Improve handling of the DefaultFormatError
This commit is contained in:
parent
fbb97f51ef
commit
f0e4e312c1
4 changed files with 41 additions and 18 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -347,6 +347,12 @@ pub enum DefaultFormatError {
|
|||
/// Returned if e.g. the default input format was requested on an output-only audio device.
|
||||
#[fail(display = "The requested stream type is not supported by the device.")]
|
||||
StreamTypeNotSupported,
|
||||
/// See the `BackendSpecificError` docs for more information about this error variant.
|
||||
#[fail(display = "{}", err)]
|
||||
BackendSpecific {
|
||||
#[fail(cause)]
|
||||
err: BackendSpecificError,
|
||||
}
|
||||
}
|
||||
|
||||
/// Error that can happen when creating a `Stream`.
|
||||
|
|
@ -765,6 +771,12 @@ impl From<BackendSpecificError> for SupportedFormatsError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<BackendSpecificError> for DefaultFormatError {
|
||||
fn from(err: BackendSpecificError) -> Self {
|
||||
DefaultFormatError::BackendSpecific { err }
|
||||
}
|
||||
}
|
||||
|
||||
// If a backend does not provide an API for retrieving supported formats, we query it with a bunch
|
||||
// of commonly used rates. This is always the case for wasapi and is sometimes the case for alsa.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue