avioalloccontext
avio_alloc_context, often referred to as avio_alloc_context in FFmpeg, is a API function that creates an AVIOContext configured to use a user-supplied I/O buffer together with callback functions for reading, writing, and seeking. It enables custom input/output sources to be integrated with FFmpeg’s demuxing and muxing pipeline, such as in-memory data, network streams, or device interfaces.
The function signature is: AVIOContext *avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void
The returned AVIOContext is typically attached to a format context, for example by assigning it to ctx->pb,
Memory management is handled by avio_context_free, which frees the AVIOContext and its associated buffer when finished.