videoplayerapp/videoplayerengine/inc/mpxvideoplayerappuiengine.h
branchRCL_3
changeset 56 839377eedc2b
equal deleted inserted replaced
54:315810614048 56:839377eedc2b
       
     1 /*
       
     2 * Copyright (c) 2009 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:  CMpxVideoPlayerAppUiEngine
       
    15  *
       
    16 */
       
    17 
       
    18 // Version : %version:  8 %
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CMPXVIDEOPLAYERAPPUIENGINE_H
       
    23 #define CMPXVIDEOPLAYERAPPUIENGINE_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <mpxplaybackutility.h>
       
    27 #include <mpxviewutility.h>
       
    28 #include <mpxcollectionutility.h>
       
    29 #include <mpxmessage2.h>
       
    30 #include <mpxcollectionplaylist.h>
       
    31 #include <mediarecognizer.h>
       
    32 #include <mpxplaybackobserver.h>
       
    33 #include <mpxviewactivationobserver.h>
       
    34 #include <mpxcollectionobserver.h>
       
    35 #include <mpxcollectionuihelperobserver.h>
       
    36 
       
    37 class CMPXCommonUiHelper;
       
    38 class MMPXCollectionUiHelper;
       
    39 class CVideoPlaylistUtility;
       
    40 class VideoPlaybackWrapper;
       
    41 
       
    42 /**
       
    43 *  Application UI class.
       
    44 *
       
    45 *  @lib mpxvideoplayer.exe
       
    46 *  @since MpxVideoPlayer 0.1
       
    47 */
       
    48 class CMpxVideoPlayerAppUiEngine : public CBase,
       
    49                                    public MMPXPlaybackObserver,
       
    50                                    public MMPXViewActivationObserver,
       
    51                                    public MMPXCollectionObserver ,
       
    52                                    public MMPXCHelperEmbeddedOpenObserver
       
    53 {
       
    54     public:        // Constructors and destructor
       
    55         static CMpxVideoPlayerAppUiEngine* NewL( VideoPlaybackWrapper* aWrapper );
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         virtual ~CMpxVideoPlayerAppUiEngine();
       
    61 
       
    62     public:
       
    63         /*
       
    64          *  Retrieve the playback utility pointer
       
    65          */
       
    66         inline MMPXPlaybackUtility* PlaybackUtility();
       
    67 
       
    68         /**
       
    69          * Opens the specified file in response to a corresponding message.
       
    70          *
       
    71          * @param aFile File to be opened.
       
    72          */
       
    73         void OpenFileL( const TDesC& aFileName );
       
    74         
       
    75         /**
       
    76          * Opens the specified file in response to a corresponding message.
       
    77          *
       
    78          * @param aFile File to be opened.
       
    79          */        
       
    80         void OpenFileL( RFile& aFile );
       
    81 
       
    82         /**
       
    83          * Opens the specified mpx media object.
       
    84          *
       
    85          * @param aMedia Media to be opened.
       
    86          */
       
    87         void OpenMediaL( const CMPXMedia& aMedia );
       
    88 
       
    89         /**
       
    90          * Handle playback message
       
    91          *
       
    92          * @param aMessage playback message
       
    93          */
       
    94         void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
       
    95 
       
    96         /**
       
    97          * Handle Player Changed Playback Message
       
    98          */
       
    99         void HandlePlaybackPlayerChangedL();
       
   100 
       
   101         /**
       
   102          * Sets mpx components ready for application shutdown
       
   103          */
       
   104         void PrepareCloseMpxL();
       
   105 
       
   106         /**
       
   107          * Handle media properties.
       
   108          */
       
   109         void DoHandelCollectionMediaL( const CMPXMedia& aMedia );
       
   110 
       
   111         /*
       
   112          * Handle embedded playback message
       
   113          * @param aMessageUid message identification uid
       
   114          * @param aMessageParameters  aiw generic parameters
       
   115          */
       
   116         TBool HandleMessageL( TUid aMessageUid,
       
   117                               const TDesC8& aMessageParameters );
       
   118 
       
   119         /**
       
   120          * From MMPXPlaybackObserver
       
   121          * Handle playback message
       
   122          *
       
   123          * @since 3.1
       
   124          * @param aMessage playback message
       
   125          * @param aErr system error code.
       
   126          */
       
   127         void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
   128 
       
   129         /**
       
   130          * From MMPXViewActivationObserver
       
   131          * Handle view activation.
       
   132          *
       
   133          * @since 3.1
       
   134          * @param aCurrentViewType Current view type Uid.
       
   135          * @param aPreviousViewType Previous view type Uid.
       
   136          */
       
   137         void HandleViewActivation( const TUid& aCurrentViewType, const TUid& aPreviousViewType );
       
   138 
       
   139 
       
   140         /**
       
   141          *  From MPXCollectionObserver
       
   142          *  @since S60 3.2.3
       
   143          *  @param aMessage collection message, ownership not transferred.
       
   144          *         Please check aMsg is not NULL before using it. If aErr is not
       
   145          *         KErrNone, plugin might still call back with more info in the aMsg.
       
   146          *  @param aErr system error code
       
   147          */
       
   148         void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/ );
       
   149 
       
   150         /**
       
   151          * From MMPXCollectionObserver
       
   152          * Handle media properties.
       
   153          *
       
   154          * @since 3.1
       
   155          * @param aMedia  media properties.
       
   156          * @param aError Error code.
       
   157          */
       
   158         void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
   159 
       
   160          /**
       
   161          * From MMPXCollectionObserver
       
   162          * Handles the collection entries being opened.
       
   163          *
       
   164          * @since 3.1
       
   165          * @param aEntries Collection entries opened.
       
   166          * @param aIndex Focused entry.
       
   167          * @param aComplete ETrue no more entries. EFalse more entries
       
   168          *                  expected.
       
   169          * @param aError Error code.
       
   170          */
       
   171         void HandleOpenL( const CMPXMedia& aEntries,
       
   172                           TInt aIndex,
       
   173                           TBool aComplete,
       
   174                           TInt aError );
       
   175 
       
   176         /**
       
   177          * From MMPXCollectionObserver
       
   178          * Handles the item being opened.
       
   179          *
       
   180          * @since 3.1
       
   181          * @param aPlaylist Collection playlist, owner ship is transfered.
       
   182          * @param aError Error code.
       
   183          */
       
   184         void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError);
       
   185 
       
   186         // from base class MMPXCHelperEmbeddedOpenObserver
       
   187             /**
       
   188             * From MMPXCHelperEmbeddedOpenObserver
       
   189             * Handles errors from opening in embedded mode
       
   190             *
       
   191             * @since 3.1
       
   192             * @param aErr Error code
       
   193             * @param aCategory Type of item to be opened.
       
   194             */
       
   195         void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory  );
       
   196        
       
   197         /*
       
   198          *  Late initializatoin of members that can be delayed 
       
   199          *  to help improve startup time
       
   200          *  @since 10.1
       
   201          */        
       
   202         void LateInitL();
       
   203         
       
   204         TInt ReplayAfterPriorTermination(const TDesC& aFileName);
       
   205         
       
   206         /*
       
   207          *  converts provided error code to a string  
       
   208          *  @since 10.1
       
   209          *  @param aErrorCode error code to be converted
       
   210          */          
       
   211         const TDesC& ResolveErrorStringL(TInt aErrorCode);
       
   212 
       
   213     private:
       
   214         /**
       
   215          * Constructor
       
   216          */
       
   217         CMpxVideoPlayerAppUiEngine( VideoPlaybackWrapper* aWrapper );
       
   218 
       
   219         /**
       
   220          * By default Symbian 2nd phase constructor is private.
       
   221          */
       
   222         void ConstructL();
       
   223 
       
   224 
       
   225         void HandleMultiLinksFileL( const TDesC& aFileName,
       
   226                                     CMediaRecognizer::TMediaType aMediaType );
       
   227 
       
   228         void HandleMultiLinksFileL( RFile& aFile,
       
   229                                     CMediaRecognizer::TMediaType aMediaType );
       
   230 
       
   231         void DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
       
   232                                       TBool aSingleLink,
       
   233                                       TBool aLocalFile );
       
   234 
       
   235         /**
       
   236          *  Handles the Url descriptor
       
   237          *
       
   238          *  @param aUrl - the ulr to be handled
       
   239          */
       
   240         void HandleUrlDesL(const TDesC& aUrl);
       
   241 
       
   242        /**
       
   243        * Handle collection message
       
   244        *
       
   245        * @param aMessage collection message
       
   246        */
       
   247        void DoHandleCollectionMessageL( CMPXMessage* aMessage );
       
   248 
       
   249        void CreatePlaybackUtilityL();
       
   250 
       
   251        void CreateCollectionUtilityMemberVariablesL();
       
   252       
       
   253 	   /*
       
   254 	   * used to send media info to plugin
       
   255 	   */
       
   256        void UpdatePbPluginMediaL();
       
   257 
       
   258        void ActivateVideoPlaybackView();
       
   259               
       
   260        void ReadActivityData();
       
   261 
       
   262     private:       // data
       
   263 
       
   264         //
       
   265         //  Owned Utilities
       
   266         //
       
   267         MMPXPlaybackUtility*     iPlaybackUtility;
       
   268         MMPXCollectionUtility*   iCollectionUtility;
       
   269         MMPXCollectionUiHelper*  iCollectionUiHelper;  // own
       
   270 
       
   271         TUid                     iVideoCollectionId;
       
   272 
       
   273         CMediaRecognizer*        iRecognizer;       // own
       
   274 
       
   275         TInt                     iAccessPointId;
       
   276         TBool                    iMultilinkPlaylist;
       
   277         TBool                    iSeekable;
       
   278         TBool                    iUpdateSeekInfo;
       
   279 
       
   280         VideoPlaybackWrapper*    iPlaybackWrapper;
       
   281         TUint32                  iLastPlayedItemId;
       
   282 };
       
   283 
       
   284 //
       
   285 //  Inline methods
       
   286 //
       
   287 inline
       
   288 MMPXPlaybackUtility* CMpxVideoPlayerAppUiEngine::PlaybackUtility()
       
   289 {
       
   290     return iPlaybackUtility;
       
   291 }
       
   292 
       
   293 #endif             // CMPXVIDEOPLAYERAPPUIENGINE_H