mpxplugins/serviceplugins/playbackplugins/localaudio/inc/mpxlocalaudioplayback.h
changeset 0 ff3acec5bc43
child 28 56b11cf8addb
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     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:  This class plays local audio file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CLOCALAUDIOPLAYBACK_H
       
    21 #define CLOCALAUDIOPLAYBACK_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <mpxplaybackplugin.h>
       
    25 #include <mdaaudiosampleplayer.h>
       
    26 #include <mpxcenrepobserver.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMPXCenRepWatcher;
       
    30 class CMPXDrmMediaUtility;
       
    31 class CMPXAudioEffectEngine;
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  CMPXLocalAudioPlayback class
       
    39 *
       
    40 *  Plug-in basically handles audio via MMF's audio player utility.
       
    41 *  @lib LocalAudioPlayback.lib
       
    42 */
       
    43 NONSHARABLE_CLASS(CMPXLocalAudioPlayback) : public CMPXPlaybackPlugin,
       
    44                                             public MMdaAudioPlayerCallback,
       
    45                                             public MMPXCenRepObserver
       
    46     {
       
    47     private:
       
    48         enum TMPXLocalAudioPlaybackState
       
    49             {
       
    50             EStateNotInitialised,
       
    51             EStateInitialising,
       
    52             EStateInitialised
       
    53             };
       
    54     public: // Constructors and destructor
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         * @param aInitParams, initialization parameter
       
    58         * @return a pointer to the created instance
       
    59         */
       
    60         static CMPXLocalAudioPlayback* NewL(TAny* aInitParams);
       
    61 
       
    62         /**
       
    63         * Destructor
       
    64         * Destroy the object and release all memory objects
       
    65         */
       
    66         ~CMPXLocalAudioPlayback();
       
    67 
       
    68     private: // Functions from base classes
       
    69         /**
       
    70         *  from CMPXPlaybackPlugin
       
    71         */
       
    72 
       
    73         /**
       
    74         * Set observer
       
    75         *
       
    76         * @param aObs observer
       
    77         */
       
    78         void SetObserver(MMPXPlaybackPluginObserver& aObs);
       
    79 
       
    80         /**
       
    81         * Initializes a song for playback
       
    82         * @param aSong the song path
       
    83         */
       
    84         void InitialiseL(const TDesC& aSong);
       
    85 
       
    86         /**
       
    87         * Initializes a song for playback
       
    88         * @param aFile file handle of a song
       
    89         */
       
    90         void InitialiseL(RFile& aFile);
       
    91 
       
    92         /**
       
    93         * Executes a command on the selected song
       
    94         * @param aCmd a command
       
    95         * @param aData, data
       
    96         */
       
    97         void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
       
    98 
       
    99         /**
       
   100         * Sets a property of the plugin
       
   101         * @param aProperty a property
       
   102         * @param aValue the value of the setting
       
   103         */
       
   104         void SetL(TMPXPlaybackProperty aProperty,TInt aValue);
       
   105 
       
   106         /**
       
   107         * Gets a property of the plugin (async)
       
   108         * @param aProperty a property
       
   109         */
       
   110         void PropertyL(TMPXPlaybackProperty aProperty) const;
       
   111 
       
   112         /**
       
   113         * Gets a list of sub players
       
   114         * @return a list of names of sub players
       
   115         */
       
   116         void SubPlayerNamesL();
       
   117 
       
   118         /**
       
   119         * Select a sub player
       
   120         * @param aIndex index to the sub player
       
   121         */
       
   122     	void SelectSubPlayerL(TInt aIndex);
       
   123 
       
   124         /**
       
   125         * Returns current sub player name
       
   126         * @return friendly name of the current the sub player
       
   127         */
       
   128         const TDesC& SubPlayerName();
       
   129 
       
   130         /**
       
   131         * Current sub player index
       
   132         * @return index to the sub player
       
   133         */
       
   134         TInt SubPlayerIndex() const;
       
   135 
       
   136         /**
       
   137         * Media properties of the current file (async)
       
   138         * @param aAttrs attributes requested
       
   139         */
       
   140         void MediaL(const TArray<TMPXAttribute>& aAttrs);
       
   141 
       
   142         /**
       
   143         * Cancel async request
       
   144         */
       
   145         void CancelRequest();
       
   146 
       
   147         /**
       
   148         *  From MMdaAudioPlayerCallback
       
   149         */
       
   150         void MapcInitComplete(TInt aError,
       
   151                               const TTimeIntervalMicroSeconds& aDuration);
       
   152 
       
   153         /**
       
   154         *  From MMdaAudioPlayerCallback
       
   155         */
       
   156         void MapcPlayComplete(TInt aError);
       
   157 
       
   158         /**
       
   159         * From MMPXCenRepObserver
       
   160         * Handle a change in a setting value.
       
   161         *
       
   162         * @param aRepositoryUid Central repository UID containing the setting
       
   163         * @param aSettingId Id of the setting
       
   164         * @since 3.0
       
   165         */
       
   166         void HandleSettingChange( const TUid& aRepositoryUid,
       
   167                                   TUint32 aSettingId);
       
   168     private:
       
   169        /**
       
   170         * C++ default constructor
       
   171         */
       
   172         CMPXLocalAudioPlayback();
       
   173 
       
   174         /**
       
   175         * the second phase constructor ConstructL to safely construct things
       
   176         * that can leave
       
   177         */
       
   178         void ConstructL();
       
   179 
       
   180         /**
       
   181         * Sets the volume level in audio controller
       
   182         * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax
       
   183         */
       
   184         void SetVolume( TInt aVolume );
       
   185 
       
   186         /**
       
   187         * Sets the volume level in audio controller to mute.
       
   188         * @param aMute ETrue to indicated mute
       
   189         */
       
   190         void SetMute( TBool aMute );
       
   191 
       
   192         /**
       
   193         *  Consumes the rights for the current media according
       
   194         *  to the specified consume type
       
   195         *
       
   196         *  @param aType Type of consumption to execute
       
   197         */
       
   198         void ConsumeRightsL(ContentAccess::TIntent aIntent);
       
   199 
       
   200 
       
   201     private: // Data
       
   202         CMPXCenRepWatcher* iVolumeWatcher;
       
   203         CMPXCenRepWatcher* iMuteWatcher;
       
   204         CMdaAudioPlayerUtility* iPlayer;
       
   205         HBufC* iSong;
       
   206         TInt iVolume;
       
   207         RFs iFs;
       
   208         RFile iFile;
       
   209         CMPXDrmMediaUtility* iDrmMediaUtility;
       
   210         CMPXAudioEffectEngine* iAudioEffects;
       
   211         TMPXLocalAudioPlaybackState iState;
       
   212         TBool iClosedByAudioPolicy;
       
   213         TBool iConsumeStarted;
       
   214         TBool iAudioEffectsOn;
       
   215         TBool iIsPlaying;
       
   216     };
       
   217 
       
   218 #endif      // CLOCALAUDIOPLAYBACK_H
       
   219 
       
   220