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.
This commit is contained in:
Christophe Fergeau 2003-11-28 13:04:21 +00:00
parent 40ea47fa69
commit c3328094e8
3 changed files with 30 additions and 8 deletions

View File

@ -55,7 +55,6 @@ enum
ARG_MIN_BITRATE, ARG_MIN_BITRATE,
ARG_QUALITY, ARG_QUALITY,
ARG_SERIAL, ARG_SERIAL,
ARG_METADATA,
ARG_MANAGED, ARG_MANAGED,
ARG_LAST_MESSAGE, ARG_LAST_MESSAGE,
}; };

View File

@ -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_from_vorbis_tag (const gchar * vorbis_tag);
G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_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 */ /* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer, GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,

View File

@ -383,15 +383,16 @@ typedef struct {
guint data_count; guint data_count;
GList *entries; GList *entries;
} MyForEach; } 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; gchar *result;
GList *l = NULL;
guint i; guint i;
const gchar *vorbis_tag = gst_tag_to_vorbis_tag (tag); 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++) { for (i = 0; i < gst_tag_list_get_tag_size (list, tag); i++) {
switch (gst_tag_get_type (tag)) { switch (gst_tag_get_type (tag)) {
case G_TYPE_UINT: case G_TYPE_UINT:
@ -420,8 +421,25 @@ write_one_tag (const GstTagList *list, const gchar *tag, gpointer user_data)
} }
default: default:
GST_DEBUG ("Couldn't write tag %s", tag); 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->count ++;
data->data_count += strlen (result); data->data_count += strlen (result);
data->entries = g_list_prepend (data->entries, result); data->entries = g_list_prepend (data->entries, result);