From 6d240c6b3c031388c3bcc6b96f14de8d60e2b4ae Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 30 Sep 2021 14:44:58 +0200 Subject: [PATCH] core/frame: introduce NAVideoBuffer::from_raw_parts() --- nihav-core/src/frame.rs | 4 ++++ 1 file changed, 4 insertions(+) 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 } -- 2.39.5