bool ProtocolEngineNodeProgressiveDownloadContainerLoader::DeleteProgressiveDownloadContainer(ProtocolContainer* aContainer) { if (NULL == aContainer) return false; // Retrieve shared library pointer OsclSharedLibrary* aSharedLibrary = aContainer->GetSharedLibraryPtr(); bool bStatus = false; if (NULL != aSharedLibrary) { // Query for release function OsclAny* interfacePtr = NULL; aSharedLibrary->QueryInterface(PENODE_SHARED_LIBRARY_INTERFACE, (OsclAny*&)interfacePtr); ProtocolEngineNodeSharedLibraryInterface* libIntPtr = OSCL_DYNAMIC_CAST(ProtocolEngineNodeSharedLibraryInterface*, interfacePtr); OsclAny* releaseFuncTemp = libIntPtr->QueryLibInterface(PENODE_RELEASE_LIB_INTERFACE); if (!releaseFuncTemp) return false; LPFN_LIB_RELEASE_FUNC libReleaseFunc = OSCL_DYNAMIC_CAST(bool (*)(ProtocolContainer*), releaseFuncTemp); if (NULL != libReleaseFunc) { bStatus = (*(libReleaseFunc))(aContainer); } aSharedLibrary->RemoveRef(); if (OsclLibSuccess == aSharedLibrary->Close()) { // Close will unload the library if refcount is 0 OSCL_DELETE(aSharedLibrary); } }
// 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; }
bool StreamingNodesCoreLibraryLoader::DeleteStreamingManagerNode(PVMFNodeInterface* aNode) { bool bStatus = false; OsclSharedLibrary* streamingSharedLibrary = NULL; if (NULL == aNode) { return false; } // Retrieve shared library pointer streamingSharedLibrary = aNode->GetSharedLibraryPtr(); if (NULL != streamingSharedLibrary) { // Query fro release function OsclAny* interfacePtr = NULL; streamingSharedLibrary->QueryInterface(PV_NODE_INTERFACE, (OsclAny*&)interfacePtr); NodeSharedLibraryInterface* nodeIntPtr = OSCL_DYNAMIC_CAST(NodeSharedLibraryInterface*, interfacePtr); OsclAny* releaseFuncTemp = nodeIntPtr->QueryNodeInterface(KPVMFRTSPStreamingModuleUuid, PV_RELEASE_NODE_INTERFACE); LPFN_NODE_RELEASE_FUNC nodeReleaseFunc = OSCL_DYNAMIC_CAST(bool (*)(PVMFNodeInterface*), releaseFuncTemp); if (NULL != nodeReleaseFunc) { bStatus = (*(nodeReleaseFunc))(aNode); } streamingSharedLibrary->RemoveRef(); if (OsclLibSuccess == streamingSharedLibrary->Close()) { // Close will unload the library if refcount is 0 OSCL_DELETE(streamingSharedLibrary); } }