videoplayerapp/mpxvideoplayer/inc/mpxvideoplayerappuiengine.h
branchRCL_3
changeset 57 befca0ec475f
child 64 3eb824b18d67
equal deleted inserted replaced
56:839377eedc2b 57:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  App UI engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Version : %version: da1mmcf#34 %
       
    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 <mpxviewactivationobserver.h>
       
    33 #include <mpxcollectionobserver.h>
       
    34 #include <mpxcollectionuihelperobserver.h>
       
    35 
       
    36 #ifdef __APPUIENGINESTIF__
       
    37 #include "mpxvideoplayerappui_stub.h"
       
    38 #else
       
    39 #include "mpxvideoplayerappui.h"
       
    40 #endif
       
    41 
       
    42 class CMpxVideoEmbeddedPdlHandler;
       
    43 class MMPXCollectionUiHelper;
       
    44 class CAiwGenericParamList;
       
    45 class CVideoPlaylistUtility;
       
    46 
       
    47 /**
       
    48 *  Application UI class.
       
    49 *
       
    50 *  @lib mpxvideoplayer.exe
       
    51 *  @since MpxVideoPlayer 0.1
       
    52 */
       
    53 class CMpxVideoPlayerAppUiEngine : public CBase,
       
    54                                    public MMPXViewActivationObserver,
       
    55                                    public MMPXCollectionObserver ,
       
    56                                    public MMPXCHelperEmbeddedOpenObserver
       
    57 {
       
    58     public:        // Constructors and destructor
       
    59         static CMpxVideoPlayerAppUiEngine* NewL( CMpxVideoPlayerAppUi* aAppUi );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CMpxVideoPlayerAppUiEngine();
       
    65 
       
    66     public:
       
    67 
       
    68         /*
       
    69          *  Retrieves playback utility and creates it if needed
       
    70          */
       
    71         MMPXPlaybackUtility& PlaybackUtilityL();
       
    72 
       
    73         /**
       
    74          * Opens the specified file in response to a corresponding message.
       
    75          *
       
    76          * @param aFile File to be opened.
       
    77          * @param aParams aiw generic parameters for the file
       
    78          */
       
    79         void OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams );
       
    80 
       
    81         /**
       
    82          * Opens the specified file in response to a corresponding message.
       
    83          *
       
    84          * @param aFile File to be opened.
       
    85          */
       
    86         void OpenFileL( const TDesC& aFileName );
       
    87 
       
    88         /**
       
    89          * Opens the specified mpx media object.
       
    90          *
       
    91          * @param aMedia Media to be opened.
       
    92          */
       
    93         void OpenMediaL( const CMPXMedia& aMedia );
       
    94 
       
    95         /*
       
    96          *  Activate the proper playback view
       
    97          */
       
    98         void ActivatePlaybackViewL();
       
    99 
       
   100         /**
       
   101          * Sets AppUiEngine in stand alone "mode"
       
   102          */
       
   103         void StartStandAloneL();
       
   104 
       
   105         /**
       
   106          * Handle media properties.
       
   107          */
       
   108         void DoHandleCollectionMediaL( const CMPXMedia& aMedia );
       
   109 
       
   110         /**
       
   111          * Steps one level up in collection path
       
   112          */
       
   113         void StepBackCollectionPathL();
       
   114 
       
   115         /*
       
   116          * Handle embedded playback message
       
   117          * @param aMessageUid message identification uid
       
   118          * @param aMessageParameters  aiw generic parameters
       
   119          */
       
   120         TBool HandleMessageL( TUid aMessageUid,
       
   121                               const TDesC8& aMessageParameters );
       
   122 
       
   123         /**
       
   124          * From MMPXViewActivationObserver
       
   125          * Handle view activation.
       
   126          *
       
   127          * @since 3.1
       
   128          * @param aCurrentViewType Current view type Uid.
       
   129          * @param aPreviousViewType Previous view type Uid.
       
   130          */
       
   131         void HandleViewActivation( const TUid& aCurrentViewType, const TUid& aPreviousViewType );
       
   132 
       
   133 
       
   134         /**
       
   135          *  From MPXCollectionObserver
       
   136          *  @since S60 3.2.3
       
   137          *  @param aMessage collection message, ownership not transferred.
       
   138          *         Please check aMsg is not NULL before using it. If aErr is not
       
   139          *         KErrNone, plugin might still call back with more info in the aMsg.
       
   140          *  @param aErr system error code
       
   141          */
       
   142         void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/ );
       
   143 
       
   144         /**
       
   145          * From MMPXCollectionObserver
       
   146          * Handle media properties.
       
   147          *
       
   148          * @since 3.1
       
   149          * @param aMedia  media properties.
       
   150          * @param aError Error code.
       
   151          */
       
   152         void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
   153 
       
   154          /**
       
   155          * From MMPXCollectionObserver
       
   156          * Handles the collection entries being opened.
       
   157          *
       
   158          * @since 3.1
       
   159          * @param aEntries Collection entries opened.
       
   160          * @param aIndex Focused entry.
       
   161          * @param aComplete ETrue no more entries. EFalse more entries
       
   162          *                  expected.
       
   163          * @param aError Error code.
       
   164          */
       
   165         void HandleOpenL( const CMPXMedia& aEntries,
       
   166                           TInt aIndex,
       
   167                           TBool aComplete,
       
   168                           TInt aError );
       
   169 
       
   170         /**
       
   171          * From MMPXCollectionObserver
       
   172          * Handles the item being opened.
       
   173          *
       
   174          * @since 3.1
       
   175          * @param aPlaylist Collection playlist, owner ship is transfered.
       
   176          * @param aError Error code.
       
   177          */
       
   178         void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError);
       
   179 
       
   180         // from base class MMPXCHelperEmbeddedOpenObserver
       
   181             /**
       
   182             * From MMPXCHelperEmbeddedOpenObserver
       
   183             * Handles errors from opening in embedded mode
       
   184             *
       
   185             * @since 3.1
       
   186             * @param aErr Error code
       
   187             * @param aCategory Type of item to be opened.
       
   188             */
       
   189         void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory  );
       
   190 
       
   191         void PreLoadPdlPlaybackViewL();
       
   192 
       
   193         /*
       
   194          * Handles the "back" button.
       
   195          */
       
   196         void HandleSoftKeyBackL();
       
   197 
       
   198         /*
       
   199          *  Processes shell commands.
       
   200          *  @param aCommand
       
   201          *  @param aDocumentName
       
   202          *  @param aTail
       
   203          *  @return  ETrue if document name exists
       
   204          */
       
   205         TBool ProcessCommandParametersL( TApaCommand aCommand,
       
   206                                          TFileName& aDocumentName,
       
   207                                          const TDesC8& aTail );
       
   208 
       
   209         /*
       
   210          *  Provides the static function for the callback to exit the application
       
   211          *  Called by CIdle iIdle
       
   212          *  @since 9.2
       
   213          *  @param aPtr Pointer to callback class
       
   214          *  @return KErrNone
       
   215          */
       
   216         static TInt ExitApplicationL( TAny* aPtr );
       
   217 
       
   218         /*
       
   219          * returns the viewdepth from the viewutlity
       
   220          */
       
   221         TInt ViewHistoryDepth();
       
   222 
       
   223         void ClearPdlInformation();
       
   224 
       
   225         void InitializeFileL( const TDesC& aFileName );
       
   226 
       
   227         void ClosePlaybackPluginL();
       
   228 
       
   229         void SendMessageToPdlViewL( TInt aMsg );
       
   230 
       
   231         /*
       
   232          *  Activates an active object to finish the
       
   233          *  initialization of the standalone application
       
   234          */
       
   235         void ActivateLateConstructTimerL();
       
   236 
       
   237     private:
       
   238         /**
       
   239          * Constructor
       
   240          */
       
   241         CMpxVideoPlayerAppUiEngine( CMpxVideoPlayerAppUi* aAppUi );
       
   242 
       
   243         /**
       
   244          * Default constructor
       
   245          */
       
   246         CMpxVideoPlayerAppUiEngine( );
       
   247 
       
   248         /**
       
   249          * By default Symbian 2nd phase constructor is private.
       
   250          */
       
   251         void ConstructL();
       
   252 
       
   253 
       
   254         void HandleMultiLinksFileL( const TDesC& aFileName,
       
   255                                     CMediaRecognizer::TMediaType aMediaType );
       
   256 
       
   257         void HandleMultiLinksFileL( RFile& aFile,
       
   258                                     CMediaRecognizer::TMediaType aMediaType );
       
   259 
       
   260         void DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
       
   261                                       TBool aSingleLink,
       
   262                                       TBool aLocalFile );
       
   263 
       
   264         TPtrC GetLinkLC( const TDesC& aFileName,
       
   265                          CMediaRecognizer::TMediaType aMediaType,
       
   266                          TBool aUseFileHandle = EFalse );
       
   267 
       
   268         TInt HandleAiwGenericParamListL( const CAiwGenericParamList* aParams );
       
   269 
       
   270         /**
       
   271         * Handle collection message
       
   272         *
       
   273         * @param aMessage collection message
       
   274         */
       
   275        void DoHandleCollectionMessageL( CMPXMessage* aMessage );
       
   276 
       
   277        void CreateCollectionUtilityMemberVariablesL();
       
   278 
       
   279        void CreateRemoteControlListenerL();
       
   280 
       
   281        /*
       
   282         *  Activates an active object to exit the application
       
   283         *  @since 5.0
       
   284         */
       
   285        void ActivateExitActiveObject();
       
   286 
       
   287        /*
       
   288         *  Called to stop and exit the application
       
   289         *  @since 9.2
       
   290         *  @return void
       
   291         */
       
   292        virtual void DoExitApplicationL();
       
   293 
       
   294        /*
       
   295        * used to send media info to plugin
       
   296        */
       
   297        void UpdatePbPluginMediaL();
       
   298 
       
   299        void InitializeStreamingLinkL( const TDesC& aUri );
       
   300        void InitializePlaylistL( const CMPXCollectionPlaylist& aPlaylist, TBool aPlay );
       
   301 
       
   302         /*
       
   303          *  Provides the static function for the callback to
       
   304          *  finish the standalone application construction
       
   305          *  Called by CPeriodic iConstructTimer
       
   306          *  @param aPtr Pointer to callback class
       
   307          *  @return KErrNone
       
   308          */
       
   309         static TInt LateConstructCallback( TAny* aPtr );
       
   310 
       
   311         /*
       
   312          *  Called to finalize the standalone
       
   313          *  application initialization.
       
   314          */
       
   315         virtual void DoLateConstructL();
       
   316 
       
   317     private:       // data
       
   318 
       
   319         CMpxVideoPlayerAppUi*         iAppUi;
       
   320 
       
   321         //
       
   322         //  Owned Utilities
       
   323         //
       
   324         MMPXPlaybackUtility*     iPlaybackUtility;
       
   325         MMPXViewUtility*         iViewUtility;
       
   326         MMPXCollectionUtility*   iCollectionUtility;
       
   327         MMPXCollectionUiHelper*  iCollectionUiHelper;  // own
       
   328 
       
   329         CPeriodic*                    iConstructTimer;
       
   330         CIdle*                        iExitAo;
       
   331         CMediaRecognizer*             iRecognizer;       // own
       
   332         CMpxVideoEmbeddedPdlHandler*  iPdlHandler;       // own
       
   333 
       
   334         TInt                     iAccessPointId;
       
   335         TBool                    iMultilinkPlaylist;
       
   336         TBool                    iSeekable;
       
   337         TBool                    iUpdateSeekInfo;
       
   338     };
       
   339 
       
   340 #endif             // CMPXVIDEOPLAYERAPPUIENGINE_H