summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpL16depay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-10-28 10:01:49 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-10-28 10:01:49 +0000
commit09e449609f856dd45da29bd76c8235cf6a37bf25 (patch)
treec3d6df656f31baf62f0de7b85f3caacbd6f23c53 /gst/rtp/gstrtpL16depay.c
parent6eb6d5b9ac5c90693161413eeee3a32d33a3637f (diff)
gst/rtp/: Add mappings for multichannel support. Does not completely just work because the getcaps function does not ...
Original commit message from CVS: * gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_setcaps): * gst/rtp/gstrtpL16pay.c: (gst_rtp_L16_pay_setcaps), (gst_rtp_L16_pay_getcaps): * gst/rtp/gstrtpchannels.c: (check_channels), (gst_rtp_channels_get_by_pos), (gst_rtp_channels_get_by_order), (gst_rtp_channels_create_default): * gst/rtp/gstrtpchannels.h: Add mappings for multichannel support. Does not completely just work because the getcaps function does not yet return the allowed channel mappings. See #556641.
Diffstat (limited to 'gst/rtp/gstrtpL16depay.c')
-rw-r--r--gst/rtp/gstrtpL16depay.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gst/rtp/gstrtpL16depay.c b/gst/rtp/gstrtpL16depay.c
index 6b5d3f3e..c9fedff6 100644
--- a/gst/rtp/gstrtpL16depay.c
+++ b/gst/rtp/gstrtpL16depay.c
@@ -24,7 +24,11 @@
#include <string.h>
#include <stdlib.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/multichannel.h>
+
#include "gstrtpL16depay.h"
+#include "gstrtpchannels.h"
GST_DEBUG_CATEGORY_STATIC (rtpL16depay_debug);
#define GST_CAT_DEFAULT (rtpL16depay_debug)
@@ -146,6 +150,8 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
gint channels;
GstCaps *srccaps;
gboolean res;
+ const gchar *channel_order;
+ const GstRTPChannelOrder *order;
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
@@ -163,6 +169,7 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
clock_rate = 44100;
break;
default:
+ /* no fixed mapping, we need channels and clock-rate */
channels = 0;
clock_rate = 0;
break;
@@ -189,6 +196,25 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, clock_rate, "channels", G_TYPE_INT, channels, NULL);
+ /* add channel positions */
+ channel_order = gst_structure_get_string (structure, "channel-order");
+
+ order = gst_rtp_channels_get_by_order (channels, channel_order);
+ if (order) {
+ gst_audio_set_channel_positions (gst_caps_get_structure (srccaps, 0),
+ order->pos);
+ } else {
+ GstAudioChannelPosition *pos;
+
+ GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
+ (NULL), ("Unknown channel order '%s' for %d channels",
+ GST_STR_NULL (channel_order), channels));
+ /* create default NONE layout */
+ pos = gst_rtp_channels_create_default (channels);
+ gst_audio_set_channel_positions (gst_caps_get_structure (srccaps, 0), pos);
+ g_free (pos);
+ }
+
res = gst_pad_set_caps (depayload->srcpad, srccaps);
gst_caps_unref (srccaps);