summaryrefslogtreecommitdiff
path: root/avconv_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-05-23 14:09:08 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-25 11:20:50 +0200
commit722ec3eb35bc152ce91d0a4502eca0df1c0086d0 (patch)
treed353507a68b0f209244ebe44f8ee72d7e7305e9e /avconv_opt.c
parent398f015f077c6a2406deffd9e37ff34b9c7bb3bc (diff)
avconv: decouple configuring filtergraphs and setting input parameters
Currently, calling configure_filtergraph() will pull in the input parameters from the corresponding decoder context. This has the following disadvantages: - the decoded frame is a more proper source for this information - a filter accessing decoder data breaks proper layering Add functions for explicitly sending the input stream parameters to a filtergraph input - currently from a frame and a decoder. The decoder one will be dropped in future commits after some more restructuring.
Diffstat (limited to 'avconv_opt.c')
-rw-r--r--avconv_opt.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/avconv_opt.c b/avconv_opt.c
index a1729c30e5..ce58f2b6be 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1498,12 +1498,28 @@ static int init_complex_filters(void)
static int configure_complex_filters(void)
{
- int i, ret = 0;
+ int i, j, ret = 0;
+
+ for (i = 0; i < nb_filtergraphs; i++) {
+ FilterGraph *fg = filtergraphs[i];
+
+ if (filtergraph_is_simple(fg))
+ continue;
- for (i = 0; i < nb_filtergraphs; i++)
- if (!filtergraph_is_simple(filtergraphs[i]) &&
- (ret = configure_filtergraph(filtergraphs[i])) < 0)
+ for (j = 0; j < fg->nb_inputs; j++) {
+ ret = ifilter_parameters_from_decoder(fg->inputs[j],
+ fg->inputs[j]->ist->dec_ctx);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Error initializing filtergraph %d input %d\n", i, j);
+ return ret;
+ }
+ }
+
+ ret = configure_filtergraph(filtergraphs[i]);
+ if (ret < 0)
return ret;
+ }
return 0;
}