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_LPP_AUDIO_STREAMER_H 20 #define AVCODECSAMPLE_MASTER_LPP_AUDIO_STREAMER_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 #include "sample_callback.h" 26 #include "dfx/error/av_codec_sample_error.h" 27 #include "av_codec_sample_log.h" 28 29 class LppAudioStreamer { 30 public: 31 LppAudioStreamer() = default; 32 ~LppAudioStreamer(); 33 34 int32_t Create(const std::string &codecMime); 35 36 int32_t SetCallbackCreate(LppUserData *lppUserData); 37 int32_t SetCallbackCreateNull(LppUserData *lppUserData); 38 int32_t SetDataNeededListener(LppUserData *lppUserData); 39 int32_t SetPositionUpdateListener(LppUserData *lppUserData); 40 int32_t SetCallback(LppUserData *lppUserData); 41 int32_t SetErrorCallback(LppUserData *lppUserData); 42 int32_t SetInterruptListener(LppUserData *lppUserData); 43 int32_t SetOnDeviceChanged(LppUserData *lppUserData); 44 int32_t SetEosCallback(LppUserData *lppUserData); 45 46 int32_t Start(); 47 48 int32_t SetParameter(const SampleInfo &sampleInfo); 49 int32_t GetParameter(const SampleInfo &sampleInfo); 50 51 int32_t Prepare(); 52 53 int32_t Resume(); 54 55 int32_t Pause(); 56 57 int32_t Flush(); 58 59 int32_t Stop(); 60 61 int32_t Reset(); 62 63 int32_t Destroy(); 64 65 int32_t CallbackDestroy(); 66 67 int32_t SetVolume(const float volume); 68 69 int32_t SetPlayBackSpeed(const float speed); 70 71 int32_t Release(); 72 int32_t returnFrames(LppUserData *lppUserData); 73 int32_t Configure(const SampleInfo &sampleInfo); 74 75 bool isAVBufferMode_ = true; 76 OH_LowPowerAudioSink *lppAudioStreamer_; 77 OH_LowPowerAudioSinkCallback *lppAudioStreamerCallback_; 78 }; 79 80 #endif //AVCODECSAMPLE_MASTER_LPP_AUDIO_STREAMER_H 81