Created by: philipnbbc
This PR adds an io_open
option to av.open()
which allows a client to provide a custom I/O. The io_open
function is called with parameters url
, flags
, and options
when a new file needs to be opened.
The existing file I/O was factored out into the PyIOFile
class, with the addition of the fclose
method. This class is used for the main file as well as for any files opened by the container.
Custom I/O has been used with the FFmpeg DASH encoder and could be used with containers that uses the io_open
and io_close
callbacks in the AVFormatContext. The test shows how it can be used with the DASH encoder by using a CUSTOM_IO_PROTOCOL prefix to direct the DASH encoder to use the custom I/O.
Activity
added changes requested label
mentioned in merge request !918 (closed)
mentioned in merge request !919 (merged)
44 44 --enable-debug=3 \ 45 45 --enable-gpl \ 46 46 --enable-libx264 \ 47 --enable-libxml2 \ Created by: philipnbbc
I've simplified it in https://github.com/PyAV-Org/PyAV/pull/718/commits/cc5b261e80122e46853609bb01f718becf6da26e to just enable libxml2. The DASH demuxer, which is used in the tests, is not enabled if libxml2 is not enabled; libxml2 is used to read the DASH manifest XML file.
Created by: philipnbbc
I think that would be worth doing (added in https://github.com/PyAV-Org/PyAV/pull/718/commits/d4b23725cb18303bdf809730156889d2c452e92b) and it actually exposed a bug that the DASH muxer hadn't (fixed in https://github.com/PyAV-Org/PyAV/pull/718/commits/d8f096baab46cb470fc78eda5b43ac49a122ceeb).
- Last updated by Jeremy Lainé
- Last updated by Administrator
251 333 def open(file, mode=None, format=None, options=None, 252 334 container_options=None, stream_options=None, 253 335 metadata_encoding='utf-8', metadata_errors='strict', 254 buffer_size=32768, timeout=None): 336 buffer_size=32768, timeout=None, io_open=None): Created by: philipnbbc
Added in https://github.com/PyAV-Org/PyAV/pull/718/commits/d84cc95b17d8dae6ac2b3329851d00fc7cda0d76
- Last updated by Administrator
requested review from @jlaine