diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-06 20:37:22 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 07:42:21 +0200 |
commit | 3c3c13e67b72d9c4e0615e744ef2c1cdf8b2701e (patch) | |
tree | ad6293eeeb2ea38730a11d1f8e5d75989e89c82a /libavformat/demux_utils.c | |
parent | d2da1dc4433367226024fa3ae2c747e55353f620 (diff) | |
download | ffmpeg-3c3c13e67b72d9c4e0615e744ef2c1cdf8b2701e.tar.gz |
avformat/utils: Move avformat_queue_attached_pictures to demux_utils.c
AVStream.attached_pic is only used for demuxers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/demux_utils.c')
-rw-r--r-- | libavformat/demux_utils.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c index 0ec9f3b2fa..ca5750d1ef 100644 --- a/libavformat/demux_utils.c +++ b/libavformat/demux_utils.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavcodec/packet_internal.h" #include "avformat.h" #include "demux.h" #include "internal.h" @@ -83,3 +84,26 @@ void av_format_inject_global_side_data(AVFormatContext *s) ffstream(st)->inject_global_side_data = 1; } } + +int avformat_queue_attached_pictures(AVFormatContext *s) +{ + FFFormatContext *const si = ffformatcontext(s); + int ret; + for (unsigned i = 0; i < s->nb_streams; i++) + if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC && + s->streams[i]->discard < AVDISCARD_ALL) { + if (s->streams[i]->attached_pic.size <= 0) { + av_log(s, AV_LOG_WARNING, + "Attached picture on stream %d has invalid size, " + "ignoring\n", i); + continue; + } + + ret = avpriv_packet_list_put(&si->raw_packet_buffer, + &s->streams[i]->attached_pic, + av_packet_ref, 0); + if (ret < 0) + return ret; + } + return 0; +} |