feat: add format to demuxer info
This commit is contained in:
parent
b358b3e420
commit
76333375d8
@ -221,6 +221,8 @@ impl Demuxer {
|
|||||||
let info = DemuxerInfo {
|
let info = DemuxerInfo {
|
||||||
duration: (*self.ctx).duration as f32 / AV_TIME_BASE as f32,
|
duration: (*self.ctx).duration as f32 / AV_TIME_BASE as f32,
|
||||||
bitrate: (*self.ctx).bit_rate as usize,
|
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,
|
streams,
|
||||||
#[cfg(feature = "avformat_version_greater_than_60_19")]
|
#[cfg(feature = "avformat_version_greater_than_60_19")]
|
||||||
groups: stream_groups,
|
groups: stream_groups,
|
||||||
|
@ -52,6 +52,7 @@ macro_rules! bail_ffmpeg {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! cstr {
|
macro_rules! cstr {
|
||||||
($str:expr) => {
|
($str:expr) => {
|
||||||
|
// TODO: leaky
|
||||||
std::ffi::CString::new($str).unwrap().into_raw()
|
std::ffi::CString::new($str).unwrap().into_raw()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,15 @@ use std::intrinsics::transmute;
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct DemuxerInfo {
|
pub struct DemuxerInfo {
|
||||||
|
/// Average bitrate of the media
|
||||||
pub bitrate: usize,
|
pub bitrate: usize,
|
||||||
|
/// Duration of the media in seconds
|
||||||
pub duration: f32,
|
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<StreamInfo>,
|
pub streams: Vec<StreamInfo>,
|
||||||
#[cfg(feature = "avformat_version_greater_than_60_19")]
|
#[cfg(feature = "avformat_version_greater_than_60_19")]
|
||||||
pub groups: Vec<StreamGroupInfo>,
|
pub groups: Vec<StreamGroupInfo>,
|
||||||
|
@ -172,6 +172,7 @@ mod tests {
|
|||||||
"test_output/test_transcode.mkv",
|
"test_output/test_transcode.mkv",
|
||||||
)?;
|
)?;
|
||||||
let info = transcoder.prepare()?;
|
let info = transcoder.prepare()?;
|
||||||
|
assert!(!info.format.is_empty());
|
||||||
for c in info.streams {
|
for c in info.streams {
|
||||||
transcoder.copy_stream(c)?;
|
transcoder.copy_stream(c)?;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user