summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-08-12 20:44:22 +0200
committerMax Kellermann <max@musicpd.org>2019-08-13 11:55:51 +0200
commit54daa85ac2d7cae14ad44d2849dd8a74ffc01438 (patch)
tree405e4e855ba27205d506a941120c5c6dd7c3c765 /src/lib
parent575ba5193137ead33ba8bd4627d46283c423c644 (diff)
decoder/flac: support embedded pictures (FLAC__METADATA_TYPE_PICTURE)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/xiph/FlacStreamMetadata.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/xiph/FlacStreamMetadata.cxx b/src/lib/xiph/FlacStreamMetadata.cxx
index dfca2ca40..bf96f1622 100644
--- a/src/lib/xiph/FlacStreamMetadata.cxx
+++ b/src/lib/xiph/FlacStreamMetadata.cxx
@@ -149,6 +149,21 @@ Scan(const FLAC__StreamMetadata_StreamInfo &stream_info,
}
}
+static void
+Scan(const FLAC__StreamMetadata_Picture &picture, TagHandler &handler) noexcept
+{
+ if (!handler.WantPicture())
+ return;
+
+ if (picture.mime_type != nullptr &&
+ StringIsEqual(picture.mime_type, "-->"))
+ /* this is a URL, not image data */
+ return;
+
+ handler.OnPicture(picture.mime_type,
+ {picture.data, picture.data_length});
+}
+
void
flac_scan_metadata(const FLAC__StreamMetadata *block,
TagHandler &handler) noexcept
@@ -163,6 +178,10 @@ flac_scan_metadata(const FLAC__StreamMetadata *block,
Scan(block->data.stream_info, handler);
break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ Scan(block->data.picture, handler);
+ break;
+
default:
break;
}