{
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer =
- gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value->data[0].
- v_pointer));
+ gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value->
+ data[0].v_pointer));
} else {
dest_value->data[0].v_pointer = NULL;
}
* @value: a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
*
* Get the contents of a %GST_TYPE_MINI_OBJECT derived #GValue,
- * increasing its reference count.
+ * increasing its reference count. If the contents of the #GValue
+ * are %NULL, %NULL will be returned.
*
* Returns: (transfer full): mini object contents of @value
*
{
g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL);
- return gst_mini_object_ref (value->data[0].v_pointer);
+ return value->data[0].v_pointer ? gst_mini_object_ref (value->data[0].
+ v_pointer) : NULL;
}
GST_END_TEST;
+GST_START_TEST (test_dup_null_mini_object)
+{
+ GValue value = { 0, };
+ GstBuffer *buf;
+
+ g_value_init (&value, GST_TYPE_BUFFER);
+
+ gst_value_set_mini_object (&value, NULL);
+
+ buf = gst_value_dup_mini_object (&value);
+ g_assert (buf == NULL);
+
+ g_value_unset (&value);
+}
+
+GST_END_TEST;
+
static Suite *
gst_mini_object_suite (void)
{
tcase_add_test (tc_chain, test_unref_threaded);
tcase_add_test (tc_chain, test_recycle_threaded);
tcase_add_test (tc_chain, test_value_collection);
+ tcase_add_test (tc_chain, test_dup_null_mini_object);
return s;
}