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 16 #ifndef AVSOURCE_MOCK_H 17 #define AVSOURCE_MOCK_H 18 19 #include <string> 20 #include <memory> 21 #include "nocopyable.h" 22 #include "avformat_mock.h" 23 #include "av_common.h" 24 #include "avcodec_common.h" 25 #include "avsource.h" 26 #include "native_avsource.h" 27 28 namespace OHOS { 29 namespace MediaAVCodec { 30 class AVSourceMock : public NoCopyable { 31 public: 32 virtual ~AVSourceMock() = default; 33 virtual int32_t Destroy() =0; 34 virtual std::shared_ptr<FormatMock> GetSourceFormat() = 0; 35 virtual std::shared_ptr<FormatMock> GetTrackFormat(uint32_t trackIndex) = 0; 36 }; 37 38 class __attribute__((visibility("default"))) AVSourceMockFactory { 39 public: 40 static std::shared_ptr<AVSourceMock> CreateSourceWithURI(char *uri); 41 static std::shared_ptr<AVSourceMock> CreateSourceWithFD(int32_t fd, int64_t offset, int64_t size); 42 private: 43 AVSourceMockFactory() = delete; 44 ~AVSourceMockFactory() = delete; 45 }; 46 } // namespace MediaAVCodec 47 } // namespace OHOS 48 #endif // AVSOURCE_MOCK_H