MCPcopy Create free account
hub / github.com/RustCV/RustCV / copy_sample_to_linear_buffer

Method copy_sample_to_linear_buffer

rustcv-backend-msmf/src/stream.rs:303–314  ·  view source on GitHub ↗

Copies frame data from an IMFSample to the linear buffer.

(&mut self, sample: &IMFSample)

Source from the content-addressed store, hash-verified

301
302 /// Copies frame data from an IMFSample to the linear buffer.
303 fn copy_sample_to_linear_buffer(&mut self, sample: &IMFSample) -> Result<()> {
304 unsafe {
305 let buffer = sample.GetBufferByIndex(0).map_err(win_err)?;
306
307 if let Ok(buffer2d) = buffer.cast::<IMF2DBuffer2>() {
308 self.copy_from_2d_buffer(&buffer2d)?;
309 } else {
310 self.copy_from_linear_buffer(&buffer)?;
311 }
312 }
313 Ok(())
314 }
315
316 /// Copies frame data from a 2D buffer with stride handling.
317 unsafe fn copy_from_2d_buffer(&mut self, buffer: &IMF2DBuffer2) -> Result<()> {

Callers 1

next_frameMethod · 0.80

Calls 2

copy_from_2d_bufferMethod · 0.80

Tested by

no test coverage detected