gstbuffer: fix GstParentBufferMeta GType name
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 4 Mar 2016 17:23:18 +0000 (18:23 +0100)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 7 Mar 2016 11:02:00 +0000 (12:02 +0100)
The alias define GST_TYPE_PARENT_BUFFER_META_API_TYPE is wrong and
breaks the usage of gst_buffer_get_parent_buffer_meta().

This patch fixes the GType alias and make another alias to keep the API
compatibility guarded by GST_DISABLE_DEPRECATED.

Also added a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=763112

gst/gstbuffer.h
tests/check/gst/gstbuffer.c

index da9a033..4d72471 100644 (file)
@@ -597,7 +597,10 @@ struct _GstParentBufferMeta
 };
 
 GType gst_parent_buffer_meta_api_get_type (void);
-#define GST_TYPE_PARENT_BUFFER_META_API_TYPE (gst_parent_buffer_meta_api_get_type())
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_TYPE_PARENT_BUFFER_META_API_TYPE GST_PARENT_BUFFER_META_API_TYPE
+#endif
+#define GST_PARENT_BUFFER_META_API_TYPE (gst_parent_buffer_meta_api_get_type())
 
 /**
  * gst_buffer_get_parent_buffer_meta:
index 6291c24..66bb5d4 100644 (file)
@@ -890,6 +890,26 @@ GST_START_TEST (test_fill)
 
 GST_END_TEST;
 
+GST_START_TEST (test_parent_buffer_meta)
+{
+  GstBuffer *buf, *parent;
+  GstParentBufferMeta *meta;
+
+  buf = gst_buffer_new ();
+  parent = gst_buffer_new ();
+
+  gst_buffer_add_parent_buffer_meta (buf, parent);
+  meta = gst_buffer_get_parent_buffer_meta (buf);
+  fail_unless (meta);
+  fail_unless (parent == meta->buffer);
+
+  gst_buffer_unref (buf);
+  gst_buffer_unref (parent);
+}
+
+GST_END_TEST;
+
+
 static Suite *
 gst_buffer_suite (void)
 {
@@ -912,6 +932,7 @@ gst_buffer_suite (void)
   tcase_add_test (tc_chain, test_map_range);
   tcase_add_test (tc_chain, test_find);
   tcase_add_test (tc_chain, test_fill);
+  tcase_add_test (tc_chain, test_parent_buffer_meta);
 
   return s;
 }