gstavcodecmap: Do not require a channel-mask

.. for mono or stereo input.

https://bugzilla.gnome.org/show_bug.cgi?id=786401
This commit is contained in:
Mathieu Duponchelle 2017-08-17 14:28:22 +02:00
parent d5ac20299a
commit 2bb0dc16d6

View file

@ -651,12 +651,19 @@ gst_ff_aud_caps_new (AVCodecContext * context, AVCodec * codec,
if (gst_audio_channel_positions_to_mask (pos, nbits_set, FALSE,
&mask)) {
GstCaps *tmp =
gst_caps_new_simple (mimetype, "channel-mask", GST_TYPE_BITMASK,
mask,
"channels", G_TYPE_INT, nbits_set, NULL);
GstStructure *s =
gst_structure_new (mimetype, "channels", G_TYPE_INT, nbits_set,
NULL);
gst_caps_append (caps, tmp);
/* No need to require a channel mask for mono or stereo */
if (!(nbits_set == 1 && pos[0] == GST_AUDIO_CHANNEL_POSITION_MONO)
&& !(nbits_set == 2
&& pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT
&& pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT))
gst_structure_set (s, "channel-mask", GST_TYPE_BITMASK, mask,
NULL);
gst_caps_append_structure (caps, s);
}
}
layouts++;