diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-07-15 19:49:24 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-07-19 09:38:53 +0200 |
commit | 6d592fbd0d8e89ecade3fc93b36ea200213dc01c (patch) | |
tree | 2efee2be6e1ebdd15d58104663ca242a6406d546 /avconv_opt.c | |
parent | be101bc1e357c50fcb740bc4870b3bacc93a5727 (diff) | |
download | ffmpeg-6d592fbd0d8e89ecade3fc93b36ea200213dc01c.tar.gz |
avconv: split creating and (re-)configuring complex filtergraphs
The current code is less than straightforward due to the fact that
output streams can be created based on filtergraph definitions. This
change should make the code simpler and more readable. It will also be
useful in the future commits.
Diffstat (limited to 'avconv_opt.c')
-rw-r--r-- | avconv_opt.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/avconv_opt.c b/avconv_opt.c index 4505a8e6a9..fbac91f441 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1367,8 +1367,7 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, { OutputStream *ost; - switch (avfilter_pad_get_type(ofilter->out_tmp->filter_ctx->output_pads, - ofilter->out_tmp->pad_idx)) { + switch (ofilter->type) { case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; default: @@ -1389,13 +1388,21 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, exit_program(1); } - if (configure_output_filter(ofilter->graph, ofilter, ofilter->out_tmp) < 0) { - av_log(NULL, AV_LOG_FATAL, "Error configuring filter.\n"); - exit_program(1); - } avfilter_inout_free(&ofilter->out_tmp); } +static int init_complex_filters(void) +{ + int i, ret = 0; + + for (i = 0; i < nb_filtergraphs; i++) { + ret = init_complex_filtergraph(filtergraphs[i]); + if (ret < 0) + return ret; + } + return 0; +} + static int configure_complex_filters(void) { int i, ret = 0; @@ -1471,8 +1478,7 @@ static int open_output_file(OptionsContext *o, const char *filename) if (!ofilter->out_tmp || ofilter->out_tmp->name) continue; - switch (avfilter_pad_get_type(ofilter->out_tmp->filter_ctx->output_pads, - ofilter->out_tmp->pad_idx)) { + switch (ofilter->type) { case AVMEDIA_TYPE_VIDEO: o->video_disable = 1; break; case AVMEDIA_TYPE_AUDIO: o->audio_disable = 1; break; case AVMEDIA_TYPE_SUBTITLE: o->subtitle_disable = 1; break; @@ -2228,9 +2234,9 @@ int avconv_parse_options(int argc, char **argv) } /* create the complex filtergraphs */ - ret = configure_complex_filters(); + ret = init_complex_filters(); if (ret < 0) { - av_log(NULL, AV_LOG_FATAL, "Error configuring filters.\n"); + av_log(NULL, AV_LOG_FATAL, "Error initializing complex filters.\n"); goto fail; } @@ -2241,6 +2247,13 @@ int avconv_parse_options(int argc, char **argv) goto fail; } + /* configure the complex filtergraphs */ + ret = configure_complex_filters(); + if (ret < 0) { + av_log(NULL, AV_LOG_FATAL, "Error configuring complex filters.\n"); + goto fail; + } + fail: uninit_parse_context(&octx); if (ret < 0) { |