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