# HG changeset patch # User Dan Glastonbury # Date 1509944369 -36000 # Mon Nov 06 14:59:29 2017 +1000 # Node ID 00065e245cfce28f4fe8e218c47cf8008d95b7c2 # Parent 3fcd9eb7c60afb5064b2b5f88ebc62225698f642 Bug 1428952 - P1: Update cubeb-rs to commit aaba6b3. r=kinetik MozReview-Commit-ID: KjgDEJve9Zx diff --git a/media/cubeb-rs/README_MOZILLA b/media/cubeb-rs/README_MOZILLA new file mode 100644 --- /dev/null +++ b/media/cubeb-rs/README_MOZILLA @@ -0,0 +1,8 @@ +The source from this directory was copied from the cubeb-rs +git repository using the update.sh script. The only changes +made were those applied by update.sh and the addition of +Makefile.in build files for the Mozilla build system. + +The cubeb-rs git repository is: https://github.com/djg/cubeb-rs.git + +The git commit ID used was aaba6b34368db990d3ec165ebc85053f61097bac (2017-10-19 15:43:50 +1000) diff --git a/media/cubeb-rs/cubeb-api/Cargo.toml b/media/cubeb-rs/cubeb-api/Cargo.toml --- a/media/cubeb-rs/cubeb-api/Cargo.toml +++ b/media/cubeb-rs/cubeb-api/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "cubeb" -version = "0.3.0" +version = "0.3.1" authors = ["Dan Glastonbury "] license = "ISC" readme = "README.md" keywords = ["cubeb"] repository = "https://github.com/djg/cubeb-rs" homepage = "https://github.com/djg/cubeb-rs" description = """ Bindings to libcubeb for interacting with system audio from rust. diff --git a/media/cubeb-rs/cubeb-api/libcubeb-sys/lib.rs b/media/cubeb-rs/cubeb-api/libcubeb-sys/lib.rs --- a/media/cubeb-rs/cubeb-api/libcubeb-sys/lib.rs +++ b/media/cubeb-rs/cubeb-api/libcubeb-sys/lib.rs @@ -46,16 +46,17 @@ extern "C" { latency_frames: c_uint, data_callback: cubeb_data_callback, state_callback: cubeb_state_callback, user_ptr: *mut c_void, ) -> c_int; pub fn cubeb_stream_destroy(stream: *mut cubeb_stream); pub fn cubeb_stream_start(stream: *mut cubeb_stream) -> c_int; pub fn cubeb_stream_stop(stream: *mut cubeb_stream) -> c_int; + pub fn cubeb_stream_reset_default_device(stream: *mut cubeb_stream) -> c_int; pub fn cubeb_stream_get_position( stream: *mut cubeb_stream, position: *mut u64, ) -> c_int; pub fn cubeb_stream_get_latency( stream: *mut cubeb_stream, latency: *mut c_uint, ) -> c_int; diff --git a/media/cubeb-rs/cubeb-api/src/stream.rs b/media/cubeb-rs/cubeb-api/src/stream.rs --- a/media/cubeb-rs/cubeb-api/src/stream.rs +++ b/media/cubeb-rs/cubeb-api/src/stream.rs @@ -241,16 +241,23 @@ where // Stop playback. pub fn stop(&self) -> Result<()> { unsafe { try_call!(sys::cubeb_stream_stop(self.raw)); } Ok(()) } + pub fn reset_default_device(&self) -> Result<()> { + unsafe { + try_call!(sys::cubeb_stream_reset_default_device(self.raw)); + } + Ok(()) + } + // Get the current stream playback position. pub fn position(&self) -> Result { let mut position: u64 = 0; unsafe { try_call!(sys::cubeb_stream_get_position(self.raw, &mut position)); } Ok(position) } diff --git a/media/cubeb-rs/remove-cubeb-build.patch b/media/cubeb-rs/remove-cubeb-build.patch new file mode 100644 --- /dev/null +++ b/media/cubeb-rs/remove-cubeb-build.patch @@ -0,0 +1,34 @@ +From 1fca45f284d78a8df5e86779aab92173f69557a0 Mon Sep 17 00:00:00 2001 +From: Dan Glastonbury +Date: Mon, 6 Nov 2017 15:00:48 +1000 +Subject: remove-cubeb-build.patch + +MozReview-Commit-ID: bymdNMfAjE + +diff --git a/media/cubeb-rs/cubeb-api/libcubeb-sys/Cargo.toml b/media/cubeb-rs/cubeb-api/libcubeb-sys/Cargo.toml +index 523c352..6ed4d34 100644 +--- a/media/cubeb-rs/cubeb-api/libcubeb-sys/Cargo.toml ++++ b/media/cubeb-rs/cubeb-api/libcubeb-sys/Cargo.toml +@@ -6,17 +6,9 @@ repository = "https://github.com/djg/cubeb-rs" + license = "ISC" + description = "Native bindings to the cubeb library" + +-links = "cubeb" +-build = "build.rs" +- + [lib] + name = "libcubeb_sys" + path = "lib.rs" + + [dependencies] +-cubeb-core = { path = "../../cubeb-core" } +- +-[build-dependencies] +-pkg-config = "0.3" +-cmake = "0.1.2" +-gcc = "0.3" ++cubeb-core = { path = "../../cubeb-core" } +\ No newline at end of file +-- +2.10.2 + diff --git a/media/cubeb-rs/update.sh b/media/cubeb-rs/update.sh new file mode 100755 --- /dev/null +++ b/media/cubeb-rs/update.sh @@ -0,0 +1,35 @@ +# Usage: sh update.sh +set -e + +cp -p $1/LICENSE . +cp -p $1/Cargo.toml . +for dir in cubeb-api cubeb-backend cubeb-core; do + test -d $dir/src || mkdir -p $dir/src + cp -pr $1/$dir/Cargo.toml $dir/ + cp -pr $1/$dir/src/* $dir/src/ +done + +test -d cubeb-api/libcubeb-sys || mkdir -p cubeb-api/libcubeb-sys +cp -p $1/cubeb-api/libcubeb-sys/Cargo.toml cubeb-api/libcubeb-sys/ +cp -p $1/cubeb-api/libcubeb-sys/lib.rs cubeb-api/libcubeb-sys/ + +if [ -d $1/.git ]; then + rev=$(cd $1 && git rev-parse --verify HEAD) + date=$(cd $1 && git show -s --format=%ci HEAD) + dirty=$(cd $1 && git diff-index --name-only HEAD) +fi + +if [ -n "$rev" ]; then + version=$rev + if [ -n "$dirty" ]; then + version=$version-dirty + echo "WARNING: updating from a dirty git repository." + fi + sed -i.bak -e "/The git commit ID used was/ s/[0-9a-f]\{40\}\(-dirty\)\{0,1\} .\{1,100\}/$version ($date)/" README_MOZILLA + rm README_MOZILLA.bak +else + echo "Remember to update README_MOZILLA with the version details." +fi + +echo "Applying remote-cubeb-build.patch on top of $rev" +patch -p3 < remove-cubeb-build.patch