GST_END_TEST GST_START_TEST (test_date_tags) { GstTagList *tag_list, *tag_list2; GDate *date, *date2; gchar *str; date = g_date_new_dmy (14, 10, 2005); tag_list = gst_tag_list_new_empty (); gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_DATE, date, NULL); str = gst_tag_list_to_string (tag_list); fail_if (str == NULL); fail_if (strstr (str, "2005-10-14") == NULL); tag_list2 = gst_tag_list_new_from_string (str); fail_if (tag_list2 == NULL); fail_if (!gst_tag_list_get_date (tag_list2, GST_TAG_DATE, &date2)); fail_unless (gst_tag_list_is_equal (tag_list2, tag_list)); gst_tag_list_unref (tag_list2); g_free (str); fail_if (g_date_compare (date, date2) != 0); fail_if (g_date_get_day (date) != 14); fail_if (g_date_get_month (date) != 10); fail_if (g_date_get_year (date) != 2005); fail_if (g_date_get_day (date2) != 14); fail_if (g_date_get_month (date2) != 10); fail_if (g_date_get_year (date2) != 2005); g_date_free (date2); gst_tag_list_unref (tag_list); g_date_free (date); }
bool operator == (tag_list const &p_first, tag_list const &p_second) { if (p_first.get_tag_list() == p_second.get_tag_list()) return true; else if ((p_first.get_tag_list() != NULL) && (p_second.get_tag_list() == NULL)) return false; else if ((p_first.get_tag_list() == NULL) && (p_second.get_tag_list() != NULL)) return false; else return gst_tag_list_is_equal(p_first.get_tag_list(), p_second.get_tag_list()); }
/** * gst_stream_set_tags: * @stream: a #GstStream * @tags: (transfer none) (allow-none): a #GstTagList * * Set the tags for the #GstStream * * Since: 1.10 */ void gst_stream_set_tags (GstStream * stream, GstTagList * tags) { gboolean notify = FALSE; GST_OBJECT_LOCK (stream); if (stream->priv->tags == NULL || tags == NULL || !gst_tag_list_is_equal (stream->priv->tags, tags)) { gst_mini_object_replace ((GstMiniObject **) & stream->priv->tags, (GstMiniObject *) tags); notify = TRUE; } GST_OBJECT_UNLOCK (stream); if (notify) g_object_notify_by_pspec (G_OBJECT (stream), gst_stream_pspecs[PROP_TAGS]); }
static gint compare_tags (GstMediaDescriptor * ref, StreamNode * rstream, StreamNode * cstream) { gboolean found; TagNode *rtag, *ctag; GList *rtag_list, *ctag_list; TagsNode *rtags, *ctags; rtags = rstream->tags; ctags = cstream->tags; if (rtags == NULL && ctags) return 1; else if (!rtags && ctags) { GList *taglist; GString *all_tags = g_string_new (NULL); for (taglist = ctags->tags; taglist; taglist = taglist->next) { gchar *stags = gst_tag_list_to_string (((TagNode *) taglist->data)->taglist); g_string_append_printf (all_tags, "%s\n", stags); g_free (stags); } GST_VALIDATE_REPORT (ref, FILE_TAG_DETECTION_INCORRECT, "Reference descriptor for stream %s has NO tags" " but tags found: %s", all_tags->str); g_string_free (all_tags, TRUE); return 0; } else if (rtags && !ctags) { GList *taglist; GString *all_tags = g_string_new (NULL); for (taglist = rtags->tags; taglist; taglist = taglist->next) { gchar *stags = gst_tag_list_to_string (((TagNode *) taglist->data)->taglist); g_string_append_printf (all_tags, "%s\n", stags); g_free (stags); } GST_VALIDATE_REPORT (ref, FILE_TAG_DETECTION_INCORRECT, "Reference descriptor for stream %s has tags:\n %s\n" " but NO tags found on the stream"); g_string_free (all_tags, TRUE); return 0; } for (rtag_list = rtags->tags; rtag_list; rtag_list = rtag_list->next) { rtag = rtag_list->data; found = FALSE; for (ctag_list = ctags->tags; ctag_list; ctag_list = ctag_list->next) { ctag = ctag_list->data; if (gst_tag_list_is_equal (rtag->taglist, ctag->taglist)) { found = TRUE; break; } } if (found == FALSE) { gchar *rtaglist = gst_tag_list_to_string (rtag->taglist); GST_VALIDATE_REPORT (ref, FILE_TAG_DETECTION_INCORRECT, "Reference descriptor for stream %s has tags %s" " but no equivalent taglist was found on the compared stream", rstream->id, rtaglist); g_free (rtaglist); return 0; } } return 1; }