ffmpeg_decoder/
lib.rs

1//! Decodes audio files using ffmpeg bindings
2//!
3//! Create a [`Decoder`](struct.Decoder.html) by supplying a `Path` to an audio file. [`Decoder`](struct.Decoder.html)
4//! implies `Iterator` where each iteration returns a single `i16` signed 16bit sample.
5//! Also implements [rodio's](https://github.com/RustAudio/rodio) [`Source`](https://docs.rs/rodio/latest/rodio/source/trait.Source.html) trait, where
6//! the [`Decoder`](struct.Decoder.html) can be supplied as a sink source for playback.
7//!
8//! ### Features Flags
9//!
10//! - `rodio_source` to enable rodio's [`Source`](https://docs.rs/rodio/latest/rodio/source/trait.Source.html) trait
11//!
12//!
13//! ## Example as Rodio Source
14//!
15//! ```rust
16//! use rodio::Sink;
17//! use std::path::PathBuf;
18//!
19//! fn play_file(input: PathBuf) -> Result<(), Error> {
20//!     let decoder = ffmpeg_decoder::Decoder::open(&input)?;
21//!
22//!     let device = rodio::default_output_device().unwrap();
23//!     let sink = Sink::new(&device);
24//!
25//!     sink.append(decoder);
26//!     sink.play();
27//!     sink.sleep_until_end();
28//!
29//!     Ok(())
30//! }
31//! ```
32mod decoder;
33pub use decoder::Decoder;
34
35mod error;
36pub use error::Error;
37
38#[cfg(feature = "rodio_source")]
39mod rodio;