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 #ifndef PVMF_STREAMING_MANAGER_NODE_H_INCLUDED 19 #define PVMF_STREAMING_MANAGER_NODE_H_INCLUDED 20 21 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED 22 #include "pvmf_node_interface.h" 23 #endif 24 25 #ifndef PVMF_NODE_UTILS_H_INCLUDED 26 #include "pvmf_node_utils.h" 27 #endif 28 29 #ifndef PVMF_DATA_SOURCE_INIT_EXTENSION_H_INCLUDED 30 #include "pvmf_data_source_init_extension.h" 31 #endif 32 33 #ifndef PVMF_SM_FSP_BASE_IMPL_H 34 #include "pvmf_sm_fsp_base_impl.h" 35 #endif 36 37 #ifndef PVLOGGER_H_INCLUDED 38 #include "pvlogger.h" 39 #endif 40 41 class PVMFSMFSPRegistry; 42 43 //Logging macros 44 #define PVMF_SM_LOGERROR(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_ERR,m); 45 #define PVMF_SM_LOGINFOHI(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG,iLogger,PVLOGMSG_NOTICE,m); 46 #define PVMF_SM_LOGINFOMED(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_MLDBG,iLogger,PVLOGMSG_INFO,m); 47 #define PVMF_SM_LOGSTACKTRACE(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG,iLogger,PVLOGMSG_STACK_TRACE,m); 48 49 typedef PVMFGenericNodeCommand <OsclMemAllocator> PVMFStreamingManagerNodeCommand; 50 typedef PVMFNodeCommandQueue<PVMFStreamingManagerNodeCommand, OsclMemAllocator> PVMFStreamingManagerNodeCmdQ; 51 52 /* Default vector reserve size */ 53 #define PVMF_STREAMING_MANAGER_NODE_COMMAND_ID_START 9000 54 #define PVMF_STREAMING_MANAGER_VECTOR_RESERVE 10 55 56 /////////////////////////////////////////////// 57 //IDs for all of the asynchronous node commands. 58 /////////////////////////////////////////////// 59 enum TPVMFStreamingManagerNodeCommand 60 { 61 PVMF_STREAMING_MANAGER_NODE_QUERYINTERFACE = PVMF_GENERIC_NODE_QUERYINTERFACE, 62 PVMF_STREAMING_MANAGER_NODE_RESET = PVMF_GENERIC_NODE_RESET, 63 PVMF_STREAMING_MANAGER_NODE_CANCELALLCOMMANDS = PVMF_GENERIC_NODE_CANCELALLCOMMANDS, 64 PVMF_STREAMING_MANAGER_NODE_CANCELCOMMAND = PVMF_GENERIC_NODE_CANCELCOMMAND, 65 PVMF_STREAMING_MANAGER_NODE_COMMAND_LAST 66 }; 67 68 class PVMFStreamingManagerNode : public PVMFNodeInterface, 69 public OsclActiveObject, 70 public PVMFDataSourceInitializationExtensionInterface 71 { 72 public: 73 OSCL_IMPORT_REF static PVMFStreamingManagerNode* New(int32 aPriority); 74 OSCL_IMPORT_REF virtual ~PVMFStreamingManagerNode(); 75 76 /* From PVMFNodeInterface */ 77 OSCL_IMPORT_REF PVMFStatus ThreadLogon(); 78 OSCL_IMPORT_REF PVMFStatus ThreadLogoff(); 79 virtual PVMFSessionId Connect(const PVMFNodeSessionInfo &aSession); 80 virtual PVMFStatus Disconnect(PVMFSessionId aSessionId); 81 virtual TPVMFNodeInterfaceState GetState() 82 { 83 if (iSMFSPlugin) 84 return iSMFSPlugin->GetState(); 85 return PVMFNodeInterface::GetState(); 86 } 87 OSCL_IMPORT_REF PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability); 88 OSCL_IMPORT_REF PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL); 89 OSCL_IMPORT_REF PVMFCommandId QueryUUID(PVMFSessionId, 90 const PvmfMimeString& aMimeType, 91 Oscl_Vector< PVUuid, OsclMemAllocator >& aUuids, 92 bool aExactUuidsOnly = false, 93 const OsclAny* aContext = NULL); 94 OSCL_IMPORT_REF PVMFCommandId QueryInterface(PVMFSessionId, const PVUuid& aUuid, 95 PVInterface*& aInterfacePtr, 96 const OsclAny* aContext = NULL); 97 OSCL_IMPORT_REF PVMFCommandId RequestPort(PVMFSessionId, 98 int32 aPortTag, 99 const PvmfMimeString* aPortConfig = NULL, 100 const OsclAny* aContext = NULL); 101 OSCL_IMPORT_REF PVMFCommandId ReleasePort(PVMFSessionId, 102 PVMFPortInterface& aPort, 103 const OsclAny* aContext = NULL); 104 OSCL_IMPORT_REF PVMFCommandId Init(PVMFSessionId, 105 const OsclAny* aContext = NULL); 106 OSCL_IMPORT_REF PVMFCommandId Prepare(PVMFSessionId, 107 const OsclAny* aContext = NULL); 108 OSCL_IMPORT_REF PVMFCommandId Start(PVMFSessionId, 109 const OsclAny* aContext = NULL); 110 OSCL_IMPORT_REF PVMFCommandId Stop(PVMFSessionId, 111 const OsclAny* aContext = NULL); 112 OSCL_IMPORT_REF PVMFCommandId Flush(PVMFSessionId, 113 const OsclAny* aContext = NULL); 114 OSCL_IMPORT_REF PVMFCommandId Pause(PVMFSessionId, 115 const OsclAny* aContext = NULL); 116 OSCL_IMPORT_REF PVMFCommandId Reset(PVMFSessionId, 117 const OsclAny* aContext = NULL); 118 OSCL_IMPORT_REF PVMFCommandId CancelAllCommands(PVMFSessionId, 119 const OsclAny* aContextData = NULL); 120 OSCL_IMPORT_REF PVMFCommandId CancelCommand(PVMFSessionId, 121 PVMFCommandId aCmdId, 122 const OsclAny* aContextData = NULL); 123 124 /* From PVMFPortActivityHandler */ 125 void HandlePortActivity(const PVMFPortActivity& aActivity); 126 127 /* From PVMFDataSourceInitializationExtensionInterface */ 128 virtual PVMFStatus SetSourceInitializationData(OSCL_wString& aSourceURL, 129 PVMFFormatType& aSourceFormat, 130 OsclAny* aSourceData); 131 virtual PVMFStatus SetClientPlayBackClock(PVMFMediaClock* aClientClock); 132 virtual PVMFStatus SetEstimatedServerClock(PVMFMediaClock* aClientClock); 133 private: 134 /* From OsclActiveObject */ 135 void Run(); 136 void DoCancel(); 137 void Construct(); 138 void addRef(); 139 void removeRef(); 140 141 OSCL_IMPORT_REF PVMFStreamingManagerNode(int32 aPriority); 142 bool ProcessCommand(PVMFStreamingManagerNodeCommand&); 143 PVMFCommandId QueueCommandL(PVMFStreamingManagerNodeCommand&); 144 145 bool queryInterface(const PVUuid& uuid, PVInterface*& iface); 146 void DoQueryInterface(PVMFStreamingManagerNodeCommand&); 147 bool DoCancelAllCommands(PVMFStreamingManagerNodeCommand& aCmdQ); 148 void CommandComplete(PVMFStreamingManagerNodeCmdQ& aCmdQ, 149 PVMFStreamingManagerNodeCommand& aCmd, 150 PVMFStatus aStatus, 151 OsclAny* aEventData = NULL, 152 PVUuid* aEventUUID = NULL, 153 int32* aEventCode = NULL); 154 155 PVMFStreamingManagerNodeCmdQ iInputCommands; 156 157 PVMFDataSourceInitializationExtensionInterface* iFSPDataSourceInitializationIntf; 158 PVMFSMFSPRegistry* iSMFSPRegistry; 159 PVMFSMFSPBaseNode* iSMFSPlugin; 160 PVUuid iFSPUuid; 161 PVMFNodeSession iUpstreamSession; 162 PVLogger * iLogger; 163 }; 164 165 #endif 166 167 168