static gboolean gst_wavenc_parse_note (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry) { gchar *tag; GstTagList *tags; GstWavEncNote *note; g_return_val_if_fail (entry != NULL, FALSE); tags = gst_toc_entry_get_tags (entry); if (!tags) { GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id); return FALSE; } if (!gst_tag_list_get_string (tags, GST_TAG_COMMENT, &tag)) { GST_INFO_OBJECT (wavenc, "no comment tag for entry: %d", id); return FALSE; } note = g_new (GstWavEncNote, 1); memcpy (note->chunk_id, "note", 4); note->chunk_data_size = 4 + strlen (tag) + 1; note->cue_point_id = id; note->text = tag; GST_DEBUG_OBJECT (wavenc, "got note: '%s'", tag); wavenc->notes = g_list_append (wavenc->notes, note); return TRUE; }
static gboolean gst_wavenc_parse_labl (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry) { gchar *tag; GstTagList *tags; GstWavEncLabl *labl; g_return_val_if_fail (entry != NULL, FALSE); tags = gst_toc_entry_get_tags (entry); if (!tags) { GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id); return FALSE; } if (!gst_tag_list_get_string (tags, GST_TAG_TITLE, &tag)) { GST_INFO_OBJECT (wavenc, "no title tag for entry: %d", id); return FALSE; } labl = g_new (GstWavEncLabl, 1); memcpy (labl->chunk_id, "labl", 4); labl->chunk_data_size = 4 + strlen (tag) + 1; labl->cue_point_id = id; labl->text = tag; GST_DEBUG_OBJECT (wavenc, "got labl: '%s'", tag); wavenc->labls = g_list_append (wavenc->labls, labl); return TRUE; }
static void print_toc_entry (gpointer data, gpointer user_data) { GstTocEntry *entry = (GstTocEntry *) data; guint depth = GPOINTER_TO_UINT (user_data); guint indent = MIN (GPOINTER_TO_UINT (user_data), MAX_INDENT); GstTagList *tags; GList *subentries; gint64 start, stop; gst_toc_entry_get_start_stop_times (entry, &start, &stop); g_print ("%*s%s: start: %" GST_TIME_FORMAT " stop: %" GST_TIME_FORMAT "\n", depth, " ", gst_toc_entry_type_get_nick (gst_toc_entry_get_entry_type (entry)), GST_TIME_ARGS (start), GST_TIME_ARGS (stop)); indent += 2; /* print tags */ tags = gst_toc_entry_get_tags (entry); if (tags) { g_print ("%*sTags:\n", 2 * depth, " "); gst_tag_list_foreach (tags, print_tag_foreach, GUINT_TO_POINTER (indent)); } /* loop over sub-toc entries */ subentries = gst_toc_entry_get_sub_entries (entry); g_list_foreach (subentries, print_toc_entry, GUINT_TO_POINTER (indent)); }
static void CHECK_TOC_ENTRY (GstTocEntry * entry_c, GstTocEntryType type_c, const gchar * uid_c) { GstTagList *tags; gchar *tag_c; fail_unless_equals_string (gst_toc_entry_get_uid (entry_c), uid_c); fail_unless (gst_toc_entry_get_entry_type (entry_c) == type_c); tags = gst_toc_entry_get_tags (entry_c); fail_unless (tags != NULL); fail_unless (gst_tag_list_get_string (tags, GST_TAG_TITLE, &tag_c)); fail_unless_equals_string (tag_c, ENTRY_TAG); g_free (tag_c); }