aboutsummaryrefslogtreecommitdiffstats
path: root/binding/afm-mediaplayer-binding.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-01-18 13:04:21 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-01-18 17:54:48 -0800
commit5ca51684c0e38f694eb4036d6855d9d53727eb87 (patch)
tree4764e2141dc1e2c2e0277275b3ed7ea5cf7af07b /binding/afm-mediaplayer-binding.c
parentc290122b3738bef82bca33cee71344903a740a77 (diff)
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 <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/afm-mediaplayer-binding.c')
-rw-r--r--binding/afm-mediaplayer-binding.c17
1 files 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;