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