aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-realmedia
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-06-11 12:54:34 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-06-11 12:54:34 +0200
commit60b9641e93c0feb263f961dec5be151b59b5939a (patch)
tree09a7e5152d3ed17be8ff4152503ff46d51a6129f /nihav-realmedia
parent54d2b09a7863070fabde6f8df45320ba35e8030b (diff)
downloadnihav-60b9641e93c0feb263f961dec5be151b59b5939a.tar.gz
rmdemux: support index version 2
Diffstat (limited to 'nihav-realmedia')
-rw-r--r--nihav-realmedia/src/demuxers/realmedia.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/nihav-realmedia/src/demuxers/realmedia.rs b/nihav-realmedia/src/demuxers/realmedia.rs
index d591eab..b5cd9b7 100644
--- a/nihav-realmedia/src/demuxers/realmedia.rs
+++ b/nihav-realmedia/src/demuxers/realmedia.rs
@@ -1132,19 +1132,29 @@ impl<'a> RealMediaDemuxer<'a> {
Ok(())
}
fn parse_index(&mut self, seek_idx: &mut SeekIndex, chunk_size: usize, ver: u16) -> DemuxerResult<()> {
- if ver != 0 { return Ok(()); }
+ if ver != 0 && ver != 2 { return Ok(()); }
let num_entries = self.src.read_u32be()? as usize;
let str_id = self.src.read_u16be()? as u32;
let _next_idx = self.src.read_u32be()?;
- validate!(chunk_size == num_entries * 14 + 10);
+ if ver == 2 {
+ self.src.read_u32be()?;
+ }
+ if ver == 0 {
+ validate!(chunk_size == num_entries * 14 + 10);
+ } else {
+ validate!(chunk_size == num_entries * 18 + 14);
+ }
if num_entries == 0 { return Ok(()); }
seek_idx.add_stream(str_id);
let idx = seek_idx.get_stream_index(str_id).unwrap();
for _ in 0..num_entries {
- let ver = self.src.read_u16be()? as u32;
- validate!(ver == 0);
+ let iver = self.src.read_u16be()?;
+ validate!(iver == ver);
let ts = self.src.read_u32be()? as u64;
+ if ver == 2 {
+ self.src.read_u32be()?;
+ }
let pos = self.src.read_u32be()? as u64;
let _pkt_no = self.src.read_u32be()?;
idx.add_entry(SeekEntry { time: ts, pts: 0, pos });