mods to ffmpeg default codec param strategy
authorGood Guy <[email protected]>
Sun, 28 Jun 2015 16:34:12 +0000 (10:34 -0600)
committerGood Guy <[email protected]>
Sun, 28 Jun 2015 16:34:12 +0000 (10:34 -0600)
12 files changed:
cinelerra-5.0/cinelerra/ffmpeg.h
cinelerra-5.0/cinelerra/fileffmpeg.C
cinelerra-5.0/cinelerra/formatpopup.C
cinelerra-5.0/cinelerra/formattools.C
cinelerra-5.0/ffmpeg/audio/dvd.dfl [moved from cinelerra-5.0/ffmpeg/audio/dvd with 100% similarity]
cinelerra-5.0/ffmpeg/audio/mp3.dfl [moved from cinelerra-5.0/ffmpeg/audio/mp3 with 100% similarity]
cinelerra-5.0/ffmpeg/audio/mp4.dfl [moved from cinelerra-5.0/ffmpeg/audio/mp4 with 100% similarity]
cinelerra-5.0/ffmpeg/audio/qt.dfl [moved from cinelerra-5.0/ffmpeg/audio/qt with 100% similarity]
cinelerra-5.0/ffmpeg/video/dvd.dfl [moved from cinelerra-5.0/ffmpeg/video/dvd with 100% similarity]
cinelerra-5.0/ffmpeg/video/mp4.dfl [moved from cinelerra-5.0/ffmpeg/video/mp4 with 100% similarity]
cinelerra-5.0/ffmpeg/video/mpeg.dfl [moved from cinelerra-5.0/ffmpeg/video/mpeg with 100% similarity]
cinelerra-5.0/ffmpeg/video/qt.dfl [moved from cinelerra-5.0/ffmpeg/video/qt with 100% similarity]

index 003d55836e9037d43001b0d86781090b5c57d7da..41941e730e61f50e449cadf2ddd2e0dcf3405ce5 100644 (file)
@@ -232,9 +232,9 @@ public:
 
        static void set_option_path(char *path, const char *fmt, ...);
        static void get_option_path(char *path, const char *type, const char *spec);
-       int get_format(char *format, const char *path, char *spec);
+       static int get_format(char *format, const char *path, char *spec);
+       static int scan_option_line(char *cp,char *tag,char *val);
        int get_file_format();
-       int scan_option_line(char *cp,char *tag,char *val);
        int get_encoder(const char *options,
                char *format, char *codec, char *bsfilter, char *bsargs);
        int get_encoder(FILE *fp,
index fdcf3297e6230916ec19b7810b6c10ca3125e516..12b8b839e520936231e938c3fb0f53443c352edf 100644 (file)
@@ -350,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));
         }
@@ -494,9 +493,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));
         }
index 559385189e31e4364b8774daf258fab8e2dd1c9c..968444bf08bdc32a34103f4f3b523017b487a8e4 100644 (file)
@@ -104,7 +104,7 @@ FFMPEGPopup::FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y)
 
 void FFMPEGPopup::create_objects()
 {
-       static const char *dirs[] = { "/audio", "/video", };
+       static const char *dirs[] = { "audio", "video", };
        for( int i=0; i<(int)(sizeof(dirs)/sizeof(dirs[0])); ++i ) {
                FileSystem fs;
                char option_path[BCTEXTLEN];
@@ -114,8 +114,9 @@ void FFMPEGPopup::create_objects()
                for( int j=0; j<total_files; ++j ) {
                        const char *name = fs.get_entry(j)->get_name();
                        const char *ext = strrchr(name,'.');
-                       if( !ext ) ext = name;
-                       else if( !strcmp("opts", ++ext) ) continue;
+                       if( !ext ) continue;
+                       if( !strcmp("dfl", ++ext) ) continue;
+                       if( !strcmp("opts", ext) ) continue;
                        int k = ffmpeg_types.size();
                        while( --k >= 0 && strcmp(ffmpeg_types[k]->get_text(), ext) );
                        if( k >= 0 ) continue;
index a8f3f6bf85da74f0e2b7d4c76568d728d980e37d..d72ed4cdb5ca3e0a1179bbd60daab9cb09abd0c1 100644 (file)
@@ -851,17 +851,16 @@ FormatFFMPEG::~FormatFFMPEG()
 }
 
 int FormatFFMPEG::load_defaults(const char *path, const char *type,
-               char *codec, char *codec_options, int len)
+                char *codec, char *codec_options, int len)
 {
        char default_file[BCTEXTLEN];
-       FFMPEG::set_option_path(default_file, "%s/%s", path, type);
+       FFMPEG::set_option_path(default_file, "%s/%s.dfl", path, type);
        FILE *fp = fopen(default_file,"r");
        if( !fp ) return 1;
-       char default_codec[BCSTRLEN];
-       fgets(default_codec, sizeof(default_codec), fp);
+       fgets(codec, BCSTRLEN, fp);
        fclose(fp);
-       char *cp=codec, *dp=default_codec;
-       while( *dp && *dp!='\n' ) *cp++ = *dp++;
+       char *cp = codec;
+       while( *cp && *cp!='\n' ) ++cp;
        *cp = 0;
        FFMPEG::set_option_path(default_file, "%s/%s", path, codec);
        return FFMPEG::load_options(default_file, codec_options, len);