mpx/playbackframework/playbackengine/inc/mpxplaybackmediahelper.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Playback engine's media helper
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXPLAYBACKMEDIAHELPER_H
       
    21 #define CMPXPLAYBACKMEDIAHELPER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <mpxcollectionpath.h>
       
    25 #include <mpxtaskqueueobserver.h>
       
    26 #include <mpxcollectionobserver.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMPXPlaybackEngine;
       
    30 class CMPXActiveTaskQueue;
       
    31 class MMPXPlaybackEngineObserver;
       
    32 class MMPXCollectionUtility;
       
    33 class CMPXClientList;
       
    34 
       
    35 /**
       
    36 *  Helper class to retrieve media for clients
       
    37 */
       
    38 NONSHARABLE_CLASS( CMPXPlaybackMediaHelper ) : public CBase,
       
    39                                                public MMPXTaskQueueObserver,
       
    40                                                public MMPXCollectionObserver
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45     * Two-phased constructor
       
    46     */
       
    47     static CMPXPlaybackMediaHelper* NewL( CMPXPlaybackEngine& aEngine );
       
    48 
       
    49     /**
       
    50     * Destructor.
       
    51     */
       
    52     virtual ~CMPXPlaybackMediaHelper();
       
    53 
       
    54 private: // constructors
       
    55 
       
    56     /**
       
    57     * Constructor.
       
    58     */
       
    59     CMPXPlaybackMediaHelper( CMPXPlaybackEngine& aEngine );
       
    60 
       
    61     /**
       
    62     * Symbian OS constructor.
       
    63     */
       
    64     void ConstructL();
       
    65 
       
    66 public: // New Methods
       
    67 
       
    68     /**
       
    69     * Retrieves the media given the current path, and upon return,
       
    70     * either calls back the observer, or broadcasts the message to
       
    71     * the given client list
       
    72     *
       
    73     * @param aPath Collection path to retrieve media.
       
    74     * @param aCmd CMPXCommand containing the attributes and attribute spec
       
    75     *             Ownership of aAttrs is passed to this method
       
    76     * @param aObserver Callback to return media to
       
    77     * @param aBroadcast Whether or not to broadcast media message
       
    78     * @param aClientlist Clientlist to broadcast message to
       
    79     */
       
    80     void MediaL( const CMPXCollectionPath& aPath,
       
    81                  CMPXCommand* aCmd,
       
    82                  MMPXPlaybackEngineObserver* aObserver,
       
    83                  TBool aBroadcast = EFalse,
       
    84                  CMPXClientList* aClientList = NULL );
       
    85 
       
    86     /**
       
    87     * Cancels all outstanding requests
       
    88     */
       
    89     void CancelRequests();
       
    90 
       
    91 private: // From base classes
       
    92 
       
    93     /**
       
    94     *  From MMPXTaskQueueObserver
       
    95     */
       
    96     void ExecuteTask( TInt aTask,
       
    97                       TInt aParamData,
       
    98                       TAny* aPtrData,
       
    99                       const CBufBase& aBuf,
       
   100                       TAny* aCallback,
       
   101                       CBase* aCObject1,
       
   102                       CBase* aCObject2);
       
   103 
       
   104     /**
       
   105     * @see MMPXTaskQueueObserver
       
   106     */
       
   107     void HandleTaskError(TInt aTask,
       
   108                          TAny* aPtrData,
       
   109                          TAny* aCallback,
       
   110                          TInt aError);
       
   111 
       
   112 	/**
       
   113     *  From MMPXCollectionObserver
       
   114     */
       
   115     void HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr);
       
   116 
       
   117     /**
       
   118     *  From MMPXCollectionObserver
       
   119     */
       
   120     void HandleOpenL( const CMPXMedia& aEntries,
       
   121                       TInt aIndex,
       
   122                       TBool aComplete,
       
   123                       TInt aError );
       
   124 
       
   125     /**
       
   126     *  From MMPXCollectionObserver
       
   127     */
       
   128     void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
       
   129                       TInt aError );
       
   130 
       
   131     /**
       
   132      *  From MMPXCollectionObserver
       
   133      */
       
   134     void HandleCommandComplete( CMPXCommand* aCommandResult,
       
   135                                 TInt aError );
       
   136 
       
   137     /**
       
   138     *  From MMPXCollectionMediaObserver
       
   139     */
       
   140     void HandleCollectionMediaL( const CMPXMedia& aMedia,
       
   141                                  TInt aError);
       
   142 
       
   143 private:  // New functions
       
   144 
       
   145     /**
       
   146     * Executes task, leaving method
       
   147     */
       
   148     void DoExecuteTaskL(
       
   149             TInt aTask,
       
   150             TInt aParamData,
       
   151             TAny* aPtrData,
       
   152             const CBufBase& aBuf,
       
   153             TAny* aCallback,
       
   154             CBase* aCObject1,
       
   155             CBase* aCObject2);
       
   156 
       
   157 private: // data
       
   158     CMPXPlaybackEngine& iEngine;
       
   159     MMPXCollectionUtility* iCollectionUtility;
       
   160     CMPXActiveTaskQueue* iTaskQueue;
       
   161     };
       
   162 
       
   163 #endif // CMPXPLAYBACKMEDIAHELPER_H
       
   164 
       
   165 //End of file