gst/gstvalue.c: add comparison function for buffers

Original commit message from CVS:
* gst/gstvalue.c: (gst_value_compare_buffer),
(_gst_value_initialize):
add comparison function for buffers
This commit is contained in:
Benjamin Otte 2004-04-23 01:20:59 +00:00
parent fd8df4039c
commit 6eb8a092a4
2 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2004-04-23 Benjamin Otte <otte@gnome.org>
* gst/gstvalue.c: (gst_value_compare_buffer),
(_gst_value_initialize):
add comparison function for buffers
2004-04-22 Ronald Bultje <rbultje@ronald.bitfreak.net> 2004-04-22 Ronald Bultje <rbultje@ronald.bitfreak.net>
* docs/pwg/pwg.xml: * docs/pwg/pwg.xml:

View file

@ -788,6 +788,25 @@ gst_value_get_caps (const GValue * value)
/*************************************/ /*************************************/
/* GstBuffer */ /* GstBuffer */
static int
gst_value_compare_buffer (const GValue * value1, const GValue * value2)
{
GstBuffer *buf1 = g_value_get_boxed (value1);
GstBuffer *buf2 = g_value_get_boxed (value2);
if (GST_BUFFER_SIZE (buf1) != GST_BUFFER_SIZE (buf2))
return GST_VALUE_UNORDERED;
if (GST_BUFFER_SIZE (buf1) == 0)
return GST_VALUE_EQUAL;
g_assert (GST_BUFFER_DATA (buf1));
g_assert (GST_BUFFER_DATA (buf2));
if (memcmp (GST_BUFFER_DATA (buf1), GST_BUFFER_DATA (buf2),
GST_BUFFER_SIZE (buf1)) == 0)
return GST_VALUE_EQUAL;
return GST_VALUE_UNORDERED;
}
static char * static char *
gst_value_serialize_buffer (const GValue * value) gst_value_serialize_buffer (const GValue * value)
{ {
@ -2119,7 +2138,7 @@ _gst_value_initialize (void)
#endif #endif
static GstValueTable gst_value = { static GstValueTable gst_value = {
0, 0,
NULL, /*gst_value_compare_buffer, */ gst_value_compare_buffer,
gst_value_serialize_buffer, gst_value_serialize_buffer,
gst_value_deserialize_buffer, gst_value_deserialize_buffer,
}; };