Bug 1428952 - P1: Update cubeb-rs to commit aaba6b3. r?kinetik draft
authorDan Glastonbury <dan.glastonbury@gmail.com>
Mon, 06 Nov 2017 14:59:29 +1000
changeset 723027 5d81dea52ea82065e6108892b51c07ec000ececa
parent 723009 5faab9e619901b1513fd4ca137747231be550def
child 723028 73b54ebac44a8ea59ad20c27e05425a8994f2d15
push id96297
push userbmo:dglastonbury@mozilla.com
push dateMon, 22 Jan 2018 05:21:01 +0000
reviewerskinetik
bugs1428952
milestone59.0a1
Bug 1428952 - P1: Update cubeb-rs to commit aaba6b3. r?kinetik MozReview-Commit-ID: KjgDEJve9Zx
media/cubeb-rs/README_MOZILLA
media/cubeb-rs/cubeb-api/Cargo.toml
media/cubeb-rs/cubeb-api/libcubeb-sys/lib.rs
media/cubeb-rs/cubeb-api/src/stream.rs
media/cubeb-rs/remove-cubeb-build.patch
media/cubeb-rs/update.sh
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)
--- 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 <dglastonbury@mozilla.com>"]
 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.
--- 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;
--- 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<u64> {
         let mut position: u64 = 0;
         unsafe {
             try_call!(sys::cubeb_stream_get_position(self.raw, &mut position));
         }
         Ok(position)
     }
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 <dan.glastonbury@gmail.com>
+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
+
new file mode 100755
--- /dev/null
+++ b/media/cubeb-rs/update.sh
@@ -0,0 +1,35 @@
+# Usage: sh update.sh <upstream_src_directory>
+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