• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 I_ENGINE_FACTORY_H
17 #define I_ENGINE_FACTORY_H
18 
19 #include <string>
20 #include <memory>
21 #include "i_player_engine.h"
22 #include "i_recorder_engine.h"
23 #include "i_avmetadatahelper_engine.h"
24 #include "i_avcodec_engine.h"
25 #include "i_avcodeclist_engine.h"
26 
27 namespace OHOS {
28 namespace Media {
29 class IEngineFactory {
30 public:
31     enum class Scene {
32         SCENE_PLAYBACK,
33         SCENE_AVMETADATA,
34         SCENE_RECORDER,
35         SCENE_AVCODEC,
36         SCENE_AVCODECLIST,
37     };
38 
39     virtual ~IEngineFactory() = default;
40     virtual int32_t Score(Scene scene, const std::string &uri = "") = 0;
41     virtual std::unique_ptr<IPlayerEngine> CreatePlayerEngine() = 0;
42     virtual std::unique_ptr<IRecorderEngine> CreateRecorderEngine() = 0;
43     virtual std::unique_ptr<IAVMetadataHelperEngine> CreateAVMetadataHelperEngine() = 0;
44     virtual std::unique_ptr<IAVCodecEngine> CreateAVCodecEngine() = 0;
45     virtual std::unique_ptr<IAVCodecListEngine> CreateAVCodecListEngine() = 0;
46 
47 protected:
48     static constexpr int32_t MAX_SCORE = 100;
49     static constexpr int32_t MIN_SCORE = 0;
50 };
51 } // namespace Media
52 } // namespace OHOS
53 #endif