summaryrefslogtreecommitdiff
path: root/ext/a52dec/gsta52dec.c
diff options
context:
space:
mode:
authorJulien Isorce <julien.isorce@gmail.com>2012-05-21 14:57:44 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2012-05-24 15:52:42 +0200
commit6f0f28af45a432304fe0d4605ad07ffbfd09d3dc (patch)
tree371619663a7261f9ee695d0231c8e3f34dc95562 /ext/a52dec/gsta52dec.c
parent6f5af2c5790a982ecacf62e8f7c03f01fcc635fd (diff)
a52dec: really prefer the original number (and position) of channels
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676495
Diffstat (limited to 'ext/a52dec/gsta52dec.c')
-rw-r--r--ext/a52dec/gsta52dec.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/a52dec/gsta52dec.c b/ext/a52dec/gsta52dec.c
index e59ee0d7..dfcb480f 100644
--- a/ext/a52dec/gsta52dec.c
+++ b/ext/a52dec/gsta52dec.c
@@ -532,7 +532,8 @@ gst_a52dec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buffer)
if (caps && gst_caps_get_size (caps) > 0) {
GstCaps *copy = gst_caps_copy_nth (caps, 0);
GstStructure *structure = gst_caps_get_structure (copy, 0);
- gint channels;
+ gint orig_channels = flags ? gst_a52dec_channels (flags, NULL) : 6;
+ gint fixed_channels = 0;
const int a52_channels[6] = {
A52_MONO,
A52_STEREO,
@@ -546,12 +547,15 @@ gst_a52dec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buffer)
* preferred (first in the caps) downstream if possible.
*/
gst_structure_fixate_field_nearest_int (structure, "channels",
- flags ? gst_a52dec_channels (flags, NULL) : 6);
- if (gst_structure_get_int (structure, "channels", &channels)
- && channels <= 6)
- flags = a52_channels[channels - 1];
- else
+ orig_channels);
+
+ if (gst_structure_get_int (structure, "channels", &fixed_channels)
+ && fixed_channels <= 6) {
+ if (fixed_channels < orig_channels)
+ flags = a52_channels[fixed_channels - 1];
+ } else {
flags = a52_channels[5];
+ }
gst_caps_unref (copy);
} else if (flags)