From fba3216156bccf7ca1424e4e4e389369c4eccefe Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Thu, 18 Jan 2018 13:04:21 -0800 Subject: binding: mediaplayer: add check GST_TAG_PREVIEW_IMAGE for album art Add support for using GST_TAG_PREVIEW_IMAGE in case GST_TAG_IMAGE tags aren't available Bug-AGL: SPEC-1241 Change-Id: I3bb4edf8c9350deffa3cf407285a333042403ec9 Signed-off-by: Matt Ranostay --- binding/afm-mediaplayer-binding.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index b344917..1c2ce6a 100644 --- a/binding/afm-mediaplayer-binding.c +++ b/binding/afm-mediaplayer-binding.c @@ -439,10 +439,10 @@ static void controls(struct afb_req request) pthread_mutex_unlock(&mutex); } -static gchar *get_album_art(GstTagList *tags) +static GstSample *parse_album(GstTagList *tags, gchar *tag_type) { GstSample *sample = NULL; - int num = gst_tag_list_get_tag_size(tags, GST_TAG_IMAGE); + int num = gst_tag_list_get_tag_size(tags, tag_type); guint i; for (i = 0; i < num ; i++) { @@ -450,7 +450,7 @@ static gchar *get_album_art(GstTagList *tags) GstStructure *caps; int type; - value = gst_tag_list_get_value_index(tags, GST_TAG_IMAGE, i); + value = gst_tag_list_get_value_index(tags, tag_type, i); if (value == NULL) break; @@ -463,6 +463,17 @@ static gchar *get_album_art(GstTagList *tags) break; } + return sample; +} + +static gchar *get_album_art(GstTagList *tags) +{ + GstSample *sample; + + sample = parse_album(tags, GST_TAG_IMAGE); + if (!sample) + sample = parse_album(tags, GST_TAG_PREVIEW_IMAGE); + if (sample) { GstBuffer *buffer = gst_sample_get_buffer(sample); GstMapInfo map; -- cgit 1.2.3-korg