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 AVDEMUXER_IMPL_H 17 #define AVDEMUXER_IMPL_H 18 19 #include <memory> 20 #include "avdemuxer.h" 21 #include "nocopyable.h" 22 #include "avsource_impl.h" 23 #include "i_demuxer_engine.h" 24 25 namespace OHOS { 26 namespace MediaAVCodec { 27 class AVDemuxerImpl : public AVDemuxer, public NoCopyable { 28 public: 29 AVDemuxerImpl(); 30 ~AVDemuxerImpl(); 31 32 int32_t SelectTrackByID(uint32_t trackIndex) override; 33 int32_t UnselectTrackByID(uint32_t trackIndex) override; 34 int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVSharedMemory> sample, 35 AVCodecBufferInfo &info, AVCodecBufferFlag &flag) override; 36 int32_t SeekToTime(int64_t millisecond, const AVSeekMode mode) override; 37 int32_t Init(std::shared_ptr<AVSource> source); 38 39 private: 40 std::shared_ptr<IDemuxerEngine> demuxerEngine_ = nullptr; 41 std::string sourceUri_; 42 }; 43 } // namespace MediaAVCodec 44 } // namespace OHOS 45 #endif // AVDEMUXER_IMPL_H