From 2b8bf9a03242bbd6e80091082a50ec13b1a95143 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 20 Feb 2020 10:02:54 +0100 Subject: [PATCH] core/frame: remove unneeded FrameFromPacket trait --- nihav-core/src/frame.rs | 23 +++++------------------ 1 file 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(); - } -} - -- 2.39.5