harmony 鸿蒙native_audiostream_base.h

  • 2025-06-12
  • 浏览 (4)

native_audiostream_base.h

Overview

The native_audiostream_base.h file declares the basic data structure of OHAudio.

Library: libohaudio.so

File to include: <ohaudio/native_audiostream_base.h>

System capability: SystemCapability.Multimedia.Audio.Core

Since: 10

Related module: OHAudio

Summary

Structs

Name Description
struct  OH_AudioRenderer_Callbacks_Struct Defines a pointer to the callback functions related to an audio renderer.
struct  OH_AudioCapturer_Callbacks_Struct Defines a pointer to the callback functions related to an audio capturer.

Types

Name Description
typedef struct OH_AudioStreamBuilderStruct OH_AudioStreamBuilder Defines an audio stream builder.
typedef struct OH_AudioRendererStruct OH_AudioRenderer Defines an audio renderer.
typedef struct OH_AudioCapturerStruct OH_AudioCapturer Defines an audio capturer.
typedef struct OH_AudioRenderer_Callbacks_Struct OH_AudioRenderer_Callbacks Defines a pointer to the callback functions related to an audio renderer.
typedef struct OH_AudioCapturer_Callbacks_Struct OH_AudioCapturer_Callbacks Defines a pointer to the callback functions related to an audio capturer.
typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer *renderer, void *userData, OH_AudioStream_DeviceChangeReason reason) Defines a pointer to the callback invoked when the audio stream device changes.
typedef void (*OH_AudioRenderer_OnMarkReachedCallback)(OH_AudioRenderer *renderer, uint32_t samplePos, void *userData) Defines a pointer to the callback invoked when the mark position is reached.
typedef int32_t (*OH_AudioRenderer_WriteDataWithMetadataCallback)(OH_AudioRenderer *renderer, void *userData, void *audioData, int32_t audioDataSize, void *metadata, int32_t metadataSize) Defines a function pointer to the callback function used to write audio data and metadata.
typedef OH_AudioData_Callback_Result(* OH_AudioRenderer_OnWriteDataCallback)(OH_AudioRenderer *renderer, void *userData, void *audioData, int32_t audioDataSize) Defines a function pointer to the callback function used to write audio data.

Enums

Name Description
OH_AudioStream_Result {
AUDIOSTREAM_SUCCESS = 0,
AUDIOSTREAM_ERROR_INVALID_PARAM = 1,
AUDIOSTREAM_ERROR_ILLEGAL_STATE = 2,
AUDIOSTREAM_ERROR_SYSTEM = 3
}
Enumerates the audio stream operation results.
OH_AudioStream_Type {
AUDIOSTREAM_TYPE_RENDERER = 1,
AUDIOSTREAM_TYPE_CAPTURER = 2
}
Enumerates the audio stream types.
OH_AudioStream_SampleFormat {
AUDIOSTREAM_SAMPLE_U8 = 0,
AUDIOSTREAM_SAMPLE_S16LE = 1,
AUDIOSTREAM_SAMPLE_S24LE = 2,
AUDIOSTREAM_SAMPLE_S32LE = 3,
AUDIOSTREAM_SAMPLE_F32LE = 4
}
Enumerates the sampling formats of audio streams.
OH_AudioStream_EncodingType {
AUDIOSTREAM_ENCODING_TYPE_RAW = 0,
AUDIOSTREAM_ENCODING_TYPE_AUDIOVIVID = 1
}
Enumerates the encoding types of audio streams.
OH_AudioStream_Usage {
AUDIOSTREAM_USAGE_UNKNOWN = 0,
AUDIOSTREAM_USAGE_MUSIC = 1,
AUDIOSTREAM_USAGE_VOICE_COMMUNICATION = 2,
AUDIOSTREAM_USAGE_VOICE_ASSISTANT = 3,
AUDIOSTREAM_USAGE_ALARM = 4,
AUDIOSTREAM_USAGE_VOICE_MESSAGE = 5,
AUDIOSTREAM_USAGE_RINGTONE = 6,
AUDIOSTREAM_USAGE_NOTIFICATION = 7,
AUDIOSTREAM_USAGE_ACCESSIBILITY = 8,
AUDIOSTREAM_USAGE_MOVIE = 10,
AUDIOSTREAM_USAGE_GAME = 11,
AUDIOSTREAM_USAGE_AUDIOBOOK = 12,
AUDIOSTREAM_USAGE_NAVIGATION = 13,
AUDIOSTREAM_USAGE_VIDEO_COMMUNICATION = 17
}
Enumerates the usage scenarios of audio streams.
OH_AudioStream_LatencyMode {
AUDIOSTREAM_LATENCY_MODE_NORMAL = 0,
AUDIOSTREAM_LATENCY_MODE_FAST = 1
}
Enumerates the latency modes of audio streams.
OH_AudioStream_VolumeMode {
AUDIOSTREAM_VOLUMEMODE_SYSTEM_GLOBAL = 0,
AUDIOSTREAM_VOLUMEMODE_APP_INDIVIDUAL = 1 }
Enumerates the volume modes of audio streams.
OH_AudioStream_State {
AUDIOSTREAM_STATE_INVALID = -1,
AUDIOSTREAM_STATE_NEW = 0,
AUDIOSTREAM_STATE_PREPARED = 1,
AUDIOSTREAM_STATE_RUNNING = 2,
AUDIOSTREAM_STATE_STOPPED = 3,
AUDIOSTREAM_STATE_RELEASED = 4,
AUDIOSTREAM_STATE_PAUSED = 5
}
Enumerates the audio stream states.
OH_AudioStream_SourceType {
AUDIOSTREAM_SOURCE_TYPE_INVALID = -1,
AUDIOSTREAM_SOURCE_TYPE_MIC = 0,
AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION = 1,
AUDIOSTREAM_SOURCE_TYPE_PLAYBACK_CAPTURE = 2,
AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION = 7,
AUDIOSTREAM_SOURCE_TYPE_CAMCORDER = 13
}
Enumerates the usage scenarios of audio streams.
OH_AudioStream_Event {
AUDIOSTREAM_EVENT_ROUTING_CHANGED = 0
}
Enumerates the audio stream events.
OH_AudioInterrupt_ForceType {
AUDIOSTREAM_INTERRUPT_FORCE = 0,
AUDIOSTREAM_INTERRUPT_SHARE = 1
}
Enumerates the types of force that causes audio interruption.
OH_AudioInterrupt_Hint {
AUDIOSTREAM_INTERRUPT_HINT_NONE = 0,
AUDIOSTREAM_INTERRUPT_HINT_RESUME = 1,
AUDIOSTREAM_INTERRUPT_HINT_PAUSE = 2,
AUDIOSTREAM_INTERRUPT_HINT_STOP = 3,
AUDIOSTREAM_INTERRUPT_HINT_DUCK = 4,
AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5
}
Enumerates the hints provided along with audio interruption.
OH_AudioInterrupt_Mode {
AUDIOSTREAM_INTERRUPT_MODE_SHARE = 0,
AUDIOSTREAM_INTERRUPT_MODE_INDEPENDENT = 1
}
Enumerates the audio interrupt modes.
OH_AudioStream_AudioEffectMode {
EFFECT_NONE = 0,
EFFECT_DEFAULT = 1
}
Enumerates the audio effect modes.
OH_AudioStream_DeviceChangeReason {
REASON_UNKNOWN = 0,
REASON_NEW_DEVICE_AVAILABLE = 1,
REASON_OLD_DEVICE_UNAVAILABLE = 2,
REASON_OVERRODE = 3
}
Enumerates the reasons for audio stream device changes.
OH_AudioStream_PrivacyType {
AUDIO_STREAM_PRIVACY_TYPE_PUBLIC = 0,
AUDIO_STREAM_PRIVACY_TYPE_PRIVATE = 1
}
Enumerates the privacy types of an audio stream. The privacy type specifies whether the audio stream can be recorded by other applications.
OH_AudioData_Callback_Result {
AUDIO_DATA_CALLBACK_RESULT_INVALID = -1,
AUDIO_DATA_CALLBACK_RESULT_VALID = 0
}
Enumerates the audio data callback results.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Audio Kit

harmony 鸿蒙OH_AudioCapturer_Callbacks_Struct

harmony 鸿蒙OH_AudioDeviceDescriptorArray

harmony 鸿蒙OH_AudioRenderer_Callbacks_Struct

harmony 鸿蒙OH_AudioSession_DeactivatedEvent

harmony 鸿蒙OH_AudioSession_Strategy

harmony 鸿蒙_o_h_audio

harmony 鸿蒙Audio Error Codes

harmony 鸿蒙Ringtone Error Codes

harmony 鸿蒙js-apis-audio-sys

0  赞