#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::audio_common::OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
use crate::audio_device_base::{
OH_AudioDeviceDescriptor, OH_AudioDevice_ChangeType, OH_AudioDevice_Usage,
};
#[cfg(feature = "api-20")]
use crate::audio_device_base::{OH_AudioDeviceDescriptorArray, OH_AudioDevice_Type};
#[cfg(feature = "api-20")]
use crate::audiostream_base::OH_AudioStream_DeviceChangeReason;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
pub struct OH_AudioSessionManager {
_unused: [u8; 0],
}
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl OH_AudioSession_ConcurrencyMode {
pub const CONCURRENCY_DEFAULT: OH_AudioSession_ConcurrencyMode =
OH_AudioSession_ConcurrencyMode(0);
pub const CONCURRENCY_MIX_WITH_OTHERS: OH_AudioSession_ConcurrencyMode =
OH_AudioSession_ConcurrencyMode(1);
pub const CONCURRENCY_DUCK_OTHERS: OH_AudioSession_ConcurrencyMode =
OH_AudioSession_ConcurrencyMode(2);
pub const CONCURRENCY_PAUSE_OTHERS: OH_AudioSession_ConcurrencyMode =
OH_AudioSession_ConcurrencyMode(3);
}
#[repr(transparent)]
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_ConcurrencyMode(pub ::core::ffi::c_uint);
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl OH_AudioSession_Scene {
pub const AUDIO_SESSION_SCENE_MEDIA: OH_AudioSession_Scene = OH_AudioSession_Scene(0);
pub const AUDIO_SESSION_SCENE_GAME: OH_AudioSession_Scene = OH_AudioSession_Scene(1);
pub const AUDIO_SESSION_SCENE_VOICE_COMMUNICATION: OH_AudioSession_Scene =
OH_AudioSession_Scene(2);
}
#[repr(transparent)]
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_Scene(pub ::core::ffi::c_uint);
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl OH_AudioSession_StateChangeHint {
pub const AUDIO_SESSION_STATE_CHANGE_HINT_RESUME: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(0);
pub const AUDIO_SESSION_STATE_CHANGE_HINT_PAUSE: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(1);
pub const AUDIO_SESSION_STATE_CHANGE_HINT_STOP: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(2);
pub const AUDIO_SESSION_STATE_CHANGE_HINT_TIME_OUT_STOP: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(3);
pub const AUDIO_SESSION_STATE_CHANGE_HINT_DUCK: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(4);
pub const AUDIO_SESSION_STATE_CHANGE_HINT_UNDUCK: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(5);
#[cfg(feature = "api-23")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
pub const AUDIO_SESSION_STATE_CHANGE_HINT_MUTE_SUGGESTION: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(6);
#[cfg(feature = "api-23")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
pub const AUDIO_SESSION_STATE_CHANGE_HINT_UNMUTE_SUGGESTION: OH_AudioSession_StateChangeHint =
OH_AudioSession_StateChangeHint(7);
}
#[repr(transparent)]
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_StateChangeHint(pub ::core::ffi::c_uint);
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl OH_AudioSession_OutputDeviceChangeRecommendedAction {
pub const DEVICE_CHANGE_RECOMMEND_TO_CONTINUE:
OH_AudioSession_OutputDeviceChangeRecommendedAction =
OH_AudioSession_OutputDeviceChangeRecommendedAction(0);
pub const DEVICE_CHANGE_RECOMMEND_TO_STOP: OH_AudioSession_OutputDeviceChangeRecommendedAction =
OH_AudioSession_OutputDeviceChangeRecommendedAction(1);
}
#[repr(transparent)]
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_OutputDeviceChangeRecommendedAction(pub ::core::ffi::c_uint);
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl OH_AudioSession_DeactivatedReason {
pub const DEACTIVATED_LOWER_PRIORITY: OH_AudioSession_DeactivatedReason =
OH_AudioSession_DeactivatedReason(0);
pub const DEACTIVATED_TIMEOUT: OH_AudioSession_DeactivatedReason =
OH_AudioSession_DeactivatedReason(1);
}
#[repr(transparent)]
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_DeactivatedReason(pub ::core::ffi::c_uint);
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
impl OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory {
pub const PREFERRED_NONE: OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory =
OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory(0);
pub const PREFERRED_DEFAULT: OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory =
OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory(1);
pub const PREFERRED_LOW_LATENCY: OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory =
OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory(2);
pub const PREFERRED_HIGH_QUALITY: OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory =
OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory(3);
}
#[repr(transparent)]
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory(pub ::core::ffi::c_uint);
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OH_AudioSession_Strategy {
pub concurrencyMode: OH_AudioSession_ConcurrencyMode,
}
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OH_AudioSession_DeactivatedEvent {
pub reason: OH_AudioSession_DeactivatedReason,
}
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OH_AudioSession_StateChangedEvent {
pub stateChangeHint: OH_AudioSession_StateChangeHint,
}
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioSession_StateChangedCallback =
::core::option::Option<unsafe extern "C" fn(event: OH_AudioSession_StateChangedEvent)>;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub type OH_AudioSession_AvailableDeviceChangedCallback = ::core::option::Option<
unsafe extern "C" fn(
type_: OH_AudioDevice_ChangeType,
audioDeviceDescriptorArray: *mut OH_AudioDeviceDescriptorArray,
),
>;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub type OH_AudioSession_CurrentInputDeviceChangedCallback = ::core::option::Option<
unsafe extern "C" fn(
devices: *mut OH_AudioDeviceDescriptorArray,
changeReason: OH_AudioStream_DeviceChangeReason,
),
>;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioSession_CurrentOutputDeviceChangedCallback = ::core::option::Option<
unsafe extern "C" fn(
devices: *mut OH_AudioDeviceDescriptorArray,
changeReason: OH_AudioStream_DeviceChangeReason,
recommendedAction: OH_AudioSession_OutputDeviceChangeRecommendedAction,
),
>;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub type OH_AudioSession_DeactivatedCallback =
::core::option::Option<unsafe extern "C" fn(event: OH_AudioSession_DeactivatedEvent) -> i32>;
extern "C" {
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioManager_GetAudioSessionManager(
audioSessionManager: *mut *mut OH_AudioSessionManager,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioSessionManager_ActivateAudioSession(
audioSessionManager: *mut OH_AudioSessionManager,
strategy: *const OH_AudioSession_Strategy,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioSessionManager_DeactivateAudioSession(
audioSessionManager: *mut OH_AudioSessionManager,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioSessionManager_IsAudioSessionActivated(
audioSessionManager: *mut OH_AudioSessionManager,
) -> bool;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioSessionManager_RegisterSessionDeactivatedCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_DeactivatedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_AudioSessionManager_UnregisterSessionDeactivatedCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_DeactivatedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_SetScene(
audioSessionManager: *mut OH_AudioSessionManager,
scene: OH_AudioSession_Scene,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_RegisterStateChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_StateChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_UnregisterStateChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_StateChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_SetDefaultOutputDevice(
audioSessionManager: *mut OH_AudioSessionManager,
deviceType: OH_AudioDevice_Type,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_GetDefaultOutputDevice(
audioSessionManager: *mut OH_AudioSessionManager,
deviceType: *mut OH_AudioDevice_Type,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_ReleaseDevices(
audioSessionManager: *mut OH_AudioSessionManager,
audioDeviceDescriptorArray: *mut OH_AudioDeviceDescriptorArray,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_RegisterCurrentOutputDeviceChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_CurrentOutputDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AudioSessionManager_UnregisterCurrentOutputDeviceChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_CurrentOutputDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_GetAvailableDevices(
audioSessionManager: *mut OH_AudioSessionManager,
deviceUsage: OH_AudioDevice_Usage,
audioDeviceDescriptorArray: *mut *mut OH_AudioDeviceDescriptorArray,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_RegisterAvailableDevicesChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
deviceUsage: OH_AudioDevice_Usage,
callback: OH_AudioSession_AvailableDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_UnregisterAvailableDevicesChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_AvailableDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_SelectMediaInputDevice(
audioSessionManager: *mut OH_AudioSessionManager,
deviceDescriptor: *mut OH_AudioDeviceDescriptor,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_GetSelectedMediaInputDevice(
audioSessionManager: *mut OH_AudioSessionManager,
audioDeviceDescriptor: *mut *mut OH_AudioDeviceDescriptor,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_SetBluetoothAndNearlinkPreferredRecordCategory(
audioSessionManager: *mut OH_AudioSessionManager,
category: OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_GetBluetoothAndNearlinkPreferredRecordCategory(
audioSessionManager: *mut OH_AudioSessionManager,
category: *mut OH_AudioSession_BluetoothAndNearlinkPreferredRecordCategory,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_RegisterCurrentInputDeviceChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_CurrentInputDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_UnregisterCurrentInputDeviceChangeCallback(
audioSessionManager: *mut OH_AudioSessionManager,
callback: OH_AudioSession_CurrentInputDeviceChangedCallback,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_AudioSessionManager_ReleaseDevice(
audioSessionManager: *mut OH_AudioSessionManager,
audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-23")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
pub fn OH_AudioSessionManager_EnableMuteSuggestionWhenMixWithOthers(
audioSessionManager: *mut OH_AudioSessionManager,
enable: bool,
) -> OH_AudioCommon_Result;
#[cfg(feature = "api-23")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
pub fn OH_AudioSessionManager_IsOtherMediaPlaying(
audioSessionManager: *mut OH_AudioSessionManager,
) -> bool;
}