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 PLUGIN_CORE_DEMUXER_H 17 #define PLUGIN_CORE_DEMUXER_H 18 19 #include "meta/format.h" 20 #include "avcodec_common.h" 21 #include "buffer/avbuffer.h" 22 #include "demuxer_plugin.h" 23 24 namespace OHOS { 25 namespace MediaAVCodec { 26 namespace Plugin { 27 using namespace Media; 28 class Demuxer { 29 public: 30 Demuxer(const Demuxer &) = delete; 31 Demuxer operator=(const Demuxer &) = delete; 32 ~Demuxer() = default; 33 int32_t SelectTrackByID(uint32_t trackIndex); 34 int32_t UnselectTrackByID(uint32_t trackIndex); 35 int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVBuffer> sample); 36 int32_t SeekToTime(int64_t millisecond, AVSeekMode mode); 37 38 private: 39 friend class DemuxerFactory; 40 Demuxer(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<DemuxerPlugin> plugin); 41 const uint32_t pkgVersion_; 42 const uint32_t apiVersion_; 43 std::shared_ptr<DemuxerPlugin> demuxer_; 44 }; 45 } // namespace Plugin 46 } // namespace MediaAVCodec 47 } // namespace OHOS 48 #endif // PLUGIN_CORE_DEMUXER_H 49