Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
Add bitrate() method
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeeeta committed Jan 28, 2017
1 parent 153f450 commit 6f8cfcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/player.rs
Expand Up @@ -32,7 +32,7 @@ fn main() {
ec.conn.connect_ports(&ch, &port).unwrap();
}
}
println!("Chans: {} Sample rate: {} Duration: {}", file.channels(), file.sample_rate(), file.duration());
println!("Chans: {} Sample rate: {} Duration: {} Bitrate: {}", file.channels(), file.sample_rate(), file.duration(), file.bitrate());
let thr = ::std::thread::spawn(move || {
loop {
for x in &mut file {
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Expand Up @@ -165,6 +165,9 @@ impl MediaFile {
pub fn sample_rate(&self) -> usize {
(unsafe { (*self.audio_ctx).sample_rate }) as usize
}
pub fn bitrate(&self) -> usize {
(unsafe { (*self.format_ctx).bit_rate }) as usize
}
pub fn duration(&self) -> Duration {
let dur = unsafe { (*self.format_ctx).duration };
Duration::microseconds(dur)
Expand Down

0 comments on commit 6f8cfcd

Please sign in to comment.