videoplayback/hbvideoplaybackview/viewinc/mpxvideoviewwrapper.h
changeset 44 518105d52e45
parent 42 17f382c040b1
child 49 824471cb468a
equal deleted inserted replaced
42:17f382c040b1 44:518105d52e45
     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:  MPX Video base playback view
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  da1mmcf#16 %
       
    19 
       
    20 
       
    21 
       
    22 // This file defines the API for .dll
       
    23 
       
    24 #ifndef __MPXVIDEOVIEWWRAPPER_H__
       
    25 #define __MPXVIDEOVIEWWRAPPER_H__
       
    26 
       
    27 //  Include Files
       
    28 
       
    29 #include <e32base.h>	// CBase
       
    30 #include <e32std.h>	 // TBuf
       
    31 #include <mpxplaybackobserver.h>
       
    32 #include <mpxvideoplaybackdefs.h>
       
    33 #include <mpxviewactivationobserver.h>
       
    34 #include <mpxcollectionobserver.h>
       
    35 
       
    36 #include "mpxvideoplaybackcontrol.hrh"
       
    37 
       
    38 enum TMPXMediaRequestStatus
       
    39 {
       
    40     MediaNotRequested,
       
    41     MediaRequested,
       
    42     MediaDelivered
       
    43 };
       
    44 
       
    45 //  Forward Declarations
       
    46 class MMPXPlaybackUtility;
       
    47 class MMPXCollectionUtility;
       
    48 class HbVideoBasePlaybackView;
       
    49 class CMPXVideoPlaybackDisplayHandler;
       
    50 class QMPXVideoPlaybackViewFileDetails;
       
    51 class CMPXVideoPlaybackUserInputHandler;
       
    52 class QMPXVideoPlaybackControlsController;
       
    53 
       
    54 //  Class Definitions
       
    55 
       
    56 class CMPXVideoViewWrapper : public CBase,
       
    57                              public MMPXPlaybackObserver,
       
    58                              public MMPXViewActivationObserver,
       
    59                              public MMPXPlaybackCallback,
       
    60                              public MMPXCollectionObserver
       
    61 {
       
    62     public:
       
    63         static CMPXVideoViewWrapper* NewL( HbVideoBasePlaybackView* aView );
       
    64         virtual ~CMPXVideoViewWrapper();
       
    65 
       
    66     private:
       
    67         CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView );
       
    68         void ConstructL();
       
    69 
       
    70     public:
       
    71         virtual void HandleCommandL( TInt aCommand );
       
    72 
       
    73         void RetrieveFileNameAndModeL( CMPXCommand* aCmd );
       
    74 
       
    75         /*
       
    76          *  From MMPXViewActivationObserver
       
    77          *  Handle view activation.
       
    78          *
       
    79          *  @param aCurrentViewType Current view type Uid.
       
    80          *  @param aPreviousViewType Previous view type Uid.
       
    81          */
       
    82         inline void HandleViewActivation( const TUid& /*aCurrentViewType*/,
       
    83                                           const TUid& /*aPreviousViewType*/ ) {}
       
    84 
       
    85         /**
       
    86         * From MMPXPlaybackObserver
       
    87         * Handle playback message
       
    88         *
       
    89         * @param aMessage Playback Message
       
    90         * @param aErr system error code.
       
    91         */
       
    92         virtual void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
    93 
       
    94         /**
       
    95         *  From MMPXPlaybackCallback
       
    96         *  Handle playback property
       
    97         *
       
    98         *  @param aProperty the property
       
    99         *  @param aValue the value of the property
       
   100         *  @param aError error code
       
   101         */
       
   102     	void HandlePropertyL( TMPXPlaybackProperty aProperty,
       
   103                               TInt aValue,
       
   104                               TInt aError );
       
   105 
       
   106         /**
       
   107         *  Method is called continously until aComplete=ETrue, signifying that
       
   108         *  it is done and there will be no more callbacks
       
   109         *  Only new items are passed each time
       
   110         *
       
   111         *  @param aPlayer UID of the subplayer
       
   112         *  @param aSubPlayers a list of sub players
       
   113         *  @param aComplete ETrue no more sub players. EFalse more subplayer
       
   114         *                   expected
       
   115         *  @param aError error code
       
   116         */
       
   117         inline void HandleSubPlayerNamesL( TUid /*aPlayer*/,
       
   118                                            const MDesCArray* /*aSubPlayers*/,
       
   119                                            TBool /*aComplete*/,
       
   120                                            TInt /*aError*/ )
       
   121         {}
       
   122 
       
   123         /**
       
   124         *  Call back of media request
       
   125         *
       
   126         *  @param aMedia media
       
   127         *  @param aError error code
       
   128         */
       
   129         void HandleMediaL( const CMPXMedia& aProperties, TInt aError );
       
   130 
       
   131 
       
   132         /**
       
   133         *  Handle completion of a asynchronous command
       
   134         *  @param aCommandResult result of the command, NULL if error
       
   135         *  @param aError error code
       
   136         */
       
   137         void HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/,
       
   138                                             TInt /*aError*/);
       
   139         /*
       
   140          *  From base class MMPXCollectionMediaObserver
       
   141          *  (via MMPXCollectionObserver)
       
   142          *  Handle extended media properties
       
   143          *
       
   144          *  @param aMedia media
       
   145          *  @param aError error code
       
   146          */
       
   147         inline void HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ ) {}
       
   148 
       
   149         /*
       
   150          *  From base class MMPXCollectionObserver
       
   151          */
       
   152         inline void HandleCollectionMessage( CMPXMessage* /*aMsg*/, TInt /*aErr*/ ) {}
       
   153 
       
   154         inline void HandleOpenL( const CMPXMedia& /*aEntries*/,
       
   155                                  TInt /*aIndex*/,
       
   156                                  TBool /*aComplete*/,
       
   157                                  TInt /*aError*/ ) {}
       
   158 
       
   159         inline void HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) {}
       
   160 
       
   161         /**
       
   162         * Set property
       
   163         */
       
   164         void SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue );
       
   165         virtual void RetrievePdlInformationL();
       
   166 
       
   167         TBool IsLive();
       
   168 
       
   169         TBool IsPlaylist();
       
   170 
       
   171         void IssueVideoAppForegroundCmdL(TBool aForeground);
       
   172 
       
   173         void RequestMediaL();
       
   174 
       
   175         void CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, TBool aDoSync = ETrue );
       
   176 
       
   177         TBool IsAppInFrontL();
       
   178 
       
   179         /*
       
   180          *  Activates an active object to close the player
       
   181          *  @since 5.0
       
   182          */
       
   183         void ActivateClosePlayerActiveObject();
       
   184 
       
   185         void CreateControlsL();
       
   186 
       
   187         TBool IsMultiItemPlaylist();
       
   188 
       
   189         void UpdateVideoRect( TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect );
       
   190 
       
   191         void UpdateVideoRectDone();
       
   192 
       
   193         void HandlePluginError( TInt aError );
       
   194 
       
   195         void ClosePlaybackViewL();
       
   196 
       
   197         void HandleBufferingStateL();
       
   198 
       
   199         /*
       
   200          *  Provides the static function for the callback to close the player
       
   201          *  Called by CIdle iIdle
       
   202          *  @since 3.2
       
   203          *  @param aPtr Pointer to callback class
       
   204          *  @return KErrNone
       
   205          */
       
   206         static TInt ClosePlayer( TAny* aPtr );
       
   207 
       
   208         /*
       
   209          *  Called to stop and exit the player
       
   210          *  @since 3.2
       
   211          *  @return void
       
   212          */
       
   213         void DoClosePlayer();
       
   214 
       
   215         void HandleVideoPlaybackMessage( CMPXMessage* aMessage );
       
   216 
       
   217     private:
       
   218 
       
   219         /**
       
   220         *  Handle playback message
       
   221         *
       
   222         *  @param aMsg playback message
       
   223         */
       
   224         virtual void DoHandlePlaybackMessageL( CMPXMessage* aMessage );
       
   225 
       
   226         /**
       
   227         *  Handle playback error message
       
   228         *
       
   229         *  @param aErr system error code.
       
   230         */
       
   231         void DoHandleErrorPlaybackMessageL( TInt aError );
       
   232 
       
   233         void DisplayFileDetailsDialogL();
       
   234 
       
   235         /**
       
   236         *  Handle media properties.
       
   237         *
       
   238         *  @param aMedia media properties
       
   239         *  @param aError error code
       
   240         */
       
   241         virtual void DoHandleMediaL( const CMPXMedia& aMedia, TInt aError );
       
   242 
       
   243         void CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd );
       
   244 
       
   245         void ParseMetaDataL( const CMPXMedia& aMedia );
       
   246 
       
   247         void DoHandleStateChangeL( TInt aNewState );
       
   248 
       
   249         void HandleGeneralPlaybackMessageL( CMPXMessage* aMessage );
       
   250 
       
   251         void SetAspectRatioL( TMPXVideoPlaybackCommand aCmd );
       
   252 
       
   253         void HandleVolumeCmdL( TMPXPlaybackCommand aCmd );
       
   254 
       
   255         void HandleShortPressBackwardL();
       
   256 
       
   257         void IssuePlayCommandL();
       
   258 
       
   259     protected: // data
       
   260         MMPXPlaybackUtility*                 iPlaybackUtility;
       
   261         MMPXCollectionUtility*               iCollectionUtility;
       
   262         TMPXPlaybackState                    iPlaybackState;
       
   263 
       
   264         QMPXVideoPlaybackViewFileDetails*    iFileDetails;
       
   265         CIdle*                               iCloseAO;
       
   266 
       
   267         HbVideoBasePlaybackView*             iView;
       
   268         CMPXVideoPlaybackDisplayHandler*     iDisplayHandler;
       
   269         CMPXVideoPlaybackUserInputHandler*   iUserInputHandler;
       
   270         QMPXVideoPlaybackControlsController* iControlsController;
       
   271 
       
   272         TMPXMediaRequestStatus               iMediaRequestStatus;
       
   273         TBool                                iPlaylistView;
       
   274         int                                  iPlayPosition;
       
   275         
       
   276     public:
       
   277         friend class HbVideoBasePlaybackView;        
       
   278 };
       
   279 
       
   280 #endif  // __MPXVIDEOVIEWWRAPPER_H__
       
   281 
       
   282 // EOF