I found this example on GitHub: avio_read_callback.c. Unfortunately, it is a very simplified example because it reads the whole input file into memory and processes it at once.
Does anyone have a better example of how to use avio_alloc_context with the read callback and how to handle incoming data block by block? Specifically, I’m looking for details on:
- The appropriate size for avio_ctx_buffer_size
- The correct return value in the read callback if there isn’t enough data
- Handling situations where more memory is needed after some data has already
been copied, such as when avformat_open_input fails initially
I have an H.264 stream that works sometimes, depending on the buffer sizes, but I occasionally experience data drops. Any help would be appreciated.