diff options
Diffstat (limited to 'libavformat/wtvdec.c')
-rw-r--r-- | libavformat/wtvdec.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 4b3b7fb407..44ca86d517 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -434,7 +434,6 @@ 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)); @@ -447,19 +446,12 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!filesize) goto done; - st = avformat_new_stream(s, NULL); - if (!st) + if (ff_add_attached_pic(s, NULL, pb, NULL, filesize) < 0) goto done; + st = s->streams[s->nb_streams - 1]; av_dict_set(&st->metadata, "title", description, 0); - st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_MJPEG; st->id = -1; - ret = av_get_packet(pb, &st->attached_pic, filesize); - if (ret < 0) - goto done; - 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); } |