[FFmpeg-cvslog] af_resample: avoid conversion of identical sample formats for 1 channel
Justin Ruggles
git at videolan.org
Mon Oct 8 13:21:15 CEST 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Thu Sep 20 13:28:34 2012 -0400| [7b556be6735371d1040c7076547b8198d9fadd34] | committer: Justin Ruggles
af_resample: avoid conversion of identical sample formats for 1 channel
When there is only 1 channel, the planar and interleaved formats of the same
data type should be treated as identical.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b556be6735371d1040c7076547b8198d9fadd34
---
libavfilter/af_resample.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c
index c51f9d2..58a9b2a 100644
--- a/libavfilter/af_resample.c
+++ b/libavfilter/af_resample.c
@@ -93,7 +93,11 @@ static int config_output(AVFilterLink *outlink)
if (inlink->channel_layout == outlink->channel_layout &&
inlink->sample_rate == outlink->sample_rate &&
- inlink->format == outlink->format)
+ (inlink->format == outlink->format ||
+ (av_get_channel_layout_nb_channels(inlink->channel_layout) == 1 &&
+ av_get_channel_layout_nb_channels(outlink->channel_layout) == 1 &&
+ av_get_planar_sample_fmt(inlink->format) ==
+ av_get_planar_sample_fmt(outlink->format))))
return 0;
if (!(s->avr = avresample_alloc_context()))
@@ -226,6 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
fail:
avfilter_unref_buffer(buf);
} else {
+ buf->format = outlink->format;
ret = ff_filter_samples(outlink, buf);
s->got_output = 1;
}
More information about the ffmpeg-cvslog
mailing list