aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-02-20 10:02:54 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-02-20 10:02:54 +0100
commit2b8bf9a03242bbd6e80091082a50ec13b1a95143 (patch)
treee91ff37bc5ae40c2fcf223cffec357ad0d830663
parenta5ba48ace542e2adfd0826614d4342d81359d624 (diff)
downloadnihav-2b8bf9a03242bbd6e80091082a50ec13b1a95143.tar.gz
core/frame: remove unneeded FrameFromPacket trait
-rw-r--r--nihav-core/src/frame.rs23
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();
- }
-}
-