[Gstreamer-bugs] [Bug 104345] Changed - no metadata from flac element
bugzilla-daemon at widget.gnome.org
bugzilla-daemon at widget.gnome.org
Thu May 8 06:50:02 PDT 2003
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
http://bugzilla.gnome.org/show_bug.cgi?id=104345
Changed by rbultje at ronald.bitfreak.net.
--- shadow/104345 Thu May 8 08:33:07 2003
+++ shadow/104345.tmp.4844 Thu May 8 09:50:02 2003
@@ -32,6 +32,49 @@
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.
+
+------- Additional Comments From rbultje at ronald.bitfreak.net 2003-05-08 09:50 -------
+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. :).
More information about the Gstreamer-bugs
mailing list