AudiosExtension

Trait AudiosExtension 

Source
pub trait AudiosExtension:
    Send
    + Sync
    + Any {
    // Provided methods
    fn audio(
        &mut self,
        limits: &AudioLimits,
        source: &mut AudioSource,
        options: &mut AudioOptions,
    ) { ... }
    fn audio_data(
        &mut self,
        max_decoded_len: ByteLength,
        key: &AudioHash,
        data: &IpcBytes,
        format: &AudioDataFormat,
        options: &AudioOptions,
    ) -> Option<AudioVar> { ... }
    fn remove(&mut self, key: &mut AudioHash, purge: &mut bool) -> bool { ... }
    fn clear(&mut self, purge: bool) { ... }
    fn available_formats(&self, formats: &mut Vec<AudioFormat>) { ... }
}
Expand description

A custom extension for the AUDIOS service.

Extensions can intercept and modify requests.

Provided Methods§

Source

fn audio( &mut self, limits: &AudioLimits, source: &mut AudioSource, options: &mut AudioOptions, )

Modify a AUDIOS.audio request.

Note that all other request methods are shorthand helpers so this will be called for every request.

Note that the AUDIOS service can be used in extensions and AudioSource::Audio is returned directly by the service. This can be used to fully replace a request here.

Source

fn audio_data( &mut self, max_decoded_len: ByteLength, key: &AudioHash, data: &IpcBytes, format: &AudioDataFormat, options: &AudioOptions, ) -> Option<AudioVar>

Audio data loaded.

This is called for AudioSource::Read, AudioSource::Download and AudioSource::Data after the data is loaded and before decoding starts.

Return a replacement variable to skip decoding or redirect to a different audio. Note that by the time this is called the service has already returned a variable in loading state, that variable will be cached according to mode. The replacement variable is bound to the return variable and lives as long as it does.

Note that the AUDIOS service can be used in extensions.

Source

fn remove(&mut self, key: &mut AudioHash, purge: &mut bool) -> bool

Modify a AUDIOS.clean or AUDIOS.purge request.

Return false to cancel the removal.

Source

fn clear(&mut self, purge: bool)

Called on AUDIOS.clean_all and AUDIOS.purge_all.

These operations cannot be intercepted, the service cache will be cleaned after this call.

Source

fn available_formats(&self, formats: &mut Vec<AudioFormat>)

Add or remove formats this extension affects.

The formats value starts with all formats implemented by the current view-process and will be returned by AUDIOS.available_formats after all proxies edit it.

Implementors§