diff options
author | Christophe Fergeau <teuf@gnome.org> | 2003-11-28 13:04:21 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2003-11-28 13:04:21 +0000 |
commit | c3328094e84eb8dc79eeade22d7e720063be90c7 (patch) | |
tree | 983ee00d8aa5313939abe60d941de59cbb708618 | |
parent | 40ea47fa690e71f8805e330565c2f32db86f1369 (diff) | |
download | gstreamer-plugins-base-c3328094e84eb8dc79eeade22d7e720063be90c7.tar.gz |
Use new tagging stuff to read and write flac metadata. Only handles vorbiscomment tags, and not (older) id3v2 tags.
Original commit message from CVS:
Use new tagging stuff to read and write flac metadata. Only handles vorbiscomment tags, and not (older) id3v2 tags.
-rw-r--r-- | ext/vorbis/vorbisenc.c | 1 | ||||
-rw-r--r-- | gst/tags/gsttagediting.h | 7 | ||||
-rw-r--r-- | gst/tags/gstvorbistag.c | 30 |
3 files changed, 30 insertions, 8 deletions
diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 05c0746b8..3649e8bb9 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -55,7 +55,6 @@ enum ARG_MIN_BITRATE, ARG_QUALITY, ARG_SERIAL, - ARG_METADATA, ARG_MANAGED, ARG_LAST_MESSAGE, }; diff --git a/gst/tags/gsttagediting.h b/gst/tags/gsttagediting.h index be0e29875..7bf968eb2 100644 --- a/gst/tags/gsttagediting.h +++ b/gst/tags/gsttagediting.h @@ -30,7 +30,12 @@ G_BEGIN_DECLS G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag); G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag); -void gst_vorbis_tag_add (GstTagList *list, const gchar *tag, const gchar *value); +void gst_vorbis_tag_add (GstTagList * list, + const gchar * tag, + const gchar * value); + +GList * gst_tag_to_vorbis_comments (const GstTagList * list, + const gchar * tag); /* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */ GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer, diff --git a/gst/tags/gstvorbistag.c b/gst/tags/gstvorbistag.c index f0c8fff18..d2fbfa81c 100644 --- a/gst/tags/gstvorbistag.c +++ b/gst/tags/gstvorbistag.c @@ -383,15 +383,16 @@ typedef struct { guint data_count; GList *entries; } MyForEach; -static void -write_one_tag (const GstTagList *list, const gchar *tag, gpointer user_data) + +GList * +gst_tag_to_vorbis_comments (const GstTagList *list, const gchar *tag) { gchar *result; + GList *l = NULL; guint i; const gchar *vorbis_tag = gst_tag_to_vorbis_tag (tag); - MyForEach *data = (MyForEach *) user_data; - if (!vorbis_tag) return; + if (!vorbis_tag) return NULL; for (i = 0; i < gst_tag_list_get_tag_size (list, tag); i++) { switch (gst_tag_get_type (tag)) { case G_TYPE_UINT: @@ -420,11 +421,28 @@ write_one_tag (const GstTagList *list, const gchar *tag, gpointer user_data) } default: GST_DEBUG ("Couldn't write tag %s", tag); - return; + continue; } + l = g_list_prepend (l, result); + } + + return g_list_reverse (l); +} + +static void +write_one_tag (const GstTagList *list, const gchar *tag, gpointer user_data) +{ + MyForEach *data = (MyForEach *) user_data; + GList *comments; + GList *it; + + comments = gst_tag_to_vorbis_comments (list, tag); + + for (it = comments; it != NULL; it = it->next) { + gchar *result = it->data; data->count ++; data->data_count += strlen (result); - data->entries = g_list_prepend (data->entries, result); + data->entries = g_list_prepend (data->entries, result); } } /** |