avaudec: don't put bogus 0 channel-mask on output caps for mono audio

This commit is contained in:
Tim-Philipp Müller 2013-11-04 23:20:17 +00:00
parent e9e31ebada
commit 4072c40b8e

View file

@ -522,20 +522,18 @@ gst_ff_aud_caps_new (AVCodecContext * context, AVCodec * codec,
/* fixed, non-probing context */ /* fixed, non-probing context */
if (context != NULL && context->channels != -1) { if (context != NULL && context->channels != -1) {
GstAudioChannelPosition pos[64]; GstAudioChannelPosition pos[64];
guint64 mask;
caps = gst_caps_new_simple (mimetype, caps = gst_caps_new_simple (mimetype,
"rate", G_TYPE_INT, context->sample_rate, "rate", G_TYPE_INT, context->sample_rate,
"channels", G_TYPE_INT, context->channels, NULL); "channels", G_TYPE_INT, context->channels, NULL);
if (gst_ffmpeg_channel_layout_to_gst (context->channel_layout, if (context->channels > 1 &&
context->channels, pos)) { gst_ffmpeg_channel_layout_to_gst (context->channel_layout,
guint64 mask; context->channels, pos) &&
gst_audio_channel_positions_to_mask (pos, context->channels, FALSE,
if (gst_audio_channel_positions_to_mask (pos, context->channels, FALSE, &mask)) {
&mask)) { gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, mask, NULL);
gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, mask,
NULL);
}
} }
} else if (encode) { } else if (encode) {
gint maxchannels = 2; gint maxchannels = 2;