|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
RAII owner of one video stream's encoder and pixel-format converter on the write path. More...
#include <VideoEncodeContext.hpp>
Collaboration diagram for MayaFlux::IO::VideoEncodeContext:Public Member Functions | |
| void | close () |
| Release all owned resources. | |
| bool | drain (FFmpegMuxContext &mux) |
| Flush all buffered frames from the encoder to the mux. | |
| bool | encode_frame (const uint8_t *src_data, size_t src_size, uint32_t src_width, uint32_t src_height, FFmpegMuxContext &mux) |
| Encode one raw pixel frame into the mux context. | |
| uint32_t | height () const |
| bool | is_valid () const |
| True if codec, scaler, and scratch frame are all ready. | |
| const std::string & | last_error () const |
| bool | open (FFmpegMuxContext &mux, uint32_t width, uint32_t height, double frame_rate, AVPixelFormat src_pixel_format, AVCodecID codec_id) |
| Open the encoder and register a video stream in the mux context. | |
| VideoEncodeContext & | operator= (const VideoEncodeContext &)=delete |
| VideoEncodeContext & | operator= (VideoEncodeContext &&)=delete |
| VideoEncodeContext ()=default | |
| VideoEncodeContext (const VideoEncodeContext &)=delete | |
| VideoEncodeContext (VideoEncodeContext &&)=delete | |
| uint32_t | width () const |
| ~VideoEncodeContext () | |
Public Attributes | |
| AVCodecContext * | codec_context {} |
| Owned; freed in destructor. | |
| SwsContext * | sws_context {} |
| Owned; freed in destructor. | |
Private Member Functions | |
| bool | drain_packets (FFmpegMuxContext &mux) |
Private Attributes | |
| int | m_cached_src_height { -1 } |
| int | m_cached_src_width { -1 } |
| uint32_t | m_height {} |
| std::string | m_last_error |
| int64_t | m_pts {} |
| AVFrame * | m_scratch_frame {} |
| Owned scratch buffer for encoder input. | |
| AVPixelFormat | m_src_pixel_fmt { AV_PIX_FMT_BGRA } |
| int | m_src_src_bpp { 4 } |
| AVStream * | m_stream {} |
| Weak ref into FFmpegMuxContext; not owned. | |
| int | m_stream_index { -1 } |
| uint32_t | m_width {} |
RAII owner of one video stream's encoder and pixel-format converter on the write path.
Encapsulates all video-stream-specific FFmpeg objects:
Does NOT own AVFormatContext — that belongs to FFmpegMuxContext.
Open sequence:
The source pixel format passed to open() must match the format delivered to every subsequent encode_frame() call. Swapchain BGRA readbacks map to AV_PIX_FMT_BGRA; RGBA readbacks to AV_PIX_FMT_RGBA.
Not copyable or movable; always stack- or member-allocated inside the owner (VideoFileWriter worker thread).
The associated FFmpegMuxContext must outlive this object.
Definition at line 44 of file VideoEncodeContext.hpp.