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 PV_FRAME_METADATA_UTILITY_H_INCLUDED
     19 #define PV_FRAME_METADATA_UTILITY_H_INCLUDED
     20 
     21 
     22 #ifndef OSCL_BASE_H_INCLUDED
     23 #include "oscl_base.h"
     24 #endif
     25 
     26 #ifndef OSCL_MEM_H_INCLUDED
     27 #include "oscl_mem.h"
     28 #endif
     29 
     30 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
     31 #include "oscl_scheduler_ao.h"
     32 #endif
     33 
     34 #ifndef OSCL_VECTOR_H_INCLUDED
     35 #include "oscl_vector.h"
     36 #endif
     37 
     38 #ifndef OSCL_PRIQUEUE_H_INCLUDED
     39 #include "oscl_priqueue.h"
     40 #endif
     41 
     42 #ifndef PV_ENGINE_TYPES_H_INCLUDED
     43 #include "pv_engine_types.h"
     44 #endif
     45 
     46 #ifndef PV_PLAYER_DATASOURCE_H_INCLUDED
     47 #include "pv_player_datasource.h"
     48 #endif
     49 
     50 #ifndef PV_FRAME_METADATA_INTERFACE_H_INCLUDED
     51 #include "pv_frame_metadata_interface.h"
     52 #endif
     53 
     54 #ifndef PV_ENGINE_OBSERVER_H_INCLUDED
     55 #include "pv_engine_observer.h"
     56 #endif
     57 
     58 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
     59 #include "pvmf_node_interface.h"
     60 #endif
     61 
     62 #ifndef PVMF_META_DATA_TYPES_H_INCLUDED
     63 #include "pvmf_meta_data_types.h"
     64 #endif
     65 
     66 #ifndef PVMF_BASIC_ERRORINFOMESSAGE_H_INCLUDED
     67 #include "pvmf_basic_errorinfomessage.h"
     68 #endif
     69 
     70 #ifndef PV_PLAYER_DATASINKPVMFNODE_H_INCLUDED
     71 #include "pv_player_datasinkpvmfnode.h"
     72 #endif
     73 
     74 #ifndef PV_FRAME_METADATA_MIO_VIDEO_H_INCLUDED
     75 #include "pv_frame_metadata_mio_video.h"
     76 #endif
     77 
     78 #ifndef PV_FRAME_METADATA_MIO_AUDIO_H_INCLUDED
     79 #include "pv_frame_metadata_mio_audio.h"
     80 #endif
     81 
     82 #ifndef OSCL_TIMER_H_INCLUDED
     83 #include "oscl_timer.h"
     84 #endif
     85 
     86 
     87 /**
     88  * PVFMUtilityState enum
     89  *
     90  *  Enumeration of internal pvFrameAndMetadata utility state.
     91  *
     92  **/
     93 typedef enum
     94 {
     95     PVFM_UTILITY_STATE_IDLE = 1,
     96     PVFM_UTILITY_STATE_INITIALIZING,
     97     PVFM_UTILITY_STATE_INITIALIZED,
     98     PVFM_UTILITY_STATE_RESETTING,
     99     PVFM_UTILITY_STATE_HANDLINGERROR,
    100     PVFM_UTILITY_STATE_ERROR
    101 } PVFMUtilityState;
    102 
    103 
    104 
    105 typedef union PVFMUtilityCommandParamUnion
    106 {
    107     bool  bool_value;
    108     float float_value;
    109     double double_value;
    110     uint8 uint8_value;
    111     int32 int32_value;
    112     uint32 uint32_value;
    113     oscl_wchar* pWChar_value;
    114     char* pChar_value;
    115     uint8* pUint8_value;
    116     int32* pInt32_value;
    117     uint32* pUint32_value;
    118     int64* pInt64_value;
    119     uint64*  pUint64_value;
    120     OsclAny* pOsclAny_value;
    121 } _PVFMUtilityCommandParamUnion;
    122 
    123 
    124 /**
    125  * PVFMUtilityCommand Class
    126  *
    127  * PVFMUtilityCommand class is a data class to hold issued commands inside pvFrameAndMetadata utility
    128  **/
    129 class PVFMUtilityCommand
    130 {
    131     public:
    132         /**
    133          * The constructor for PVFMUtilityCommand which allows the data values to be set.
    134          *
    135          * @param aCmdType The command type value for this command. The value is an utility-specific 32-bit value.
    136          * @param aCmdId The command ID assigned by the utiliy for this command.
    137          * @param aContextData The pointer to the passed-in context data for this command.
    138          *
    139          * @returns None
    140          **/
    141         PVFMUtilityCommand(int32 aCmdType, PVCommandId aCmdId, OsclAny* aContextData = NULL,
    142                            Oscl_Vector<PVFMUtilityCommandParamUnion, OsclMemAllocator>* aParamVector = NULL, bool aAPICommand = true) :
    143                 iCmdType(aCmdType), iCmdId(aCmdId), iContextData(aContextData), iAPICommand(aAPICommand)
    144         {
    145             iParamVector.clear();
    146             if (aParamVector)
    147             {
    148                 iParamVector = *aParamVector;
    149             }
    150         }
    151 
    152         /**
    153          * The copy constructor for PVFMUtilityCommand. Used mainly for Oscl_Vector.
    154          *
    155          * @param aCmd The reference to the source PVFMUtilityCommand to copy the data values from.
    156          *
    157          * @returns None
    158          **/
    159         PVFMUtilityCommand(const PVFMUtilityCommand& aCmd)
    160         {
    161             iCmdType = aCmd.iCmdType;
    162             iCmdId = aCmd.iCmdId;
    163             iContextData = aCmd.iContextData;
    164             iAPICommand = aCmd.iAPICommand;
    165             iParamVector = aCmd.iParamVector;
    166             iMimeType = aCmd.iMimeType;
    167             iUuid = aCmd.iUuid;
    168         }
    169 
    170         /**
    171          * This function returns the stored command type value.
    172          *
    173          * @returns The signed 32-bit command type value for this command.
    174          **/
    175         int32 GetCmdType()const
    176         {
    177             return iCmdType;
    178         }
    179 
    180         /**
    181          * This function returns the stored command ID value.
    182          *
    183          * @returns The PVCommandId value for this command.
    184          **/
    185         PVCommandId GetCmdId()const
    186         {
    187             return iCmdId;
    188         }
    189 
    190         /**
    191          * This function returns the stored context data pointer.
    192          *
    193          * @returns The pointer to the context data for this command
    194          **/
    195         OsclAny* GetContext()const
    196         {
    197             return iContextData;
    198         }
    199 
    200         /**
    201          * This function tells whether the command is an API command or not
    202          *
    203          * @returns true if API command, false if not.
    204          **/
    205         bool IsAPICommand()const
    206         {
    207             return iAPICommand;
    208         }
    209 
    210         /**
    211          * This function returns the command parameter from the specified index.
    212          * If the specified index is not available, empty parameter will be returned
    213          *
    214          * @param aIndex The index of the parameter to return
    215          *
    216          * @returns The stored parameter for this command
    217          **/
    218         PVFMUtilityCommandParamUnion GetParam(uint32 aIndex)const
    219         {
    220             if (aIndex >= iParamVector.size())
    221             {
    222                 PVFMUtilityCommandParamUnion param;
    223                 oscl_memset(&param, 0, sizeof(PVFMUtilityCommandParamUnion));
    224                 return param;
    225             }
    226             else
    227             {
    228                 return iParamVector[aIndex];
    229             }
    230         }
    231 
    232         /**
    233          * This function returns MIME type parameter for this command
    234          *
    235          * @returns The MIME type parameter for this command
    236          */
    237         const PvmfMimeString& GetMimeType()const
    238         {
    239             return iMimeType;
    240         }
    241 
    242         /**
    243          * This function returns UUID parameter for this command
    244          *
    245          * @returns The UUID parameter for this command
    246          */
    247         PVUuid GetUuid()const
    248         {
    249             return iUuid;
    250         }
    251 
    252         /**
    253          * This function stores MIME type parameter of this command
    254          */
    255         void SetMimeType(const PvmfMimeString& aMimeType)
    256         {
    257             iMimeType = aMimeType;
    258         }
    259 
    260         /**
    261          * This function stores the UUID parameter of this command
    262          */
    263         void SetUuid(const PVUuid& aUuid)
    264         {
    265             iUuid = aUuid;
    266         }
    267 
    268         /**
    269          * Equality comparison for use with OsclPriorityQueue
    270          */
    271         bool operator==(const PVFMUtilityCommand& aCmd) const
    272         {
    273             return iCmdId == aCmd.iCmdId;
    274         }
    275 
    276         int32 iCmdType;
    277         PVCommandId iCmdId;
    278         OsclAny* iContextData;
    279         bool iAPICommand;
    280         Oscl_Vector<PVFMUtilityCommandParamUnion, OsclMemAllocator> iParamVector;
    281         OSCL_HeapString<OsclMemAllocator> iMimeType;
    282         PVUuid iUuid;
    283 };
    284 
    285 /**
    286  * PVFMUtilityCommandType enum
    287  *
    288  *  Enumeration of types of commands that can be issued to pvFrameAndMetadata utility.
    289  *
    290  **/
    291 typedef enum
    292 {
    293     // Engine API commands
    294     PVFM_UTILITY_COMMAND_QUERY_UUID = 1,
    295     PVFM_UTILITY_COMMAND_QUERY_INTERFACE,
    296     PVFM_UTILITY_COMMAND_CANCEL_ALL_COMMANDS,
    297     PVFM_UTILITY_COMMAND_GET_STATE,
    298     PVFM_UTILITY_COMMAND_ADD_DATA_SOURCE,
    299     PVFM_UTILITY_COMMAND_GET_METADATA_KEYS,
    300     PVFM_UTILITY_COMMAND_GET_METADATA_VALUES,
    301     PVFM_UTILITY_COMMAND_SET_PARAMETERS,
    302     PVFM_UTILITY_COMMAND_GET_FRAME_USER_BUFFER,
    303     PVFM_UTILITY_COMMAND_GET_FRAME_UTILITY_BUFFER,
    304     PVFM_UTILITY_COMMAND_RETURN_BUFFER,
    305     PVFM_UTILITY_COMMAND_REMOVE_DATA_SOURCE,
    306     PVFM_UTILITY_COMMAND_HANDLE_PLAYER_ERROR
    307 } PVFMUtilityCommandType;
    308 
    309 
    310 /**
    311  * PVFMUtilityCommandCompareLess Class
    312  *
    313  * PVFMUtilityCommandCompareLess class is a utility class to allow the OSCL priority queue perform command priority comparison.
    314  * The class is meant to be used inside pvFrameAndMetadata utility and not exposed to the interface layer or above.
    315  **/
    316 class PVFMUtilityCommandCompareLess
    317 {
    318     public:
    319         /**
    320         * The algorithm used in OsclPriorityQueue needs a compare function
    321         * that returns true when A's priority is less than B's
    322         * @return true if A's priority is less than B's, else false
    323         */
    324         int compare(PVFMUtilityCommand& a, PVFMUtilityCommand& b) const
    325         {
    326             int a_pri = PVFMUtilityCommandCompareLess::GetPriority(a);
    327             int b_pri = PVFMUtilityCommandCompareLess::GetPriority(b);
    328             if (a_pri < b_pri)
    329             {
    330                 // Higher priority
    331                 return true;
    332             }
    333             else if (a_pri == b_pri)
    334             {
    335                 // Same priority so look at the command ID to maintain FIFO
    336                 return (a.GetCmdId() > b.GetCmdId());
    337             }
    338             else
    339             {
    340                 // Lower priority
    341                 return false;
    342             }
    343         }
    344 
    345         /**
    346         * Returns the priority of each command
    347         * @return A 0-based priority number. A lower number indicates lower priority.
    348         */
    349         static int GetPriority(PVFMUtilityCommand& aCmd)
    350         {
    351             switch (aCmd.GetCmdType())
    352             {
    353                 case PVFM_UTILITY_COMMAND_QUERY_UUID:
    354                     return 5;
    355                 case PVFM_UTILITY_COMMAND_QUERY_INTERFACE:
    356                     return 5;
    357                 case PVFM_UTILITY_COMMAND_CANCEL_ALL_COMMANDS:
    358                     return 8;
    359                 case PVFM_UTILITY_COMMAND_GET_STATE:
    360                     return 5;
    361                 case PVFM_UTILITY_COMMAND_ADD_DATA_SOURCE:
    362                     return 5;
    363                 case PVFM_UTILITY_COMMAND_GET_METADATA_KEYS:
    364                     return 5;
    365                 case PVFM_UTILITY_COMMAND_GET_METADATA_VALUES:
    366                     return 5;
    367                 case PVFM_UTILITY_COMMAND_SET_PARAMETERS:
    368                     return 5;
    369                 case PVFM_UTILITY_COMMAND_GET_FRAME_USER_BUFFER:
    370                     return 5;
    371                 case PVFM_UTILITY_COMMAND_GET_FRAME_UTILITY_BUFFER:
    372                     return 5;
    373                 case PVFM_UTILITY_COMMAND_RETURN_BUFFER:
    374                     return 5;
    375                 case PVFM_UTILITY_COMMAND_REMOVE_DATA_SOURCE:
    376                     return 5;
    377                 case PVFM_UTILITY_COMMAND_HANDLE_PLAYER_ERROR:
    378                     return 9;
    379                 default:
    380                     return 0;
    381             }
    382         }
    383 };
    384 
    385 // Internal structure to use for opaque data context
    386 struct PVFMUtilityContext
    387 {
    388     PVCommandId iCmdId;
    389     OsclAny* iCmdContext;
    390     int32 iCmdType;
    391 };
    392 
    393 
    394 // Forward declaration
    395 class PVPlayerInterface;
    396 class PVMFNodeInterface;
    397 class PVFMVideoMIO;
    398 class PVFMAudioMIO;
    399 class OsclMemPoolResizableAllocator;
    400 
    401 class PVFrameAndMetadataUtility : public OsclTimerObject,
    402         public PVFrameAndMetadataInterface,
    403         public PvmiCapabilityAndConfig,
    404         public PVCommandStatusObserver,
    405         public PVErrorEventObserver,
    406         public PVInformationalEventObserver,
    407         public PVFMVideoMIOGetFrameObserver,
    408         public OsclTimerObserver
    409 {
    410     public:
    411         static PVFrameAndMetadataUtility* New(char *aOutputFormatMIMEType,
    412                                               PVCommandStatusObserver *aCmdObserver,
    413                                               PVErrorEventObserver *aErrorObserver,
    414                                               PVInformationalEventObserver *aInfoObserver,
    415                                               bool aHwAccelerated = true);
    416         ~PVFrameAndMetadataUtility();
    417 
    418         // From PVFrameAndMetadataInterface
    419         PVCommandId QueryUUID(const PvmfMimeString& aMimeType, Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids, bool aExactUuidsOnly = false, const OsclAny* aContextData = NULL);
    420         PVCommandId QueryInterface(const PVUuid& aUuid, PVInterface*& aInterfacePtr, const OsclAny* aContextData = NULL);
    421         PVCommandId CancelAllCommands(const OsclAny* aContextData = NULL);
    422         PVCommandId GetState(PVFrameAndMetadataState& aState, const OsclAny* aContextData = NULL);
    423         PVMFStatus GetStateSync(PVFrameAndMetadataState& aState);
    424         PVCommandId AddDataSource(PVPlayerDataSource& aDataSource, const OsclAny* aContextData = NULL);
    425         PVCommandId GetMetadataKeys(PVPMetadataList& aKeyList, int32 aStartingIndex = 0, int32 aMaxEntries = -1, char* aQueryKey = NULL, const OsclAny* aContextData = NULL);
    426         PVCommandId GetMetadataValues(PVPMetadataList& aKeyList, int32 aStartingValueIndex, int32 aMaxValueEntries, int32& aNumAvailableValueEntries, Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList, const OsclAny* aContextData = NULL);
    427         PVCommandId GetFrame(PVFrameSelector& aFrameInfo, uint8* aProvidedFrameBuffer, uint32& aBufferSize, PVFrameBufferProperty& aBufferProp, const OsclAny* aContextData = NULL);
    428         PVCommandId GetFrame(PVFrameSelector& aFrameInfo, uint8** aFrameBufferPtr, uint32& aBufferSize, PVFrameBufferProperty& aBufferProp, const OsclAny* aContextData = NULL);
    429         PVCommandId ReturnBuffer(uint8* aFrameBufferPtr, const OsclAny* aContextData = NULL);
    430         PVCommandId RemoveDataSource(PVPlayerDataSource& aDataSource, const OsclAny* aContextData = NULL);
    431         PVMFStatus  SetMode(uint32 aMode);
    432 
    433         void        SetThumbnailDimensions(uint32 aWidth, uint32 aHeight);
    434         void        GetThumbnailDimensions(uint32 &aWidth, uint32 &aHeight);
    435         // From PvmiCapabilityAndConfig
    436         void setObserver(PvmiConfigAndCapabilityCmdObserver* aObserver);
    437         PVMFStatus getParametersSync(PvmiMIOSession aSession, PvmiKeyType aIdentifier, PvmiKvp*& aParameters, int& aNumParamElements, PvmiCapabilityContext aContext);
    438         PVMFStatus releaseParameters(PvmiMIOSession aSession, PvmiKvp* aParameters, int aNumElements);
    439         void createContext(PvmiMIOSession aSession, PvmiCapabilityContext& aContext);
    440         void setContextParameters(PvmiMIOSession aSession, PvmiCapabilityContext& aContext, PvmiKvp* aParameters, int aNumParamElements);
    441         void DeleteContext(PvmiMIOSession aSession, PvmiCapabilityContext& aContext);
    442         void setParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters, int aNumElements, PvmiKvp* &aRetKVP);
    443         PVMFCommandId setParametersAsync(PvmiMIOSession aSession, PvmiKvp* aParameters, int aNumElements, PvmiKvp*& aRetKVP, OsclAny* aContext = NULL);
    444         uint32 getCapabilityMetric(PvmiMIOSession aSession);
    445         PVMFStatus verifyParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters, int aNumElements);
    446 
    447     private:
    448         bool iHwAccelerated;
    449         PVMFBasicErrorInfoMessage* CreateBasicErrInfoMessage(PVMFErrorInfoMessageInterface* nextmsg, PVFMErrorEventType aErrEvent = PVFMErrPlayerEngine);
    450 
    451         PVFrameAndMetadataUtility(bool aHwAccelerated);
    452         void Construct(char *aOutputFormatMIMEType,
    453                        PVCommandStatusObserver *aCmdObserver,
    454                        PVErrorEventObserver *aErrorObserver,
    455                        PVInformationalEventObserver *aInfoObserver);
    456 
    457         // From OsclTimerObject
    458         void Run();
    459 
    460         // From PVCommandStatusObserver
    461         void CommandCompleted(const PVCmdResponse& aResponse);
    462 
    463         // From PVErrorEventObserver
    464         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
    465 
    466         // From PVInformationalEventObserver
    467         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
    468 
    469         // From PVFMVideoMIOGetFrameObserver
    470         void HandleFrameReadyEvent(PVMFStatus aEventStatus);
    471 
    472         // From OsclTimerObserver
    473         void TimeoutOccurred(int32 timerID, int32 timeoutInfo);
    474 
    475         // Command and event queueing related functions
    476         PVCommandId AddCommandToQueue(int32 aCmdType, OsclAny* aContextData = NULL,
    477                                       Oscl_Vector<PVFMUtilityCommandParamUnion, OsclMemAllocator>* aParamVector = NULL,
    478                                       const PVUuid* aUuid = NULL, bool aAPICommand = true);
    479 
    480         // Command and event callback functions
    481         void UtilityCommandCompleted(PVCommandId aId, OsclAny* aContext, PVMFStatus aStatus, PVInterface* aExtInterface = NULL,
    482                                      OsclAny* aEventData = NULL, int32 aEventDataSize = 0);
    483 
    484         // Functions for utility state handling
    485         void SetUtilityState(PVFMUtilityState aState);
    486         PVFrameAndMetadataState GetUtilityState(void);
    487 
    488         // Keeps track of next available command ID
    489         PVCommandId iCommandId;
    490 
    491         // Current utility state
    492         PVFMUtilityState iState;
    493 
    494         // caller's intent
    495         uint32 iMode;
    496 
    497         // Queue for utility commands
    498         Oscl_Vector<PVFMUtilityCommand, OsclMemAllocator> iCurrentCmd; // Vector of size 1 to hold the command being currently processed
    499         Oscl_Vector<PVFMUtilityCommand, OsclMemAllocator> iCmdToCancel; // Vector of size 1 to hold the command being currently cancelled
    500         OsclPriorityQueue<PVFMUtilityCommand, OsclMemAllocator, Oscl_Vector<PVFMUtilityCommand, OsclMemAllocator>, PVFMUtilityCommandCompareLess> iPendingCmds; // Vector to hold the command that has been requested
    501 
    502         // Reference to observers
    503         PVCommandStatusObserver *iCmdStatusObserver;
    504         PVErrorEventObserver *iErrorEventObserver;
    505         PVInformationalEventObserver *iInfoEventObserver;
    506 
    507         // Command handling functions
    508         void DoCancelAllCommands(PVFMUtilityCommand& aCmd);
    509         void DoCancelCommandBeingProcessed(void);
    510 
    511         PVMFStatus DoQueryUUID(PVFMUtilityCommand& aCmd);
    512         PVMFStatus DoPlayerQueryUUID(PVCommandId aCmdId, OsclAny* aCmdContext, PvmfMimeString& aMIMEType, Oscl_Vector<PVUuid, OsclMemAllocator>& aUUIDVec, bool aExactMatch);
    513 
    514         PVMFStatus DoQueryInterface(PVFMUtilityCommand& aCmd);
    515         PVMFStatus DoPlayerQueryInterface(PVCommandId aCmdId, OsclAny* aCmdContext, PVUuid& aUuid, PVInterface*& aInterfacePtr);
    516         bool queryInterface(const PVUuid& uuid, PVInterface*& iface, PVCommandId cmdid, OsclAny* context);
    517 
    518         PVMFStatus DoGetState(PVFMUtilityCommand& aCmd, bool aSyncCmd = false);
    519 
    520         PVMFStatus DoAddDataSource(PVFMUtilityCommand& aCmd);
    521         PVMFStatus DoADSPlayerAddDataSource(PVCommandId aCmdId, OsclAny* aCmdContext);
    522         PVMFStatus DoADSPlayerInit(PVCommandId aCmdId, OsclAny* aCmdContext);
    523         PVMFStatus DoADSPlayerAddVideoDataSink(PVCommandId aCmdId, OsclAny* aCmdContext);
    524         PVMFStatus DoADSPlayerAddAudioDataSink(PVCommandId aCmdId, OsclAny* aCmdContext);
    525         PVMFStatus DoADSPlayerPrepare(PVCommandId aCmdId, OsclAny* aCmdContext);
    526         PVMFStatus DoADSPlayerStart(PVCommandId aCmdId, OsclAny* aCmdContext);
    527         PVMFStatus DoADSPlayerPause(PVCommandId aCmdId, OsclAny* aCmdContext);
    528 
    529         PVMFStatus DoGetMetadataKeys(PVFMUtilityCommand& aCmd);
    530         PVMFStatus DoPlayerGetMetadataKeys(PVCommandId aCmdId, OsclAny* aCmdContext,
    531                                            PVPMetadataList& aKeyList, int32 aStartingIndex, int32 aMaxEntries, char* aQueryKey);
    532 
    533         PVMFStatus DoGetMetadataValues(PVFMUtilityCommand& aCmd);
    534         PVMFStatus DoPlayerGetMetadataValues(PVCommandId aCmdId, OsclAny* aCmdContext,
    535                                              PVPMetadataList& aKeyList, int32 aStartingValueIndex, int32 aMaxValueEntries,
    536                                              int32& aNumAvailableValueEntries, Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList);
    537         PVMFStatus DoCapConfigSetParameters(PVFMUtilityCommand& aCmd, bool aSyncCmd);
    538         PVMFStatus DoVerifyAndSetFMUParameter(PvmiKvp& aParameter, bool aSetParam);
    539         PVMFStatus DoPlayerSetParametersSync(PVCommandId aCmdId, OsclAny* aCmdContext, PvmiKvp* aParameters, int aNumElements, PvmiKvp* &aRetKVP);
    540         bool HasVideo();
    541         PVMFStatus DoGetFrame(PVFMUtilityCommand& aCmd);
    542         PVMFStatus DoGFPlayerStopFromPaused(PVCommandId aCmdId, OsclAny* aCmdContext);
    543         PVMFStatus DoGFPlayerPrepare(PVCommandId aCmdId, OsclAny* aCmdContext);
    544         PVMFStatus DoGFPlayerStart(PVCommandId aCmdId, OsclAny* aCmdContext);
    545         PVMFStatus DoGFPlayerPause(PVCommandId aCmdId, OsclAny* aCmdContext);
    546 
    547         PVMFStatus DoReturnBuffer(PVFMUtilityCommand& aCmd);
    548 
    549         PVMFStatus DoRemoveDataSource(PVFMUtilityCommand& aCmd);
    550         PVMFStatus DoRDSPlayerStop(PVCommandId aCmdId, OsclAny* aCmdContext);
    551         PVMFStatus DoRDSPlayerRemoveVideoDataSink(PVCommandId aCmdId, OsclAny* aCmdContext);
    552         PVMFStatus DoRDSPlayerRemoveAudioDataSink(PVCommandId aCmdId, OsclAny* aCmdContext);
    553         PVMFStatus DoRDSPlayerReset(PVCommandId aCmdId, OsclAny* aCmdContext);
    554         PVMFStatus DoRDSPlayerRemoveDataSource(PVCommandId aCmdId, OsclAny* aCmdContext);
    555 
    556         PVMFStatus DoPlayerShutdownRestart(void);
    557 
    558         enum
    559         {
    560             // Player commands
    561             PVFM_CMD_PlayerQueryUUID,
    562             PVFM_CMD_PlayerQueryInterface,
    563             PVFM_CMD_ADSPlayerAddDataSource,
    564             PVFM_CMD_ADSPlayerInit,
    565             PVFM_CMD_ADSPlayerAddVideoDataSink,
    566             PVFM_CMD_ADSPlayerAddAudioDataSink,
    567             PVFM_CMD_ADSPlayerPrepare,
    568             PVFM_CMD_ADSPlayerStart,
    569             PVFM_CMD_ADSPlayerPause,
    570             PVFM_CMD_PlayerGetMetadataKeys,
    571             PVFM_CMD_PlayerGetMetadataValues,
    572             PVFM_CMD_PlayerSetParametersSync,
    573             PVFM_CMD_GFPlayerStopFromPaused,
    574             PVFM_CMD_GFPlayerPrepare,
    575             PVFM_CMD_GFPlayerStart,
    576             PVFM_CMD_GFPlayerPause,
    577             PVFM_CMD_RDSPlayerStopFromPaused,
    578             PVFM_CMD_RDSPlayerRemoveVideoDataSink,
    579             PVFM_CMD_RDSPlayerRemoveAudioDataSink,
    580             PVFM_CMD_RDSPlayerReset,
    581             PVFM_CMD_RDSPlayerRemoveDataSource,
    582             PVFM_CMD_PlayerQueryCapConfigInterface
    583         };
    584 
    585         // Player command completion handling
    586         void HandlePlayerQueryUUID(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    587         void HandlePlayerQueryInterface(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    588         void HandleADSPlayerAddDataSource(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    589         void HandleADSPlayerInit(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    590         void HandleADSPlayerAddVideoDataSink(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    591         void HandleADSPlayerAddAudioDataSink(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    592         void HandleADSPlayerPrepare(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    593         void HandleADSPlayerStart(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    594         void HandleADSPlayerPause(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    595         void HandlePlayerGetMetadataKeys(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    596         void HandlePlayerGetMetadataValues(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    597         void HandlePlayerSetParametersSync(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    598         void HandleGFPlayerStopFromPaused(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    599         void HandleGFPlayerPrepare(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    600         void HandleGFPlayerStart(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    601         void HandleGFPlayerPause(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    602         void HandleRDSPlayerStopFromPaused(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    603         void HandleRDSPlayerRemoveVideoDataSink(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    604         void HandleRDSPlayerRemoveAudioDataSink(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    605         void HandleRDSPlayerReset(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    606         void HandleRDSPlayerRemoveDataSource(PVFMUtilityContext& aUtilContext, const PVCmdResponse& aCmdResp);
    607 
    608         // Utility function to retrieve player specific error/info
    609         PVMFErrorInfoMessageInterface* GetErrorInfoMessageInterface(PVInterface& aInterface);
    610 
    611         // Player engine instance handle
    612         PVPlayerInterface* iPlayer;
    613 
    614         PvmiCapabilityAndConfig* iPlayerCapConfigIF;
    615         PVInterface* iPlayerCapConfigIFPVI;
    616 
    617         // Output Format Type
    618         PVMFFormatType iOutputFormatType;
    619 
    620         // User specified player data source handle
    621         PVPlayerDataSource* iDataSource;
    622 
    623         // Video data sink
    624         PVPlayerDataSinkPVMFNode iVideoDataSink;
    625         PVMFNodeInterface* iVideoNode;
    626         PVFMVideoMIO* iVideoMIO;
    627 
    628         // Audio data sink
    629         PVPlayerDataSinkPVMFNode iAudioDataSink;
    630         PVMFNodeInterface* iAudioNode;
    631         PVFMAudioMIO* iAudioMIO;
    632 
    633         // Handle to the logger node
    634         PVLogger* iLogger;
    635         PVLogger* iPerfLogger;
    636 
    637         // Context objects
    638         PVFMUtilityContext iUtilityContext;
    639         int32 iCancelContext;
    640         bool iErrorHandlingInUtilityAO;
    641 
    642         // UUID for calling QueryInterface() on player
    643         PVUuid iPlayerQueryIFUUID;
    644 
    645         // Resizable memory pool for utility allocated frame buffers
    646         OsclMemPoolResizableAllocator* iVideoFrameBufferMemPool;
    647         uint8* iCurrentVideoFrameBuffer;
    648         uint32* iVideoFrameBufferSize;
    649 
    650         // Pointer to video frame selection info passed-in by user
    651         PVFrameSelector* iVideoFrameSelector;
    652 
    653         // Pointer to video frame buffer property structure passed-in by user
    654         PVFrameBufferProperty* iVideoFrameBufferProp;
    655 
    656         // Flags for parallel async commands
    657         bool iFrameReceived;
    658         bool iPlayerStartCompleted;
    659 
    660         // Hold command status info when error occurs
    661         PVMFStatus iAPICmdStatus;
    662         PVMFErrorInfoMessageInterface* iAPICmdErrMsg;
    663 
    664         // OsclTimer for timeouts
    665         OsclTimer<OsclMemAllocator>* iTimeoutTimer;
    666         uint32 iErrorHandlingWaitTime;
    667         uint32 iFrameReadyWaitTime;
    668 
    669         uint32 iThumbnailWidth;
    670         uint32 iThumbnailHeight;
    671 };
    672 
    673 #endif // PV_FRAME_METADATA_UTILITY_H_INCLUDED
    674 
    675 
    676 
    677 
    678 
    679