967 |
1006 |
968 void CNGAPostProcHwDevice::ReturnPicture(TVideoPicture* ) |
1007 void CNGAPostProcHwDevice::ReturnPicture(TVideoPicture* ) |
969 { |
1008 { |
970 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReturnPicture +-"), this); |
1009 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ReturnPicture +-"), this); |
971 //not required for direct rendering |
1010 //not required for direct rendering |
|
1011 } |
|
1012 |
|
1013 TBool CNGAPostProcHwDevice::GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& /*aFormat*/) |
|
1014 { |
|
1015 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL %d %d ++"), this, iVBMEnabled, iProcessQ.Count()); |
|
1016 TVideoPicture* pic = NULL; |
|
1017 TInt err = KErrNone; |
|
1018 TBool frameAvailable =EFalse; |
|
1019 tWndParam inputCropWindow; |
|
1020 tWndParam outputCropWindow; |
|
1021 tBaseVideoFrame inputFrame; |
|
1022 inputFrame.lum = NULL; |
|
1023 |
|
1024 if(aPictureData.iDataFormat == ERgbFbsBitmap) |
|
1025 { |
|
1026 if(iProcessQ.Count()) |
|
1027 { |
|
1028 pic = iProcessQ[0]; //frame already submitted for display |
|
1029 } |
|
1030 else if(iInputQ.Count()) |
|
1031 { |
|
1032 pic = iInputQ[0]; //frame yet to be displayed |
|
1033 } |
|
1034 if(pic) |
|
1035 { |
|
1036 if (iVBMEnabled) |
|
1037 { |
|
1038 inputFrame.lum = (TUint8*)pic->iData.iRawData->Ptr(); |
|
1039 } |
|
1040 else |
|
1041 { |
|
1042 if (iInputDecoderDevice) |
|
1043 { |
|
1044 MMmfVideoFetchFrame* VFHandler = NULL; |
|
1045 VFHandler = (MMmfVideoFetchFrame*)iInputDecoderDevice->CustomInterface(KUidMMFVideoFetchFrame); |
|
1046 if (VFHandler) |
|
1047 { |
|
1048 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL() fetch frame"), this); |
|
1049 inputFrame.lum = (TUint8*)VFHandler->MmvffGetFrame(GetID(pic)); |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL() decoder yet to implement MMmfVideoFetchFrame CI"), this); |
|
1054 } |
|
1055 } |
|
1056 } |
|
1057 } |
|
1058 if(inputFrame.lum) |
|
1059 { |
|
1060 inputFrame.cb = inputFrame.lum + iPicSize.iWidth * iPicSize.iHeight; |
|
1061 |
|
1062 if( ((iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma1) || |
|
1063 (iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma2) || |
|
1064 (iVideoFormat.iYuvFormat.iPattern == EYuv420Chroma3) )) |
|
1065 { |
|
1066 inputFrame.cr = inputFrame.lum + (iPicSize.iWidth * iPicSize.iHeight*5)/4; |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 inputFrame.cr = inputFrame.lum + (iPicSize.iWidth * iPicSize.iHeight*3)/2; |
|
1071 } |
|
1072 |
|
1073 inputFrame.width = (unsigned short)iPicSize.iWidth; |
|
1074 inputFrame.height = (unsigned short)iPicSize.iHeight; |
|
1075 |
|
1076 outputCropWindow.wndHeight = iPicSize.iHeight; |
|
1077 outputCropWindow.wndWidth = iPicSize.iWidth; |
|
1078 outputCropWindow.xOffset = 0; |
|
1079 outputCropWindow.yOffset = 0; |
|
1080 |
|
1081 inputCropWindow.wndHeight = iPicSize.iHeight; |
|
1082 inputCropWindow.wndWidth = iPicSize.iWidth; |
|
1083 inputCropWindow.xOffset = 0; |
|
1084 inputCropWindow.yOffset = 0; |
|
1085 |
|
1086 RFbsSession fbs; |
|
1087 fbs.Connect(); |
|
1088 CFbsBitmap* iOutBitmap = aPictureData.iRgbBitmap; |
|
1089 TInt status = iOutBitmap->Resize(iPicSize); |
|
1090 if (status == KErrNone) |
|
1091 { |
|
1092 // Lock the heap to prevent the FBS server from invalidating the address |
|
1093 iOutBitmap->LockHeap(); |
|
1094 TUint8* dataAddress = (TUint8*)iOutBitmap->DataAddress(); |
|
1095 err = ColorConvert(&inputFrame, dataAddress, &inputCropWindow, &outputCropWindow); |
|
1096 iOutBitmap->UnlockHeap(); |
|
1097 frameAvailable = ETrue; |
|
1098 } |
|
1099 fbs.Disconnect(); |
|
1100 } |
|
1101 } |
|
1102 else |
|
1103 { |
|
1104 err = KErrNotSupported; |
|
1105 } |
|
1106 if(err != KErrNone) |
|
1107 { |
|
1108 User::Leave(err); |
|
1109 } |
|
1110 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:GetSnapshotL --"), this); |
|
1111 return(frameAvailable); |
972 } |
1112 } |
973 |
1113 |
974 void CNGAPostProcHwDevice::InputEnd() |
1114 void CNGAPostProcHwDevice::InputEnd() |
975 { |
1115 { |
976 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd ++"), this); |
1116 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:InputEnd ++"), this); |
1278 aCropRect = TRect(0, 0, iInfo().iSize.iWidth, iInfo().iSize.iHeight); |
1419 aCropRect = TRect(0, 0, iInfo().iSize.iWidth, iInfo().iSize.iHeight); |
1279 if((iPicSize.iWidth > 0) && (iPicSize.iHeight > 0)) |
1420 if((iPicSize.iWidth > 0) && (iPicSize.iHeight > 0)) |
1280 { |
1421 { |
1281 aCropRect.Intersection( iPicSize); |
1422 aCropRect.Intersection( iPicSize); |
1282 } |
1423 } |
1283 aPixelAspectRatio = TVideoAspectRatio(1,1); |
1424 aPixelAspectRatio = TVideoAspectRatio(iAspectRatioNum,iAspectRatioDenom); |
1284 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL()-- \ |
1425 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() \ |
1285 cropRectWidth = %d cropRectHeight = %d --"), this, aCropRect.Width(), aCropRect.Height()); |
1426 cropRectWidth = %d cropRectHeight = %d"), this, aCropRect.Width(), aCropRect.Height()); |
1286 |
1427 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() \ |
|
1428 PAR Num = %d PAR Denom = %d"), this, aPixelAspectRatio.iNumerator, aPixelAspectRatio.iDenominator); |
|
1429 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssGetSurfaceParametersL() --"), this); |
1287 } |
1430 } |
1288 |
1431 |
1289 void CNGAPostProcHwDevice::MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId) |
1432 void CNGAPostProcHwDevice::MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId) |
1290 { |
1433 { |
1291 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL()++"), this); |
1434 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL()++"), this); |
1292 if(!aSurfaceId.IsNull()) |
1435 if(!aSurfaceId.IsNull()) |
1293 { |
1436 { |
1294 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL(): UnregisterSurface ID = 0x%x"), this, aSurfaceId ); |
1437 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL(): UnregisterSurface ID = 0x%x"), this, aSurfaceId ); |
1295 iWsSession.UnregisterSurface(0, aSurfaceId); |
1438 TInt numScreens = iWsSession.NumberOfScreens(); |
|
1439 for(TInt i=0;i < numScreens;i++) |
|
1440 { |
|
1441 iWsSession.UnregisterSurface(i, aSurfaceId); |
|
1442 } |
|
1443 iWsSession.Flush(); |
1296 iSurfaceHandler->DestroySurface(aSurfaceId); |
1444 iSurfaceHandler->DestroySurface(aSurfaceId); |
1297 } |
1445 if(iSurfaceId == aSurfaceId) |
1298 |
1446 { |
|
1447 iSurfaceCreatedEventPublished = EFalse; |
|
1448 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1449 iChunk.Close(); |
|
1450 } |
|
1451 } |
1299 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL() --"), this); |
1452 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL() --"), this); |
1300 } |
1453 } |
1301 |
1454 |
1302 // === MMmfVideoPropertiesObserver === |
1455 // === MMmfVideoPropertiesObserver === |
1303 |
1456 |
1305 { |
1458 { |
1306 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties ++"), this); |
1459 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties ++"), this); |
1307 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties PAR \ |
1460 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties PAR \ |
1308 iAspectRatioNum = %d, iAspectRatioDenom = %d"), this, |
1461 iAspectRatioNum = %d, iAspectRatioDenom = %d"), this, |
1309 aYuvFormat.iAspectRatioNum,aYuvFormat.iAspectRatioDenom); |
1462 aYuvFormat.iAspectRatioNum,aYuvFormat.iAspectRatioDenom); |
1310 iPicSize = aPictureSize; |
1463 iPicSize = aPictureSize; |
|
1464 iAspectRatioNum = aYuvFormat.iAspectRatioNum; |
|
1465 iAspectRatioDenom = aYuvFormat.iAspectRatioDenom; |
1311 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties Picture Size \ |
1466 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvpoUpdateVideoProperties Picture Size \ |
1312 iWidth = %d, iHeight = %d, iSurfaceCreatedEventPublished = %d"), |
1467 iWidth = %d, iHeight = %d, iSurfaceCreatedEventPublished = %d"), |
1313 this, iPicSize.iWidth,iPicSize.iHeight, iSurfaceCreatedEventPublished?1:0); |
1468 this, iPicSize.iWidth,iPicSize.iHeight, iSurfaceCreatedEventPublished?1:0); |
1314 |
1469 |
1315 if(iVPObserver) |
1470 if(iVPObserver) |
1380 |
1540 |
1381 } |
1541 } |
1382 |
1542 |
1383 void CNGAPostProcHwDevice::MmvshcRedrawBufferToSurface(TPtrC8& aRedrawBuffer) |
1543 void CNGAPostProcHwDevice::MmvshcRedrawBufferToSurface(TPtrC8& aRedrawBuffer) |
1384 { |
1544 { |
1385 PP_DEBUG(_L("CNGAPostProcHwDevice::MmvshcRedrawBufferToSurface ++"), this); |
1545 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface ++"), this); |
1386 |
1546 |
1387 TSize surfaceSize; |
|
1388 TUint8* lPtr; |
1547 TUint8* lPtr; |
1389 TInt offset; |
1548 TInt offset; |
1390 if(iPicSize.iWidth > iPicSize.iHeight) |
1549 |
1391 { |
1550 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface -- Creating %d x %d surface"), this, iPicSize.iWidth, iPicSize.iHeight); |
1392 surfaceSize.iWidth = iPicSize.iWidth; |
|
1393 surfaceSize.iHeight = iPicSize.iWidth; |
|
1394 } |
|
1395 else |
|
1396 { |
|
1397 surfaceSize.iWidth = iPicSize.iHeight; |
|
1398 surfaceSize.iHeight = iPicSize.iHeight; |
|
1399 } |
|
1400 |
1551 |
1401 TInt err = KErrNone; |
1552 TInt err = KErrNone; |
1402 SetSurfaceAttributes(surfaceSize, 1); |
1553 SetSurfaceAttributes(iPicSize, 1); |
1403 |
1554 |
1404 err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId); |
1555 err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId); |
1405 if (err != KErrNone) |
1556 if (err != KErrNone) |
1406 { |
1557 { |
1407 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to create Surface %d"), |
1558 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to create Surface %d"), |
1408 this, err); |
1559 this, err); |
1409 iProxy->MdvppFatalError(this, err); |
1560 iProxy->MdvppFatalError(this, err); |
1410 return; |
1561 return; |
1411 } |
1562 } |
|
1563 |
|
1564 err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo); |
|
1565 if (err != KErrNone) |
|
1566 { |
|
1567 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to get Surface info %d"), |
|
1568 this, err); |
|
1569 iSurfaceHandler->DestroySurface(iSurfaceId); |
|
1570 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1571 iProxy->MdvppFatalError(this, err); |
|
1572 return; |
|
1573 } |
|
1574 |
|
1575 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface() \ |
|
1576 surfaceWidth = %d surfaceHeight = %d surfaceStride = %d"), this, iInfo().iSize.iWidth, iInfo().iSize.iHeight, iInfo().iStride); |
|
1577 |
|
1578 TInt redrawBufferSize = aRedrawBuffer.Size(); |
|
1579 TInt surfaceSize = iInfo().iStride * iInfo().iSize.iHeight; |
|
1580 |
|
1581 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface RedrawBuffer size= %d Surface size = %d"), this, redrawBufferSize, surfaceSize); |
|
1582 |
|
1583 // Check whether redraw buffer will fit onto the surface. |
|
1584 // If this check fails then we won't raise a fatal error - We just won't create the redraw surface |
|
1585 if (redrawBufferSize > surfaceSize) |
|
1586 { |
|
1587 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface Redraw buffer size larger than surface size"), this); |
|
1588 iSurfaceHandler->DestroySurface(iSurfaceId); |
|
1589 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1590 return; |
|
1591 } |
|
1592 |
1412 err = iSurfaceHandler->MapSurface(iSurfaceId, iChunk); |
1593 err = iSurfaceHandler->MapSurface(iSurfaceId, iChunk); |
1413 if (err != KErrNone) |
1594 if (err != KErrNone) |
1414 { |
1595 { |
1415 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to map Surface %d"), |
1596 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to map Surface %d"), |
1416 this, err); |
1597 this, err); |
1417 iSurfaceHandler->DestroySurface(iSurfaceId); |
1598 iSurfaceHandler->DestroySurface(iSurfaceId); |
1418 iSurfaceId = TSurfaceId::CreateNullId(); |
1599 iSurfaceId = TSurfaceId::CreateNullId(); |
1419 iProxy->MdvppFatalError(this, err); |
1600 iProxy->MdvppFatalError(this, err); |
1420 return; |
1601 return; |
1421 } |
1602 } |
1422 err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo); |
|
1423 if (err != KErrNone) |
|
1424 { |
|
1425 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to get Surface info %d"), |
|
1426 this, err); |
|
1427 iSurfaceHandler->DestroySurface(iSurfaceId); |
|
1428 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1429 iProxy->MdvppFatalError(this, err); |
|
1430 return; |
|
1431 } |
|
1432 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface() \ |
|
1433 surfaceWidth = %d surfaceHeight = %d --"), this, iInfo().iSize.iWidth, iInfo().iSize.iHeight); |
|
1434 |
1603 |
1435 if((err = iSurfaceHandler->GetBufferOffset(iSurfaceId, 0, offset)) != KErrNone) |
1604 if((err = iSurfaceHandler->GetBufferOffset(iSurfaceId, 0, offset)) != KErrNone) |
1436 { |
1605 { |
1437 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset query failed %d"), this, err); |
1606 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset query failed %d"), this, err); |
1438 iSurfaceHandler->DestroySurface(iSurfaceId); |
1607 iSurfaceHandler->DestroySurface(iSurfaceId); |
1439 iSurfaceId = TSurfaceId::CreateNullId(); |
1608 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1609 iChunk.Close(); |
1440 iProxy->MdvppFatalError(this, err); |
1610 iProxy->MdvppFatalError(this, err); |
1441 return; |
1611 return; |
1442 } |
1612 } |
1443 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset = %d aRedrawBuffer.Size()= %d --"), this, offset, aRedrawBuffer.Size()); |
1613 |
1444 |
1614 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface offset = %d"), this, offset); |
|
1615 |
1445 lPtr = reinterpret_cast<TUint8*>(iChunk.Base() + offset); |
1616 lPtr = reinterpret_cast<TUint8*>(iChunk.Base() + offset); |
1446 memcpy((TAny *)lPtr, (TAny *)aRedrawBuffer.Ptr(), aRedrawBuffer.Size()); |
1617 memcpy((TAny *)lPtr, (TAny *)aRedrawBuffer.Ptr(), redrawBufferSize); |
1447 |
1618 |
|
1619 iRedrawSurfaceInUse = ETrue; |
|
1620 |
|
1621 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface(): New surface = 0x%x"), this, iSurfaceId); |
|
1622 |
1448 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface error = %d --"), this, err); |
1623 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvshcRedrawBufferToSurface error = %d --"), this, err); |
1449 } |
1624 } |
1450 |
1625 |
1451 TInt CNGAPostProcHwDevice::SetupExternalSurface(const TSurfaceId &aSurfaceID) |
1626 TInt CNGAPostProcHwDevice::SetupExternalSurface(const TSurfaceId &aSurfaceID) |
1452 { |
1627 { |
|
1628 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface(): aSurfaceID = 0x%x"), this, aSurfaceID ); |
|
1629 |
1453 TInt err = KErrNone; |
1630 TInt err = KErrNone; |
1454 |
1631 |
1455 if(!iSurfaceId.IsNull()) |
1632 if(!iSurfaceId.IsNull()) |
1456 { |
1633 { |
1457 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface Cleaning ReDraw Surface"), this); |
1634 if (iVideoSurfaceObserver && iSurfaceCreatedEventPublished) |
1458 iVideoSurfaceObserver->MmvsoRemoveSurface(); |
1635 { |
|
1636 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface - Telling client to remove old surface"), this); |
|
1637 iVideoSurfaceObserver->MmvsoRemoveSurface(); |
|
1638 iSurfaceCreatedEventPublished = EFalse; |
|
1639 } |
|
1640 else |
|
1641 { |
|
1642 // We never told the client about the surface, so we must destroy it ourselves |
|
1643 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface - Destroying old surface"), this); |
|
1644 TInt numScreens = iWsSession.NumberOfScreens(); |
|
1645 for(TInt i=0;i < numScreens;i++) |
|
1646 { |
|
1647 iWsSession.UnregisterSurface(i, iSurfaceId); |
|
1648 } |
|
1649 iWsSession.Flush(); |
|
1650 iSurfaceHandler->DestroySurface(iSurfaceId); |
|
1651 } |
|
1652 |
|
1653 iChunk.Close(); |
1459 } |
1654 } |
1460 |
1655 |
1461 iSurfaceId = aSurfaceID; |
1656 iSurfaceId = aSurfaceID; |
1462 iUsingExternalSurface = ETrue; |
1657 iUsingExternalSurface = ETrue; |
1463 |
1658 iRedrawSurfaceInUse = EFalse; |
1464 |
1659 |
1465 // Create the surface handler if it doesn't exist. |
1660 // Create the surface handler if it doesn't exist. |
1466 if (!iSurfaceHandler) |
1661 if (!iSurfaceHandler) |
1467 { |
1662 { |
1468 TRAP(err, iSurfaceHandler = CNGAPostProcSurfaceHandler::NewL()); |
1663 TRAP(err, iSurfaceHandler = CNGAPostProcSurfaceHandler::NewL()); |
1469 if (err != KErrNone) |
1664 if (err != KErrNone) |
1686 TInt resp = EPostIt; |
1884 TInt resp = EPostIt; |
1687 // Frame presentation time |
1885 // Frame presentation time |
1688 TInt64 uPresTime = frame->iTimestamp.Int64(); |
1886 TInt64 uPresTime = frame->iTimestamp.Int64(); |
1689 |
1887 |
1690 // Check if this is an out of order frame in case of forward playback |
1888 // Check if this is an out of order frame in case of forward playback |
1691 if((iCurrentPlaybackPosition.Int64() >= uPresTime) && (iPlayRate > 0)) |
1889 if((iCurrentPlaybackPosition.Int64() > uPresTime) && (iPlayRate > 0)) |
1692 { |
1890 { |
1693 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (forward playback) Tfm=%d"), this,(TInt)uPresTime); |
1891 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (forward playback) Tfm=%d"), this,(TInt)uPresTime); |
1694 resp = ESkipIt; //drop |
1892 resp = ESkipIt; //drop |
1695 } // Check if this is an out of order frame in case of backward playback |
1893 } // Check if this is an out of order frame in case of backward playback |
1696 else if((iCurrentPlaybackPosition.Int64() <= uPresTime) && (iPlayRate < 0)) |
1894 else if((iCurrentPlaybackPosition.Int64() < uPresTime) && (iPlayRate < 0)) |
1697 { |
1895 { |
1698 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (backward playback) Tfm=%d"), this,(TInt)uPresTime); |
1896 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:IsTimeToPost : Out of order frame (backward playback) Tfm=%d"), this,(TInt)uPresTime); |
1699 resp = ESkipIt; //drop |
1897 resp = ESkipIt; //drop |
1700 } |
1898 } |
1701 else if (iClockSource) |
1899 else if (iClockSource) |
2129 { |
2334 { |
2130 err = KErrNone; |
2335 err = KErrNone; |
2131 err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint); |
2336 err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint); |
2132 } |
2337 } |
2133 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err); |
2338 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err); |
|
2339 iHint.iKey.iUid = surfaceHints::KSurfaceContent; |
|
2340 iHint.iValue = surfaceHints::EVideoPlayback; |
|
2341 iHint.iMutable = ETrue; |
|
2342 err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint); |
|
2343 if(err == KErrAlreadyExists) |
|
2344 { |
|
2345 err = KErrNone; |
|
2346 err = iSurfaceHandler->SetSurfaceHint(iSurfaceId,iHint); |
|
2347 } |
|
2348 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints. err = %d --"), this,err); |
2134 return err; |
2349 return err; |
|
2350 } |
|
2351 |
|
2352 TInt CNGAPostProcHwDevice::ColorConvert(tBaseVideoFrame* aInputFrame, TUint8* aDestPtr, tWndParam* aInputCropWindow, tWndParam* aOutputCropWindow) |
|
2353 { |
|
2354 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ColorConvert ++"), this); |
|
2355 __ASSERT_ALWAYS(aDestPtr, User::Invariant()); |
|
2356 TInt lError = E_SUCCESS; |
|
2357 TInt err = KErrNone; |
|
2358 |
|
2359 err = SetSourceFormat(); |
|
2360 if(err == KErrNone) |
|
2361 { |
|
2362 err = SetSourceRange(); |
|
2363 if(err == KErrNone) |
|
2364 { |
|
2365 |
|
2366 lError = Emz_VDec_gColorConv_YUVtoRGB(aInputFrame,aDestPtr, |
|
2367 aInputCropWindow, aOutputCropWindow, iSourceFormat, |
|
2368 EBitmapColor16MU, iSourceRange); |
|
2369 |
|
2370 if(lError) |
|
2371 { |
|
2372 if(lError == E_OUT_OF_MEMORY) |
|
2373 { |
|
2374 err = KErrNoMemory; |
|
2375 } |
|
2376 else if(lError == E_FAILURE) |
|
2377 { |
|
2378 err = KErrNotSupported; |
|
2379 } |
|
2380 else |
|
2381 { |
|
2382 err = KErrGeneral; |
|
2383 } |
|
2384 } |
|
2385 } |
|
2386 } |
|
2387 |
|
2388 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ColorConvert --"), this); |
|
2389 return err; |
|
2390 } |
|
2391 |
|
2392 TInt CNGAPostProcHwDevice::SetSourceFormat() |
|
2393 { |
|
2394 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceFormatL ++"), this); |
|
2395 TInt err = KErrNone; |
|
2396 switch (iVideoFormat.iYuvFormat.iPattern) |
|
2397 { |
|
2398 case EYuv420Chroma1: |
|
2399 iSourceFormat = EYuv420Chroma1_Planar; |
|
2400 break; |
|
2401 case EYuv420Chroma2: |
|
2402 iSourceFormat = EYuv420Chroma2_Planar; |
|
2403 break; |
|
2404 case EYuv420Chroma3: |
|
2405 iSourceFormat = EYuv420Chroma3_Planar; |
|
2406 break; |
|
2407 case EYuv422Chroma1: |
|
2408 if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedLE) |
|
2409 iSourceFormat = EYuv422Chroma1_LE; |
|
2410 else if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedBE ) |
|
2411 iSourceFormat = EYuv422Chroma1_BE; |
|
2412 else |
|
2413 err = KErrArgument; |
|
2414 break; |
|
2415 case EYuv422Chroma2: |
|
2416 if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedLE) |
|
2417 iSourceFormat = EYuv422Chroma2_LE; |
|
2418 else if( iVideoFormat.iYuvFormat.iDataLayout == EYuvDataInterleavedBE ) |
|
2419 iSourceFormat = EYuv422Chroma2_BE; |
|
2420 else |
|
2421 err = KErrArgument; |
|
2422 break; |
|
2423 default: |
|
2424 err = KErrNotSupported; |
|
2425 } |
|
2426 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceFormatL --"), this); |
|
2427 return err; |
|
2428 } |
|
2429 |
|
2430 |
|
2431 TInt CNGAPostProcHwDevice::SetSourceRange() |
|
2432 { |
|
2433 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceRangeL ++"), this); |
|
2434 TInt err = KErrNone; |
|
2435 switch (iVideoFormat.iYuvFormat.iCoefficients) |
|
2436 { |
|
2437 case EYuvBt601Range0: |
|
2438 iSourceRange = EITU601_5_REDUCEDRANGE; |
|
2439 break; |
|
2440 case EYuvBt601Range1: |
|
2441 iSourceRange = EITU601_5_FULLRANGE; |
|
2442 break; |
|
2443 case EYuvBt709Range0: |
|
2444 iSourceRange = EB709_REDUCEDRANGE; |
|
2445 break; |
|
2446 case EYuvBt709Range1: |
|
2447 iSourceRange = EB709_FULLRANGE; |
|
2448 break; |
|
2449 default: |
|
2450 err = KErrNotSupported; |
|
2451 } |
|
2452 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetSourceRangeL --"), this); |
|
2453 return err; |
2135 } |
2454 } |
2136 |
2455 |
2137 CNGAPostProcTimer::CNGAPostProcTimer( CNGAPostProcHwDevice& aParent ) |
2456 CNGAPostProcTimer::CNGAPostProcTimer( CNGAPostProcHwDevice& aParent ) |
2138 :CTimer(EPriorityHigh),iParent(aParent) |
2457 :CTimer(EPriorityHigh),iParent(aParent) |
2139 { |
2458 { |