1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUDIO_RENDERER_FILE_SINK_H 17 #define AUDIO_RENDERER_FILE_SINK_H 18 19 #include "audio_info.h" 20 21 #include <cstdio> 22 #include <list> 23 #include <iostream> 24 #include <string> 25 26 namespace OHOS { 27 namespace AudioStandard { 28 class AudioRendererFileSink { 29 public: 30 int32_t Init(const char *filePath); 31 void DeInit(void); 32 int32_t Start(void); 33 int32_t Stop(void); 34 int32_t Flush(void); 35 int32_t Reset(void); 36 int32_t Pause(void); 37 int32_t Resume(void); 38 int32_t RenderFrame(char &data, uint64_t len, uint64_t &writeLen); 39 int32_t SetVolume(float left, float right); 40 int32_t GetLatency(uint32_t *latency); 41 int32_t GetTransactionId(uint64_t *transactionId); 42 static AudioRendererFileSink *GetInstance(void); 43 private: 44 AudioRendererFileSink(); 45 ~AudioRendererFileSink(); 46 FILE *filePtr_ = nullptr; 47 std::string filePath_; 48 }; 49 } // namespace AudioStandard 50 } // namespace OHOS 51 #endif // AUDIO_RENDERER_FILE_SINK_H 52