1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. 3 */ 4 /* 5 * Copyright (C) 2023 Huawei Device Co., Ltd. 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef AVCODECSAMPLE_MASTER_LPPCALLBACK_H 20 #define AVCODECSAMPLE_MASTER_LPPCALLBACK_H 21 22 #include <multimedia/player_framework/lowpower_avsink_base.h> 23 #include <multimedia/player_framework/lowpower_video_sink_base.h> 24 #include <multimedia/player_framework/lowpower_audio_sink_base.h> 25 class LppCallback { 26 public: 27 static void OnDataNeeded(OH_LowPowerAudioSink *decoder, OH_AVSamplesBuffer *framePacket, void *userData); 28 static void OnPositionUpdated(OH_LowPowerAudioSink *decoder, int64_t currentPosition, void *userData); 29 static void OnError(OH_LowPowerAudioSink *decoder, OH_AVErrCode errCode, const char *errorMsg, void *userData); 30 static void OnInterrupted(OH_LowPowerAudioSink *decoder, OH_AudioInterrupt_ForceType type, 31 OH_AudioInterrupt_Hint hint, void *userData); 32 static void OnDeviceChanged(OH_LowPowerAudioSink *decoder, OH_AudioStream_DeviceChangeReason reason, 33 void *userData); 34 static void OnEos(OH_LowPowerAudioSink *decoder, void *userData); 35 static void OnDataNeededVideo(OH_LowPowerVideoSink *streamer, OH_AVSamplesBuffer *framePacket, 36 void *userData); 37 static void OnAnchorUpdated(OH_LowPowerVideoSink *streamer, long *anchorPts, long *anchorClock, 38 void *userData); 39 static void OnVideoError(OH_LowPowerVideoSink *streamer, OH_AVErrCode errCode, const char *errMsg, 40 void *userData); 41 static void OnAudioError(OH_LowPowerAudioSink *streamer, OH_AVErrCode errCode, const char *errMsg, 42 void *userData); 43 static void OnTargetArrived(OH_LowPowerVideoSink *streamer, const int64_t targetPts, const bool isTimeout, 44 void *userData); 45 static void OnRenderStarted(OH_LowPowerVideoSink *streamer, void *userData); 46 static void OnEos(OH_LowPowerVideoSink *streamer, void *userData); 47 static void OnFirstFrameDecoded(OH_LowPowerVideoSink *streamer, void *userData); 48 static void OH_LowPowerVideoSink_OnStreamChanged(OH_LowPowerVideoSink *streamer, OH_AVFormat *format, 49 void *userData); 50 51 }; 52 53 #endif //AVCODECSAMPLE_MASTER_LPPCALLBACK_H 54