• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include <core/plugin/intf_plugin.h>
17 #include <core/plugin/intf_plugin_decl.h>
18 #include <core/plugin/intf_plugin_register.h>
19 #include <jpg/implementation_uids.h>
20 
21 #include "jpg/image_loader_jpg.h"
22 
23 using namespace CORE_NS;
24 
CORE_BEGIN_NAMESPACE()25 CORE_BEGIN_NAMESPACE()
26 #if defined(CORE_PLUGIN) && (CORE_PLUGIN == 1)
27 IPluginRegister* gPluginRegistry { nullptr };
GetPluginRegister()28 IPluginRegister& GetPluginRegister()
29 {
30     return *gPluginRegistry;
31 }
32 #endif
33 CORE_END_NAMESPACE()
34 
35 namespace JPGPlugin {
36 #ifdef __OHOS_PLATFORM__
GetVersionInfo()37 const char* GetVersionInfo()
38 {
39     return "GIT_TAG: GIT_REVISION: 8796bff GIT_BRANCH: dev";
40 }
41 #else
42 const char* GetVersionInfo();
43 #endif
44 
45 static constexpr CORE_NS::IImageLoaderManager::ImageLoaderTypeInfo JPG_LOADER {
46     { CORE_NS::IImageLoaderManager::ImageLoaderTypeInfo::UID },
47     nullptr,
48     BASE_NS::Uid { "8a8010f4-f262-412f-95d1-389348b4a6ba" },
49     CreateImageLoaderJPG,
50     IMAGE_TYPES,
51 };
52 
RegisterInterfaces(IPluginRegister & pluginRegistry)53 PluginToken RegisterInterfaces(IPluginRegister& pluginRegistry)
54 {
55 #if defined(CORE_PLUGIN) && (CORE_PLUGIN == 1)
56     gPluginRegistry = &pluginRegistry;
57 #endif
58     pluginRegistry.RegisterTypeInfo(JPG_LOADER);
59     return &pluginRegistry;
60 }
61 
UnregisterInterfaces(PluginToken token)62 void UnregisterInterfaces(PluginToken token)
63 {
64     static_cast<IPluginRegister*>(token)->UnregisterTypeInfo(JPG_LOADER);
65 }
66 } // namespace JPGPlugin
67 
68 extern "C" {
PLUGIN_DATA(JPGPlugin)69 PLUGIN_DATA(JPGPlugin) {
70     { IPlugin::UID },
71     "JPGPlugin",
72     /** Version information of the plugin. */
73     { JPGPlugin::UID_JPG_PLUGIN, JPGPlugin::GetVersionInfo },
74     JPGPlugin::RegisterInterfaces,
75     JPGPlugin::UnregisterInterfaces,
76     {},
77 };
78 }
79