openharmony 鸿蒙 capi-lowpower-audio-sink-base-h

2026-08-25 浏览 (1)

lowpower_audio_sink_base.h

Overview

The file declares the structs and enums of the LowPowerAudioSink.

File to include: <multimedia/player_framework/lowpower_audio_sink_base.h>

Library: liblowpower_avsink.so

System capability: SystemCapability.Multimedia.Media.LowPowerAVSink

Since: 20

Related module: LowPowerAudioSink

Summary

Structs

Nametypedef KeywordDescription
OH_LowPowerAudioSinkOH_LowPowerAudioSinkDescribes the declaration for the LowPowerAudioSink.
OH_LowPowerAudioSinkCallbackOH_LowPowerAudioSinkCallbackContains a set of callback function pointers for the LowPowerAudioSink.
To ensure the normal running of the LowPowerAudioSink, you must register the instance of this struct with the OH_LowPowerAudioSink instance and process the information reported by the callback functions.

Functions

Nametypedef KeywordDescription
typedef void (*OH_LowPowerAudioSink_OnError)(OH_LowPowerAudioSink* sink, OH_AVErrCode errCode, const char* errorMsg, void* userData)OH_LowPowerAudioSink_OnErrorCalled when an error occurs in the LowPowerAudioSink.
typedef void (*OH_LowPowerAudioSink_OnPositionUpdated)(OH_LowPowerAudioSink* sink, int64_t currentPosition, void* userData)OH_LowPowerAudioSink_OnPositionUpdatedCalled when the playback position is updated in the LowPowerAudioSink.
typedef void (*OH_LowPowerAudioSink_OnDataNeeded)(OH_LowPowerAudioSink* sink, OH_AVSamplesBuffer* samples, void* userData)OH_LowPowerAudioSink_OnDataNeededCalled when the LowPowerAudioSink needs more data.
typedef void (*OH_LowPowerAudioSink_OnInterrupted)(OH_LowPowerAudioSink* sink, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint, void* userData)OH_LowPowerAudioSink_OnInterruptedCalled when the audio focus is interrupted in the LowPowerAudioSink.
typedef void (*OH_LowPowerAudioSink_OnDeviceChanged)(OH_LowPowerAudioSink* sink, OH_AudioStream_DeviceChangeReason reason, void* userData)OH_LowPowerAudioSink_OnDeviceChangedCalled when the audio device changes in the LowPowerAudioSink.
typedef void (*OH_LowPowerAudioSink_OnEos)(OH_LowPowerAudioSink* sink, void* userData)OH_LowPowerAudioSink_OnEosCalled when the playback is complete in the LowPowerAudioSink. This callback is included in OH_LowPowerAudioSinkCallback.

Function Description

OH_LowPowerAudioSink_OnError()

typedef void (*OH_LowPowerAudioSink_OnError)(OH_LowPowerAudioSink* sink,OH_AVErrCode errCode,const char* errorMsg,void* userData)

Description

Called when an error occurs in the LowPowerAudioSink.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
OH_AVErrCode errCodeError code reported when an error occurs.
const char* errorMsgPointer to an error message.
void* userDataPointer to user-defined data.

OH_LowPowerAudioSink_OnPositionUpdated()

typedef void (*OH_LowPowerAudioSink_OnPositionUpdated)(OH_LowPowerAudioSink* sink,int64_t currentPosition,void* userData)

Description

Called when the playback position is updated in the LowPowerAudioSink.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
int64_t currentPositionCurrent playback position.
void* userDataPointer to user-defined data.

OH_LowPowerAudioSink_OnDataNeeded()

typedef void (*OH_LowPowerAudioSink_OnDataNeeded)(OH_LowPowerAudioSink* sink,OH_AVSamplesBuffer* samples,void* userData)

Description

Called when the LowPowerAudioSink needs more data.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
OH_AVSamplesBuffer* samplesPointer to the AVSamplesBuffer instance to be written.
void* userDataPointer to user-defined data.

OH_LowPowerAudioSink_OnInterrupted()

typedef void (*OH_LowPowerAudioSink_OnInterrupted)(OH_LowPowerAudioSink* sink,OH_AudioInterrupt_ForceType type,OH_AudioInterrupt_Hint hint,void* userData)

Description

Called when the audio focus is interrupted in the LowPowerAudioSink.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
OH_AudioInterrupt_ForceType typeType of force that causes the audio interruption.
OH_AudioInterrupt_Hint hintHint provided along with audio interruption.
void* userDataPointer to user-defined data.

OH_LowPowerAudioSink_OnDeviceChanged()

typedef void (*OH_LowPowerAudioSink_OnDeviceChanged)(OH_LowPowerAudioSink* sink,OH_AudioStream_DeviceChangeReason reason,void* userData)

Description

Called when the audio device changes in the LowPowerAudioSink.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
OH_AudioStream_DeviceChangeReason reasonReason for the output device changes.
void* userDataPointer to user-defined data.

OH_LowPowerAudioSink_OnEos()

typedef void (*OH_LowPowerAudioSink_OnEos)(OH_LowPowerAudioSink* sink, void* userData)

Description

Called when the playback is complete in the LowPowerAudioSink. This callback is included in OH_LowPowerAudioSinkCallback.

Since: 20

Parameters

NameDescription
OH_LowPowerAudioSink* sinkPointer to an OH_LowPowerAudioSink instance.
void* userDataPointer to user-defined data.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-avrecorder-oh-avrecorder-range

openharmony 鸿蒙 errorcode-media

openharmony 鸿蒙 capi-avplayer

openharmony 鸿蒙 capi-avplayer-base-h

openharmony 鸿蒙 capi-avimage-generator-h

openharmony 鸿蒙 capi-avscreencapture-oh-rect

openharmony 鸿蒙 capi-videoprocessing-videoprocessing-callback

openharmony 鸿蒙 capi-avsinkbase

openharmony 鸿蒙 capi-avmetadataextractor

openharmony 鸿蒙 capi-avscreencapture-oh-multidisplaycapability

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/JxiC58dT