Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cubeb-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ circle-ci = { repository = "mozilla/cubeb-rs" }
gecko-in-tree = ["cubeb-sys/gecko-in-tree"]

[dependencies]
bitflags = "1.2.0"
bitflags = "2.9.1"
cubeb-sys = { path = "../cubeb-sys", version = "0.29" }

[build-dependencies]
Expand Down
1 change: 1 addition & 0 deletions cubeb-core/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ffi;

bitflags! {
/// Some common layout definitions
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ChannelLayout: ffi::cubeb_channel_layout {
const FRONT_LEFT = ffi::CHANNEL_FRONT_LEFT;
const FRONT_RIGHT = ffi::CHANNEL_FRONT_RIGHT;
Expand Down
17 changes: 14 additions & 3 deletions cubeb-core/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub enum DeviceState {

bitflags! {
/// Architecture specific sample type.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct DeviceFormat: ffi::cubeb_device_fmt {
const S16LE = ffi::CUBEB_DEVICE_FMT_S16LE;
const S16BE = ffi::CUBEB_DEVICE_FMT_S16BE;
Expand All @@ -32,11 +33,12 @@ bitflags! {
/// Channel type for a `cubeb_stream`. Depending on the backend and platform
/// used, this can control inter-stream interruption, ducking, and volume
/// control.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct DevicePref: ffi::cubeb_device_pref {
const MULTIMEDIA = ffi::CUBEB_DEVICE_PREF_MULTIMEDIA;
const VOICE = ffi::CUBEB_DEVICE_PREF_VOICE;
const NOTIFICATION = ffi::CUBEB_DEVICE_PREF_NOTIFICATION;
const ALL = ffi::CUBEB_DEVICE_PREF_ALL;
const _ = 0x08;
}
}

Expand All @@ -47,6 +49,7 @@ impl DevicePref {
bitflags! {
/// Whether a particular device is an input device (e.g. a microphone), or an
/// output device (e.g. headphones).
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct DeviceType: ffi::cubeb_device_type {
const INPUT = ffi::CUBEB_DEVICE_TYPE_INPUT as _;
const OUTPUT = ffi::CUBEB_DEVICE_TYPE_OUTPUT as _;
Expand Down Expand Up @@ -226,8 +229,8 @@ impl DeviceInfoRef {

#[cfg(test)]
mod tests {
use ffi::cubeb_device;
use Device;
use ffi::{cubeb_device, CUBEB_DEVICE_PREF_ALL};
use {Device, DevicePref};

#[test]
fn device_device_ref_same_ptr() {
Expand All @@ -236,4 +239,12 @@ mod tests {
assert_eq!(device.as_ptr(), ptr);
assert_eq!(device.as_ptr(), device.as_ref().as_ptr());
}

#[test]
fn device_pref_all_same_as_the_constant() {
assert_eq!(
DevicePref::all(),
DevicePref::from_bits_retain(CUBEB_DEVICE_PREF_ALL)
);
}
}
2 changes: 2 additions & 0 deletions cubeb-core/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl From<State> for ffi::cubeb_state {

bitflags! {
/// Miscellaneous stream preferences.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct StreamPrefs: ffi::cubeb_stream_prefs {
const LOOPBACK = ffi::CUBEB_STREAM_PREF_LOOPBACK;
const DISABLE_DEVICE_SWITCHING = ffi::CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING;
Expand All @@ -61,6 +62,7 @@ impl StreamPrefs {

bitflags! {
/// Input stream processing parameters.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct InputProcessingParams: ffi::cubeb_input_processing_params {
const ECHO_CANCELLATION = ffi::CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION;
const NOISE_SUPPRESSION = ffi::CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION;
Expand Down