1# audio_types.h 2 3 4## **概述** 5 6Audio模块接口定义中使用的自定义数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 7 8**Since:** 9 101.0 11 12**Version:** 13 141.0 15 16**相关模块:** 17 18[Audio](_audio.md) 19 20 21## **汇总** 22 23 24### 类 25 26 | 名称 | 描述 | 27| -------- | -------- | 28| [AudioPort](_audio_port.md) | 音频端口 | 29| [AudioAdapterDescriptor](_audio_adapter_descriptor.md) | 音频适配器描述符 | 30| [AudioDeviceDescriptor](_audio_device_descriptor.md) | 音频设备描述符 | 31| [AudioSceneDescriptor](_audio_scene_descriptor.md) | 音频场景描述符 | 32| [AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) | 音频场景描述 | 33| [AudioSampleAttributes](_audio_sample_attributes.md) | 音频采样属性 | 34| [AudioTimeStamp](_audio_time_stamp.md) | 音频时间戳 | 35| [AudioSubPortCapability](_audio_sub_port_capability.md) | 音频子端口的支持能力 | 36| [AudioPortCapability](_audio_port_capability.md) | 音频端口的支持能力 | 37| [AudioMmapBufferDescriptor](_audio_mmap_buffer_descriptor.md) | mmap缓冲区描述符 | 38| [AudioDevExtInfo](_audio_dev_ext_info.md) | 音频设备拓展信息. | 39| [AudioMixExtInfo](_audio_mix_ext_info.md) | 音轨拓展信息 | 40| [AudioSessionExtInfo](_audio_session_ext_info.md) | 会话拓展信息 | 41| [AudioRouteNode](_audio_route_node.md) | 音频路由节点. | 42| [AudioRoute](_audio_route.md) | 音频路由信息. | 43 44 45### 类型定义 46 47 | 名称 | 描述 | 48| -------- | -------- | 49| AudioHandle | 音频句柄 | 50| ([RenderCallback](_audio.md#rendercallback)) (enum AudioCallbackType, void \*reserved, void \*cookie) | 回调函数指针 | 51 52 53### 枚举 54 55 | 名称 | 描述 | 56| -------- | -------- | 57| [AudioPortDirection](_audio.md#audioportdirection) { PORT_OUT = 0x1u, PORT_IN = 0x2u, PORT_OUT_IN = 0x3u } | 音频端口的类型 | 58| [AudioPortPin](_audio.md#audioportpin) { PIN_NONE = 0x0u, PIN_OUT_SPEAKER = 0x1u, PIN_OUT_HEADSET = 0x2u, PIN_OUT_LINEOUT = 0x4u, PIN_OUT_HDMI = 0x8u, PIN_OUT_USB = 0x10u, PIN_OUT_USB_EXT = 0x20u, PIN_IN_MIC = 0x8000001u, PIN_IN_HS_MIC = 0x8000002u, PIN_IN_LINEIN = 0x8000004u, PIN_IN_USB_EXT = 0x8000008u } | 音频适配器端口的PIN脚 | 59| [AudioCategory](_audio.md#audiocategory) { AUDIO_IN_MEDIA = 0, AUDIO_IN_COMMUNICATION, AUDIO_IN_RINGTONE, AUDIO_IN_CALL } | 音频类型(category) | 60| [AudioFormat](_audio.md#audioformat){ AUDIO_FORMAT_PCM_8_BIT = 0x1u, AUDIO_FORMAT_PCM_16_BIT = 0x2u, AUDIO_FORMAT_PCM_24_BIT = 0x3u, AUDIO_FORMAT_PCM_32_BIT = 0x4u, AUDIO_FORMAT_AAC_MAIN = 0x1000001u, AUDIO_FORMAT_AAC_LC = 0x1000002u, AUDIO_FORMAT_AAC_LD = 0x1000003u, AUDIO_FORMAT_AAC_ELD = 0x1000004u, AUDIO_FORMAT_AAC_HE_V1 = 0x1000005u, AUDIO_FORMAT_AAC_HE_V2 = 0x1000006u, AUDIO_FORMAT_G711A = 0x2000001u, AUDIO_FORMAT_G711U = 0x2000002u, AUDIO_FORMAT_G726 = 0x2000003u } | 音频格式 | 61| [AudioChannelMask](_audio.md#audiochannelmask){ AUDIO_CHANNEL_FRONT_LEFT = 0x1, AUDIO_CHANNEL_FRONT_RIGHT = 0x2, AUDIO_CHANNEL_MONO = 0x1u, AUDIO_CHANNEL_STEREO = 0x3u } | 音频通道掩码(mask) | 62| [AudioSampleRatesMask](_audio.md#audiosampleratesmask){ AUDIO_SAMPLE_RATE_MASK_8000 = 0x1u, AUDIO_SAMPLE_RATE_MASK_12000 = 0x2u, AUDIO_SAMPLE_RATE_MASK_11025 = 0x4u, AUDIO_SAMPLE_RATE_MASK_16000 = 0x8u, AUDIO_SAMPLE_RATE_MASK_22050 = 0x10u, AUDIO_SAMPLE_RATE_MASK_24000 = 0x20u, AUDIO_SAMPLE_RATE_MASK_32000 = 0x40u, AUDIO_SAMPLE_RATE_MASK_44100 = 0x80u, AUDIO_SAMPLE_RATE_MASK_48000 = 0x100u, AUDIO_SAMPLE_RATE_MASK_64000 = 0x200u, AUDIO_SAMPLE_RATE_MASK_96000 = 0x400u, AUDIO_SAMPLE_RATE_MASK_INVALID = 0xFFFFFFFFu } | 音频采样频率MASK | 63| [AudioPortPassthroughMode](_audio.md#audioportpassthroughmode){ PORT_PASSTHROUGH_LPCM = 0x1, PORT_PASSTHROUGH_RAW = 0x2, PORT_PASSTHROUGH_HBR2LBR = 0x4, PORT_PASSTHROUGH_AUTO = 0x8 } | 音频端口的数据透传模式 | 64| [AudioSampleFormat](_audio.md#audiosampleformat){ AUDIO_SAMPLE_FORMAT_S8, AUDIO_SAMPLE_FORMAT_S8P, AUDIO_SAMPLE_FORMAT_U8, AUDIO_SAMPLE_FORMAT_U8P, AUDIO_SAMPLE_FORMAT_S16, AUDIO_SAMPLE_FORMAT_S16P, AUDIO_SAMPLE_FORMAT_U16, AUDIO_SAMPLE_FORMAT_U16P, AUDIO_SAMPLE_FORMAT_S24, AUDIO_SAMPLE_FORMAT_S24P, AUDIO_SAMPLE_FORMAT_U24, AUDIO_SAMPLE_FORMAT_U24P, AUDIO_SAMPLE_FORMAT_S32, AUDIO_SAMPLE_FORMAT_S32P, AUDIO_SAMPLE_FORMAT_U32, AUDIO_SAMPLE_FORMAT_U32P, AUDIO_SAMPLE_FORMAT_S64, AUDIO_SAMPLE_FORMAT_S64P, AUDIO_SAMPLE_FORMAT_U64, AUDIO_SAMPLE_FORMAT_U64P, AUDIO_SAMPLE_FORMAT_F32, AUDIO_SAMPLE_FORMAT_F32P, AUDIO_SAMPLE_FORMAT_F64, AUDIO_SAMPLE_FORMAT_F64P } | 原始音频样本格式 | 65| [AudioChannelMode](_audio.md#audiochannelmode){ AUDIO_CHANNEL_NORMAL = 0, AUDIO_CHANNEL_BOTH_LEFT, AUDIO_CHANNEL_BOTH_RIGHT, AUDIO_CHANNEL_EXCHANGE, AUDIO_CHANNEL_MIX, AUDIO_CHANNEL_LEFT_MUTE, AUDIO_CHANNEL_RIGHT_MUTE, AUDIO_CHANNEL_BOTH_MUTE } | 音频播放的通道模式 | 66| [AudioDrainNotifyType](_audio.md#audiodrainnotifytype){ AUDIO_DRAIN_NORMAL_MODE, AUDIO_DRAIN_EARLY_MODE } | DrainBuffer函数结束类型 | 67| [AudioCallbackType](_audio.md#audiocallbacktype){ AUDIO_NONBLOCK_WRITE_COMPLETED, AUDIO_DRAIN_COMPLETED, AUDIO_FLUSH_COMPLETED, AUDIO_RENDER_FULL, AUDIO_ERROR_OCCUR } | 回调函数通知事件类型 | 68| [AudioPortRole](_audio.md#audioportrole){ AUDIO_PORT_UNASSIGNED_ROLE = 0, AUDIO_PORT_SOURCE_ROLE = 1, AUDIO_PORT_SINK_ROLE = 2 } | 音频端口角色 | 69| [AudioPortType](_audio.md#audioporttype){ AUDIO_PORT_UNASSIGNED_TYPE = 0, AUDIO_PORT_DEVICE_TYPE = 1, AUDIO_PORT_MIX_TYPE = 2, AUDIO_PORT_SESSION_TYPE = 3 } | 音频端口类型. | 70| [AudioSessionType](_audio.md#audiosessiontype){ AUDIO_OUTPUT_STAGE_SESSION = 0, AUDIO_OUTPUT_MIX_SESSION, AUDIO_ALLOCATE_SESSION, AUDIO_INVALID_SESSION } | 端口会话类型 | 71