diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-06 20:53:12 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 07:42:22 +0200 |
commit | 92a43ad3842b8422dd0e88cfd66cf0f284e5015a (patch) | |
tree | 994bd0d8d5f3ca073603f603c93e3b30ce52a793 /libavformat/utils.c | |
parent | 3c3c13e67b72d9c4e0615e744ef2c1cdf8b2701e (diff) |
avformat/utils: Move ff_add_attached_pic to demux_utils.c
It is demuxer-only: It potentially adds an AVStream and it sets
AVStream.attached_pic.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 492fca000a..9e2e3335ac 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -175,41 +175,6 @@ int av_filename_number_test(const char *filename) (av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0); } -int ff_add_attached_pic(AVFormatContext *s, AVStream *st0, AVIOContext *pb, - AVBufferRef **buf, int size) -{ - AVStream *st = st0; - AVPacket *pkt; - int ret; - - if (!st && !(st = avformat_new_stream(s, NULL))) - return AVERROR(ENOMEM); - pkt = &st->attached_pic; - if (buf) { - av_assert1(*buf); - av_packet_unref(pkt); - pkt->buf = *buf; - pkt->data = (*buf)->data; - pkt->size = (*buf)->size - AV_INPUT_BUFFER_PADDING_SIZE; - *buf = NULL; - } else { - ret = av_get_packet(pb, pkt, size); - if (ret < 0) - goto fail; - } - st->disposition |= AV_DISPOSITION_ATTACHED_PIC; - st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; - - pkt->stream_index = st->index; - pkt->flags |= AV_PKT_FLAG_KEY; - - return 0; -fail: - if (!st0) - ff_remove_stream(s, st); - return ret; -} - /**********************************************************/ int ff_is_intra_only(enum AVCodecID id) |