• 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 SOURCE_ENGINE_IMPL_H
17 #define SOURCE_ENGINE_IMPL_H
18 
19 #include <map>
20 #include <mutex>
21 #include <condition_variable>
22 #include "i_source_engine.h"
23 #include "plugin_definition.h"
24 #include "source.h"
25 #include "block_queue.h"
26 #include "avcodec_common.h"
27 
28 namespace OHOS {
29 namespace MediaAVCodec {
30 class SourceEngineImpl : public ISourceEngine {
31 public:
32     explicit SourceEngineImpl(const std::string& uri);
33     ~SourceEngineImpl() override;
34     int32_t Init() override;
35     int32_t GetTrackCount(uint32_t &trackCount) override;
36     int32_t GetSourceFormat(Format &format) override;
37     int32_t GetTrackFormat(Format &format, uint32_t trackIndex) override;
38     uintptr_t GetSourceAddr() override;
39 
40 private:
41     std::string uri_;
42     std::mutex mutex_;
43     std::shared_ptr<Plugin::Source> source_ = nullptr;
44 };
45 } // namespace MediaAVCodec
46 } // namespace OHOS
47 #endif // SOURCE_ENGINE_IMPL_H