From: Kostya Shishkov Date: Thu, 20 Feb 2020 09:02:54 +0000 (+0100) Subject: core/frame: remove unneeded FrameFromPacket trait X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=2b8bf9a03242bbd6e80091082a50ec13b1a95143;p=nihav.git core/frame: remove unneeded FrameFromPacket trait --- 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(); - } -} -