aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2013-07-09 02:39:10 -0300
committerMichael Niedermayer <michaelni@gmx.at>2013-07-09 19:21:23 +0200
commit193782216fc8179ec92d498449be0a51e4c7c658 (patch)
tree45168dd64164109753bffbaff729946f8ba701cf
parent1e5bbbfcf303ec3db0c7db30b85855e2e5358aec (diff)
downloadffmpeg-193782216fc8179ec92d498449be0a51e4c7c658.tar.gz
vorbiscomment: Add support for embedded cover art
Fixes ticket #2655 Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/Makefile3
-rw-r--r--libavformat/oggparsevorbis.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2a6173c153..3c4a3c88cd 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -256,7 +256,8 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparsespeex.o \
oggparsetheora.o \
oggparsevorbis.o \
- vorbiscomment.o
+ vorbiscomment.o \
+ flacdec_picture.o
OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \
vorbiscomment.o
OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index da029a47df..a21b3a92cc 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -24,12 +24,14 @@
#include <stdlib.h>
#include "libavutil/avstring.h"
+#include "libavutil/base64.h"
#include "libavutil/bswap.h"
#include "libavutil/dict.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/vorbis_parser.h"
#include "avformat.h"
+#include "flacdec.h"
#include "internal.h"
#include "oggdec.h"
#include "vorbiscomment.h"
@@ -128,7 +130,22 @@ ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, in
memcpy(ct, v, vl);
ct[vl] = 0;
- if (!ogm_chapter(as, tt, ct))
+ if (!strcmp(tt, "METADATA_BLOCK_PICTURE")) {
+ int ret;
+ char *pict = av_malloc(vl);
+
+ if (!pict) {
+ av_log(as, AV_LOG_WARNING, "out-of-memory error. Skipping cover art block.\n");
+ continue;
+ }
+ if ((ret = av_base64_decode(pict, ct, vl)) > 0)
+ ret = ff_flac_parse_picture(as, pict, ret);
+ av_freep(&pict);
+ if (ret < 0) {
+ av_log(as, AV_LOG_WARNING, "Failed to parse cover art block.\n");
+ continue;
+ }
+ } else if (!ogm_chapter(as, tt, ct))
av_dict_set(m, tt, ct,
AV_DICT_DONT_STRDUP_KEY |
AV_DICT_DONT_STRDUP_VAL);