pub struct StreamingVideoEncoder { /* private fields */ }Expand description
A streaming video encoder that handles scaling via FFmpeg.
This encoder is designed for use during emulation - frames are written immediately as they are generated, without buffering all frames in memory.
Scaling is handled natively by FFmpeg using nearest-neighbor interpolation, which is efficient and produces sharp pixel edges.
Implementations§
Source§impl StreamingVideoEncoder
impl StreamingVideoEncoder
Sourcepub fn with_fps_config(
format: VideoFormat,
output_path: &Path,
src_width: u32,
src_height: u32,
resolution: &VideoResolution,
fps_config: FpsConfig,
) -> Result<Self, VideoError>
pub fn with_fps_config( format: VideoFormat, output_path: &Path, src_width: u32, src_height: u32, resolution: &VideoResolution, fps_config: FpsConfig, ) -> Result<Self, VideoError>
Create a new streaming encoder with explicit FPS configuration.
This is the preferred constructor when using the new FPS multiplier system.
Sourcepub fn write_frame(&mut self, frame: &[RgbColor]) -> Result<(), VideoError>
pub fn write_frame(&mut self, frame: &[RgbColor]) -> Result<(), VideoError>
Write a single frame.
Sourcepub fn finish(&mut self) -> Result<(), VideoError>
pub fn finish(&mut self) -> Result<(), VideoError>
Finish encoding and finalize the output file.
Sourcepub fn frames_written(&self) -> u64
pub fn frames_written(&self) -> u64
Get the number of frames written so far.
Sourcepub fn source_dimensions(&self) -> (u32, u32)
pub fn source_dimensions(&self) -> (u32, u32)
Get the source dimensions.
Sourcepub fn output_dimensions(&self) -> (u32, u32)
pub fn output_dimensions(&self) -> (u32, u32)
Get the output dimensions (after scaling).
Sourcepub fn is_scaling(&self) -> bool
pub fn is_scaling(&self) -> bool
Check if scaling is enabled.
Sourcepub fn fps_config(&self) -> &FpsConfig
pub fn fps_config(&self) -> &FpsConfig
Get the FPS configuration.
Sourcepub fn needs_mid_frame_capture(&self) -> bool
pub fn needs_mid_frame_capture(&self) -> bool
Check if mid-frame captures are needed.
Sourcepub fn captures_per_frame(&self) -> u32
pub fn captures_per_frame(&self) -> u32
Get the number of captures per PPU frame.
Auto Trait Implementations§
impl Freeze for StreamingVideoEncoder
impl !RefUnwindSafe for StreamingVideoEncoder
impl Send for StreamingVideoEncoder
impl !Sync for StreamingVideoEncoder
impl Unpin for StreamingVideoEncoder
impl UnsafeUnpin for StreamingVideoEncoder
impl !UnwindSafe for StreamingVideoEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more