diff --git a/src/avformat/avio.rs b/src/avformat/avio.rs index 1e51d65..3f425b8 100644 --- a/src/avformat/avio.rs +++ b/src/avformat/avio.rs @@ -154,6 +154,17 @@ impl AVIOContextCustom { _opaque: opaque, } } + + /// Re-take the ownership of the `data` passed in `alloc_context`. + /// The `data` inside this will be set to an empty vector. + pub fn take_data(&mut self) -> Vec { + std::mem::take(&mut self._opaque.data) + } + + /// Get a mutable reference to the data inside this context. + pub fn as_mut_data(&mut self) -> &mut Vec { + &mut self._opaque.data + } } impl Drop for AVIOContextCustom {