summaryrefslogtreecommitdiff
path: root/libavformat/apetag.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-29 07:58:56 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-01 18:23:13 +0200
commit39ecb63d0f082ee3b2ac2ac65577170deb245ec4 (patch)
treedec03fe40d01b51e21929d00c3e45732163447a5 /libavformat/apetag.c
parentb7b73e83e3d5c78a5fea96a6bcae02e1f0a5c45f (diff)
avformat: Add and use helper function to add attachment streams
All instances of adding attached pictures to a stream or adding a stream and an attached packet to said stream have several things in common like setting the index and flags of the packet, setting the stream disposition etc. This commit therefore factors this out. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/apetag.c')
-rw-r--r--libavformat/apetag.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 23ee6b516d..6f82fbe202 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -79,20 +79,12 @@ static int ape_tag_read_field(AVFormatContext *s)
av_dict_set(&st->metadata, key, filename, 0);
if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
- int ret;
-
- ret = av_get_packet(s->pb, &st->attached_pic, size);
+ int ret = ff_add_attached_pic(s, st, s->pb, NULL, size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
return ret;
}
-
- st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
- st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
st->codecpar->codec_id = id;
-
- st->attached_pic.stream_index = st->index;
- st->attached_pic.flags |= AV_PKT_FLAG_KEY;
} else {
if ((ret = ff_get_extradata(s, st->codecpar, s->pb, size)) < 0)
return ret;