Add new DeviceNameError type

The coreaudio and wasapi backends may both potentially fail to produce
the name associated with a device. This changes the API to allow for
returning the errors in these cases.
This commit is contained in:
mitchmindtree 2019-06-21 00:53:11 +02:00
parent 78a7cb9e79
commit 105086a108
6 changed files with 54 additions and 19 deletions

View file

@ -7,6 +7,7 @@ use ChannelCount;
use BackendSpecificError;
use BuildStreamError;
use DefaultFormatError;
use DeviceNameError;
use Format;
use SupportedFormatsError;
use SampleFormat;
@ -74,8 +75,8 @@ pub struct Device(String);
impl Device {
#[inline]
pub fn name(&self) -> String {
self.0.clone()
pub fn name(&self) -> Result<String, DeviceNameError> {
Ok(self.0.clone())
}
unsafe fn supported_formats(