[farsight2/master] rtpconference: Add function to make gst caps while keeping the ptime

Olivier Crête olivier.crete at collabora.co.uk
Mon Dec 28 18:18:50 PST 2009


---
 gst/fsrtpconference/fs-rtp-conference.c |   29 +++++++++++++++++++++++++++++
 gst/fsrtpconference/fs-rtp-conference.h |    1 +
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index 78d687e..030ef2b 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -866,3 +866,32 @@ fs_codec_to_gst_caps (const FsCodec *codec)
   return caps;
 }
 
+
+/**
+ * fs_codec_to_gst_caps_with_ptime
+ * @codec: A #FsCodec to be converted
+ *
+ * This function converts a #FsCodec to a fixed #GstCaps with media type
+ * application/x-rtp. This will also add the ptime/maxptime from the codec
+ * into the #GstCaps.
+ *
+ * Return value: A newly-allocated #GstCaps or %NULL if the codec was %NULL
+ */
+
+GstCaps *
+fs_codec_to_gst_caps_with_ptime (const FsCodec *codec)
+{
+  GstCaps *caps = fs_codec_to_gst_caps (codec);
+
+  if (caps)
+  {
+    if (codec->ABI.ABI.ptime)
+      gst_caps_set_simple (caps,
+          "ptime", G_TYPE_UINT, codec->ABI.ABI.ptime, NULL);
+    if (codec->ABI.ABI.maxptime)
+      gst_caps_set_simple (caps,
+          "maxptime", G_TYPE_UINT, codec->ABI.ABI.maxptime, NULL);
+  }
+
+  return caps;
+}
diff --git a/gst/fsrtpconference/fs-rtp-conference.h b/gst/fsrtpconference/fs-rtp-conference.h
index b39b958..05efc77 100644
--- a/gst/fsrtpconference/fs-rtp-conference.h
+++ b/gst/fsrtpconference/fs-rtp-conference.h
@@ -75,6 +75,7 @@ GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_nego);
 
 
 GstCaps *fs_codec_to_gst_caps (const FsCodec *codec);
+GstCaps *fs_codec_to_gst_caps_with_ptime (const FsCodec *codec);
 
 
 G_END_DECLS
-- 
1.5.6.5




More information about the farsight-commits mailing list