aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-vivo
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-10-04 11:53:21 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-10-04 11:53:21 +0200
commita480a0de101483d802a11e72d758dae00fa4860a (patch)
treeb433ba04fc397f6e7297aeb56103105254dcb3f7 /nihav-vivo
parentb4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b (diff)
downloadnihav-a480a0de101483d802a11e72d758dae00fa4860a.tar.gz
introduce stream and container duration
Diffstat (limited to 'nihav-vivo')
-rw-r--r--nihav-vivo/src/demuxers/vivo.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/nihav-vivo/src/demuxers/vivo.rs b/nihav-vivo/src/demuxers/vivo.rs
index 3c0ac7d..4a6f254 100644
--- a/nihav-vivo/src/demuxers/vivo.rs
+++ b/nihav-vivo/src/demuxers/vivo.rs
@@ -14,6 +14,7 @@ struct VivoDemuxer<'a> {
fps: f32,
width: usize,
height: usize,
+ duration: u64,
vname: &'static str,
aname: &'static str,
}
@@ -57,7 +58,7 @@ impl<'a> DemuxCore<'a> for VivoDemuxer<'a> {
let vhdr = NAVideoInfo::new(self.width, self.height, false, YUV420_FORMAT);
let vinfo = NACodecInfo::new(self.vname, NACodecTypeInfo::Video(vhdr), None);
- let res = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, self.v_num, self.v_den));
+ let res = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, self.v_num, self.v_den, 0));
validate!(res.is_some());
self.video_id = res.unwrap();
@@ -69,7 +70,7 @@ impl<'a> DemuxCore<'a> for VivoDemuxer<'a> {
if self.aname != "none" {
let ahdr = NAAudioInfo::new(self.a_den, 1, SND_S16_FORMAT, self.a_num as usize);
let ainfo = NACodecInfo::new(self.aname, NACodecTypeInfo::Audio(ahdr), None);
- let res = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, self.a_num, self.a_den));
+ let res = strmgr.add_stream(NAStream::new(StreamType::Audio, 1, ainfo, self.a_num, self.a_den, 0));
validate!(res.is_some());
self.audio_id = res.unwrap();
}
@@ -132,6 +133,7 @@ impl<'a> DemuxCore<'a> for VivoDemuxer<'a> {
fn seek(&mut self, _time: NATimePoint, _seek_idx: &SeekIndex) -> DemuxerResult<()> {
Err(DemuxerError::NotPossible)
}
+ fn get_duration(&self) -> u64 { self.duration }
}
impl<'a> NAOptionHandler for VivoDemuxer<'a> {
@@ -156,6 +158,7 @@ impl<'a> VivoDemuxer<'a> {
width: 0,
height: 0,
fps: 0.0,
+ duration: 0,
vname: "none",
aname: "none",
}
@@ -216,6 +219,11 @@ impl<'a> VivoDemuxer<'a> {
return Err(DemuxerError::InvalidData);
};
},
+ b"Duration" => {
+ self.duration = if let Ok(val) = valstr.parse() {
+ val
+ } else { 0 };
+ },
/* b"TimeUnitNumerator" => {
self.v_num = if let Ok(val) = valstr.parse() {
val