gst/rtp/: Make mode property a string. Fixes #464475.
authorOlivier Crete <tester@tester.ca>
Wed, 8 Aug 2007 10:54:50 +0000 (10:54 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 8 Aug 2007 10:54:50 +0000 (10:54 +0000)
Original commit message from CVS:
Patch by: Olivier Crete <tester at tester dot ca>
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_setcaps):
* gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_setcaps):
Make mode property a string. Fixes #464475.

ChangeLog
gst/rtp/gstrtpilbcdepay.c
gst/rtp/gstrtpilbcpay.c

index 4ba07a8..5e82ed9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-08  Wim Taymans  <wim.taymans@gmail.com>
+
+       Patch by: Olivier Crete <tester at tester dot ca>
+
+       * gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_setcaps):
+       * gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_setcaps):
+       Make mode property a string. Fixes #464475.
+
 2007-08-05  Stefan Kost  <ensonic@users.sf.net>
 
        * ext/flac/gstflacenc.c:
index 3ab1611..a829056 100644 (file)
@@ -56,7 +56,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
         "media = (string) \"audio\", "
         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
         "clock-rate = (int) 8000, "
-        "encoding-name = (string) \"ILBC\", " "mode = (int) { 20, 30 }")
+        "encoding-name = (string) \"ILBC\", "
+        "mode = (string) { \"20\", \"30\" }")
     );
 
 static GstStaticPadTemplate gst_rtp_ilbc_depay_src_template =
@@ -149,14 +150,22 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
   GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (depayload);
   GstCaps *srccaps;
   GstStructure *structure;
+  const gchar *mode_str = NULL;
   gint mode;
   gboolean ret;
 
   structure = gst_caps_get_structure (caps, 0);
 
-  /* parse mode, if we can */
   mode = rtpilbcdepay->mode;
-  gst_structure_get_int (structure, "mode", &mode);
+
+  /* parse mode, if we can */
+  mode_str = gst_structure_get_string (structure, "mode");
+  if (mode_str) {
+    mode = strtol (mode_str, NULL, 10);
+    if (mode != 20 && mode != 30)
+      mode = rtpilbcdepay->mode;
+  }
+
   rtpilbcdepay->mode = mode;
 
   srccaps = gst_caps_new_simple ("audio/x-iLBC",
index 736e633..708f535 100644 (file)
@@ -50,7 +50,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
         "media = (string) \"audio\", "
         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
         "clock-rate = (int) 8000, "
-        "encoding-name = (string) \"ILBC\", " "mode = (int) {20, 30}")
+        "encoding-name = (string) \"ILBC\", "
+        "mode = (string) { \"20\", \"30\" }")
     );
 
 static gboolean gst_rtpilbcpay_setcaps (GstBaseRTPPayload * payload,
@@ -116,6 +117,7 @@ gst_rtpilbcpay_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
   GstBaseRTPAudioPayload *basertpaudiopayload;
   gboolean ret;
   gint mode;
+  gchar *mode_str;
   GstStructure *structure;
   const char *payload_name;
 
@@ -137,9 +139,13 @@ gst_rtpilbcpay_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
   gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload,
       mode, mode == 30 ? 50 : 38);
 
+
+  mode_str = g_strdup_printf ("%d", mode);
   ret =
-      gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_INT, mode,
-      NULL);
+      gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_STRING,
+      mode_str, NULL);
+  g_free (mode_str);
+
   if (mode != rtpilbcpay->mode && rtpilbcpay->mode != -1)
     goto mode_changed;