taglist: add warning when we get something else than a sample for a sample tag

Facilitate GstBuffer -> GstSample transition for some tags,
could be hard to catch otherwise when creating tags, since
it'll only be apparent later when someone tries to read the
tags.
This commit is contained in:
Tim-Philipp Müller 2012-09-13 00:38:21 +01:00
parent 0bc87ee5d9
commit c2a25bcd0f

View file

@ -1261,7 +1261,13 @@ gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode,
*/
return;
}
gst_tag_list_add_value_internal (list, mode, tag, &value, info);
/* Facilitate GstBuffer -> GstSample transition */
if (G_UNLIKELY (info->type == GST_TYPE_SAMPLE &&
!GST_IS_SAMPLE (value.data[0].v_pointer))) {
g_warning ("Expected GstSample argument for tag '%s'", tag);
} else {
gst_tag_list_add_value_internal (list, mode, tag, &value, info);
}
g_value_unset (&value);
tag = va_arg (var_args, gchar *);
}