pub struct VirtualCapture { /* private fields */ }Expand description
Simple virtual capture backend that emits patterned frames from a buffer pool.
§Example
use styx_capture::prelude::*;
let pool = BufferPool::with_capacity(1, 128);
let res = Resolution::new(4, 4).unwrap();
let format = MediaFormat::new(FourCc::new(*b"RG24"), res, ColorSpace::Srgb);
let mode = Mode {
id: ModeId { format, interval: None },
format,
intervals: smallvec::smallvec![],
interval_stepwise: None,
};
let source = VirtualCapture::new(mode, pool, 3);
let frame = source.next_frame().unwrap();
assert_eq!(frame.meta().format.code.to_string(), "RG24");Implementations§
Source§impl VirtualCapture
impl VirtualCapture
Sourcepub fn new(
mode: Mode,
pool: BufferPool,
bytes_per_pixel: usize,
) -> VirtualCapture
pub fn new( mode: Mode, pool: BufferPool, bytes_per_pixel: usize, ) -> VirtualCapture
Create a virtual source using the provided mode and pool.
Sourcepub fn tick(
&self,
_config: &CaptureConfig,
sink: &BoundedTx<FrameLease>,
) -> SendOutcome
pub fn tick( &self, _config: &CaptureConfig, sink: &BoundedTx<FrameLease>, ) -> SendOutcome
Emit a single frame and return whether it was accepted by the downstream queue.
Trait Implementations§
Source§impl CaptureSource for VirtualCapture
impl CaptureSource for VirtualCapture
Source§fn descriptor(&self) -> &CaptureDescriptor
fn descriptor(&self) -> &CaptureDescriptor
Descriptor for this source.
Source§fn next_frame(&self) -> Option<FrameLease>
fn next_frame(&self) -> Option<FrameLease>
Pull the next frame; concrete backends decide how to block/yield.
Auto Trait Implementations§
impl !Freeze for VirtualCapture
impl RefUnwindSafe for VirtualCapture
impl Send for VirtualCapture
impl Sync for VirtualCapture
impl Unpin for VirtualCapture
impl UnwindSafe for VirtualCapture
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
Mutably borrows from an owned value. Read more