diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-02-20 10:02:54 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-02-20 10:02:54 +0100 |
commit | 2b8bf9a03242bbd6e80091082a50ec13b1a95143 (patch) | |
tree | e91ff37bc5ae40c2fcf223cffec357ad0d830663 | |
parent | a5ba48ace542e2adfd0826614d4342d81359d624 (diff) | |
download | nihav-2b8bf9a03242bbd6e80091082a50ec13b1a95143.tar.gz |
core/frame: remove unneeded FrameFromPacket trait
-rw-r--r-- | nihav-core/src/frame.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index 0a07db7..95bad26 100644 --- a/nihav-core/src/frame.rs +++ b/nihav-core/src/frame.rs @@ -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(); - } -} - |