aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-02 15:41:20 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-07 00:41:45 +0200
commit7001ff74ba7fb5035f412a8be17d97b165f0ac5f (patch)
treead75b7f777ec672c834ce1860ec25afbe455e43b /libavformat/matroskadec.c
parent5869407da2657900ebf7419a4dff85b309e2363e (diff)
downloadffmpeg-7001ff74ba7fb5035f412a8be17d97b165f0ac5f.tar.gz
avformat/aviobuf: Add ffio_init_(read|write)_context()
Most users of ffio_init_context() simply want to wrap a buffer into an AVIOContext; they do not provide function pointers at all. Therefore this commit adds shortcuts for these two common operations. This also allows to accept const data when reading (i.e. the const is now cast away at a central place in ffio_init_read_context() instead of at several callers). This also allows to constify the data in ff_text_init_buf(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 638e07c13d..941c0bcdc9 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2599,9 +2599,8 @@ static int mka_parse_audio_codec(MatroskaTrack *track, AVCodecParameters *par,
if (!strcmp(track->codec_id, "A_MS/ACM") &&
track->codec_priv.size >= 14) {
FFIOContext b;
- ffio_init_context(&b, track->codec_priv.data,
- track->codec_priv.size,
- 0, NULL, NULL, NULL, NULL);
+ ffio_init_read_context(&b, track->codec_priv.data,
+ track->codec_priv.size);
ret = ff_get_wav_header(s, &b.pub, par,
track->codec_priv.size, 0);
if (ret < 0)
@@ -2887,9 +2886,8 @@ static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par,
if (track->codec_priv.size >= 86) {
FFIOContext b;
unsigned bit_depth = AV_RB16(track->codec_priv.data + 82);
- ffio_init_context(&b, track->codec_priv.data,
- track->codec_priv.size,
- 0, NULL, NULL, NULL, NULL);
+ ffio_init_read_context(&b, track->codec_priv.data,
+ track->codec_priv.size);
if (ff_get_qtpalette(codec_id, &b.pub, track->palette)) {
bit_depth &= 0x1F;
track->has_palette = 1;
@@ -4057,7 +4055,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf
av_assert1(buf);
- ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL);
+ ffio_init_read_context(&pb, data, size);
if ((n = ebml_read_num(matroska, &pb.pub, 8, &num, 1)) < 0)
return n;