diff --git a/src/demux.rs b/src/demux.rs index cc83568..372a7ae 100644 --- a/src/demux.rs +++ b/src/demux.rs @@ -221,6 +221,8 @@ impl Demuxer { let info = DemuxerInfo { duration: (*self.ctx).duration as f32 / AV_TIME_BASE as f32, bitrate: (*self.ctx).bit_rate as usize, + format: rstr!((*(*self.ctx).iformat).name).to_string(), + mime_types: rstr!((*(*self.ctx).iformat).mime_type).to_string(), streams, #[cfg(feature = "avformat_version_greater_than_60_19")] groups: stream_groups, diff --git a/src/lib.rs b/src/lib.rs index cb169e1..c847541 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,6 +52,7 @@ macro_rules! bail_ffmpeg { #[macro_export] macro_rules! cstr { ($str:expr) => { + // TODO: leaky std::ffi::CString::new($str).unwrap().into_raw() }; } diff --git a/src/stream_info.rs b/src/stream_info.rs index 994a992..2795d53 100644 --- a/src/stream_info.rs +++ b/src/stream_info.rs @@ -10,8 +10,15 @@ use std::intrinsics::transmute; #[derive(Clone, Debug, PartialEq)] pub struct DemuxerInfo { + /// Average bitrate of the media pub bitrate: usize, + /// Duration of the media in seconds pub duration: f32, + /// Comma separated list of formats supported by the demuxer + pub format: String, + /// Comma separated list of mime-types used during probing + pub mime_types: String, + /// List of streams contained in the media pub streams: Vec, #[cfg(feature = "avformat_version_greater_than_60_19")] pub groups: Vec, diff --git a/src/transcode.rs b/src/transcode.rs index 69b3b6a..dc9fb44 100644 --- a/src/transcode.rs +++ b/src/transcode.rs @@ -172,6 +172,7 @@ mod tests { "test_output/test_transcode.mkv", )?; let info = transcoder.prepare()?; + assert!(!info.format.is_empty()); for c in info.streams { transcoder.copy_stream(c)?; }