videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp
changeset 37 4eb2df7f7cbe
parent 36 8aed59de29f9
child 39 f6d44a0cd476
equal deleted inserted replaced
36:8aed59de29f9 37:4eb2df7f7cbe
    13 *
    13 *
    14 * Description:   Implementation of Video base playback view
    14 * Description:   Implementation of Video base playback view
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#27 %
    18 // Version : %version: da1mmcf#30 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
   553         case EPbCmdTvOutEvent:
   553         case EPbCmdTvOutEvent:
   554         {
   554         {
   555             TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected;
   555             TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected;
   556 
   556 
   557             TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) );
   557             TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) );
   558             TBool playbackAllowed = ETrue;
       
   559 
   558 
   560             if ( tvOutConnected )
   559             if ( tvOutConnected )
   561             {
   560             {
   562                 cmdId = EMPXControlCmdTvOutConnected;
   561                 cmdId = EMPXControlCmdTvOutConnected;
   563 
       
   564                 playbackAllowed = *aMessage->Value<TInt>( KMPXMediaVideoTvOutPlayAllowed );
       
   565             }
   562             }
   566 
   563 
   567             if ( iUserInputHandler )
   564             if ( iUserInputHandler )
   568             {
   565             {
   569                 TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected ));     
   566                 TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected ));     
   570             }
   567             }
   571 
   568 
   572             if ( iControlsController )
   569             if ( iControlsController )
   573             {
   570             {
   574                 iControlsController->handleEvent( cmdId, playbackAllowed );
   571                 iControlsController->handleEvent( cmdId );
   575             }
   572             }
   576             break;
   573             break;
   577         }
   574         }
   578     }
   575     }
   579 }
   576 }
   832     {
   829     {
   833         iFileDetails->mTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
   830         iFileDetails->mTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
   834     }
   831     }
   835 
   832 
   836     //
   833     //
   837     //  TV-Out Playback Allowed
       
   838     //
       
   839     if ( aMedia.IsSupported( KMPXMediaVideoTvOutPlayAllowed ) )
       
   840     {
       
   841         iFileDetails->mTvOutPlayAllowed =
       
   842             aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
       
   843     }
       
   844 
       
   845     //
       
   846     //  BitRate
   834     //  BitRate
   847     //
   835     //
   848     if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) )
   836     if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) )
   849     {
   837     {
   850         iFileDetails->mBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate );
   838         iFileDetails->mBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate );
   960             iControlsController->addFileDetails( iFileDetails );            
   948             iControlsController->addFileDetails( iFileDetails );            
   961         }
   949         }
   962 
   950 
   963         if ( iFileDetails->mVideoEnabled )
   951         if ( iFileDetails->mVideoEnabled )
   964         {
   952         {
   965             RWindow *window = iView->getWindow();
   953             //
   966 
   954             // get window size
   967             TRect displayRect = TRect( window->Position().iX,
   955             //
   968                                        window->Position().iY,
   956             RWindow *window = iView->getWindow();            
   969                                        window->Position().iX + window->Size().iWidth,                  
   957             TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) );
   970                                        window->Position().iY + window->Size().iHeight );
   958             
   971 
   959             //
   972             TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height();
   960             // get window aspect ratio
   973 
   961             //   if device is in landscape mode, width > height
       
   962             //   if device is in portrait mode, width < height
       
   963             //
       
   964             TReal32 width = (TReal32) displayRect.Width();
       
   965             TReal32 height = (TReal32) displayRect.Height();            
       
   966             TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width);
       
   967 
       
   968             //
       
   969             // get new aspect ratio
   974             TInt newAspectRatio = 
   970             TInt newAspectRatio = 
   975                 iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio );
   971                 iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio );
   976 
   972 
   977             //
   973             //
   978             //  Setup the display window and issue play command
   974             //  Setup the display window and issue play command
  1037 //
  1033 //
  1038 void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty,
  1034 void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty,
  1039                                                  TInt aValue,
  1035                                                  TInt aValue,
  1040                                                  TInt aError )
  1036                                                  TInt aError )
  1041 {
  1037 {
  1042     MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL - Error(%d)"), aError );
  1038     MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError );
  1043 
  1039 
  1044     if ( aError == KErrNone )
  1040     if ( aError == KErrNone )
  1045     {
  1041     {
  1046         switch ( aProperty  )
  1042         switch ( aProperty  )
  1047         {
  1043         {
  1302 //   CMPXVideoViewWrapper::HandleShortPressBackwardL()
  1298 //   CMPXVideoViewWrapper::HandleShortPressBackwardL()
  1303 // -------------------------------------------------------------------------------------------------
  1299 // -------------------------------------------------------------------------------------------------
  1304 //
  1300 //
  1305 void CMPXVideoViewWrapper::HandleShortPressBackwardL()
  1301 void CMPXVideoViewWrapper::HandleShortPressBackwardL()
  1306 {
  1302 {
  1307     MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL()"));
  1303     MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleShortPressBackwardL()"));
  1308 
  1304 
  1309     if( !iPlaylistView )
  1305     if( !iPlaylistView )
  1310     {
  1306     {
  1311         SetPropertyL( EPbPropertyPosition, 0 );
  1307         SetPropertyL( EPbPropertyPosition, 0 );
  1312     }
  1308     }
  1316 //   CMPXVideoViewWrapper::IssueVideoAppForegroundCmd()
  1312 //   CMPXVideoViewWrapper::IssueVideoAppForegroundCmd()
  1317 // -------------------------------------------------------------------------------------------------
  1313 // -------------------------------------------------------------------------------------------------
  1318 //
  1314 //
  1319 void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground )
  1315 void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground )
  1320 {
  1316 {
  1321     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleForegroundEventL()"),
  1317     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"),
  1322                    _L("aForeground = %d"), aForeground );
  1318                    _L("aForeground = %d"), aForeground );
  1323 
  1319 
  1324     TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground;
  1320     TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground;
  1325 
  1321 
  1326     if ( aForeground )
  1322     if ( aForeground )
  1377     iFileDetails->mClipName = qFilename;
  1373     iFileDetails->mClipName = qFilename;
  1378 
  1374 
  1379     iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode );
  1375     iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode );
  1380 
  1376 
  1381     iFileDetails->mTvOutConnected   = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
  1377     iFileDetails->mTvOutConnected   = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
  1382     iFileDetails->mTvOutPlayAllowed = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
       
  1383 
  1378 
  1384     TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );    
  1379     TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );    
  1385     const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
  1380     const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
  1386     iFileDetails->mMimeType = qMimeType;
  1381     iFileDetails->mMimeType = qMimeType;
  1387 
  1382