Home | History | Annotate | Download | only in src
      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_WAVFFPARSER_NODE_H_INCLUDED
     19 #define PVMF_WAVFFPARSER_NODE_H_INCLUDED
     20 
     21 
     22 #ifndef OSCL_BASE_H_INCLUDED
     23 #include "oscl_base.h"
     24 #endif
     25 
     26 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
     27 #include "oscl_scheduler_ao.h"
     28 #endif
     29 
     30 #ifndef OSCL_FILE_IO_H_INCLUDED
     31 #include "oscl_file_io.h"
     32 #endif
     33 
     34 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED
     35 #include "pvmf_format_type.h"
     36 #endif
     37 
     38 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
     39 #include "pvmf_node_interface.h"
     40 #endif
     41 
     42 #ifndef PVMF_MEDIA_DATA_H_INCLUDED
     43 #include "pvmf_media_data.h"
     44 #endif
     45 
     46 #ifndef OSCL_MEM_MEMPOOL_H_INCLUDED
     47 #include "oscl_mem_mempool.h"
     48 #endif
     49 #ifndef PVMF_MEMPOOL_H_INCLUDED
     50 #include "pvmf_mempool.h"
     51 #endif
     52 
     53 #ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED
     54 #include "pvmf_simple_media_buffer.h"
     55 #endif
     56 
     57 #ifndef PVMF_DATA_SOURCE_INIT_EXTENSION_H_INCLUDED
     58 #include "pvmf_data_source_init_extension.h"
     59 #endif
     60 
     61 #ifndef PVMF_TRACK_SELECTION_EXTENSION_H_INCLUDED
     62 #include "pvmf_track_selection_extension.h"
     63 #endif
     64 
     65 #ifndef PVMF_MEDIA_PRESENTATION_INFO_H_INCLUDED
     66 #include "pvmf_media_presentation_info.h"
     67 #endif
     68 
     69 #ifndef PVMF_NODE_UTILS_H_INCLUDED
     70 #include "pvmf_node_utils.h"
     71 #endif
     72 
     73 #ifndef PVMF_META_DATA_EXTENSION_H_INCLUDED
     74 #include "pvmf_meta_data_extension.h"
     75 #endif
     76 
     77 #ifndef PVMF_DATA_SOURCE_PLAYBACK_CONTROL_H_INCLUDED
     78 #include "pvmf_data_source_playback_control.h"
     79 #endif
     80 
     81 #ifndef WAV_PARSERNODE_TUNABLES_H_INCLUDED
     82 #include "wav_parsernode_tunables.h"
     83 #endif
     84 
     85 #ifndef PVWAVFILEPARSER_H_INCLUDED
     86 #include "pvwavfileparser.h"
     87 #endif
     88 
     89 class MediaClockConverter;
     90 class PVMFWAVFFParserNode;
     91 class PVWAVFFNodeTrackPortInfo : public OsclMemPoolFixedChunkAllocatorObserver
     92 {
     93     public:
     94         enum TrackState
     95         {
     96             TRACKSTATE_UNINITIALIZED,
     97             TRACKSTATE_INITIALIZED,
     98             TRACKSTATE_TRANSMITTING_GETDATA,
     99             TRACKSTATE_TRANSMITTING_SENDDATA,
    100             TRACKSTATE_SEND_ENDOFTRACK,
    101             TRACKSTATE_MEDIADATAPOOLEMPTY,
    102             TRACKSTATE_DESTFULL,
    103             TRACKSTATE_SOURCEEMPTY,
    104             TRACKSTATE_ENDOFTRACK,
    105             TRACKSTATE_ERROR
    106         };
    107 
    108         PVWAVFFNodeTrackPortInfo()
    109         {
    110             iTrackId = -1;
    111             iPort = NULL;
    112             iClockConverter = NULL;
    113             iState = TRACKSTATE_UNINITIALIZED;
    114             iTrackDataMemoryPool = NULL;
    115             iMediaDataImplAlloc = NULL;
    116             iMediaDataMemPool = NULL;
    117             iNode = NULL;
    118             iSeqNum = 0;
    119             iSendBOS = false;
    120         }
    121 
    122         PVWAVFFNodeTrackPortInfo(const PVWAVFFNodeTrackPortInfo& aSrc):
    123                 OsclMemPoolFixedChunkAllocatorObserver()
    124         {
    125             iTrackId = aSrc.iTrackId;
    126             iPort = aSrc.iPort;
    127             iTag = aSrc.iTag;
    128             iClockConverter = aSrc.iClockConverter;
    129             iMediaData = aSrc.iMediaData;
    130             iState = aSrc.iState;
    131             iTrackDataMemoryPool = aSrc.iTrackDataMemoryPool;
    132             iMediaDataImplAlloc = aSrc.iMediaDataImplAlloc;
    133             iMediaDataMemPool = aSrc.iMediaDataMemPool;
    134             iNode = aSrc.iNode;
    135             iSeqNum = aSrc.iSeqNum;
    136             iSendBOS = aSrc.iSendBOS;
    137         }
    138 
    139         virtual ~PVWAVFFNodeTrackPortInfo()
    140         {
    141         }
    142 
    143         // From OsclMemPoolFixedChunkAllocatorObserver
    144         // Callback handler when mempool's deallocate() is called after
    145         // calling notifyfreechunkavailable() on the mempool
    146         void freechunkavailable(OsclAny*);
    147 
    148         // Track ID number in WAV FF
    149         int32 iTrackId;
    150         // Output port to send the data downstream
    151         PVMFPortInterface* iPort;
    152 
    153         // Settings for the output port
    154         //PVMFPortProperty iPortProperty;
    155 
    156         int32 iTag;
    157 
    158         // Converter to convert from track timescale to milliseconds
    159         MediaClockConverter* iClockConverter;
    160         // Shared memory pointer holding the currently retrieved track data
    161         PVMFSharedMediaDataPtr iMediaData;
    162         // Current state of this track
    163         TrackState iState;
    164         // Output buffer memory pool
    165         OsclMemPoolFixedChunkAllocator *iTrackDataMemoryPool;
    166         // Allocator for simple media data buffer impl
    167         PVMFSimpleMediaBufferCombinedAlloc *iMediaDataImplAlloc;
    168         // Memory pool for simple media data
    169         PVMFMemPoolFixedChunkAllocator *iMediaDataMemPool;
    170         // WAV FF parser node handle
    171         PVMFWAVFFParserNode* iNode;
    172         // Sequence number
    173         uint32 iSeqNum;
    174         // bos flag
    175         bool iSendBOS;
    176 };
    177 
    178 //memory allocator type for this node.
    179 typedef OsclMemAllocator PVMFWAVFFNodeAllocator;
    180 
    181 //Node command type.
    182 enum PVMFWAVFFNodeCommandType
    183 {
    184     PVWAVFF_NODE_CMD_SETDATASOURCEPOSITION = PVMF_GENERIC_NODE_COMMAND_LAST,
    185     PVWAVFF_NODE_CMD_QUERYDATASOURCEPOSITION,
    186     PVWAVFF_NODE_CMD_SETDATASOURCERATE,
    187     PVWAVFF_NODE_CMD_GETNODEMETADATAKEY,
    188     PVWAVFF_NODE_CMD_GETNODEMETADATAVALUE
    189 };
    190 #define PVMFWAVFFNodeCommandBase PVMFGenericNodeCommand<PVMFWAVFFNodeAllocator>  // to remove typedef warning on symbian
    191 class PVMFWAVFFNodeCommand: public PVMFWAVFFNodeCommandBase
    192 {
    193 
    194     public:
    195         // Constructor and parser for GetNodeMetadataKeys
    196         void Construct(PVMFSessionId s, int32 cmd
    197                        , PVMFMetadataList& aKeyList
    198                        , uint32 aStartingIndex
    199                        , int32 aMaxEntries
    200                        , char* aQueryKey
    201                        , const OsclAny* aContext)
    202         {
    203             PVMFWAVFFNodeCommandBase::Construct(s, cmd, aContext);
    204             iParam1 = (OsclAny*) & aKeyList;
    205             iParam2 = (OsclAny*)aStartingIndex;
    206             iParam3 = (OsclAny*)aMaxEntries;
    207             if (aQueryKey)
    208             {
    209                 //allocate a copy of the query key string.
    210                 Oscl_TAlloc<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> str;
    211                 iParam4 = str.ALLOC_AND_CONSTRUCT(aQueryKey);
    212             }
    213         }
    214         void Parse(PVMFMetadataList*& MetaDataListPtr, uint32 &aStartingIndex, int32 &aMaxEntries, char*& aQueryKey)
    215         {
    216             MetaDataListPtr = (PVMFMetadataList*)iParam1;
    217             aStartingIndex = (uint32)iParam2;
    218             aMaxEntries = (int32)iParam3;
    219             aQueryKey = NULL;
    220             if (iParam4)
    221             {
    222                 OSCL_HeapString<OsclMemAllocator>* keystring = (OSCL_HeapString<OsclMemAllocator>*)iParam4;
    223                 aQueryKey = keystring->get_str();
    224             }
    225         }
    226 
    227         // Constructor and parser for GetNodeMetadataValue
    228         void Construct(PVMFSessionId s, int32 cmd, PVMFMetadataList& aKeyList, Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, uint32 aStartIndex, int32 aMaxEntries, const OsclAny* aContext)
    229         {
    230             PVMFWAVFFNodeCommandBase::Construct(s, cmd, aContext);
    231             iParam1 = (OsclAny*) & aKeyList;
    232             iParam2 = (OsclAny*) & aValueList;
    233             iParam3 = (OsclAny*)aStartIndex;
    234             iParam4 = (OsclAny*)aMaxEntries;
    235 
    236         }
    237         void Parse(PVMFMetadataList* &aKeyList, Oscl_Vector<PvmiKvp, OsclMemAllocator>* &aValueList, uint32 &aStartingIndex, int32 &aMaxEntries)
    238         {
    239             aKeyList = (PVMFMetadataList*)iParam1;
    240             aValueList = (Oscl_Vector<PvmiKvp, OsclMemAllocator>*)iParam2;
    241             aStartingIndex = (uint32)iParam3;
    242             aMaxEntries = (int32)iParam4;
    243         }
    244 
    245         // Constructor and parser for SetDataSourcePosition
    246         void Construct(PVMFSessionId s, int32 cmd, PVMFTimestamp aTargetNPT, PVMFTimestamp* aActualNPT, PVMFTimestamp* aActualMediaDataTS,
    247                        bool aSeekToSyncPoint, uint32 aStreamID, const OsclAny*aContext)
    248         {
    249             PVMFWAVFFNodeCommandBase::Construct(s, cmd, aContext);
    250             iParam1 = (OsclAny*)aTargetNPT;
    251             iParam2 = (OsclAny*)aActualNPT;
    252             iParam3 = (OsclAny*)aActualMediaDataTS;
    253             iParam4 = (OsclAny*)aSeekToSyncPoint;
    254             iParam5 = (OsclAny*)aStreamID;
    255         }
    256         void Parse(PVMFTimestamp& aTargetNPT, PVMFTimestamp* &aActualNPT, PVMFTimestamp* &aActualMediaDataTS, bool& aSeekToSyncPoint, uint32& aStreamID)
    257         {
    258             aTargetNPT = (PVMFTimestamp)iParam1;
    259             aActualNPT = (PVMFTimestamp*)iParam2;
    260             aActualMediaDataTS = (PVMFTimestamp*)iParam3;
    261             aSeekToSyncPoint = (iParam4 ? true : false);
    262             aStreamID = (uint32)iParam5;
    263         }
    264 
    265         // Constructor and parser for QueryDataSourcePosition
    266         void Construct(PVMFSessionId s, int32 cmd, PVMFTimestamp aTargetNPT, PVMFTimestamp* aActualNPT, bool aSeekToSyncPoint, const OsclAny*aContext)
    267         {
    268             PVMFWAVFFNodeCommandBase::Construct(s, cmd, aContext);
    269             iParam1 = (OsclAny*)aTargetNPT;
    270             iParam2 = (OsclAny*)aActualNPT;
    271             iParam3 = (OsclAny*)aSeekToSyncPoint;
    272             iParam4 = NULL;
    273             iParam5 = NULL;
    274         }
    275         void Parse(PVMFTimestamp& aTargetNPT, PVMFTimestamp* &aActualNPT, bool& aSeekToSyncPoint)
    276         {
    277             aTargetNPT = (PVMFTimestamp)iParam1;
    278             aActualNPT = (PVMFTimestamp*)iParam2;
    279             aSeekToSyncPoint = (iParam3 ? true : false);
    280         }
    281 
    282         // Constructor and parser for SetDataSourceRate
    283         void Construct(PVMFSessionId s, int32 cmd, int32 aRate, PVMFTimebase* aTimebase, const OsclAny* aContext)
    284         {
    285             PVMFWAVFFNodeCommandBase::Construct(s, cmd, aContext);
    286             iParam1 = (OsclAny*)aRate;
    287             iParam2 = (OsclAny*)aTimebase;
    288             iParam3 = NULL;
    289             iParam4 = NULL;
    290             iParam5 = NULL;
    291         }
    292         void Parse(int32& aRate, PVMFTimebase*& aTimebase)
    293         {
    294             aRate = (int32)iParam1;
    295             aTimebase = (PVMFTimebase*)iParam2;
    296         }
    297 
    298         //need to overlaod the base Destroy routine to cleanup metadata key.
    299         void Destroy()
    300         {
    301             PVMFGenericNodeCommand<OsclMemAllocator>::Destroy();
    302             switch (iCmd)
    303             {
    304                 case PVWAVFF_NODE_CMD_GETNODEMETADATAKEY:
    305                     if (iParam4)
    306                     {
    307                         //cleanup the allocated string
    308                         Oscl_TAlloc<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> str;
    309                         str.destruct_and_dealloc(iParam4);
    310                     }
    311                     break;
    312                 default:
    313                     break;
    314             }
    315         }
    316 
    317         //need to overlaod the base Copy routine to copy metadata key.
    318         void Copy(const PVMFGenericNodeCommand<OsclMemAllocator>& aCmd)
    319         {
    320             PVMFGenericNodeCommand<OsclMemAllocator>::Copy(aCmd);
    321             switch (aCmd.iCmd)
    322             {
    323                 case PVWAVFF_NODE_CMD_GETNODEMETADATAKEY:
    324                     if (aCmd.iParam4)
    325                     {
    326                         //copy the allocated string
    327                         OSCL_HeapString<OsclMemAllocator>* aStr = (OSCL_HeapString<OsclMemAllocator>*)aCmd.iParam4;
    328                         Oscl_TAlloc<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> str;
    329                         iParam4 = str.ALLOC_AND_CONSTRUCT(*aStr);
    330                     }
    331                     break;
    332                 default:
    333                     break;
    334             }
    335         }
    336 
    337 };
    338 
    339 //Command queue type
    340 typedef PVMFNodeCommandQueue<PVMFWAVFFNodeCommand, PVMFWAVFFNodeAllocator> PVMFWAVFFNodeCmdQ;
    341 
    342 class PV_Wav_Parser;
    343 class PVMFWAVFFParserOutPort;
    344 class PVLogger;
    345 
    346 class PVMFWAVFFParserNode : public OsclTimerObject,
    347         public PVMFNodeInterface,
    348         public PVMFDataSourceInitializationExtensionInterface,
    349         public PVMFTrackSelectionExtensionInterface,
    350         public PvmfDataSourcePlaybackControlInterface,
    351         public PVMFMetadataExtensionInterface
    352 {
    353     public:
    354         PVMFWAVFFParserNode(int32 aPriority = OsclActiveObject::EPriorityNominal);
    355         ~PVMFWAVFFParserNode();
    356 
    357         // From PVMFNodeInterface
    358         PVMFStatus ThreadLogon();
    359         PVMFStatus ThreadLogoff();
    360         PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability);
    361         PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL);
    362         PVMFCommandId QueryUUID(PVMFSessionId, const PvmfMimeString& aMimeType,
    363                                 Oscl_Vector<PVUuid, PVMFWAVFFNodeAllocator>& aUuids,
    364                                 bool aExactUuidsOnly = false,
    365                                 const OsclAny* aContext = NULL);
    366         PVMFCommandId QueryInterface(PVMFSessionId, const PVUuid& aUuid,
    367                                      PVInterface*& aInterfacePtr,
    368                                      const OsclAny* aContext = NULL);
    369         virtual PVMFCommandId RequestPort(PVMFSessionId aSession,
    370                                           int32 aPortTag,
    371                                           const PvmfMimeString* aPortConfig = NULL,
    372                                           const OsclAny* aContext = NULL);
    373         PVMFCommandId ReleasePort(PVMFSessionId, PVMFPortInterface& aPort, const OsclAny* aContext = NULL);
    374         PVMFCommandId Init(PVMFSessionId, const OsclAny* aContext = NULL);
    375         PVMFCommandId Start(PVMFSessionId, const OsclAny* aContext = NULL);
    376         PVMFCommandId Stop(PVMFSessionId, const OsclAny* aContext = NULL);
    377         PVMFCommandId Flush(PVMFSessionId, const OsclAny* aContext = NULL);
    378         PVMFCommandId Pause(PVMFSessionId, const OsclAny* aContext = NULL);
    379         PVMFCommandId Reset(PVMFSessionId, const OsclAny* aContext = NULL);
    380         PVMFCommandId Prepare(PVMFSessionId aSession, const OsclAny* aContext = NULL);
    381         PVMFCommandId CancelAllCommands(PVMFSessionId, const OsclAny* aContextData = NULL);
    382         PVMFCommandId CancelCommand(PVMFSessionId, PVMFCommandId aCmdId, const OsclAny* aContextData = NULL);
    383         PVMFStatus QueryInterfaceSync(PVMFSessionId aSession,
    384                                       const PVUuid& aUuid,
    385                                       PVInterface*& aInterfacePtr);
    386 
    387         //From PVMFDataSourceInitializationExtensionInterface
    388         void addRef();
    389         void removeRef();
    390         bool queryInterface(const PVUuid& uuid, PVInterface *& iface);
    391         PVMFStatus SetSourceInitializationData(OSCL_wString& aSourceURL, PVMFFormatType& aSourceFormat, OsclAny* aSourceData);
    392         PVMFStatus SetClientPlayBackClock(PVMFMediaClock* aClientClock);
    393         PVMFStatus SetEstimatedServerClock(PVMFMediaClock* aClientClock);
    394 
    395         //From PVMFTrackSelectionExtensionInterface
    396         PVMFStatus GetMediaPresentationInfo(PVMFMediaPresentationInfo& aInfo);
    397         PVMFStatus SelectTracks(PVMFMediaPresentationInfo& aInfo);
    398 
    399         // From PVMFMetadataExtensionInterface
    400         uint32 GetNumMetadataKeys(char* aQueryKeyString = NULL);
    401         uint32 GetNumMetadataValues(PVMFMetadataList& aKeyList);
    402         PVMFCommandId GetNodeMetadataKeys(PVMFSessionId aSessionId,
    403                                           PVMFMetadataList& aKeyList,
    404                                           uint32 aStartingKeyIndex,
    405                                           int32 aMaxKeyEntries,
    406                                           char* aQueryKeyString = NULL,
    407                                           const OsclAny* aContextData = NULL);
    408         PVMFCommandId GetNodeMetadataValues(PVMFSessionId aSessionId,
    409                                             PVMFMetadataList& aKeyList,
    410                                             Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList,
    411                                             uint32 aStartingValueIndex,
    412                                             int32 aMaxValueEntries,
    413                                             const OsclAny* aContextData = NULL);
    414         PVMFStatus ReleaseNodeMetadataKeys(PVMFMetadataList& aKeyList,
    415                                            uint32 aStartingKeyIndex,
    416                                            uint32 aEndKeyIndex) ;
    417 
    418         PVMFStatus ReleaseNodeMetadataValues(Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList,
    419                                              uint32 aStartingValueIndex,
    420                                              uint32 aEndValueIndex) ;
    421 
    422         // From PvmfDataSourcePlaybackControlInterface
    423         PVMFCommandId SetDataSourcePosition(PVMFSessionId aSessionId, PVMFTimestamp aTargetNPT, PVMFTimestamp& aActualNPT, PVMFTimestamp& aActualMediaDataTS, bool aSeekToSyncPoint = true, uint32 aStreamID = 0, OsclAny* aContext = NULL);
    424         PVMFCommandId QueryDataSourcePosition(PVMFSessionId aSessionId, PVMFTimestamp aTargetNPT, PVMFTimestamp& aActualNPT, bool aSeekToSyncPoint = true, OsclAny* aContext = NULL);
    425         PVMFCommandId QueryDataSourcePosition(PVMFSessionId aSessionId, PVMFTimestamp aTargetNPT,
    426                                               PVMFTimestamp& aSeekPointBeforeTargetNPT, PVMFTimestamp& aSeekPointAfterTargetNPT,
    427                                               OsclAny* aContext = NULL, bool aSeekToSyncPoint = true);
    428 
    429         PVMFCommandId SetDataSourceRate(PVMFSessionId aSession, int32 aRate, PVMFTimebase* aTimebase = NULL, OsclAny* aContext = NULL);
    430 
    431 
    432     private:
    433 
    434         //from PVMFPortActivityHandler
    435         void HandlePortActivity(const PVMFPortActivity& aActivity);
    436 
    437         void Construct();
    438         void Run();
    439 
    440         // Port processing
    441         bool ProcessPortActivity();
    442         void QueuePortActivity(const PVMFPortActivity &aActivity);
    443         PVMFStatus ProcessOutgoingMsg(PVMFPortInterface* aPort);
    444         bool HandleOutgoingQueueReady(PVMFPortInterface* aPortInterface);
    445 
    446         /**
    447          * Queue holding port activity. Only incoming and outgoing msg activity are
    448          * put on the queue.  For each port, there should only be at most one activity
    449          * of each type on the queue.
    450          */
    451         Oscl_Vector<PVMFPortActivity, PVMFWAVFFNodeAllocator> iPortActivityQueue;
    452 
    453         //Command processing
    454         PVMFCommandId QueueCommandL(PVMFWAVFFNodeCommand& aCmd);
    455         bool ProcessCommand(PVMFWAVFFNodeCommand&);
    456         void CommandComplete(PVMFWAVFFNodeCmdQ&, PVMFWAVFFNodeCommand&, PVMFStatus, OsclAny* aData = NULL,
    457                              PVUuid* aEventUUID = NULL, int32* aEventCode = NULL);
    458         bool FlushPending();
    459 
    460         //Command handlers.
    461         void DoQueryUuid(PVMFWAVFFNodeCommand&);
    462         void DoQueryInterface(PVMFWAVFFNodeCommand&);
    463         void DoInit(PVMFWAVFFNodeCommand&);
    464         void DoPrepare(PVMFWAVFFNodeCommand&);
    465         void DoStart(PVMFWAVFFNodeCommand&);
    466         void DoStop(PVMFWAVFFNodeCommand&);
    467         void DoPause(PVMFWAVFFNodeCommand&);
    468         void DoReset(PVMFWAVFFNodeCommand&);
    469         void DoFlush(PVMFWAVFFNodeCommand&);
    470         void DoCancelAllCommands(PVMFWAVFFNodeCommand&);
    471         void DoCancelCommand(PVMFWAVFFNodeCommand&);
    472         void DoRequestPort(PVMFWAVFFNodeCommand&);
    473         void DoReleasePort(PVMFWAVFFNodeCommand&);
    474         void DoSetDataSourcePosition(PVMFWAVFFNodeCommand& aCmd);
    475         void DoQueryDataSourcePosition(PVMFWAVFFNodeCommand& aCmd);
    476         void DoSetDataSourceRate(PVMFWAVFFNodeCommand& aCmd);
    477         PVMFStatus DoGetNodeMetadataKey(PVMFWAVFFNodeCommand& aCmd);
    478         PVMFStatus DoGetNodeMetadataValue(PVMFWAVFFNodeCommand& aCmd);
    479         void InitializeTrackStructure();
    480 
    481         bool verify_supported_format();
    482         // used to configure downstream ports
    483         PVMFStatus NegotiateSettings(PvmiCapabilityAndConfig* configInterface);
    484 
    485         // Event reporting
    486         void ReportErrorEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL);
    487         void ReportInfoEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL);
    488         void SetState(TPVMFNodeInterfaceState);
    489 
    490         bool MapWAVErrorCodeToEventCode(int32 aWAVErrCode, PVUuid& aEventUUID, int32& aEventCode);
    491 
    492         // Track data processing
    493         bool HandleTrackState();
    494         bool RetrieveTrackData(PVWAVFFNodeTrackPortInfo& aTrackPortInfo);
    495         bool SendTrackData(PVWAVFFNodeTrackPortInfo& aTrackPortInfo);
    496         bool SendEndOfTrackCommand(PVWAVFFNodeTrackPortInfo& aTrackPortInfo);
    497         bool SendBeginOfMediaStreamCommand(PVWAVFFNodeTrackPortInfo& aTrackPortInfo);
    498         bool CheckAvailabilityForSendingNewTrackData(PVWAVFFNodeTrackPortInfo& aTrackPortInfo);
    499         void ResetAllTracks();
    500         bool ReleaseAllPorts();
    501         void CleanupFileSource();
    502         int32 PushBackPortActivity(PVMFPortActivity &aActivity);
    503         int32 CreateNewArray(char*& aPtr, int32 aLen);
    504         int32 PushBackKeyVal(Oscl_Vector<PvmiKvp, OsclMemAllocator>*& aValueListPtr, PvmiKvp &aKeyVal);
    505         PVMFStatus PushBackMetadataKeys(PVMFMetadataList *&aKeyListPtr, uint32 aLcv);
    506 
    507     private: // private member variables
    508 
    509         //stream id
    510         uint32 iStreamID;
    511         //bos flag
    512         bool iSendBOS;
    513 
    514         PVMFWAVFFNodeCmdQ iInputCommands;
    515         PVMFWAVFFNodeCmdQ iCurrentCommand;
    516 
    517         PVMFWAVFFParserOutPort* iOutPort;
    518         friend class PVMFWAVFFParserOutPort;
    519 
    520         PVMFNodeCapability iCapability;
    521         PVLogger *iLogger;
    522 
    523         PVWAVFileInfo wavinfo;
    524 
    525         uint32 trackdata_bufsize;
    526         uint32 trackdata_num_samples;
    527 
    528         PVMFPortInterface* iCmdRespPort;
    529 
    530         OSCL_wHeapString<OsclMemAllocator> iFilename;
    531         Oscl_FileServer iFileServer;
    532         PV_Wav_Parser* iWAVParser;
    533 
    534         Oscl_Vector<PVWAVFFNodeTrackPortInfo, OsclMemAllocator> iSelectedTrackList;
    535 
    536         Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iAvailableMetadataKeys;
    537 
    538         // Reference counter for extension
    539         uint32 iExtensionRefCount;
    540         bool oOutgoingQueueBusy;
    541 };
    542 
    543 #endif // PVMF_WAVFFPARSER_NODE_H_INCLUDED
    544 
    545