[farsight2/master] Add fs_codec_are_equal_including_config()
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:22:55 PST 2008
---
docs/libs/farsight2-libs-sections.txt | 1 +
gst-libs/gst/farsight/fs-codec.c | 33 +++++++++++++++++++++++++++++++++
gst-libs/gst/farsight/fs-codec.h | 5 +++++
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt
index ac10b8b..ebcdbb5 100644
--- a/docs/libs/farsight2-libs-sections.txt
+++ b/docs/libs/farsight2-libs-sections.txt
@@ -114,6 +114,7 @@ fs_codec_new
fs_codec_destroy
fs_codec_copy
fs_codec_are_equal
+fs_codec_are_equal_including_config
fs_codec_list_from_keyfile
fs_codec_list_destroy
fs_codec_list_copy
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 0beda99..ce02bef 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -535,6 +535,9 @@ compare_lists (GList *list1, GList *list2)
* if their optional parameters are in a different order. %NULL encoding names
* are ignored. Configuration parameters are ignored when comparing.
*
+ * fs_codec_are_equal_including_config() is the same as this function, but also
+ * compares the configuration data
+ *
* Return value: %TRUE of the codecs are identical, %FALSE otherwise
*/
@@ -568,6 +571,36 @@ fs_codec_are_equal (const FsCodec *codec1, const FsCodec *codec2)
}
/**
+ * fs_codec_are_equal:
+ * @codec1: First codec
+ * @codec2: Second codec
+ *
+ * Compare two codecs, it will declare two codecs to be identical even
+ * if their optional parameters are in a different order. %NULL encoding names
+ * are ignored.
+ *
+ * This is the same as fs_codec_are_equal(), but also makes sure that the
+ * codec configurations are the same.
+ *
+ * Return value: %TRUE of the codecs are identical, %FALSE otherwise
+ */
+gboolean
+fs_codec_are_equal_including_config (
+ const FsCodec *codec1,
+ const FsCodec *codec2)
+{
+ if (!fs_codec_are_equal (codec1, codec2))
+ return FALSE;
+
+ if (!compare_lists (codec1->config_params, codec2->config_params) ||
+ !compare_lists (codec2->config_params, codec1->config_params))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/**
* fs_codec_to_gst_caps
* @codec: A #FsCodec to be converted
*
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index 6e3383d..55f72be 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -135,6 +135,11 @@ GstCaps *fs_codec_to_gst_caps (const FsCodec *codec);
gboolean fs_codec_list_are_equal (GList *list1, GList *list2);
+gboolean fs_codec_are_equal_including_config (
+ const FsCodec *codec1,
+ const FsCodec *codec2);
+
+
const gchar *fs_media_type_to_string (FsMediaType media_type);
void fs_codec_add_optional_parameter (FsCodec *codec, const gchar *name,
--
1.5.6.5
More information about the farsight-commits
mailing list