1105 iDsaOptions.iRect = aDP.iRect; |
1117 iDsaOptions.iRect = aDP.iRect; |
1106 iDsaOptions.iWindow = &aDP.iWindow; |
1118 iDsaOptions.iWindow = &aDP.iWindow; |
1107 iDsaOptions.iWs = &aDP.iWs; |
1119 iDsaOptions.iWs = &aDP.iWs; |
1108 iDsaOptions.iWsSD = &aDP.iWsSD; |
1120 iDsaOptions.iWsSD = &aDP.iWsSD; |
1109 __VTPRINTEXIT( "LocVid.SetVFParamsDP" ) |
1121 __VTPRINTEXIT( "LocVid.SetVFParamsDP" ) |
|
1122 } |
|
1123 |
|
1124 // ----------------------------------------------------------------------------- |
|
1125 // CVtEngLocalVideo::SetViewFinderParameters |
|
1126 // Configures parameters for rendering with NGA. |
|
1127 // ----------------------------------------------------------------------------- |
|
1128 // |
|
1129 void CVtEngLocalVideo::SetViewFinderParameters( |
|
1130 const TVtEngRenderingOptionsNGA &aNGA ) |
|
1131 { |
|
1132 __VTPRINTENTER( "LocVid.SetVFParamsNGA" ) |
|
1133 |
|
1134 // Before setting the params, stop VF |
|
1135 if( ViewFinderStarted() ) |
|
1136 { |
|
1137 StopViewFinder(); |
|
1138 } |
|
1139 |
|
1140 iOptions.iSize.SetSize( KVtEngLocalVideoDefaultWidth, |
|
1141 KVtEngLocalVideoDefaultHeight ); |
|
1142 |
|
1143 iWindow = &aNGA.iWindow; |
|
1144 iWs = &aNGA.iWs; |
|
1145 |
|
1146 iRenderingMethod = EWindowServer; |
|
1147 |
|
1148 iNGARender->AttachSurfaceL( iWs, iWindow ); |
|
1149 __VTPRINTEXIT( "LocVid.SetVFParamsNGA" ) |
1110 } |
1150 } |
1111 |
1151 |
1112 // ----------------------------------------------------------------------------- |
1152 // ----------------------------------------------------------------------------- |
1113 // CVtEngLocalVideo::SetDefaultStillImageL |
1153 // CVtEngLocalVideo::SetDefaultStillImageL |
1114 // Sets default still image. |
1154 // Sets default still image. |
4498 __VTPRINTEXITR( "LocVid.LayoutCH.ProviderSwitchDone %d", handled ) |
4540 __VTPRINTEXITR( "LocVid.LayoutCH.ProviderSwitchDone %d", handled ) |
4499 return handled; |
4541 return handled; |
4500 } |
4542 } |
4501 |
4543 |
4502 // ----------------------------------------------------------------------------- |
4544 // ----------------------------------------------------------------------------- |
|
4545 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::NewL |
|
4546 // ----------------------------------------------------------------------------- |
|
4547 // |
|
4548 CVtEngLocalVideo::CVtEngVFBitmapNGARender * |
|
4549 CVtEngLocalVideo::CVtEngVFBitmapNGARender::NewL() |
|
4550 { |
|
4551 CVtEngVFBitmapNGARender* self |
|
4552 = new ( ELeave ) CVtEngVFBitmapNGARender(); |
|
4553 CleanupStack::PushL( self ); |
|
4554 self->ConstructL( ); |
|
4555 CleanupStack::Pop(); |
|
4556 return self; |
|
4557 } |
|
4558 |
|
4559 // ----------------------------------------------------------------------------- |
|
4560 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender |
|
4561 // ----------------------------------------------------------------------------- |
|
4562 // |
|
4563 CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender() |
|
4564 { |
|
4565 __VTPRINTENTER( "LocVid.NGARender.~" ) |
|
4566 Cancel(); |
|
4567 |
|
4568 if ( iSurfaceCreated ) |
|
4569 { |
|
4570 iWindow->RemoveBackgroundSurface(ETrue); |
|
4571 iWs->UnregisterSurface(0, iSurfaceId); |
|
4572 |
|
4573 iSurfaceManager.CloseSurface(iSurfaceId); |
|
4574 iSurfaceChunk->Close(); |
|
4575 delete iSurfaceChunk; |
|
4576 iSurfaceChunk = NULL; |
|
4577 |
|
4578 iSurfaceManager.Close(); |
|
4579 |
|
4580 iSurfaceUpdateSession.CancelAllUpdateNotifications(); |
|
4581 iSurfaceUpdateSession.Close(); |
|
4582 } |
|
4583 |
|
4584 __VTPRINTEXIT( "LocVid.NGARender.~" ) |
|
4585 } |
|
4586 |
|
4587 // ----------------------------------------------------------------------------- |
|
4588 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::UpdateBitmap |
|
4589 // ----------------------------------------------------------------------------- |
|
4590 // |
|
4591 TInt CVtEngLocalVideo::CVtEngVFBitmapNGARender::UpdateBitmapL( CFbsBitmap& aFrame ) |
|
4592 { |
|
4593 __VTPRINTENTER( "LocVid.NGARender.UpdateBitmapL" ) |
|
4594 // do nothing if we're already active, the newer bitmap will be ignored. |
|
4595 if ( IsActive() ) |
|
4596 { |
|
4597 __VTPRINTEXIT( "LocVid.NGARender.UpdateBitmapL 0" ) |
|
4598 return KErrNone; |
|
4599 } |
|
4600 else |
|
4601 { |
|
4602 if ( !iSurfaceCreated ) |
|
4603 { |
|
4604 User::Leave( KErrNotReady ); |
|
4605 } |
|
4606 aFrame.BeginDataAccess(); |
|
4607 __VTPRINT2( DEBUG_MEDIA, "LocVid.NGARender.bitmap size = %d", aFrame.DataSize() ); |
|
4608 #if 0 |
|
4609 memcpy( iBuffer, aFrame.DataAddress(), aFrame.DataSize() ); |
|
4610 #else |
|
4611 TInt size = aFrame.DataSize(); |
|
4612 TPtr8 ptrBuffer( iBuffer, size ); |
|
4613 ptrBuffer.Copy( reinterpret_cast<TUint8*>(aFrame.DataAddress()), size ); |
|
4614 #endif |
|
4615 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 1" ); |
|
4616 aFrame.EndDataAccess(); |
|
4617 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 2" ); |
|
4618 iStatus = KRequestPending; |
|
4619 SetActive(); |
|
4620 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 3" ); |
|
4621 iSurfaceUpdateSession.NotifyWhenDisplayed( iStatus, iTimeStamp ); |
|
4622 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 4" ); |
|
4623 iSurfaceUpdateSession.SubmitUpdate( KAllScreens, iSurfaceId, 0, NULL ); |
|
4624 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 5" ); |
|
4625 |
|
4626 __VTPRINTEXIT( "LocVid.NGARender.UpdateBitmapL 1" ) |
|
4627 |
|
4628 return KErrNone; |
|
4629 } |
|
4630 } |
|
4631 |
|
4632 // ----------------------------------------------------------------------------- |
|
4633 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::CreateSurfaceL |
|
4634 // ----------------------------------------------------------------------------- |
|
4635 // |
|
4636 TInt CVtEngLocalVideo::CVtEngVFBitmapNGARender::AttachSurfaceL( |
|
4637 RWsSession *aWs, |
|
4638 RWindow *aWindow ) |
|
4639 { |
|
4640 __VTPRINTENTER( "LocVid.NGARender.AttachSurfaceL" ) |
|
4641 |
|
4642 if ( aWs == NULL || aWindow == NULL ) |
|
4643 { |
|
4644 User::Leave( KErrArgument ); |
|
4645 } |
|
4646 |
|
4647 if(iSurfaceCreated) |
|
4648 return KErrNone; |
|
4649 |
|
4650 if ( !iSurfaceCreated ) |
|
4651 { |
|
4652 TInt err; |
|
4653 |
|
4654 err = iSurfaceUpdateSession.Connect(); |
|
4655 User::LeaveIfError(err); |
|
4656 |
|
4657 err = iSurfaceManager.Open(); |
|
4658 User::LeaveIfError(err); |
|
4659 |
|
4660 RSurfaceManager::TSurfaceCreationAttributesBuf attributes; |
|
4661 attributes().iPixelFormat = iSurfaceFormat; |
|
4662 attributes().iSize.SetSize( KVtEngLocalVideoDefaultWidth, |
|
4663 KVtEngLocalVideoDefaultHeight ); |
|
4664 attributes().iBuffers = EVtEngVFMaxBuffers; |
|
4665 attributes().iStride = attributes().iSize.iWidth*4; |
|
4666 attributes().iOffsetToFirstBuffer = 0; |
|
4667 attributes().iAlignment = 4; |
|
4668 attributes().iContiguous = EFalse; |
|
4669 attributes().iMappable = ETrue; |
|
4670 |
|
4671 err = iSurfaceManager.CreateSurface( attributes, iSurfaceId ); |
|
4672 User::LeaveIfError( err ); |
|
4673 |
|
4674 // Map to chunk |
|
4675 iSurfaceChunk = new RChunk(); |
|
4676 User::LeaveIfNull( iSurfaceChunk ); |
|
4677 err = iSurfaceManager.MapSurface( iSurfaceId, *iSurfaceChunk ); |
|
4678 User::LeaveIfError( err ); |
|
4679 |
|
4680 // Get the info from the surfaceManager |
|
4681 RSurfaceManager::TInfoBuf info; |
|
4682 err = iSurfaceManager.SurfaceInfo( iSurfaceId, info ); |
|
4683 User::LeaveIfError( err ); |
|
4684 |
|
4685 TInt offset; |
|
4686 iSurfaceManager.GetBufferOffset( iSurfaceId, 0, offset ); |
|
4687 iBuffer = iSurfaceChunk->Base() + offset; |
|
4688 |
|
4689 iSurfaceCreated = ETrue; |
|
4690 } |
|
4691 else |
|
4692 { |
|
4693 if ( iWs == NULL || iWindow == NULL ) |
|
4694 { |
|
4695 User::Leave( KErrGeneral ); |
|
4696 } |
|
4697 |
|
4698 iWindow->RemoveBackgroundSurface(ETrue); |
|
4699 iWs->UnregisterSurface(0, iSurfaceId); |
|
4700 |
|
4701 __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.Surface exists, detach first!" ) |
|
4702 } |
|
4703 |
|
4704 iWs = aWs; |
|
4705 iWindow = aWindow; |
|
4706 iWs->RegisterSurface( 0, iSurfaceId ); |
|
4707 |
|
4708 TSurfaceConfiguration surfaceConfig; |
|
4709 surfaceConfig.SetSurfaceId( iSurfaceId ); |
|
4710 surfaceConfig.SetOrientation( CFbsBitGc::EGraphicsOrientationRotated270); |
|
4711 iWindow->SetBackgroundSurface( surfaceConfig, ETrue ); |
|
4712 //iWindow->SetBackgroundSurface( iSurfaceId ); |
|
4713 |
|
4714 __VTPRINTEXIT( "LocVid.NGARender.AttachSurfaceL" ) |
|
4715 |
|
4716 return KErrNone; |
|
4717 } |
|
4718 |
|
4719 // ----------------------------------------------------------------------------- |
|
4720 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender |
|
4721 // ----------------------------------------------------------------------------- |
|
4722 // |
|
4723 CVtEngLocalVideo::CVtEngVFBitmapNGARender::CVtEngVFBitmapNGARender() |
|
4724 : CActive( CActive::EPriorityStandard ), |
|
4725 iSurfaceFormat( EUidPixelFormatXRGB_8888 ) |
|
4726 { |
|
4727 iSurfaceCreated = EFalse; |
|
4728 |
|
4729 CActiveScheduler::Add( this ); |
|
4730 } |
|
4731 |
|
4732 // ----------------------------------------------------------------------------- |
|
4733 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::ConstructL |
|
4734 // ----------------------------------------------------------------------------- |
|
4735 // |
|
4736 void CVtEngLocalVideo::CVtEngVFBitmapNGARender::ConstructL( ) |
|
4737 { |
|
4738 __VTPRINTENTER( "LocVid.NGARender.ConstructL" ) |
|
4739 __VTPRINTEXIT( "LocVid.NGARender.ConstructL" ) |
|
4740 } |
|
4741 |
|
4742 // ----------------------------------------------------------------------------- |
|
4743 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::RunL |
|
4744 // ----------------------------------------------------------------------------- |
|
4745 // |
|
4746 void CVtEngLocalVideo::CVtEngVFBitmapNGARender::RunL() |
|
4747 { |
|
4748 __VTPRINTENTER( "LocVid.NGARender.RunL" ) |
|
4749 __VTPRINTEXIT( "LocVid.NGARender.RunL" ) |
|
4750 } |
|
4751 |
|
4752 // ----------------------------------------------------------------------------- |
|
4753 // CVtEngLocalVideo::CVtEngVFBitmapNGARender::DoCancel |
|
4754 // ----------------------------------------------------------------------------- |
|
4755 // |
|
4756 void CVtEngLocalVideo::CVtEngVFBitmapNGARender::DoCancel() |
|
4757 { |
|
4758 __VTPRINTENTER( "LocVid.NGARender.DoCancel" ) |
|
4759 __VTPRINTEXIT( "LocVid.NGARender.DoCancel" ) |
|
4760 } |
|
4761 |
|
4762 // ----------------------------------------------------------------------------- |
4503 // CVtEngLocalVideo::CreateCameraPreferencesL |
4763 // CVtEngLocalVideo::CreateCameraPreferencesL |
4504 // ----------------------------------------------------------------------------- |
4764 // ----------------------------------------------------------------------------- |
4505 // |
4765 // |
4506 CVtEngCameraPreferences* CVtEngLocalVideo::CreateCameraPreferencesL() |
4766 CVtEngCameraPreferences* CVtEngLocalVideo::CreateCameraPreferencesL() |
4507 { |
4767 { |