pub struct OutputFile(/* private fields */);Expand description
A container opened for writing whose file is closed without panicking.
Self::close reports the error closing the file returns: a write that
failed earlier, or one the file system only reports at close(2).
Dropping it closes the file and discards that error, which is what an
abandoned output wants.
Implementations§
Source§impl OutputFile
impl OutputFile
Methods from Deref<Target = AVFormatContextOutput>§
pub fn as_ptr(&self) -> *const AVFormatContext
pub fn as_mut_ptr(&mut self) -> *mut AVFormatContext
Sourcepub unsafe fn set_ptr(&mut self, ptr: NonNull<AVFormatContext>)
pub unsafe fn set_ptr(&mut self, ptr: NonNull<AVFormatContext>)
§Safety
This function should only be called when the pointer is valid and the data it’s pointing to can be dropped.
Sourcepub fn write_header(
&mut self,
dict: &mut Option<AVDictionary>,
) -> Result<(), RsmpegError>
pub fn write_header( &mut self, dict: &mut Option<AVDictionary>, ) -> Result<(), RsmpegError>
Allocate the stream private data and write the stream header to an output media file.
options: AnAVDictionaryfilled withAVFormatContextInputand muxer-private options. On return this parameter will be replaced with a dict containing options that were not found. Set this toNoneif it’s not needed.
Sourcepub fn write_trailer(&mut self) -> Result<(), RsmpegError>
pub fn write_trailer(&mut self) -> Result<(), RsmpegError>
Write the stream trailer to an output media file and free the file private data.
Sourcepub fn dump(&mut self, index: i32, filename: &CStr) -> Result<(), RsmpegError>
pub fn dump(&mut self, index: i32, filename: &CStr) -> Result<(), RsmpegError>
Dump ffi::AVFormatContext info in the “FFmpeg” way.
The filename here is just for info printing, it’s really doesn’t matter.
Sourcepub fn write_frame(&mut self, packet: &mut AVPacket) -> Result<(), RsmpegError>
pub fn write_frame(&mut self, packet: &mut AVPacket) -> Result<(), RsmpegError>
Write a packet to an output media file.
This function passes the packet directly to the muxer, without any
buffering or reordering. The caller is responsible for correctly
interleaving the packets if the format requires it. Callers that want
libavformat to handle the interleaving should call
Self::interleaved_write_frame() instead of this function.
Sourcepub fn interleaved_write_frame(
&mut self,
packet: &mut AVPacket,
) -> Result<(), RsmpegError>
pub fn interleaved_write_frame( &mut self, packet: &mut AVPacket, ) -> Result<(), RsmpegError>
Write a packet to an output media file ensuring correct interleaving.
This function will buffer the packets internally as needed to make sure
the packets in the output file are properly interleaved in the order of
increasing dts. Callers doing their own interleaving should call
Self::write_frame() instead of this function.
Sourcepub fn streams(&'stream self) -> &'stream [AVStreamRef<'stream>]
pub fn streams(&'stream self) -> &'stream [AVStreamRef<'stream>]
Return slice of AVStreamRef.
Sourcepub fn oformat(&self) -> AVOutputFormatRef<'static>
pub fn oformat(&self) -> AVOutputFormatRef<'static>
Get AVOutputFormat from the AVFormatContextOutput.
Sourcepub fn set_oformat(&mut self, format: AVOutputFormatRef<'static>)
pub fn set_oformat(&mut self, format: AVOutputFormatRef<'static>)
Set AVOutputFormat in the AVFormatContextOutput.
Sourcepub fn new_stream(&'stream mut self) -> AVStreamMut<'stream>
pub fn new_stream(&'stream mut self) -> AVStreamMut<'stream>
Add a new stream to a media file, should be called by the user before
Self::write_header();