MCPcopy Create free account
hub / github.com/Recordscript/recordscript / frame

Method frame

libs/scrap/src/common/android.rs:38–54  ·  view source on GitHub ↗
(&'a mut self, _timeout: Duration)

Source from the content-addressed store, hash-verified

36
37impl crate::TraitCapturer for Capturer {
38 fn frame<'a>(&'a mut self, _timeout: Duration) -> io::Result<Frame<'a>> {
39 if let Some(buf) = get_video_raw() {
40 crate::would_block_if_equal(&mut self.saved_raw_data, buf)?;
41 // Is it safe to directly return buf without copy?
42 self.rgba.resize(buf.len(), 0);
43 unsafe {
44 std::ptr::copy_nonoverlapping(buf.as_ptr(), self.rgba.as_mut_ptr(), buf.len())
45 };
46 Ok(Frame::PixelBuffer(PixelBuffer::new(
47 &self.rgba,
48 self.width(),
49 self.height(),
50 )))
51 } else {
52 return Err(io::ErrorKind::WouldBlock.into());
53 }
54 }
55}
56
57pub struct PixelBuffer<'a> {

Callers

nothing calls this directly

Calls 5

get_video_rawFunction · 0.85
would_block_if_equalFunction · 0.85
PixelBufferClass · 0.70
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected