[farsight2/master] codec: Add ptime

Olivier Crête olivier.crete at collabora.co.uk
Mon Dec 28 17:13:56 PST 2009


---
 gst-libs/gst/farsight/fs-codec.c |   12 ++++++++++++
 gst-libs/gst/farsight/fs-codec.h |    4 +++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index f57da6b..838cb26 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -159,6 +159,7 @@ fs_codec_copy (const FsCodec * codec)
   copy->clock_rate = codec->clock_rate;
   copy->channels = codec->channels;
   copy->ABI.ABI.maxptime = codec->ABI.ABI.maxptime;
+  copy->ABI.ABI.ptime = codec->ABI.ABI.ptime;
 
   copy->encoding_name = g_strdup (codec->encoding_name);
 
@@ -364,6 +365,13 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error)
           codec->ABI.ABI.maxptime = 0;
           goto keyerror;
         }
+      } else if (!g_ascii_strcasecmp ("ptime", keys[j])) {
+        codec->ABI.ABI.ptime = g_key_file_get_integer (keyfile, groups[i],
+            keys[j], &gerror);
+        if (gerror) {
+          codec->ABI.ABI.ptime = 0;
+          goto keyerror;
+        }
       } else {
         FsCodecParameter *param = g_slice_new (FsCodecParameter);
 
@@ -461,6 +469,9 @@ fs_codec_to_string (const FsCodec *codec)
   if (codec->ABI.ABI.maxptime)
     g_string_append_printf (string, " maxptime=%u", codec->ABI.ABI.maxptime);
 
+  if (codec->ABI.ABI.ptime)
+    g_string_append_printf (string, " ptime=%u", codec->ABI.ABI.ptime);
+
   for (item = codec->optional_params;
        item;
        item = g_list_next (item)) {
@@ -534,6 +545,7 @@ fs_codec_are_equal (const FsCodec *codec1, const FsCodec *codec2)
       codec1->clock_rate != codec2->clock_rate ||
       codec1->channels != codec2->channels ||
       codec1->ABI.ABI.maxptime != codec2->ABI.ABI.maxptime ||
+      codec1->ABI.ABI.ptime != codec2->ABI.ABI.ptime ||
       codec1->encoding_name == NULL ||
       codec2->encoding_name == NULL ||
       g_ascii_strcasecmp (codec1->encoding_name, codec2->encoding_name))
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index 496be5e..934e079 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -81,7 +81,8 @@ typedef enum
  * @clock_rate: clock rate of this stream
  * @channels: Number of channels codec should decode
  * @optional_params: key pairs of param name to param data
- * @maxptime: The maximum size (in ms) of a sent buffer
+ * @ptime: The preferred duration (in ms) of a packet
+ * @maxptime: The maximum duration (in ms) of a packet
  *
  * This structure reprensents one codec that can be offered or received
  */
@@ -97,6 +98,7 @@ struct _FsCodec
   /*< private >*/
   union {
     struct {
+      guint ptime;
       guint maxptime;
     } ABI;
     gpointer _padding[4];         /* padding for binary-compatible
-- 
1.5.6.5




More information about the farsight-commits mailing list