1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /** 19 * @file pv_player_node_registry.h 20 * @brief PVPlayerNodeRegistry maintains a list of nodes available which is queryable. The utility 21 * also allows the node specified by PVUuid to be created and returned 22 * 23 */ 24 25 26 #ifndef PV_PLAYER_NODE_REGISTRY_INTERFACE_H_INCLUDED 27 #define PV_PLAYER_NODE_REGISTRY_INTERFACE_H_INCLUDED 28 29 #ifndef OSCL_VECTOR_H_INCLUDED 30 #include "oscl_vector.h" 31 #endif 32 33 #ifndef OSCL_MEM_H_INCLUDED 34 #include "oscl_mem.h" 35 #endif 36 37 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED 38 #include "pvmf_format_type.h" 39 #endif 40 41 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED 42 #include "pvmf_node_interface.h" 43 #endif 44 45 #ifndef PV_UUID_H_INCLUDED 46 #include "pv_uuid.h" 47 #endif 48 49 #ifndef PVMF_RECOGNIZER_PLUGIN_H_INCLUDED 50 #include "pvmf_recognizer_plugin.h" 51 #endif 52 53 class OsclSharedLibrary; 54 55 // CLASS DECLARATION 56 /** 57 * PVPlayerNodeInfo is a class which will maintain node info 58 **/ 59 class PVPlayerNodeInfo 60 { 61 public: 62 /** 63 * Object Constructor function 64 **/ PVPlayerNodeInfo()65 PVPlayerNodeInfo() 66 { 67 iNodeCreateFunc = NULL; 68 iNodeReleaseFunc = NULL; 69 } 70 71 /** 72 * Copy Constructor function 73 **/ PVPlayerNodeInfo(const PVPlayerNodeInfo & aInfo)74 PVPlayerNodeInfo(const PVPlayerNodeInfo& aInfo) 75 { 76 iNodeUUID = aInfo.iNodeUUID; 77 iNodeCreateFunc = aInfo.iNodeCreateFunc; 78 iNodeReleaseFunc = aInfo.iNodeReleaseFunc; 79 iInputTypes = aInfo.iInputTypes; 80 iOutputType = aInfo.iOutputType; 81 } 82 83 /** 84 * Object destructor function 85 **/ ~PVPlayerNodeInfo()86 ~PVPlayerNodeInfo() 87 { 88 } 89 90 PVUuid iNodeUUID; 91 PVMFNodeInterface*(*iNodeCreateFunc)(int32); 92 bool (*iNodeReleaseFunc)(PVMFNodeInterface *); 93 Oscl_Vector<PVMFFormatType, OsclMemAllocator> iInputTypes; 94 Oscl_Vector<PVMFFormatType, OsclMemAllocator> iOutputType; 95 }; 96 97 98 class PVPlayerNodeRegistryInterface 99 { 100 public: 101 /** 102 * The QueryRegistry for PVPlayerNodeRegistry. Used mainly for Seaching of the UUID 103 * whether it is available or not & returns Success if it is found else failure. 104 * 105 * @param aInputType Input Format Type 106 * 107 * @param aOutputType Output Format Type 108 * 109 * @param aUuids Reference to the UUID registered 110 * 111 * @returns Success or Failure 112 **/ 113 virtual PVMFStatus QueryRegistry(PVMFFormatType& aInputType, PVMFFormatType& aOutputType, Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids) = 0; 114 115 /** 116 * The CreateNode for PVPlayerNodeRegistry. Used mainly for creating a node. 117 * 118 * @param aUuid UUID returned by the QueryRegistry 119 * 120 * @returns a pointer to node 121 **/ 122 virtual PVMFNodeInterface* CreateNode(PVUuid& aUuid) = 0; 123 124 /** 125 * The ReleaseNode for PVPlayerNodeRegistry. Used for releasing a node. 126 * 127 * @param aUuid UUID recorded at the time of creation of the node. 128 * 129 * @param Pointer to the node to be released 130 * 131 * @returns True or False 132 **/ 133 virtual bool ReleaseNode(PVUuid& aUuid, PVMFNodeInterface *aNode) = 0; 134 135 /** 136 * The RegisterNode for PVPlayerNodeRegistry. Used for registering nodes through the NodeInfo object. 137 * 138 * @param aNodeInfo NodeInfo object passed to the regisry class. This contains all nodes that need to be registered. 139 * 140 **/ 141 virtual void RegisterNode(const PVPlayerNodeInfo& aNodeInfo) = 0; 142 143 /** 144 * The UnregisterNode for PVPlayerNodeRegistry. Used for unregistering nodes through the NodeInfo object. 145 * 146 * @param aNodeInfo NodeInfo object passed to the regisry class. This contains all nodes that need to be unregistered. 147 * 148 **/ 149 virtual void UnregisterNode(const PVPlayerNodeInfo& aNodeInfo) = 0; 150 }; 151 152 class PVPlayerRecognizerRegistryInterface 153 { 154 public: 155 /** 156 * The RegisterRecognizer for PVPlayerRecognizerRegistry. Used for registering plugins through the PVMFRecognizerPluginFactory* object. 157 * 158 * @param PVMFRecognizerPluginFactory* object passed to the regisry class. This contains all nodes that need to be registered. 159 * 160 **/ 161 virtual void RegisterRecognizer(PVMFRecognizerPluginFactory* aRecognizerPluginFactory) = 0; 162 163 /** 164 * The UnregisterRecognizer for PVPlayerRecognizerRegistry. Used for unregistering plugins through the PVMFRecognizerPluginFactory* object. 165 * 166 * @param PVMFRecognizerPluginFactory* object passed to the regisry class. This contains all nodes that need to be unregistered. 167 * 168 **/ 169 virtual void UnregisterRecognizer(PVMFRecognizerPluginFactory* aRecognizerPluginFactory) = 0; 170 171 }; 172 173 /* 174 ** NodeRegistryPopulatorInterface is an abstract interface that is used to register and 175 ** unregister nodes in a registry. A registry uses this interface to allow registry populators 176 ** to add and remove objects in the registry. 177 */ 178 #define PV_NODE_REGISTRY_POPULATOR_INTERFACE OsclUuid(0x1d4769f0,0xca0c,0x11dc,0x95,0xff,0x08,0x00,0x20,0x0c,0x9a,0x66) 179 180 class NodeRegistryPopulatorInterface 181 { 182 public: 183 /* 184 ** RegisterAllNodes will register one or more nodes in the registry 185 ** @param aRegistry: the registry 186 ** @param aContext (out): a returned context value. The registry must 187 ** include this value in the UnregisterAllNodes call. 188 */ 189 virtual void RegisterAllNodes(PVPlayerNodeRegistryInterface* aRegistry, OsclAny*& aContext) = 0; 190 191 /* 192 ** UnregisterAllNodes will unregister one or more nodes in the registry 193 ** @param aRegistry: the registry 194 ** @param aContext (in): the context value that was returned in the RegisterAllNodes 195 ** call. 196 */ 197 virtual void UnregisterAllNodes(PVPlayerNodeRegistryInterface* aRegistry, OsclAny* aContext) = 0; 198 }; 199 200 /* 201 ** RecognizerPopulatorInterface is an abstract interface that is used to register and 202 ** unregister recognizers in a registry. A registry uses this interface to allow registry populators 203 ** to add and remove objects in the registry. 204 */ 205 #define PV_RECOGNIZER_POPULATOR_INTERFACE OsclUuid(0x6d3413a0,0xca0c,0x11dc,0x95,0xff,0x08,0x00,0x20,0x0c,0x9a,0x66) 206 207 class RecognizerPopulatorInterface 208 { 209 public: 210 /* 211 ** RegisterAllRecognizers will register one or more recognizers in the registry 212 ** @param aRegistry: the registry 213 ** @param aContext (out): a returned context value. The registry must 214 ** include this value in the UnregisterAllRecognizers call. 215 */ 216 virtual void RegisterAllRecognizers(PVPlayerRecognizerRegistryInterface* aRegistry, OsclAny*& aContext) = 0; 217 218 /* 219 ** UnregisterAllNodes will unregister one or more recognizers in the registry 220 ** @param aRegistry: the registry 221 ** @param aContext (in): the context value that was returned in the RegisterAllRecognizers 222 ** call. 223 */ 224 virtual void UnregisterAllRecognizers(PVPlayerRecognizerRegistryInterface* aRegistry, OsclAny* aContext) = 0; 225 }; 226 227 #endif // PV_PLAYER_NODE_REGISTRY_INTERFACE_H_INCLUDED 228 229 230