diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2006-08-24 10:03:03 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-08-24 10:03:03 +0000 |
commit | 3b826d41db635b3b8bda5d830c4fd8141c6940b2 (patch) | |
tree | 4d574abd0c73aacc393615b4cddc3df50ee248ff /ext/flac | |
parent | 424ea70f585877e4b479a9107b792c97c2856c4d (diff) |
ext/flac/gstflacdec.c: Use libgsttag helper function here too.
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_update_metadata):
Use libgsttag helper function here too.
Diffstat (limited to 'ext/flac')
-rw-r--r-- | ext/flac/gstflacdec.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index c3affa16..8a352910 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -301,31 +301,29 @@ gst_flac_dec_update_metadata (GstFlacDec * flacdec, const FLAC__StreamMetadata * metadata) { GstTagList *list; - guint32 number_of_comments, cursor, str_len; - gchar *p_value, *value, *name, *str_ptr; + guint num, i; list = gst_tag_list_new (); - if (list == NULL) { - return FALSE; - } - number_of_comments = metadata->data.vorbis_comment.num_comments; - value = NULL; - GST_DEBUG ("%d tag(s) found", number_of_comments); - for (cursor = 0; cursor < number_of_comments; cursor++) { - str_ptr = (gchar *) metadata->data.vorbis_comment.comments[cursor].entry; - str_len = metadata->data.vorbis_comment.comments[cursor].length; - p_value = g_strstr_len (str_ptr, str_len, "="); - if (p_value) { - name = g_strndup (str_ptr, p_value - str_ptr); - value = g_strndup (p_value + 1, str_ptr + str_len - p_value - 1); + num = metadata->data.vorbis_comment.num_comments; + GST_DEBUG ("%u tag(s) found", num); + + for (i = 0; i < num; ++i) { + gchar *vc, *name, *value; + vc = g_strndup ((gchar *) metadata->data.vorbis_comment.comments[i].entry, + metadata->data.vorbis_comment.comments[i].length); + + if (gst_tag_parse_extended_comment (vc, &name, NULL, &value, TRUE)) { GST_DEBUG ("%s : %s", name, value); gst_vorbis_tag_add (list, name, value); g_free (name); g_free (value); } + + g_free (vc); } + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_AUDIO_CODEC, "FLAC", NULL); |