Skip to content

Instantly share code, notes, and snippets.

@justinruggles
Created September 20, 2012 05:17
Show Gist options
  • Save justinruggles/3754091 to your computer and use it in GitHub Desktop.
Save justinruggles/3754091 to your computer and use it in GitHub Desktop.
diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c
index eb2d2f9..7547b9c 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment