diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-04 16:52:07 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-25 23:01:54 +0200 |
commit | 45bfe8b838275235412777dd430206d9a24eb3ee (patch) | |
tree | d35a1ee7436b0259fd26d32bc80482c0a9f2927e /libavformat/vividas.c | |
parent | 530ac6aa305aeda631c77f8a17e96c14c7ab1a1c (diff) |
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/vividas.c')
-rw-r--r-- | libavformat/vividas.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/vividas.c b/libavformat/vividas.c index 8d1c1dab29..d7a6e74650 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -283,9 +283,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * int64_t off; int val_1; int num_video; - AVIOContext pb0, *pb = &pb0; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; - ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb0, buf, size, 0, NULL, NULL, NULL, NULL); ffio_read_varlen(pb); // track_header_len avio_r8(pb); // '1' @@ -436,12 +437,13 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu int64_t off; int64_t poff; int maxnp=0; - AVIOContext pb0, *pb = &pb0; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; int i; int64_t filesize = avio_size(s->pb); uint64_t n_sb_blocks_tmp; - ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb0, buf, size, 0, NULL, NULL, NULL, NULL); ffio_read_varlen(pb); // track_index_len avio_r8(pb); // 'c' |