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 #include "pvmf_node_shared_lib_interface.h" 19 20 #include "pvmf_downloadmanager_factory.h" 21 22 #include "osclconfig.h" 23 24 class DownloadNodesInterface: public OsclSharedLibraryInterface, 25 public NodeSharedLibraryInterface 26 { 27 public: DownloadNodesInterface()28 DownloadNodesInterface() {}; 29 30 // From NodeSharedLibraryInterface QueryNodeInterface(const PVUuid & aNodeUuid,const OsclUuid & aInterfaceId)31 OsclAny* QueryNodeInterface(const PVUuid& aNodeUuid, const OsclUuid& aInterfaceId) 32 { 33 if (KPVMFDownloadManagerNodeUuid == aNodeUuid) 34 { 35 if (PV_CREATE_NODE_INTERFACE == aInterfaceId) 36 { 37 return ((OsclAny*)(PVMFDownloadManagerNodeFactory::CreatePVMFDownloadManagerNode)); 38 } 39 else if (PV_RELEASE_NODE_INTERFACE == aInterfaceId) 40 { 41 return ((OsclAny*)(PVMFDownloadManagerNodeFactory::DeletePVMFDownloadManagerNode)); 42 } 43 } 44 45 return NULL; 46 }; 47 48 // From OsclSharedLibraryInterface SharedLibraryLookup(const OsclUuid & aInterfaceId)49 OsclAny* SharedLibraryLookup(const OsclUuid& aInterfaceId) 50 { 51 if (aInterfaceId == PV_NODE_INTERFACE) 52 { 53 return OSCL_STATIC_CAST(NodeSharedLibraryInterface*, this); 54 } 55 return NULL; 56 }; 57 }; 58 59 60 extern "C" 61 { PVGetInterface(void)62 OSCL_EXPORT_REF OsclSharedLibraryInterface* PVGetInterface(void) 63 { 64 return OSCL_NEW(DownloadNodesInterface, ()); 65 } PVReleaseInterface(OsclSharedLibraryInterface * aInstance)66 OSCL_EXPORT_REF void PVReleaseInterface(OsclSharedLibraryInterface* aInstance) 67 { 68 OSCL_DELETE(aInstance); 69 } 70 } 71 72