diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-28 13:20:26 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-28 13:20:26 +0000 |
commit | d0242e741dad360ccf71afd0ee9c50bad9a3a7e6 (patch) | |
tree | 793a6d2ff85cad4a895097adace0515d866d2eb2 /ffmpeg.c | |
parent | a0e7079a207fc38cb3754cf11a29863c81f633e4 (diff) | |
download | ffmpeg-d0242e741dad360ccf71afd0ee9c50bad9a3a7e6.tar.gz |
Factorize: opt_{audio,video,subtitle}_tag() -> opt_codec_tag().
Originally committed as revision 25596 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 37 |
1 files changed, 12 insertions, 25 deletions
@@ -2819,24 +2819,6 @@ static void opt_audio_codec(const char *arg) opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg); } -static void opt_audio_tag(const char *arg) -{ - char *tail; - audio_codec_tag= strtol(arg, &tail, 0); - - if(!tail || *tail) - audio_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); -} - -static void opt_video_tag(const char *arg) -{ - char *tail; - video_codec_tag= strtol(arg, &tail, 0); - - if(!tail || *tail) - video_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); -} - static void opt_video_codec(const char *arg) { opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg); @@ -2847,13 +2829,18 @@ static void opt_subtitle_codec(const char *arg) opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg); } -static void opt_subtitle_tag(const char *arg) +static void opt_codec_tag(const char *opt, const char *arg) { char *tail; - subtitle_codec_tag= strtol(arg, &tail, 0); + uint32_t *codec_tag; + + codec_tag = !strcmp(opt, "atag") ? &audio_codec_tag : + !strcmp(opt, "vtag") ? &video_codec_tag : + !strcmp(opt, "stag") ? &subtitle_codec_tag : NULL; - if(!tail || *tail) - subtitle_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); + *codec_tag = strtol(arg, &tail, 0); + if (!tail || *tail) + *codec_tag = arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); } static void opt_map(const char *arg) @@ -4124,7 +4111,7 @@ static const OptionDef options[] = { { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" }, { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" }, { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" }, - { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" }, + { "vtag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" }, { "newvideo", OPT_VIDEO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new video stream to the current output stream" }, { "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" }, { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" }, @@ -4140,7 +4127,7 @@ static const OptionDef options[] = { { "ac", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" }, { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" }, { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" }, - { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" }, + { "atag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force audio tag/fourcc", "fourcc/tag" }, { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, // { "newaudio", OPT_AUDIO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new audio stream to the current output stream" }, { "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" }, @@ -4151,7 +4138,7 @@ static const OptionDef options[] = { { "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" }, { "newsubtitle", OPT_SUBTITLE | OPT_FUNC2, {(void*)opt_new_stream}, "add a new subtitle stream to the current output stream" }, { "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" }, - { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_subtitle_tag}, "force subtitle tag/fourcc", "fourcc/tag" }, + { "stag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" }, /* grab options */ { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" }, |