ffmpeg param visibility, high422 x264 profile, bd/dvd enhancements
[goodguy/history.git] / cinelerra-5.1 / cinelerra / bdcreate.C
index 279449e04a141ca9b566f42a9f91d45669c6fe1b..d487830c9d7dcd781827aa2fcabea14f478c5339 100644 (file)
@@ -30,7 +30,7 @@
 #define BD_1920x1080_2500i     1
 #define BD_1920x1080_2400p     2
 #define BD_1920x1080_23976p    3
-#define BD_1280x720_5997p      4
+#define BD_1280x720_5994p      4
 #define BD_1280x720_5000p      5
 #define BD_1280x720_23976p     6
 #define BD_1280x720_2400p      7
@@ -46,7 +46,7 @@ static struct bd_format {
        { "1920x1080 25i",        1920,1080, 25     },
        { "1920x1080 24p",        1920,1080, 24     },
        { "1920x1080 23.976p",    1920,1080, 23.976 },
-       { "1280x720 59.97p",      1280,720,  59.97  },
+       { "1280x720 59.94p",      1280,720,  59.94  },
        { "1280x720 50p",         1280,720,  50     },
        { "1280x720 23.976p",     1280,720,  23.976 },
        { "1280x720 24p",         1280,720,  24     },
@@ -98,6 +98,17 @@ CreateBD_Thread::CreateBD_Thread(MWindow *mwindow)
        this->use_wide_aspect = 0;
        this->use_resize_tracks = 0;
        this->use_label_chapters = 0;
+
+       this->bd_size = BD_SIZE;
+       this->bd_width = BD_WIDTH;
+       this->bd_height = BD_HEIGHT;
+       this->bd_aspect_width = BD_ASPECT_WIDTH;
+       this->bd_aspect_height = BD_ASPECT_HEIGHT;
+       this->bd_framerate = BD_FRAMERATE;
+       this->bd_samplerate = BD_SAMPLERATE;
+       this->bd_max_bitrate = BD_MAX_BITRATE;
+       this->bd_kaudio_rate = BD_KAUDIO_RATE;
+       this->max_w = this->max_h = 0;
 }
 
 CreateBD_Thread::~CreateBD_Thread()
@@ -173,7 +184,8 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
        fprintf(fp,"bdwrite $1/udfs $1/bd.m2ts\n");
        fprintf(fp,"umount $1/udfs\n");
        fprintf(fp,"echo To burn bluray, load writable media and run:\n");
-       fprintf(fp,"echo growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n");
+       fprintf(fp,"echo for WORM: growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n");
+       fprintf(fp,"echo for RW:   dd if=$1/bd.udfs of=/dev/bd bs=2048000\n");
        fprintf(fp,"\n");
        fclose(fp);
 
@@ -278,8 +290,12 @@ void CreateBD_Thread::handle_close_event(int result)
                insert_video_plugin("Inverse Telecine", &keyframe);
        }
        if( use_scale ) {
-               sprintf(data,"<SCALE TYPE=1 X_FACTOR=1 Y_FACTOR=1 "
-                       " WIDTH=%d HEIGHT=%d CONSTRAIN=0>", bd_width, bd_height);
+               sprintf(data,"<SCALE TYPE=%d X_FACTOR=%f Y_FACTOR=%f "
+                       "WIDTH=%d HEIGHT=%d CONSTRAIN=0>",
+                       max_w >= bd_width || max_h >= bd_height ? 1 : 0,
+                       max_w > 0 ? (double)bd_width/max_w : 1,
+                       max_h > 0 ? (double)bd_height/max_h : 1,
+                       bd_width, bd_height);
                keyframe.set_data(data);
                insert_video_plugin("Scale", &keyframe);
        }
@@ -345,6 +361,7 @@ BC_Window* CreateBD_Thread::new_gui()
        bd_samplerate = BD_SAMPLERATE;
        bd_max_bitrate = BD_MAX_BITRATE;
        bd_kaudio_rate = BD_KAUDIO_RATE;
+       max_w = 0; max_h = 0;
 
        int has_standard = -1;
        if( mwindow->edl ) {
@@ -357,7 +374,7 @@ BC_Window* CreateBD_Thread::new_gui()
                        has_standard = i;  break;
                }
        }
-       use_standard = has_standard >= 0 ? has_standard : BD_1920x1080_2400p;
+       use_standard = has_standard >= 0 ? has_standard : BD_1920x1080_23976p;
 
        option_presets();
        int scr_x = mwindow->gui->get_screen_x(0, -1);
@@ -600,6 +617,7 @@ CreateBD_GUI::CreateBD_GUI(CreateBD_Thread *thread, int x, int y, int w, int h)
        cancel_x = cancel_y = cancel_w = cancel_h = 0;
        asset_title = 0;
        tmp_path = 0;
+       btmp_path = 0;
        disk_space = 0;
        need_deinterlace = 0;
        need_inverse_telecine = 0;
@@ -629,11 +647,15 @@ void CreateBD_GUI::create_objects()
        asset_title = new CreateBD_AssetTitle(this, at_x, at_y, get_w()-at_x-10);
        add_subwindow(asset_title);
        y += title->get_h() + pady/2;
-       title = new BC_Title(x, y, _("tmp path:"), MEDIUMFONT, YELLOW);
+       title = new BC_Title(x, y, _("Work path:"), MEDIUMFONT, YELLOW);
        add_subwindow(title);
        tmp_x = x + title->get_w();  tmp_y = y;
-       tmp_path = new CreateBD_TmpPath(this, tmp_x, tmp_y,  get_w()-tmp_x-10);
+       tmp_path = new CreateBD_TmpPath(this, tmp_x, tmp_y,  get_w()-tmp_x-35);
        add_subwindow(tmp_path);
+       btmp_path = new BrowseButton(thread->mwindow, this, tmp_path,
+               tmp_x+tmp_path->get_w(), tmp_y, "/tmp",
+               _("Work path"), _("Select a Work directory:"), 1);
+       add_subwindow(btmp_path);
        y += title->get_h() + pady/2;
        disk_space = new CreateBD_DiskSpace(this, x, y);
        add_subwindow(disk_space);
@@ -695,7 +717,8 @@ void CreateBD_GUI::create_objects()
 int CreateBD_GUI::resize_event(int w, int h)
 {
        asset_title->reposition_window(at_x, at_y, get_w()-at_x-10);
-       tmp_path->reposition_window(tmp_x, tmp_y,  get_w()-tmp_x-10);
+       tmp_path->reposition_window(tmp_x, tmp_y,  get_w()-tmp_x-35);
+       btmp_path->reposition_window(tmp_x+tmp_path->get_w(), tmp_y);
        ok_y = h - ok_h - 10;
        ok->reposition_window(ok_x, ok_y);
        cancel_x = w - cancel_w - 10,
@@ -752,25 +775,14 @@ int CreateBD_Thread::
 resize_tracks()
 {
        Tracks *tracks = mwindow->edl->tracks;
-       int max_w = 0, max_h = 0;
-       for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
-               if( vtrk->data_type != TRACK_VIDEO ) continue;
-               if( !vtrk->record ) continue;
-               Edits *edits = vtrk->edits;
-               for( Edit *edit=edits->first; edit; edit=edit->next ) {
-                       Indexable *indexable = edit->get_source();
-                       int w = indexable->get_w();
-                       if( w > max_w ) max_w = w;
-                       int h = indexable->get_h();
-                       if( h > max_h ) max_h = h;
-               }
-       }
-
+       int trk_w = max_w, trk_h = max_h;
+       if( trk_w < bd_width ) trk_w = bd_width;
+       if( trk_h < bd_height ) trk_h = bd_height;
        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                if( vtrk->data_type != TRACK_VIDEO ) continue;
                if( !vtrk->record ) continue;
-               vtrk->track_w = max_w;
-               vtrk->track_h = max_h;
+               vtrk->track_w = trk_w;
+               vtrk->track_h = trk_h;
        }
        return 0;
 }
@@ -793,7 +805,7 @@ option_presets()
        bd_framerate = bd_formats[use_standard].framerate;
 
        Tracks *tracks = mwindow->edl->tracks;
-       int max_w = 0, max_h = 0;
+       max_w = 0;  max_h = 0;
        int has_deinterlace = 0, has_scale = 0;
        for( Track *trk=tracks->first; trk; trk=trk->next ) {
                if( !trk->record ) continue;