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 DEMUXER_MOCK_H 17 #define DEMUXER_MOCK_H 18 19 #include <string> 20 #include <memory> 21 #include "nocopyable.h" 22 #include "avformat_mock.h" 23 #include "avsource_mock.h" 24 #include "common_mock.h" 25 #include "av_common.h" 26 #include "avcodec_common.h" 27 28 namespace OHOS { 29 namespace MediaAVCodec { 30 class DemuxerMock : public NoCopyable { 31 public: 32 virtual ~DemuxerMock() = default; 33 34 virtual int32_t Destroy() = 0; 35 virtual int32_t SelectTrackByID(uint32_t trackIndex) = 0; 36 virtual int32_t UnselectTrackByID(uint32_t trackIndex) = 0; 37 virtual int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVMemoryMock> sample, 38 AVCodecBufferInfo *bufferInfo, uint32_t &flag) = 0; 39 virtual int32_t SeekToTime(int64_t mSeconds, Media::SeekMode mode) = 0; 40 }; 41 42 class __attribute__((visibility("default"))) AVDemuxerMockFactory { 43 public: 44 static std::shared_ptr<DemuxerMock> CreateDemuxer(std::shared_ptr<AVSourceMock> source); 45 private: 46 AVDemuxerMockFactory() = delete; 47 ~AVDemuxerMockFactory() = delete; 48 }; 49 } // namespace MediaAVCodec 50 } // namespace OHOS 51 #endif // DEMUXER_MOCK_H