core/frame: introduce NAVideoBuffer::from_raw_parts()
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 30 Sep 2021 12:44:58 +0000 (14:44 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 30 Sep 2021 16:13:05 +0000 (18:13 +0200)
nihav-core/src/frame.rs

index 0fcdbcaa7526845f74ced9303431f7872d50e1c5..5499de1001b40b36446bec2cd8d99902bcf24d1e 100644 (file)
@@ -150,6 +150,10 @@ pub struct NAVideoBuffer<T> {
 }
 
 impl<T: Clone> NAVideoBuffer<T> {
+    /// Constructs video buffer from the provided components.
+    pub fn from_raw_parts(info: NAVideoInfo, data: NABufferRef<Vec<T>>, offs: Vec<usize>, strides: Vec<usize>) -> 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 }