aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-17 02:38:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-17 02:55:57 +0200
commit664f0aac62e060d7a28beb7c04d8ca9e35e5e05f (patch)
tree654845de107c1899b3c2c5c9cf64462a3aeae952
parent13fdb355358cd074471a18e8f7ea175330e3ceb5 (diff)
downloadffmpeg-664f0aac62e060d7a28beb7c04d8ca9e35e5e05f.tar.gz
libavfilter: src_buffer, use only aresample, not aconvert.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/src_buffer.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/libavfilter/src_buffer.c b/libavfilter/src_buffer.c
index 8f27ea0733..33b3ec70cb 100644
--- a/libavfilter/src_buffer.c
+++ b/libavfilter/src_buffer.c
@@ -215,19 +215,25 @@ static int check_format_change_audio(AVFilterContext *ctx,
int ret, logged = 0;
link = ctx->outputs[0];
- if (samplesref->audio->sample_rate != link->sample_rate) {
+ if (samplesref->audio->sample_rate != link->sample_rate ||
+ samplesref->format != link->format ||
+ samplesref->audio->channel_layout != link->channel_layout) {
log_input_change(ctx, link, samplesref);
logged = 1;
- abuffer->sample_rate = samplesref->audio->sample_rate;
+ abuffer->sample_rate = samplesref->audio->sample_rate;
+ abuffer->sample_format = samplesref->format;
+ abuffer->channel_layout = samplesref->audio->channel_layout;
if (!abuffer->aresample) {
ret = insert_filter(abuffer, link, &abuffer->aresample, "aresample");
if (ret < 0) return ret;
} else {
link = abuffer->aresample->outputs[0];
- if (samplesref->audio->sample_rate == link->sample_rate)
+ if (samplesref->audio->sample_rate == link->sample_rate &&
+ samplesref->format == link->format &&
+ samplesref->audio->channel_layout == link->channel_layout)
remove_filter(&abuffer->aresample);
else
if ((ret = reconfigure_filter(abuffer, abuffer->aresample)) < 0)
@@ -235,28 +241,6 @@ static int check_format_change_audio(AVFilterContext *ctx,
}
}
- link = ctx->outputs[0];
- if (samplesref->format != link->format ||
- samplesref->audio->channel_layout != link->channel_layout) {
-
- if (!logged) log_input_change(ctx, link, samplesref);
-
- abuffer->sample_format = samplesref->format;
- abuffer->channel_layout = samplesref->audio->channel_layout;
-
- if (!abuffer->aconvert) {
- ret = insert_filter(abuffer, link, &abuffer->aconvert, "aconvert");
- if (ret < 0) return ret;
- } else {
- link = abuffer->aconvert->outputs[0];
- if (samplesref->format == link->format &&
- samplesref->audio->channel_layout == link->channel_layout)
- remove_filter(&abuffer->aconvert);
- else
- if ((ret = reconfigure_filter(abuffer, abuffer->aconvert)) < 0)
- return ret;
- }
- }
return 0;
}