cef_audio_handler_t

Type Alias cef_audio_handler_t 

Source
pub type cef_audio_handler_t = _cef_audio_handler_t;
Expand description

Implement this structure to handle audio events.

NOTE: This struct is allocated client-side.

Aliased Type§

#[repr(C)]
pub struct cef_audio_handler_t { pub base: _cef_base_ref_counted_t, pub get_audio_parameters: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *mut _cef_audio_parameters_t) -> i32>, pub on_audio_stream_started: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *const _cef_audio_parameters_t, i32)>, pub on_audio_stream_packet: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *mut *const f32, i32, i64)>, pub on_audio_stream_stopped: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t)>, pub on_audio_stream_error: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *const _cef_string_utf16_t)>, }

Fields§

§base: _cef_base_ref_counted_t

Base structure.

§get_audio_parameters: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *mut _cef_audio_parameters_t) -> i32>

Called on the UI thread to allow configuration of audio stream parameters. Return true (1) to proceed with audio stream capture, or false (0) to cancel it. All members of |params| can optionally be configured here, but they are also pre-filled with some sensible defaults.

§on_audio_stream_started: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *const _cef_audio_parameters_t, i32)>

Called on a browser audio capture thread when the browser starts streaming audio. OnAudioStreamStopped will always be called after OnAudioStreamStarted; both functions may be called multiple times for the same browser. |params| contains the audio parameters like sample rate and channel layout. |channels| is the number of channels.

§on_audio_stream_packet: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *mut *const f32, i32, i64)>

Called on the audio stream thread when a PCM packet is received for the stream. |data| is an array representing the raw PCM data as a floating point type, i.e. 4-byte value(s). |frames| is the number of frames in the PCM packet. |pts| is the presentation timestamp (in milliseconds since the Unix Epoch) and represents the time at which the decompressed packet should be presented to the user. Based on |frames| and the |channel_layout| value passed to OnAudioStreamStarted you can calculate the size of the |data| array in bytes.

§on_audio_stream_stopped: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t)>

Called on the UI thread when the stream has stopped. OnAudioSteamStopped will always be called after OnAudioStreamStarted; both functions may be called multiple times for the same stream.

§on_audio_stream_error: Option<unsafe extern "C" fn(*mut _cef_audio_handler_t, *mut _cef_browser_t, *const _cef_string_utf16_t)>

Called on the UI or audio stream thread when an error occurred. During the stream creation phase this callback will be called on the UI thread while in the capturing phase it will be called on the audio stream thread. The stream will be stopped immediately.