diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-06 21:28:57 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 07:45:58 +0200 |
commit | a085cfa65414ff4346d8367cfb54d50d4925396f (patch) | |
tree | cc6c802f6f5e3fd40d447bf3d442834be839c1f5 /libavformat/demux_utils.c | |
parent | aef16886dde59d41bdeef8dfe78cd7d9055bf50e (diff) | |
download | ffmpeg-a085cfa65414ff4346d8367cfb54d50d4925396f.tar.gz |
avformat/utils: Move ff_get_extradata to demux_utils.c
It is only used by demuxers (although it is hypothetically
possible that some day e.g. a protocol might need it, but
that is unlikely given that they don't deal with AVCodecParameters).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/demux_utils.c')
-rw-r--r-- | libavformat/demux_utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c index 8a1e4ff5c0..a59476e0da 100644 --- a/libavformat/demux_utils.c +++ b/libavformat/demux_utils.c @@ -25,6 +25,7 @@ #include "libavcodec/bytestream.h" #include "libavcodec/packet_internal.h" #include "avformat.h" +#include "avio_internal.h" #include "demux.h" #include "internal.h" @@ -350,3 +351,19 @@ int ff_generate_avci_extradata(AVStream *st) return 0; } + +int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size) +{ + int ret = ff_alloc_extradata(par, size); + if (ret < 0) + return ret; + ret = ffio_read_size(pb, par->extradata, size); + if (ret < 0) { + av_freep(&par->extradata); + par->extradata_size = 0; + av_log(logctx, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size); + return ret; + } + + return ret; +} |