summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-10-28 17:42:02 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-10-28 17:42:02 +0000
commitb29385bd76388904ba203360e1533c903a369ab4 (patch)
tree44610ba8e38561f7dad5350d9a95dd60fc517414
parent23f37b0179ba14c4cac67b690b4c2e5e736c757e (diff)
gst/rtp/gstrtpchannels.*: Add method to get possible channel positions.
Original commit message from CVS: * gst/rtp/gstrtpchannels.c: (gst_rtp_channels_get_by_index): * gst/rtp/gstrtpchannels.h: Add method to get possible channel positions.
-rw-r--r--ChangeLog6
-rw-r--r--gst/rtp/gstrtpchannels.c31
-rw-r--r--gst/rtp/gstrtpchannels.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 22672e92..c3fce95c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-10-28 Wim Taymans <wim.taymans@collabora.co.uk>
+ * gst/rtp/gstrtpchannels.c: (gst_rtp_channels_get_by_index):
+ * gst/rtp/gstrtpchannels.h:
+ Add method to get possible channel positions.
+
+2008-10-28 Wim Taymans <wim.taymans@collabora.co.uk>
+
* gst/rtp/Makefile.am:
Also commit updated makefile
diff --git a/gst/rtp/gstrtpchannels.c b/gst/rtp/gstrtpchannels.c
index 05100f0f..2ce42803 100644
--- a/gst/rtp/gstrtpchannels.c
+++ b/gst/rtp/gstrtpchannels.c
@@ -111,6 +111,37 @@ gst_rtp_channels_get_by_order (gint channels, const gchar * order)
}
/**
+ * gst_rtp_channels_get_by_index:
+ * @channels: the amount of channels
+ * @idx: the channel index to retrieve
+ *
+ * Get the allowed channel order descriptions for @channels. @idx can be used to
+ * retrieve the desired index.
+ *
+ * Returns: a #GstRTPChannelOrder at @idx, NULL when there are no valid channel
+ * orders.
+ */
+const GstRTPChannelOrder *
+gst_rtp_channels_get_by_index (gint channels, guint idx)
+{
+ gint i;
+ const GstRTPChannelOrder *res = NULL;
+
+ for (i = 0; channel_orders[i].pos; i++) {
+ if (channel_orders[i].channels != channels)
+ continue;
+
+ if (idx == 0) {
+ res = &channel_orders[i];
+ break;
+ }
+ idx--;
+ }
+ return res;
+}
+
+
+/**
* gst_rtp_channels_create_default:
* @channels: the amount of channels
*
diff --git a/gst/rtp/gstrtpchannels.h b/gst/rtp/gstrtpchannels.h
index 2c9efe38..591eb05f 100644
--- a/gst/rtp/gstrtpchannels.h
+++ b/gst/rtp/gstrtpchannels.h
@@ -181,5 +181,6 @@ const GstRTPChannelOrder * gst_rtp_channels_get_by_pos (gint channels,
const GstAudioChannelPosition *pos);
const GstRTPChannelOrder * gst_rtp_channels_get_by_order (gint channels,
const gchar *order);
+const GstRTPChannelOrder * gst_rtp_channels_get_by_index (gint channels, guint idx);
GstAudioChannelPosition * gst_rtp_channels_create_default (gint channels);