aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-05-06 07:00:22 +0200
committerAnton Khirnov <anton@khirnov.net>2012-05-14 21:36:10 +0200
commitff1f51a8aa624753aaec76d8f836cd3c92d91fed (patch)
tree72db802d5ba0d0bc5a80a20668e729eadb3f97d0 /libavfilter/avfilter.c
parent5775a1832c4165e6acc1d307004b38701bb463f4 (diff)
downloadffmpeg-ff1f51a8aa624753aaec76d8f836cd3c92d91fed.tar.gz
lavfi: add channel layout/sample rate negotiation.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index bd898e37ab..57108b13ce 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -28,6 +28,7 @@
#include "libavcodec/avcodec.h"
#include "avfilter.h"
+#include "formats.h"
#include "internal.h"
unsigned avfilter_version(void) {
@@ -176,6 +177,12 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
if (link->out_formats)
avfilter_formats_changeref(&link->out_formats,
&filt->outputs[filt_dstpad_idx]->out_formats);
+ if (link->out_samplerates)
+ avfilter_formats_changeref(&link->out_samplerates,
+ &filt->outputs[filt_dstpad_idx]->out_samplerates);
+ if (link->out_channel_layouts)
+ ff_channel_layouts_changeref(&link->out_channel_layouts,
+ &filt->outputs[filt_dstpad_idx]->out_channel_layouts);
return 0;
}
@@ -216,12 +223,6 @@ int avfilter_config_links(AVFilterContext *filter)
link->sample_aspect_ratio = link->src->input_count ?
link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
- if (link->sample_rate == 0 && link->src && link->src->input_count)
- link->sample_rate = link->src->inputs[0]->sample_rate;
-
- if (link->channel_layout == 0 && link->src && link->src->input_count)
- link->channel_layout = link->src->inputs[0]->channel_layout;
-
if ((config_link = link->dstpad->config_props))
if ((ret = config_link(link)) < 0)
return ret;
@@ -614,6 +615,10 @@ void avfilter_free(AVFilterContext *filter)
link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&link->out_formats);
+ avfilter_formats_unref(&link->in_samplerates);
+ avfilter_formats_unref(&link->out_samplerates);
+ ff_channel_layouts_unref(&link->in_channel_layouts);
+ ff_channel_layouts_unref(&link->out_channel_layouts);
}
av_freep(&link);
}
@@ -623,6 +628,10 @@ void avfilter_free(AVFilterContext *filter)
link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&link->out_formats);
+ avfilter_formats_unref(&link->in_samplerates);
+ avfilter_formats_unref(&link->out_samplerates);
+ ff_channel_layouts_unref(&link->in_channel_layouts);
+ ff_channel_layouts_unref(&link->out_channel_layouts);
}
av_freep(&link);
}