summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-12-24 13:06:13 +0100
committerSebastian Dröge <sebastian@centricular.com>2016-01-18 15:42:10 +0200
commit455fc9a8deb877f0b2e5242d28f271d5c3049bdb (patch)
tree18a18d46de5c03378819c7f20b49eeeb93d1ede5
parent82588603fc70c57c77ecc527c8e9ef7ed5e3a652 (diff)
downloadgst-libav-455fc9a8deb877f0b2e5242d28f271d5c3049bdb.tar.gz
avcodecmap: Add special mapping for mono channel layouts
In ffmpeg this is the same as FRONT_CENTER, but we distinguish between FRONT_CENTER and MONO in GStreamer. Add an explicit mapping for this special case in the translations functions. https://bugzilla.gnome.org/show_bug.cgi?id=759846
-rw-r--r--ext/libav/gstavcodecmap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
index 126919e..e2dfeb1 100644
--- a/ext/libav/gstavcodecmap.c
+++ b/ext/libav/gstavcodecmap.c
@@ -99,6 +99,9 @@ gst_ffmpeg_channel_positions_to_layout (GstAudioChannelPosition * pos,
if (!pos)
return 0;
+ if (channels == 1 && pos[0] == GST_AUDIO_CHANNEL_POSITION_MONO)
+ return AV_CH_LAYOUT_MONO;
+
for (i = 0; i < channels; i++) {
for (j = 0; j < G_N_ELEMENTS (_ff_to_gst_layout); j++) {
if (_ff_to_gst_layout[j].gst == pos[i]) {
@@ -127,6 +130,15 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
} else {
guint i, j;
+ /* Special path for mono, as AV_CH_LAYOUT_MONO is the same
+ * as FRONT_CENTER but we distinguish between the two in
+ * GStreamer
+ */
+ if (channels == 1 && channel_layout == AV_CH_LAYOUT_MONO) {
+ pos[0] = GST_AUDIO_CHANNEL_POSITION_MONO;
+ return TRUE;
+ }
+
for (i = 0; i < 64; i++) {
if ((channel_layout & (G_GUINT64_CONSTANT (1) << i)) != 0) {
nchannels++;