core: introduce NAStream::make_ts()
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 4 Nov 2022 17:25:46 +0000 (18:25 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 4 Nov 2022 17:25:46 +0000 (18:25 +0100)
nihav-core/src/frame.rs

index fbdbdf5e391f533e5c75c2fb90b4cd5f11d07248..c93a9216fcc9ee7218da0910b65129ae5a890d94 100644 (file)
@@ -1345,6 +1345,10 @@ impl NAStream {
     }
     /// Returns stream duration.
     pub fn get_duration(&self) -> u64 { self.duration }
+    /// Constructs a new timestamp.
+    pub fn make_ts(&self, pts: Option<u64>, dts: Option<u64>, duration: Option<u64>) -> NATimeInfo {
+        NATimeInfo::new(pts, dts, duration, self.tb_num, self.tb_den)
+    }
     /// Converts current instance into a reference-counted one.
     pub fn into_ref(self) -> NAStreamRef { Arc::new(self) }
 }