From 45bfe8b838275235412777dd430206d9a24eb3ee Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 4 Aug 2021 16:52:07 +0200 Subject: 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 --- libavformat/matroskaenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavformat/matroskaenc.c') diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index b1735f3838..6e34243f6b 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -839,11 +839,12 @@ static void mkv_write_video_color(AVIOContext *pb, const AVStream *st, * a master element with two bytes ID and one byte length field * plus another byte to stay clear of the end. */ uint8_t colour[(2 + 1 + 8) * 18 + (2 + 1) + 1]; - AVIOContext buf, *dyn_cp = &buf; + FFIOContext buf; + AVIOContext *const dyn_cp = &buf.pub; int colorinfo_size; const void *side_data; - ffio_init_context(dyn_cp, colour, sizeof(colour), 1, NULL, NULL, NULL, NULL); + ffio_init_context(&buf, colour, sizeof(colour), 1, NULL, NULL, NULL, NULL); if (par->color_trc != AVCOL_TRC_UNSPECIFIED && par->color_trc < AVCOL_TRC_NB) { -- cgit v1.2.3