diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2006-05-15 09:00:42 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-05-15 09:00:42 +0000 |
commit | a5b0ad8834a7f3c227232a05c3d33d3d5947339e (patch) | |
tree | 57391fa4172e2259aa58f43e4e2c8e94963b5b33 | |
parent | d0ba8b0f4332d2f906992a78c073fec995e061b1 (diff) |
ext/taglib/gstid3v2mux.cc: Add support for writing images (APIC frames) into ID3v2 tags (picture type always set to '...
Original commit message from CVS:
* ext/taglib/gstid3v2mux.cc:
Add support for writing images (APIC frames) into ID3v2
tags (picture type always set to 'other' for now though).
-rw-r--r-- | ChangeLog | 6 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | ext/taglib/gstid3v2mux.cc | 44 |
3 files changed, 50 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2006-05-15 Tim-Philipp Müller <tim at centricular dot net> + + * ext/taglib/gstid3v2mux.cc: + Add support for writing images (APIC frames) into ID3v2 + tags (picture type always set to 'other' for now though). + 2006-05-14 Michael Smith <msmith@fluendo.com> * gst/wavparse/gstwavparse.c: diff --git a/common b/common -Subproject e41606ab2c6a31be473de511b5fd776bd2593b5 +Subproject 3062df90281144cbdb55bd58ee9f0714ab346c2 diff --git a/ext/taglib/gstid3v2mux.cc b/ext/taglib/gstid3v2mux.cc index a1e4537e..e77cb749 100644 --- a/ext/taglib/gstid3v2mux.cc +++ b/ext/taglib/gstid3v2mux.cc @@ -59,6 +59,7 @@ #include <textidentificationframe.h> #include <uniquefileidentifierframe.h> +#include <attachedpictureframe.h> #include <id3v2tag.h> #include <gst/tag/tag.h> @@ -316,6 +317,49 @@ add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data) id3v2tag->addFrame (frame); g_free (id_str); } + } else if (strcmp (tag, GST_TAG_IMAGE) == 0) { + const GValue *val; + GstBuffer *image; + + GST_LOG ("image tag"); + val = gst_tag_list_get_value_index (list, tag, 0); + image = (GstBuffer *) gst_value_get_mini_object (val); + if (GST_IS_BUFFER (image) && GST_BUFFER_SIZE (image) > 0 && + GST_BUFFER_CAPS (image) != NULL && + !gst_caps_is_empty (GST_BUFFER_CAPS (image))) { + const gchar *mime_type; + GstStructure *s; + + s = gst_caps_get_structure (GST_BUFFER_CAPS (image), 0); + mime_type = gst_structure_get_name (s); + if (mime_type != NULL) { + ID3v2::AttachedPictureFrame * frame; + const gchar *desc; + + if (strcmp (mime_type, "text/uri-list") == 0) + mime_type = "-->"; + + frame = new ID3v2::AttachedPictureFrame (); + + GST_DEBUG ("Attaching picture of %u bytes and mime type %s", + GST_BUFFER_SIZE (image), mime_type); + + id3v2tag->addFrame (frame); + frame->setPicture (ByteVector ((const char *) GST_BUFFER_DATA (image), + GST_BUFFER_SIZE (image))); + frame->setTextEncoding (String::UTF8); + frame->setMimeType (mime_type); + + desc = gst_structure_get_string (s, "image-description"); + frame->setDescription ((desc) ? desc : ""); + + /* FIXME */ + frame->setType (ID3v2::AttachedPictureFrame::Other); + } + } else { + GST_WARNING ("NULL image or no caps on image buffer (%p, caps=%" + GST_PTR_FORMAT ")", image, (image) ? GST_BUFFER_CAPS (image) : NULL); + } } else { GST_WARNING ("Unsupported tag: %s", tag); } |