Exciting new Alt/h help key provided by sge (Georgy) with many thanks!
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / fileffmpeg.C
index 21e3067e2f4bbbd4203962979ceac13b442f40bc..bcc558170db4817a3976f0a248aaabfe7aaa3b05 100644 (file)
@@ -326,7 +326,7 @@ int FileFFMPEG::open_file(int rd, int wr)
        int result = 0;
        if( ff ) return 1;
        ff = new FFMPEG(this);
-
+       
        if( rd ) {
                result = ff->init_decoder(asset->path);
                if( !result ) result = ff->open_decoder();
@@ -342,6 +342,12 @@ int FileFFMPEG::open_file(int rd, int wr)
                        int video_layers = ff->ff_total_video_layers();
                        if( video_layers > 0 ) {
                                asset->video_data = 1;
+                               asset->aspect_ratio = ff->ff_aspect_ratio(0);
+                               if (!asset->interlace_mode) asset->interlace_mode = ff->ff_interlace(0);
+                               if ( ff->ff_video_frames(0) > 1 ) {
+//                             ff->video_probe(1);
+                                if (!asset->interlace_mode && (ff->interlace_from_codec) ) asset->interlace_mode = ff->video_probe(1); 
+                               }
                                if( !asset->layers ) asset->layers = video_layers;
                                asset->actual_width = ff->ff_video_width(0);
                                asset->actual_height = ff->ff_video_height(0);
@@ -510,6 +516,8 @@ FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window,
        audio_options = 0;
        format_name = asset->fformat;
        codec_name = asset->acodec;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Options for Render with FFmpeg");
 }
 
 FFMPEGConfigAudio::~FFMPEGConfigAudio()
@@ -675,6 +683,8 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window,
        bitrate = 0;
        quality = 0;
        video_options = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Options for Render with FFmpeg");
 }
 
 FFMPEGConfigVideo::~FFMPEGConfigVideo()
@@ -841,6 +851,8 @@ FFMPEGConfigFormat::FFMPEGConfigFormat(FFOptionsFormatViewDialog *view_dialog,
        format_options = 0;
        format_name = asset->fformat;
        codec_name = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Modifying FFmpeg Format Options");
 }
 
 FFMPEGConfigFormat::~FFMPEGConfigFormat()
@@ -864,10 +876,10 @@ void FFMPEGConfigFormat::save_options()
 }
 void FFMPEGConfigFormat::save_changes()
 {
+       read_options();
        char *options = asset->ff_format_options;
        int options_len = sizeof(asset->ff_format_options)-1;
        ff_options_dialog->store_options(options, options_len);
-       format_options->update(options);
 }
 
 void FFMPEGConfigFormat::load_options()
@@ -1587,6 +1599,8 @@ FFOptionsWindow::FFOptionsWindow(FFOptionsDialog *dialog, int x, int y)
        this->dialog = dialog;
        this->selected = 0;
        this->kind = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Modifying FFmpeg Format Options");
 }
 
 FFOptionsWindow::~FFOptionsWindow()
@@ -1938,6 +1952,15 @@ int FFOptionsFormatView::handle_event()
 {
        Asset *asset = fmt_config->asset;
        char *format_name = asset->fformat;
+       char replace_name0[] = "mov";
+       char replace_name1[] = "mpegts";
+       char replace_name2[] = "matroska";
+       if (!strcmp(format_name, "qt"))
+               format_name = replace_name0; // fixup
+       if (!strcmp(format_name, "m2ts"))
+               format_name = replace_name1; // fixup
+       if (!strcmp(format_name, "mkv"))
+               format_name = replace_name2; // fixup
        avformat_free_context(fmt_ctx);  fmt_ctx = 0;
        int ret = avformat_alloc_output_context2(&fmt_ctx, 0, format_name, 0);
        if( ret || !fmt_ctx ) {
@@ -1974,11 +1997,8 @@ BC_Window *FFOptionsFormatViewDialog::new_gui()
 
 void FFOptionsFormatViewDialog::handle_done_event(int result)
 {
-       if( !result ) {
-               cfg_window->lock_window("FFOptionsFormatViewDialog::handle_done_event");
+       if( !result )
                cfg_window->save_changes();
-               cfg_window->unlock_window();
-       }
        cfg_window = 0;
 }