musichomescreen/mcpmusicplayer/inc/aiplayerpluginengine.h
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Engine which interfaces to MPX framework.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AIPLAYERPLUGINENGINE_H
       
    20 #define C_AIPLAYERPLUGINENGINE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <mpxplaybackobserver.h>
       
    24 #include <mpxalbumartutilobserver.h>
       
    25 #include "aiplayerpluginengineobserver.h"
       
    26 
       
    27 class MMPXPlaybackUtility;
       
    28 class CMPXAlbumArtUtil;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Music Player Player Plugin Engine.
       
    33  *  This class provides interface to MPX framework.
       
    34  *
       
    35  *  @lib aiplayerplugin2.lib
       
    36  *  @since S60 5.0
       
    37  */
       
    38 NONSHARABLE_CLASS( CAiPlayerPluginEngine ) : public CBase,
       
    39                                              public MMPXPlaybackObserver,
       
    40                                              public MMPXPlaybackCallback,
       
    41                                              public MMPXAlbumArtUtilObserver
       
    42     {
       
    43 public: // Constructors and destructor
       
    44 
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     static CAiPlayerPluginEngine* NewL( MAiPlayerPluginEngineObserver& aObserver );
       
    49 
       
    50     /**
       
    51      * Destructor.
       
    52      */
       
    53     virtual ~CAiPlayerPluginEngine();
       
    54 
       
    55     /**
       
    56      * From MMPXPlaybackObserver
       
    57      * See mpxplaybackobserver.h for detailed description.
       
    58      * @since S60 5.0
       
    59      */
       
    60     void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
    61 
       
    62     /**
       
    63      * From MMPXPlaybackCallback
       
    64      * See mpxplaybackobserver.h for detailed description.
       
    65      * @since S60 5.0
       
    66      */
       
    67     void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
       
    68     void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
       
    69     void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
       
    70     void HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError );
       
    71 
       
    72     /**
       
    73      * From MMPXAlbumArtUtilObserver
       
    74      * See mpxalbumartutilobserver.h for detailed description
       
    75      * @since S60 3.2.3
       
    76      */
       
    77     void ExtractAlbumArtStarted();
       
    78     void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr );
       
    79 public:
       
    80 
       
    81     /**
       
    82      * Get the current state of the active player.
       
    83      *
       
    84      * @return Active player state
       
    85      * @see TMPlayerState
       
    86      */
       
    87     TMPlayerState PlayerState();
       
    88 
       
    89     /**
       
    90      * Get the title of the currently playing song.
       
    91      *
       
    92      * @return Song title
       
    93      */
       
    94     const TDesC& TitleL();
       
    95 
       
    96     /**
       
    97      * Get the artist of the currently playing song.
       
    98      *
       
    99      * @return Artist
       
   100      */
       
   101     const TDesC& Artist();
       
   102     
       
   103     /**
       
   104      * Get the uri of the currently playing song.
       
   105      *
       
   106      * @return Uri
       
   107      */
       
   108     const TDesC& Uri();
       
   109 
       
   110     /**
       
   111      * Get the current position.
       
   112      *
       
   113      * @return Current position.
       
   114      */
       
   115     TInt Position();
       
   116 
       
   117     /**
       
   118      * Get the duration of the currently playing song.
       
   119      *
       
   120      * @return Song duration.
       
   121      */
       
   122     TInt Duration();
       
   123 
       
   124 
       
   125 private:
       
   126 
       
   127     /**
       
   128      * C++ default constructor.
       
   129      */
       
   130     CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver );
       
   131 
       
   132     /**
       
   133      * By default Symbian 2nd phase constructor is private.
       
   134      */
       
   135     void ConstructL();
       
   136 
       
   137     /**
       
   138      *  Handle playback message
       
   139      *
       
   140      *  @param aMessage playback message
       
   141      */
       
   142     void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
       
   143 
       
   144     /**
       
   145      *  Handle playback property
       
   146      *
       
   147      *  @param aProperty the property
       
   148      *  @param aValue the value of the property
       
   149      *  @param aError error code
       
   150      */
       
   151     void DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError );
       
   152 
       
   153     /**
       
   154      *  Handle playback state changed.
       
   155      *
       
   156      *  @param aState New Playback state
       
   157      */
       
   158     void DoHandleStateChangedL( TMPXPlaybackState aState );
       
   159 
       
   160     /**
       
   161      * Displays error notes.
       
   162      *
       
   163      * @param aError Error ID to be handled.
       
   164      */
       
   165     void HandleErrorL( TInt aError );
       
   166 
       
   167     /**
       
   168      *  Map states from TMPXPlaybackState to TMPlayerState
       
   169      *
       
   170      *  @param aState State in TMPXPlaybackState format
       
   171      *  @return State in TMPlayerState format, or KErrNotFound
       
   172      *          if the state can't be mapped
       
   173      */
       
   174     TMPlayerState MapState( TMPXPlaybackState aState );
       
   175 
       
   176    /**
       
   177      *  Request media.
       
   178      */
       
   179     void RequestMediaL();
       
   180 private:    // Data
       
   181 
       
   182     MAiPlayerPluginEngineObserver* 	iObserver; 			// Not owned
       
   183     MMPXPlaybackUtility*            iPlaybackUtility;   // Owned    
       
   184     CMPXAlbumArtUtil* iAlbumArtUtil;  // own
       
   185     HBufC*		iTitle;  // own
       
   186     HBufC*      iArtist;  // own
       
   187     HBufC*      iUri;  // own
       
   188     CMPXMedia*  iMedia;  // own
       
   189     TInt		iPosition;
       
   190     TInt		iDuration;
       
   191     TBool       iExtractingAlbumArt;
       
   192     TBool       iSkipping;
       
   193     
       
   194     
       
   195     };
       
   196 
       
   197 #endif  // C_CAiPlayerPluginEngine_H
       
   198 
       
   199 // End of File