videoplayback/videoplaybackcontrols/src/mpxvideoplaybackcontrolscontroller.cpp
branchRCL_3
changeset 12 7f2b2a65da29
parent 11 8970fbd719ec
child 14 55fa1ec415c6
equal deleted inserted replaced
11:8970fbd719ec 12:7f2b2a65da29
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 32 %
    19 // Version : %version: e003sa33#36 %
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <fbs.h>
    23 #include <fbs.h>
    24 #include <coecntrl.h>
    24 #include <coecntrl.h>
   158 // Destructor.
   158 // Destructor.
   159 // -------------------------------------------------------------------------------------------------
   159 // -------------------------------------------------------------------------------------------------
   160 //
   160 //
   161 EXPORT_C CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController()
   161 EXPORT_C CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController()
   162 {
   162 {
   163     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController"));
   163     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController"));
   164 
   164 
   165     iFs.Close();
   165     iFs.Close();
   166 
   166 
   167 #ifdef RD_TACTILE_FEEDBACK
   167 #ifdef RD_TACTILE_FEEDBACK
   168     if ( iFeedback )
   168     if ( iFeedback )
   372         }
   372         }
   373         case EMPXControlCmdSurfaceCreated:
   373         case EMPXControlCmdSurfaceCreated:
   374         {
   374         {
   375             iSurfaceCreated = ETrue;
   375             iSurfaceCreated = ETrue;
   376             SetRealOneBitmapVisibility( EFalse );
   376             SetRealOneBitmapVisibility( EFalse );
       
   377             RedrawControlsForSurfaceChanges();
   377             break;
   378             break;
   378         }
   379         }
   379         case EMPXControlCmdSurfaceRemoved:
   380         case EMPXControlCmdSurfaceRemoved:
   380         {
   381         {
   381             iSurfaceCreated = EFalse;
   382             iSurfaceCreated = EFalse;
       
   383             RedrawControlsForSurfaceChanges();
       
   384             break;
       
   385         }
       
   386         case EMPXControlCmdLoadingStarted:
       
   387         {
       
   388             HandleLoadingStarted();
   382             break;
   389             break;
   383         }
   390         }
   384     }
   391     }
   385 }
   392 }
   386 
   393 
  1936     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::SetBackgroundBlack(%d)"), backgroundBlack);
  1943     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::SetBackgroundBlack(%d)"), backgroundBlack);
  1937     return backgroundBlack;
  1944     return backgroundBlack;
  1938 }
  1945 }
  1939 
  1946 
  1940 // -------------------------------------------------------------------------------------------------
  1947 // -------------------------------------------------------------------------------------------------
  1941 //   CMPXVideoPlaybackControlsController::IsSameAspectRatio
  1948 //   CMPXVideoPlaybackControlsController::ShowAspectRatioIcon
  1942 // -------------------------------------------------------------------------------------------------
  1949 // -------------------------------------------------------------------------------------------------
  1943 //
  1950 //
  1944 TBool CMPXVideoPlaybackControlsController::IsSameAspectRatio()
  1951 TBool CMPXVideoPlaybackControlsController::ShowAspectRatioIcon()
  1945 {
  1952 {
  1946 	MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackControlsController::IsSameAspectRatio()" ) );
  1953 	MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::ShowAspectRatioIcon()"));
  1947 	
  1954 
  1948     TBool retVal = EFalse;
  1955     TBool retVal = EFalse;
  1949 
  1956 
  1950     if ( iFileDetails->iVideoEnabled &&
  1957     if ( iFileDetails->iVideoEnabled &&
  1951     	 iFileDetails->iVideoHeight > 0 &&
  1958     	 iFileDetails->iVideoHeight > 0 &&
  1952   	     iFileDetails->iVideoWidth > 0 )
  1959   	     iFileDetails->iVideoWidth > 0 &&
       
  1960   	     AknLayoutUtils::PenEnabled() )
  1953     {
  1961     {
  1954         TRect displayRect = iContainer->Rect();
  1962         TRect displayRect = iContainer->Rect();
  1955         TReal displayAspectRatio = ( TReal32 )displayRect.Width() / ( TReal32 )displayRect.Height();
  1963         TReal displayAspectRatio = ( TReal32 )displayRect.Width() / ( TReal32 )displayRect.Height();
  1956         TReal videoAspectRatio = ( TReal32 )iFileDetails->iVideoWidth / 
  1964         TReal videoAspectRatio = ( TReal32 )iFileDetails->iVideoWidth /
  1957         		                 ( TReal32 )iFileDetails->iVideoHeight;
  1965         		                 ( TReal32 )iFileDetails->iVideoHeight;
  1958 
  1966 
  1959         if ( displayAspectRatio == videoAspectRatio )
  1967         // If clip's AR is as same as screen display AR, AspectRatioIcon does not display.
       
  1968         if ( displayAspectRatio != videoAspectRatio )
  1960         {
  1969         {
  1961             retVal = ETrue;
  1970             retVal = ETrue;
  1962         }
  1971         }
  1963     }
  1972     }
  1964 
  1973 
  1965     MPX_DEBUG( _L( "CMPXVideoPlaybackControlsController::IsSameAspectRatio(%d)" ), retVal );
  1974     MPX_DEBUG( _L( "CMPXVideoPlaybackControlsController::ShowAspectRatioIcon()[%d]" ), retVal );
  1966     
  1975 
  1967     return retVal;
  1976     return retVal;
  1968 }
  1977 }
  1969 
  1978 
       
  1979 // -------------------------------------------------------------------------------------------------
       
  1980 //   CMPXVideoPlaybackControlsController::HandleLoadingStarted
       
  1981 // -------------------------------------------------------------------------------------------------
       
  1982 //
       
  1983 void CMPXVideoPlaybackControlsController::HandleLoadingStarted()
       
  1984 {
       
  1985     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HandleLoadingStarted()"));
       
  1986 
       
  1987     if ( iState != EPbStateBuffering )
       
  1988     {
       
  1989         iState = EPbStateBuffering;
       
  1990         UpdateStateOnButtonBar();
       
  1991         UpdateControlsVisibility();
       
  1992     }
       
  1993 }
       
  1994 
       
  1995 // -------------------------------------------------------------------------------------------------
       
  1996 //   CMPXVideoPlaybackControlsController::RedrawControlsForSurfaceChanges
       
  1997 // -------------------------------------------------------------------------------------------------
       
  1998 //
       
  1999 void CMPXVideoPlaybackControlsController::RedrawControlsForSurfaceChanges()
       
  2000 {
       
  2001     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::RedrawControlsForSurfaceChanges()"));
       
  2002 
       
  2003     //
       
  2004     //  A surface has been added or removed.
       
  2005     //  If the controls are visible, redraw them with the new transparency value.
       
  2006     //
       
  2007     if ( IsVisible() )
       
  2008     {
       
  2009         UpdateControlsVisibility();
       
  2010     }
       
  2011 }
       
  2012 
       
  2013 
  1970 // End of File
  2014 // End of File