+ /// Returns media duration reported by container or its streams.
+ ///
+ /// Duration is in milliseconds and set to zero when it is not available.
+ pub fn get_duration(&self) -> u64 {
+ let duration = self.dmx.get_duration();
+ if duration != 0 {
+ return duration;
+ }
+ let mut duration = 0;
+ for stream in self.streams.iter() {
+ if stream.duration > 0 {
+ let dur = NATimeInfo::ts_to_time(stream.duration, 1000, stream.tb_num, stream.tb_den);
+ if duration < dur {
+ duration = dur;
+ }
+ }
+ }
+ duration
+ }
+}
+
+impl<'a> NAOptionHandler for Demuxer<'a> {
+ fn get_supported_options(&self) -> &[NAOptionDefinition] {
+ self.dmx.get_supported_options()
+ }
+ fn set_options(&mut self, options: &[NAOption]) {
+ self.dmx.set_options(options);
+ }
+ fn query_option_value(&self, name: &str) -> Option<NAValue> {
+ self.dmx.query_option_value(name)
+ }