]> git.nihav.org Git - nihav.git/blobdiff - nihav-core/src/frame.rs
split nihav-registry from nihav-core
[nihav.git] / nihav-core / src / frame.rs
index 39c6ce60412db35a081764b93e177a719dfbcb77..95bad262b9ae94e927543d191db4138c1466d4a1 100644 (file)
@@ -1,6 +1,6 @@
 //! Packets and decoded frames functionality.
 use std::cmp::max;
-use std::collections::HashMap;
+//use std::collections::HashMap;
 use std::fmt;
 use std::sync::Arc;
 pub use crate::formats::*;
@@ -926,7 +926,7 @@ pub struct NAFrame {
     pub frame_type:     FrameType,
     /// Keyframe flag.
     pub key:            bool,
-        options:        HashMap<String, NAValue>,
+//        options:        HashMap<String, NAValue>,
 }
 
 /// A specialised type for reference-counted `NAFrame`.
@@ -947,9 +947,9 @@ impl NAFrame {
                ftype:          FrameType,
                keyframe:       bool,
                info:           NACodecInfoRef,
-               options:        HashMap<String, NAValue>,
+               /*options:        HashMap<String, NAValue>,*/
                buffer:         NABufferType) -> Self {
-        NAFrame { ts, id: 0, buffer, info, frame_type: ftype, key: keyframe, options }
+        NAFrame { ts, id: 0, buffer, info, frame_type: ftype, key: keyframe/*, options*/ }
     }
     /// Returns frame format information.
     pub fn get_info(&self) -> NACodecInfoRef { self.info.clone() }
@@ -985,6 +985,11 @@ impl NAFrame {
 
     /// Converts current instance into a reference-counted one.
     pub fn into_ref(self) -> NAFrameRef { Arc::new(self) }
+
+    /// Creates new frame with metadata from `NAPacket`.
+    pub fn new_from_pkt(pkt: &NAPacket, info: NACodecInfoRef, buf: NABufferType) -> NAFrame {
+        NAFrame::new(pkt.ts, FrameType::Other, pkt.keyframe, info, /*HashMap::new(),*/ buf)
+    }
 }
 
 impl fmt::Display for NAFrame {
@@ -1144,21 +1149,3 @@ impl fmt::Display for NAPacket {
         write!(f, "{}", ostr)
     }
 }
-
-/// A trait for creating `NAFrame` using information from `NAPacket`.
-pub trait FrameFromPacket {
-    /// Creates new frame with metadata from `NAPacket`.
-    fn new_from_pkt(pkt: &NAPacket, info: NACodecInfoRef, buf: NABufferType) -> NAFrame;
-    /// Sets frame timestamp from `NAPacket`.
-    fn fill_timestamps(&mut self, pkt: &NAPacket);
-}
-
-impl FrameFromPacket for NAFrame {
-    fn new_from_pkt(pkt: &NAPacket, info: NACodecInfoRef, buf: NABufferType) -> NAFrame {
-        NAFrame::new(pkt.ts, FrameType::Other, pkt.keyframe, info, HashMap::new(), buf)
-    }
-    fn fill_timestamps(&mut self, pkt: &NAPacket) {
-        self.ts = pkt.get_time_information();
-    }
-}
-