summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpL16pay.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/gstrtpL16pay.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/gstrtpL16pay.c')
-rw-r--r--gst/rtp/gstrtpL16pay.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c
index 8d121e61..2b5f250b 100644
--- a/gst/rtp/gstrtpL16pay.c
+++ b/gst/rtp/gstrtpL16pay.c
@@ -23,9 +23,12 @@
#include <string.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/multichannel.h>
#include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpL16pay.h"
+#include "gstrtpchannels.h"
GST_DEBUG_CATEGORY_STATIC (rtpL16pay_debug);
#define GST_CAT_DEFAULT (rtpL16pay_debug)
@@ -173,6 +176,8 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
gint channels, rate;
gboolean res;
gchar *params;
+ GstAudioChannelPosition *pos;
+ const GstRTPChannelOrder *order;
rtpL16pay = GST_RTP_L16_PAY (basepayload);
@@ -185,13 +190,33 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
if (!gst_structure_get_int (structure, "channels", &channels))
goto no_channels;
+ /* get the channel order */
+ pos = gst_audio_get_channel_positions (structure);
+ if (pos)
+ order = gst_rtp_channels_get_by_pos (channels, pos);
+ else
+ order = NULL;
gst_basertppayload_set_options (basepayload, "audio", TRUE, "L16", rate);
params = g_strdup_printf ("%d", channels);
- res = gst_basertppayload_set_outcaps (basepayload,
- "encoding-params", G_TYPE_STRING, params, "channels", G_TYPE_INT,
- channels, NULL);
+
+ if (!order && channels > 2) {
+ GST_ELEMENT_WARNING (rtpL16pay, STREAM, DECODE,
+ (NULL), ("Unknown channel order for %d channels", channels));
+ }
+
+ if (order && order->name) {
+ res = gst_basertppayload_set_outcaps (basepayload,
+ "encoding-params", G_TYPE_STRING, params, "channels", G_TYPE_INT,
+ channels, "channel-order", G_TYPE_STRING, order->name, NULL);
+ } else {
+ res = gst_basertppayload_set_outcaps (basepayload,
+ "encoding-params", G_TYPE_STRING, params, "channels", G_TYPE_INT,
+ channels, NULL);
+ }
+
g_free (params);
+ g_free (pos);
rtpL16pay->rate = rate;
rtpL16pay->channels = channels;