...
|
...
|
@@ -414,6 +414,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
414
|
414
|
char description[1024];
|
415
|
415
|
unsigned int filesize;
|
416
|
416
|
AVStream *st;
|
|
417
|
+ int ret;
|
417
|
418
|
int64_t pos = avio_tell(pb);
|
418
|
419
|
|
419
|
420
|
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
|
...
|
...
|
@@ -430,13 +431,14 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
430
|
430
|
if (!st)
|
431
|
431
|
goto done;
|
432
|
432
|
av_dict_set(&st->metadata, "title", description, 0);
|
|
433
|
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
433
|
434
|
st->codec->codec_id = AV_CODEC_ID_MJPEG;
|
434
|
|
- st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
|
435
|
|
- st->codec->extradata = av_mallocz(filesize);
|
436
|
|
- if (!st->codec->extradata)
|
|
435
|
+ ret = av_get_packet(pb, &st->attached_pic, filesize);
|
|
436
|
+ if (ret < 0)
|
437
|
437
|
goto done;
|
438
|
|
- st->codec->extradata_size = filesize;
|
439
|
|
- avio_read(pb, st->codec->extradata, filesize);
|
|
438
|
+ st->attached_pic.stream_index = st->index;
|
|
439
|
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
|
440
|
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
|
440
|
441
|
done:
|
441
|
442
|
avio_seek(pb, pos + length, SEEK_SET);
|
442
|
443
|
}
|