wtvdec: demux thumbnail picture to AVStream.attached_pic
Fixes ticket #2133. (cherry picked from commit 508836932fcbc3c109fcc4df7a2f2b0bf21bbece) Conflicts: libavformat/wtvdec.c
This commit is contained in:
parent
ebb3a5974f
commit
155a0bed97
@ -404,6 +404,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
|||||||
char description[1024];
|
char description[1024];
|
||||||
unsigned int filesize;
|
unsigned int filesize;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
int ret;
|
||||||
int64_t pos = avio_tell(pb);
|
int64_t pos = avio_tell(pb);
|
||||||
|
|
||||||
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
|
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)
|
if (!st)
|
||||||
goto done;
|
goto done;
|
||||||
av_dict_set(&st->metadata, "title", description, 0);
|
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_id = CODEC_ID_MJPEG;
|
||||||
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
|
ret = av_get_packet(pb, &st->attached_pic, filesize);
|
||||||
st->codec->extradata = av_mallocz(filesize);
|
if (ret < 0)
|
||||||
if (!st->codec->extradata)
|
|
||||||
goto done;
|
goto done;
|
||||||
st->codec->extradata_size = filesize;
|
st->attached_pic.stream_index = st->index;
|
||||||
avio_read(pb, st->codec->extradata, filesize);
|
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
||||||
|
st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
|
||||||
done:
|
done:
|
||||||
avio_seek(pb, pos + length, SEEK_SET);
|
avio_seek(pb, pos + length, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user