videoplayback/inc/mpxvideoplaybackcontrolscontroller.h
branchRCL_3
changeset 57 befca0ec475f
child 70 375929f879c2
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:  Implementation of MPXVideoPlaybackControlsController
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Version : %version: 20 %
       
    20 
       
    21 
       
    22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
       
    23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
       
    24 
       
    25 // INCLUDES
       
    26 #include <mpxplaybackframeworkdefs.h>
       
    27 #include <aknlayoutscalable_avkon.cdl.h>
       
    28 #include <f32file.h>
       
    29 #include <MMFScalingCustomCommandConstants.h>
       
    30 
       
    31 #include "mpxvideo_debug.h"
       
    32 #include "mpxvideoplaybackviewfiledetails.h"
       
    33 #include "mpxvideoplaybackcontrol.hrh"
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CEikLabel;
       
    37 class CEikImage;
       
    38 class MTouchFeedback;
       
    39 class CMPXVideoPlaybackControl;
       
    40 class CMPXVideoPlaybackContainer;
       
    41 class CMPXVideoPlaybackControlPolicy;
       
    42 class CAknsBasicBackgroundControlContext;
       
    43 class CMPXVideoPlaybackControlConfiguration;
       
    44 
       
    45 // DATA TYPES
       
    46 
       
    47 enum TMPXTimerAction
       
    48 {
       
    49     EMPXTimerCancel,
       
    50     EMPXTimerReset
       
    51 };
       
    52 
       
    53 
       
    54 // CLASS DECLARATION
       
    55 
       
    56 class CMPXVideoPlaybackControlsController : public CBase
       
    57 {
       
    58 
       
    59     public: // Constructors and destructor
       
    60 
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         */
       
    64         IMPORT_C static CMPXVideoPlaybackControlsController* NewL(
       
    65                 CMPXVideoPlaybackContainer* aContainer,
       
    66                 TRect aRect,
       
    67                 CMPXVideoPlaybackViewFileDetails* aDetails );
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         IMPORT_C virtual ~CMPXVideoPlaybackControlsController();
       
    73 
       
    74     private:
       
    75 
       
    76         /**
       
    77         * C++ default constructor.
       
    78         */
       
    79         CMPXVideoPlaybackControlsController( CMPXVideoPlaybackContainer* aContainer, TRect aRect );
       
    80 
       
    81         /**
       
    82         * Symbian 2nd phase constructor.
       
    83         */
       
    84         void ConstructL( CMPXVideoPlaybackViewFileDetails* aDetails );
       
    85 
       
    86     public:
       
    87 
       
    88         /**
       
    89         * Handle event from container
       
    90         */
       
    91         IMPORT_C void HandleEventL( TMPXVideoPlaybackControlCommandIds aEvent, TInt aValue = 0 );
       
    92 
       
    93         IMPORT_C CEikImage* GetBitmap( TMPXVideoPlaybackControls aBitmap );
       
    94 
       
    95         //
       
    96         //  Add the file details to the controls controller when available
       
    97         //
       
    98         IMPORT_C void AddFileDetailsL( CMPXVideoPlaybackViewFileDetails* aDetails );
       
    99 
       
   100         /**
       
   101         * Command handling function.
       
   102         * Call HandleCommandL() of container
       
   103         */
       
   104         void HandleCommandL( TInt aCommand, TInt aValue = 0 );
       
   105 
       
   106         /**
       
   107         * Return ETrue if TV-out cable gets connected
       
   108         */
       
   109         inline TBool IsTvOutConnected();
       
   110 
       
   111         /**
       
   112         * Reset or cancel timers for the controls
       
   113         */
       
   114         void ResetDisappearingTimers( TMPXTimerAction aTimerAction );
       
   115 
       
   116         /**
       
   117         * Return state
       
   118         */
       
   119         inline TMPXPlaybackState State();
       
   120 
       
   121         /*
       
   122          *   Return the Aspect Ratio for the clip
       
   123          */
       
   124         inline TMMFScalingType AspectRatio();
       
   125 
       
   126         /**
       
   127         * Return file details
       
   128         */
       
   129         inline CMPXVideoPlaybackViewFileDetails* FileDetails();
       
   130 
       
   131         //
       
   132         //  Locates the bitmap file searching from y: down and then z: last
       
   133         //
       
   134         void LocateBitmapFileL( TFileName& aFileName );
       
   135 
       
   136         void SetRealOneBitmapVisibility( TBool aVisible );
       
   137 
       
   138         inline TBool IsRealMediaFormat();
       
   139 
       
   140     private:
       
   141         /**
       
   142         * Create controls
       
   143         */
       
   144         void CreateControlsL();
       
   145 
       
   146         /**
       
   147         * Update controls
       
   148         */
       
   149         void HandleStateChange( TMPXPlaybackState aNewState );
       
   150 
       
   151         /**
       
   152         * Update Control's visibility
       
   153         */
       
   154         void UpdateControlsVisibility();
       
   155 
       
   156         /**
       
   157         * Toggle visibility
       
   158         */
       
   159         void ToggleVisibility();
       
   160 
       
   161         CEikImage* CreateImageL( TFileName& aIconsPath, TInt aBitmapIndex, TInt aBitmapMaskIndex );
       
   162 
       
   163         CEikImage* CreateBitmapL( TFileName& aIconsPath,
       
   164                                   TInt aBitmapIndex,
       
   165                                   const TAknWindowLineLayout& aLayout );
       
   166 
       
   167         /**
       
   168         * Create/delete controls based on updated control list
       
   169         */
       
   170         void ControlsListUpdatedL( TBool aUpdateVisibility = ETrue );
       
   171 
       
   172         /**
       
   173         * Create fake softkeyL
       
   174         */
       
   175         void CreateFakeSoftKeyL( TInt aResource,
       
   176                                  TBool aTop,
       
   177                                  TMPXVideoPlaybackControls aControlIndex,
       
   178                                  TUint aProperties );
       
   179 
       
   180         /**
       
   181         * Crate text label with speccific layout
       
   182         */
       
   183         void CreateTextLabelWithSpecificLayoutL(
       
   184                 TInt aResource,
       
   185                 TMPXVideoPlaybackControls aControlIndex,
       
   186                 TUint aProperties,
       
   187                 TAknTextComponentLayout aLayout );
       
   188 
       
   189         //
       
   190         //  Create the bitmaps for Audio Only Clips
       
   191         //
       
   192         void CreateAudioOnlyBitmapL( TFileName& aIconsPath,
       
   193                                      TInt aBitmapIndex,
       
   194                                      TInt aBitmapMaskIndex,
       
   195                                      TMPXVideoPlaybackControls aControlIndex,
       
   196                                      const TAknWindowLineLayout& aLayout,
       
   197                                      TUint aProperties );
       
   198 
       
   199         //
       
   200         //  Create the title control for Audio Only Clips
       
   201         //
       
   202         void CreateTitleControlL( TMPXVideoPlaybackControls aControlIndex,
       
   203                                   TUint aProperties );
       
   204 
       
   205         /**
       
   206         * Create CEikLabelL
       
   207         */
       
   208         CEikLabel* CreateTextLabelL( const TDesC& aText );
       
   209 
       
   210         /*
       
   211         *  Handles the Controls Timer Timout
       
   212         */
       
   213         static TInt HandleControlsTimeout( TAny* aPtr );
       
   214 
       
   215         /**
       
   216         * Cancels all disappearing timers and hides all controls
       
   217         */
       
   218         void HideAllControls();
       
   219 
       
   220         /**
       
   221         * Show Controls and reset the timers
       
   222         */
       
   223         void ShowControls();
       
   224 
       
   225         /**
       
   226         * Return ETrue if any control is visible
       
   227         */
       
   228         TBool IsVisible();
       
   229 
       
   230         /**
       
   231         * Return ETrue if real one bitmap is visible
       
   232         */
       
   233         TBool IsRealOneBitmapVisible();
       
   234 
       
   235         /**
       
   236         * Append a control based on control index
       
   237         */
       
   238         void AppendControlL( TMPXVideoPlaybackControls aControlIndex );
       
   239 
       
   240         /**
       
   241         * Set changed volume
       
   242         */
       
   243         void VolumeChanged( TInt aVolume );
       
   244 
       
   245         /**
       
   246         * Set changed duration
       
   247         */
       
   248         void DurationChangedL( TInt aDuration);
       
   249 
       
   250         /**
       
   251         * Set changed position
       
   252         */
       
   253         void PositionChangedL( TInt aPosition );
       
   254 
       
   255         /**
       
   256         * Set changed position
       
   257         */
       
   258         void AspectRatioChanged( TInt aAspectRatio );
       
   259         /*
       
   260          *  Sets the download size on the progress bar
       
   261          */
       
   262         void SetDownloadSize( TInt aSize );
       
   263 
       
   264         /*
       
   265          *  Updates the download ratio on the progress bar
       
   266          */
       
   267         void UpdateDownloadPosition( TInt aNewSize );
       
   268 
       
   269         /**
       
   270         * Set changed state on button bar
       
   271         */
       
   272         void UpdateStateOnButtonBar();
       
   273 
       
   274         /**
       
   275         * Stop branding animation
       
   276         */
       
   277         void StopBrandingAnimation();
       
   278 
       
   279         /**
       
   280         * Check whether this clip is real format or not
       
   281         */
       
   282         TBool IsRealFormatL( const TDesC& aDes );
       
   283 
       
   284         /**
       
   285         * Check whether this clip is real format or not for streaming/live streaming
       
   286         */
       
   287         TBool RealFormatForStreamingL( const TDesC& aDes );
       
   288 
       
   289         /**
       
   290         * Check whether this clip is real format or not for local/progressive donwload
       
   291         */
       
   292         TBool RealFormatForLocalL();
       
   293 
       
   294         /*
       
   295          *  Create the Real One bitmap
       
   296          */
       
   297         void CreateRealOneBitmapL();
       
   298 
       
   299         /**
       
   300         * Handle errors
       
   301         */
       
   302         void HandleErrors();
       
   303 
       
   304         /**
       
   305         * Return ETrue if control is visible
       
   306         */
       
   307         TBool IsSoftKeyVisible( TInt aValue );
       
   308 
       
   309         /**
       
   310         * Handle tvout connected/disconnected event
       
   311         */
       
   312         void HandleTvOutEventL( TBool aConnected,
       
   313                                 TMPXVideoPlaybackControlCommandIds aEvent,
       
   314                                 TBool aShowArIcon );
       
   315         /**
       
   316         * Handle softkey pressed event
       
   317         */
       
   318         void HandleSoftKeyPressedL( TInt aValue );
       
   319 
       
   320         /*
       
   321          *  Locate the path of the dll
       
   322          */
       
   323         TInt AddDllPath( TDes& aFileName );
       
   324 
       
   325         /*
       
   326          *  Shows the Meida File Details Viewer control
       
   327          */
       
   328         void ShowMediaDetailsViewerL();
       
   329 
       
   330         /*
       
   331          *  Checks if Media Details Viewer control is open/visible
       
   332          */
       
   333         TBool IsMediaDetailsViewerVisible();
       
   334 
       
   335         /*
       
   336          *  Closes Media Details Viewer
       
   337          */
       
   338         void CloseMediaDetailsViewer();
       
   339 
       
   340         /*
       
   341          *   Handles the Loading Started command that was received after Buffering state was
       
   342          *   blocked by the playback view
       
   343          */
       
   344         void HandleLoadingStarted();
       
   345 
       
   346         /*
       
   347          *   This will cause the controls to be updated when the surface changes and the
       
   348          *   controls are visible.
       
   349          */
       
   350         void RedrawControlsForSurfaceChanges();
       
   351 
       
   352     private:
       
   353 
       
   354         CMPXVideoPlaybackControlPolicy*         iControlsPolicy;
       
   355         CArrayPtrFlat<CMPXVideoPlaybackControl> iControls;
       
   356         CMPXVideoPlaybackControl*               iMediaDetailsViewerControl;
       
   357 
       
   358         CMPXVideoPlaybackControlConfiguration*  iControlsConfig;
       
   359 
       
   360         CEikImage*                              iRealOneBitmap;
       
   361 
       
   362         CPeriodic*                              iControlsTimer;
       
   363 
       
   364         TRect                                   iRect;
       
   365         TInt                                    iVideoResourceOffset;
       
   366 
       
   367         TMPXPlaybackState                       iState;
       
   368         TMMFScalingType                         iAspectRatio;
       
   369 
       
   370         CMPXVideoPlaybackViewFileDetails*       iFileDetails;     //  not owned
       
   371 
       
   372         RFs                                     iFs;
       
   373         TFileName                               iBitmapFileName;
       
   374 
       
   375         TBool                                   iTvOutConnected;
       
   376         TBool                                   iShowControls;
       
   377         TBool                                   iRNFormat;
       
   378 
       
   379 #ifdef RD_TACTILE_FEEDBACK
       
   380         MTouchFeedback*                         iFeedback;
       
   381 #endif //RD_TACTILE_FEEDBACK
       
   382 
       
   383     public:
       
   384         CMPXVideoPlaybackContainer*             iContainer;
       
   385 };
       
   386 
       
   387 // INLINE METHODS
       
   388 
       
   389 inline
       
   390 TMPXPlaybackState CMPXVideoPlaybackControlsController::State()
       
   391 {
       
   392     return iState;
       
   393 }
       
   394 
       
   395 inline
       
   396 CMPXVideoPlaybackViewFileDetails* CMPXVideoPlaybackControlsController::FileDetails()
       
   397 {
       
   398     return iFileDetails;
       
   399 }
       
   400 
       
   401 inline
       
   402 TBool CMPXVideoPlaybackControlsController::IsTvOutConnected()
       
   403 {
       
   404     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsTvOutConnected(%d)"),
       
   405         iFileDetails->iTvOutConnected);
       
   406 
       
   407     return iFileDetails->iTvOutConnected;
       
   408 }
       
   409 
       
   410 inline
       
   411 TBool CMPXVideoPlaybackControlsController::IsRealMediaFormat()
       
   412 {
       
   413     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsRealFormat() [%d]"), iRNFormat);
       
   414     return iRNFormat;
       
   415 }
       
   416 
       
   417 inline
       
   418 TMMFScalingType CMPXVideoPlaybackControlsController::AspectRatio()
       
   419 {
       
   420     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::AspectRatio(%d)"), iAspectRatio);
       
   421     return iAspectRatio;
       
   422 }
       
   423 
       
   424 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_*/
       
   425 
       
   426 // End of File