summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2016-07-24 00:23:36 +0900
committerYoann Lopes <yoann.lopes@qt.io>2016-07-26 14:03:15 +0000
commit9bdc7c84eea0ff66c937d5f62ffed249321c3c35 (patch)
tree7fd81d3fae77162046c07751b26d7537d432ce47 /src/gsttools
parentd0ac492e3023545adad8008a3ebcac2a297dc783 (diff)
GStreamer: support cover art
Change-Id: I05987f578a40c23dc2eb6f3e6a7f76d11f704214 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstutils.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index 831ba9691..a2b35073c 100644
--- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp
@@ -141,6 +141,22 @@ static void addTagToMap(const GstTagList *list,
}
if (!map->contains("year") && year > 0)
map->insert("year", year);
+ } else if (G_VALUE_TYPE(&val) == GST_TYPE_SAMPLE) {
+ GstSample *sample = (GstSample *)g_value_get_boxed(&val);
+ GstCaps* caps = gst_sample_get_caps(sample);
+ if (caps && !gst_caps_is_empty(caps)) {
+ GstStructure *structure = gst_caps_get_structure(caps, 0);
+ const gchar *name = gst_structure_get_name(structure);
+ if (QByteArray(name).startsWith("image/")) {
+ GstBuffer *buffer = gst_sample_get_buffer(sample);
+ if (buffer) {
+ GstMapInfo info;
+ gst_buffer_map(buffer, &info, GST_MAP_READ);
+ map->insert(QByteArray(tag), QImage::fromData(info.data, info.size, name));
+ gst_buffer_unmap(buffer, &info);
+ }
+ }
+ }
#endif
} else if (G_VALUE_TYPE(&val) == GST_TYPE_FRACTION) {
int nom = gst_value_get_fraction_numerator(&val);