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/matroskadec.c | |
parent | 530ac6aa305aeda631c77f8a17e96c14c7ab1a1c (diff) | |
download | ffmpeg-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/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index c33128f528..7d79b3d5c4 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2350,7 +2350,7 @@ static int matroska_parse_tracks(AVFormatContext *s) int extradata_size = 0; int extradata_offset = 0; uint32_t fourcc = 0; - AVIOContext b; + FFIOContext b; char* key_id_base64 = NULL; int bit_depth = -1; @@ -2511,7 +2511,8 @@ static int matroska_parse_tracks(AVFormatContext *s) ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - ret = ff_get_wav_header(s, &b, st->codecpar, track->codec_priv.size, 0); + ret = ff_get_wav_header(s, &b.pub, st->codecpar, + track->codec_priv.size, 0); if (ret < 0) return ret; codec_id = st->codecpar->codec_id; @@ -2557,7 +2558,7 @@ static int matroska_parse_tracks(AVFormatContext *s) ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - if (ff_get_qtpalette(codec_id, &b, track->palette)) { + if (ff_get_qtpalette(codec_id, &b.pub, track->palette)) { bit_depth &= 0x1F; track->has_palette = 1; } @@ -3587,7 +3588,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf { uint64_t timecode = AV_NOPTS_VALUE; MatroskaTrack *track; - AVIOContext pb; + FFIOContext pb; int res = 0; AVStream *st; int16_t block_time; @@ -3598,7 +3599,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL); - if ((n = ebml_read_num(matroska, &pb, 8, &num, 1)) < 0) + if ((n = ebml_read_num(matroska, &pb.pub, 8, &num, 1)) < 0) return n; data += n; size -= n; @@ -3656,7 +3657,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf } res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1, - &pb, lace_size, &laces); + &pb.pub, lace_size, &laces); if (res < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "Error parsing frame sizes.\n"); return res; |