53 |
53 |
54 //************************************************** |
54 //************************************************** |
55 |
55 |
56 CMMFVideoPostProcHwDevice* CNGAPostProcHwDevice::NewL() |
56 CMMFVideoPostProcHwDevice* CNGAPostProcHwDevice::NewL() |
57 { |
57 { |
58 PP_DEBUG(_L("CNGAPostProcHwDevice:NewL() ++")); |
58 PP_DEBUG(_L("CNGAPostProcHwDevice::NewL() ++")); |
59 |
59 |
60 CNGAPostProcHwDevice* self = new (ELeave) CNGAPostProcHwDevice; |
60 CNGAPostProcHwDevice* self = new (ELeave) CNGAPostProcHwDevice; |
61 CleanupStack::PushL(self); |
61 CleanupStack::PushL(self); |
62 self->ConstructL(); |
62 self->ConstructL(); |
63 CleanupStack::Pop(); |
63 CleanupStack::Pop(); |
64 |
64 |
65 PP_DEBUG(_L("CNGAPostProcHwDevice:NewL() --")); |
65 PP_DEBUG(_L("CNGAPostProcHwDevice::NewL() --")); |
66 return (CMMFVideoPostProcHwDevice*)self; |
66 return (CMMFVideoPostProcHwDevice*)self; |
67 } |
67 } |
68 |
68 |
69 void CNGAPostProcHwDevice::ConstructL() |
69 void CNGAPostProcHwDevice::ConstructL() |
70 { |
70 { |
71 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ConstructL() ++"), this); |
71 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::ConstructL() ++"), this); |
72 |
72 |
73 // support for VBM buffer interface |
73 // support for VBM buffer interface |
74 iVBMBufferOptions.iNumInputBuffers = KMaxVBMBuffers; |
74 iVBMBufferOptions.iNumInputBuffers = KMaxVBMBuffers; |
75 iVBMBufferOptions.iBufferSize = TSize(KMaxVBMInputWidth, KMaxVBMInputHeight); |
75 iVBMBufferOptions.iBufferSize = TSize(KMaxVBMInputWidth, KMaxVBMInputHeight); |
76 iPostingTimer = CNGAPostProcTimer::NewL(*this); |
76 iPostingTimer = CNGAPostProcTimer::NewL(*this); |
77 iWsSession.Connect(); |
77 iWsSession.Connect(); |
78 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:ConstructL() --"), this); |
78 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::ConstructL() --"), this); |
79 } |
79 } |
80 |
80 |
81 CNGAPostProcHwDevice::CNGAPostProcHwDevice() |
81 CNGAPostProcHwDevice::CNGAPostProcHwDevice() |
82 : iProxy(NULL), |
82 : iProxy(NULL), |
83 iInputDecoderDevice(NULL), |
83 iInputDecoderDevice(NULL), |
104 iStepFrameCount(0), |
104 iStepFrameCount(0), |
105 iPlayRate(KDefPlayRate), |
105 iPlayRate(KDefPlayRate), |
106 iKeyFrameMode(EFalse), |
106 iKeyFrameMode(EFalse), |
107 iFPObserver(NULL) |
107 iFPObserver(NULL) |
108 { |
108 { |
109 iRedrawSurfaceId = TSurfaceId::CreateNullId(); |
|
110 iSurfaceId = TSurfaceId::CreateNullId(); |
109 iSurfaceId = TSurfaceId::CreateNullId(); |
111 iAttributes().iPixelFormat = EUidPixelFormatYUV_422Interleaved; |
110 iAttributes().iPixelFormat = EUidPixelFormatYUV_422Interleaved; |
112 } |
111 } |
113 |
112 |
114 CNGAPostProcHwDevice::~CNGAPostProcHwDevice() |
113 CNGAPostProcHwDevice::~CNGAPostProcHwDevice() |
115 { |
114 { |
116 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:~() ++"), this); |
115 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::~CNGAPostProcHwDevice() ++"), this); |
117 if (iSessionManager) |
116 if (iSessionManager) |
118 { |
117 { |
119 iSessionManager->CancelUpdate(); |
118 iSessionManager->CancelUpdate(); |
120 delete iSessionManager; |
119 delete iSessionManager; |
121 iSessionManager = NULL; |
120 iSessionManager = NULL; |
653 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvsoSetSecureOutputL --"), this); |
652 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvsoSetSecureOutputL --"), this); |
654 } |
653 } |
655 |
654 |
656 void CNGAPostProcHwDevice::MmavsoSetAllowedOutputL(TUint aAllowedOutputMask) |
655 void CNGAPostProcHwDevice::MmavsoSetAllowedOutputL(TUint aAllowedOutputMask) |
657 { |
656 { |
658 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmavsoSetAllowedOutputL aAllowedOutputMask=%d ++"), this,aAllowedOutputMask); |
657 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmavsoSetAllowedOutputL aAllowedOutputMask=0x%08x ++"), this,aAllowedOutputMask); |
659 TInt err = KErrNone; |
658 TInt err = KErrNone; |
660 iSurfaceMask = surfaceHints::EAllowInternalOnly; |
659 iSurfaceMask = surfaceHints::EAllowInternalOnly; |
661 if (aAllowedOutputMask == EVideoAllowAll) |
660 if (aAllowedOutputMask == EVideoAllowAll) |
662 { |
661 { |
663 iSurfaceMask = surfaceHints::EAllowAllExternals; |
662 iSurfaceMask = surfaceHints::EAllowAllExternals; |
814 { |
813 { |
815 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw ++"), this); |
814 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw ++"), this); |
816 TInt err = KErrNone; |
815 TInt err = KErrNone; |
817 if(iResourceLost) |
816 if(iResourceLost) |
818 { |
817 { |
|
818 err = AddHints(); |
|
819 if (err != KErrNone) |
|
820 { |
|
821 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost -- failed to AddHints %d"), |
|
822 this, err); |
|
823 iProxy->MdvppFatalError(this, err); |
|
824 return; |
|
825 } |
819 err = RegisterSurface(iSurfaceId); |
826 err = RegisterSurface(iSurfaceId); |
820 if (err != KErrNone) |
827 if (err != KErrNone) |
821 { |
828 { |
822 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost -- failed to Register Surface %d"), |
829 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost -- failed to Register Surface %d"), |
823 this, err); |
830 this, err); |
824 iSurfaceHandler->DestroySurface(iSurfaceId); |
831 iSurfaceHandler->DestroySurface(iSurfaceId); |
825 iSurfaceId = TSurfaceId::CreateNullId(); |
832 iSurfaceId = TSurfaceId::CreateNullId(); |
826 iProxy->MdvppFatalError(this, err); |
833 iProxy->MdvppFatalError(this, err); |
827 return; |
834 return; |
828 } |
835 } |
829 err = AddHints(); |
836 |
830 if (err != KErrNone) |
837 iSessionManager->PostPicture(iSurfaceId, 0, 1, EFalse); |
831 { |
838 PublishSurfaceCreated(); |
832 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost -- failed to AddHints %d"), |
839 iResourceLost = EFalse; |
833 this, err); |
840 } |
834 iProxy->MdvppFatalError(this, err); |
841 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw --"), this); |
835 return; |
|
836 } |
|
837 iSessionManager->PostPicture(iSurfaceId, 0, 1, EFalse); |
|
838 PublishSurfaceCreated(); |
|
839 iResourceLost = EFalse; |
|
840 } |
|
841 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Redraw --"), this); |
|
842 } |
842 } |
843 |
843 |
844 void CNGAPostProcHwDevice::Start() |
844 void CNGAPostProcHwDevice::Start() |
845 { |
845 { |
846 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Start ++"), this); |
846 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Start ++"), this); |
1272 } |
1272 } |
1273 |
1273 |
1274 void CNGAPostProcHwDevice::MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId) |
1274 void CNGAPostProcHwDevice::MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId) |
1275 { |
1275 { |
1276 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL()++"), this); |
1276 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL()++"), this); |
1277 if(iSurfaceId == aSurfaceId && !aSurfaceId.IsNull()) |
1277 if(!aSurfaceId.IsNull()) |
1278 { |
1278 { |
1279 if(iInfo().iBuffers > 1) // No need to return temprory redraw surface buffer to decoder |
|
1280 { |
|
1281 ReleaseProcessQ(); |
|
1282 } |
|
1283 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL(): UnregisterSurface ID = 0x%x"), this, aSurfaceId ); |
1279 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL(): UnregisterSurface ID = 0x%x"), this, aSurfaceId ); |
1284 iWsSession.UnregisterSurface(0, iSurfaceId); |
1280 iWsSession.UnregisterSurface(0, aSurfaceId); |
1285 iSurfaceHandler->DestroySurface(iSurfaceId); |
1281 iSurfaceHandler->DestroySurface(aSurfaceId); |
1286 iSurfaceId = TSurfaceId::CreateNullId(); |
|
1287 } |
1282 } |
1288 |
1283 |
1289 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL() --"), this); |
1284 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvssSurfaceRemovedL() --"), this); |
1290 } |
1285 } |
1291 |
1286 |
1316 // === MMmfVideoResourceObserver === |
1311 // === MMmfVideoResourceObserver === |
1317 |
1312 |
1318 void CNGAPostProcHwDevice::MmvroResourcesLost(TUid ) |
1313 void CNGAPostProcHwDevice::MmvroResourcesLost(TUid ) |
1319 { |
1314 { |
1320 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost ++"), this); |
1315 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost ++"), this); |
1321 if(!iRedrawSurfaceId.IsNull()) |
1316 iResourceLost = ETrue; |
1322 { |
1317 Pause(); |
1323 iResourceLost = ETrue; |
1318 ReleaseInputQ(); |
1324 Pause(); |
1319 iSessionManager->CancelUpdate(); |
1325 ReleaseInputQ(); |
1320 ReleaseProcessQ(); |
1326 iSessionManager->CancelUpdate(); |
1321 iVideoSurfaceObserver->MmvsoRemoveSurface(); |
1327 ReleaseProcessQ(); |
|
1328 iWsSession.UnregisterSurface(0, iRedrawSurfaceId); |
|
1329 iSurfaceHandler->DestroySurface(iRedrawSurfaceId); |
|
1330 iRedrawSurfaceId = TSurfaceId::CreateNullId(); |
|
1331 } |
|
1332 else |
|
1333 { |
|
1334 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]::MmvroResourcesLost ERROR iRedrawSurfaceId NULL"), this); |
|
1335 } |
|
1336 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost --"), this); |
1322 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvroResourcesLost --"), this); |
1337 } |
1323 } |
1338 |
1324 |
1339 // === MMmfVideoPropertiesNotifier === |
1325 // === MMmfVideoPropertiesNotifier === |
1340 |
1326 |
1380 } |
1366 } |
1381 |
1367 |
1382 TInt err = KErrNone; |
1368 TInt err = KErrNone; |
1383 SetSurfaceAttributes(surfaceSize, 1); |
1369 SetSurfaceAttributes(surfaceSize, 1); |
1384 |
1370 |
1385 iRedrawSurfaceId = iSurfaceId; |
|
1386 |
|
1387 err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId); |
1371 err = iSurfaceHandler->CreateSurface(iAttributes, iSurfaceId); |
1388 if (err != KErrNone) |
1372 if (err != KErrNone) |
1389 { |
1373 { |
1390 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to create Surface %d"), |
1374 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvshcRedrawBufferToSurface -- failed to create Surface %d"), |
1391 this, err); |
1375 this, err); |
1436 TInt err = KErrNone; |
1420 TInt err = KErrNone; |
1437 |
1421 |
1438 if(!iSurfaceId.IsNull()) |
1422 if(!iSurfaceId.IsNull()) |
1439 { |
1423 { |
1440 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface Cleaning ReDraw Surface"), this); |
1424 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface Cleaning ReDraw Surface"), this); |
1441 iWsSession.UnregisterSurface(0, iSurfaceId); |
1425 iVideoSurfaceObserver->MmvsoRemoveSurface(); |
1442 iSurfaceHandler->DestroySurface(iSurfaceId); |
|
1443 } |
1426 } |
1444 |
1427 |
1445 iSurfaceId = aSurfaceID; |
1428 iSurfaceId = aSurfaceID; |
1446 iUsingExternalSurface = ETrue; |
1429 iUsingExternalSurface = ETrue; |
1447 |
1430 |
1462 { |
1445 { |
1463 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed OpenSurface %d"), |
1446 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed OpenSurface %d"), |
1464 this, err); |
1447 this, err); |
1465 return err; |
1448 return err; |
1466 } |
1449 } |
|
1450 err = AddHints(); |
|
1451 if (err != KErrNone) |
|
1452 { |
|
1453 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to AddHints %d"), |
|
1454 this, err); |
|
1455 return err; |
|
1456 } |
1467 err = RegisterSurface(iSurfaceId); |
1457 err = RegisterSurface(iSurfaceId); |
1468 if (err != KErrNone) |
1458 if (err != KErrNone) |
1469 { |
1459 { |
1470 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed RegisterSurface %d"), |
1460 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed RegisterSurface %d"), |
1471 this, err); |
1461 this, err); |
1472 iSurfaceHandler->DestroySurface(iSurfaceId); |
1462 iSurfaceHandler->DestroySurface(iSurfaceId); |
1473 iSurfaceId = TSurfaceId::CreateNullId(); |
1463 iSurfaceId = TSurfaceId::CreateNullId(); |
1474 return err; |
1464 return err; |
1475 } |
1465 } |
1476 err = AddHints(); |
1466 |
1477 if (err != KErrNone) |
1467 err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo); |
1478 { |
1468 if (err != KErrNone) |
1479 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to AddHints %d"), |
1469 { |
1480 this, err); |
1470 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to get Surface info %d"), |
1481 return err; |
1471 this, err); |
1482 } |
1472 return err; |
1483 err = iSurfaceHandler->SurfaceInfo(iSurfaceId, iInfo); |
1473 } |
1484 if (err != KErrNone) |
1474 |
1485 { |
|
1486 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface -- failed to get Surface info %d"), |
|
1487 this, err); |
|
1488 return err; |
|
1489 } |
|
1490 |
|
1491 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface err=%d"), this, err); |
1475 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:SetupExternalSurface err=%d"), this, err); |
1492 return err; |
1476 return err; |
1493 } |
1477 } |
1494 |
1478 |
1495 //=== Internal === |
1479 //=== Internal === |
1788 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create VBM buffer %d"), this, err); |
1772 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create VBM buffer %d"), this, err); |
1789 iSurfaceHandler->DestroySurface(iSurfaceId); |
1773 iSurfaceHandler->DestroySurface(iSurfaceId); |
1790 iSurfaceId = TSurfaceId::CreateNullId(); |
1774 iSurfaceId = TSurfaceId::CreateNullId(); |
1791 return err; |
1775 return err; |
1792 } |
1776 } |
1793 err = RegisterSurface(iSurfaceId); |
1777 err = AddHints(); |
1794 if (err != KErrNone) |
1778 if (err != KErrNone) |
1795 { |
1779 { |
1796 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to RegisterSurface %d"), this, err); |
1780 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to AddHints %d"), this, err); |
1797 iSurfaceHandler->DestroySurface(iSurfaceId); |
1781 return err; |
1798 iSurfaceId = TSurfaceId::CreateNullId(); |
1782 } |
1799 return err; |
1783 err = RegisterSurface(iSurfaceId); |
1800 } |
1784 if (err != KErrNone) |
1801 err = AddHints(); |
1785 { |
1802 if (err != KErrNone) |
1786 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to RegisterSurface %d"), this, err); |
1803 { |
1787 iSurfaceHandler->DestroySurface(iSurfaceId); |
1804 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to AddHints %d"), this, err); |
1788 iSurfaceId = TSurfaceId::CreateNullId(); |
1805 return err; |
1789 return err; |
1806 } |
1790 } |
|
1791 |
1807 } |
1792 } |
1808 return err; |
1793 return err; |
1809 } |
1794 } |
1810 |
1795 |
1811 void CNGAPostProcHwDevice::SetSurfaceAttributes(const TSize& aSize, TInt aNumBuf) |
1796 void CNGAPostProcHwDevice::SetSurfaceAttributes(const TSize& aSize, TInt aNumBuf) |
2085 return pic; |
2070 return pic; |
2086 } |
2071 } |
2087 |
2072 |
2088 TInt CNGAPostProcHwDevice::AddHints() |
2073 TInt CNGAPostProcHwDevice::AddHints() |
2089 { |
2074 { |
2090 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints ++"), this); |
2075 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:AddHints iSurfaceMask 0x%08x ++"), this, iSurfaceMask); |
2091 TInt err = KErrNone; |
2076 TInt err = KErrNone; |
2092 iHint.Set(iSurfaceKey,iSurfaceMask,ETrue); |
2077 iHint.Set(iSurfaceKey,iSurfaceMask,ETrue); |
2093 err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint); |
2078 err = iSurfaceHandler->AddSurfaceHint(iSurfaceId,iHint); |
2094 if(err == KErrAlreadyExists) |
2079 if(err == KErrAlreadyExists) |
2095 { |
2080 { |