Commit c3328094 authored by Christophe Fergeau's avatar Christophe Fergeau
Browse files

Use new tagging stuff to read and write flac metadata. Only handles...

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.
parent 40ea47fa
......@@ -55,7 +55,6 @@ enum
ARG_MIN_BITRATE,
ARG_QUALITY,
ARG_SERIAL,
ARG_METADATA,
ARG_MANAGED,
ARG_LAST_MESSAGE,
};
......
......@@ -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,
......
......@@ -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);
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment