From 4b6a410be093faff9527504e03cf6d1a91df6cdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 4 Jan 2012 15:05:41 +0100 Subject: [PATCH] speex: Update for the new raw audio caps --- ext/speex/gstspeexdec.c | 8 ++++++++ ext/speex/gstspeexenc.c | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c index 1936820..4ba4d28 100644 --- a/ext/speex/gstspeexdec.c +++ b/ext/speex/gstspeexdec.c @@ -67,6 +67,7 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw, " "format = (string) " FORMAT_STR ", " + "layout = (string) interleaved, " "rate = (int) [ 6000, 48000 ], " "channels = (int) [ 1, 2 ]") ); @@ -231,9 +232,16 @@ gst_speex_dec_parse_header (GstSpeexDec * dec, GstBuffer * buf) /* set caps */ caps = gst_caps_new_simple ("audio/x-raw", "format", G_TYPE_STRING, FORMAT_STR, + "layout", G_TYPE_STRING, "interleaved", "rate", G_TYPE_INT, dec->header->rate, "channels", G_TYPE_INT, dec->header->nb_channels, NULL); + if (dec->header->nb_channels == 2) { + gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, + GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_LEFT) | + GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_RIGHT), NULL); + } + if (!gst_pad_set_caps (GST_AUDIO_DECODER_SRC_PAD (dec), caps)) goto nego_failed; diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c index 01202ea..3bf2bbc 100644 --- a/ext/speex/gstspeexenc.c +++ b/ext/speex/gstspeexenc.c @@ -59,7 +59,14 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw, " "format = (string) " FORMAT_STR ", " - "rate = (int) [ 6000, 48000 ], " "channels = (int) [ 1, 2 ]") + "layout = (string) interleaved, " + "rate = (int) [ 6000, 48000 ], " + "channels = (int) 1; " + "audio/x-raw, " + "format = (string) " FORMAT_STR ", " + "layout = (string) interleaved, " + "rate = (int) [ 6000, 48000 ], " + "channels = (int) 2, " "channel-mask = (bitmask) 0x3") ); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", -- 2.7.4