aspect ratio fixes for dvd/bd create, TZ fix
authorGood Guy <good1.2guy@gmail.com>
Thu, 3 Sep 2015 22:45:08 +0000 (16:45 -0600)
committerGood Guy <good1.2guy@gmail.com>
Thu, 3 Sep 2015 22:45:08 +0000 (16:45 -0600)
cinelerra-5.0/cinelerra/bdcreate.C
cinelerra-5.0/cinelerra/dcraw.c
cinelerra-5.0/cinelerra/dvdcreate.C
cinelerra-5.0/cinelerra/ffmpeg.C
cinelerra-5.0/cinelerra/ffmpeg.h
cinelerra-5.0/global_config

index f4f907d3f75276af0c2fac2e7e30a1e85233a8b6..ce851d2521f7ed196d37696948d273605a4d7c0a 100644 (file)
@@ -83,19 +83,19 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
        EDL *edl = mwindow->edl;
        if( !edl || !edl->session ) {
                char msg[BCTEXTLEN];
-                sprintf(msg, _("No EDL/Session"));
-                MainError::show_error(msg);
-                return 1;
-        }
+               sprintf(msg, _("No EDL/Session"));
+               MainError::show_error(msg);
+               return 1;
+       }
        EDLSession *session = edl->session;
 
        double total_length = edl->tracks->total_length();
-        if( total_length <= 0 ) {
+       if( total_length <= 0 ) {
                char msg[BCTEXTLEN];
-                sprintf(msg, _("No content: %s"), asset_title);
-                MainError::show_error(msg);
-                return 1;
-        }
+               sprintf(msg, _("No content: %s"), asset_title);
+               MainError::show_error(msg);
+               return 1;
+       }
 
        char asset_dir[BCTEXTLEN];
        sprintf(asset_dir, "%s/%s", tmp_path, asset_title);
@@ -111,16 +111,16 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
        double old_samplerate = session->sample_rate;
        double old_framerate = session->frame_rate;
 
-        session->video_channels = BD_STREAMS;
-        session->video_tracks = BD_STREAMS;
+       session->video_channels = BD_STREAMS;
+       session->video_tracks = BD_STREAMS;
 // use session framerate
-//      session->frame_rate = BD_FRAMERATE;
-        session->output_w = BD_WIDTH;
-        session->output_h = BD_HEIGHT;
-        session->aspect_w = use_wide_aspect ? BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH;
-        session->aspect_h = use_wide_aspect ? BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT;
-        session->sample_rate = BD_SAMPLERATE;
-        session->audio_channels = session->audio_tracks =
+//     session->frame_rate = BD_FRAMERATE;
+       session->output_w = BD_WIDTH;
+       session->output_h = BD_HEIGHT;
+       session->aspect_w = use_wide_aspect ? BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH;
+       session->aspect_h = use_wide_aspect ? BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT;
+       session->sample_rate = BD_SAMPLERATE;
+       session->audio_channels = session->audio_tracks =
                use_wide_audio ? BD_WIDE_CHANNELS : BD_CHANNELS;
 
        char script_filename[BCTEXTLEN];
@@ -151,7 +151,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
        fclose(fp);
 
        if( use_wide_audio ) {
-               session->audio_channels = session->audio_tracks = BD_WIDE_CHANNELS;
+               session->audio_channels = session->audio_tracks = BD_WIDE_CHANNELS;
                session->achannel_positions[0] = 90;
                session->achannel_positions[1] = 150;
                session->achannel_positions[2] = 30;
@@ -162,7 +162,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
                        mwindow->remap_audio(MWindow::AUDIO_1_TO_1);
        }
        else {
-               session->audio_channels = session->audio_tracks = BD_CHANNELS;
+               session->audio_channels = session->audio_tracks = BD_CHANNELS;
                session->achannel_positions[0] = 180;
                session->achannel_positions[1] = 0;
                if( edl->tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS )
@@ -183,10 +183,10 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
 
        char xml_filename[BCTEXTLEN];
        sprintf(xml_filename, "%s/bd.xml", asset_dir);
-        FileXML xml_file;
-        edl->save_xml(&xml_file, xml_filename, 0, 0);
-        xml_file.terminate_string();
-        if( xml_file.write_to_file(xml_filename) ) {
+       FileXML xml_file;
+       edl->save_xml(&xml_file, xml_filename, 0, 0);
+       xml_file.terminate_string();
+       if( xml_file.write_to_file(xml_filename) ) {
                char msg[BCTEXTLEN];
                sprintf(msg, _("Unable to save: %s"), xml_filename);
                MainError::show_error(msg);
@@ -216,7 +216,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
                         sizeof(asset->ff_audio_options));
        asset->ff_audio_bitrate = BD_KAUDIO_RATE * 1000;
 
-       asset->video_data = 1;
+       asset->video_data = 1;
        strcpy(asset->vcodec, "bluray.m2ts");
        FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
        FFMPEG::load_options(option_path, asset->ff_video_options,
@@ -224,11 +224,6 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs,
        asset->ff_video_bitrate = vid_bitrate;
        asset->ff_video_quality = 0;
 
-       int len = strlen(asset->ff_video_options);
-       char *cp = asset->ff_video_options + len;
-       snprintf(cp, sizeof(asset->ff_video_options)-len-1,
-               "aspect %.5f\n", asset->aspect_ratio);
-
        job = new BatchRenderJob(mwindow->preferences);
        jobs->append(job);
        job->edl_path[0] = '@';
@@ -242,7 +237,7 @@ void CreateBD_Thread::handle_close_event(int result)
 {
        if( result ) return;
        mwindow->batch_render->load_defaults(mwindow->defaults);
-        mwindow->undo->update_undo_before();
+       mwindow->undo->update_undo_before();
        KeyFrame keyframe;  char data[BCTEXTLEN];
        if( use_deinterlace ) {
                sprintf(data,"<DEINTERLACE MODE=1>");
@@ -311,10 +306,10 @@ BC_Window* CreateBD_Thread::new_gui()
        use_wide_aspect = 0;
        use_label_chapters = 0;
        option_presets();
-        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 = 250;
+       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 = 250;
        int x = scr_x + scr_w/2 - w/2, y = scr_h/2 - h/2;
 
        gui = new CreateBD_GUI(this, x, y, w, h);
@@ -326,8 +321,8 @@ BC_Window* CreateBD_Thread::new_gui()
 CreateBD_OK::CreateBD_OK(CreateBD_GUI *gui, int x, int y)
  : BC_OKButton(x, y)
 {
-        this->gui = gui;
-        set_tooltip(_("end setup, start batch render"));
+       this->gui = gui;
+       set_tooltip(_("end setup, start batch render"));
 }
 
 CreateBD_OK::~CreateBD_OK()
@@ -336,23 +331,23 @@ CreateBD_OK::~CreateBD_OK()
 
 int CreateBD_OK::button_press_event()
 {
-        if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
-                gui->set_done(0);
-                return 1;
-        }
-        return 0;
+       if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
+               gui->set_done(0);
+               return 1;
+       }
+       return 0;
 }
 
 int CreateBD_OK::keypress_event()
 {
-        return 0;
+       return 0;
 }
 
 
 CreateBD_Cancel::CreateBD_Cancel(CreateBD_GUI *gui, int x, int y)
  : BC_CancelButton(x, y)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateBD_Cancel::~CreateBD_Cancel()
@@ -361,18 +356,18 @@ CreateBD_Cancel::~CreateBD_Cancel()
 
 int CreateBD_Cancel::button_press_event()
 {
-        if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
-                gui->set_done(1);
-                return 1;
-        }
-        return 0;
+       if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
+               gui->set_done(1);
+               return 1;
+       }
+       return 0;
 }
 
 
 CreateBD_DiskSpace::CreateBD_DiskSpace(CreateBD_GUI *gui, int x, int y)
  : BC_Title(x, y, "", MEDIUMFONT, GREEN)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateBD_DiskSpace::~CreateBD_DiskSpace()
@@ -406,7 +401,7 @@ CreateBD_TmpPath::CreateBD_TmpPath(CreateBD_GUI *gui, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, -(int)sizeof(gui->thread->tmp_path),
                gui->thread->tmp_path, 1, MEDIUMFONT)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateBD_TmpPath::~CreateBD_TmpPath()
@@ -416,14 +411,14 @@ CreateBD_TmpPath::~CreateBD_TmpPath()
 int CreateBD_TmpPath::handle_event()
 {
        gui->disk_space->update();
-        return 1;
+       return 1;
 }
 
 
 CreateBD_AssetTitle::CreateBD_AssetTitle(CreateBD_GUI *gui, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, 0, gui->thread->asset_title, 1, MEDIUMFONT)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateBD_AssetTitle::~CreateBD_AssetTitle()
@@ -623,11 +618,11 @@ 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);
-        ok_y = h - ok_h - 10;
-        ok->reposition_window(ok_x, ok_y);
+       ok_y = h - ok_h - 10;
+       ok->reposition_window(ok_x, ok_y);
        cancel_x = w - cancel_w - 10,
        cancel_y = h - cancel_h - 10;
-        cancel->reposition_window(cancel_x, cancel_y);
+       cancel->reposition_window(cancel_x, cancel_y);
        return 0;
 }
 
@@ -638,8 +633,8 @@ int CreateBD_GUI::translation_event()
 
 int CreateBD_GUI::close_event()
 {
-        set_done(1);
-        return 1;
+       set_done(1);
+       return 1;
 }
 
 int CreateBD_Thread::
@@ -660,16 +655,16 @@ insert_video_plugin(const char *title, KeyFrame *default_keyframe)
                }
                vtrk->optimize();
        }
-        return 0;
+       return 0;
 }
 
 int CreateBD_Thread::
 resize_tracks()
 {
-        Tracks *tracks = mwindow->edl->tracks;
+       Tracks *tracks = mwindow->edl->tracks;
 #if 0
        int max_w = 0, max_h = 0;
-        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
+       for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                if( vtrk->data_type != TRACK_VIDEO ) continue;
                if( !vtrk->record ) continue;
                Edits *edits = vtrk->edits;
@@ -680,25 +675,25 @@ resize_tracks()
                        int h = indexable->get_h();
                        if( h > max_h ) max_h = h;
                }
-        }
+       }
 #endif
-        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
-                if( vtrk->data_type != TRACK_VIDEO ) continue;
-                if( !vtrk->record ) continue;
+       for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
+               if( vtrk->data_type != TRACK_VIDEO ) continue;
+               if( !vtrk->record ) continue;
                vtrk->track_w = BD_WIDTH; // max_w;
                vtrk->track_h = BD_HEIGHT; // max_h;
        }
-        return 0;
+       return 0;
 }
 
 int CreateBD_Thread::
 option_presets()
 {
        if( !mwindow->edl ) return 1;
-        Tracks *tracks = mwindow->edl->tracks;
+       Tracks *tracks = mwindow->edl->tracks;
        int max_w = 0, max_h = 0;
        int has_deinterlace = 0, has_scale = 0;
-        for( Track *trk=tracks->first; trk; trk=trk->next ) {
+       for( Track *trk=tracks->first; trk; trk=trk->next ) {
                if( !trk->record ) continue;
                Edits *edits = trk->edits;
                switch( trk->data_type ) {
@@ -714,8 +709,8 @@ option_presets()
                        }
                        for( int i=0; i<trk->plugin_set.size(); ++i ) {
                                for(Plugin *plugin = (Plugin*)trk->plugin_set[i]->first;
-                                                plugin;
-                                                plugin = (Plugin*)plugin->next) {
+                                               plugin;
+                                               plugin = (Plugin*)plugin->next) {
                                        if( !strcmp(plugin->title, "Deinterlace") )
                                                has_deinterlace = 1;
                                        if( !strcmp(plugin->title, "Auto Scale") ||
@@ -725,14 +720,14 @@ option_presets()
                        }
                        break;
                }
-        }
+       }
        if( has_scale )
                use_scale = 0;
        if( use_scale ) {
                if( max_w != BD_WIDTH ) use_resize_tracks = 1;
                if( max_h != BD_HEIGHT ) use_resize_tracks = 1;
        }
-        for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
+       for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
                if( !trk->record ) continue;
                switch( trk->data_type ) {
                case TRACK_VIDEO:
@@ -740,7 +735,7 @@ option_presets()
                        if( trk->track_h != max_h ) use_resize_tracks = 1;
                        break;
                }
-        }
+       }
        if( !has_deinterlace && max_h > 2*BD_HEIGHT ) use_deinterlace = 1;
        // Labels *labels = mwindow->edl->labels;
        // use_label_chapters = labels && labels->first ? 1 : 0;
index 0f46aba28791389a9b171402a6e2e02a93844ea4..300849b3f34e869bc4ff6fe53f582d26d548279c 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #define DCRAW_VERSION "9.17"
+#define LOCALTIME
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
index a94770368cd6e9bd0f37f5e32a497003d1b658b0..3eac2aeaa2a42c307326a47f2802f83117b11c65 100644 (file)
@@ -83,19 +83,19 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
        EDL *edl = mwindow->edl;
        if( !edl || !edl->session ) {
                char msg[BCTEXTLEN];
-                sprintf(msg, _("No EDL/Session"));
-                MainError::show_error(msg);
-                return 1;
-        }
+               sprintf(msg, _("No EDL/Session"));
+               MainError::show_error(msg);
+               return 1;
+       }
        EDLSession *session = edl->session;
 
        double total_length = edl->tracks->total_length();
-        if( total_length <= 0 ) {
+       if( total_length <= 0 ) {
                char msg[BCTEXTLEN];
-                sprintf(msg, _("No content: %s"), asset_title);
-                MainError::show_error(msg);
-                return 1;
-        }
+               sprintf(msg, _("No content: %s"), asset_title);
+               MainError::show_error(msg);
+               return 1;
+       }
 
        char asset_dir[BCTEXTLEN];
        sprintf(asset_dir, "%s/%s", tmp_path, asset_title);
@@ -111,15 +111,15 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
        double old_samplerate = session->sample_rate;
        double old_framerate = session->frame_rate;
 
-        session->video_channels = DVD_STREAMS;
-        session->video_tracks = DVD_STREAMS;
-        session->frame_rate = DVD_FRAMERATE;
-        session->output_w = DVD_WIDTH;
-        session->output_h = DVD_HEIGHT;
-        session->aspect_w = use_wide_aspect ? DVD_WIDE_ASPECT_WIDTH : DVD_ASPECT_WIDTH;
-        session->aspect_h = use_wide_aspect ? DVD_WIDE_ASPECT_HEIGHT : DVD_ASPECT_HEIGHT;
-        session->sample_rate = DVD_SAMPLERATE;
-        session->audio_channels = session->audio_tracks =
+       session->video_channels = DVD_STREAMS;
+       session->video_tracks = DVD_STREAMS;
+       session->frame_rate = DVD_FRAMERATE;
+       session->output_w = DVD_WIDTH;
+       session->output_h = DVD_HEIGHT;
+       session->aspect_w = use_wide_aspect ? DVD_WIDE_ASPECT_WIDTH : DVD_ASPECT_WIDTH;
+       session->aspect_h = use_wide_aspect ? DVD_WIDE_ASPECT_HEIGHT : DVD_ASPECT_HEIGHT;
+       session->sample_rate = DVD_SAMPLERATE;
+       session->audio_channels = session->audio_tracks =
                use_wide_audio ? DVD_WIDE_CHANNELS : DVD_CHANNELS;
 
        char script_filename[BCTEXTLEN];
@@ -190,7 +190,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
        fclose(fp);
 
        if( use_wide_audio ) {
-               session->audio_channels = session->audio_tracks = DVD_WIDE_CHANNELS;
+               session->audio_channels = session->audio_tracks = DVD_WIDE_CHANNELS;
                session->achannel_positions[0] = 90;
                session->achannel_positions[1] = 150;
                session->achannel_positions[2] = 30;
@@ -201,7 +201,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
                        mwindow->remap_audio(MWindow::AUDIO_1_TO_1);
        }
        else {
-               session->audio_channels = session->audio_tracks = DVD_CHANNELS;
+               session->audio_channels = session->audio_tracks = DVD_CHANNELS;
                session->achannel_positions[0] = 180;
                session->achannel_positions[1] = 0;
                if( edl->tracks->recordable_audio_tracks() == DVD_WIDE_CHANNELS )
@@ -222,10 +222,10 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
 
        char xml_filename[BCTEXTLEN];
        sprintf(xml_filename, "%s/dvd.xml", asset_dir);
-        FileXML xml_file;
-        edl->save_xml(&xml_file, xml_filename, 0, 0);
-        xml_file.terminate_string();
-        if( xml_file.write_to_file(xml_filename) ) {
+       FileXML xml_file;
+       edl->save_xml(&xml_file, xml_filename, 0, 0);
+       xml_file.terminate_string();
+       if( xml_file.write_to_file(xml_filename) ) {
                char msg[BCTEXTLEN];
                sprintf(msg, _("Unable to save: %s"), xml_filename);
                MainError::show_error(msg);
@@ -249,29 +249,24 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
                asset->format = FILE_FFMPEG;
                strcpy(asset->fformat, "dvd");
 
-               asset->audio_data = 1;
+               asset->audio_data = 1;
                strcpy(asset->acodec, "dvd.dvd");
                FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
                FFMPEG::load_options(option_path, asset->ff_audio_options,
                         sizeof(asset->ff_audio_options));
                asset->ff_audio_bitrate = DVD_KAUDIO_RATE * 1000;
 
-               asset->video_data = 1;
+               asset->video_data = 1;
                strcpy(asset->vcodec, "dvd.dvd");
                FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
                FFMPEG::load_options(option_path, asset->ff_video_options,
                         sizeof(asset->ff_video_options));
                asset->ff_video_bitrate = vid_bitrate;
                asset->ff_video_quality = 0;
-
-               int len = strlen(asset->ff_video_options);
-               char *cp = asset->ff_video_options + len;
-               snprintf(cp, sizeof(asset->ff_video_options)-len-1,
-                       "aspect %.5f\n", asset->aspect_ratio);
        }
        else {
                sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir);
-               asset->video_data = 1;
+               asset->video_data = 1;
                asset->format = FILE_VMPEG;
                asset->vmpeg_cmodel = BC_YUV420P;
                asset->vmpeg_fix_bitrate = 1;
@@ -291,7 +286,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
                asset = job->asset;
                
                sprintf(&asset->path[0],"%s/dvd.ac3", asset_dir);
-               asset->audio_data = 1;
+               asset->audio_data = 1;
                asset->format = FILE_AC3;
                asset->channels = session->audio_channels;
                asset->sample_rate = session->sample_rate;
@@ -316,7 +311,7 @@ void CreateDVD_Thread::handle_close_event(int result)
 {
        if( result ) return;
        mwindow->batch_render->load_defaults(mwindow->defaults);
-        mwindow->undo->update_undo_before();
+       mwindow->undo->update_undo_before();
        KeyFrame keyframe;  char data[BCTEXTLEN];
        if( use_deinterlace ) {
                sprintf(data,"<DEINTERLACE MODE=1>");
@@ -371,7 +366,7 @@ BC_Window* CreateDVD_Thread::new_gui()
        memset(tmp_path,0,sizeof(tmp_path));
        strcpy(tmp_path,"/tmp");
        memset(asset_title,0,sizeof(asset_title));
-       time_t dt;      time(&dt);
+       time_t dt;  time(&dt);
        struct tm dtm;  localtime_r(&dt, &dtm);
        sprintf(asset_title, "dvd_%02d%02d%02d-%02d%02d%02d",
                dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
@@ -386,10 +381,10 @@ BC_Window* CreateDVD_Thread::new_gui()
        use_label_chapters = 0;
        use_ffmpeg = 0;
        option_presets();
-        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 = 250;
+       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 = 250;
        int x = scr_x + scr_w/2 - w/2, y = scr_h/2 - h/2;
 
        gui = new CreateDVD_GUI(this, x, y, w, h);
@@ -401,8 +396,8 @@ BC_Window* CreateDVD_Thread::new_gui()
 CreateDVD_OK::CreateDVD_OK(CreateDVD_GUI *gui, int x, int y)
  : BC_OKButton(x, y)
 {
-        this->gui = gui;
-        set_tooltip(_("end setup, start batch render"));
+       this->gui = gui;
+       set_tooltip(_("end setup, start batch render"));
 }
 
 CreateDVD_OK::~CreateDVD_OK()
@@ -411,23 +406,23 @@ CreateDVD_OK::~CreateDVD_OK()
 
 int CreateDVD_OK::button_press_event()
 {
-        if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
-                gui->set_done(0);
-                return 1;
-        }
-        return 0;
+       if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
+               gui->set_done(0);
+               return 1;
+       }
+       return 0;
 }
 
 int CreateDVD_OK::keypress_event()
 {
-        return 0;
+       return 0;
 }
 
 
 CreateDVD_Cancel::CreateDVD_Cancel(CreateDVD_GUI *gui, int x, int y)
  : BC_CancelButton(x, y)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateDVD_Cancel::~CreateDVD_Cancel()
@@ -436,18 +431,18 @@ CreateDVD_Cancel::~CreateDVD_Cancel()
 
 int CreateDVD_Cancel::button_press_event()
 {
-        if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
-                gui->set_done(1);
-                return 1;
-        }
-        return 0;
+       if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) {
+               gui->set_done(1);
+               return 1;
+       }
+       return 0;
 }
 
 
 CreateDVD_DiskSpace::CreateDVD_DiskSpace(CreateDVD_GUI *gui, int x, int y)
  : BC_Title(x, y, "", MEDIUMFONT, GREEN)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateDVD_DiskSpace::~CreateDVD_DiskSpace()
@@ -481,7 +476,7 @@ CreateDVD_TmpPath::CreateDVD_TmpPath(CreateDVD_GUI *gui, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, -(int)sizeof(gui->thread->tmp_path),
                gui->thread->tmp_path, 1, MEDIUMFONT)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateDVD_TmpPath::~CreateDVD_TmpPath()
@@ -491,14 +486,14 @@ CreateDVD_TmpPath::~CreateDVD_TmpPath()
 int CreateDVD_TmpPath::handle_event()
 {
        gui->disk_space->update();
-        return 1;
+       return 1;
 }
 
 
 CreateDVD_AssetTitle::CreateDVD_AssetTitle(CreateDVD_GUI *gui, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, 0, gui->thread->asset_title, 1, MEDIUMFONT)
 {
-        this->gui = gui;
+       this->gui = gui;
 }
 
 CreateDVD_AssetTitle::~CreateDVD_AssetTitle()
@@ -711,11 +706,11 @@ int CreateDVD_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);
-        ok_y = h - ok_h - 10;
-        ok->reposition_window(ok_x, ok_y);
+       ok_y = h - ok_h - 10;
+       ok->reposition_window(ok_x, ok_y);
        cancel_x = w - cancel_w - 10,
        cancel_y = h - cancel_h - 10;
-        cancel->reposition_window(cancel_x, cancel_y);
+       cancel->reposition_window(cancel_x, cancel_y);
        return 0;
 }
 
@@ -726,8 +721,8 @@ int CreateDVD_GUI::translation_event()
 
 int CreateDVD_GUI::close_event()
 {
-        set_done(1);
-        return 1;
+       set_done(1);
+       return 1;
 }
 
 int CreateDVD_Thread::
@@ -748,16 +743,16 @@ insert_video_plugin(const char *title, KeyFrame *default_keyframe)
                }
                vtrk->optimize();
        }
-        return 0;
+       return 0;
 }
 
 int CreateDVD_Thread::
 resize_tracks()
 {
-        Tracks *tracks = mwindow->edl->tracks;
+       Tracks *tracks = mwindow->edl->tracks;
 #if 0
        int max_w = 0, max_h = 0;
-        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
+       for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                if( vtrk->data_type != TRACK_VIDEO ) continue;
                if( !vtrk->record ) continue;
                Edits *edits = vtrk->edits;
@@ -768,25 +763,25 @@ resize_tracks()
                        int h = indexable->get_h();
                        if( h > max_h ) max_h = h;
                }
-        }
+       }
 #endif
-        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
-                if( vtrk->data_type != TRACK_VIDEO ) continue;
-                if( !vtrk->record ) continue;
+       for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
+               if( vtrk->data_type != TRACK_VIDEO ) continue;
+               if( !vtrk->record ) continue;
                vtrk->track_w = DVD_WIDTH; // max_w;
                vtrk->track_h = DVD_HEIGHT; // max_h;
        }
-        return 0;
+       return 0;
 }
 
 int CreateDVD_Thread::
 option_presets()
 {
        if( !mwindow->edl ) return 1;
-        Tracks *tracks = mwindow->edl->tracks;
+       Tracks *tracks = mwindow->edl->tracks;
        int max_w = 0, max_h = 0;
        int has_deinterlace = 0, has_scale = 0;
-        for( Track *trk=tracks->first; trk; trk=trk->next ) {
+       for( Track *trk=tracks->first; trk; trk=trk->next ) {
                if( !trk->record ) continue;
                Edits *edits = trk->edits;
                switch( trk->data_type ) {
@@ -802,8 +797,8 @@ option_presets()
                        }
                        for( int i=0; i<trk->plugin_set.size(); ++i ) {
                                for(Plugin *plugin = (Plugin*)trk->plugin_set[i]->first;
-                                                plugin;
-                                                plugin = (Plugin*)plugin->next) {
+                                               plugin;
+                                               plugin = (Plugin*)plugin->next) {
                                        if( !strcmp(plugin->title, "Deinterlace") )
                                                has_deinterlace = 1;
                                        if( !strcmp(plugin->title, "Auto Scale") ||
@@ -813,14 +808,14 @@ option_presets()
                        }
                        break;
                }
-        }
+       }
        if( has_scale )
                use_scale = 0;
        if( use_scale ) {
                if( max_w != DVD_WIDTH ) use_resize_tracks = 1;
                if( max_h != DVD_HEIGHT ) use_resize_tracks = 1;
        }
-        for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
+       for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
                if( !trk->record ) continue;
                switch( trk->data_type ) {
                case TRACK_VIDEO:
@@ -828,7 +823,7 @@ option_presets()
                        if( trk->track_h != max_h ) use_resize_tracks = 1;
                        break;
                }
-        }
+       }
        if( !has_deinterlace && max_h > 2*DVD_HEIGHT ) use_deinterlace = 1;
        Labels *labels = mwindow->edl->labels;
        use_label_chapters = labels && labels->first ? 1 : 0;
index b1272467a1c1e04cab8432b214ee143cc3e3f303..de983a3a4b5032b4c5241c1770a6855f3725684a 100644 (file)
@@ -984,13 +984,15 @@ AVRational FFMPEG::check_frame_rate(AVCodec *codec, double frame_rate)
        return max_err < 0.0001 ? best_rate : (AVRational) { 0, 0 };
 }
 
-AVRational FFMPEG::to_sample_aspect_ratio(double aspect_ratio)
+AVRational FFMPEG::to_sample_aspect_ratio(Asset *asset)
 {
 #if 1
-       int height = 1000000, width = height * aspect_ratio;
+       double display_aspect = asset->width / (double)asset->height;
+       double sample_aspect = asset->aspect_ratio / display_aspect;
+       int width = 1000000, height = width * sample_aspect + 0.5;
        float w, h;
        MWindow::create_aspect_ratio(w, h, width, height);
-       return (AVRational){(int)w, (int)h};
+       return (AVRational){(int)h, (int)w};
 #else
 // square pixels
        return (AVRational){1, 1};
@@ -1566,7 +1568,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                        vid->height = asset->height;
                        ctx->height = (vid->height+3) & ~3;
                        vid->frame_rate = asset->frame_rate;
-                       ctx->sample_aspect_ratio = to_sample_aspect_ratio(asset->aspect_ratio);
+                       ctx->sample_aspect_ratio = to_sample_aspect_ratio(asset);
                        ctx->pix_fmt = codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
                        AVRational frame_rate = check_frame_rate(codec, vid->frame_rate);
                        if( !frame_rate.num || !frame_rate.den ) {
index 931e9c4d8902990747613a304a56dca04fbc516f..8400751bc5f63329f8c6271c2d509f88e7675b79 100644 (file)
@@ -227,7 +227,7 @@ public:
 
        int check_sample_rate(AVCodec *codec, int sample_rate);
        AVRational check_frame_rate(AVCodec *codec, double frame_rate);
-       AVRational to_sample_aspect_ratio(double aspect_ratio);
+       AVRational to_sample_aspect_ratio(Asset *asset);
        AVRational to_time_base(int sample_rate);
 
        static void set_option_path(char *path, const char *fmt, ...);
index 623a0e3348d860b14a1c71f25fb700042a5ea9d8..afd54605d109aa88bb1fe40cf12467990cf782e3 100644 (file)
@@ -5,7 +5,7 @@ HAVE_XFT := y
 HAVE_ESOUND := y
 HAVE_FIREWIRE := y
 HAVE_OSS := y
-STATIC_LIBRARIES := y
+STATIC_LIBRARIES := n
 
 OBJDIR := $(shell uname --machine)