#[non_exhaustive]pub enum AudioSource {
Read(PathBuf),
Download(Uri, Option<Txt>),
Data(AudioHash, IpcBytes, AudioDataFormat),
Audio(AudioVar),
}Expand description
The different sources of an audio resource.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Read(PathBuf)
A path to an audio file in the file system.
Audio equality is defined by the path, a copy of the audio in another path is a different audio.
Download(Uri, Option<Txt>)
A uri to an audio resource downloaded using HTTP GET with an optional HTTP ACCEPT string.
If the ACCEPT line is not given, all audio formats supported by the view-process backend are accepted.
Audio equality is defined by the URI and ACCEPT string.
Data(AudioHash, IpcBytes, AudioDataFormat)
Shared reference to bytes for an encoded or decoded audio.
Audio equality is defined by the hash, it is usually the hash of the bytes but it does not need to be.
Inside AUDIOS the reference to the bytes is held only until the audio finishes decoding.
Audio(AudioVar)
Already resolved (loaded or loading) audio.
The audio is passed-through, not cached.
Implementations§
Source§impl AudioSource
impl AudioSource
Sourcepub fn from_data(data: IpcBytes, format: AudioDataFormat) -> Self
pub fn from_data(data: IpcBytes, format: AudioDataFormat) -> Self
New source from data.
Sourcepub fn hash128(&self, options: &AudioOptions) -> Option<AudioHash>
pub fn hash128(&self, options: &AudioOptions) -> Option<AudioHash>
Returns the audio hash, unless the source is AudioTrack.
Sourcepub fn hash128_data(data_hash: AudioHash, options: &AudioOptions) -> AudioHash
pub fn hash128_data(data_hash: AudioHash, options: &AudioOptions) -> AudioHash
Compute hash for a borrowed Data audio.
Sourcepub fn hash128_read(path: &Path, options: &AudioOptions) -> AudioHash
pub fn hash128_read(path: &Path, options: &AudioOptions) -> AudioHash
Compute hash for a borrowed Read path.
Sourcepub fn hash128_download(
uri: &Uri,
accept: &Option<Txt>,
options: &AudioOptions,
) -> AudioHash
pub fn hash128_download( uri: &Uri, accept: &Option<Txt>, options: &AudioOptions, ) -> AudioHash
Compute hash for a borrowed Download URI and HTTP-ACCEPT.
Trait Implementations§
Source§impl Clone for AudioSource
impl Clone for AudioSource
Source§fn clone(&self) -> AudioSource
fn clone(&self) -> AudioSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudioSource
impl Debug for AudioSource
Source§impl From<&[u8]> for AudioSource
impl From<&[u8]> for AudioSource
Source§impl From<&Path> for AudioSource
impl From<&Path> for AudioSource
Source§impl From<&str> for AudioSource
impl From<&str> for AudioSource
Source§impl<F: Into<AudioDataFormat>> From<(&[u8], F)> for AudioSource
impl<F: Into<AudioDataFormat>> From<(&[u8], F)> for AudioSource
Source§impl<F: Into<AudioDataFormat>, const N: usize> From<(&[u8; N], F)> for AudioSource
impl<F: Into<AudioDataFormat>, const N: usize> From<(&[u8; N], F)> for AudioSource
Source§impl<F: Into<AudioDataFormat>> From<(IpcBytes, F)> for AudioSource
impl<F: Into<AudioDataFormat>> From<(IpcBytes, F)> for AudioSource
Source§impl From<(Uri, &'static str)> for AudioSource
impl From<(Uri, &'static str)> for AudioSource
Source§impl<F: Into<AudioDataFormat>> From<(Vec<u8>, F)> for AudioSource
impl<F: Into<AudioDataFormat>> From<(Vec<u8>, F)> for AudioSource
Source§impl From<IpcBytes> for AudioSource
impl From<IpcBytes> for AudioSource
Source§impl From<PathBuf> for AudioSource
impl From<PathBuf> for AudioSource
Source§impl From<String> for AudioSource
impl From<String> for AudioSource
Source§impl From<Uri> for AudioSource
impl From<Uri> for AudioSource
Source§impl From<Var<AudioTrack>> for AudioSource
impl From<Var<AudioTrack>> for AudioSource
Source§impl IntoVar<AudioSource> for &[u8]
impl IntoVar<AudioSource> for &[u8]
Source§impl IntoVar<AudioSource> for &Path
impl IntoVar<AudioSource> for &Path
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for &str
impl IntoVar<AudioSource> for &str
Source§impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (&[u8], F)
impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (&[u8], F)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl<F: Into<AudioDataFormat>, const N: usize> IntoVar<AudioSource> for (&[u8; N], F)
impl<F: Into<AudioDataFormat>, const N: usize> IntoVar<AudioSource> for (&[u8; N], F)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (IpcBytes, F)
impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (IpcBytes, F)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl IntoVar<AudioSource> for (Uri, &'static str)
impl IntoVar<AudioSource> for (Uri, &'static str)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From (URI, HTTP-ACCEPT).
Source§impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (Vec<u8>, F)
impl<F: Into<AudioDataFormat>> IntoVar<AudioSource> for (Vec<u8>, F)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl IntoVar<AudioSource> for IpcBytes
impl IntoVar<AudioSource> for IpcBytes
Source§impl IntoVar<AudioSource> for PathBuf
impl IntoVar<AudioSource> for PathBuf
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for String
impl IntoVar<AudioSource> for String
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
Same as conversion from &str.
Source§impl IntoVar<AudioSource> for Txt
impl IntoVar<AudioSource> for Txt
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
Same as conversion from &str.
Source§impl IntoVar<AudioSource> for Uri
impl IntoVar<AudioSource> for Uri
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for AudioVar
impl IntoVar<AudioSource> for AudioVar
fn into_var(self) -> Var<AudioSource>
Source§impl PartialEq for AudioSource
impl PartialEq for AudioSource
impl IntoValue<AudioSource> for &[u8]
impl<const N: usize> IntoValue<AudioSource> for &[u8; N]
impl IntoValue<AudioSource> for &Path
impl IntoValue<AudioSource> for &str
impl<F: Into<AudioDataFormat>> IntoValue<AudioSource> for (&[u8], F)
impl<F: Into<AudioDataFormat>, const N: usize> IntoValue<AudioSource> for (&[u8; N], F)
impl<F: Into<AudioDataFormat>> IntoValue<AudioSource> for (IpcBytes, F)
impl IntoValue<AudioSource> for (Uri, &'static str)
impl<F: Into<AudioDataFormat>> IntoValue<AudioSource> for (Vec<u8>, F)
impl IntoValue<AudioSource> for IpcBytes
impl IntoValue<AudioSource> for PathBuf
impl IntoValue<AudioSource> for String
impl IntoValue<AudioSource> for Txt
impl IntoValue<AudioSource> for Uri
impl IntoValue<AudioSource> for AudioVar
impl IntoValue<AudioSource> for Vec<u8>
Auto Trait Implementations§
impl !Freeze for AudioSource
impl !RefUnwindSafe for AudioSource
impl Send for AudioSource
impl Sync for AudioSource
impl !Unpin for AudioSource
impl !UnwindSafe for AudioSource
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more