add 1:1 convert, add es.po: thx sergio, cwdw zoom tweak, add done beep pots, bd forma...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / bdcreate.C
index dcae332dfd7be715481b1cc2023ebfe485e6f9d9..e18ebee3cc830cf40bf9e20f37e1b5b8ed925c2b 100644 (file)
@@ -41,9 +41,10 @@ static struct bd_format {
 } bd_formats[] = {
 // framerates are frames, not fields, per second, *=not standard
        { "1920x1080 29.97i",   1920,1080, 29.97,  1, ILACE_MODE_TOP_FIRST },
-       { "1920x1080 29.97p*",  1920,1080, 29.97,  1, ILACE_MODE_NOTINTERLACED },
+       { "1920x1080 29.97p*",  1920,1080, 29.97,  1, ILACE_MODE_FAKE_INTERLACE },
        { "1920x1080 24p",      1920,1080, 24.,    1, ILACE_MODE_NOTINTERLACED },
        { "1920x1080 25i",      1920,1080, 25.,    1, ILACE_MODE_TOP_FIRST },
+       { "1920x1080 25p*",     1920,1080, 25.,    1, ILACE_MODE_FAKE_INTERLACE },
        { "1920x1080 23.976p",  1920,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED },
        { "1440x1080 29.97i",   1440,1080, 29.97, -1, ILACE_MODE_TOP_FIRST },
        { "1440x1080 25i",      1440,1080, 25.,   -1, ILACE_MODE_TOP_FIRST },
@@ -51,6 +52,8 @@ static struct bd_format {
        { "1440x1080 23.976p",  1440,1080, 23.976,-1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  59.94p",   1280,720,  59.94,  1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  50p",      1280,720,  50.,    1, ILACE_MODE_NOTINTERLACED },
+       { "1280x720  29.97p*",  1280,720,  29.97,  1, ILACE_MODE_NOTINTERLACED },
+       { "1280x720  25p*",     1280,720,  25.,    1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  24p",      1280,720,  24.,    1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  23.976p",  1280,720,  23.976, 1, ILACE_MODE_NOTINTERLACED },
        { "720x576   25i",       720,576,  25.,    0, ILACE_MODE_BOTTOM_FIRST },
@@ -164,7 +167,8 @@ char *BD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls)
        int is_usr_mnt = get_udfs_mount(udfs, mopts, mntpt);
        const char *exec_path = File::get_cinlib_path();
        fprintf(fp,"#!/bin/bash -ex\n");
-       fprintf(fp,"dir=`dirname $0`\n");
+       fprintf(fp,"sdir=`dirname $0`\n");
+       fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n");
        fprintf(fp,"PATH=$PATH:%s\n",exec_path);
        fprintf(fp,"mkdir -p $dir/udfs\n");
        fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ \t].*//'`\n");
@@ -319,21 +323,17 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs, const char
        asset->ff_audio_bitrate = bd_kaudio_rate * 1000;
 
        asset->video_data = 1;
-       strcpy(asset->vcodec, "bluray.m2ts");
+       const char *vcodec = "bluray.m2ts";
+       switch( asset->interlace_mode ) {
+       case ILACE_MODE_TOP_FIRST:    vcodec = "bluray_tff.m2ts";  break;
+       case ILACE_MODE_BOTTOM_FIRST: vcodec = "bluray_bff.m2ts";  break;
+       case ILACE_MODE_FAKE_INTERLACE : vcodec = "bluray_fakeinterlace.m2ts";  break;
+       }
+       strcpy(asset->vcodec, vcodec);
        //mwindow->defaults->get("DEFAULT_BLURAY_VCODEC", asset->vcodec);
        FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
        FFMPEG::load_options(option_path, asset->ff_video_options,
                 sizeof(asset->ff_video_options));
-       const char *opts = 0;
-       switch( asset->interlace_mode ) {
-       case ILACE_MODE_TOP_FIRST:    opts = ":tff\n";  break;
-       case ILACE_MODE_BOTTOM_FIRST: opts = ":bff\n";  break;
-       }
-       if( opts ) {
-               int len = strlen(asset->ff_video_options);
-               char *cp = asset->ff_video_options + len-1;
-               strncpy(cp, opts, sizeof(asset->ff_video_options)-len);
-       }
        asset->ff_video_bitrate = vid_bitrate;
        asset->ff_video_quality = -1;
        return 0;
@@ -477,7 +477,7 @@ BC_Window* CreateBD_Thread::new_gui()
        int scr_x = mwindow->gui->get_screen_x(0, -1);
        int scr_w = mwindow->gui->get_screen_w(0, -1);
        int scr_h = mwindow->gui->get_screen_h(0, -1);
-       int w = 500, h = 290;
+       int w = xS(560), h = yS(290);
        int x = scr_x + scr_w/2 - w/2, y = scr_h/2 - h/2;
 
        gui = new CreateBD_GUI(this, x, y, w, h);
@@ -708,7 +708,7 @@ CreateBD_WideAudio::~CreateBD_WideAudio()
 
 
 CreateBD_GUI::CreateBD_GUI(CreateBD_Thread *thread, int x, int y, int w, int h)
- : BC_Window(_(PROGRAM_NAME ": Create BD"), x, y, w, h, 50, 50, 1, 0, 1)
+ : BC_Window(_(PROGRAM_NAME ": Create BD"), x, y, w, h, xS(50), yS(50), 1, 0, 1)
 {
        this->thread = thread;
        at_x = at_y = tmp_x = tmp_y = 0;
@@ -738,20 +738,23 @@ CreateBD_GUI::~CreateBD_GUI()
 
 void CreateBD_GUI::create_objects()
 {
+       int xs10 = xS(10), xs35 = xS(35);
+       int xs160 = xS(160), xs170 = xS(170);
+       int ys5 = yS(5), ys10 = yS(10);
        lock_window("CreateBD_GUI::create_objects");
-       int pady = BC_TextBox::calculate_h(this, MEDIUMFONT, 0, 1) + 5;
+       int pady = BC_TextBox::calculate_h(this, MEDIUMFONT, 0, 1) + ys5;
        int padx = BC_Title::calculate_w(this, (char*)"X", MEDIUMFONT);
        int x = padx/2, y = pady/2;
        BC_Title *title = new BC_Title(x, y, _("Title:"), MEDIUMFONT, YELLOW);
        add_subwindow(title);
        at_x = x + title->get_w();  at_y = y;
-       asset_title = new CreateBD_AssetTitle(this, at_x, at_y, get_w()-at_x-10);
+       asset_title = new CreateBD_AssetTitle(this, at_x, at_y, get_w()-at_x-xs10);
        add_subwindow(asset_title);
        y += title->get_h() + pady/2;
        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-35);
+       tmp_path = new CreateBD_TmpPath(this, tmp_x, tmp_y,  get_w()-tmp_x-xs35);
        add_subwindow(tmp_path);
        btmp_path = new BrowseButton(thread->mwindow->theme, this, tmp_path,
                tmp_x+tmp_path->get_w(), tmp_y, "/tmp",
@@ -760,7 +763,7 @@ void CreateBD_GUI::create_objects()
        y += title->get_h() + pady/2;
        disk_space = new CreateBD_DiskSpace(this, x, y);
        add_subwindow(disk_space);
-       int x0 = get_w() - 170;
+       int x0 = get_w() - xs170;
        title = new BC_Title(x0, y, _("Media:"), MEDIUMFONT, YELLOW);
        add_subwindow(title);
        int x1 =  x0+title->get_w()+padx;
@@ -778,7 +781,7 @@ void CreateBD_GUI::create_objects()
        add_subwindow(standard);
        standard->create_objects();
        standard->set_text(bd_formats[thread->use_standard].name);
-       x0 -= 30;
+       x0 -= xS(60);
        title = new BC_Title(x0, y, _("Scale:"), MEDIUMFONT, YELLOW);
        add_subwindow(title);
        x1 = x0+title->get_w()+padx;
@@ -793,9 +796,9 @@ void CreateBD_GUI::create_objects()
        need_histogram = new CreateBD_Histogram(this, x1, y);
        add_subwindow(need_histogram);
        y += need_histogram->get_h() + pady/2;
-       non_standard = new BC_Title(x1, y+5, "", MEDIUMFONT, RED);
+       non_standard = new BC_Title(x1, y+ys5, "", MEDIUMFONT, RED);
        add_subwindow(non_standard);
-       x1 += 160;  y = y1;
+       x1 += xs160;  y = y1;
        need_inverse_telecine = new CreateBD_InverseTelecine(this, x1, y);
        add_subwindow(need_inverse_telecine);
        y += need_inverse_telecine->get_h() + pady/2;
@@ -804,7 +807,7 @@ void CreateBD_GUI::create_objects()
        y += need_wide_audio->get_h() + pady/2;
        need_resize_tracks = new CreateBD_ResizeTracks(this, x1, y);
        add_subwindow(need_resize_tracks);
-       x1 += 160;  y = y1;
+       x1 += xs160;  y = y1;
        need_labeled = new CreateBD_LabelChapters(this, x1, y);
        add_subwindow(need_labeled);
        y += need_labeled->get_h() + pady/2;
@@ -812,14 +815,14 @@ void CreateBD_GUI::create_objects()
        add_subwindow(need_farmed);
        ok_w = BC_OKButton::calculate_w();
        ok_h = BC_OKButton::calculate_h();
-       ok_x = 10;
-       ok_y = get_h() - ok_h - 10;
+       ok_x = xs10;
+       ok_y = get_h() - ok_h - xs10;
        ok = new CreateBD_OK(this, ok_x, ok_y);
        add_subwindow(ok);
        cancel_w = BC_CancelButton::calculate_w();
        cancel_h = BC_CancelButton::calculate_h();
-       cancel_x = get_w() - cancel_w - 10,
-       cancel_y = get_h() - cancel_h - 10;
+       cancel_x = get_w() - cancel_w - xs10,
+       cancel_y = get_h() - cancel_h - ys10;
        cancel = new CreateBD_Cancel(this, cancel_x, cancel_y);
        add_subwindow(cancel);
        show_window();
@@ -828,13 +831,15 @@ 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-35);
+       int xs10 = xS(10), xs35 = xS(35);
+       int ys10 = yS(10);
+       asset_title->reposition_window(at_x, at_y, get_w()-at_x-xs10);
+       tmp_path->reposition_window(tmp_x, tmp_y,  get_w()-tmp_x-xs35);
        btmp_path->reposition_window(tmp_x+tmp_path->get_w(), tmp_y);
-       ok_y = h - ok_h - 10;
+       ok_y = h - ok_h - ys10;
        ok->reposition_window(ok_x, ok_y);
-       cancel_x = w - cancel_w - 10,
-       cancel_y = h - cancel_h - 10;
+       cancel_x = w - cancel_w - xs10,
+       cancel_y = h - cancel_h - ys10;
        cancel->reposition_window(cancel_x, cancel_y);
        return 0;
 }
@@ -1017,7 +1022,7 @@ int CreateBD_FormatItem::handle_event()
 
 
 CreateBD_Format::CreateBD_Format(CreateBD_GUI *gui, int x, int y)
- : BC_PopupMenu(x, y, 180, bd_formats[gui->thread->use_standard].name, 1)
+ : BC_PopupMenu(x, y, xS(200), bd_formats[gui->thread->use_standard].name, 1)
 {
        this->gui = gui;
 }
@@ -1072,7 +1077,7 @@ int CreateBD_ScaleItem::handle_event()
 
 
 CreateBD_Scale::CreateBD_Scale(CreateBD_GUI *gui, int x, int y)
- : BC_PopupMenu(x, y, 100, "", 1)
+ : BC_PopupMenu(x, y, xS(140), "", 1)
 {
        this->gui = gui;
 }
@@ -1098,7 +1103,7 @@ int CreateBD_Scale::handle_event()
 
 
 CreateBD_MediaSize::CreateBD_MediaSize(CreateBD_GUI *gui, int x, int y)
- : BC_PopupTextBox(gui, 0, 0, x, y, 70,50)
+ : BC_PopupTextBox(gui, 0, 0, x, y, xS(70),yS(50))
 {
        this->gui = gui;
 }