зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1789547 - Upgrade cubeb-sys to 0.10.1 r=padenot,supply-chain-reviewers,cubeb-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D156631
This commit is contained in:
Родитель
d763d1555a
Коммит
55da3cc045
|
@ -1117,27 +1117,27 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
|||
|
||||
[[package]]
|
||||
name = "cubeb"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d47c8cc00b8034e996d7dd262956a0d904c1e1d0d521d22c99801420b38484bd"
|
||||
checksum = "53051f86ed8cf5a6771704e80147266f32bdf05cc09089da304484a1c612bb97"
|
||||
dependencies = [
|
||||
"cubeb-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cubeb-backend"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3d1cd779dd013686571104bbc98f2bcde1e732764b8ad394efaea86b064227d"
|
||||
checksum = "0ce2d65b509a33ff97b83439dd1df5f50b8253cb14aa5c55794df37a28846724"
|
||||
dependencies = [
|
||||
"cubeb-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cubeb-core"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04aabcd7fa088330b5f25b2f92cd1c2d80d0232e114e5bdaa682bb65103d57d9"
|
||||
checksum = "48c0ac573dc2e393c12e4b829d6e17bbb7a1f95b288043ee47ef251097ddb094"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cubeb-sys",
|
||||
|
@ -1175,9 +1175,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cubeb-sys"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da8f61339785526e9488f4902ef09d83483fa7fc2c6f6f6f80bb8ae04af03818"
|
||||
checksum = "33b49428acff552b1ba790649ea16a6f3d60cf74e9457a1378771a1acc12d5ee"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"pkg-config",
|
||||
|
|
|
@ -225,6 +225,38 @@ which is statically guaranteed to be safe. Inputs to the macro have to be
|
|||
static so there's no uncontrolled input whatsoever.
|
||||
"""
|
||||
|
||||
[[audits.cubeb]]
|
||||
who = "Matthew Gregan <kinetik@flim.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.10.1"
|
||||
notes = """
|
||||
Mozilla-developed package.
|
||||
"""
|
||||
|
||||
[[audits.cubeb-backend]]
|
||||
who = "Matthew Gregan <kinetik@flim.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.10.1"
|
||||
notes = """
|
||||
Mozilla-developed package.
|
||||
"""
|
||||
|
||||
[[audits.cubeb-core]]
|
||||
who = "Matthew Gregan <kinetik@flim.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.10.1"
|
||||
notes = """
|
||||
Mozilla-developed package.
|
||||
"""
|
||||
|
||||
[[audits.cubeb-sys]]
|
||||
who = "Matthew Gregan <kinetik@flim.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.10.1"
|
||||
notes = """
|
||||
Mozilla-developed package.
|
||||
"""
|
||||
|
||||
[[audits.derive_arbitrary]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
|
|
|
@ -411,22 +411,6 @@ criteria = "safe-to-deploy"
|
|||
version = "0.1.3"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
[[exemptions.cubeb]]
|
||||
version = "0.10.0"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
[[exemptions.cubeb-backend]]
|
||||
version = "0.10.0"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
[[exemptions.cubeb-core]]
|
||||
version = "0.10.0"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
[[exemptions.cubeb-sys]]
|
||||
version = "0.10.0"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
[[exemptions.d3d12]]
|
||||
version = "0.4.1"
|
||||
criteria = "safe-to-deploy"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"76c777e980f3adf5366a019d60683e09f7eb6124130e05c330da7afd3bf702a2","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/capi.rs":"edf8a65022d393d0214897986ca49428438b0b32f84e1380c962ecc835290e54","src/lib.rs":"94b80747ae1037423a2281f2572fc6d15cd7702417974ae3730adccd71c7a300","src/log.rs":"cf8e3a778f6b72d4cd80c1c56963355aa2224f19fd4fdf07d03f6fb366000899","src/ops.rs":"981866ad12bf07e2f2b887ef9b5810364d2c48101d513879a06a8bf76984dc50","src/traits.rs":"ac35b2124876865b427f0e91026bb1102aadc96f1b763a639c495640cbd92650","tests/test_capi.rs":"3f028589aa4e8cd00469f51451d55c119ec9830df56e248f3ae7e0ddccbbcdd1"},"package":"e3d1cd779dd013686571104bbc98f2bcde1e732764b8ad394efaea86b064227d"}
|
||||
{"files":{"Cargo.toml":"e00c08778e781f852e5f23481fe692311fee9ff332e366900064e08077eb8cf1","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/capi.rs":"edf8a65022d393d0214897986ca49428438b0b32f84e1380c962ecc835290e54","src/lib.rs":"4ce6db20f88487e99057ebeae0615fa1c99e82cfee0ab0825936da2e108fc73e","src/log.rs":"56e4cca1fc1e2bbfb61c61f849f577b2175899139686b1e092e00dba7f6d5273","src/ops.rs":"981866ad12bf07e2f2b887ef9b5810364d2c48101d513879a06a8bf76984dc50","src/traits.rs":"ac35b2124876865b427f0e91026bb1102aadc96f1b763a639c495640cbd92650","tests/test_capi.rs":"27093e582f540c5baf50af5d1e5008c46573792853927b9ecfe62c117bfac303"},"package":"0ce2d65b509a33ff97b83439dd1df5f50b8253cb14aa5c55794df37a28846724"}
|
|
@ -11,18 +11,22 @@
|
|||
|
||||
[package]
|
||||
name = "cubeb-backend"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
|
||||
description = "Bindings to libcubeb internals to facilitate implementing cubeb backends in rust.\n"
|
||||
homepage = "https://github.com/djg/cubeb-rs"
|
||||
description = """
|
||||
Bindings to libcubeb internals to facilitate implementing cubeb backends in rust.
|
||||
"""
|
||||
homepage = "https://github.com/mozilla/cubeb-rs"
|
||||
keywords = ["cubeb"]
|
||||
categories = ["api-bindings"]
|
||||
license = "ISC"
|
||||
repository = "https://github.com/djg/cubeb-rs"
|
||||
repository = "https://github.com/mozilla/cubeb-rs"
|
||||
|
||||
[dependencies.cubeb-core]
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
|
||||
[features]
|
||||
gecko-in-tree = ["cubeb-core/gecko-in-tree"]
|
||||
|
||||
[badges.circle-ci]
|
||||
repository = "djg/cubeb-rs"
|
||||
repository = "mozilla/cubeb-rs"
|
||||
|
|
|
@ -7,7 +7,7 @@ extern crate cubeb_core;
|
|||
|
||||
pub mod capi;
|
||||
#[macro_use]
|
||||
mod log;
|
||||
pub mod log;
|
||||
mod ops;
|
||||
mod traits;
|
||||
|
||||
|
|
|
@ -3,71 +3,98 @@
|
|||
// This program is made available under an ISC-style license. See the
|
||||
// accompanying file LICENSE for details.
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_log_internal {
|
||||
($level: expr, $msg: expr) => {
|
||||
#[allow(unused_unsafe)]
|
||||
unsafe {
|
||||
if $level <= $crate::ffi::g_cubeb_log_level.into() {
|
||||
cubeb_log_internal!(__INTERNAL__ $msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
($level: expr, $fmt: expr, $($arg: expr),+) => {
|
||||
#[allow(unused_unsafe)]
|
||||
unsafe {
|
||||
if $level <= $crate::ffi::g_cubeb_log_level.into() {
|
||||
cubeb_log_internal!(__INTERNAL__ format!($fmt, $($arg),*));
|
||||
}
|
||||
}
|
||||
};
|
||||
(__INTERNAL__ $msg: expr) => {
|
||||
if let Some(log_callback) = $crate::ffi::g_cubeb_log_callback {
|
||||
use std::io::Write;
|
||||
|
||||
let mut buf = [0 as u8; 1024];
|
||||
let filename = std::path::Path::new(file!())
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap();
|
||||
// 2 for ':', 1 for ' ', 1 for '\n', and 1 for converting `line!()` to number of digits
|
||||
let len = filename.len() + ((line!() as f32).log10().trunc() as usize) + $msg.len() + 5;
|
||||
debug_assert!(len < buf.len(), "log will be truncated");
|
||||
let _ = write!(&mut buf[..], "{}:{}: {}\n", filename, line!(), $msg);
|
||||
let last = std::cmp::min(len, buf.len() - 1);
|
||||
buf[last] = 0;
|
||||
let cstr = unsafe { std::ffi::CStr::from_bytes_with_nul_unchecked(&buf[..=last]) };
|
||||
log_callback(cstr.as_ptr());
|
||||
}
|
||||
}
|
||||
/// Annotates input buffer string with logging information.
|
||||
/// Returns result as a ffi::CStr for use with native cubeb logging functions.
|
||||
pub fn cubeb_log_internal_buf_fmt<'a>(
|
||||
buf: &'a mut [u8; 1024],
|
||||
file: &str,
|
||||
line: u32,
|
||||
msg: &str,
|
||||
) -> &'a std::ffi::CStr {
|
||||
use std::io::Write;
|
||||
let filename = std::path::Path::new(file)
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap();
|
||||
// 2 for ':', 1 for ' ', 1 for '\n', and 1 for converting `line!()` to number of digits
|
||||
let len = filename.len() + ((line as f32).log10().trunc() as usize) + msg.len() + 5;
|
||||
debug_assert!(len < buf.len(), "log will be truncated");
|
||||
let _ = writeln!(&mut buf[..], "{}:{}: {}", filename, line, msg);
|
||||
let last = std::cmp::min(len, buf.len() - 1);
|
||||
buf[last] = 0;
|
||||
let cstr = unsafe { std::ffi::CStr::from_bytes_with_nul_unchecked(&buf[..=last]) };
|
||||
cstr
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_logv {
|
||||
($msg: expr) => (cubeb_log_internal!($crate::LogLevel::Verbose, $msg));
|
||||
($fmt: expr, $($arg: expr),+) => (cubeb_log_internal!($crate::LogLevel::Verbose, $fmt, $($arg),*));
|
||||
macro_rules! cubeb_log_internal {
|
||||
($log_callback: expr, $level: expr, $fmt: expr, $($arg: expr),+) => {
|
||||
cubeb_log_internal!($log_callback, $level, format!($fmt, $($arg),*));
|
||||
};
|
||||
($log_callback: expr, $level: expr, $msg: expr) => {
|
||||
#[allow(unused_unsafe)]
|
||||
unsafe {
|
||||
if $level <= $crate::ffi::g_cubeb_log_level.into() {
|
||||
if let Some(log_callback) = $log_callback {
|
||||
let mut buf = [0u8; 1024];
|
||||
log_callback(
|
||||
$crate::log::cubeb_log_internal_buf_fmt(&mut buf, file!(), line!(), &$msg)
|
||||
.as_ptr(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_log {
|
||||
($msg: expr) => (cubeb_log_internal!($crate::LogLevel::Normal, $msg));
|
||||
($fmt: expr, $($arg: expr),+) => (cubeb_log_internal!($crate::LogLevel::Normal, $fmt, $($arg),*));
|
||||
($($arg: expr),+) => (cubeb_log_internal!($crate::ffi::g_cubeb_log_callback, $crate::LogLevel::Normal, $($arg),+));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_logv {
|
||||
($($arg: expr),+) => (cubeb_log_internal!($crate::ffi::g_cubeb_log_callback, $crate::LogLevel::Verbose, $($arg),+));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_alog {
|
||||
($($arg: expr),+) => (cubeb_log_internal!($crate::ffi::cubeb_async_log.into(), $crate::LogLevel::Normal, $($arg),+));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cubeb_alogv {
|
||||
($($arg: expr),+) => (cubeb_log_internal!($crate::ffi::cubeb_async_log.into(), $crate::LogLevel::Verbose, $($arg),+));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_normal_logging() {
|
||||
cubeb_log!("This is log at normal level");
|
||||
fn test_normal_logging_sync() {
|
||||
cubeb_log!("This is synchronous log output at normal level");
|
||||
cubeb_log!("{} Formatted log", 1);
|
||||
cubeb_log!("{} Formatted {} log {}", 1, 2, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_verbose_logging() {
|
||||
cubeb_logv!("This is a log at verbose level");
|
||||
fn test_verbose_logging_sync() {
|
||||
cubeb_logv!("This is synchronous log output at verbose level");
|
||||
cubeb_logv!("{} Formatted log", 1);
|
||||
cubeb_logv!("{} Formatted {} log {}", 1, 2, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normal_logging_async() {
|
||||
cubeb_alog!("This is asynchronous log output at normal level");
|
||||
cubeb_alog!("{} Formatted log", 1);
|
||||
cubeb_alog!("{} Formatted {} log {}", 1, 2, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_verbose_logging_async() {
|
||||
cubeb_alogv!("This is asynchronous log output at verbose level");
|
||||
cubeb_alogv!("{} Formatted log", 1);
|
||||
cubeb_alogv!("{} Formatted {} log {}", 1, 2, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ use std::ptr;
|
|||
pub const OPS: Ops = capi_new!(TestContext, TestStream);
|
||||
|
||||
struct TestContext {
|
||||
#[allow(dead_code)]
|
||||
pub ops: *const Ops,
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"0bcfe4fb7ffdc555520121b9165b4727b34671e6fdeddfad8da7aa94031d057d","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/builders.rs":"87adbbdd63fde848eeaae4a79a04859ed02ca982fb644f6b8b5fe7c158a8944c","src/channel.rs":"676d0cfa733c09ef039ed16138cb78ae6bd10b58d0eb93292e6d8accc69086ff","src/context.rs":"a5796ffbced8cc3c48bea8e19c4fabb8b9bd1ff3a7d0ead635ba5b2a27618672","src/device.rs":"5fa27f2ba7f108e4ae32ad776b1639b0e8c8ad4c401ce171c512c8126ea5a517","src/device_collection.rs":"37e4f46fc1ec3c88b71aad94aea1a5b2a1eb85aa9df63d7bcc251638078709a6","src/error.rs":"5e276e3256bec8f042ba9c4dfc6ea96cadd39f905b877261fb48629b779b9c4e","src/ffi_types.rs":"71948d0949675df876e18c4340f4e693fc6a14c4de9d63a3885450c95577596b","src/format.rs":"7162c1550be53f5fe94b0bba4c71fea2f0304462108657c62a20ea47207ca413","src/lib.rs":"6010a5e20b836b8e5c9fba382fde819e6f3c18c0ec2016e6e7e118eabedbcd51","src/log.rs":"c46bae3472043fd076df3229c3421d948a87fae8495c1524b41ab2d8608f612a","src/stream.rs":"c370616448ae972295a272cc7561e0b8fe0c48558e2c1449e5ee7090a32c5564","src/try_call.rs":"4ee0b4bdce7740a78bea76c67d8f6a31e6f8ff615acb05cbe67e00683d1b69a6","src/util.rs":"308cfbaacd615ff600e74415c52daeef007fff34a4a0648a73c0042f6067f84f"},"package":"04aabcd7fa088330b5f25b2f92cd1c2d80d0232e114e5bdaa682bb65103d57d9"}
|
||||
{"files":{"Cargo.toml":"7b4569f6fffc88f8176064967e26b353db5738c0918dcd0940da47ec1a2fe4a2","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/builders.rs":"87adbbdd63fde848eeaae4a79a04859ed02ca982fb644f6b8b5fe7c158a8944c","src/call.rs":"cf8949c2cf53f5418d8e5222f570b9301a98a476a18c734fc2ebbc8b53ac0165","src/channel.rs":"676d0cfa733c09ef039ed16138cb78ae6bd10b58d0eb93292e6d8accc69086ff","src/context.rs":"9d7fd770511910e8c416ff47354863f547915ff94fb19ef2dd6796a70c2658cd","src/device.rs":"5fa27f2ba7f108e4ae32ad776b1639b0e8c8ad4c401ce171c512c8126ea5a517","src/device_collection.rs":"f86535ffeee73b889bdbac1c5a3432b01cca86df819a7cc26eaa0c983d30cbbe","src/error.rs":"3693bf575e9504b9b1ab114de3e2ce7132039acf27ec68967dae66c2ce1581aa","src/ffi_types.rs":"71948d0949675df876e18c4340f4e693fc6a14c4de9d63a3885450c95577596b","src/format.rs":"7162c1550be53f5fe94b0bba4c71fea2f0304462108657c62a20ea47207ca413","src/lib.rs":"57ecf793ab1cc052c021ccbf9ad011ea52d1303e2dbc54adea90a95b5d7a36cf","src/log.rs":"c46bae3472043fd076df3229c3421d948a87fae8495c1524b41ab2d8608f612a","src/stream.rs":"d34a66ee11fc3818a9685923c7211b96544cd2bb6b72f5fa4b2727c57d84d929","src/util.rs":"308cfbaacd615ff600e74415c52daeef007fff34a4a0648a73c0042f6067f84f"},"package":"48c0ac573dc2e393c12e4b829d6e17bbb7a1f95b288043ee47ef251097ddb094"}
|
|
@ -11,21 +11,25 @@
|
|||
|
||||
[package]
|
||||
name = "cubeb-core"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
|
||||
description = "Common types and definitions for cubeb rust and C bindings. Not intended for direct use.\n"
|
||||
homepage = "https://github.com/djg/cubeb-rs"
|
||||
description = """
|
||||
Common types and definitions for cubeb rust and C bindings. Not intended for direct use.
|
||||
"""
|
||||
homepage = "https://github.com/mozilla/cubeb-rs"
|
||||
keywords = ["cubeb"]
|
||||
categories = ["api-bindings"]
|
||||
license = "ISC"
|
||||
repository = "https://github.com/djg/cubeb-rs"
|
||||
repository = "https://github.com/mozilla/cubeb-rs"
|
||||
|
||||
[dependencies.bitflags]
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.cubeb-sys]
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
|
||||
[features]
|
||||
gecko-in-tree = ["cubeb-sys/gecko-in-tree"]
|
||||
|
||||
[badges.circle-ci]
|
||||
repository = "djg/cubeb-rs"
|
||||
repository = "mozilla/cubeb-rs"
|
||||
|
|
|
@ -16,12 +16,6 @@ pub fn cvt_r(ret: c_int) -> Result<(), Error> {
|
|||
|
||||
macro_rules! call {
|
||||
(ffi::$p:ident ($($e:expr),*)) => ({
|
||||
::try_call::cvt_r(ffi::$p($($e),*))
|
||||
})
|
||||
}
|
||||
|
||||
macro_rules! try_call {
|
||||
(ffi::$p:ident ($($e:expr),*)) => ({
|
||||
::try_call::cvt_r(ffi::$p($($e),*))?
|
||||
::call::cvt_r(ffi::$p($($e),*))
|
||||
})
|
||||
}
|
|
@ -29,7 +29,7 @@ impl Context {
|
|||
let context_name = as_ptr!(context_name);
|
||||
let backend_name = as_ptr!(backend_name);
|
||||
unsafe {
|
||||
try_call!(ffi::cubeb_init(&mut context, context_name, backend_name));
|
||||
call!(ffi::cubeb_init(&mut context, context_name, backend_name))?;
|
||||
Ok(Context::from_ptr(context))
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ impl ContextRef {
|
|||
pub fn max_channel_count(&self) -> Result<u32> {
|
||||
let mut channel_count = 0u32;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_get_max_channel_count(
|
||||
call!(ffi::cubeb_get_max_channel_count(
|
||||
self.as_ptr(),
|
||||
&mut channel_count
|
||||
));
|
||||
))?;
|
||||
}
|
||||
Ok(channel_count)
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ impl ContextRef {
|
|||
pub fn min_latency(&self, params: &StreamParamsRef) -> Result<u32> {
|
||||
let mut latency = 0u32;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_get_min_latency(
|
||||
call!(ffi::cubeb_get_min_latency(
|
||||
self.as_ptr(),
|
||||
params.as_ptr(),
|
||||
&mut latency
|
||||
));
|
||||
))?;
|
||||
}
|
||||
Ok(latency)
|
||||
}
|
||||
|
@ -70,10 +70,10 @@ impl ContextRef {
|
|||
pub fn preferred_sample_rate(&self) -> Result<u32> {
|
||||
let mut rate = 0u32;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_get_preferred_sample_rate(
|
||||
call!(ffi::cubeb_get_preferred_sample_rate(
|
||||
self.as_ptr(),
|
||||
&mut rate
|
||||
));
|
||||
))?;
|
||||
}
|
||||
Ok(rate)
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl ContextRef {
|
|||
let input_stream_params = as_ptr!(input_stream_params);
|
||||
let output_stream_params = as_ptr!(output_stream_params);
|
||||
|
||||
let _ = try_call!(ffi::cubeb_stream_init(
|
||||
call!(ffi::cubeb_stream_init(
|
||||
self.as_ptr(),
|
||||
&mut stm,
|
||||
stream_name,
|
||||
|
@ -113,18 +113,18 @@ impl ContextRef {
|
|||
data_callback,
|
||||
state_callback,
|
||||
user_ptr
|
||||
));
|
||||
))?;
|
||||
Ok(Stream::from_ptr(stm))
|
||||
}
|
||||
|
||||
pub fn enumerate_devices(&self, devtype: DeviceType) -> Result<DeviceCollection> {
|
||||
let mut coll = ffi::cubeb_device_collection::default();
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_enumerate_devices(
|
||||
call!(ffi::cubeb_enumerate_devices(
|
||||
self.as_ptr(),
|
||||
devtype.bits(),
|
||||
&mut coll
|
||||
));
|
||||
))?;
|
||||
}
|
||||
Ok(DeviceCollection::init_with_ctx(self, coll))
|
||||
}
|
||||
|
@ -139,12 +139,12 @@ impl ContextRef {
|
|||
callback: ffi::cubeb_device_collection_changed_callback,
|
||||
user_ptr: *mut c_void,
|
||||
) -> Result<()> {
|
||||
let _ = try_call!(ffi::cubeb_register_device_collection_changed(
|
||||
call!(ffi::cubeb_register_device_collection_changed(
|
||||
self.as_ptr(),
|
||||
devtype.bits(),
|
||||
callback,
|
||||
user_ptr
|
||||
));
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ impl<'ctx> ::std::ops::Deref for DeviceCollection<'ctx> {
|
|||
impl<'ctx> ::std::convert::AsRef<DeviceCollectionRef> for DeviceCollection<'ctx> {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &DeviceCollectionRef {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub enum ErrorCode {
|
|||
DeviceUnavailable,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct Error {
|
||||
code: ErrorCode,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ extern crate cubeb_sys;
|
|||
#[macro_use]
|
||||
mod ffi_types;
|
||||
|
||||
mod try_call;
|
||||
mod call;
|
||||
|
||||
mod builders;
|
||||
mod channel;
|
||||
|
|
|
@ -123,7 +123,7 @@ impl StreamRef {
|
|||
pub fn position(&self) -> Result<u64> {
|
||||
let mut position = 0u64;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_stream_get_position(self.as_ptr(), &mut position));
|
||||
call!(ffi::cubeb_stream_get_position(self.as_ptr(), &mut position))?;
|
||||
}
|
||||
Ok(position)
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ impl StreamRef {
|
|||
pub fn latency(&self) -> Result<u32> {
|
||||
let mut latency = 0u32;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_stream_get_latency(self.as_ptr(), &mut latency));
|
||||
call!(ffi::cubeb_stream_get_latency(self.as_ptr(), &mut latency))?;
|
||||
}
|
||||
Ok(latency)
|
||||
}
|
||||
|
@ -145,10 +145,10 @@ impl StreamRef {
|
|||
pub fn input_latency(&self) -> Result<u32> {
|
||||
let mut latency = 0u32;
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_stream_get_input_latency(
|
||||
call!(ffi::cubeb_stream_get_input_latency(
|
||||
self.as_ptr(),
|
||||
&mut latency
|
||||
));
|
||||
))?;
|
||||
}
|
||||
Ok(latency)
|
||||
}
|
||||
|
@ -167,10 +167,10 @@ impl StreamRef {
|
|||
pub fn current_device(&self) -> Result<&DeviceRef> {
|
||||
let mut device: *mut ffi::cubeb_device = ptr::null_mut();
|
||||
unsafe {
|
||||
let _ = try_call!(ffi::cubeb_stream_get_current_device(
|
||||
call!(ffi::cubeb_stream_get_current_device(
|
||||
self.as_ptr(),
|
||||
&mut device
|
||||
));
|
||||
))?;
|
||||
Ok(DeviceRef::from_ptr(device))
|
||||
}
|
||||
}
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -11,13 +11,14 @@
|
|||
|
||||
[package]
|
||||
name = "cubeb-sys"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
|
||||
build = "build.rs"
|
||||
links = "cubeb"
|
||||
description = "Native bindings to the cubeb library"
|
||||
license = "ISC"
|
||||
repository = "https://github.com/djg/cubeb-rs"
|
||||
repository = "https://github.com/mozilla/cubeb-rs"
|
||||
|
||||
[build-dependencies.cmake]
|
||||
version = "0.1.2"
|
||||
|
||||
|
@ -26,5 +27,6 @@ version = "0.3"
|
|||
|
||||
[features]
|
||||
gecko-in-tree = []
|
||||
|
||||
[badges.circle-ci]
|
||||
repository = "djg/cubeb-rs"
|
||||
repository = "mozilla/cubeb-rs"
|
||||
|
|
|
@ -46,6 +46,17 @@ fn main() {
|
|||
let android = target.contains("android");
|
||||
let mut cfg = cmake::Config::new("libcubeb");
|
||||
|
||||
if darwin {
|
||||
let cmake_osx_arch = if target.contains("aarch64") {
|
||||
// Apple Silicon
|
||||
"arm64"
|
||||
} else {
|
||||
// Assuming Intel (x86_64)
|
||||
"x86_64"
|
||||
};
|
||||
cfg.define("CMAKE_OSX_ARCHITECTURES", cmake_osx_arch);
|
||||
}
|
||||
|
||||
let _ = fs::remove_dir_all(env::var("OUT_DIR").unwrap());
|
||||
t!(fs::create_dir_all(env::var("OUT_DIR").unwrap()));
|
||||
|
||||
|
@ -84,6 +95,7 @@ fn main() {
|
|||
let _ = pkg_config::find_library("alsa");
|
||||
let _ = pkg_config::find_library("libpulse");
|
||||
let _ = pkg_config::find_library("jack");
|
||||
let _ = pkg_config::find_library("speexdsp");
|
||||
if android {
|
||||
println!("cargo:rustc-link-lib=dylib=OpenSLES");
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
You must have CMake v3.1 or later installed.
|
||||
|
||||
1. `git clone --recursive https://github.com/kinetiknz/cubeb.git`
|
||||
1. `git clone --recursive https://github.com/mozilla/cubeb.git`
|
||||
2. `mkdir cubeb-build`
|
||||
3. `cd cubeb-build`
|
||||
3. `cmake ../cubeb`
|
||||
4. `cmake --build .`
|
||||
5. `ctest`
|
||||
4. `cmake ../cubeb`
|
||||
5. `cmake --build .`
|
||||
6. `ctest`
|
||||
|
||||
# Windows build notes
|
||||
|
||||
|
@ -41,6 +41,6 @@ To build with MinGW-w64, install the following items:
|
|||
- Download and install MinGW-w64 with Win32 threads.
|
||||
- Download and install CMake.
|
||||
- Run MinGW-w64 Terminal from the Start Menu.
|
||||
- Follow the build steps at the top of this file, but at step 3 run:
|
||||
`cmake -G "MinGW Makefiles" ..`
|
||||
- Follow the build steps at the top of this file, but at step 4 run:
|
||||
`cmake -G "MinGW Makefiles" ../cubeb`
|
||||
- Continue the build steps at the top of this file.
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
See INSTALL.md for build instructions.
|
||||
|
||||
See [Backend Support](https://github.com/kinetiknz/cubeb/wiki/Backend-Support) in the wiki for the support level of each backend.
|
||||
See [Backend Support](https://github.com/mozilla/cubeb/wiki/Backend-Support) in the wiki for the support level of each backend.
|
||||
|
||||
Licensed under an ISC-style license. See LICENSE for details.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// This program is made available under an ISC-style license. See the
|
||||
// accompanying file LICENSE for details.
|
||||
|
||||
use std::os::raw::{c_char, c_int};
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
|
||||
cubeb_enum! {
|
||||
pub enum cubeb_log_level {
|
||||
|
@ -23,4 +23,7 @@ extern "C" {
|
|||
|
||||
pub static g_cubeb_log_level: cubeb_log_level;
|
||||
pub static g_cubeb_log_callback: cubeb_log_callback;
|
||||
|
||||
pub fn cubeb_async_log_reset_threads(_: c_void) -> c_void;
|
||||
pub fn cubeb_async_log(msg: *const c_char, ...) -> c_void;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.lock":"d0e184467544d2ccf8bef8d6bd0d5423e26e74c7cd002267965b10197b641988","Cargo.toml":"fd477b36c03358d1c0a94851a4a07284c688e5bcc7bc0cf0967af958b5f0910d","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","README.md":"408c573ec240927cf5b9c036098e94e374ec41f71991415422586f450586b214","examples/common/mod.rs":"3363405f3d21ad120617473a0288c337a7b15eb79f5bb1035cfd258bd9bedf2b","examples/devices.rs":"ff5dcd588e7036165c4b4c20ec355d036e0ae90cf88b3b0f5cd86621fe2ce61d","examples/tone.rs":"8f5f9851b6d99f6f16c597fcb9312e3ef81769cbfb89341d2ea2522ca2e2214e","src/context.rs":"2d29d9704af311996bf9702519ef5bb0e9d3ada032d22070db7dbb6e8987859e","src/frame.rs":"649cedaa2e9e1c5d2c3146bd0d66fd28bb230e68142493a9ea7dbab4a15f5adc","src/lib.rs":"c86f594be459cbef72b05d60f4124d0844ba13d5d07fbe11b3d7438cd52a5a5e","src/log.rs":"704faeb31934dad6bc6d02e01caa85118754209bd559d30d03fcfa5cb8c1603c","src/sample.rs":"0d4645cc1d6ac26f198f6f59a44e193422e5646ecef0de46224653bef79d1a10","src/stream.rs":"32c4169de7b6f5d5c5016c1cb6c70fbb20bc9155979630b1fc4c57636950dfe6"},"package":"d47c8cc00b8034e996d7dd262956a0d904c1e1d0d521d22c99801420b38484bd"}
|
||||
{"files":{"Cargo.lock":"b5619b3fbd40526e5ca797cc26134375b4fe94b476428f34aed791ffe9f07ee2","Cargo.toml":"42c32a8a24c2ed9c317ee83c73597080c029f1084d9a7924cc3f37d498c16056","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","README.md":"408c573ec240927cf5b9c036098e94e374ec41f71991415422586f450586b214","examples/common/mod.rs":"3363405f3d21ad120617473a0288c337a7b15eb79f5bb1035cfd258bd9bedf2b","examples/devices.rs":"ff5dcd588e7036165c4b4c20ec355d036e0ae90cf88b3b0f5cd86621fe2ce61d","examples/tone.rs":"8f5f9851b6d99f6f16c597fcb9312e3ef81769cbfb89341d2ea2522ca2e2214e","src/context.rs":"2d29d9704af311996bf9702519ef5bb0e9d3ada032d22070db7dbb6e8987859e","src/frame.rs":"649cedaa2e9e1c5d2c3146bd0d66fd28bb230e68142493a9ea7dbab4a15f5adc","src/lib.rs":"c86f594be459cbef72b05d60f4124d0844ba13d5d07fbe11b3d7438cd52a5a5e","src/log.rs":"704faeb31934dad6bc6d02e01caa85118754209bd559d30d03fcfa5cb8c1603c","src/sample.rs":"0d4645cc1d6ac26f198f6f59a44e193422e5646ecef0de46224653bef79d1a10","src/stream.rs":"32c4169de7b6f5d5c5016c1cb6c70fbb20bc9155979630b1fc4c57636950dfe6"},"package":"53051f86ed8cf5a6771704e80147266f32bdf05cc09089da304484a1c612bb97"}
|
|
@ -25,16 +25,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cubeb"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
dependencies = [
|
||||
"cubeb-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cubeb-core"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04aabcd7fa088330b5f25b2f92cd1c2d80d0232e114e5bdaa682bb65103d57d9"
|
||||
checksum = "48c0ac573dc2e393c12e4b829d6e17bbb7a1f95b288043ee47ef251097ddb094"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cubeb-sys",
|
||||
|
@ -42,9 +42,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cubeb-sys"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da8f61339785526e9488f4902ef09d83483fa7fc2c6f6f6f80bb8ae04af03818"
|
||||
checksum = "33b49428acff552b1ba790649ea16a6f3d60cf74e9457a1378771a1acc12d5ee"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"pkg-config",
|
||||
|
@ -52,6 +52,6 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.24"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||
|
|
|
@ -11,19 +11,23 @@
|
|||
|
||||
[package]
|
||||
name = "cubeb"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
|
||||
description = "Bindings to libcubeb for interacting with system audio from rust.\n"
|
||||
homepage = "https://github.com/djg/cubeb-rs"
|
||||
description = """
|
||||
Bindings to libcubeb for interacting with system audio from rust.
|
||||
"""
|
||||
homepage = "https://github.com/mozilla/cubeb-rs"
|
||||
readme = "README.md"
|
||||
keywords = ["cubeb"]
|
||||
categories = ["api-bindings"]
|
||||
license = "ISC"
|
||||
repository = "https://github.com/djg/cubeb-rs"
|
||||
repository = "https://github.com/mozilla/cubeb-rs"
|
||||
|
||||
[dependencies.cubeb-core]
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
|
||||
[features]
|
||||
gecko-in-tree = ["cubeb-core/gecko-in-tree"]
|
||||
|
||||
[badges.circle-ci]
|
||||
repository = "djg/cubeb-rs"
|
||||
repository = "mozilla/cubeb-rs"
|
||||
|
|
|
@ -24,7 +24,7 @@ mozurl = { path = "../../../../netwerk/base/mozurl" }
|
|||
webrender_bindings = { path = "../../../../gfx/webrender_bindings" }
|
||||
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "44eca95823bb57e964cf7b6d9791ed2ccb4b2108", optional = true }
|
||||
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="1f1fe1e08e01a9a534ec7f079702a583a0899ce7", optional = true, features=["pulse-dlopen"] }
|
||||
cubeb-sys = { version = "0.10", optional = true, features=["gecko-in-tree"] }
|
||||
cubeb-sys = { version = "0.10.1", optional = true, features=["gecko-in-tree"] }
|
||||
audioipc2-client = { git = "https://github.com/kinetiknz/audioipc-2", rev = "ea7cabf8c9dc051a52ffb6cd7d2564b29b7428eb", optional = true } # macos (v2) branch
|
||||
audioipc2-server = { git = "https://github.com/kinetiknz/audioipc-2", rev = "ea7cabf8c9dc051a52ffb6cd7d2564b29b7428eb", optional = true } # macos (v2) branch
|
||||
audioipc-client = { git = "https://github.com/mozilla/audioipc", rev = "fb7a2b12ced3b43e6a268621989c6191d1ed7e39", optional = true }
|
||||
|
|
Загрузка…
Ссылка в новой задаче