diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-06-07 09:12:42 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-06-07 09:12:42 +0000 |
commit | d9f1b68cf57220c0ec0cefaee3558e6b37ab0d72 (patch) | |
tree | e33ce6763e11dba4540d933295c1e7c0e1aacf02 /ffmpeg.c | |
parent | 8a4f5983ee3f0f44e0263a3ce686ede035b6d594 (diff) | |
download | ffmpeg-d9f1b68cf57220c0ec0cefaee3558e6b37ab0d72.tar.gz |
Presets support.
How per codec defaults and ranges will be supported is still being discussed.
Originally committed as revision 13685 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -3636,6 +3636,41 @@ static int opt_bsf(const char *opt, const char *arg) return 0; } +static int opt_preset(const char *opt, const char *arg) +{ + FILE *f; + char tmp[100], tmp2[100]; + char *home= getenv("HOME"); + + snprintf(tmp, sizeof(tmp), "%s/.ffmpeg/%s.ffpreset", home, arg); + f= fopen(tmp, "r"); + if(!f){ + char *codec_name= *opt == 'v' ? video_codec_name : + *opt == 'a' ? audio_codec_name : + subtitle_codec_name; + snprintf(tmp, sizeof(tmp), "%s/.ffmpeg/%s-%s.ffpreset", home, codec_name, arg); + f= fopen(tmp, "r"); + } + + if(!f){ + fprintf(stderr, "Preset file not found\n"); + av_exit(1); + } + + while(!feof(f)){ + int e= fscanf(f, "%99[^=]=%99[^\n]\n", tmp, tmp2); + if(e!=2){ + fprintf(stderr, "Preset file invalid\n"); + av_exit(1); + } + opt_default(tmp, tmp2); + } + + fclose(f); + + return 0; +} + static const OptionDef options[] = { /* main options */ { "L", OPT_EXIT, {(void*)show_license}, "show license" }, @@ -3758,6 +3793,10 @@ static const OptionDef options[] = { { "vbsf", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" }, { "sbsf", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" }, + { "apre", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_preset}, "", "preset" }, + { "vpre", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "", "preset" }, + { "spre", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "", "preset" }, + { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { NULL, }, }; |