mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/apetag: Avoid stack packet when reading attached picture
Read it directly into AVStream.attached_pic. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
34f4f57800
commit
ab5803553b
|
@ -79,10 +79,9 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||||
av_dict_set(&st->metadata, key, filename, 0);
|
av_dict_set(&st->metadata, key, filename, 0);
|
||||||
|
|
||||||
if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
|
if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
|
||||||
AVPacket pkt;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = av_get_packet(s->pb, &pkt, size);
|
ret = av_get_packet(s->pb, &st->attached_pic, size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
|
av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -92,7 +91,6 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||||
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
|
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||||
st->codecpar->codec_id = id;
|
st->codecpar->codec_id = id;
|
||||||
|
|
||||||
st->attached_pic = pkt;
|
|
||||||
st->attached_pic.stream_index = st->index;
|
st->attached_pic.stream_index = st->index;
|
||||||
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue