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 #ifdef SUPPORT_PLAYER 22 #include "i_player_engine.h" 23 #endif 24 #ifdef SUPPORT_RECORDER 25 #include "i_recorder_engine.h" 26 #endif 27 #ifdef SUPPORT_METADATA 28 #include "i_avmetadatahelper_engine.h" 29 #endif 30 #ifdef SUPPORT_TRANSCODER 31 #include "i_transcoder_engine.h" 32 #include "i_transcoder_engine.h" 33 #endif 34 35 namespace OHOS { 36 namespace Media { 37 class IEngineFactory { 38 public: 39 enum class Scene { 40 SCENE_PLAYBACK, 41 SCENE_AVMETADATA, 42 SCENE_RECORDER, 43 SCENE_AVCODEC, 44 SCENE_AVCODECLIST, 45 SCENE_TRANSCODER, 46 }; 47 48 virtual ~IEngineFactory() = default; 49 virtual int32_t Score(Scene scene, const int32_t& appUid, const std::string &uri = "") 50 { 51 (void)scene; 52 (void)appUid; 53 (void)uri; 54 return 0; 55 } 56 57 #ifdef SUPPORT_PLAYER 58 virtual std::unique_ptr<IPlayerEngine> CreatePlayerEngine(int32_t uid = 0, int32_t pid = 0, uint32_t tokenId = 0) 59 { 60 (void)uid; 61 (void)pid; 62 (void)tokenId; 63 return nullptr; 64 } 65 #endif 66 67 #ifdef SUPPORT_RECORDER CreateRecorderEngine(int32_t appUid,int32_t appPid,uint32_t appTokenId,uint64_t appFullTokenId)68 virtual std::unique_ptr<IRecorderEngine> CreateRecorderEngine(int32_t appUid, int32_t appPid, uint32_t appTokenId, 69 uint64_t appFullTokenId) 70 { 71 (void)appUid; 72 (void)appPid; 73 (void)appTokenId; 74 (void)appFullTokenId; 75 return nullptr; 76 } 77 #endif 78 79 #ifdef SUPPORT_METADATA CreateAVMetadataHelperEngine()80 virtual std::unique_ptr<IAVMetadataHelperEngine> CreateAVMetadataHelperEngine() 81 { 82 return nullptr; 83 } 84 #endif 85 86 #ifdef SUPPORT_TRANSCODER CreateTransCoderEngine(int32_t appUid,int32_t appPid,uint32_t appTokenId,uint64_t appFullTokenId)87 virtual std::unique_ptr<ITransCoderEngine> CreateTransCoderEngine(int32_t appUid, int32_t appPid, 88 uint32_t appTokenId, uint64_t appFullTokenId) 89 { 90 (void)appUid; 91 (void)appPid; 92 (void)appTokenId; 93 (void)appFullTokenId; 94 return nullptr; 95 } 96 #endif 97 98 protected: 99 static constexpr int32_t MAX_SCORE = 100; 100 static constexpr int32_t MIN_SCORE = 0; 101 }; 102 } // namespace Media 103 } // namespace OHOS 104 #endif