1 /* 2 * Copyright (C) 2023 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 #ifndef CACHEBUFFER_MOCK_H 16 #define CACHEBUFFER_MOCK_H 17 18 #include <fcntl.h> 19 #include <cstdio> 20 #include <mutex> 21 #include <cstdlib> 22 #include <thread> 23 #include <string> 24 #include <vector> 25 #include <memory> 26 #include <atomic> 27 #include <iostream> 28 #include "gtest/gtest.h" 29 #include "unittest_log.h" 30 #include "media_errors.h" 31 #include "nocopyable.h" 32 #include "cache_buffer.h" 33 #include "thread_pool.h" 34 35 namespace OHOS { 36 namespace Media { 37 using namespace std; 38 using namespace AudioStandard; 39 using namespace MediaAVCodec; 40 class CacheBufferMock { 41 public: 42 CacheBufferMock() = default; 43 ~CacheBufferMock() = default; 44 bool CreateCacheBuffer(const Format &trackFormat, const int32_t &soundID, const int32_t &streamID, 45 std::shared_ptr<ThreadPool> cacheBufferStopThreadPool); 46 bool IsAudioRendererCanMix(const AudioStandard::AudioRendererInfo &audioRendererInfo); 47 int32_t CreateAudioRenderer(const int32_t streamID, 48 const AudioStandard::AudioRendererInfo audioRendererInfo, const PlayParams playParams); 49 size_t GetFileSize(const std::string& fileName); 50 private: 51 std::shared_ptr<CacheBuffer> cacheBuffer_ = nullptr; 52 }; 53 } // namespace Media 54 } // namespace OHOS 55 #endif