aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-04 16:52:07 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-25 23:01:54 +0200
commit45bfe8b838275235412777dd430206d9a24eb3ee (patch)
treed35a1ee7436b0259fd26d32bc80482c0a9f2927e /libavformat/mov.c
parent530ac6aa305aeda631c77f8a17e96c14c7ab1a1c (diff)
downloadffmpeg-45bfe8b838275235412777dd430206d9a24eb3ee.tar.gz
avformat/avio: Move internal AVIOContext fields to avio_internal.h
Currently AVIOContext's private fields are all over AVIOContext. This commit moves them into a new structure in avio_internal.h instead. Said structure contains the public AVIOContext as its first element in order to avoid having to allocate a separate AVIOContextInternal which is costly for those use cases where one just wants to access an already existing buffer via the AVIOContext-API. For these cases ffio_init_context() can't fail and always returned zero, which was typically not checked. Therefore it has been made to not return anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c556390525..da4c5d60f8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5177,7 +5177,7 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
#if CONFIG_ZLIB
- AVIOContext ctx;
+ FFIOContext ctx;
uint8_t *cmov_data;
uint8_t *moov_data; /* uncompressed data */
long cmov_len, moov_len;
@@ -5211,12 +5211,11 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
ret = AVERROR_INVALIDDATA;
if (uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK)
goto free_and_return;
- if (ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
- goto free_and_return;
- ctx.seekable = AVIO_SEEKABLE_NORMAL;
+ ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL);
+ ctx.pub.seekable = AVIO_SEEKABLE_NORMAL;
atom.type = MKTAG('m','o','o','v');
atom.size = moov_len;
- ret = mov_read_default(c, &ctx, atom);
+ ret = mov_read_default(c, &ctx.pub, atom);
free_and_return:
av_free(moov_data);
av_free(cmov_data);