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/asfenc.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/asfenc.c')
-rw-r--r-- | libavformat/asfenc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index a8a844ce6e..b294431aec 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -236,7 +236,7 @@ typedef struct ASFContext { int64_t packet_timestamp_end; unsigned int packet_nb_payloads; uint8_t packet_buf[PACKET_SIZE_MAX]; - AVIOContext pb; + FFIOContext pb; /* only for reading */ uint64_t data_offset; ///< beginning of the first data packet @@ -911,7 +911,7 @@ static void put_payload_header(AVFormatContext *s, ASFStream *stream, int m_obj_offset, int payload_len, int flags) { ASFContext *asf = s->priv_data; - AVIOContext *pb = &asf->pb; + AVIOContext *const pb = &asf->pb.pub; int val; val = stream->num; @@ -983,7 +983,7 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, AVStream *avst, put_payload_header(s, stream, timestamp + PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags); - avio_write(&asf->pb, buf, payload_len); + avio_write(&asf->pb.pub, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); @@ -1125,7 +1125,7 @@ static int asf_write_trailer(AVFormatContext *s) int ret; /* flush the current packet */ - if (asf->pb.buf_ptr > asf->pb.buffer) + if (asf->pb.pub.buf_ptr > asf->pb.pub.buffer) flush_packet(s); /* write index */ |