pub struct RgbaSink {
pub last_frame: Arc<Mutex<Option<RgbaFrame>>>,
}Expand description
Reference FrameSink implementation that stores the latest frame in a
shared Arc<Mutex<Option<RgbaFrame>>>.
Clone frame_handle to share access with a rendering
thread:
ⓘ
let sink = RgbaSink::new();
let handle = sink.frame_handle();
player.set_sink(Box::new(sink));
// In the render loop (any thread):
if let Some(frame) = handle.lock().unwrap().as_ref() {
upload_to_gpu(&frame.data, frame.width, frame.height);
}Only the latest frame is stored — not a queue. Renderers typically only need the current frame, not a backlog.
Fields§
§last_frame: Arc<Mutex<Option<RgbaFrame>>>Shared storage for the most recently received RGBA frame.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RgbaSink
impl RefUnwindSafe for RgbaSink
impl Send for RgbaSink
impl Sync for RgbaSink
impl Unpin for RgbaSink
impl UnsafeUnpin for RgbaSink
impl UnwindSafe for RgbaSink
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