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_AMRFFPARSER_NODE_H_INCLUDED 19 #define PVMF_AMRFFPARSER_NODE_H_INCLUDED 20 21 #ifndef OSCL_BASE_H_INCLUDED 22 #include "oscl_base.h" 23 #endif 24 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED 25 #include "oscl_scheduler_ao.h" 26 #endif 27 #ifndef OSCL_FILE_IO_H_INCLUDED 28 #include "oscl_file_io.h" 29 #endif 30 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED 31 #include "pvmf_format_type.h" 32 #endif 33 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED 34 #include "pvmf_node_interface.h" 35 #endif 36 #ifndef PVMF_MEDIA_DATA_H_INCLUDED 37 #include "pvmf_media_data.h" 38 #endif 39 #ifndef OSCL_MEM_MEMPOOL_H_INCLUDED 40 #include "oscl_mem_mempool.h" 41 #endif 42 #ifndef PVMF_MEMPOOL_H_INCLUDED 43 #include "pvmf_mempool.h" 44 #endif 45 #ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED 46 #include "pvmf_simple_media_buffer.h" 47 #endif 48 #ifndef PVMF_DATA_SOURCE_INIT_EXTENSION_H_INCLUDED 49 #include "pvmf_data_source_init_extension.h" 50 #endif 51 #ifndef PVMF_TRACK_SELECTION_EXTENSION_H_INCLUDED 52 #include "pvmf_track_selection_extension.h" 53 #endif 54 #ifndef PVMF_MEDIA_PRESENTATION_INFO_H_INCLUDED 55 #include "pvmf_media_presentation_info.h" 56 #endif 57 #ifndef PVMF_NODE_UTILS_H_INCLUDED 58 #include "pvmf_node_utils.h" 59 #endif 60 #ifndef AMRFILEPARSER_H_INCLUDED 61 #include "amrfileparser.h" 62 #endif 63 #ifndef PVMF_META_DATA_EXTENSION_H_INCLUDED 64 #include "pvmf_meta_data_extension.h" 65 #endif 66 #ifndef PVMF_DATA_SOURCE_PLAYBACK_CONTROL_H_INCLUDED 67 #include "pvmf_data_source_playback_control.h" 68 #endif 69 #ifndef PVMF_LOCAL_DATA_SOURCE_H_INCLUDED 70 #include "pvmf_local_data_source.h" 71 #endif 72 73 #ifndef PVMF_FORMAT_PROGDOWNLOAD_SUPPORT_EXTENSION_H_INCLUDED 74 #include "pvmf_format_progdownload_support_extension.h" 75 #endif 76 77 #ifndef PVMF_DOWNLOAD_PROGRESS_EXTENSION_H 78 #include "pvmf_download_progress_interface.h" 79 #endif 80 81 #ifndef PVMI_DATASTREAMUSER_INTERFACE_H_INCLUDED 82 #include "pvmi_datastreamuser_interface.h" 83 #endif 84 85 #ifndef PVMF_AMRFFPARSER_PORT_H_INCLUDED 86 #include "pvmf_amrffparser_port.h" 87 #endif 88 89 #ifndef PVMF_CPMPLUGIN_LICENSE_INTERFACE_H_INCLUDED 90 #include "pvmf_cpmplugin_license_interface.h" 91 #endif 92 93 #define PVMF_AMR_PARSER_NODE_NEW(auditCB,T,params,ptr)\ 94 {\ 95 ptr = OSCL_NEW(T,params);\ 96 } 97 98 #define PVMF_AMR_PARSER_NODE_DELETE(auditCB,T,ptr)\ 99 {\ 100 OSCL_DELETE(ptr);\ 101 } 102 103 #define PVMF_AMR_PARSER_NODE_TEMPLATED_DELETE(auditCB, T, Tsimple, ptr)\ 104 {\ 105 OSCL_DELETE(ptr);\ 106 } 107 108 #define PV_AMR_PARSER_NODE_ARRAY_NEW(auditCB, T, count, ptr)\ 109 {\ 110 ptr = OSCL_ARRAY_NEW(T, count);\ 111 } 112 113 #define PV_AMR_PARSER_NODE_ARRAY_DELETE(auditCB, ptr)\ 114 {\ 115 OSCL_ARRAY_DELETE(ptr);\ 116 } 117 118 119 typedef PVMFGenericNodeCommand<OsclMemAllocator> PVMFAMRFFNodeCommandBase; 120 121 /* Default vector reserve size */ 122 #define PVMF_AMR_PARSER_NODE_VECTOR_RESERVE 10 123 /* Starting value for command IDs */ 124 #define PVMF_AMR_PARSER_NODE_COMMAND_ID_START 9000 125 126 enum TPVMFAMRParserNodeCommand 127 { 128 PVMF_AMR_PARSER_NODE_QUERYUUID, 129 PVMF_AMR_PARSER_NODE_QUERYINTERFACE, 130 PVMF_AMR_PARSER_NODE_REQUESTPORT, 131 PVMF_AMR_PARSER_NODE_RELEASEPORT, 132 PVMF_AMR_PARSER_NODE_INIT, 133 PVMF_AMR_PARSER_NODE_PREPARE, 134 PVMF_AMR_PARSER_NODE_START, 135 PVMF_AMR_PARSER_NODE_STOP, 136 PVMF_AMR_PARSER_NODE_FLUSH, 137 PVMF_AMR_PARSER_NODE_PAUSE, 138 PVMF_AMR_PARSER_NODE_RESET, 139 PVMF_AMR_PARSER_NODE_CANCELALLCOMMANDS, 140 PVMF_AMR_PARSER_NODE_CANCELCOMMAND, 141 PVMF_AMR_PARSER_NODE_SET_DATASOURCE_POSITION, 142 PVMF_AMR_PARSER_NODE_QUERY_DATASOURCE_POSITION, 143 PVMF_AMR_PARSER_NODE_SET_DATASOURCE_RATE, 144 PVMF_AMR_PARSER_NODE_GETNODEMETADATAKEYS, 145 PVMF_AMR_PARSER_NODE_GETNODEMETADATAVALUES, 146 PVMF_AMR_PARSER_NODE_SET_DATASOURCE_DIRECTION, 147 PVMF_AMR_PARSER_NODE_GET_LICENSE_W, 148 PVMF_AMR_PARSER_NODE_GET_LICENSE, 149 PVMF_AMR_PARSER_NODE_CMD_CANCEL_GET_LICENSE, 150 PVMF_AMR_PARSER_NODE_COMMAND_LAST 151 }; 152 153 #define PVMF_AMR_PARSER_NODE_MAX_CPM_METADATA_KEYS 256 154 155 class PVMFAMRFFNodeCommand : public PVMFAMRFFNodeCommandBase 156 { 157 public: 158 159 // Constructor and parser for GetNodeMetadataKeys 160 void Construct(PVMFSessionId s, int32 cmd 161 , PVMFMetadataList& aKeyList 162 , uint32 aStartingIndex 163 , int32 aMaxEntries 164 , char* aQueryKey 165 , const OsclAny* aContext) 166 { 167 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 168 iParam1 = (OsclAny*) & aKeyList; 169 iParam2 = (OsclAny*)aStartingIndex; 170 iParam3 = (OsclAny*)aMaxEntries; 171 iParam4 = (OsclAny*)aQueryKey; 172 } 173 void Parse(PVMFMetadataList*& MetaDataListPtr, uint32 &aStartingIndex, int32 &aMaxEntries, char*& aQueryKey) 174 { 175 MetaDataListPtr = (PVMFMetadataList*)iParam1; 176 aStartingIndex = (uint32)iParam2; 177 aMaxEntries = (int32)iParam3; 178 aQueryKey = (char*)iParam4; 179 } 180 181 // Constructor and parser for GetNodeMetadataValue 182 void Construct(PVMFSessionId s, int32 cmd, PVMFMetadataList& aKeyList, Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, uint32 aStartIndex, int32 aMaxEntries, const OsclAny* aContext) 183 { 184 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 185 iParam1 = (OsclAny*) & aKeyList; 186 iParam2 = (OsclAny*) & aValueList; 187 iParam3 = (OsclAny*)aStartIndex; 188 iParam4 = (OsclAny*)aMaxEntries; 189 190 } 191 void Parse(PVMFMetadataList* &aKeyList, Oscl_Vector<PvmiKvp, OsclMemAllocator>* &aValueList, uint32 &aStartingIndex, int32 &aMaxEntries) 192 { 193 aKeyList = (PVMFMetadataList*)iParam1; 194 aValueList = (Oscl_Vector<PvmiKvp, OsclMemAllocator>*)iParam2; 195 aStartingIndex = (uint32)iParam3; 196 aMaxEntries = (int32)iParam4; 197 } 198 199 // Constructor and parser for SetDataSourcePosition 200 void Construct(PVMFSessionId s, int32 cmd, PVMFTimestamp aTargetNPT, PVMFTimestamp& aActualNPT, PVMFTimestamp& aActualMediaDataTS, 201 bool aSeekToSyncPoint, uint32 aStreamID, const OsclAny*aContext) 202 { 203 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 204 iParam1 = (OsclAny*)aTargetNPT; 205 iParam2 = (OsclAny*) & aActualNPT; 206 iParam3 = (OsclAny*) & aActualMediaDataTS; 207 iParam4 = (OsclAny*)aSeekToSyncPoint; 208 iParam5 = (OsclAny*)aStreamID; 209 } 210 void Parse(PVMFTimestamp& aTargetNPT, PVMFTimestamp*& aActualNPT, PVMFTimestamp*& aActualMediaDataTS, bool& aSeekToSyncPoint, uint32& aStreamID) 211 { 212 aTargetNPT = (PVMFTimestamp)iParam1; 213 aActualNPT = (PVMFTimestamp*)iParam2; 214 aActualMediaDataTS = (PVMFTimestamp*)iParam3; 215 aSeekToSyncPoint = (iParam4) ? true : false; 216 aStreamID = (uint32)iParam5; 217 } 218 219 // Constructor and parser for QueryDataSourcePosition 220 void Construct(PVMFSessionId s, int32 cmd, PVMFTimestamp aTargetNPT, PVMFTimestamp& aActualNPT, bool aSeekToSyncPoint, const OsclAny*aContext) 221 { 222 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 223 iParam1 = (OsclAny*)aTargetNPT; 224 iParam2 = (OsclAny*) & aActualNPT; 225 iParam3 = (OsclAny*)aSeekToSyncPoint; 226 iParam4 = NULL; 227 iParam5 = NULL; 228 } 229 void Parse(PVMFTimestamp& aTargetNPT, PVMFTimestamp*& aActualNPT, bool& aSeekToSyncPoint) 230 { 231 aTargetNPT = (PVMFTimestamp)iParam1; 232 aActualNPT = (PVMFTimestamp*)iParam2; 233 aSeekToSyncPoint = (iParam3) ? true : false; 234 } 235 236 // Constructor and parser for SetDataSourceRate 237 void Construct(PVMFSessionId s, int32 cmd, int32 aRate, PVMFTimebase* aTimebase, const OsclAny*aContext) 238 { 239 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 240 iParam1 = (OsclAny*)aRate; 241 iParam2 = (OsclAny*)aTimebase; 242 iParam3 = NULL; 243 iParam4 = NULL; 244 iParam5 = NULL; 245 } 246 void Parse(int32& aRate, PVMFTimebase*& aTimebase) 247 { 248 aRate = (int32)iParam1; 249 aTimebase = (PVMFTimebase*)iParam2; 250 } 251 252 /* need to overlaod the base Destroy routine to cleanup metadata key. */ 253 void Destroy() 254 { 255 PVMFGenericNodeCommand<PVMFAMRParserNodeAllocator>::Destroy(); 256 switch (iCmd) 257 { 258 case PVMF_AMR_PARSER_NODE_GETNODEMETADATAKEYS: 259 if (iParam4) 260 { 261 /* cleanup the allocated string */ 262 Oscl_TAlloc<OSCL_HeapString<PVMFAMRParserNodeAllocator>, PVMFAMRParserNodeAllocator> str; 263 str.destruct_and_dealloc(iParam4); 264 } 265 break; 266 default: 267 break; 268 } 269 } 270 /* need to overlaod the base Copy routine to copy metadata key. */ 271 void Copy(const PVMFGenericNodeCommand<PVMFAMRParserNodeAllocator>& aCmd) 272 { 273 PVMFGenericNodeCommand<PVMFAMRParserNodeAllocator>::Copy(aCmd); 274 switch (aCmd.iCmd) 275 { 276 case PVMF_AMR_PARSER_NODE_GETNODEMETADATAKEYS: 277 if (aCmd.iParam4) 278 { 279 /* copy the allocated string */ 280 OSCL_HeapString<PVMFAMRParserNodeAllocator>* aStr = 281 (OSCL_HeapString<PVMFAMRParserNodeAllocator>*)aCmd.iParam4; 282 Oscl_TAlloc<OSCL_HeapString<PVMFAMRParserNodeAllocator>, PVMFAMRParserNodeAllocator> str; 283 iParam4 = str.alloc_and_construct(*aStr); 284 } 285 break; 286 default: 287 break; 288 } 289 } 290 291 /* Constructor and parser for GetLicenseW */ 292 void Construct(PVMFSessionId s, 293 int32 cmd, 294 OSCL_wString& aContentName, 295 OsclAny* aLicenseData, 296 uint32 aDataSize, 297 int32 aTimeoutMsec, 298 OsclAny* aContext) 299 { 300 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 301 iParam1 = (OsclAny*) & aContentName; 302 iParam2 = (OsclAny*)aLicenseData; 303 iParam3 = (OsclAny*)aDataSize; 304 iParam4 = (OsclAny*)aTimeoutMsec; 305 iParam5 = NULL; 306 } 307 void Parse(OSCL_wString*& aContentName, 308 OsclAny*& aLicenseData, 309 uint32& aDataSize, 310 int32& aTimeoutMsec) 311 { 312 aContentName = (OSCL_wString*)iParam1; 313 aLicenseData = (PVMFTimestamp*)iParam2; 314 aDataSize = (uint32)iParam3; 315 aTimeoutMsec = (int32)iParam4; 316 } 317 318 /* Constructor and parser for GetLicense */ 319 void Construct(PVMFSessionId s, 320 int32 cmd, 321 OSCL_String& aContentName, 322 OsclAny* aLicenseData, 323 uint32 aDataSize, 324 int32 aTimeoutMsec, 325 OsclAny* aContext) 326 { 327 PVMFAMRFFNodeCommandBase::Construct(s, cmd, aContext); 328 iParam1 = (OsclAny*) & aContentName; 329 iParam2 = (OsclAny*)aLicenseData; 330 iParam3 = (OsclAny*)aDataSize; 331 iParam4 = (OsclAny*)aTimeoutMsec; 332 iParam5 = NULL; 333 } 334 void Parse(OSCL_String*& aContentName, 335 OsclAny*& aLicenseData, 336 uint32& aDataSize, 337 int32& aTimeoutMsec) 338 { 339 aContentName = (OSCL_String*)iParam1; 340 aLicenseData = (PVMFTimestamp*)iParam2; 341 aDataSize = (uint32)iParam3; 342 aTimeoutMsec = (int32)iParam4; 343 } 344 }; 345 346 347 typedef PVMFNodeCommandQueue<PVMFAMRFFNodeCommand, OsclMemAllocator> PVMFAMRFFNodeCmdQ; 348 349 350 /** 351 * Track/Port information 352 */ 353 class MediaClockConverter; 354 class PVMFAMRFFParserNode; 355 356 357 /** 358 * Container for the CPM object 359 */ 360 361 #ifndef CPM_H_INCLUDED 362 #include "cpm.h" 363 #endif 364 365 //memory allocator type for this node. 366 typedef OsclMemAllocator PVMFAMRFFNodeAllocator; 367 368 /** 369 * The node class 370 */ 371 //typedef PVMFNodeCommandQueue<PVMFAMRFFNodeCommand, PVMFAMRParserNodeAllocator> PVMFAMRParserNodeCmdQueue; 372 class CAMRFileParser; 373 class PVMFAMRFFParserOutPort; 374 class PVLogger; 375 376 class PVMFAMRFFParserNode : public OsclTimerObject 377 , public PVMFNodeInterface 378 , public PVMFDataSourceInitializationExtensionInterface 379 , public PVMFTrackSelectionExtensionInterface 380 , public PvmfDataSourcePlaybackControlInterface 381 , public PVMFMetadataExtensionInterface 382 , public PVMFCPMStatusObserver 383 , public PVMIDatastreamuserInterface 384 , public PvmiDataStreamObserver 385 , public PVMFFormatProgDownloadSupportInterface 386 , public PVMFCPMPluginLicenseInterface 387 { 388 public: 389 PVMFAMRFFParserNode(int32 aPriority = OsclActiveObject::EPriorityNominal); 390 ~PVMFAMRFFParserNode(); 391 392 // From PVMFNodeInterface 393 PVMFStatus ThreadLogon(); 394 PVMFStatus ThreadLogoff(); 395 PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability); 396 PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL); 397 PVMFCommandId QueryUUID(PVMFSessionId, const PvmfMimeString& aMimeType, 398 Oscl_Vector<PVUuid, PVMFAMRFFNodeAllocator>& aUuids, 399 bool aExactUuidsOnly = false, 400 const OsclAny* aContext = NULL); 401 402 PVMFCommandId QueryInterface(PVMFSessionId, const PVUuid& aUuid, 403 PVInterface*& aInterfacePtr, 404 const OsclAny* aContext = NULL); 405 406 virtual PVMFCommandId RequestPort(PVMFSessionId aSession, 407 int32 aPortTag, 408 const PvmfMimeString* aPortConfig = NULL, 409 const OsclAny* aContext = NULL); 410 411 PVMFCommandId ReleasePort(PVMFSessionId, PVMFPortInterface& aPort, const OsclAny* aContext = NULL); 412 PVMFCommandId Init(PVMFSessionId, const OsclAny* aContext = NULL); 413 PVMFCommandId Start(PVMFSessionId, const OsclAny* aContext = NULL); 414 PVMFCommandId Stop(PVMFSessionId, const OsclAny* aContext = NULL); 415 PVMFCommandId Flush(PVMFSessionId, const OsclAny* aContext = NULL); 416 PVMFCommandId Pause(PVMFSessionId, const OsclAny* aContext = NULL); 417 PVMFCommandId Reset(PVMFSessionId, const OsclAny* aContext = NULL); 418 PVMFCommandId Prepare(PVMFSessionId aSession, const OsclAny* aContext = NULL); 419 PVMFCommandId CancelAllCommands(PVMFSessionId, const OsclAny* aContextData = NULL); 420 PVMFCommandId CancelCommand(PVMFSessionId, PVMFCommandId aCmdId, const OsclAny* aContextData = NULL); 421 PVMFStatus QueryInterfaceSync(PVMFSessionId aSession, 422 const PVUuid& aUuid, 423 PVInterface*& aInterfacePtr); 424 425 /* From PVInterface */ 426 void addRef(); 427 void removeRef(); 428 bool queryInterface(const PVUuid& uuid, PVInterface *& iface); 429 //From PVMFDataSourceInitializationExtensionInterface 430 PVMFStatus SetSourceInitializationData(OSCL_wString& aSourceURL, PVMFFormatType& aSourceFormat, OsclAny* aSourceData); 431 PVMFStatus SetClientPlayBackClock(PVMFMediaClock* aClientClock); 432 PVMFStatus SetEstimatedServerClock(PVMFMediaClock* aClientClock); 433 434 //From PVMFTrackSelectionExtensionInterface 435 PVMFStatus GetMediaPresentationInfo(PVMFMediaPresentationInfo& aInfo); 436 PVMFStatus SelectTracks(PVMFMediaPresentationInfo& aInfo); 437 438 // From PVMFMetadataExtensionInterface 439 uint32 GetNumMetadataKeys(char* aQueryKeyString = NULL); 440 uint32 GetNumMetadataValues(PVMFMetadataList& aKeyList); 441 PVMFCommandId GetNodeMetadataKeys(PVMFSessionId aSessionId, PVMFMetadataList& aKeyList 442 , uint32 aStartingKeyIndex, int32 aMaxKeyEntries, char* aQueryKeyString = NULL, const OsclAny* aContextData = NULL); 443 PVMFCommandId GetNodeMetadataValues(PVMFSessionId aSessionId, PVMFMetadataList& aKeyList 444 , Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, uint32 aStartingValueIndex, int32 aMaxValueEntries, const OsclAny* aContextData = NULL); 445 PVMFStatus ReleaseNodeMetadataKeys(PVMFMetadataList& aKeyList, uint32 aStartingKeyIndex, uint32 aEndKeyIndex); 446 PVMFStatus ReleaseNodeMetadataValues(Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, uint32 aStartingValueIndex, uint32 aEndValueIndex); 447 448 // From PvmfDataSourcePlaybackControlInterface 449 PVMFCommandId SetDataSourcePosition(PVMFSessionId aSessionId 450 , PVMFTimestamp aTargetNPT 451 , PVMFTimestamp& aActualNPT 452 , PVMFTimestamp& aActualMediaDataTS 453 , bool aSeekToSyncPoint = true 454 , uint32 aStreamID = 0 455 , OsclAny* aContext = NULL); 456 457 PVMFCommandId QueryDataSourcePosition(PVMFSessionId aSessionId 458 , PVMFTimestamp aTargetNPT 459 , PVMFTimestamp& aActualNPT 460 , bool aSeekToSyncPoint = true 461 , OsclAny* aContext = NULL); 462 463 PVMFCommandId QueryDataSourcePosition(PVMFSessionId aSessionId 464 , PVMFTimestamp aTargetNPT 465 , PVMFTimestamp& aSeekPointBeforeTargetNPT 466 , PVMFTimestamp& aSeekPointAfterTargetNPT 467 , OsclAny* aContext = NULL 468 , bool aSeekToSyncPoint = true); 469 470 PVMFCommandId SetDataSourceRate(PVMFSessionId aSession 471 , int32 aRate 472 , PVMFTimebase* aTimebase = NULL 473 , OsclAny* aContext = NULL); 474 475 /* From PVMIDatastreamuserInterface */ 476 void PassDatastreamFactory(PVMFDataStreamFactory& aFactory, 477 int32 aFactoryTag, 478 const PvmfMimeString* aFactoryConfig = NULL); 479 480 void PassDatastreamReadCapacityObserver(PVMFDataStreamReadCapacityObserver* aObserver); 481 482 /* From PVMFFormatProgDownloadSupportInterface */ 483 int32 convertSizeToTime(uint32 fileSize, uint32& aNPTInMS); 484 void setFileSize(const uint32 aFileSize); 485 void setDownloadProgressInterface(PVMFDownloadProgressInterface*); 486 void playResumeNotification(bool aDownloadComplete); 487 void notifyDownloadComplete() 488 { 489 playResumeNotification(true); 490 }; 491 492 /* From PvmiDataStreamObserver */ 493 void DataStreamCommandCompleted(const PVMFCmdResp& aResponse); 494 void DataStreamInformationalEvent(const PVMFAsyncEvent& aEvent); 495 void DataStreamErrorEvent(const PVMFAsyncEvent& aEvent); 496 497 //from PVMFPortActivityHandler 498 void HandlePortActivity(const PVMFPortActivity& aActivity); 499 500 /* From PVMFCPMPluginLicenseInterface */ 501 PVMFStatus GetLicenseURL(PVMFSessionId aSessionId, 502 OSCL_wString& aContentName, 503 OSCL_wString& aLicenseURL) 504 { 505 OSCL_UNUSED_ARG(aSessionId); 506 OSCL_UNUSED_ARG(aContentName); 507 OSCL_UNUSED_ARG(aLicenseURL); 508 //must use Async method. 509 return PVMFErrNotSupported; 510 } 511 PVMFStatus GetLicenseURL(PVMFSessionId aSessionId, 512 OSCL_String& aContentName, 513 OSCL_String& aLicenseURL) 514 { 515 OSCL_UNUSED_ARG(aSessionId); 516 OSCL_UNUSED_ARG(aContentName); 517 OSCL_UNUSED_ARG(aLicenseURL); 518 //must use Async method. 519 return PVMFErrNotSupported; 520 } 521 522 PVMFCommandId GetLicense(PVMFSessionId aSessionId, 523 OSCL_wString& aContentName, 524 OsclAny* aData, 525 uint32 aDataSize, 526 int32 aTimeoutMsec, 527 OsclAny* aContextData) ; 528 529 PVMFCommandId GetLicense(PVMFSessionId aSessionId, 530 OSCL_String& aContentName, 531 OsclAny* aData, 532 uint32 aDataSize, 533 int32 aTimeoutMsec, 534 OsclAny* aContextData); 535 536 PVMFCommandId CancelGetLicense(PVMFSessionId aSessionId 537 , PVMFCommandId aCmdId 538 , OsclAny* aContextData); 539 540 private: 541 void Construct(); 542 void Run(); 543 //Command processing 544 PVMFCommandId QueueCommandL(PVMFAMRFFNodeCommand& aCmd); 545 546 void MoveCmdToCurrentQueue(PVMFAMRFFNodeCommand& aCmd); 547 void MoveCmdToCancelQueue(PVMFAMRFFNodeCommand& aCmd); 548 bool ProcessCommand(); 549 void CommandComplete(PVMFAMRFFNodeCmdQ& aCmdQueue, 550 PVMFAMRFFNodeCommand& aCmd, 551 PVMFStatus aStatus, 552 OsclAny* aData = NULL, 553 PVUuid* aEventUUID = NULL, 554 int32* aEventCode = NULL, 555 PVInterface* aExtMsg = NULL); 556 557 void CommandComplete(PVMFAMRFFNodeCmdQ&, PVMFAMRFFNodeCommand&, PVMFStatus, PVInterface*, OsclAny* aData); 558 bool FlushPending(); 559 //Command handlers. 560 void DoQueryUuid(PVMFAMRFFNodeCommand&); 561 void DoQueryInterface(PVMFAMRFFNodeCommand&); 562 563 PVMFStatus DoInit(PVMFAMRFFNodeCommand&); 564 void CompleteInit(); 565 566 void DoPrepare(PVMFAMRFFNodeCommand&); 567 void DoStart(PVMFAMRFFNodeCommand&); 568 void DoStop(PVMFAMRFFNodeCommand&); 569 void DoPause(PVMFAMRFFNodeCommand&); 570 void DoFlush(PVMFAMRFFNodeCommand&); 571 572 void DoCancelAllCommands(PVMFAMRFFNodeCommand&); 573 void DoCancelCommand(PVMFAMRFFNodeCommand&); 574 575 void DoRequestPort(PVMFAMRFFNodeCommand&, PVMFPortInterface*&); 576 void DoReleasePort(PVMFAMRFFNodeCommand&); 577 578 void DoReset(PVMFAMRFFNodeCommand&); 579 void CompleteReset(); 580 581 // For metadata extention interface 582 PVMFStatus DoGetMetadataKeys(PVMFAMRFFNodeCommand& aCmd); 583 PVMFStatus DoGetMetadataValues(PVMFAMRFFNodeCommand& aCmd); 584 PVMFStatus InitMetaData(); 585 586 587 void CompleteGetMetaDataValues(); 588 int32 AddToValueList(Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, PvmiKvp& aNewValue); 589 PVMFStatus CompleteGetMetadataKeys(PVMFAMRFFNodeCommand& aCmd); 590 591 void PushToAvailableMetadataKeysList(const char* aKeystr, char* aOptionalParam = NULL); 592 Oscl_Vector<OSCL_HeapString<PVMFAMRParserNodeAllocator>, PVMFAMRParserNodeAllocator> iAvailableMetadataKeys; 593 Oscl_Vector<OSCL_HeapString<PVMFAMRParserNodeAllocator>, PVMFAMRParserNodeAllocator> iCPMMetadataKeys; 594 uint32 iAMRParserNodeMetadataValueCount; 595 596 // For data source position extension interface 597 PVMFStatus DoSetDataSourcePosition(PVMFAMRFFNodeCommand& aCmd); 598 PVMFStatus DoQueryDataSourcePosition(PVMFAMRFFNodeCommand& aCmd); 599 PVMFStatus DoSetDataSourceRate(PVMFAMRFFNodeCommand& aCmd); 600 601 /* For data source direction extension interface */ 602 void DoSetDataSourceDirection(PVMFAMRFFNodeCommand& aCmd); 603 int32 iPlayBackDirection; 604 605 // Event reporting 606 void ReportErrorEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, PVUuid* aEventUUID = NULL, int32* aEventCode = NULL); 607 void ReportInfoEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, PVUuid* aEventUUID = NULL, int32* aEventCode = NULL); 608 void SetState(TPVMFNodeInterfaceState); 609 610 // Track data processing 611 612 bool RetrieveTrackData(PVAMRFFNodeTrackPortInfo& aTrackPortInfo); 613 PVMFStatus RetrieveTrackData(PVAMRFFNodeTrackPortInfo& aTrackPortInfo, PVMFSharedMediaDataPtr& aMediaDataOut); 614 bool SendEndOfTrackCommand(PVAMRFFNodeTrackPortInfo& aTrackPortInfo); 615 PVMFStatus SendBeginOfMediaStreamCommand(PVAMRFFNodeTrackPortInfo* aTrackPortInfo); 616 bool CheckAvailabilityForSendingNewTrackData(PVAMRFFNodeTrackPortInfo& aTrackPortInfo); 617 void ResetAllTracks(); 618 bool ReleaseAllPorts(); 619 void CleanupFileSource(); 620 621 private: // private member variables 622 623 PVMFAMRFFNodeCmdQ iInputCommands; 624 PVMFAMRFFNodeCmdQ iCurrentCommand; 625 PVMFAMRFFNodeCmdQ iCancelCommand; 626 627 PVMFAMRFFParserOutPort* iOutPort; 628 friend class PVMFAMRFFParserOutPort; 629 void ProcessOutgoingMsg(); 630 631 /* Port processing */ 632 PVMFPortVector<PVMFAMRFFParserOutPort, PVMFAMRParserNodeAllocator> iPortVector; 633 bool ProcessPortActivity(PVAMRFFNodeTrackPortInfo*); 634 PVMFStatus RetrieveMediaSample(PVAMRFFNodeTrackPortInfo* aTrackInfoPtr, 635 PVMFSharedMediaDataPtr& aSharedPtr); 636 PVMFStatus QueueMediaSample(PVAMRFFNodeTrackPortInfo* aTrackInfoPtr); 637 PVMFStatus ProcessOutgoingMsg(PVAMRFFNodeTrackPortInfo* aTrackInfoPtr); 638 bool GetTrackInfo(PVMFPortInterface* aPort, 639 PVAMRFFNodeTrackPortInfo*& aTrackInfoPtr); 640 bool GetTrackInfo(int32 aTrackID, 641 PVAMRFFNodeTrackPortInfo*& aTrackInfoPtr); 642 PVMFStatus GenerateAndSendEOSCommand(PVAMRFFNodeTrackPortInfo* aTrackInfoPtr); 643 bool CheckForPortRescheduling(); 644 bool CheckForPortActivityQueues(); 645 int32 PushBackKeyVal(Oscl_Vector<PvmiKvp, OsclMemAllocator>*& aValueListPtr, PvmiKvp &aKeyVal); 646 PVMFStatus PushValueToList(Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> &aRefMetadataKeys, 647 PVMFMetadataList *&aKeyListPtr, 648 uint32 aLcv); 649 650 /* Progressive download related */ 651 PVMFStatus CheckForAMRHeaderAvailability(); 652 void PauseAllMediaRetrieval(); 653 uint64 iAMRHeaderSize; 654 bool iAutoPaused; 655 bool iDownloadComplete; 656 PVMFDownloadProgressInterface* iDownloadProgressInterface; 657 uint32 iDownloadFileSize; 658 PVMIDataStreamSyncInterface* iDataStreamInterface; 659 PVMFDataStreamFactory* iDataStreamFactory; 660 PVMFDataStreamReadCapacityObserver* iDataStreamReadCapacityObserver; 661 PvmiDataStreamSession iDataStreamSessionID; 662 PvmiDataStreamCommandId iRequestReadCapacityNotificationID; 663 uint32 iLastNPTCalcInConvertSizeToTime; 664 uint32 iFileSizeLastConvertedToTime; 665 666 PVMFNodeCapability iCapability; 667 PVLogger* iLogger; 668 PVLogger* iDataPathLogger; 669 PVLogger* iClockLogger; 670 671 OSCL_wHeapString<OsclMemAllocator> iSourceURL; 672 PVMFFormatType iSourceFormat; 673 Oscl_FileServer iFileServer; 674 bool iUseCPMPluginRegistry; 675 OsclFileHandle* iFileHandle; 676 PVMFLocalDataSource iCPMSourceData; 677 678 CAMRFileParser* iAMRParser; 679 TPVAmrFileInfo iAMRFileInfo; 680 bool oSourceIsCurrent; 681 682 // stream id 683 uint32 iStreamID; 684 // flaf for bos 685 bool iSendBOS; 686 687 Oscl_Vector<PVAMRFFNodeTrackPortInfo, OsclMemAllocator> iSelectedTrackList; 688 689 // Reference counter for extension 690 uint32 iExtensionRefCount; 691 692 693 /* Content Policy Manager related */ 694 bool iPreviewMode; 695 PVMFCPM* iCPM; 696 PVMFSessionId iCPMSessionID; 697 PVMFCPMContentType iCPMContentType; 698 PVMFCPMPluginAccessInterfaceFactory* iCPMContentAccessFactory; 699 PVMFMetadataExtensionInterface* iCPMMetaDataExtensionInterface; 700 PVMFCPMPluginLicenseInterface* iCPMLicenseInterface; 701 PVInterface* iCPMLicenseInterfacePVI; 702 PvmiKvp iRequestedUsage; 703 PvmiKvp iApprovedUsage; 704 PvmiKvp iAuthorizationDataKvp; 705 PVMFCPMUsageID iUsageID; 706 PVMFCommandId iCPMInitCmdId; 707 PVMFCommandId iCPMOpenSessionCmdId; 708 PVMFCommandId iCPMRegisterContentCmdId; 709 PVMFCommandId iCPMRequestUsageId; 710 PVMFCommandId iCPMUsageCompleteCmdId; 711 PVMFCommandId iCPMCloseSessionCmdId; 712 PVMFCommandId iCPMResetCmdId; 713 PVMFCommandId iCPMGetMetaDataKeysCmdId; 714 PVMFCommandId iCPMGetMetaDataValuesCmdId; 715 PVMFCommandId iCPMGetLicenseInterfaceCmdId; 716 PVMFCommandId iCPMGetLicenseCmdId; 717 PVMFCommandId iCPMCancelGetLicenseCmdId; 718 719 void InitCPM(); 720 void OpenCPMSession(); 721 void CPMRegisterContent(); 722 bool GetCPMContentAccessFactory(); 723 bool GetCPMMetaDataExtensionInterface(); 724 void RequestUsage(); 725 void SendUsageComplete(); 726 void CloseCPMSession(); 727 void ResetCPM(); 728 void PopulateDRMInfo(); 729 void GetCPMMetaDataKeys(); 730 void GetCPMMetaDataValues(); 731 void GetCPMLicenseInterface(); 732 PVMFStatus iCPMRequestUsageCommandStatus; 733 /* From PVMFCPMStatusObserver */ 734 void CPMCommandCompleted(const PVMFCmdResp& aResponse); 735 736 PVMFStatus DoGetLicense(PVMFAMRFFNodeCommand& aCmd, 737 bool aWideCharVersion = false); 738 PVMFStatus DoCancelGetLicense(PVMFAMRFFNodeCommand& aCmd); 739 void CompleteGetLicense(); 740 PVMFStatus ParseAMRFile(); 741 uint32 iCountToClaculateRDATimeInterval; 742 }; 743 744 #endif // PVMF_AMRFFPARSER_NODE_H_INCLUDED 745 746