pub struct MicrophoneDevice {
pub id: String,
pub label: String,
pub is_default: bool,
pub channels: u8,
pub sample_rate_hz: u32,
pub native_id: String,
}Expand description
One attached microphone with a stable ID, a human-readable label, a default-device flag, and the native channel + sample-rate hint reported by GStreamer.
id is derived from the device label via FNV-1a hashing so the
same mic produces the same ID across reboots even when the OS’s
underlying device-id string is non-stable (macOS AVFoundation has
a history of doing this). Matches crate::camera::stable_id_for.
Fields§
§id: StringStable identifier — used by M-MIC.2’s “last-used mic”
persistence and by M-MIC.1’s start_mic_capture(mic_id) IPC.
label: StringHuman-readable label (e.g. "MacBook Pro Microphone",
"Shure MV7", "AirPods Pro").
is_default: booltrue when GStreamer flagged this device as the OS-level
default. Falls back to “first device in the enumeration”
when no device carries the is-default = true property.
channels: u8Native channel count from the first reported caps line
(1 = mono, 2 = stereo). 0 means the parser couldn’t extract
the value — downstream capture defaults to 2.
sample_rate_hz: u32Native sample rate in Hz (typically 48000 or 44100).
0 means the parser couldn’t extract the value — downstream
capture defaults to 48000. GStreamer’s audioresample will
convert as needed for the encoder.
native_id: StringPlatform-native device identifier from gst’s unique-id
property — what the OS-specific gst element actually wants
to select the device (M-MIC.3 / AUT-284):
- macOS
osxaudiosrc device-uid=…— e.g."AppleUSBAudioEngine:Insta360:Insta360 Link:100000:3". - Linux
pulsesrc device=…— e.g."alsa_input.pci-0000_00_1f.3.analog-stereo". - Windows
wasapisrc device=…— a{GUID}string.
Empty when the device didn’t expose a unique-id (some
gst plugin / OS combinations) — callers fall back to
autoaudiosrc (OS default) in that case.
Trait Implementations§
Source§impl Clone for MicrophoneDevice
impl Clone for MicrophoneDevice
Source§fn clone(&self) -> MicrophoneDevice
fn clone(&self) -> MicrophoneDevice
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MicrophoneDevice
impl Debug for MicrophoneDevice
Source§impl<'de> Deserialize<'de> for MicrophoneDevice
impl<'de> Deserialize<'de> for MicrophoneDevice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for MicrophoneDevice
impl Hash for MicrophoneDevice
Source§impl PartialEq for MicrophoneDevice
impl PartialEq for MicrophoneDevice
Source§fn eq(&self, other: &MicrophoneDevice) -> bool
fn eq(&self, other: &MicrophoneDevice) -> bool
self and other values to be equal, and is used by ==.