Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-29 08:58:56 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-01 19:23:13 +0300
commit39ecb63d0f082ee3b2ac2ac65577170deb245ec4 (patch)
treedec03fe40d01b51e21929d00c3e45732163447a5 /libavformat/flac_picture.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/flac_picture.c')
-rw-r--r--libavformat/flac_picture.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index f15cfa877a..96e14f76c9 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -160,20 +160,11 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr
if (AV_RB64(data->data) == PNGSIG)
id = AV_CODEC_ID_PNG;
- st = avformat_new_stream(s, NULL);
- if (!st) {
- RETURN_ERROR(AVERROR(ENOMEM));
- }
-
- av_packet_unref(&st->attached_pic);
- st->attached_pic.buf = data;
- st->attached_pic.data = data->data;
- st->attached_pic.size = len;
- st->attached_pic.stream_index = st->index;
- st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+ ret = ff_add_attached_pic(s, NULL, NULL, &data, 0);
+ if (ret < 0)
+ RETURN_ERROR(ret);
- st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
- st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st = s->streams[s->nb_streams - 1];
st->codecpar->codec_id = id;
st->codecpar->width = width;
st->codecpar->height = height;