aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2013-01-06 14:15:24 +1100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-01-30 10:00:38 +0100
commit155a0bed972248226b9044f2b72e3695459f1ff9 (patch)
tree19b73cbcc8acd096ff5546a7caf4b05337b8fcfc /libavformat
parentebb3a5974fe399b43271d5ed91d69dcafc448b01 (diff)
downloadffmpeg-155a0bed972248226b9044f2b72e3695459f1ff9.tar.gz
wtvdec: demux thumbnail picture to AVStream.attached_pic
Fixes ticket #2133. (cherry picked from commit 508836932fcbc3c109fcc4df7a2f2b0bf21bbece) Conflicts: libavformat/wtvdec.c
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/wtvdec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 9157042d08..45c930f9bd 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -404,6 +404,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
char description[1024];
unsigned int filesize;
AVStream *st;
+ int ret;
int64_t pos = avio_tell(pb);
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
@@ -420,13 +421,14 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
if (!st)
goto done;
av_dict_set(&st->metadata, "title", description, 0);
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MJPEG;
- st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
- st->codec->extradata = av_mallocz(filesize);
- if (!st->codec->extradata)
+ ret = av_get_packet(pb, &st->attached_pic, filesize);
+ if (ret < 0)
goto done;
- st->codec->extradata_size = filesize;
- avio_read(pb, st->codec->extradata, filesize);
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
done:
avio_seek(pb, pos + length, SEEK_SET);
}