From cd8830d3e7e7e51dd218feb4e1a9dcc223b4def2 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Thu, 2 Jul 2015 20:40:39 +0200 Subject: [PATCH] gst-thumbnailer: Accept images other then the front cover Not all media has the media type information in the tag, so just picking up GST_TAG_IMAGE_TYPE_FRONT_COVER means no thumbnails are generated for those. Adjust the image selection such that the front cover image is still preferred, but if that's not available any other should do. Signed-off-by: Sjoerd Simons --- plugins/gst-thumbnailer/gst-thumbnailer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/gst-thumbnailer/gst-thumbnailer.c b/plugins/gst-thumbnailer/gst-thumbnailer.c index 284a0b9..709308e 100644 --- a/plugins/gst-thumbnailer/gst-thumbnailer.c +++ b/plugins/gst-thumbnailer/gst-thumbnailer.c @@ -138,15 +138,16 @@ gst_thumbnailer_cover_from_tags (GstTagList *tags, { GstSample *cover = NULL; guint i; - GstSample *sample; GstCaps *caps; const GstStructure *caps_struct; - gint type; + gint type = GST_TAG_IMAGE_TYPE_UNDEFINED; GstBuffer *buffer; GdkPixbuf *pixbuf = NULL; for (i = 0; ; i++) { + GstSample *sample; + if (g_cancellable_is_cancelled (cancellable)) break; @@ -161,14 +162,13 @@ gst_thumbnailer_cover_from_tags (GstTagList *tags, GST_TYPE_TAG_IMAGE_TYPE, &type); - if (type == GST_TAG_IMAGE_TYPE_FRONT_COVER) - { - /* found the cover */ - cover = sample; - break; - } + if (cover != NULL) + gst_sample_unref (cover); + cover = sample; - gst_sample_unref (sample); + /* Prefer the front cover image if specified */ + if (type == GST_TAG_IMAGE_TYPE_FRONT_COVER) + break; } if (cover == NULL -- 2.1.4