From: Good Guy Date: Sun, 28 Jun 2015 16:34:12 +0000 (-0600) Subject: mods to ffmpeg default codec param strategy X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=c58bbe01c3c09edf315f78508e61e8924bf44eb0;p=goodguy%2Fhistory.git mods to ffmpeg default codec param strategy --- diff --git a/cinelerra-5.0/cinelerra/ffmpeg.h b/cinelerra-5.0/cinelerra/ffmpeg.h index 003d5583..41941e73 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.h +++ b/cinelerra-5.0/cinelerra/ffmpeg.h @@ -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, diff --git a/cinelerra-5.0/cinelerra/fileffmpeg.C b/cinelerra-5.0/cinelerra/fileffmpeg.C index fdcf3297..12b8b839 100644 --- a/cinelerra-5.0/cinelerra/fileffmpeg.C +++ b/cinelerra-5.0/cinelerra/fileffmpeg.C @@ -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)); } diff --git a/cinelerra-5.0/cinelerra/formatpopup.C b/cinelerra-5.0/cinelerra/formatpopup.C index 55938518..968444bf 100644 --- a/cinelerra-5.0/cinelerra/formatpopup.C +++ b/cinelerra-5.0/cinelerra/formatpopup.C @@ -104,7 +104,7 @@ FFMPEGPopup::FFMPEGPopup(ArrayList *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; jget_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; diff --git a/cinelerra-5.0/cinelerra/formattools.C b/cinelerra-5.0/cinelerra/formattools.C index a8f3f6bf..d72ed4cd 100644 --- a/cinelerra-5.0/cinelerra/formattools.C +++ b/cinelerra-5.0/cinelerra/formattools.C @@ -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); diff --git a/cinelerra-5.0/ffmpeg/audio/dvd b/cinelerra-5.0/ffmpeg/audio/dvd.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/audio/dvd rename to cinelerra-5.0/ffmpeg/audio/dvd.dfl diff --git a/cinelerra-5.0/ffmpeg/audio/mp3 b/cinelerra-5.0/ffmpeg/audio/mp3.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/audio/mp3 rename to cinelerra-5.0/ffmpeg/audio/mp3.dfl diff --git a/cinelerra-5.0/ffmpeg/audio/mp4 b/cinelerra-5.0/ffmpeg/audio/mp4.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/audio/mp4 rename to cinelerra-5.0/ffmpeg/audio/mp4.dfl diff --git a/cinelerra-5.0/ffmpeg/audio/qt b/cinelerra-5.0/ffmpeg/audio/qt.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/audio/qt rename to cinelerra-5.0/ffmpeg/audio/qt.dfl diff --git a/cinelerra-5.0/ffmpeg/video/dvd b/cinelerra-5.0/ffmpeg/video/dvd.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/video/dvd rename to cinelerra-5.0/ffmpeg/video/dvd.dfl diff --git a/cinelerra-5.0/ffmpeg/video/mp4 b/cinelerra-5.0/ffmpeg/video/mp4.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/video/mp4 rename to cinelerra-5.0/ffmpeg/video/mp4.dfl diff --git a/cinelerra-5.0/ffmpeg/video/mpeg b/cinelerra-5.0/ffmpeg/video/mpeg.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/video/mpeg rename to cinelerra-5.0/ffmpeg/video/mpeg.dfl diff --git a/cinelerra-5.0/ffmpeg/video/qt b/cinelerra-5.0/ffmpeg/video/qt.dfl similarity index 100% rename from cinelerra-5.0/ffmpeg/video/qt rename to cinelerra-5.0/ffmpeg/video/qt.dfl