38 CMediaClientVideoDisplayBody* CMediaClientVideoDisplayBody::NewL(TInt aDisplayId, const TSurfaceId& aSurfaceId, |
49 CMediaClientVideoDisplayBody* CMediaClientVideoDisplayBody::NewL(TInt aDisplayId, const TSurfaceId& aSurfaceId, |
39 const TRect& aCropRect, TVideoAspectRatio aAspectRatio, TBool aExtDisplaySwitchingControl) |
50 const TRect& aCropRect, TVideoAspectRatio aAspectRatio, TBool aExtDisplaySwitchingControl) |
40 { |
51 { |
41 DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL +++"); |
52 DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL +++"); |
42 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aDisplayId %d", aDisplayId); |
53 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aDisplayId %d", aDisplayId); |
43 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aSurfaceId 0x%X,0x%X,0x%X,0x%X", aSurfaceId.iInternal[0], aSurfaceId.iInternal[1], aSurfaceId.iInternal[2], aSurfaceId.iInternal[3]); |
54 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]); |
44 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
55 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
45 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::NewL - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
56 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::NewL - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
46 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aExtDisplaySwitchingControl %d", aExtDisplaySwitchingControl); |
57 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aExtDisplaySwitchingControl %d", aExtDisplaySwitchingControl); |
47 |
58 |
48 if(aSurfaceId.IsNull()) |
59 if(aSurfaceId.IsNull()) |
261 |
290 |
262 |
291 |
263 TInt CMediaClientVideoDisplayBody::SurfaceCreated(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, const TRect& aCropRegion) |
292 TInt CMediaClientVideoDisplayBody::SurfaceCreated(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, const TRect& aCropRegion) |
264 { |
293 { |
265 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceCreated +++"); |
294 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceCreated +++"); |
266 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId 0x%X,0x%X,0x%X,0x%X", aSurfaceId.iInternal[0], aSurfaceId.iInternal[1], aSurfaceId.iInternal[2], aSurfaceId.iInternal[3]); |
295 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]); |
267 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
296 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
268 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
297 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
269 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY); |
298 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY); |
270 |
299 |
271 TBool emitEvent = EFalse; |
300 TBool emitEvent = EFalse; |
332 } |
366 } |
333 |
367 |
334 void CMediaClientVideoDisplayBody::RemoveSurface(TBool aControllerEvent) |
368 void CMediaClientVideoDisplayBody::RemoveSurface(TBool aControllerEvent) |
335 { |
369 { |
336 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface +++"); |
370 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface +++"); |
|
371 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::RemoveSurface - iSurfaceId %08x:%08x:%08x:%08x", iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]); |
|
372 |
337 if (IsSurfaceCreated()) |
373 if (IsSurfaceCreated()) |
338 { |
374 { |
339 RemoveBackgroundSurface(ETrue); |
375 RemoveBackgroundSurface(ETrue); |
340 |
376 |
341 if (iEventHandler && aControllerEvent) |
377 if (iEventHandler && aControllerEvent) |
342 { |
378 { |
343 iEventHandler->MmsehRemoveSurface(iSurfaceId); |
379 iEventHandler->MmsehRemoveSurface(iSurfaceId); |
344 } |
380 } |
345 |
381 |
|
382 if(iSwitchedToExternalDisplay) |
|
383 { |
|
384 SetWindowArrayPtr2Client(); |
|
385 #ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW |
|
386 RemoveBackgroundSurface(ETrue); |
|
387 #endif |
|
388 RemoveExtDisplayHandler(); |
|
389 } |
346 iSurfaceId = TSurfaceId::CreateNullId(); |
390 iSurfaceId = TSurfaceId::CreateNullId(); |
347 |
|
348 if(iSwitchedToExternalDisplay) |
|
349 { |
|
350 SetWindowArrayPtr2Client(); |
|
351 RemoveExtDisplayHandler(); |
|
352 } |
|
353 } |
391 } |
354 |
392 |
355 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface ---"); |
393 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface ---"); |
356 } |
394 } |
357 |
395 |
358 TInt CMediaClientVideoDisplayBody::SurfaceParametersChanged(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio) |
396 TInt CMediaClientVideoDisplayBody::SurfaceParametersChanged(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio) |
359 { |
397 { |
360 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged +++"); |
398 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged +++"); |
361 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId 0x%X,0x%X,0x%X,0x%X", aSurfaceId.iInternal[0], aSurfaceId.iInternal[1], aSurfaceId.iInternal[2], aSurfaceId.iInternal[3]); |
399 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]); |
362 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
400 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY); |
363 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
401 DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator); |
364 |
402 |
365 if (!IsSurfaceCreated()) |
403 if (!IsSurfaceCreated()) |
366 { |
404 { |
1182 } |
1226 } |
1183 |
1227 |
1184 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---"); |
1228 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---"); |
1185 } |
1229 } |
1186 |
1230 |
1187 void CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected(TBool aExtDisplayConnected) |
1231 void CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected(TExtDisplayConnectionProviderConnType aExtDisplayConnType) |
1188 { |
1232 { |
1189 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected +++ aExtDisplayConnected=%d", aExtDisplayConnected); |
1233 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected +++ aExtDisplayConnType=%d", aExtDisplayConnType); |
1190 |
1234 |
1191 if(iExtDisplayConnected != aExtDisplayConnected) |
1235 if(aExtDisplayConnType != iExtDisplayConnType) |
1192 { |
1236 { |
1193 iExtDisplayConnected = aExtDisplayConnected; |
1237 TExtDisplayConnectionProviderConnType prevExtDisplayConnType = iExtDisplayConnType; |
1194 SwitchSurface(); |
1238 iExtDisplayConnType = aExtDisplayConnType; |
|
1239 |
|
1240 if(prevExtDisplayConnType == EExtDisplayConnectionProviderConnTypeDisconnected) |
|
1241 { |
|
1242 // disconnected -> connected - don't care which type it is |
|
1243 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected disconnected -> connected(type %d)", iExtDisplayConnType); |
|
1244 iExtDisplayConnected = ETrue; |
|
1245 SwitchSurface(); |
|
1246 } |
|
1247 else if(iExtDisplayConnType == EExtDisplayConnectionProviderConnTypeDisconnected) |
|
1248 { |
|
1249 // connected -> disconnected - don't care from which type it is |
|
1250 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected connected(type %d) -> disconnected", prevExtDisplayConnType); |
|
1251 iExtDisplayConnected = EFalse; |
|
1252 SwitchSurface(); |
|
1253 } |
|
1254 else |
|
1255 { |
|
1256 // If we get this far then the connection type has changed from "AV Out -> HDMI" or "HDMI -> AV Out" |
|
1257 // Both are likely. "AV Out -> HDMI" occurs if AV Out cable is connected and HDMI cable is then connected. |
|
1258 // "HDMI -> AV Out" occurs if both AV Out and HDMI cables are connected and HDMI cable is then disconnected. |
|
1259 // HDMI is preferred over AV Out. |
|
1260 |
|
1261 // update external display window data |
|
1262 iExtDisplayHandler->UpdateWindow(); |
|
1263 TRect externalDisplayRect(TPoint(0, 0), iExtDisplayHandler->DisplaySizeInPixels()); |
|
1264 (*iWindowsArrayPtr)[0].iClipRect = externalDisplayRect; |
|
1265 (*iWindowsArrayPtr)[0].iVideoExtent = externalDisplayRect; |
|
1266 TRAPD(err, (*iWindowsArrayPtr)[0].iAutoScaleType = ExtDisplayAutoScaleTypeL()); |
|
1267 if(err == KErrNone) |
|
1268 { |
|
1269 RemoveBackgroundSurface(ETrue); |
|
1270 RedrawWindows(iCropRegion); |
|
1271 } |
|
1272 else |
|
1273 { |
|
1274 // Not a lot we can do. Just keep as it is but external display output will be incorrect. |
|
1275 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected ExtDisplayAutoScaleTypeL failed %d", err); |
|
1276 } |
|
1277 } |
1195 } |
1278 } |
1196 else |
1279 else |
1197 { |
1280 { |
1198 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected No change in ext display connection status"); |
1281 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected No change to connection type"); |
1199 } |
1282 } |
1200 |
1283 |
1201 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected ---"); |
1284 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected ---"); |
1202 } |
1285 } |
1203 |
1286 |
1204 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client() |
1287 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client() |
1233 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL - iWindow WsHandle 0x%X", windowData.iWindow->WsHandle()); |
1316 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL - iWindow WsHandle 0x%X", windowData.iWindow->WsHandle()); |
1234 |
1317 |
1235 TRect externalDisplayRect(TPoint(0, 0), extDisplayHandler->DisplaySizeInPixels()); |
1318 TRect externalDisplayRect(TPoint(0, 0), extDisplayHandler->DisplaySizeInPixels()); |
1236 windowData.iClipRect = externalDisplayRect; |
1319 windowData.iClipRect = externalDisplayRect; |
1237 windowData.iVideoExtent = externalDisplayRect; |
1320 windowData.iVideoExtent = externalDisplayRect; |
1238 // windowData.iScaleWidth not required for EAutoScaleBestFit |
1321 // windowData.iScaleWidth only required for EAutoScaleNone |
1239 // windowData.iScaleHeight not required for EAutoScaleBestFit |
1322 // windowData.iScaleWidth only required for EAutoScaleNone |
1240 windowData.iRotation = EVideoRotationNone; |
1323 windowData.iRotation = EVideoRotationNone; |
1241 windowData.iAutoScaleType = EAutoScaleBestFit; |
1324 windowData.iAutoScaleType = ExtDisplayAutoScaleTypeL(); |
1242 windowData.iHorizPos = EHorizontalAlignCenter; |
1325 windowData.iHorizPos = EHorizontalAlignCenter; |
1243 windowData.iVertPos = EVerticalAlignCenter; |
1326 windowData.iVertPos = EVerticalAlignCenter; |
1244 // windowData.iWindow2 not used |
1327 // windowData.iWindow2 not used |
1245 |
1328 |
1246 iExtDisplayWindows.AppendL(windowData); |
1329 iExtDisplayWindows.AppendL(windowData); |
1378 { |
1462 { |
1379 TRAPD(err, CreateExtDisplayHandlerL()); |
1463 TRAPD(err, CreateExtDisplayHandlerL()); |
1380 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface CreateExtDisplayHandlerL error %d", err); |
1464 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface CreateExtDisplayHandlerL error %d", err); |
1381 if(err == KErrNone) |
1465 if(err == KErrNone) |
1382 { |
1466 { |
1383 // Set background surface for external display window before removing from client windows. |
|
1384 // Required for switching of paused video |
|
1385 SetWindowArrayPtr2Ext(); |
1467 SetWindowArrayPtr2Ext(); |
1386 RedrawWindows(iCropRegion); |
1468 RedrawWindows(iCropRegion); |
|
1469 |
|
1470 #ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW |
|
1471 // Hide surface so that video is not seen on client window |
|
1472 HideAllClientWindows(); |
|
1473 #else |
|
1474 // Surface removed from window |
1387 SetWindowArrayPtr2Client(); |
1475 SetWindowArrayPtr2Client(); |
1388 RemoveBackgroundSurface(ETrue); |
1476 RemoveBackgroundSurface(ETrue); |
1389 SetWindowArrayPtr2Ext(); |
1477 SetWindowArrayPtr2Ext(); |
|
1478 #endif |
1390 } |
1479 } |
1391 } |
1480 } |
1392 else if(iSwitchedToExternalDisplay) |
1481 else if(iSwitchedToExternalDisplay) |
1393 { |
1482 { |
1394 // Set background surface for clientwindows before removing from external display window. |
1483 // Set background surface for clientwindows before removing from external display window. |
1395 // Required for switching of paused video |
|
1396 SetWindowArrayPtr2Client(); |
1484 SetWindowArrayPtr2Client(); |
|
1485 // RedrawWindows handles both the case where the surface was removed from client window and |
|
1486 // also the case where the surface was hidden from client window |
1397 RedrawWindows(iCropRegion); |
1487 RedrawWindows(iCropRegion); |
1398 SetWindowArrayPtr2Ext(); |
1488 SetWindowArrayPtr2Ext(); |
1399 RemoveBackgroundSurface(ETrue); |
1489 RemoveBackgroundSurface(ETrue); |
1400 RemoveExtDisplayHandler(); |
1490 RemoveExtDisplayHandler(); |
1401 SetWindowArrayPtr2Client(); |
1491 SetWindowArrayPtr2Client(); |
1506 aOldRect.Intersection(aOtherRect); |
1596 aOldRect.Intersection(aOtherRect); |
1507 aNewRect.Intersection(aOtherRect); |
1597 aNewRect.Intersection(aOtherRect); |
1508 |
1598 |
1509 if (aOldRect != aNewRect) |
1599 if (aOldRect != aNewRect) |
1510 { |
1600 { |
1511 DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged - Intersection area has changed"); |
1601 DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged --- Intersection area has changed"); |
1512 return ETrue; |
1602 return ETrue; |
1513 } |
1603 } |
1514 |
1604 |
1515 DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged - Intersection area has not changed"); |
1605 DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged --- Intersection area has not changed"); |
1516 return EFalse; |
1606 return EFalse; |
1517 } |
1607 } |
|
1608 |
|
1609 /** |
|
1610 * This function calculates the delta width and delta height for AV out when the TV-Out setting is set to "widescreen". |
|
1611 * |
|
1612 * AV out has fixed resolution whether TV-Out is set to "normal" or "widescreen". The TV-Out setting indicates |
|
1613 * that the video should be scaled so that when displayed on a corresponding TV the aspect looks correct. |
|
1614 * |
|
1615 * When displaying video on a widescreen TV through AV out, because the resolution is the same the TV stretches |
|
1616 * the video horizontally. When displaying on a normal TV no stretching takes place. |
|
1617 * |
|
1618 * For "normal" TAutoScaleType::EAutoScaleClip is used. |
|
1619 * |
|
1620 * For "widescreen" this function calculates the width delta and height delta required so that when the video is stretched |
|
1621 * the aspect looks correct on a widescreen TV. |
|
1622 * |
|
1623 * This function must only be called when autoscale is set to TAutoScaleType::EAutoScaleStretch and an external display is |
|
1624 * connected. |
|
1625 **/ |
|
1626 void CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay(TReal32 aViewportAspect, const TRect& aVideoExtent, TInt& aDeltaHeight, TInt& aDeltaWidth) |
|
1627 { |
|
1628 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay +++"); |
|
1629 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aViewportAspect %f", aViewportAspect); |
|
1630 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY); |
|
1631 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aDeltaHeight %d", aDeltaHeight); |
|
1632 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aDeltaWidth %d", aDeltaWidth); |
|
1633 |
|
1634 aDeltaWidth = 0; |
|
1635 aDeltaHeight = 0; |
|
1636 |
|
1637 TReal32 wideScreenAspect = (TReal32)16 / (TReal32)9; |
|
1638 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay wideScreenAspect %f", wideScreenAspect); |
|
1639 |
|
1640 if(aViewportAspect == wideScreenAspect) |
|
1641 { |
|
1642 // no need to calculate |
|
1643 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect equals wideScreenAspect"); |
|
1644 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - width delta and height delta not changed"); |
|
1645 } |
|
1646 else if(aViewportAspect < wideScreenAspect) |
|
1647 { |
|
1648 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect is less than wideScreenAspect"); |
|
1649 |
|
1650 // calculate video width for viewport that when stretched looks ok on widescreen |
|
1651 TReal32 correctedWidth = (TReal32)aVideoExtent.Width() * aViewportAspect / wideScreenAspect; |
|
1652 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay corrected viewport width %f", correctedWidth); |
|
1653 |
|
1654 aDeltaWidth = correctedWidth - aVideoExtent.Width(); |
|
1655 } |
|
1656 else // aViewportAspect > wideScreenAspect |
|
1657 { |
|
1658 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect is greater than wideScreenAspect"); |
|
1659 |
|
1660 // calculate video height for viewport that when stretched looks ok on widescreen |
|
1661 TReal32 correctedHeight = (TReal32)aVideoExtent.Height() * wideScreenAspect / aViewportAspect; |
|
1662 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay corrected viewport height %f", correctedHeight); |
|
1663 |
|
1664 aDeltaHeight = aVideoExtent.Height() - correctedHeight; |
|
1665 } |
|
1666 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay --- aDeltaHeight %d", aDeltaHeight); |
|
1667 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay --- aDeltaWidth %d", aDeltaWidth); |
|
1668 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay ---"); |
|
1669 } |
|
1670 |
|
1671 TBool CMediaClientVideoDisplayBody::IsWideScreenL() |
|
1672 { |
|
1673 DEBUG_PRINTF("CMediaClientVideoDisplayBody::IsWideScreenL +++"); |
|
1674 |
|
1675 CRepository* repo = CRepository::NewLC(KCRUidTvoutSettings); |
|
1676 TInt value; |
|
1677 User::LeaveIfError(repo->Get(KSettingsTvAspectRatio, value)); |
|
1678 |
|
1679 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsWideScreenL Tv Apect Ratio set to %d, 0=4x3 1=16x9", value); |
|
1680 |
|
1681 CleanupStack::PopAndDestroy(repo); |
|
1682 |
|
1683 TBool ret = value > 0; |
|
1684 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsWideScreenL --- return %d", ret); |
|
1685 return ret; |
|
1686 } |
|
1687 |
|
1688 TAutoScaleType CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL() |
|
1689 { |
|
1690 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL +++"); |
|
1691 |
|
1692 // EExtDisplayConnectionProviderConnTypeHdmi - EAutoScaleBestFit |
|
1693 // EExtDisplayConnectionProviderConnTypeAnalog / normal - EAutoScaleBestFit |
|
1694 // EExtDisplayConnectionProviderConnTypeAnalog / widescreen - EAutoScaleStretch |
|
1695 |
|
1696 TAutoScaleType autoScaleType; |
|
1697 if((iExtDisplayConnType == EExtDisplayConnectionProviderConnTypeAnalog) && IsWideScreenL()) |
|
1698 { |
|
1699 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL External display scale type EAutoScaleStretch"); |
|
1700 autoScaleType = EAutoScaleStretch; |
|
1701 } |
|
1702 else |
|
1703 { |
|
1704 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL External display scale type EAutoScaleBestFit"); |
|
1705 autoScaleType = EAutoScaleBestFit; |
|
1706 } |
|
1707 |
|
1708 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL --- return %d", autoScaleType); |
|
1709 return autoScaleType; |
|
1710 } |
|
1711 |
|
1712 #ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW |
|
1713 |
|
1714 void CMediaClientVideoDisplayBody::HideAllClientWindows() |
|
1715 { |
|
1716 DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideAllClientWindows +++"); |
|
1717 |
|
1718 TInt count = iClientWindows.Count(); |
|
1719 for (TInt i = 0; i < count; ++i) |
|
1720 { |
|
1721 // ignore error - cannot be handled |
|
1722 HideWindow(iClientWindows[i].iWindow); |
|
1723 } |
|
1724 |
|
1725 DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideAllClientWindows ---"); |
|
1726 } |
|
1727 |
|
1728 TInt CMediaClientVideoDisplayBody::HideWindow(RWindowBase* aWindow) |
|
1729 { |
|
1730 DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideWindow +++"); |
|
1731 |
|
1732 TSurfaceConfiguration config; |
|
1733 TInt err = aWindow->GetBackgroundSurface(config); |
|
1734 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::HideWindow GetBackgroundSurface error %d", err); |
|
1735 |
|
1736 #ifdef _DEBUG |
|
1737 TSurfaceId surface; |
|
1738 config.GetSurfaceId(surface); |
|
1739 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::HideWindow - Retrieved Surface %08x:%08x:%08x:%08x", |
|
1740 surface.iInternal[3], surface.iInternal[2], surface.iInternal[1], surface.iInternal[0]); |
|
1741 #endif |
|
1742 |
|
1743 if (err == KErrNone) |
|
1744 { |
|
1745 config.SetExtent(TRect(KHiddenExtentA, KHiddenExtentA, KHiddenExtentB, KHiddenExtentB)); |
|
1746 err = aWindow->SetBackgroundSurface(config, ETrue); |
|
1747 // Make sure all window rendering has completed before proceeding |
|
1748 RWsSession* ws = aWindow->Session(); |
|
1749 if (ws) |
|
1750 { |
|
1751 ws->Finish(); |
|
1752 } |
|
1753 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::HideWindow SetBackgroundSurface error %d", err); |
|
1754 } |
|
1755 |
|
1756 DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideWindow ---"); |
|
1757 return err; |
|
1758 } |
|
1759 |
|
1760 void CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows() |
|
1761 { |
|
1762 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows +++"); |
|
1763 |
|
1764 TInt count = iClientWindows.Count(); |
|
1765 for (TInt i = 0; i < count; ++i) |
|
1766 { |
|
1767 // ignore error - cannot be handled |
|
1768 SetHiddenBackgroundSurfaceOnClientWindow(iClientWindows[i]); |
|
1769 } |
|
1770 |
|
1771 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows ---"); |
|
1772 } |
|
1773 |
|
1774 |
|
1775 TInt CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow(TWindowData& aWindowData) |
|
1776 { |
|
1777 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow +++"); |
|
1778 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow - iSurfaceId %08x:%08x:%08x:%08x", |
|
1779 iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]); |
|
1780 |
|
1781 TSurfaceConfiguration config; |
|
1782 config.SetExtent(TRect(KHiddenExtentA, KHiddenExtentA, KHiddenExtentB, KHiddenExtentB)); |
|
1783 config.SetSurfaceId(iSurfaceId); |
|
1784 TInt err = aWindowData.iWindow->SetBackgroundSurface(config, ETrue); |
|
1785 |
|
1786 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow ---, return %d", err); |
|
1787 return err; |
|
1788 } |
|
1789 #endif |