core: make StreamManager accept NAStreamRef too
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 5 Jun 2020 16:46:40 +0000 (18:46 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 5 Jun 2020 16:46:40 +0000 (18:46 +0200)
nihav-core/src/demuxers/mod.rs

index a0f67a84c7d984fad014ece751dbc6b8c1763b06..6723cf2e0fdca7f18fe889bb632ac720c5fe341b 100644 (file)
@@ -94,6 +94,13 @@ impl StreamManager {
         self.ignored.push(false);
         Some(stream_num)
     }
+    /// Adds a new stream from reference-counted object.
+    pub fn add_stream_ref(&mut self, stream: NAStreamRef) -> Option<usize> {
+        let stream_num = self.streams.len();
+        self.streams.push(stream);
+        self.ignored.push(false);
+        Some(stream_num)
+    }
     /// Returns stream with the requested index.
     pub fn get_stream(&self, idx: usize) -> Option<NAStreamRef> {
         if idx < self.streams.len() {