add buffer flush to ffmpeg seek, clear loop_session on load replace mode
[goodguy/history.git] / cinelerra-5.0 / cinelerra / fileffmpeg.C
index bfe0a107b0ab0145285bcb55337b8e9d6aeb2042..04bdd750b084362656167ce69c78a3bdc29aa39c 100644 (file)
@@ -318,18 +318,6 @@ int FileFFMPEG::get_best_colormodel(Asset *asset, int driver)
        return BC_YUV420P;
 }
 
-static void load_options(const char *path, char *bfr, int len)
-{
-       *bfr = 0;
-       FILE *fp = fopen(path, "r");
-       if( !fp ) return;
-       fgets(bfr, len, fp); // skip hdr
-       len = fread(bfr, 1, len-1, fp);
-       if( len < 0 ) len = 0;
-       bfr[len] = 0;
-       fclose(fp);
-}
-
 //======
 extern void get_exe_path(char *result); // from main.C
 
@@ -362,16 +350,15 @@ void FFMPEGConfigAudio::create_objects()
 
         FileSystem fs;
        char option_path[BCTEXTLEN];
-       FFMPEG::set_option_path(option_path, "/audio");
+       FFMPEG::set_option_path(option_path, "audio");
         fs.update(option_path);
         int total_files = fs.total_files();
         for(int i = 0; i < total_files; i++) {
                 const char *name = fs.get_entry(i)->get_name();
                if( asset->fformat[0] != 0 ) {
                        const char *ext = strrchr(name,'.');
-                       if( !ext ) ext = name;
-                       else if( !strcmp("opts", ++ext) ) continue;
-                       if( strcmp(asset->fformat, ext) ) continue;
+                       if( !ext ) continue;
+                       if( strcmp(asset->fformat, ++ext) ) continue;
                }
                 presets.append(new BC_ListBoxItem(name));
         }
@@ -400,7 +387,7 @@ void FFMPEGConfigAudio::create_objects()
        y += 25;
        if( !asset->ff_audio_options[0] && asset->acodec[0] ) {
                FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-               load_options(option_path, asset->ff_audio_options,
+               FFMPEG::load_options(option_path, asset->ff_audio_options,
                         sizeof(asset->ff_audio_options));
        }
        add_subwindow(audio_options = new FFAudioOptions(this, x, y, get_w()-x-20, 10,
@@ -444,7 +431,7 @@ int FFMPEGConfigAudioPopup::handle_event()
        Asset *asset = popup->asset;
        char option_path[BCTEXTLEN];
        FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-       load_options(option_path, asset->ff_audio_options,
+       FFMPEG::load_options(option_path, asset->ff_audio_options,
                         sizeof(asset->ff_audio_options));
        popup->audio_options->update(asset->ff_audio_options);
        return 1;
@@ -478,6 +465,7 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
        preset_popup = 0;
 
        bitrate = 0;
+       quality = 0;
        video_options = 0;
 }
 
@@ -506,9 +494,8 @@ void FFMPEGConfigVideo::create_objects()
                 const char *name = fs.get_entry(i)->get_name();
                if( asset->fformat[0] != 0 ) {
                        const char *ext = strrchr(name,'.');
-                       if( !ext ) ext = name;
-                       else if( !strcmp("opts", ++ext) ) continue;
-                       if( strcmp(asset->fformat, ext) ) continue;
+                       if( !ext ) continue;
+                       if( strcmp(asset->fformat, ++ext) ) continue;
                }
                 presets.append(new BC_ListBoxItem(name));
         }
@@ -545,7 +532,7 @@ void FFMPEGConfigVideo::create_objects()
        y += 25;
        if( !asset->ff_video_options[0] && asset->vcodec[0] ) {
                FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-               load_options(option_path, asset->ff_video_options,
+               FFMPEG::load_options(option_path, asset->ff_video_options,
                         sizeof(asset->ff_video_options));
        }
        add_subwindow(video_options = new FFVideoOptions(this, x, y, get_w()-x-20, 10,
@@ -593,7 +580,7 @@ int FFMPEGConfigVideoPopup::handle_event()
        Asset *asset = popup->asset;
        char option_path[BCTEXTLEN];
        FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-       load_options(option_path, asset->ff_video_options,
+       FFMPEG::load_options(option_path, asset->ff_video_options,
                         sizeof(asset->ff_video_options));
        popup->video_options->update(asset->ff_video_options);
        return 1;