[farsight2/master] Add defines for codec id (and allow disabling codecs)

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:19:42 PST 2008


---
 gst-libs/gst/farsight/fs-codec.c |    9 ++++++---
 gst-libs/gst/farsight/fs-codec.h |    4 ++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 62d1079..f02ddf5 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -293,7 +293,7 @@ fs_codec_list_from_keyfile (const gchar *filename)
     gchar *encoding_name = NULL;
     gchar *next_tok = NULL;
 
-    codec->id = -1;
+    codec->id = FS_CODEC_ID_ANY;
 
     keys = g_key_file_get_keys (keyfile, groups[i], &keys_count, &gerror);
 
@@ -356,10 +356,13 @@ fs_codec_list_from_keyfile (const gchar *filename)
          codec->id = g_key_file_get_integer (keyfile, groups[i], keys[j],
             &gerror);
         if (gerror) {
-          codec->id = -1;
+          codec->id = FS_CODEC_ID_ANY;
           goto keyerror;
         }
 
+        if (codec->id < 0)
+          codec->id = FS_CODEC_ID_DISABLE;
+
       } else if (!strcmp ("channels", keys[j])) {
          codec->channels = g_key_file_get_integer (keyfile, groups[i], keys[j],
             &gerror);
@@ -372,7 +375,7 @@ fs_codec_list_from_keyfile (const gchar *filename)
         FsCodecParameter *param = g_new0 (FsCodecParameter, 1);
 
         param->name = g_strdup (keys[j]);
-        param->value = g_key_file_get_string (keyfile, groups[i], keys[j], 
+        param->value = g_key_file_get_string (keyfile, groups[i], keys[j],
             &gerror);
         if (gerror) {
           g_free (param->name);
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index 17b4162..114bfd4 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -62,6 +62,10 @@ typedef enum
   FS_MEDIA_TYPE_LAST = FS_MEDIA_TYPE_APPLICATION
 } FsMediaType;
 
+
+#define FS_CODEC_ID_ANY            (-1)
+#define FS_CODEC_ID_DISABLE        (-2)
+
 /**
  * FsCodec:
  * @id: numeric identifier for encoding, eg. PT for SDP
-- 
1.5.6.5




More information about the farsight-commits mailing list