summaryrefslogtreecommitdiff
path: root/gst/id3tag
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2013-12-16 11:51:00 +0100
committerSebastian Dröge <sebastian@centricular.com>2013-12-16 11:51:00 +0100
commit2ce2017650bed25e1b090933b79b845276023964 (patch)
treeb07f59a21ab5acde494a2f5ad83cee82d18c27c9 /gst/id3tag
parentb3f198b67d022ee1a9bbbf6b77cedea578881c96 (diff)
downloadgstreamer-plugins-bad-2ce2017650bed25e1b090933b79b845276023964.tar.gz
id3tag: Write image-type into the APIC tag
Diffstat (limited to 'gst/id3tag')
-rw-r--r--gst/id3tag/id3tag.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/gst/id3tag/id3tag.c b/gst/id3tag/id3tag.c
index ea322d17d..62bf7dd23 100644
--- a/gst/id3tag/id3tag.c
+++ b/gst/id3tag/id3tag.c
@@ -749,11 +749,28 @@ add_image_tag (GstId3v2Tag * id3v2tag, const GstTagList * list,
id3v2_frame_write_string (&frame, encoding, mime_type, TRUE);
- /* FIXME set image type properly from caps */
- if (strcmp (tag, GST_TAG_PREVIEW_IMAGE) == 0)
+ if (strcmp (tag, GST_TAG_PREVIEW_IMAGE) == 0) {
id3v2_frame_write_uint8 (&frame, ID3V2_APIC_PICTURE_FILE_ICON);
- else
- id3v2_frame_write_uint8 (&frame, ID3V2_APIC_PICTURE_OTHER);
+ } else {
+ const GstStructure *info_struct;
+ int image_type;
+
+ info_struct = gst_sample_get_info (sample);
+ if (info_struct
+ && gst_structure_has_name (info_struct, "GstTagImageInfo")) {
+ if (gst_structure_get (info_struct, "image-type",
+ GST_TYPE_TAG_IMAGE_TYPE, &image_type, NULL)) {
+ if (image_type > 0 && image_type <= 18) {
+ image_type += 2;
+ } else {
+ image_type = ID3V2_APIC_PICTURE_OTHER;
+ }
+ } else {
+ image_type = ID3V2_APIC_PICTURE_OTHER;
+ }
+ }
+ id3v2_frame_write_uint8 (&frame, image_type);
+ }
id3v2_frame_write_string (&frame, encoding, desc, TRUE);