From: Kostya Shishkov Date: Thu, 30 Sep 2021 12:44:58 +0000 (+0200) Subject: core/frame: introduce NAVideoBuffer::from_raw_parts() X-Git-Url: https://git.nihav.org/?p=nihav.git;a=commitdiff_plain;h=6d240c6b3c031388c3bcc6b96f14de8d60e2b4ae core/frame: introduce NAVideoBuffer::from_raw_parts() --- diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index 0fcdbca..5499de1 100644 --- a/nihav-core/src/frame.rs +++ b/nihav-core/src/frame.rs @@ -150,6 +150,10 @@ pub struct NAVideoBuffer { } impl NAVideoBuffer { + /// Constructs video buffer from the provided components. + pub fn from_raw_parts(info: NAVideoInfo, data: NABufferRef>, offs: Vec, strides: Vec) -> Self { + Self { info, data, offs, strides } + } /// Returns the component offset (0 for all unavailable offsets). pub fn get_offset(&self, idx: usize) -> usize { if idx >= self.offs.len() { 0 }