From c767837aaa5802a1be5befa5690ee2f63a71fc46 Mon Sep 17 00:00:00 2001 From: tage64 Date: Sun, 2 Jan 2022 16:41:11 +0100 Subject: [PATCH 1/2] Bump rodio version to 0.14. --- Cargo.toml | 2 +- cli/Cargo.toml | 4 ++-- cli/src/main.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc93042..11023a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ ffmpeg-sys-next = { version = "4.3.4", default-features=false, features=['avcode thiserror = "1.0" log = "0.4" -rodio = { version = "0.11", default-features=false, optional=true } +rodio = { version = "0.14.0", default-features = false, optional = true } [workspace] members = [ diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 13cd01d..caac98d 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -7,9 +7,9 @@ edition = "2018" [dependencies] ffmpeg-decoder = { path = "../", features = ['rodio_source'] } -rodio = { version = "0.11", default-features=false } +rodio = { version = "0.14.0", default-features = false } anyhow = "1.0" env_logger = "0.7" log = "0.4" -structopt = "0.3" \ No newline at end of file +structopt = "0.3" diff --git a/cli/src/main.rs b/cli/src/main.rs index 7e5f400..0d15c61 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -47,8 +47,8 @@ fn decode_to_file(input: PathBuf) -> Result<(), Error> { fn play_file(input: PathBuf) -> Result<(), Error> { let decoder = ffmpeg_decoder::Decoder::open(&input)?; - let device = rodio::default_output_device().unwrap(); - let sink = Sink::new(&device); + let (_stream, stream_handler) = rodio::OutputStream::try_default()?; + let sink = Sink::try_new(&stream_handler)?; sink.append(decoder); sink.play(); From c88bcc6af55b0be1c1a909743dbaaa49ced5a1f3 Mon Sep 17 00:00:00 2001 From: tage64 Date: Sun, 2 Jan 2022 17:00:52 +0100 Subject: [PATCH 2/2] Update rodio example to match new rodio version. --- src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 55ddf19..f290618 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,14 +13,15 @@ //! ## Example as Rodio Source //! //! ```rust -//! use rodio::Sink; -//! use std::path::PathBuf; +//! use rodio::{OutputStream, Sink}; +//! use std::path::Path; +//! use std::error::Error; //! -//! fn play_file(input: PathBuf) -> Result<(), Error> { -//! let decoder = ffmpeg_decoder::Decoder::open(&input)?; +//! fn play_file(input: impl AsRef) -> Result<(), Box> { +//! let decoder = ffmpeg_decoder::Decoder::open(input)?; //! -//! let device = rodio::default_output_device().unwrap(); -//! let sink = Sink::new(&device); +//! let (_stream, stream_handler) = OutputStream::try_default()?; +//! let sink = Sink::try_new(&stream_handler)?; //! //! sink.append(decoder); //! sink.play();