GNOME Bugzilla – Bug 104345
vorbis metadata needs converting to gst format
Last modified: 2004-12-22 21:47:04 UTC
Just filing a bug for the fact that there's no metadata implementented yet for the flac element.
*** Bug 112569 has been marked as a duplicate of this bug. ***
Hm, seems like there's a lot of interest for FLAC... http://flac.sourceforge.net/format.html "VORBIS_COMMENT: This block is for storing a list of human-readable name/value pairs. Values are encoded using UTF-8. It is an implementation of the Vorbis comment specification. This is the only officially supported tagging mechanism in FLAC. There may be only one VORBIS_COMMENT block in a stream." According to Ross (rburton), FLAC__file_encoder_set_metadata() is the way to go here.
So, according to the docs, it'd look like: static void set_metadata (FLAC__StreamEncoder *encoder, GstCaps *caps) { FLAC__StreamMetadata *meta = g_malloc(sizeof(FLAC__StreamMetadata)); const gchar **meta_types = { "TITLE", "VERSION", "ALBUM", "TRACKNUMBER", "ARTIST", "PERFORMER", "COPYRIGHT", "LICENSE", "ORGANISATION", "DESCRIPTION", "GENRE", "DATE", "LOCATION", "CONTACT", "ISRC", NULL }; meta->type = FLAC__METADATA_TYPE_VORBIS_COMMENT; meta->data.vorbis_comment.vendor_string.length = strlen(FLAC__VENDOR_STRING); meta->data.vorbis_comment.vendor_string.entry = FLAC__VENDOR_STRING; meta->data.num_comments = 0; meta->data.comments = g_malloc(sizeof(FLAC__StreamMetadata_VorbisComment_Entry) * 15); /* max */ /* num_comments */ for ( ; *meta_types != NULL; meta_types++) { if (gst_caps_has_property(caps, *meta_types)) { gchar *entry; gst_caps_get_string(caps, *meta_types, &entry); meta->data.comments[meta->data.num_comments].length = strlen(entry) + strlen(*meta_types) + 1; meta->data.comments[meta.data.num_comments].entry = g_strdup_printf("%s=%s", *meta_types, entry); meta->data.num_comments++; } } FLAC__file_encoder_set_metadata(encoder, &meta, 1); } After initting the encoder, we should free the struct somewhere. Besides, it's untested. However, it's a start. :).
From what I understand, flacdec would have to use FLAC__stream_decoder_set_metadata_callback() to get a metadata callback when the file in question contains metadata. The callback would then have to check whether the metadata block is a VorbisComment metadata block and - if yes - read the metadata and signal that it has metadata using the proper GStreamer callbacks (g_object_notify(object, "metadata") or so)... The way in which we interpret is is the same as above.
apoc just notified me that he added this last week, so I shouldn't have written all that... Current stuff remaining is that we use the vorbis comment tags (in caps, see above) for metadata, and we should translate that to gstreamer tags (lowercase).
Hm, we have multiple bugs describing the same issue... *** This bug has been marked as a duplicate of 110544 ***