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).
This commit is contained in:
Tim-Philipp Müller 2006-05-15 09:00:42 +00:00
parent d0ba8b0f43
commit a5b0ad8834
3 changed files with 51 additions and 1 deletions

View file

@ -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:

2
common

@ -1 +1 @@
Subproject commit e41606ab2c6a31be473de511b5fd776bd2593b56
Subproject commit 3062df90281144cbdb55bd58ee9f0714ab346c23

View file

@ -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);
}