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,
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));
}
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));
}
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];
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;
}
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);