qtdemux: boldly assume that first 'covr' image is the front cover
authorTim-Philipp Müller <tim@centricular.com>
Sat, 14 Jan 2017 15:16:53 +0000 (15:16 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 14 Jan 2017 15:16:53 +0000 (15:16 +0000)
gst/isomp4/qtdemux.c

index ef680ca..d4fb292 100644 (file)
@@ -12113,9 +12113,16 @@ qtdemux_tag_add_covr (GstQTDemux * qtdemux, GstTagList * taglist,
     type = QT_UINT32 ((guint8 *) data->data + 8);
     GST_DEBUG_OBJECT (qtdemux, "have covr tag, type=%d,len=%d", type, len);
     if ((type == 0x0000000d || type == 0x0000000e) && len > 16) {
+      GstTagImageType image_type;
+
+      if (gst_tag_list_get_tag_size (taglist, GST_TAG_IMAGE) == 0)
+        image_type = GST_TAG_IMAGE_TYPE_FRONT_COVER;
+      else
+        image_type = GST_TAG_IMAGE_TYPE_NONE;
+
       if ((sample =
               gst_tag_image_data_to_image_sample ((guint8 *) data->data + 16,
-                  len - 16, GST_TAG_IMAGE_TYPE_NONE))) {
+                  len - 16, image_type))) {
         GST_DEBUG_OBJECT (qtdemux, "adding tag size %d", len - 16);
         gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, tag1, sample, NULL);
         gst_sample_unref (sample);