• 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 AVDEMUXER_IMPL_H
17 #define AVDEMUXER_IMPL_H
18 
19 #include <memory>
20 #include "avdemuxer.h"
21 #include "avsource.h"
22 #include "nocopyable.h"
23 #include "media_demuxer.h"
24 
25 namespace OHOS {
26 namespace MediaAVCodec {
27 using namespace Media;
28 class AVDemuxerImpl : public AVDemuxer, public NoCopyable {
29 public:
30     AVDemuxerImpl();
31     ~AVDemuxerImpl();
32 
33     int32_t SelectTrackByID(uint32_t trackIndex) override;
34     int32_t UnselectTrackByID(uint32_t trackIndex) override;
35     int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVSharedMemory> sample,
36         AVCodecBufferInfo &info, uint32_t &flag) override;
37     int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVSharedMemory> sample,
38         AVCodecBufferInfo &info, AVCodecBufferFlag &flag) override;
39     int32_t ReadSampleBuffer(uint32_t trackIndex, std::shared_ptr<AVBuffer> sample) override;
40     int32_t SeekToTime(int64_t millisecond, const SeekMode mode) override;
41     int32_t SetCallback(const std::shared_ptr<AVDemuxerCallback> &callback) override;
42     int32_t GetMediaKeySystemInfo(std::multimap<std::string, std::vector<uint8_t>> &infos) override;
43     int32_t Init(std::shared_ptr<AVSource> source);
44 
45 private:
46     std::shared_ptr<MediaDemuxer> demuxerEngine_ = nullptr;
47     std::string sourceUri_;
48 };
49 } // namespace MediaAVCodec
50 } // namespace OHOS
51 #endif // AVDEMUXER_IMPL_H