• 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 DEMUXER_ENGINE_IMPL_H
17 #define DEMUXER_ENGINE_IMPL_H
18 
19 #include <map>
20 #include <mutex>
21 #include <condition_variable>
22 #include "i_demuxer_engine.h"
23 #include "demuxer.h"
24 #include "avcodec_common.h"
25 
26 namespace OHOS {
27 namespace MediaAVCodec {
28 class DemuxerEngineImpl : public IDemuxerEngine {
29 public:
30     explicit DemuxerEngineImpl(uintptr_t sourceAddr);
31     ~DemuxerEngineImpl() override;
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, AVSeekMode mode) override;
37 private:
38     uintptr_t sourceAddr_;
39     std::mutex mutex_;
40     std::shared_ptr<Plugin::Demuxer> demuxer_ = nullptr;
41 };
42 } // namespace MediaAVCodec
43 } // namespace OHOS
44 #endif // DEMUXER_ENGINE_IMPL_H