// Factory functions PVMFNodeInterface* StreamingNodesCoreLibraryLoader::CreateStreamingManagerNode(int32 aPriority) { OsclSharedLibrary* streamingSharedLibrary = NULL; OSCL_StackString<NODE_REGISTRY_LIB_NAME_MAX_LENGTH> libname(RTSP_LIB_NAME); // Need to load the library for the node streamingSharedLibrary = OSCL_NEW(OsclSharedLibrary, (libname)); OsclLibStatus result = streamingSharedLibrary->LoadLib(); if (OsclLibSuccess != result) { return NULL; } streamingSharedLibrary->AddRef(); // Query for create function OsclAny* interfacePtr = NULL; streamingSharedLibrary->QueryInterface(PV_NODE_INTERFACE, (OsclAny*&)interfacePtr); NodeSharedLibraryInterface* nodeIntPtr = OSCL_DYNAMIC_CAST(NodeSharedLibraryInterface*, interfacePtr); OsclAny* createFuncTemp = nodeIntPtr->QueryNodeInterface(KPVMFRTSPStreamingModuleUuid, PV_CREATE_NODE_INTERFACE); LPFN_NODE_CREATE_FUNC nodeCreateFunc = OSCL_DYNAMIC_CAST(PVMFNodeInterface * (*)(int32), createFuncTemp); if (NULL != nodeCreateFunc) { PVMFNodeInterface* node = NULL; // call the real node factory function node = (*(nodeCreateFunc))(aPriority); if (NULL == node) { streamingSharedLibrary->RemoveRef(); if (OsclLibSuccess == streamingSharedLibrary->Close()) { // Close will unload the library if refcount is 0 OSCL_DELETE(streamingSharedLibrary); } return NULL; } node->SetSharedLibraryPtr(streamingSharedLibrary); return node; } return NULL; }
// Factory functions ProtocolContainer* ProtocolEngineNodeProgressiveDownloadContainerLoader::CreateProgressiveDownloadContainer(PVMFProtocolEngineNode* aNode) { OsclSharedLibrary* aSharedLibrary = NULL; OSCL_StackString<LIB_NAME_MAX_LENGTH> libname(PDL_PLUGIN_LIB_NAME); // Need to load the library for the node aSharedLibrary = OSCL_NEW(OsclSharedLibrary, ()); OsclLibStatus result = aSharedLibrary->LoadLib(libname); if (OsclLibSuccess != result) return NULL; aSharedLibrary->AddRef(); // Query for create function OsclAny* interfacePtr = NULL; aSharedLibrary->QueryInterface(PENODE_SHARED_LIBRARY_INTERFACE, (OsclAny*&)interfacePtr); if (NULL == interfacePtr) return NULL; ProtocolEngineNodeSharedLibraryInterface* libIntPtr = OSCL_DYNAMIC_CAST(ProtocolEngineNodeSharedLibraryInterface*, interfacePtr); OsclAny* createFuncTemp = libIntPtr->QueryLibInterface(PENODE_CREATE_LIB_INTERFACE); if (!createFuncTemp) return NULL; LPFN_LIB_CREATE_FUNC libCreateFunc = OSCL_DYNAMIC_CAST(ProtocolContainer * (*)(PVMFProtocolEngineNode *), createFuncTemp); if (NULL != libCreateFunc) { // call the real node factory function ProtocolContainer *aProtocolContainer = (*(libCreateFunc))(aNode); if (NULL != aProtocolContainer) { aProtocolContainer->SetSharedLibraryPtr(aSharedLibrary); return aProtocolContainer; } } aSharedLibrary->RemoveRef(); if (OsclLibSuccess == aSharedLibrary->Close()) { // Close will unload the library if refcount is 0 OSCL_DELETE(aSharedLibrary); } return NULL; }