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