[farsight2/master] Add function to search for optional codec parameters

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


---
 docs/libs/farsight2-libs-sections.txt |    1 +
 gst-libs/gst/farsight/fs-codec.c      |   33 +++++++++++++++++++++++++++++++++
 gst-libs/gst/farsight/fs-codec.h      |    3 +++
 3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt
index 4b08b5f..6b86f2e 100644
--- a/docs/libs/farsight2-libs-sections.txt
+++ b/docs/libs/farsight2-libs-sections.txt
@@ -122,6 +122,7 @@ fs_codec_to_string
 fs_codec_to_gst_caps
 fs_codec_add_optional_parameter
 fs_codec_remove_optional_parameter
+fs_codec_get_optional_parameter
 FS_CODEC_FORMAT
 FS_CODEC_ARGS
 <SUBSECTION Standard>
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index ea86b78..f5038a6 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -679,3 +679,36 @@ fs_codec_remove_optional_parameter (FsCodec *codec,
   g_slice_free (FsCodecParameter, param);
   codec->optional_params = g_list_remove (codec->optional_params, param);
 }
+
+/**
+ * fs_codec_get_optional_parameter:
+ * @codec: a #FsCodec
+ * @name: The name of the parameter to search for
+ * @value: The value of the parameter to search for or %NULL for any value
+ *
+ * Finds the #FsCodecParameter in the #FsCodec that has the requested name
+ * and, if not %NULL, the requested value
+ *
+ * Returns: the #FsCodecParameter from the #FsCodec or %NULL
+ */
+
+FsCodecParameter *
+fs_codec_get_optional_parameter (FsCodec *codec, gchar *name, gchar *value)
+{
+  GList *item = NULL;
+
+  g_return_val_if_fail (codec != NULL, NULL);
+  g_return_val_if_fail (name != NULL, NULL);
+
+  for (item = g_list_first (codec->optional_params);
+       item;
+       item = g_list_next (item))
+  {
+    FsCodecParameter *param = item->data;
+    if (!g_ascii_strcasecmp (param->name, name) &&
+        (value == NULL || !g_ascii_strcasecmp (param->value, value)))
+      return param;
+  }
+
+  return NULL;
+}
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index 6442ebc..6914d21 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -163,6 +163,9 @@ void fs_codec_add_optional_parameter (FsCodec *codec, const gchar *name,
 void fs_codec_remove_optional_parameter (FsCodec *codec,
     FsCodecParameter *param);
 
+FsCodecParameter *fs_codec_get_optional_parameter (FsCodec *codec,
+    gchar *name, gchar *value);
+
 G_END_DECLS
 
 #endif /* __FS_CODEC_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list