# HG changeset patch # User Shimizu Satoshi # Date 1287456539 -32400 # Node ID 92a82bc706f75e11a806b528c157268310fd41f4 # Parent 9ae0fe04e757ab85f6ea2d227aa40084850a4393 Obtain an image of Webcamera from QEMU and add the Bitmap change display function. diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/group/BLD.INF --- a/mmplugins/cameraplugins/group/BLD.INF Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/group/BLD.INF Tue Oct 19 11:48:59 2010 +0900 @@ -1,40 +1,36 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// On board camera API -// -// - -/** - @file -*/ - -#ifdef SYMBIAN_MULTIMEDIA_THREEPLANEARCH -//Include the mmcameraclientplugin -#include "../source/mmcameraclientplugin/group/bld.inf" -#endif //SYMBIAN_MULTIMEDIA_THREEPLANEARCH - -PRJ_EXPORTS -// ROM buildsupport -../inc/ecam_stubplugin.iby /epoc32/rom/include/ecam_stubplugin.iby -../inc/ecam_webcameraplugin.iby /epoc32/rom/include/ecam_webcameraplugin.iby - -PRJ_MMPFILES -../mmpfiles/ECamStubPlugin.mmp -../mmpfiles/ecamwebcameraplugin.mmp - -PRJ_TESTMMPFILES -../mmpfiles/TestCamera.mmp - -PRJ_TESTEXPORTS -../inc/ecam_test.iby /epoc32/rom/include/ecam_test.iby +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// On board camera API +// +// + + + +/** + @file +*/ +PRJ_EXPORTS +// ROM buildsupport +../inc/ecam_stubplugin.iby /epoc32/rom/include/ecam_stubplugin.iby +../inc/ecam_webcameraplugin.iby /epoc32/rom/include/ecam_webcameraplugin.iby + +PRJ_MMPFILES +../mmpfiles/ECamStubPlugin.mmp +../mmpfiles/ecamwebcameraplugin.mmp + +PRJ_TESTMMPFILES +../mmpfiles/TestCamera.mmp + +PRJ_TESTEXPORTS +../inc/ecam_test.iby /epoc32/rom/include/ecam_test.iby diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/group/multimedia_ecam_plugins.mrp --- a/mmplugins/cameraplugins/group/multimedia_ecam_plugins.mrp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/group/multimedia_ecam_plugins.mrp Tue Oct 19 11:48:59 2010 +0900 @@ -1,30 +1,18 @@ -#multimedia_ecam_plugins.mrp -# -# Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -component multimedia_ecam_plugins - -source \sf\os\mm\mmplugins\cameraplugins - -binary \sf\os\mm\mmplugins\cameraplugins\group all - -exports \sf\os\mm\mmplugins\cameraplugins\group - -notes_source \component_defs\release.src - -ipr E -ipr T \sf\os\mm\mmplugins\cameraplugins\source\testcamera - +#multimedia_ecam_plugins.mrp +# +#Copyright (c) Symbian Software Ltd 2008. All rights reserved. +# + +component multimedia_ecam_plugins + +source \sf\os\mm\mmplugins\cameraplugins + +binary \sf\os\mm\mmplugins\cameraplugins\group all + +exports \sf\os\mm\mmplugins\cameraplugins\group + +notes_source \component_defs\release.src + +ipr E +ipr T \sf\os\mm\mmplugins\cameraplugins\source\testcamera + diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/inc/ecam_stubplugin.iby --- a/mmplugins/cameraplugins/inc/ecam_stubplugin.iby Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/inc/ecam_stubplugin.iby Tue Oct 19 11:48:59 2010 +0900 @@ -1,24 +1,23 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef ECAM_STUBPLUGIN_IBY -#define ECAM_STUBPLUGIN_IBY - -#ifndef SYMBIAN_EXCLUDE_ECAM_STUBPLUGIN -ECOM_PLUGIN(ECamStubPlugin.dll,10207081.rsc) -#endif - -#endif //ECAM_STUBPLUGIN_IBY - +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef ECAM_STUBPLUGIN_IBY +#define ECAM_STUBPLUGIN_IBY + +#ifndef SYMBIAN_EXCLUDE_ECAM_STUBPLUGIN +ECOM_PLUGIN(ECamStubPlugin.dll,10207081.rsc) +#endif + +#endif //ECAM_STUBPLUGIN_IBY diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/inc/ecam_test.iby --- a/mmplugins/cameraplugins/inc/ecam_test.iby Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/inc/ecam_test.iby Tue Oct 19 11:48:59 2010 +0900 @@ -1,22 +1,21 @@ -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef ECAM_TEST_IBY -#define ECAM_TEST_IBY - -ECOM_PLUGIN(ECamTestPlugin.dll,102070CC.rss) - -#endif // ECAM_TEST_IBY - +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef ECAM_TEST_IBY +#define ECAM_TEST_IBY + +ECOM_PLUGIN(ECamTestPlugin.dll,102070CC.rss) + +#endif // ECAM_TEST_IBY diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/inc/ecam_webcameraplugin.iby --- a/mmplugins/cameraplugins/inc/ecam_webcameraplugin.iby Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/inc/ecam_webcameraplugin.iby Tue Oct 19 11:48:59 2010 +0900 @@ -1,23 +1,23 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAM_WEBCAMERA_IBY -#define ECAM_WEBCAMERA_IBY - -ECOM_PLUGIN(ecamwebcameraplugin.dll,01000001.rss) - -#endif // ECAM_TEST_IBY +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAM_WEBCAMERA_IBY +#define ECAM_WEBCAMERA_IBY + +ECOM_PLUGIN(ecamwebcameraplugin.dll,01000001.rss) + +#endif // ECAM_TEST_IBY diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/mmpfiles/ECamStubPlugin.mmp --- a/mmplugins/cameraplugins/mmpfiles/ECamStubPlugin.mmp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/mmpfiles/ECamStubPlugin.mmp Tue Oct 19 11:48:59 2010 +0900 @@ -1,47 +1,45 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// ECamStubPlugin.dll Camera stub plugin implementation -// -// - -/** - @file -*/ - - - -#include "../../../imagingandcamerafws/camerafw/Include/ECamUids.hrh" - -TARGET ecamstubplugin.dll -TARGETTYPE PLUGIN -CAPABILITY ALL -TCB - -// MAGIC Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D KUidOnboardCameraStubDll -VENDORID 0x70000001 - -SOURCEPATH ../source/stub -SOURCE ECamStubPlugin.cpp - -USERINCLUDE ../source/stub -OS_LAYER_SYSTEMINCLUDE_SYMBIAN - -START RESOURCE 10207081.rss -TARGET ecamstubplugin.rsc -END - -LIBRARY euser.lib -LIBRARY ecampluginsupport.lib - -SMPSAFE +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ECamStubPlugin.dll Camera stub plugin implementation +// +// + + + +/** + @file +*/ + +#include "../../../imagingandcamerafws/camerafw/Include/ECamUids.hrh" + +TARGET ecamstubplugin.dll +TARGETTYPE PLUGIN +CAPABILITY ALL -TCB + +// MAGIC Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidOnboardCameraStubDll +VENDORID 0x70000001 + +SOURCEPATH ../source/stub +SOURCE ECamStubPlugin.cpp + +USERINCLUDE ../source/stub +SYSTEMINCLUDE /epoc32/include + +START RESOURCE 10207081.rss +TARGET ecamstubplugin.rsc +END + +LIBRARY euser.lib +LIBRARY ecampluginsupport.lib diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/mmpfiles/TestCamera.mmp --- a/mmplugins/cameraplugins/mmpfiles/TestCamera.mmp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/mmpfiles/TestCamera.mmp Tue Oct 19 11:48:59 2010 +0900 @@ -1,62 +1,54 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// ECamTestPlugin.dll Test plugin implementation -// -// - -/** - @file -*/ - -#include "../../../imagingandcamerafws/camerafw/Include/ECamUids.hrh" -#include "../source/testcamera/TestCameraUids.hrh" - -TARGET ecamtestplugin.dll -TARGETTYPE PLUGIN -CAPABILITY ALL -TCB - -// MAGIC Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D KUidOnboardCameraTestDll -VENDORID 0x70000001 - -SOURCEPATH ../source/testcamera -SOURCE TestCamera.cpp -SOURCE test_advanced_settings.cpp -SOURCE test_snapshot.cpp -SOURCE test_image_processing.cpp - -USERINCLUDE ../source/testcamera -USERINCLUDE ../../../imagingandcamerafws/camerafw/Include -OS_LAYER_SYSTEMINCLUDE_SYMBIAN - -START RESOURCE 102070CC.RSS -TARGET ecamtestplugin.rsc -END - -LIBRARY euser.lib -LIBRARY ecampluginsupport.lib -LIBRARY ecam.lib -LIBRARY fbscli.lib -LIBRARY bitgdi.lib -LIBRARY ws32.lib -LIBRARY efsrv.lib - - - - - - - - -SMPSAFE +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ECamTestPlugin.dll Test plugin implementation +// +// + + + +/** + @file +*/ + +#include "../../../imagingandcamerafws/camerafw/Include/ECamUids.hrh" +#include "../source/testcamera/TestCameraUids.hrh" + +TARGET ecamtestplugin.dll +TARGETTYPE PLUGIN +CAPABILITY ALL -TCB + +// MAGIC Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidOnboardCameraTestDll +VENDORID 0x70000001 + +SOURCEPATH ../source/testcamera +SOURCE TestCamera.cpp +SOURCE test_advanced_settings.cpp +SOURCE test_snapshot.cpp +SOURCE test_image_processing.cpp + +USERINCLUDE ../source/testcamera +SYSTEMINCLUDE /epoc32/include + +START RESOURCE 102070CC.RSS +TARGET ecamtestplugin.rsc +END + +LIBRARY euser.lib +LIBRARY ecampluginsupport.lib +LIBRARY ecam.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY ws32.lib +LIBRARY efsrv.lib diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/mmpfiles/ecamwebcameraplugin.mmp --- a/mmplugins/cameraplugins/mmpfiles/ecamwebcameraplugin.mmp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/mmpfiles/ecamwebcameraplugin.mmp Tue Oct 19 11:48:59 2010 +0900 @@ -1,56 +1,55 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - - - -/** - @file -*/ - -#include "../source/webcamera/ecamwebcamerapluginuids.hrh" - -TARGET ecamwebcameraplugin.dll -TARGETTYPE PLUGIN -CAPABILITY ALL -TCB - -// MAGIC Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D KUidOnboardWebCameraDll -VENDORID 0x70000001 - -SOURCEPATH ../source/webcamera -SOURCE ecamwebcameraplugin.cpp -SOURCE ecamwebcameraadvset.cpp -SOURCE ecamwebcameraactive.cpp -SOURCE ecamwebcameravfactive.cpp -SOURCE ecamwebcamerabuffer.cpp - -USERINCLUDE ../source/webcamera -SYSTEMINCLUDE /epoc32/include -SYSTEMINCLUDE /epoc32/include/platform -SYSTEMINCLUDE /epoc32/include/syborg - -START RESOURCE 01000001.rss -TARGET ecamwebcameraplugin.rsc -END - -LIBRARY euser.lib -LIBRARY ecampluginsupport.lib -LIBRARY ecam.lib -LIBRARY fbscli.lib -LIBRARY efsrv.lib -LIBRARY ws32.lib -LIBRARY bitgdi.lib +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + + + +/** + @file +*/ + +#include "../source/webcamera/ecamwebcamerapluginuids.hrh" + +TARGET ecamwebcameraplugin.dll +TARGETTYPE PLUGIN +CAPABILITY ALL -TCB + +// MAGIC Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidOnboardWebCameraDll +VENDORID 0x70000001 + +SOURCEPATH ../source/webcamera +SOURCE ecamwebcameraplugin.cpp +SOURCE ecamwebcameraadvset.cpp +SOURCE ecamwebcameraactive.cpp +SOURCE ecamwebcameravfactive.cpp +SOURCE ecamwebcamerabuffer.cpp + +USERINCLUDE ../source/webcamera +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/syborg + +START RESOURCE 01000001.rss +TARGET ecamwebcameraplugin.rsc +END + +LIBRARY euser.lib +LIBRARY ecampluginsupport.lib +LIBRARY ecam.lib +LIBRARY fbscli.lib +LIBRARY efsrv.lib +LIBRARY ws32.lib +LIBRARY bitgdi.lib diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/stub/10207081.rss --- a/mmplugins/cameraplugins/source/stub/10207081.rss Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/stub/10207081.rss Tue Oct 19 11:48:59 2010 +0900 @@ -1,56 +1,55 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include "ecom/registryinfo.rh" -#include "ecamuids.hrh" - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = KUidOnboardCameraStubDll; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardCameraStubPlugin; - version_no = 1; - display_name = "Stub ECam Plugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - }, - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraInfoPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardCameraStubInfo; - version_no = 1; - display_name = "Stub ECam InfoPlugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - } - }; - } - +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "ecom/registryinfo.rh" +#include "ecamuids.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidOnboardCameraStubDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardCameraStubPlugin; + version_no = 1; + display_name = "Stub ECam Plugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraInfoPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardCameraStubInfo; + version_no = 1; + display_name = "Stub ECam InfoPlugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + } + }; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/stub/ECamStubPlugin.cpp --- a/mmplugins/cameraplugins/source/stub/ECamStubPlugin.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/stub/ECamStubPlugin.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,395 +1,394 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include "ECamStubPlugin.h" - -#include -#include -#include - -// -// Main stuff -// - -static void Panic(TInt aReason) - { - _LIT(KDllName, "ECam Stub Plugin"); - User::Panic(KDllName, aReason); - } - -// -// CCameraStub -// - -CCameraStub::CCameraStub() - { - } - -CCameraStub::~CCameraStub() - { - } - -CCameraStub* CCameraStub::NewL() - { - return new (ELeave) CCameraStub; - } - -// -// 2nd stage ConstructL calls called by framework -// - -void CCameraStub::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) - { - iObserver = &aObserver; - iCameraIndex = aCameraIndex; - User::Leave(KErrNotSupported); - } - -void CCameraStub::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) - { - iObserver = &aObserver; - iCameraHandle = aCameraHandle; - User::Leave(KErrNotSupported); - } - - -void CCameraStub::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) - { - iObserver2 = &aObserver; - iCameraIndex = aCameraIndex; - iPriority = aPriority; - User::Leave(KErrNotSupported); - } - -void CCameraStub::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) - { - iObserver2 = &aObserver; - iCameraHandle = aCameraHandle; - User::Leave(KErrNotSupported); - } - - - -// -// Dummy versions of virtual functions -// - -void CCameraStub::CameraInfo(TCameraInfo& /*aInfo*/) const - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::Reserve() - { - Panic(EPanicUnimplemented); - } - - -void CCameraStub::Release() - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::PowerOn() - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::PowerOff() - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::Handle() - { - Panic(EPanicUnimplemented); - return 0; - } - -void CCameraStub::SetZoomFactorL(TInt /*aZoomFactor = 0*/) - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::ZoomFactor() const - { - Panic(EPanicUnimplemented); - return 0; - } - -void CCameraStub::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/) - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::DigitalZoomFactor() const - { - Panic(EPanicUnimplemented); - return 0; - } - -void CCameraStub::SetContrastL(TInt /*aContrast*/) - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::Contrast() const - { - Panic(EPanicUnimplemented); - return 0; - } - -void CCameraStub::SetBrightnessL(TInt /*aBrightness*/) - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::Brightness() const - { - Panic(EPanicUnimplemented); - return 0; - } - - -void CCameraStub::SetFlashL(TFlash /*aFlash = EFlashNone*/) - { - Panic(EPanicUnimplemented); - } - -CCamera::TFlash CCameraStub::Flash() const - { - Panic(EPanicUnimplemented); - return EFlashNone; - } - -void CCameraStub::SetExposureL(TExposure /*aExposure = EExposureAuto*/) - { - Panic(EPanicUnimplemented); - } - -CCamera::TExposure CCameraStub::Exposure() const - { - Panic(EPanicUnimplemented); - return EExposureAuto; - } - -void CCameraStub::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/) - { - Panic(EPanicUnimplemented); - } - - -CCamera::TWhiteBalance CCameraStub::WhiteBalance() const - { - Panic(EPanicUnimplemented); - return EWBAuto; - } - -void CCameraStub::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StartViewFinderBitmapsL(TSize& /*aSize*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/) - { - Panic(EPanicUnimplemented); - } - - -void CCameraStub::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/) - { - Panic(EPanicUnimplemented); - } - - -void CCameraStub::StopViewFinder() - { - Panic(EPanicUnimplemented); - } - -TBool CCameraStub::ViewFinderActive() const - { - Panic(EPanicUnimplemented); - return EFalse; - } - -void CCameraStub::SetViewFinderMirrorL(TBool /*aMirror*/) - { - Panic(EPanicUnimplemented); - } - -TBool CCameraStub::ViewFinderMirror() const - { - Panic(EPanicUnimplemented); - return EFalse; - } - -void CCameraStub::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) - { - Panic(EPanicUnimplemented); - } - - -void CCameraStub::CaptureImage() - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::CancelCaptureImage() - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StartVideoCapture() - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::StopVideoCapture() - { - Panic(EPanicUnimplemented); - } - -TBool CCameraStub::VideoCaptureActive() const - { - Panic(EPanicUnimplemented); - return EFalse; - } - -void CCameraStub::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const - { - Panic(EPanicUnimplemented); - } - -void CCameraStub::GetFrameSize(TSize& /*aSize*/) const - { - Panic(EPanicUnimplemented); - } - -TReal32 CCameraStub::FrameRate() const - { - Panic(EPanicUnimplemented); - return 0.0; - } - -TInt CCameraStub::BuffersInUse() const - { - Panic(EPanicUnimplemented); - return 0; - } - -TInt CCameraStub::FramesPerBuffer() const - { - Panic(EPanicUnimplemented); - return 0; - } - -void CCameraStub::SetJpegQuality(TInt /*aQuality*/) - { - Panic(EPanicUnimplemented); - } - -TInt CCameraStub::JpegQuality() const - { - Panic(EPanicUnimplemented); - return 0; - } - -TAny* CCameraStub::CustomInterface(TUid /*aInterface*/) - { - Panic(EPanicUnimplemented); - return NULL; - } - - -// -// CCameraStubInfo -// - -CCameraStubInfo::CCameraStubInfo() - { - } - -CCameraStubInfo::~CCameraStubInfo() - { - } - -CCameraStubInfo* CCameraStubInfo::NewL() - { - return new (ELeave) CCameraStubInfo; - } - -TInt CCameraStubInfo::CamerasAvailable() - { - return 0; - } - - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraStubPlugin, CCameraStub::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraStubInfo, CCameraStubInfo::NewL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "ECamStubPlugin.h" + +#include +#include +#include + +// +// Main stuff +// + +static void Panic(TInt aReason) + { + _LIT(KDllName, "ECam Stub Plugin"); + User::Panic(KDllName, aReason); + } + +// +// CCameraStub +// + +CCameraStub::CCameraStub() + { + } + +CCameraStub::~CCameraStub() + { + } + +CCameraStub* CCameraStub::NewL() + { + return new (ELeave) CCameraStub; + } + +// +// 2nd stage ConstructL calls called by framework +// + +void CCameraStub::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) + { + iObserver = &aObserver; + iCameraIndex = aCameraIndex; + User::Leave(KErrNotSupported); + } + +void CCameraStub::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) + { + iObserver = &aObserver; + iCameraHandle = aCameraHandle; + User::Leave(KErrNotSupported); + } + + +void CCameraStub::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) + { + iObserver2 = &aObserver; + iCameraIndex = aCameraIndex; + iPriority = aPriority; + User::Leave(KErrNotSupported); + } + +void CCameraStub::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) + { + iObserver2 = &aObserver; + iCameraHandle = aCameraHandle; + User::Leave(KErrNotSupported); + } + + + +// +// Dummy versions of virtual functions +// + +void CCameraStub::CameraInfo(TCameraInfo& /*aInfo*/) const + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::Reserve() + { + Panic(EPanicUnimplemented); + } + + +void CCameraStub::Release() + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::PowerOn() + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::PowerOff() + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::Handle() + { + Panic(EPanicUnimplemented); + return 0; + } + +void CCameraStub::SetZoomFactorL(TInt /*aZoomFactor = 0*/) + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::ZoomFactor() const + { + Panic(EPanicUnimplemented); + return 0; + } + +void CCameraStub::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/) + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::DigitalZoomFactor() const + { + Panic(EPanicUnimplemented); + return 0; + } + +void CCameraStub::SetContrastL(TInt /*aContrast*/) + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::Contrast() const + { + Panic(EPanicUnimplemented); + return 0; + } + +void CCameraStub::SetBrightnessL(TInt /*aBrightness*/) + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::Brightness() const + { + Panic(EPanicUnimplemented); + return 0; + } + + +void CCameraStub::SetFlashL(TFlash /*aFlash = EFlashNone*/) + { + Panic(EPanicUnimplemented); + } + +CCamera::TFlash CCameraStub::Flash() const + { + Panic(EPanicUnimplemented); + return EFlashNone; + } + +void CCameraStub::SetExposureL(TExposure /*aExposure = EExposureAuto*/) + { + Panic(EPanicUnimplemented); + } + +CCamera::TExposure CCameraStub::Exposure() const + { + Panic(EPanicUnimplemented); + return EExposureAuto; + } + +void CCameraStub::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/) + { + Panic(EPanicUnimplemented); + } + + +CCamera::TWhiteBalance CCameraStub::WhiteBalance() const + { + Panic(EPanicUnimplemented); + return EWBAuto; + } + +void CCameraStub::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StartViewFinderBitmapsL(TSize& /*aSize*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/) + { + Panic(EPanicUnimplemented); + } + + +void CCameraStub::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/) + { + Panic(EPanicUnimplemented); + } + + +void CCameraStub::StopViewFinder() + { + Panic(EPanicUnimplemented); + } + +TBool CCameraStub::ViewFinderActive() const + { + Panic(EPanicUnimplemented); + return EFalse; + } + +void CCameraStub::SetViewFinderMirrorL(TBool /*aMirror*/) + { + Panic(EPanicUnimplemented); + } + +TBool CCameraStub::ViewFinderMirror() const + { + Panic(EPanicUnimplemented); + return EFalse; + } + +void CCameraStub::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) + { + Panic(EPanicUnimplemented); + } + + +void CCameraStub::CaptureImage() + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::CancelCaptureImage() + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StartVideoCapture() + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::StopVideoCapture() + { + Panic(EPanicUnimplemented); + } + +TBool CCameraStub::VideoCaptureActive() const + { + Panic(EPanicUnimplemented); + return EFalse; + } + +void CCameraStub::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const + { + Panic(EPanicUnimplemented); + } + +void CCameraStub::GetFrameSize(TSize& /*aSize*/) const + { + Panic(EPanicUnimplemented); + } + +TReal32 CCameraStub::FrameRate() const + { + Panic(EPanicUnimplemented); + return 0.0; + } + +TInt CCameraStub::BuffersInUse() const + { + Panic(EPanicUnimplemented); + return 0; + } + +TInt CCameraStub::FramesPerBuffer() const + { + Panic(EPanicUnimplemented); + return 0; + } + +void CCameraStub::SetJpegQuality(TInt /*aQuality*/) + { + Panic(EPanicUnimplemented); + } + +TInt CCameraStub::JpegQuality() const + { + Panic(EPanicUnimplemented); + return 0; + } + +TAny* CCameraStub::CustomInterface(TUid /*aInterface*/) + { + Panic(EPanicUnimplemented); + return NULL; + } + + +// +// CCameraStubInfo +// + +CCameraStubInfo::CCameraStubInfo() + { + } + +CCameraStubInfo::~CCameraStubInfo() + { + } + +CCameraStubInfo* CCameraStubInfo::NewL() + { + return new (ELeave) CCameraStubInfo; + } + +TInt CCameraStubInfo::CamerasAvailable() + { + return 0; + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraStubPlugin, CCameraStub::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraStubInfo, CCameraStubInfo::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/stub/ECamStubPlugin.h --- a/mmplugins/cameraplugins/source/stub/ECamStubPlugin.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/stub/ECamStubPlugin.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,117 +1,117 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef ECAMSTUBPLUGIN_H -#define ECAMSTUBPLUGIN_H - -#include -#include - -// Implementations of the ECam plugin classes - -class CCameraStub : public CCameraPlugin - { -public: - static CCameraStub* NewL(); - ~CCameraStub(); - -protected: - // from CCameraPlugin - void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); - void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); - - void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); - void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); - - // from CCamera itself - void CameraInfo(TCameraInfo& aInfo) const; - void Reserve(); - void Release(); - void PowerOn(); - void PowerOff(); - TInt Handle(); - void SetZoomFactorL(TInt aZoomFactor = 0); - TInt ZoomFactor() const; - void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); - TInt DigitalZoomFactor() const; - void SetContrastL(TInt aContrast); - TInt Contrast() const; - void SetBrightnessL(TInt aBrightness); - TInt Brightness() const; - void SetFlashL(TFlash aFlash = EFlashNone); - TFlash Flash() const; - void SetExposureL(TExposure aExposure = EExposureAuto); - TExposure Exposure() const; - void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); - TWhiteBalance WhiteBalance() const; - void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); - void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); - void StartViewFinderBitmapsL(TSize& aSize); - void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); - void StartViewFinderL(TFormat aImageFormat,TSize& aSize); - void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); - void StopViewFinder(); - TBool ViewFinderActive() const; - void SetViewFinderMirrorL(TBool aMirror); - TBool ViewFinderMirror() const; - void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); - void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); - void CaptureImage(); - void CancelCaptureImage(); - void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); - void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); - void StartVideoCapture(); - void StopVideoCapture(); - TBool VideoCaptureActive() const; - void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; - void GetFrameSize(TSize& aSize) const; - TReal32 FrameRate() const; - TInt BuffersInUse() const; - TInt FramesPerBuffer() const; - void SetJpegQuality(TInt aQuality); - TInt JpegQuality() const; - TAny* CustomInterface(TUid aInterface); - -private: - CCameraStub(); -private: - MCameraObserver* iObserver; // not owned - MCameraObserver2* iObserver2; // not owned - TInt iCameraIndex; - TInt iCameraHandle; - TInt iPriority; - }; - -class CCameraStubInfo : public CCameraInfoPlugin - { -public: - static CCameraStubInfo* NewL(); - - ~CCameraStubInfo(); - - // from CCameraInfoPlugin - TInt CamerasAvailable(); -private: - CCameraStubInfo(); - }; - -enum TStubPanicReasons - { - EPanicUnimplemented=1 - }; - -#endif // ECAMSTUBPLUGIN_H +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef ECAMSTUBPLUGIN_H +#define ECAMSTUBPLUGIN_H + +#include +#include + +// Implementations of the ECam plugin classes + +class CCameraStub : public CCameraPlugin + { +public: + static CCameraStub* NewL(); + ~CCameraStub(); + +protected: + // from CCameraPlugin + void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); + void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); + + void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); + void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); + + // from CCamera itself + void CameraInfo(TCameraInfo& aInfo) const; + void Reserve(); + void Release(); + void PowerOn(); + void PowerOff(); + TInt Handle(); + void SetZoomFactorL(TInt aZoomFactor = 0); + TInt ZoomFactor() const; + void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); + TInt DigitalZoomFactor() const; + void SetContrastL(TInt aContrast); + TInt Contrast() const; + void SetBrightnessL(TInt aBrightness); + TInt Brightness() const; + void SetFlashL(TFlash aFlash = EFlashNone); + TFlash Flash() const; + void SetExposureL(TExposure aExposure = EExposureAuto); + TExposure Exposure() const; + void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); + TWhiteBalance WhiteBalance() const; + void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); + void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); + void StartViewFinderBitmapsL(TSize& aSize); + void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); + void StartViewFinderL(TFormat aImageFormat,TSize& aSize); + void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); + void StopViewFinder(); + TBool ViewFinderActive() const; + void SetViewFinderMirrorL(TBool aMirror); + TBool ViewFinderMirror() const; + void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); + void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); + void CaptureImage(); + void CancelCaptureImage(); + void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); + void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); + void StartVideoCapture(); + void StopVideoCapture(); + TBool VideoCaptureActive() const; + void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; + void GetFrameSize(TSize& aSize) const; + TReal32 FrameRate() const; + TInt BuffersInUse() const; + TInt FramesPerBuffer() const; + void SetJpegQuality(TInt aQuality); + TInt JpegQuality() const; + TAny* CustomInterface(TUid aInterface); + +private: + CCameraStub(); +private: + MCameraObserver* iObserver; // not owned + MCameraObserver2* iObserver2; // not owned + TInt iCameraIndex; + TInt iCameraHandle; + TInt iPriority; + }; + +class CCameraStubInfo : public CCameraInfoPlugin + { +public: + static CCameraStubInfo* NewL(); + + ~CCameraStubInfo(); + + // from CCameraInfoPlugin + TInt CamerasAvailable(); +private: + CCameraStubInfo(); + }; + +enum TStubPanicReasons + { + EPanicUnimplemented=1 + }; + +#endif // ECAMSTUBPLUGIN_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/102070CC.RSS --- a/mmplugins/cameraplugins/source/testcamera/102070CC.RSS Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/102070CC.RSS Tue Oct 19 11:48:59 2010 +0900 @@ -1,57 +1,56 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include -#include -#include "TestCameraUids.hrh" - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = KUidOnboardCameraTestDll; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardCameraTestPlugin; - version_no = 3; - display_name ="ECam Test Plugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - }, - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraInfoPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardCameraTestInfo; - version_no = 3; - display_name = "ECam Test InfoPlugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - } - }; - } - +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "TestCameraUids.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidOnboardCameraTestDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardCameraTestPlugin; + version_no = 3; + display_name ="ECam Test Plugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraInfoPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardCameraTestInfo; + version_no = 3; + display_name = "ECam Test InfoPlugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + } + }; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/TestCamera.cpp --- a/mmplugins/cameraplugins/source/testcamera/TestCamera.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/TestCamera.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,1564 +1,1555 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include -#include -#include -#include -#include "TestCamera.h" -#include "test_advanced_settings.h" -#include "test_snapshot.h" -#include "test_image_processing.h" -#include "TestCameraUids.hrh" -#include - -// -// Main stuff -// -// -// 2nd stage ConstructL calls called by framework -// -CTestCamera* CTestCamera::NewL() - { - FileDependencyUtil::CheckFileDependencyL(); - CTestCamera* self = new(ELeave) CTestCamera; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -void CTestCamera::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) - { - iObserver = &aObserver; - iCameraIndex = aCameraIndex; - } - -void CTestCamera::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) - { - iObserver = &aObserver; - iCameraHandle = aCameraHandle; - } - -void CTestCamera::ConstructL() - { - - TInt err; - TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor16MA)); - if (err == KErrNotSupported) - { - TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor16M)); - } - if (err == KErrNotSupported) - { - TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor64K)); - } - if (err == KErrNotSupported) - { - TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor4K)); - } - if (err == KErrNotSupported) - { - TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor256)); - } - if (err == KErrNotSupported) - { - iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor16MAP); - } - else - { - User::LeaveIfError(err); - } - - User::LeaveIfError(iScreenDev->CreateContext(iScreenGc)); - User::LeaveIfError(iImageSizes.Append( TSize(640, 480) )); // VGA - User::LeaveIfError(iImageSizes.Append( TSize(160, 120) )); // QQVGA - iInfo.iNumImageSizesSupported = iImageSizes.Count(); - iStillImageSize = iImageSizes[1]; // Defaults to QQVGA - - User::LeaveIfError(iVideoFrameSizes.Append( TSize(176, 144) )); // QCIF - User::LeaveIfError(iVideoFrameSizes.Append( TSize(128, 96) )); // subQCIF - iInfo.iNumVideoFrameSizesSupported = iVideoFrameSizes.Count(); - User::LeaveIfError(iVideoFrameRates.Append( 10.00 )); - User::LeaveIfError(iVideoFrameRates.Append( 5.00 )); - User::LeaveIfError(iVideoFrameRates.Append( 1.00 )); - iInfo.iNumVideoFrameRatesSupported = iVideoFrameRates.Count(); - iVideoFrameRate = iVideoFrameRates[0]; - // Still image used as view finder source if not defined otherwise - iStillImage = new(ELeave) CFbsBitmap; - User::LeaveIfError(iStillImage->Create(iStillImageSize, KViewFinderDisplayMode)); - iStillImageDev = CFbsBitmapDevice::NewL(iStillImage); - User::LeaveIfError(iStillImageDev->CreateContext(iStillImageGc)); - iStillImageGc->SetPenColor(KRgbBlack); - iStillImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); - iStillImageGc->SetBrushColor(KRgbWhite); - iStillImageGc->SetFaded(ETrue); - iVideoPreparedLast = EFalse; - iTimer = CPeriodic::NewL(CActive::EPriorityHigh); - } - - -void CTestCamera::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) - { - iObserver2 = &aObserver; - iCameraIndex = aCameraIndex; - iPriority = aPriority; - } - -void CTestCamera::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) - { - iObserver2 = &aObserver; - iCameraHandle = aCameraHandle; - } - - -CTestCamera::CTestCamera(): - iStillImageFormat(KInitialViewFinderFormat), - iReserveAsync(CActive::EPriorityStandard), - iPowerOnAsync(CActive::EPriorityStandard), - iImageCaptureAsync(CActive::EPriorityStandard), - iVideoCaptureAsync(CActive::EPriorityStandard), - iHandleEventAsync(CActive::EPriorityStandard), - iHandleEvent2Async(CActive::EPriorityStandard), - iFrameBuffer1(iVideoFrame1), - iFrameBuffer2(iVideoFrame2), - iFrameCameraBuffer1(iVideoFrame1), - iFrameCameraBuffer2(iVideoFrame2), - iContrast(0), - iBrightness(0), - iImgProcBrightness(0), - iImgProcContrast(0), - iVideoCaptureActive(EFalse), - iImageCaptureActive(EFalse), - iVideoPreparedLast(EFalse), - iVideoCapturePrepared(EFalse), - iImageCapturePrepared(EFalse), - iECamEvent(KNullUid, KErrNone), - iECamEvent2(KNullUid, KErrNone, 0), - iAdvSettingsImpl(NULL), - iSnapshotImpl(NULL), - iImgProcImpl(NULL), - iDriveMode(KDefaultDriveMode), - iBurstImages(KBurstImages) - { - TCallBack reserveCallBack(ReserveCallBack,this); - iReserveAsync.Set(reserveCallBack); - TCallBack powerOnCallBack(PowerOnCallBack,this); - iPowerOnAsync.Set(powerOnCallBack); - TCallBack imageCaptureCallBack(ImageCaptureCallBack,this); - iImageCaptureAsync.Set(imageCaptureCallBack); - TCallBack videoCaptureCallBack(VideoCaptureCallBack,this); - iVideoCaptureAsync.Set(videoCaptureCallBack); - TCallBack handleEventCallBack(HandleEventCallBack,this); - iHandleEventAsync.Set(handleEventCallBack); - TCallBack handleEvent2CallBack(HandleEvent2CallBack,this); - iHandleEvent2Async.Set(handleEvent2CallBack); - - iInfo.iHardwareVersion.iMajor = 0; - iInfo.iHardwareVersion.iMinor = 0; - iInfo.iHardwareVersion.iBuild = 0; - iInfo.iSoftwareVersion.iMajor = 0; - iInfo.iSoftwareVersion.iMinor = 0; - iInfo.iSoftwareVersion.iBuild = 0; - iInfo.iOrientation = TCameraInfo::EOrientationOutwards; - - iInfo.iOptionsSupported = 0; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderDirectSupported; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderBitmapsSupported; - iInfo.iOptionsSupported |= TCameraInfo::EImageCaptureSupported; - iInfo.iOptionsSupported |= TCameraInfo::EVideoCaptureSupported; - iInfo.iOptionsSupported |= TCameraInfo::EContrastSupported; - iInfo.iOptionsSupported |= TCameraInfo::EBrightnessSupported; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderClippingSupported; - - iInfo.iFlashModesSupported = 0; // Bitfield of TFlash values - iInfo.iExposureModesSupported = 0; // Bitfield of TExposure values - iInfo.iWhiteBalanceModesSupported = 0; // Bitfield of TWhiteBalance values - - iInfo.iMinZoom = KMinTestCameraZoom; - // KMinTestCameraZoom is zero or negative - // note the algorithm for creating of zoom factor - iInfo.iMinZoomFactor = TReal32(1)/TReal32(1 << -KMinTestCameraZoom); - iInfo.iMaxZoom = KMaxTestCameraZoom; - iInfo.iMaxZoomFactor = 1 << KMaxTestCameraZoom; - - iInfo.iMaxDigitalZoom = KMaxTestCameraDigitalZoom; - iInfo.iMaxDigitalZoomFactor = KMaxTestCameraDigitalZoomFactor; - - iInfo.iImageFormatsSupported = 0; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor4K; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor64K; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor16M; - - iInfo.iVideoFrameFormatsSupported = 0; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor4K; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor64K; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor16M; - iInfo.iMaxFramesPerBufferSupported = 1; - iInfo.iMaxBuffersSupported = 2; - - iScreenRect = TRect(TPoint(0,0), TPoint(0,0)); - - iEventError = KErrNone; - } - -CTestCamera::~CTestCamera() - { - delete iTimer; - delete iStillImage; - delete iStillImageGc; - delete iStillImageDev; - delete iVideoFrame1; - delete iVideoFrameGc1; - delete iVideoFrameDev1; - delete iVideoFrame2; - delete iVideoFrameGc2; - delete iVideoFrameDev2; - delete iViewFinderBitmapGc; - delete iViewFinderBitmapDev; - delete iViewFinderBitmap; - delete iDSA; - delete iScreenGc; - delete iScreenDev; - delete iGc; - delete iDev; - delete iImage; - delete iAdvSettingsImpl; - delete iSnapshotImpl; - delete iImgProcImpl; - iImageSizes.Reset(); - iVideoFrameSizes.Reset(); - iVideoFrameRates.Reset(); - } - -void CTestCamera::CameraInfo(TCameraInfo& aInfo) const - { - aInfo = iInfo; - } - -void CTestCamera::Reserve() - { - iReserved = ETrue; - iReserveAsync.CallBack(); - } - -void CTestCamera::Release() - { - iReserved = EFalse; - iTimer->Cancel(); - } - -void CTestCamera::PowerOn() - { - if (!iReserved || iPowerOn) - { - iPowerOnAsync.CallBack(); - return; - } - - iPowerOn = ETrue; - TCallBack callback(TimerCallBack,this); - iTimer->Start(0,TInt(TReal32(1000000) / iVideoFrameRate), callback); - iPowerOnAsync.CallBack(); - } - -void CTestCamera::PowerOff() - { - iPowerOn = EFalse; - iTimer->Cancel(); - } - -TInt CTestCamera::Handle() - { - return 0; - } - -void CTestCamera::SetZoomFactorL(TInt aZoomFactor) - { - // it is equivalent to comparing with iInfo members as they are initialised with the same constants - // if (aZoomFactor < iInfo.iMinZoom || aZoomFactor > iInfo.iMaxZoom) - if (aZoomFactor < KMinTestCameraZoom || aZoomFactor > KMaxTestCameraZoom) - { - User::Leave(KErrNotSupported); - } - - iZoom = aZoomFactor; - } - -TInt CTestCamera::ZoomFactor() const - { - // default value is 0 - return iZoom; - } - -void CTestCamera::SetDigitalZoomFactorL(TInt aDigitalZoomFactor) - { - CheckReserveAndPowerL(); - // it is equivalent to comparing with iInfo member as it is initialised with the same constant - // if (aDigitalZoomFactor < 0 || aDigitalZoomFactor > iInfo.iMaxDigitalZoom) - if (aDigitalZoomFactor < 0 || aDigitalZoomFactor > KMaxTestCameraDigitalZoom) - { - User::Leave(KErrNotSupported); - } - - iDigitalZoom = aDigitalZoomFactor; - } - -TInt CTestCamera::DigitalZoomFactor() const - { - // default value is 0 - return iDigitalZoom; - } - -void CTestCamera::SetContrastL(TInt aContrast) - { - CheckReserveAndPowerL(); - - iContrast = Min(Max(aContrast,-100),100); - } - -TInt CTestCamera::Contrast() const - { - return iContrast; - } - -void CTestCamera::SetBrightnessL(TInt aBrightness) - { - CheckReserveAndPowerL(); - - iBrightness = Min(Max(aBrightness,-100),100); - } - -TInt CTestCamera::Brightness() const - { - return iBrightness; - } - -void CTestCamera::SetFlashL(TFlash aFlash) - { - CheckReserveAndPowerL(); - - if (aFlash != EFlashNone) - { - User::Leave(KErrNotSupported); - } - } - -CCamera::TFlash CTestCamera::Flash() const - { - return EFlashNone; - } - -void CTestCamera::SetExposureL(TExposure aExposure) - { - CheckReserveAndPowerL(); - - if (aExposure != EExposureAuto) - { - User::Leave(KErrNotSupported); - } - } - -CCamera::TExposure CTestCamera::Exposure() const - { - return EExposureAuto; - } - -void CTestCamera::SetWhiteBalanceL(TWhiteBalance aWhiteBalance) - { - CheckReserveAndPowerL(); - - if (aWhiteBalance != EWBAuto) - { - User::Leave(KErrNotSupported); - } - } - -CCamera::TWhiteBalance CTestCamera::WhiteBalance() const - { - return EWBAuto; - } - -void CTestCamera::StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect) - { - TRect emptyRect; - StartViewFinderDirectL(aWs,aScreenDevice,aWindow,aScreenRect,emptyRect); - } - -void CTestCamera::StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect) - { - if (!iReserved) - { - User::Leave(KErrInUse); - } - - if (!iPowerOn || iViewFinderActive) - { - User::Leave(KErrNotReady); - } - - iScreenRect = aScreenRect; - iClipRect = aClipRect; - - delete iDSA; - iDSA = NULL; - iViewFinderActive = EFalse; - iDSA = CDirectScreenAccess::NewL(aWs,aScreenDevice,aWindow,*this); - iDSA->StartL(); - iViewFinderActive = ETrue; - iDSA->Gc()->SetOrigin(); // Set Origin to top left of screen (0,0) - - if (!iClipRect.IsEmpty()) - { - iDSA->Gc()->SetClippingRect(iClipRect); - } - } - -void CTestCamera::StartViewFinderBitmapsL(TSize& aSize) - { - TRect emptyRect; - StartViewFinderBitmapsL(aSize,emptyRect); - } - -void CTestCamera::StartViewFinderBitmapsL(TSize& aSize, TRect& aClipRect) - { - if (!iReserved) - { - User::Leave(KErrInUse); - } - if (!iPowerOn || iViewFinderActive) - { - User::Leave(KErrNotReady); - } - - iViewFinderActive = ETrue; - iScreenRect = TRect(TPoint(0,0), aSize); - iClipRect = aClipRect; - iClipRect.Intersection(iScreenRect); - - delete iViewFinderBitmapGc; - iViewFinderBitmapGc = NULL; - delete iViewFinderBitmapDev; - iViewFinderBitmapDev = NULL; - delete iViewFinderBitmap; - iViewFinderBitmap = NULL; - - iViewFinderBitmap = new(ELeave) CFbsBitmap; - if (!iClipRect.IsEmpty()) - { - User::LeaveIfError(iViewFinderBitmap->Create(iClipRect.Size(), KViewFinderDisplayMode)); - } - else - { - User::LeaveIfError(iViewFinderBitmap->Create(aSize, KViewFinderDisplayMode)); - } - iViewFinderBitmapDev = CFbsBitmapDevice::NewL(iViewFinderBitmap); - User::LeaveIfError(iViewFinderBitmapDev->CreateContext(iViewFinderBitmapGc)); - } - -void CTestCamera::StartViewFinderL(TFormat aImageFormat,TSize& aSize) - { - TRect emptyRect; - StartViewFinderL(aImageFormat,aSize,emptyRect); - } - -void CTestCamera::StartViewFinderL(TFormat aImageFormat,TSize& /*aSize*/,TRect& aClipRect) - { - if(!iReserved) - { - User::Leave(KErrInUse); - } - if(!iPowerOn || iViewFinderActive) - { - User::Leave(KErrNotReady); - } - - iViewFinderActive = ETrue; - iClipRect = aClipRect; - if(!(aImageFormat & iInfo.iImageFormatsSupported)) - { - User::Leave(KErrNotSupported); - } - } - - -void CTestCamera::StopViewFinder() - { - iViewFinderActive = EFalse; - delete iDSA; - iDSA = NULL; - - delete iViewFinderBitmapGc; - iViewFinderBitmapGc = NULL; - delete iViewFinderBitmapDev; - iViewFinderBitmapDev = NULL; - delete iViewFinderBitmap; - iViewFinderBitmap = NULL; - } - -TBool CTestCamera::ViewFinderActive() const - { - return iViewFinderActive; - } - -void CTestCamera::SetViewFinderMirrorL(TBool aMirror) - { - if (aMirror) - { - User::Leave(KErrNotSupported); - } - } - -TBool CTestCamera::ViewFinderMirror() const - { - return EFalse; - } - -void CTestCamera::PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex) - { - if (!iReserved) - { - User::Leave(KErrInUse); - } - - if (!iPowerOn || iVideoCaptureActive || iImageCaptureActive) - { - User::Leave(KErrNotReady); - } - - - if (!(aImageFormat & iInfo.iImageFormatsSupported) || aSizeIndex < 0 - || aSizeIndex >= iInfo.iNumImageSizesSupported) - { - User::Leave(KErrNotSupported); - } - - iVideoPreparedLast = EFalse; - - if (iImageCapturePrepared - && iStillImageSize == iImageSizes[aSizeIndex] - && iStillImageFormat == aImageFormat) - { - return; - } - - iStillImageSize = iImageSizes[aSizeIndex]; - iStillImageFormat = aImageFormat; - - TDisplayMode displayMode = ENone; - switch (iStillImageFormat) - { - case EFormatFbsBitmapColor4K : - displayMode = EColor4K; - break; - case EFormatFbsBitmapColor64K : - displayMode = EColor64K; - break; - case EFormatFbsBitmapColor16M : - displayMode = EColor16M; - break; - default : - User::Leave(KErrNotSupported); - break; - } - - delete iStillImageGc; - iStillImageGc = NULL; - delete iStillImageDev; - iStillImageDev = NULL; - delete iStillImage; - iStillImage = NULL; - - iStillImage = new(ELeave) CFbsBitmap; - User::LeaveIfError(iStillImage->Create(iStillImageSize, displayMode)); - iStillImageDev = CFbsBitmapDevice::NewL(iStillImage); - User::LeaveIfError(iStillImageDev->CreateContext(iStillImageGc)); - iStillImageGc->SetPenColor(KRgbBlack); - iStillImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); - iStillImageGc->SetBrushColor(KRgbWhite); - iStillImageGc->SetFaded(ETrue); - iImageCapturePrepared = ETrue; - } - -void CTestCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) - { - User::Leave(KErrNotSupported); - } - -void CTestCamera::CaptureImage() - { - if (!iReserved) - { - iStillCaptureErr = KErrInUse; - } - - if (!iPowerOn || iImageCaptureActive || iVideoCaptureActive || !iImageCapturePrepared) - { - iStillCaptureErr = KErrNotReady; - } - - if (iStillCaptureErr == KErrNone) - { - TRAP(iStillCaptureErr,DoCaptureImageL()); - } - - if (iStillCaptureErr == KErrNone) - { - iImageCaptureActive = ETrue; - } - else - { - iImageCaptureAsync.CallBack(); - } - } - -void CTestCamera::DoCaptureImageL() - { - delete iGc; - iGc = NULL; - delete iDev; - iDev = NULL; - delete iImage; - iImage = NULL; - - CFbsBitmap* image = new(ELeave) CFbsBitmap; - CleanupStack::PushL(image); - User::LeaveIfError(image->Create(iStillImageSize, iStillImage->DisplayMode())); - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(image); - CleanupStack::PushL(dev); - CFbsBitGc* gc = NULL; - User::LeaveIfError(dev->CreateContext(gc)); - CleanupStack::Pop(dev); - CleanupStack::Pop(image); - - iImage = image; - iDev = dev; - iGc = gc; - } - -void CTestCamera::CancelCaptureImage() - { - iImageCaptureActive = EFalse; - } - -void CTestCamera::EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const - { - if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumImageSizesSupported || - !(aFormat & iInfo.iImageFormatsSupported) ) - { - aSize = TSize(0,0); - } - else - { - aSize = iImageSizes[aSizeIndex]; - } - } - -void CTestCamera::PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer) - { - if (!iReserved) - { - User::Leave(KErrInUse); - } - - if (!iPowerOn || iVideoCaptureActive || iImageCaptureActive) - { - User::Leave(KErrNotReady); - } - - if (!(aFormat & iInfo.iVideoFrameFormatsSupported) - || aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported - || aRateIndex < 0 || aRateIndex >= iInfo.iNumVideoFrameRatesSupported - || aBuffersToUse != 2 || aFramesPerBuffer != 1) - { - User::Leave(KErrNotSupported); - } - - iVideoPreparedLast = ETrue; - - if (iVideoCapturePrepared - && iVideoFrameSize == iVideoFrameSizes[aSizeIndex] - && iVideoFrameFormat == aFormat) - { - return; - } - - TDisplayMode displayMode = ENone; - switch (aFormat) - { - case EFormatFbsBitmapColor4K : - displayMode = EColor4K; - break; - case EFormatFbsBitmapColor64K : - displayMode = EColor64K; - break; - case EFormatFbsBitmapColor16M : - displayMode = EColor16M; - break; - default : - User::Leave(KErrNotSupported); - break; - } - - iVideoFrameSize = iVideoFrameSizes[aSizeIndex]; - iVideoFrameRate = iVideoFrameRates[aRateIndex]; - iVideoFrameFormat = aFormat; - iBuffersInUse = aBuffersToUse; - - delete iVideoFrameGc1; - iVideoFrameGc1 = NULL; - delete iVideoFrameDev1; - iVideoFrameDev1 = NULL; - delete iVideoFrame1; - iVideoFrame1 = NULL; - - delete iVideoFrameGc2; - iVideoFrameGc2 = NULL; - delete iVideoFrameDev2; - iVideoFrameDev2 = NULL; - delete iVideoFrame2; - iVideoFrame2 = NULL; - - iVideoFrame1 = new(ELeave) CFbsBitmap; - User::LeaveIfError(iVideoFrame1->Create(iVideoFrameSize, displayMode)); - iVideoFrameDev1 = CFbsBitmapDevice::NewL(iVideoFrame1); - User::LeaveIfError(iVideoFrameDev1->CreateContext(iVideoFrameGc1)); - iVideoFrameGc1->SetPenColor(KRgbBlack); - iVideoFrameGc1->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); - iVideoFrameGc1->SetBrushColor(KRgbWhite); - iVideoFrameGc1->SetFaded(ETrue); - - if (iBuffersInUse == 2) - { - iVideoFrame2 = new(ELeave) CFbsBitmap; - User::LeaveIfError(iVideoFrame2->Create(iVideoFrameSize, displayMode)); - iVideoFrameDev2 = CFbsBitmapDevice::NewL(iVideoFrame2); - User::LeaveIfError(iVideoFrameDev1->CreateContext(iVideoFrameGc2)); - iVideoFrameGc2->SetPenColor(KRgbBlack); - iVideoFrameGc2->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); - iVideoFrameGc2->SetBrushColor(KRgbWhite); - iVideoFrameGc2->SetFaded(ETrue); - } - - iVideoCapturePrepared = ETrue; - } - -void CTestCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) - { - User::Leave(KErrNotSupported); - } - -void CTestCamera::StartVideoCapture() - { - if (!iReserved) - { - iVideoCaptureErr = KErrInUse; - } - - if (!iPowerOn || iImageCaptureActive || iVideoCaptureActive || !iVideoCapturePrepared) - { - iVideoCaptureErr = KErrNotReady; - } - - if (iVideoCaptureErr == KErrNone) - { - iVideoCaptureActive = ETrue; - } - - else - { - iVideoCaptureAsync.CallBack(); - } - } - -void CTestCamera::StopVideoCapture() - { - iVideoCaptureActive = EFalse; - iFrameIndex = 0; - iElapsedTime = 0; - } - -TBool CTestCamera::VideoCaptureActive() const - { - return iVideoCaptureActive; - } - -void CTestCamera::EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const - { - if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported || - !(aFormat & iInfo.iVideoFrameFormatsSupported)) - { - aSize = TSize(0,0); - } - else - { - aSize = iVideoFrameSizes[aSizeIndex]; - } - } - -void CTestCamera::EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure) const - { - if (aRateIndex < 0 || aRateIndex >= iInfo.iNumVideoFrameRatesSupported || - aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported || - !(aFormat & iInfo.iVideoFrameFormatsSupported) || - (!(aExposure & iInfo.iExposureModesSupported) && aExposure != CCamera::EExposureAuto)) - { - aRate = 0.0; - } - else - { - aRate = iVideoFrameRates[aRateIndex]; - } - } - -void CTestCamera::GetFrameSize(TSize& aSize) const - { - aSize = iVideoFrameSize; - } - -TReal32 CTestCamera::FrameRate() const - { - return iVideoFrameRate; - } - -TInt CTestCamera::BuffersInUse() const - { - return iBuffersInUse; - } - -TInt CTestCamera::FramesPerBuffer() const - { - return 1; - } - -void CTestCamera::SetJpegQuality(TInt /*aQuality*/) - { - } - -TInt CTestCamera::JpegQuality() const - { - return 0; - } - -TAny* CTestCamera::CustomInterface(TUid aInterface) - { - TAny* ptrIface = NULL; - TRAPD(error,CustomInterfaceL(ptrIface, aInterface)); - - if(error == KErrNone) - { - switch(aInterface.iUid) - { - // advanced settings interface pointers - case KECamMCameraAdvancedSettingsUidValue: - { - return static_cast(ptrIface); - } - case KECamMCameraAdvancedSettings2UidValue: - { - return static_cast(ptrIface); - } - case KECamMCameraAdvancedSettings3UidValue: - { - return static_cast(ptrIface); - } - - // snapshot interface pointers - case KECamMCameraSnapshotUidValue: - { - return static_cast(ptrIface); - } - - // preset interface pointers - case KECamMCameraPresetsUidValue: - return static_cast(ptrIface); - - // image processing interface pointers - case KECamMCameraImageProcessingUidValue: - { - return static_cast(ptrIface); - } - - case KECamMCameraImageProcessing2UidValue: - { - return static_cast(ptrIface); - } - - default: - return NULL; - } - } - else - { - return NULL; - } - } - -void CTestCamera::CustomInterfaceL(TAny*& aIface, TUid aInterface) - { - switch(aInterface.iUid) - { - // advanced settings interface pointers - case KECamMCameraAdvancedSettingsUidValue: - { - iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); - aIface = static_cast(iAdvSettingsImpl); - break; - } - case KECamMCameraAdvancedSettings2UidValue: - { - iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); - aIface = static_cast(iAdvSettingsImpl); - break; - } - case KECamMCameraAdvancedSettings3UidValue: - { - iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); - aIface = static_cast(iAdvSettingsImpl); - break; - } - - // snapshot interface pointers - case KECamMCameraSnapshotUidValue: - { - iSnapshotImpl = CTestCamSnapshot::NewL(*this); - aIface = static_cast(iSnapshotImpl); - break; - } - // preset interface pointers - case KECamMCameraPresetsUidValue: - { - aIface = static_cast(CTestCamPresets::NewL(*this)); - break; - } - - // image processing interface pointers - case KECamMCameraImageProcessingUidValue: - { - iImgProcImpl = CTestCamImgProc::NewL(*this); - aIface = static_cast(iImgProcImpl); - break; - } - - case KECamMCameraImageProcessing2UidValue: - { - iImgProcImpl = CTestCamImgProc::NewL(*this); - aIface = static_cast(iImgProcImpl); - break; - } - - default: - aIface = NULL; - } - } - -void CTestCamera::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) - { - iViewFinderActive = EFalse; - } - -void CTestCamera::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) - { - TRAPD(error,iDSA->StartL()); - if (error != KErrNone) - { - return; - } - iDSA->Gc()->SetOrigin(); // Set Origin to top left of screen (0,0) - - if (!iClipRect.IsEmpty()) - { - iDSA->Gc()->SetClippingRect(iClipRect); - } - else - { - iDSA->Gc()->CancelClippingRect(); - } - - iViewFinderActive = ETrue; - } - -TInt CTestCamera::TimerCallBack(TAny* aThis) - { - static_cast(aThis)->FrameReady(); - return KErrNone; - } - -void CTestCamera::FrameReady() - { - if (iVideoPreparedLast) - { - iVideoFramePos.iX += KFramePosIncrement; - iVideoFramePos.iY += KFramePosIncrement; - - if (iVideoFramePos.iX >= iVideoFrameSize.iWidth) - { - iVideoFramePos.iX = 0; - } - - if (iVideoFramePos.iY >= iVideoFrameSize.iHeight) - { - iVideoFramePos.iY = 0; - } - } - else - { - iStillImagePos.iX += KFramePosIncrement; - iStillImagePos.iY += KFramePosIncrement; - - if (iStillImagePos.iX >= iStillImageSize.iWidth) - { - iStillImagePos.iX = 0; - } - - if (iStillImagePos.iY >= iStillImageSize.iHeight) - { - iStillImagePos.iY = 0; - } - } - - if (iImageCaptureActive) - { - if (!iImageCapturePrepared) - { - iImageCaptureActive = EFalse; - if (iObserver2) - { - iObserver2->ImageBufferReady(iFrameCameraBuffer1,KErrNotReady); - } - else - { - iObserver->ImageReady(NULL,NULL,KErrNotReady); - } - } - else - { - if(iDriveMode == CCamera::CCameraAdvancedSettings::EDriveModeBurst) - { - for (TInt index =0; index < iBurstImages -1; index++) - { - if(iSnapshotImpl != NULL) - { - if(iSnapshotImpl->iSnapshotActive) - { - GetFrame(*(iSnapshotImpl->iSnapshotImageGc), iStillImagePos); - iSnapshotImpl->ServiceBurstImageSnapshot(*(iSnapshotImpl->iSnapshotImageGc)); - } - } - - GetImgProcessedFrame(*iStillImageGc, iStillImagePos); - ServiceBurstImageCapture(*iStillImageGc); - } - } - - // normal case, single shot and last image from burst mode - if(iSnapshotImpl != NULL) - { - if(iSnapshotImpl->iSnapshotActive) - { - GetFrame(*iSnapshotImpl->iSnapshotImageGc, iStillImagePos); - iSnapshotImpl->ServiceSnapshot(*(iSnapshotImpl->iSnapshotImageGc)); - } - } - - GetImgProcessedFrame(*iStillImageGc, iStillImagePos); - ServiceImageCapture(*iStillImageGc); - - if (iVideoPreparedLast) - { - GetFrame(*iVideoFrameGc1, iVideoFramePos); - if (iViewFinderActive) - { - ServiceViewFinder(iVideoFrame1); - } - } - else - { - if (iViewFinderActive) - { - ServiceViewFinder(iStillImage); - } - } - } - } - - else if (iVideoCaptureActive) - { - if (!iVideoCapturePrepared) - { - iVideoCaptureActive = EFalse; - if (iObserver2) - { - iObserver2->VideoBufferReady(iFrameCameraBuffer1,KErrNotReady); - } - else - { - iObserver->FrameBufferReady(NULL,KErrNotReady); - } - } - else - { - if (iObserver2) - { - if (iFrameCameraBuffer1.iAvailable) - { - GetFrame(*iVideoFrameGc1, iVideoFramePos); - ServiceVideo(1); - if (iViewFinderActive) - { - ServiceViewFinder(iVideoFrame1); - } - } - else if (iFrameCameraBuffer2.iAvailable && iBuffersInUse == 2) - { - GetFrame(*iVideoFrameGc2, iVideoFramePos); - ServiceVideo(2); - if (iViewFinderActive) - { - ServiceViewFinder(iVideoFrame2); - } - } - } - else - { - if (iFrameBuffer1.iAvailable) - { - GetFrame(*iVideoFrameGc1, iVideoFramePos); - ServiceVideo(1); - if (iViewFinderActive) - { - ServiceViewFinder(iVideoFrame1); - } - } - else if (iFrameBuffer2.iAvailable && iBuffersInUse == 2) - { - GetFrame(*iVideoFrameGc2, iVideoFramePos); - ServiceVideo(2); - if (iViewFinderActive) - { - ServiceViewFinder(iVideoFrame2); - } - } - } - } - } - - else if (iViewFinderActive) - { - if (iVideoPreparedLast) - { - GetFrame(*iVideoFrameGc1, iVideoFramePos); - ServiceViewFinder(iVideoFrame1); - } - else - { - GetFrame(*iStillImageGc, iStillImagePos); - ServiceViewFinder(iStillImage); - } - } - } - -void CTestCamera::GetFrame(CFbsBitGc& aGc, TPoint& aPos) const - { - TInt black = (100 - iContrast) * 127 / 200; - TInt white = ((100 + iContrast) * 128 / 200) + 127; - - const TInt brightAdjust = iBrightness * 255 / 100; - black += brightAdjust; - white += brightAdjust; - - black = Min(Max(black,0),255); - white = Min(Max(white,0),255); - - aGc.SetFadingParameters(TUint8(black),TUint8(white)); - aGc.Clear(); - aGc.DrawRect(TRect(aPos,TSize(KFrameFeatureSize,KFrameFeatureSize))); - } - -void CTestCamera::GetImgProcessedFrame(CFbsBitGc& aGc, TPoint& aPos) const - { - TInt contrast = iContrast; - TInt brightness = iBrightness; - - if(iImgProcImpl != NULL) - { - for(TInt index=0; indexiActiveTransformations.Count(); index++) - { - switch(iImgProcImpl->iActiveTransformations[index].iUid) - { - case KUidECamEventImageProcessingAdjustBrightnessUidValue: - { - brightness = iImgProcBrightness; - break; - } - case KUidECamEventImageProcessingAdjustContrastUidValue: - { - contrast = iImgProcContrast; - break; - } - default: - { - break; - } - } - } - } - - TInt black = (100 - contrast) * 127 / 200; - TInt white = ((100 + contrast) * 128 / 200) + 127; - - const TInt brightAdjust = brightness * 255 / 100; - black += brightAdjust; - white += brightAdjust; - - black = Min(Max(black,0),255); - white = Min(Max(white,0),255); - - aGc.SetFadingParameters(TUint8(black),TUint8(white)); - aGc.Clear(); - aGc.DrawRect(TRect(aPos,TSize(KFrameFeatureSize,KFrameFeatureSize))); - } - -void CTestCamera::ServiceVideo(TInt aBufferNum) - { - iFrameIndex++; - iElapsedTime = iElapsedTime.Int64() + (TInt64(1000000) / TInt64(iVideoFrameRate)); - - if (aBufferNum == 1) - { - if (iObserver2) - { - iFrameCameraBuffer1.iIndexOfFirstFrameInBuffer = iFrameIndex; - iFrameCameraBuffer1.iElapsedTime = iElapsedTime; - iFrameCameraBuffer1.iAvailable = EFalse; - } - else - { - iFrameBuffer1.iIndexOfFirstFrameInBuffer = iFrameIndex; - iFrameBuffer1.iElapsedTime = iElapsedTime; - iFrameBuffer1.iAvailable = EFalse; - } - - if (iObserver2) - { - iObserver2->VideoBufferReady(iFrameCameraBuffer1,KErrNone); - } - else - { - iObserver->FrameBufferReady(&iFrameBuffer1,KErrNone); - } - } - else if (aBufferNum == 2) - { - if (iObserver2) - { - iFrameCameraBuffer2.iIndexOfFirstFrameInBuffer = iFrameIndex; - iFrameCameraBuffer2.iElapsedTime = iElapsedTime; - iFrameCameraBuffer2.iAvailable = EFalse; - } - else - { - iFrameBuffer2.iIndexOfFirstFrameInBuffer = iFrameIndex; - iFrameBuffer2.iElapsedTime = iElapsedTime; - iFrameBuffer2.iAvailable = EFalse; - } - - if (iObserver2) - { - iObserver2->VideoBufferReady(iFrameCameraBuffer2,KErrNone); - } - else - { - iObserver->FrameBufferReady(&iFrameBuffer2,KErrNone); - } - } - } - -void CTestCamera::ServiceViewFinder(CFbsBitmap* aSourceFrame) - { - if (iDSA) - { - iDSA->Gc()->DrawBitmap(iScreenRect,aSourceFrame); - iDSA->ScreenDevice()->Update(); - } - else if (iViewFinderBitmap) - { - if (iViewFinderBitmapGc) - { - if (!iClipRect.IsEmpty()) - { - TReal32 xRatio = static_cast(aSourceFrame->SizeInPixels().iWidth) / - static_cast(iClipRect.Size().iWidth); - - TReal32 yRatio = static_cast(aSourceFrame->SizeInPixels().iHeight) / - static_cast(iClipRect.Size().iHeight); - - TRect sourceRect(TPoint(static_cast(xRatio*iClipRect.iTl.iX), - static_cast(yRatio*iClipRect.iTl.iY)), - TPoint(static_cast(xRatio*iClipRect.iBr.iX), - static_cast(yRatio*iClipRect.iBr.iY))); - - TRect destRect(TPoint(0,0), iClipRect.Size()); - - iViewFinderBitmapGc->DrawBitmap(destRect, - aSourceFrame, - sourceRect); - } - else - { - TRect destRect(TPoint(0,0), iViewFinderBitmap->SizeInPixels()); - iViewFinderBitmapGc->DrawBitmap(destRect, aSourceFrame); - } - - if (iObserver2) - { - iObserver2->ViewFinderReady(iFrameCameraBuffer1,KErrNone); - } - else - { - iObserver->ViewFinderFrameReady(*iViewFinderBitmap); - } - - } - } - else - { - iScreenGc->DrawBitmap(iClipRect,aSourceFrame); - iScreenDev->Update(); - } - } - -void CTestCamera::ServiceImageCapture(const CFbsBitGc& aSourceBitmapGc) - { - iImageCaptureActive = EFalse; - iGc->BitBlt(TPoint(0,0), aSourceBitmapGc); - CFbsBitmap* image = iImage; - RTestCameraFrameBuffer frameBuffer(image); - delete iGc; - iGc = NULL; - delete iDev; - iDev = NULL; - if (iObserver2 != NULL) - { - iObserver2->ImageBufferReady(frameBuffer,KErrNone); - } - else - { - iImage = NULL; - iObserver->ImageReady(image,NULL,KErrNone); - } - } - -void CTestCamera::ServiceBurstImageCapture(const CFbsBitGc& aSourceBitmapGc) - { - iGc->BitBlt(TPoint(0,0), aSourceBitmapGc); - if (iObserver2 != NULL) - { - CFbsBitmap* image = iImage; - RTestCameraFrameBuffer frameBuffer(image); - iObserver2->ImageBufferReady(frameBuffer,KErrNone); - } - else//not for MCameraObserver - { - return; - } - - if(iSnapshotImpl) - { - if(iSnapshotImpl->iSnapshotActive) - { - return; - } - } - User::After(500000); - iStillImagePos.iX += KFramePosIncrement; - iStillImagePos.iY += KFramePosIncrement; - - if (iStillImagePos.iX >= iStillImageSize.iWidth) - { - iStillImagePos.iX = 0; - } - - if (iStillImagePos.iY >= iStillImageSize.iHeight) - { - iStillImagePos.iY = 0; - } - } - -void CTestCamera::CheckReserveAndPowerL() - { - if (!iReserved) - { - User::Leave(KErrInUse); - } - - if (!iPowerOn) - { - User::Leave(KErrNotReady); - } - } - -TInt CTestCamera::CheckReserveAndPower() const - { - if (!iReserved) - { - return KErrInUse; - } - - if (!iPowerOn) - { - return KErrNotReady; - } - - return KErrNone; - } - -TInt CTestCamera::ReserveCallBack(TAny* aThis) - { - const TECAMEvent event(KUidECamEventReserveComplete,KErrNone); - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->HandleEvent(event); - } - else - { - testCamera->iObserver->ReserveComplete(KErrNone); - } - return KErrNone; - } - -TInt CTestCamera::PowerOnCallBack(TAny* aThis) - { - TECAMEvent event(KUidECamEventPowerOnComplete,KErrNone); - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->HandleEvent(event); - } - else - { - testCamera->iObserver->PowerOnComplete(testCamera->iPowerOn ? KErrNone : KErrInUse); - } - return KErrNone; - } - -TInt CTestCamera::ImageCaptureCallBack(TAny* aThis) - { - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->ImageBufferReady((static_cast(aThis))->iFrameCameraBuffer1,testCamera->iStillCaptureErr); - } - else - { - testCamera->iObserver->ImageReady(NULL,NULL,testCamera->iStillCaptureErr); - } - testCamera->iStillCaptureErr = KErrNone; - return KErrNone; - } - -TInt CTestCamera::VideoCaptureCallBack(TAny* aThis) - { - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->VideoBufferReady((static_cast(aThis))->iFrameCameraBuffer1,testCamera->iVideoCaptureErr); - } - else - { - testCamera->iObserver->FrameBufferReady(NULL,testCamera->iVideoCaptureErr); - } - testCamera->iVideoCaptureErr = KErrNone; - return KErrNone; - } - -TInt CTestCamera::HandleEventCallBack(TAny* aThis) - { - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->HandleEvent(testCamera->iECamEvent); - } - - return KErrNone; - } - -TInt CTestCamera::HandleEvent2CallBack(TAny* aThis) - { - CTestCamera* testCamera = static_cast(aThis); - if (testCamera->iObserver2) - { - testCamera->iObserver2->HandleEvent(testCamera->iECamEvent2); - } - - return KErrNone; - } - -// -// CTestCameraInfo -// - -CTestCameraInfo::CTestCameraInfo() - { - } - -CTestCameraInfo::~CTestCameraInfo() - { - } - -CTestCameraInfo* CTestCameraInfo::NewL() - { - FileDependencyUtil::CheckFileDependencyL(); - return new (ELeave) CTestCameraInfo; - } - -TInt CTestCameraInfo::CamerasAvailable() - { - return 1; - } - -//void CTestCamera::CheckFileDependencyL() -void FileDependencyUtil::CheckFileDependencyL() - { - RFs fsSession; - RFile file; - CleanupClosePushL(fsSession); - User::LeaveIfError(fsSession.Connect()); - TInt err = file.Open(fsSession, KTestCameraPluginName, EFileRead); - file.Close(); - if(err != KErrNone) - { - User::LeaveIfError(KErrNotSupported); - } - CleanupStack::PopAndDestroy(); //fsSession - } - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraTestPlugin, CTestCamera::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraTestInfo, CTestCameraInfo::NewL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include +#include +#include "TestCamera.h" +#include "test_advanced_settings.h" +#include "test_snapshot.h" +#include "test_image_processing.h" +#include "TestCameraUids.hrh" +#include + +// +// Main stuff +// +// +// 2nd stage ConstructL calls called by framework +// +CTestCamera* CTestCamera::NewL() + { + FileDependencyUtil::CheckFileDependencyL(); + CTestCamera* self = new(ELeave) CTestCamera; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CTestCamera::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) + { + iObserver = &aObserver; + iCameraIndex = aCameraIndex; + } + +void CTestCamera::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) + { + iObserver = &aObserver; + iCameraHandle = aCameraHandle; + } + +void CTestCamera::ConstructL() + { + + TInt err; + TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor16M)); + if (err == KErrNotSupported) + { + TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor64K)); + } + if (err == KErrNotSupported) + { + TRAP(err, iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor4K)); + } + if (err == KErrNotSupported) + { + iScreenDev = CFbsScreenDevice::NewL(_L(""),EColor256); + } + else + { + User::LeaveIfError(err); + } + + User::LeaveIfError(iScreenDev->CreateContext(iScreenGc)); + User::LeaveIfError(iImageSizes.Append( TSize(640, 480) )); // VGA + User::LeaveIfError(iImageSizes.Append( TSize(160, 120) )); // QQVGA + iInfo.iNumImageSizesSupported = iImageSizes.Count(); + iStillImageSize = iImageSizes[1]; // Defaults to QQVGA + + User::LeaveIfError(iVideoFrameSizes.Append( TSize(176, 144) )); // QCIF + User::LeaveIfError(iVideoFrameSizes.Append( TSize(128, 96) )); // subQCIF + iInfo.iNumVideoFrameSizesSupported = iVideoFrameSizes.Count(); + User::LeaveIfError(iVideoFrameRates.Append( 10.00 )); + User::LeaveIfError(iVideoFrameRates.Append( 5.00 )); + User::LeaveIfError(iVideoFrameRates.Append( 1.00 )); + iInfo.iNumVideoFrameRatesSupported = iVideoFrameRates.Count(); + iVideoFrameRate = iVideoFrameRates[0]; + // Still image used as view finder source if not defined otherwise + iStillImage = new(ELeave) CFbsBitmap; + User::LeaveIfError(iStillImage->Create(iStillImageSize, KViewFinderDisplayMode)); + iStillImageDev = CFbsBitmapDevice::NewL(iStillImage); + User::LeaveIfError(iStillImageDev->CreateContext(iStillImageGc)); + iStillImageGc->SetPenColor(KRgbBlack); + iStillImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); + iStillImageGc->SetBrushColor(KRgbWhite); + iStillImageGc->SetFaded(ETrue); + iVideoPreparedLast = EFalse; + iTimer = CPeriodic::NewL(CActive::EPriorityHigh); + } + + +void CTestCamera::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) + { + iObserver2 = &aObserver; + iCameraIndex = aCameraIndex; + iPriority = aPriority; + } + +void CTestCamera::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) + { + iObserver2 = &aObserver; + iCameraHandle = aCameraHandle; + } + + +CTestCamera::CTestCamera(): + iStillImageFormat(KInitialViewFinderFormat), + iReserveAsync(CActive::EPriorityStandard), + iPowerOnAsync(CActive::EPriorityStandard), + iImageCaptureAsync(CActive::EPriorityStandard), + iVideoCaptureAsync(CActive::EPriorityStandard), + iHandleEventAsync(CActive::EPriorityStandard), + iHandleEvent2Async(CActive::EPriorityStandard), + iFrameBuffer1(iVideoFrame1), + iFrameBuffer2(iVideoFrame2), + iFrameCameraBuffer1(iVideoFrame1), + iFrameCameraBuffer2(iVideoFrame2), + iContrast(0), + iBrightness(0), + iImgProcBrightness(0), + iImgProcContrast(0), + iVideoCaptureActive(EFalse), + iImageCaptureActive(EFalse), + iVideoPreparedLast(EFalse), + iVideoCapturePrepared(EFalse), + iImageCapturePrepared(EFalse), + iECamEvent(KNullUid, KErrNone), + iECamEvent2(KNullUid, KErrNone, 0), + iAdvSettingsImpl(NULL), + iSnapshotImpl(NULL), + iImgProcImpl(NULL), + iDriveMode(KDefaultDriveMode), + iBurstImages(KBurstImages) + { + TCallBack reserveCallBack(ReserveCallBack,this); + iReserveAsync.Set(reserveCallBack); + TCallBack powerOnCallBack(PowerOnCallBack,this); + iPowerOnAsync.Set(powerOnCallBack); + TCallBack imageCaptureCallBack(ImageCaptureCallBack,this); + iImageCaptureAsync.Set(imageCaptureCallBack); + TCallBack videoCaptureCallBack(VideoCaptureCallBack,this); + iVideoCaptureAsync.Set(videoCaptureCallBack); + TCallBack handleEventCallBack(HandleEventCallBack,this); + iHandleEventAsync.Set(handleEventCallBack); + TCallBack handleEvent2CallBack(HandleEvent2CallBack,this); + iHandleEvent2Async.Set(handleEvent2CallBack); + + iInfo.iHardwareVersion.iMajor = 0; + iInfo.iHardwareVersion.iMinor = 0; + iInfo.iHardwareVersion.iBuild = 0; + iInfo.iSoftwareVersion.iMajor = 0; + iInfo.iSoftwareVersion.iMinor = 0; + iInfo.iSoftwareVersion.iBuild = 0; + iInfo.iOrientation = TCameraInfo::EOrientationOutwards; + + iInfo.iOptionsSupported = 0; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderDirectSupported; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderBitmapsSupported; + iInfo.iOptionsSupported |= TCameraInfo::EImageCaptureSupported; + iInfo.iOptionsSupported |= TCameraInfo::EVideoCaptureSupported; + iInfo.iOptionsSupported |= TCameraInfo::EContrastSupported; + iInfo.iOptionsSupported |= TCameraInfo::EBrightnessSupported; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderClippingSupported; + + iInfo.iFlashModesSupported = 0; // Bitfield of TFlash values + iInfo.iExposureModesSupported = 0; // Bitfield of TExposure values + iInfo.iWhiteBalanceModesSupported = 0; // Bitfield of TWhiteBalance values + + iInfo.iMinZoom = KMinTestCameraZoom; + // KMinTestCameraZoom is zero or negative + // note the algorithm for creating of zoom factor + iInfo.iMinZoomFactor = TReal32(1)/TReal32(1 << -KMinTestCameraZoom); + iInfo.iMaxZoom = KMaxTestCameraZoom; + iInfo.iMaxZoomFactor = 1 << KMaxTestCameraZoom; + + iInfo.iMaxDigitalZoom = KMaxTestCameraDigitalZoom; + iInfo.iMaxDigitalZoomFactor = KMaxTestCameraDigitalZoomFactor; + + iInfo.iImageFormatsSupported = 0; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor4K; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor64K; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor16M; + + iInfo.iVideoFrameFormatsSupported = 0; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor4K; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor64K; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor16M; + iInfo.iMaxFramesPerBufferSupported = 1; + iInfo.iMaxBuffersSupported = 2; + + iScreenRect = TRect(TPoint(0,0), TPoint(0,0)); + + iEventError = KErrNone; + } + +CTestCamera::~CTestCamera() + { + delete iTimer; + delete iStillImage; + delete iStillImageGc; + delete iStillImageDev; + delete iVideoFrame1; + delete iVideoFrameGc1; + delete iVideoFrameDev1; + delete iVideoFrame2; + delete iVideoFrameGc2; + delete iVideoFrameDev2; + delete iViewFinderBitmapGc; + delete iViewFinderBitmapDev; + delete iViewFinderBitmap; + delete iDSA; + delete iScreenGc; + delete iScreenDev; + delete iGc; + delete iDev; + delete iImage; + delete iAdvSettingsImpl; + delete iSnapshotImpl; + delete iImgProcImpl; + iImageSizes.Reset(); + iVideoFrameSizes.Reset(); + iVideoFrameRates.Reset(); + } + +void CTestCamera::CameraInfo(TCameraInfo& aInfo) const + { + aInfo = iInfo; + } + +void CTestCamera::Reserve() + { + iReserved = ETrue; + iReserveAsync.CallBack(); + } + +void CTestCamera::Release() + { + iReserved = EFalse; + iTimer->Cancel(); + } + +void CTestCamera::PowerOn() + { + if (!iReserved || iPowerOn) + { + iPowerOnAsync.CallBack(); + return; + } + + iPowerOn = ETrue; + TCallBack callback(TimerCallBack,this); + iTimer->Start(0,TInt(TReal32(1000000) / iVideoFrameRate), callback); + iPowerOnAsync.CallBack(); + } + +void CTestCamera::PowerOff() + { + iPowerOn = EFalse; + iTimer->Cancel(); + } + +TInt CTestCamera::Handle() + { + return 0; + } + +void CTestCamera::SetZoomFactorL(TInt aZoomFactor) + { + // it is equivalent to comparing with iInfo members as they are initialised with the same constants + // if (aZoomFactor < iInfo.iMinZoom || aZoomFactor > iInfo.iMaxZoom) + if (aZoomFactor < KMinTestCameraZoom || aZoomFactor > KMaxTestCameraZoom) + { + User::Leave(KErrNotSupported); + } + + iZoom = aZoomFactor; + } + +TInt CTestCamera::ZoomFactor() const + { + // default value is 0 + return iZoom; + } + +void CTestCamera::SetDigitalZoomFactorL(TInt aDigitalZoomFactor) + { + CheckReserveAndPowerL(); + // it is equivalent to comparing with iInfo member as it is initialised with the same constant + // if (aDigitalZoomFactor < 0 || aDigitalZoomFactor > iInfo.iMaxDigitalZoom) + if (aDigitalZoomFactor < 0 || aDigitalZoomFactor > KMaxTestCameraDigitalZoom) + { + User::Leave(KErrNotSupported); + } + + iDigitalZoom = aDigitalZoomFactor; + } + +TInt CTestCamera::DigitalZoomFactor() const + { + // default value is 0 + return iDigitalZoom; + } + +void CTestCamera::SetContrastL(TInt aContrast) + { + CheckReserveAndPowerL(); + + iContrast = Min(Max(aContrast,-100),100); + } + +TInt CTestCamera::Contrast() const + { + return iContrast; + } + +void CTestCamera::SetBrightnessL(TInt aBrightness) + { + CheckReserveAndPowerL(); + + iBrightness = Min(Max(aBrightness,-100),100); + } + +TInt CTestCamera::Brightness() const + { + return iBrightness; + } + +void CTestCamera::SetFlashL(TFlash aFlash) + { + CheckReserveAndPowerL(); + + if (aFlash != EFlashNone) + { + User::Leave(KErrNotSupported); + } + } + +CCamera::TFlash CTestCamera::Flash() const + { + return EFlashNone; + } + +void CTestCamera::SetExposureL(TExposure aExposure) + { + CheckReserveAndPowerL(); + + if (aExposure != EExposureAuto) + { + User::Leave(KErrNotSupported); + } + } + +CCamera::TExposure CTestCamera::Exposure() const + { + return EExposureAuto; + } + +void CTestCamera::SetWhiteBalanceL(TWhiteBalance aWhiteBalance) + { + CheckReserveAndPowerL(); + + if (aWhiteBalance != EWBAuto) + { + User::Leave(KErrNotSupported); + } + } + +CCamera::TWhiteBalance CTestCamera::WhiteBalance() const + { + return EWBAuto; + } + +void CTestCamera::StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect) + { + TRect emptyRect; + StartViewFinderDirectL(aWs,aScreenDevice,aWindow,aScreenRect,emptyRect); + } + +void CTestCamera::StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect) + { + if (!iReserved) + { + User::Leave(KErrInUse); + } + + if (!iPowerOn || iViewFinderActive) + { + User::Leave(KErrNotReady); + } + + iScreenRect = aScreenRect; + iClipRect = aClipRect; + + delete iDSA; + iDSA = NULL; + iViewFinderActive = EFalse; + iDSA = CDirectScreenAccess::NewL(aWs,aScreenDevice,aWindow,*this); + iDSA->StartL(); + iViewFinderActive = ETrue; + iDSA->Gc()->SetOrigin(); // Set Origin to top left of screen (0,0) + + if (!iClipRect.IsEmpty()) + { + iDSA->Gc()->SetClippingRect(iClipRect); + } + } + +void CTestCamera::StartViewFinderBitmapsL(TSize& aSize) + { + TRect emptyRect; + StartViewFinderBitmapsL(aSize,emptyRect); + } + +void CTestCamera::StartViewFinderBitmapsL(TSize& aSize, TRect& aClipRect) + { + if (!iReserved) + { + User::Leave(KErrInUse); + } + if (!iPowerOn || iViewFinderActive) + { + User::Leave(KErrNotReady); + } + + iViewFinderActive = ETrue; + iScreenRect = TRect(TPoint(0,0), aSize); + iClipRect = aClipRect; + iClipRect.Intersection(iScreenRect); + + delete iViewFinderBitmapGc; + iViewFinderBitmapGc = NULL; + delete iViewFinderBitmapDev; + iViewFinderBitmapDev = NULL; + delete iViewFinderBitmap; + iViewFinderBitmap = NULL; + + iViewFinderBitmap = new(ELeave) CFbsBitmap; + if (!iClipRect.IsEmpty()) + { + User::LeaveIfError(iViewFinderBitmap->Create(iClipRect.Size(), KViewFinderDisplayMode)); + } + else + { + User::LeaveIfError(iViewFinderBitmap->Create(aSize, KViewFinderDisplayMode)); + } + iViewFinderBitmapDev = CFbsBitmapDevice::NewL(iViewFinderBitmap); + User::LeaveIfError(iViewFinderBitmapDev->CreateContext(iViewFinderBitmapGc)); + } + +void CTestCamera::StartViewFinderL(TFormat aImageFormat,TSize& aSize) + { + TRect emptyRect; + StartViewFinderL(aImageFormat,aSize,emptyRect); + } + +void CTestCamera::StartViewFinderL(TFormat aImageFormat,TSize& /*aSize*/,TRect& aClipRect) + { + if(!iReserved) + { + User::Leave(KErrInUse); + } + if(!iPowerOn || iViewFinderActive) + { + User::Leave(KErrNotReady); + } + + iViewFinderActive = ETrue; + iClipRect = aClipRect; + if(!(aImageFormat & iInfo.iImageFormatsSupported)) + { + User::Leave(KErrNotSupported); + } + } + + +void CTestCamera::StopViewFinder() + { + iViewFinderActive = EFalse; + delete iDSA; + iDSA = NULL; + + delete iViewFinderBitmapGc; + iViewFinderBitmapGc = NULL; + delete iViewFinderBitmapDev; + iViewFinderBitmapDev = NULL; + delete iViewFinderBitmap; + iViewFinderBitmap = NULL; + } + +TBool CTestCamera::ViewFinderActive() const + { + return iViewFinderActive; + } + +void CTestCamera::SetViewFinderMirrorL(TBool aMirror) + { + if (aMirror) + { + User::Leave(KErrNotSupported); + } + } + +TBool CTestCamera::ViewFinderMirror() const + { + return EFalse; + } + +void CTestCamera::PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex) + { + if (!iReserved) + { + User::Leave(KErrInUse); + } + + if (!iPowerOn || iVideoCaptureActive || iImageCaptureActive) + { + User::Leave(KErrNotReady); + } + + + if (!(aImageFormat & iInfo.iImageFormatsSupported) || aSizeIndex < 0 + || aSizeIndex >= iInfo.iNumImageSizesSupported) + { + User::Leave(KErrNotSupported); + } + + iVideoPreparedLast = EFalse; + + if (iImageCapturePrepared + && iStillImageSize == iImageSizes[aSizeIndex] + && iStillImageFormat == aImageFormat) + { + return; + } + + iStillImageSize = iImageSizes[aSizeIndex]; + iStillImageFormat = aImageFormat; + + TDisplayMode displayMode = ENone; + switch (iStillImageFormat) + { + case EFormatFbsBitmapColor4K : + displayMode = EColor4K; + break; + case EFormatFbsBitmapColor64K : + displayMode = EColor64K; + break; + case EFormatFbsBitmapColor16M : + displayMode = EColor16M; + break; + default : + User::Leave(KErrNotSupported); + break; + } + + delete iStillImageGc; + iStillImageGc = NULL; + delete iStillImageDev; + iStillImageDev = NULL; + delete iStillImage; + iStillImage = NULL; + + iStillImage = new(ELeave) CFbsBitmap; + User::LeaveIfError(iStillImage->Create(iStillImageSize, displayMode)); + iStillImageDev = CFbsBitmapDevice::NewL(iStillImage); + User::LeaveIfError(iStillImageDev->CreateContext(iStillImageGc)); + iStillImageGc->SetPenColor(KRgbBlack); + iStillImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); + iStillImageGc->SetBrushColor(KRgbWhite); + iStillImageGc->SetFaded(ETrue); + iImageCapturePrepared = ETrue; + } + +void CTestCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) + { + User::Leave(KErrNotSupported); + } + +void CTestCamera::CaptureImage() + { + if (!iReserved) + { + iStillCaptureErr = KErrInUse; + } + + if (!iPowerOn || iImageCaptureActive || iVideoCaptureActive || !iImageCapturePrepared) + { + iStillCaptureErr = KErrNotReady; + } + + if (iStillCaptureErr == KErrNone) + { + TRAP(iStillCaptureErr,DoCaptureImageL()); + } + + if (iStillCaptureErr == KErrNone) + { + iImageCaptureActive = ETrue; + } + else + { + iImageCaptureAsync.CallBack(); + } + } + +void CTestCamera::DoCaptureImageL() + { + delete iGc; + iGc = NULL; + delete iDev; + iDev = NULL; + delete iImage; + iImage = NULL; + + CFbsBitmap* image = new(ELeave) CFbsBitmap; + CleanupStack::PushL(image); + User::LeaveIfError(image->Create(iStillImageSize, iStillImage->DisplayMode())); + CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(image); + CleanupStack::PushL(dev); + CFbsBitGc* gc = NULL; + User::LeaveIfError(dev->CreateContext(gc)); + CleanupStack::Pop(dev); + CleanupStack::Pop(image); + + iImage = image; + iDev = dev; + iGc = gc; + } + +void CTestCamera::CancelCaptureImage() + { + iImageCaptureActive = EFalse; + } + +void CTestCamera::EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const + { + if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumImageSizesSupported || + !(aFormat & iInfo.iImageFormatsSupported) ) + { + aSize = TSize(0,0); + } + else + { + aSize = iImageSizes[aSizeIndex]; + } + } + +void CTestCamera::PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer) + { + if (!iReserved) + { + User::Leave(KErrInUse); + } + + if (!iPowerOn || iVideoCaptureActive || iImageCaptureActive) + { + User::Leave(KErrNotReady); + } + + if (!(aFormat & iInfo.iVideoFrameFormatsSupported) + || aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported + || aRateIndex < 0 || aRateIndex >= iInfo.iNumVideoFrameRatesSupported + || aBuffersToUse != 2 || aFramesPerBuffer != 1) + { + User::Leave(KErrNotSupported); + } + + iVideoPreparedLast = ETrue; + + if (iVideoCapturePrepared + && iVideoFrameSize == iVideoFrameSizes[aSizeIndex] + && iVideoFrameFormat == aFormat) + { + return; + } + + TDisplayMode displayMode = ENone; + switch (aFormat) + { + case EFormatFbsBitmapColor4K : + displayMode = EColor4K; + break; + case EFormatFbsBitmapColor64K : + displayMode = EColor64K; + break; + case EFormatFbsBitmapColor16M : + displayMode = EColor16M; + break; + default : + User::Leave(KErrNotSupported); + break; + } + + iVideoFrameSize = iVideoFrameSizes[aSizeIndex]; + iVideoFrameRate = iVideoFrameRates[aRateIndex]; + iVideoFrameFormat = aFormat; + iBuffersInUse = aBuffersToUse; + + delete iVideoFrameGc1; + iVideoFrameGc1 = NULL; + delete iVideoFrameDev1; + iVideoFrameDev1 = NULL; + delete iVideoFrame1; + iVideoFrame1 = NULL; + + delete iVideoFrameGc2; + iVideoFrameGc2 = NULL; + delete iVideoFrameDev2; + iVideoFrameDev2 = NULL; + delete iVideoFrame2; + iVideoFrame2 = NULL; + + iVideoFrame1 = new(ELeave) CFbsBitmap; + User::LeaveIfError(iVideoFrame1->Create(iVideoFrameSize, displayMode)); + iVideoFrameDev1 = CFbsBitmapDevice::NewL(iVideoFrame1); + User::LeaveIfError(iVideoFrameDev1->CreateContext(iVideoFrameGc1)); + iVideoFrameGc1->SetPenColor(KRgbBlack); + iVideoFrameGc1->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); + iVideoFrameGc1->SetBrushColor(KRgbWhite); + iVideoFrameGc1->SetFaded(ETrue); + + if (iBuffersInUse == 2) + { + iVideoFrame2 = new(ELeave) CFbsBitmap; + User::LeaveIfError(iVideoFrame2->Create(iVideoFrameSize, displayMode)); + iVideoFrameDev2 = CFbsBitmapDevice::NewL(iVideoFrame2); + User::LeaveIfError(iVideoFrameDev1->CreateContext(iVideoFrameGc2)); + iVideoFrameGc2->SetPenColor(KRgbBlack); + iVideoFrameGc2->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); + iVideoFrameGc2->SetBrushColor(KRgbWhite); + iVideoFrameGc2->SetFaded(ETrue); + } + + iVideoCapturePrepared = ETrue; + } + +void CTestCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) + { + User::Leave(KErrNotSupported); + } + +void CTestCamera::StartVideoCapture() + { + if (!iReserved) + { + iVideoCaptureErr = KErrInUse; + } + + if (!iPowerOn || iImageCaptureActive || iVideoCaptureActive || !iVideoCapturePrepared) + { + iVideoCaptureErr = KErrNotReady; + } + + if (iVideoCaptureErr == KErrNone) + { + iVideoCaptureActive = ETrue; + } + + else + { + iVideoCaptureAsync.CallBack(); + } + } + +void CTestCamera::StopVideoCapture() + { + iVideoCaptureActive = EFalse; + iFrameIndex = 0; + iElapsedTime = 0; + } + +TBool CTestCamera::VideoCaptureActive() const + { + return iVideoCaptureActive; + } + +void CTestCamera::EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const + { + if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported || + !(aFormat & iInfo.iVideoFrameFormatsSupported)) + { + aSize = TSize(0,0); + } + else + { + aSize = iVideoFrameSizes[aSizeIndex]; + } + } + +void CTestCamera::EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure) const + { + if (aRateIndex < 0 || aRateIndex >= iInfo.iNumVideoFrameRatesSupported || + aSizeIndex < 0 || aSizeIndex >= iInfo.iNumVideoFrameSizesSupported || + !(aFormat & iInfo.iVideoFrameFormatsSupported) || + (!(aExposure & iInfo.iExposureModesSupported) && aExposure != CCamera::EExposureAuto)) + { + aRate = 0.0; + } + else + { + aRate = iVideoFrameRates[aRateIndex]; + } + } + +void CTestCamera::GetFrameSize(TSize& aSize) const + { + aSize = iVideoFrameSize; + } + +TReal32 CTestCamera::FrameRate() const + { + return iVideoFrameRate; + } + +TInt CTestCamera::BuffersInUse() const + { + return iBuffersInUse; + } + +TInt CTestCamera::FramesPerBuffer() const + { + return 1; + } + +void CTestCamera::SetJpegQuality(TInt /*aQuality*/) + { + } + +TInt CTestCamera::JpegQuality() const + { + return 0; + } + +TAny* CTestCamera::CustomInterface(TUid aInterface) + { + TAny* ptrIface = NULL; + TRAPD(error,CustomInterfaceL(ptrIface, aInterface)); + + if(error == KErrNone) + { + switch(aInterface.iUid) + { + // advanced settings interface pointers + case KECamMCameraAdvancedSettingsUidValue: + { + return static_cast(ptrIface); + } + case KECamMCameraAdvancedSettings2UidValue: + { + return static_cast(ptrIface); + } + case KECamMCameraAdvancedSettings3UidValue: + { + return static_cast(ptrIface); + } + + // snapshot interface pointers + case KECamMCameraSnapshotUidValue: + { + return static_cast(ptrIface); + } + + // preset interface pointers + case KECamMCameraPresetsUidValue: + return static_cast(ptrIface); + + // image processing interface pointers + case KECamMCameraImageProcessingUidValue: + { + return static_cast(ptrIface); + } + + case KECamMCameraImageProcessing2UidValue: + { + return static_cast(ptrIface); + } + + default: + return NULL; + } + } + else + { + return NULL; + } + } + +void CTestCamera::CustomInterfaceL(TAny*& aIface, TUid aInterface) + { + switch(aInterface.iUid) + { + // advanced settings interface pointers + case KECamMCameraAdvancedSettingsUidValue: + { + iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); + aIface = static_cast(iAdvSettingsImpl); + break; + } + case KECamMCameraAdvancedSettings2UidValue: + { + iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); + aIface = static_cast(iAdvSettingsImpl); + break; + } + case KECamMCameraAdvancedSettings3UidValue: + { + iAdvSettingsImpl = CTestCamAdvSet::NewL(*this); + aIface = static_cast(iAdvSettingsImpl); + break; + } + + // snapshot interface pointers + case KECamMCameraSnapshotUidValue: + { + iSnapshotImpl = CTestCamSnapshot::NewL(*this); + aIface = static_cast(iSnapshotImpl); + break; + } + // preset interface pointers + case KECamMCameraPresetsUidValue: + { + aIface = static_cast(CTestCamPresets::NewL(*this)); + break; + } + + // image processing interface pointers + case KECamMCameraImageProcessingUidValue: + { + iImgProcImpl = CTestCamImgProc::NewL(*this); + aIface = static_cast(iImgProcImpl); + break; + } + + case KECamMCameraImageProcessing2UidValue: + { + iImgProcImpl = CTestCamImgProc::NewL(*this); + aIface = static_cast(iImgProcImpl); + break; + } + + default: + aIface = NULL; + } + } + +void CTestCamera::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + iViewFinderActive = EFalse; + } + +void CTestCamera::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + TRAPD(error,iDSA->StartL()); + if (error != KErrNone) + { + return; + } + iDSA->Gc()->SetOrigin(); // Set Origin to top left of screen (0,0) + + if (!iClipRect.IsEmpty()) + { + iDSA->Gc()->SetClippingRect(iClipRect); + } + else + { + iDSA->Gc()->CancelClippingRect(); + } + + iViewFinderActive = ETrue; + } + +TInt CTestCamera::TimerCallBack(TAny* aThis) + { + static_cast(aThis)->FrameReady(); + return KErrNone; + } + +void CTestCamera::FrameReady() + { + if (iVideoPreparedLast) + { + iVideoFramePos.iX += KFramePosIncrement; + iVideoFramePos.iY += KFramePosIncrement; + + if (iVideoFramePos.iX >= iVideoFrameSize.iWidth) + { + iVideoFramePos.iX = 0; + } + + if (iVideoFramePos.iY >= iVideoFrameSize.iHeight) + { + iVideoFramePos.iY = 0; + } + } + else + { + iStillImagePos.iX += KFramePosIncrement; + iStillImagePos.iY += KFramePosIncrement; + + if (iStillImagePos.iX >= iStillImageSize.iWidth) + { + iStillImagePos.iX = 0; + } + + if (iStillImagePos.iY >= iStillImageSize.iHeight) + { + iStillImagePos.iY = 0; + } + } + + if (iImageCaptureActive) + { + if (!iImageCapturePrepared) + { + iImageCaptureActive = EFalse; + if (iObserver2) + { + iObserver2->ImageBufferReady(iFrameCameraBuffer1,KErrNotReady); + } + else + { + iObserver->ImageReady(NULL,NULL,KErrNotReady); + } + } + else + { + if(iDriveMode == CCamera::CCameraAdvancedSettings::EDriveModeBurst) + { + for (TInt index =0; index < iBurstImages -1; index++) + { + if(iSnapshotImpl != NULL) + { + if(iSnapshotImpl->iSnapshotActive) + { + GetFrame(*(iSnapshotImpl->iSnapshotImageGc), iStillImagePos); + iSnapshotImpl->ServiceBurstImageSnapshot(*(iSnapshotImpl->iSnapshotImageGc)); + } + } + + GetImgProcessedFrame(*iStillImageGc, iStillImagePos); + ServiceBurstImageCapture(*iStillImageGc); + } + } + + // normal case, single shot and last image from burst mode + if(iSnapshotImpl != NULL) + { + if(iSnapshotImpl->iSnapshotActive) + { + GetFrame(*iSnapshotImpl->iSnapshotImageGc, iStillImagePos); + iSnapshotImpl->ServiceSnapshot(*(iSnapshotImpl->iSnapshotImageGc)); + } + } + + GetImgProcessedFrame(*iStillImageGc, iStillImagePos); + ServiceImageCapture(*iStillImageGc); + + if (iVideoPreparedLast) + { + GetFrame(*iVideoFrameGc1, iVideoFramePos); + if (iViewFinderActive) + { + ServiceViewFinder(iVideoFrame1); + } + } + else + { + if (iViewFinderActive) + { + ServiceViewFinder(iStillImage); + } + } + } + } + + else if (iVideoCaptureActive) + { + if (!iVideoCapturePrepared) + { + iVideoCaptureActive = EFalse; + if (iObserver2) + { + iObserver2->VideoBufferReady(iFrameCameraBuffer1,KErrNotReady); + } + else + { + iObserver->FrameBufferReady(NULL,KErrNotReady); + } + } + else + { + if (iObserver2) + { + if (iFrameCameraBuffer1.iAvailable) + { + GetFrame(*iVideoFrameGc1, iVideoFramePos); + ServiceVideo(1); + if (iViewFinderActive) + { + ServiceViewFinder(iVideoFrame1); + } + } + else if (iFrameCameraBuffer2.iAvailable && iBuffersInUse == 2) + { + GetFrame(*iVideoFrameGc2, iVideoFramePos); + ServiceVideo(2); + if (iViewFinderActive) + { + ServiceViewFinder(iVideoFrame2); + } + } + } + else + { + if (iFrameBuffer1.iAvailable) + { + GetFrame(*iVideoFrameGc1, iVideoFramePos); + ServiceVideo(1); + if (iViewFinderActive) + { + ServiceViewFinder(iVideoFrame1); + } + } + else if (iFrameBuffer2.iAvailable && iBuffersInUse == 2) + { + GetFrame(*iVideoFrameGc2, iVideoFramePos); + ServiceVideo(2); + if (iViewFinderActive) + { + ServiceViewFinder(iVideoFrame2); + } + } + } + } + } + + else if (iViewFinderActive) + { + if (iVideoPreparedLast) + { + GetFrame(*iVideoFrameGc1, iVideoFramePos); + ServiceViewFinder(iVideoFrame1); + } + else + { + GetFrame(*iStillImageGc, iStillImagePos); + ServiceViewFinder(iStillImage); + } + } + } + +void CTestCamera::GetFrame(CFbsBitGc& aGc, TPoint& aPos) const + { + TInt black = (100 - iContrast) * 127 / 200; + TInt white = ((100 + iContrast) * 128 / 200) + 127; + + const TInt brightAdjust = iBrightness * 255 / 100; + black += brightAdjust; + white += brightAdjust; + + black = Min(Max(black,0),255); + white = Min(Max(white,0),255); + + aGc.SetFadingParameters(TUint8(black),TUint8(white)); + aGc.Clear(); + aGc.DrawRect(TRect(aPos,TSize(KFrameFeatureSize,KFrameFeatureSize))); + } + +void CTestCamera::GetImgProcessedFrame(CFbsBitGc& aGc, TPoint& aPos) const + { + TInt contrast = iContrast; + TInt brightness = iBrightness; + + if(iImgProcImpl != NULL) + { + for(TInt index=0; indexiActiveTransformations.Count(); index++) + { + switch(iImgProcImpl->iActiveTransformations[index].iUid) + { + case KUidECamEventImageProcessingAdjustBrightnessUidValue: + { + brightness = iImgProcBrightness; + break; + } + case KUidECamEventImageProcessingAdjustContrastUidValue: + { + contrast = iImgProcContrast; + break; + } + default: + { + break; + } + } + } + } + + TInt black = (100 - contrast) * 127 / 200; + TInt white = ((100 + contrast) * 128 / 200) + 127; + + const TInt brightAdjust = brightness * 255 / 100; + black += brightAdjust; + white += brightAdjust; + + black = Min(Max(black,0),255); + white = Min(Max(white,0),255); + + aGc.SetFadingParameters(TUint8(black),TUint8(white)); + aGc.Clear(); + aGc.DrawRect(TRect(aPos,TSize(KFrameFeatureSize,KFrameFeatureSize))); + } + +void CTestCamera::ServiceVideo(TInt aBufferNum) + { + iFrameIndex++; + iElapsedTime = iElapsedTime.Int64() + (TInt64(1000000) / TInt64(iVideoFrameRate)); + + if (aBufferNum == 1) + { + if (iObserver2) + { + iFrameCameraBuffer1.iIndexOfFirstFrameInBuffer = iFrameIndex; + iFrameCameraBuffer1.iElapsedTime = iElapsedTime; + iFrameCameraBuffer1.iAvailable = EFalse; + } + else + { + iFrameBuffer1.iIndexOfFirstFrameInBuffer = iFrameIndex; + iFrameBuffer1.iElapsedTime = iElapsedTime; + iFrameBuffer1.iAvailable = EFalse; + } + + if (iObserver2) + { + iObserver2->VideoBufferReady(iFrameCameraBuffer1,KErrNone); + } + else + { + iObserver->FrameBufferReady(&iFrameBuffer1,KErrNone); + } + } + else if (aBufferNum == 2) + { + if (iObserver2) + { + iFrameCameraBuffer2.iIndexOfFirstFrameInBuffer = iFrameIndex; + iFrameCameraBuffer2.iElapsedTime = iElapsedTime; + iFrameCameraBuffer2.iAvailable = EFalse; + } + else + { + iFrameBuffer2.iIndexOfFirstFrameInBuffer = iFrameIndex; + iFrameBuffer2.iElapsedTime = iElapsedTime; + iFrameBuffer2.iAvailable = EFalse; + } + + if (iObserver2) + { + iObserver2->VideoBufferReady(iFrameCameraBuffer2,KErrNone); + } + else + { + iObserver->FrameBufferReady(&iFrameBuffer2,KErrNone); + } + } + } + +void CTestCamera::ServiceViewFinder(CFbsBitmap* aSourceFrame) + { + if (iDSA) + { + iDSA->Gc()->DrawBitmap(iScreenRect,aSourceFrame); + iDSA->ScreenDevice()->Update(); + } + else if (iViewFinderBitmap) + { + if (iViewFinderBitmapGc) + { + if (!iClipRect.IsEmpty()) + { + TReal32 xRatio = static_cast(aSourceFrame->SizeInPixels().iWidth) / + static_cast(iClipRect.Size().iWidth); + + TReal32 yRatio = static_cast(aSourceFrame->SizeInPixels().iHeight) / + static_cast(iClipRect.Size().iHeight); + + TRect sourceRect(TPoint(static_cast(xRatio*iClipRect.iTl.iX), + static_cast(yRatio*iClipRect.iTl.iY)), + TPoint(static_cast(xRatio*iClipRect.iBr.iX), + static_cast(yRatio*iClipRect.iBr.iY))); + + TRect destRect(TPoint(0,0), iClipRect.Size()); + + iViewFinderBitmapGc->DrawBitmap(destRect, + aSourceFrame, + sourceRect); + } + else + { + TRect destRect(TPoint(0,0), iViewFinderBitmap->SizeInPixels()); + iViewFinderBitmapGc->DrawBitmap(destRect, aSourceFrame); + } + + if (iObserver2) + { + iObserver2->ViewFinderReady(iFrameCameraBuffer1,KErrNone); + } + else + { + iObserver->ViewFinderFrameReady(*iViewFinderBitmap); + } + + } + } + else + { + iScreenGc->DrawBitmap(iClipRect,aSourceFrame); + iScreenDev->Update(); + } + } + +void CTestCamera::ServiceImageCapture(const CFbsBitGc& aSourceBitmapGc) + { + iImageCaptureActive = EFalse; + iGc->BitBlt(TPoint(0,0), aSourceBitmapGc); + CFbsBitmap* image = iImage; + RTestCameraFrameBuffer frameBuffer(image); + delete iGc; + iGc = NULL; + delete iDev; + iDev = NULL; + if (iObserver2 != NULL) + { + iObserver2->ImageBufferReady(frameBuffer,KErrNone); + } + else + { + iImage = NULL; + iObserver->ImageReady(image,NULL,KErrNone); + } + } + +void CTestCamera::ServiceBurstImageCapture(const CFbsBitGc& aSourceBitmapGc) + { + iGc->BitBlt(TPoint(0,0), aSourceBitmapGc); + if (iObserver2 != NULL) + { + CFbsBitmap* image = iImage; + RTestCameraFrameBuffer frameBuffer(image); + iObserver2->ImageBufferReady(frameBuffer,KErrNone); + } + else//not for MCameraObserver + { + return; + } + + if(iSnapshotImpl) + { + if(iSnapshotImpl->iSnapshotActive) + { + return; + } + } + User::After(500000); + iStillImagePos.iX += KFramePosIncrement; + iStillImagePos.iY += KFramePosIncrement; + + if (iStillImagePos.iX >= iStillImageSize.iWidth) + { + iStillImagePos.iX = 0; + } + + if (iStillImagePos.iY >= iStillImageSize.iHeight) + { + iStillImagePos.iY = 0; + } + } + +void CTestCamera::CheckReserveAndPowerL() + { + if (!iReserved) + { + User::Leave(KErrInUse); + } + + if (!iPowerOn) + { + User::Leave(KErrNotReady); + } + } + +TInt CTestCamera::CheckReserveAndPower() const + { + if (!iReserved) + { + return KErrInUse; + } + + if (!iPowerOn) + { + return KErrNotReady; + } + + return KErrNone; + } + +TInt CTestCamera::ReserveCallBack(TAny* aThis) + { + const TECAMEvent event(KUidECamEventReserveComplete,KErrNone); + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->HandleEvent(event); + } + else + { + testCamera->iObserver->ReserveComplete(KErrNone); + } + return KErrNone; + } + +TInt CTestCamera::PowerOnCallBack(TAny* aThis) + { + TECAMEvent event(KUidECamEventPowerOnComplete,KErrNone); + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->HandleEvent(event); + } + else + { + testCamera->iObserver->PowerOnComplete(testCamera->iPowerOn ? KErrNone : KErrInUse); + } + return KErrNone; + } + +TInt CTestCamera::ImageCaptureCallBack(TAny* aThis) + { + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->ImageBufferReady((static_cast(aThis))->iFrameCameraBuffer1,testCamera->iStillCaptureErr); + } + else + { + testCamera->iObserver->ImageReady(NULL,NULL,testCamera->iStillCaptureErr); + } + testCamera->iStillCaptureErr = KErrNone; + return KErrNone; + } + +TInt CTestCamera::VideoCaptureCallBack(TAny* aThis) + { + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->VideoBufferReady((static_cast(aThis))->iFrameCameraBuffer1,testCamera->iVideoCaptureErr); + } + else + { + testCamera->iObserver->FrameBufferReady(NULL,testCamera->iVideoCaptureErr); + } + testCamera->iVideoCaptureErr = KErrNone; + return KErrNone; + } + +TInt CTestCamera::HandleEventCallBack(TAny* aThis) + { + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->HandleEvent(testCamera->iECamEvent); + } + + return KErrNone; + } + +TInt CTestCamera::HandleEvent2CallBack(TAny* aThis) + { + CTestCamera* testCamera = static_cast(aThis); + if (testCamera->iObserver2) + { + testCamera->iObserver2->HandleEvent(testCamera->iECamEvent2); + } + + return KErrNone; + } + +// +// CTestCameraInfo +// + +CTestCameraInfo::CTestCameraInfo() + { + } + +CTestCameraInfo::~CTestCameraInfo() + { + } + +CTestCameraInfo* CTestCameraInfo::NewL() + { + FileDependencyUtil::CheckFileDependencyL(); + return new (ELeave) CTestCameraInfo; + } + +TInt CTestCameraInfo::CamerasAvailable() + { + return 1; + } + +//void CTestCamera::CheckFileDependencyL() +void FileDependencyUtil::CheckFileDependencyL() + { + RFs fsSession; + RFile file; + CleanupClosePushL(fsSession); + User::LeaveIfError(fsSession.Connect()); + TInt err = file.Open(fsSession, KTestCameraPluginName, EFileRead); + file.Close(); + if(err != KErrNone) + { + User::LeaveIfError(KErrNotSupported); + } + CleanupStack::PopAndDestroy(); //fsSession + } + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraTestPlugin, CTestCamera::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardCameraTestInfo, CTestCameraInfo::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/TestCamera.h --- a/mmplugins/cameraplugins/source/testcamera/TestCamera.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/TestCamera.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,318 +1,318 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef __TESTCAMERA_H__ -#define __TESTCAMERA_H__ - - -#include -#include -#include -#include -#include -#include - -_LIT(KTestCameraPluginName, "C:\\102070cc.txt"); - -const TInt KMinTestCameraZoom = -3; -const TInt KMaxTestCameraZoom = 3; -const TReal32 KMaxTestCameraDigitalZoomFactor = 1.0; -const TInt KMaxTestCameraDigitalZoom = 0; -const TInt KFramePosIncrement = 5; -const TInt KFrameFeatureSize = 25; -const TInt KFrameFeatureBorderThickness = 5; -const enum CCamera::TFormat KInitialViewFinderFormat = CCamera::EFormatFbsBitmapColor16M; -const TDisplayMode KViewFinderDisplayMode = EColor4K; - -class CTestCamAdvSet; -class CTestCamPresets; -class CTestCamSnapshot; -class CTestCamImgProc; - -class RTestCameraFrameBuffer : public MCameraBuffer - { -public: - RTestCameraFrameBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} - virtual TInt NumFrames() {return 0;} - virtual TDesC8* DataL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return NULL; } - virtual CFbsBitmap& BitmapL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return *iFrame;} - virtual RChunk& ChunkL() { return iChunk;} - virtual TInt ChunkOffsetL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0;} - virtual TInt FrameSize(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0; } - virtual void Release() {iAvailable = ETrue;} -public: - volatile TBool iAvailable; - CFbsBitmap*& iFrame; - RChunk iChunk; - }; - -class RTestFrameBuffer : public MFrameBuffer - { -public: - RTestFrameBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} - virtual TDesC8* DataL(TInt /*aIndex*/) { User::Leave(KErrNotSupported); return NULL; } - virtual CFbsBitmap* FrameL(TInt aIndex) { if (aIndex != 0) User::Leave(KErrNotSupported); return iFrame; } - virtual void Release() { iAvailable = ETrue; } -public: - TBool iAvailable; - CFbsBitmap*& iFrame; - }; - -class CDirectScreenAccess; - -class CTestCamera : public CCameraPlugin, public MDirectScreenAccess - { - friend class CTestCamAdvSet; - friend class CTestCamPresets; - friend class CTestCamSnapshot; - friend class CTestCamImgProc; - -public: - static CTestCamera* NewL(); - ~CTestCamera(); - void ConstructL(); - // from CCameraPlugin - void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); - void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); - void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); - void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); -private: - // From CCamera - virtual void CameraInfo(TCameraInfo& aInfo) const; - virtual void Reserve(); - virtual void Release(); - virtual void PowerOn(); - virtual void PowerOff(); - virtual TInt Handle(); - - virtual void SetZoomFactorL(TInt aZoomFactor = 0); - virtual TInt ZoomFactor() const; - virtual void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); - virtual TInt DigitalZoomFactor() const; - - virtual void SetContrastL(TInt aContrast); - virtual TInt Contrast() const; - virtual void SetBrightnessL(TInt aBrightness); - virtual TInt Brightness() const; - virtual void SetFlashL(TFlash aFlash = EFlashNone); - virtual TFlash Flash() const; - virtual void SetExposureL(TExposure aExposure = EExposureAuto); - virtual TExposure Exposure() const; - virtual void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); - virtual TWhiteBalance WhiteBalance() const; - - virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); - virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); - virtual void StartViewFinderBitmapsL(TSize& aSize); - virtual void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); - virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize); - virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); - virtual void StopViewFinder(); - virtual TBool ViewFinderActive() const; - virtual void SetViewFinderMirrorL(TBool aMirror); - virtual TBool ViewFinderMirror() const; - - virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); - virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); - virtual void CaptureImage(); - virtual void CancelCaptureImage(); - virtual void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - - virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); - virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); - virtual void StartVideoCapture(); - virtual void StopVideoCapture(); - - virtual TBool VideoCaptureActive() const; - virtual void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - virtual void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; - virtual void GetFrameSize(TSize& aSize) const; - virtual TReal32 FrameRate() const; - virtual TInt BuffersInUse() const; - virtual TInt FramesPerBuffer() const; - - virtual void SetJpegQuality(TInt aQuality); - virtual TInt JpegQuality() const; - - virtual TAny* CustomInterface(TUid aInterface); - - // From MAbortDirectScreenAccess - virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); - - // From MDirectScreenAccess - virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason); - - // New functions - static TInt TimerCallBack(TAny* aThis); - void FrameReady(); - void GetFrame(CFbsBitGc& aGc, TPoint& aPos) const; - void GetImgProcessedFrame(CFbsBitGc& aGc, TPoint& aPos) const; - void ServiceVideo(TInt aBuferNum); - void ServiceViewFinder(CFbsBitmap* aSourceFrame); - void ServiceImageCapture(const CFbsBitGc& aSourceBitmapGc); - void ServiceBurstImageCapture(const CFbsBitGc& aSourceBitmapGc); - void DoCaptureImageL(); - void CheckReserveAndPowerL(); - TInt CheckReserveAndPower() const; - void CustomInterfaceL(TAny*& aIface, TUid aInterface); - static TInt ReserveCallBack(TAny* aThis); - static TInt PowerOnCallBack(TAny* aThis); - static TInt ImageCaptureCallBack(TAny* aThis); - static TInt VideoCaptureCallBack(TAny* aThis); - static TInt HandleEventCallBack(TAny* aThis); - static TInt HandleEvent2CallBack(TAny* aThis); - -private: - CTestCamera(); -private: - MCameraObserver* iObserver; // not owned - MCameraObserver2* iObserver2; // not owned - TBool iReserved; - TBool iPowerOn; - - TCameraInfo iInfo; - CPeriodic* iTimer; - TTimeIntervalMicroSeconds32 iFrameDelay; - TInt iFrameIndex; - TTimeIntervalMicroSeconds iElapsedTime; - TPoint iStillImagePos; - TPoint iVideoFramePos; - - TReal32 iVideoFrameRate; - TInt iBuffersInUse; - TSize iVideoFrameSize; - TFormat iVideoFrameFormat; - - CFbsBitmap* iVideoFrame1; - CFbsBitmapDevice* iVideoFrameDev1; - CFbsBitGc* iVideoFrameGc1; - CFbsBitmap* iVideoFrame2; - CFbsBitmapDevice* iVideoFrameDev2; - CFbsBitGc* iVideoFrameGc2; - - TInt iStillCaptureErr; - TSize iStillImageSize; - TFormat iStillImageFormat; - CFbsBitmap* iStillImage; - CFbsBitmapDevice* iStillImageDev; - CFbsBitGc* iStillImageGc; - - TSize iViewFinderSize; - TFormat iViewFinderFormat; - CFbsBitmap* iViewFinderBitmap; - CFbsBitmapDevice* iViewFinderBitmapDev; - CFbsBitGc* iViewFinderBitmapGc; - - CDirectScreenAccess* iDSA; - CFbsScreenDevice* iScreenDev; - CFbsBitGc* iScreenGc; - TRect iScreenRect; - TRect iClipRect; - - CFbsBitmap* iImage; - CFbsBitmapDevice* iDev; - CFbsBitGc* iGc; - - CAsyncCallBack iReserveAsync; - CAsyncCallBack iPowerOnAsync; - CAsyncCallBack iImageCaptureAsync; - CAsyncCallBack iVideoCaptureAsync; - CAsyncCallBack iHandleEventAsync; - CAsyncCallBack iHandleEvent2Async; - - RTestFrameBuffer iFrameBuffer1; - RTestFrameBuffer iFrameBuffer2; - - RTestCameraFrameBuffer iFrameCameraBuffer1; - RTestCameraFrameBuffer iFrameCameraBuffer2; - - TInt iVideoCaptureErr; - // Members to store the current optical or digital value set with SetZoomFactorL() and SetDigitalZoomFactorL() - // Although arguments have trailing Factor in fact they must contain values in the ranges specified by - // iInfo.iMinZoom : iInfo.iMaxZoom for optical zoom and - // 0 : iInfo.iMaxDigitalZoom for digital zoom - // The factor values cannot be modified using Camera API as it is assumed - // that they are determined by the camera hardware. - TInt iZoom; - TInt iDigitalZoom; - - TInt iContrast; - TInt iBrightness; - - TInt iImgProcBrightness; - TInt iImgProcContrast; - - volatile TBool iViewFinderActive; - volatile TBool iVideoCaptureActive; - volatile TBool iImageCaptureActive; - volatile TBool iVideoPreparedLast; - volatile TBool iVideoCapturePrepared; - volatile TBool iImageCapturePrepared; - - RArray iImageSizes; - RArray iVideoFrameSizes; - RArray iVideoFrameRates; - TInt iCameraIndex; - TInt iCameraHandle; - TInt iPriority; - - TECAMEvent iECamEvent; - TECAMEvent2 iECamEvent2; - TInt iEventError; - - CTestCamAdvSet* iAdvSettingsImpl; - CTestCamSnapshot* iSnapshotImpl; - CTestCamImgProc* iImgProcImpl; - - CCamera::CCameraAdvancedSettings::TDriveMode iDriveMode; - TInt iBurstImages; - }; - -class CTestCameraInfo : public CCameraInfoPlugin - { -public: - static CTestCameraInfo* NewL(); - ~CTestCameraInfo(); - // from CCameraInfoPlugin - TInt CamerasAvailable(); -private: - CTestCameraInfo(); - }; - -enum TStubPanicReasons - { - EPanicUnimplemented=1 - }; - -class FileDependencyUtil - { -public: - static void CheckFileDependencyL(); - }; - -class CDataGlobal : public CBase - { -public: - CTestCamAdvSet* iTestCamAdvSet; - CTestCamPresets* iTestCamPresets; - CTestCamSnapshot* iTestCamSnapshot; - CTestCamImgProc* iTestCamImgProc; - TInt iAdvSetReferenceCount; - TInt iPresetsReferenceCount; - TInt iSnapshotReferenceCount; - TInt iImgProcReferenceCount; - }; - -#endif +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __TESTCAMERA_H__ +#define __TESTCAMERA_H__ + + +#include +#include +#include +#include +#include +#include + +_LIT(KTestCameraPluginName, "C:\\102070cc.txt"); + +const TInt KMinTestCameraZoom = -3; +const TInt KMaxTestCameraZoom = 3; +const TReal32 KMaxTestCameraDigitalZoomFactor = 1.0; +const TInt KMaxTestCameraDigitalZoom = 0; +const TInt KFramePosIncrement = 5; +const TInt KFrameFeatureSize = 25; +const TInt KFrameFeatureBorderThickness = 5; +const enum CCamera::TFormat KInitialViewFinderFormat = CCamera::EFormatFbsBitmapColor16M; +const TDisplayMode KViewFinderDisplayMode = EColor4K; + +class CTestCamAdvSet; +class CTestCamPresets; +class CTestCamSnapshot; +class CTestCamImgProc; + +class RTestCameraFrameBuffer : public MCameraBuffer + { +public: + RTestCameraFrameBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} + virtual TInt NumFrames() {return 0;} + virtual TDesC8* DataL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return NULL; } + virtual CFbsBitmap& BitmapL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return *iFrame;} + virtual RChunk& ChunkL() { return iChunk;} + virtual TInt ChunkOffsetL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0;} + virtual TInt FrameSize(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0; } + virtual void Release() {iAvailable = ETrue;} +public: + volatile TBool iAvailable; + CFbsBitmap*& iFrame; + RChunk iChunk; + }; + +class RTestFrameBuffer : public MFrameBuffer + { +public: + RTestFrameBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} + virtual TDesC8* DataL(TInt /*aIndex*/) { User::Leave(KErrNotSupported); return NULL; } + virtual CFbsBitmap* FrameL(TInt aIndex) { if (aIndex != 0) User::Leave(KErrNotSupported); return iFrame; } + virtual void Release() { iAvailable = ETrue; } +public: + TBool iAvailable; + CFbsBitmap*& iFrame; + }; + +class CDirectScreenAccess; + +class CTestCamera : public CCameraPlugin, public MDirectScreenAccess + { + friend class CTestCamAdvSet; + friend class CTestCamPresets; + friend class CTestCamSnapshot; + friend class CTestCamImgProc; + +public: + static CTestCamera* NewL(); + ~CTestCamera(); + void ConstructL(); + // from CCameraPlugin + void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); + void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); + void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); + void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); +private: + // From CCamera + virtual void CameraInfo(TCameraInfo& aInfo) const; + virtual void Reserve(); + virtual void Release(); + virtual void PowerOn(); + virtual void PowerOff(); + virtual TInt Handle(); + + virtual void SetZoomFactorL(TInt aZoomFactor = 0); + virtual TInt ZoomFactor() const; + virtual void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); + virtual TInt DigitalZoomFactor() const; + + virtual void SetContrastL(TInt aContrast); + virtual TInt Contrast() const; + virtual void SetBrightnessL(TInt aBrightness); + virtual TInt Brightness() const; + virtual void SetFlashL(TFlash aFlash = EFlashNone); + virtual TFlash Flash() const; + virtual void SetExposureL(TExposure aExposure = EExposureAuto); + virtual TExposure Exposure() const; + virtual void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); + virtual TWhiteBalance WhiteBalance() const; + + virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); + virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); + virtual void StartViewFinderBitmapsL(TSize& aSize); + virtual void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); + virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize); + virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); + virtual void StopViewFinder(); + virtual TBool ViewFinderActive() const; + virtual void SetViewFinderMirrorL(TBool aMirror); + virtual TBool ViewFinderMirror() const; + + virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); + virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); + virtual void CaptureImage(); + virtual void CancelCaptureImage(); + virtual void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + + virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); + virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); + virtual void StartVideoCapture(); + virtual void StopVideoCapture(); + + virtual TBool VideoCaptureActive() const; + virtual void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + virtual void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; + virtual void GetFrameSize(TSize& aSize) const; + virtual TReal32 FrameRate() const; + virtual TInt BuffersInUse() const; + virtual TInt FramesPerBuffer() const; + + virtual void SetJpegQuality(TInt aQuality); + virtual TInt JpegQuality() const; + + virtual TAny* CustomInterface(TUid aInterface); + + // From MAbortDirectScreenAccess + virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); + + // From MDirectScreenAccess + virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason); + + // New functions + static TInt TimerCallBack(TAny* aThis); + void FrameReady(); + void GetFrame(CFbsBitGc& aGc, TPoint& aPos) const; + void GetImgProcessedFrame(CFbsBitGc& aGc, TPoint& aPos) const; + void ServiceVideo(TInt aBuferNum); + void ServiceViewFinder(CFbsBitmap* aSourceFrame); + void ServiceImageCapture(const CFbsBitGc& aSourceBitmapGc); + void ServiceBurstImageCapture(const CFbsBitGc& aSourceBitmapGc); + void DoCaptureImageL(); + void CheckReserveAndPowerL(); + TInt CheckReserveAndPower() const; + void CustomInterfaceL(TAny*& aIface, TUid aInterface); + static TInt ReserveCallBack(TAny* aThis); + static TInt PowerOnCallBack(TAny* aThis); + static TInt ImageCaptureCallBack(TAny* aThis); + static TInt VideoCaptureCallBack(TAny* aThis); + static TInt HandleEventCallBack(TAny* aThis); + static TInt HandleEvent2CallBack(TAny* aThis); + +private: + CTestCamera(); +private: + MCameraObserver* iObserver; // not owned + MCameraObserver2* iObserver2; // not owned + TBool iReserved; + TBool iPowerOn; + + TCameraInfo iInfo; + CPeriodic* iTimer; + TTimeIntervalMicroSeconds32 iFrameDelay; + TInt iFrameIndex; + TTimeIntervalMicroSeconds iElapsedTime; + TPoint iStillImagePos; + TPoint iVideoFramePos; + + TReal32 iVideoFrameRate; + TInt iBuffersInUse; + TSize iVideoFrameSize; + TFormat iVideoFrameFormat; + + CFbsBitmap* iVideoFrame1; + CFbsBitmapDevice* iVideoFrameDev1; + CFbsBitGc* iVideoFrameGc1; + CFbsBitmap* iVideoFrame2; + CFbsBitmapDevice* iVideoFrameDev2; + CFbsBitGc* iVideoFrameGc2; + + TInt iStillCaptureErr; + TSize iStillImageSize; + TFormat iStillImageFormat; + CFbsBitmap* iStillImage; + CFbsBitmapDevice* iStillImageDev; + CFbsBitGc* iStillImageGc; + + TSize iViewFinderSize; + TFormat iViewFinderFormat; + CFbsBitmap* iViewFinderBitmap; + CFbsBitmapDevice* iViewFinderBitmapDev; + CFbsBitGc* iViewFinderBitmapGc; + + CDirectScreenAccess* iDSA; + CFbsScreenDevice* iScreenDev; + CFbsBitGc* iScreenGc; + TRect iScreenRect; + TRect iClipRect; + + CFbsBitmap* iImage; + CFbsBitmapDevice* iDev; + CFbsBitGc* iGc; + + CAsyncCallBack iReserveAsync; + CAsyncCallBack iPowerOnAsync; + CAsyncCallBack iImageCaptureAsync; + CAsyncCallBack iVideoCaptureAsync; + CAsyncCallBack iHandleEventAsync; + CAsyncCallBack iHandleEvent2Async; + + RTestFrameBuffer iFrameBuffer1; + RTestFrameBuffer iFrameBuffer2; + + RTestCameraFrameBuffer iFrameCameraBuffer1; + RTestCameraFrameBuffer iFrameCameraBuffer2; + + TInt iVideoCaptureErr; + // Members to store the current optical or digital value set with SetZoomFactorL() and SetDigitalZoomFactorL() + // Although arguments have trailing Factor in fact they must contain values in the ranges specified by + // iInfo.iMinZoom : iInfo.iMaxZoom for optical zoom and + // 0 : iInfo.iMaxDigitalZoom for digital zoom + // The factor values cannot be modified using Camera API as it is assumed + // that they are determined by the camera hardware. + TInt iZoom; + TInt iDigitalZoom; + + TInt iContrast; + TInt iBrightness; + + TInt iImgProcBrightness; + TInt iImgProcContrast; + + volatile TBool iViewFinderActive; + volatile TBool iVideoCaptureActive; + volatile TBool iImageCaptureActive; + volatile TBool iVideoPreparedLast; + volatile TBool iVideoCapturePrepared; + volatile TBool iImageCapturePrepared; + + RArray iImageSizes; + RArray iVideoFrameSizes; + RArray iVideoFrameRates; + TInt iCameraIndex; + TInt iCameraHandle; + TInt iPriority; + + TECAMEvent iECamEvent; + TECAMEvent2 iECamEvent2; + TInt iEventError; + + CTestCamAdvSet* iAdvSettingsImpl; + CTestCamSnapshot* iSnapshotImpl; + CTestCamImgProc* iImgProcImpl; + + CCamera::CCameraAdvancedSettings::TDriveMode iDriveMode; + TInt iBurstImages; + }; + +class CTestCameraInfo : public CCameraInfoPlugin + { +public: + static CTestCameraInfo* NewL(); + ~CTestCameraInfo(); + // from CCameraInfoPlugin + TInt CamerasAvailable(); +private: + CTestCameraInfo(); + }; + +enum TStubPanicReasons + { + EPanicUnimplemented=1 + }; + +class FileDependencyUtil + { +public: + static void CheckFileDependencyL(); + }; + +class CDataGlobal : public CBase + { +public: + CTestCamAdvSet* iTestCamAdvSet; + CTestCamPresets* iTestCamPresets; + CTestCamSnapshot* iTestCamSnapshot; + CTestCamImgProc* iTestCamImgProc; + TInt iAdvSetReferenceCount; + TInt iPresetsReferenceCount; + TInt iSnapshotReferenceCount; + TInt iImgProcReferenceCount; + }; + +#endif diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/TestCameraUids.hrh --- a/mmplugins/cameraplugins/source/testcamera/TestCameraUids.hrh Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/TestCameraUids.hrh Tue Oct 19 11:48:59 2010 +0900 @@ -1,25 +1,24 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef TESTCAMERAUIDS_HRH -#define TESTCAMERAUIDS_HRH - - -#define KUidOnboardCameraTestDll 0x102070CC -#define KUidOnboardCameraTestPlugin 0x102070CD -#define KUidOnboardCameraTestInfo 0x102070CE - -#endif // TESTCAMERAUIDS_HRH - +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef TESTCAMERAUIDS_HRH +#define TESTCAMERAUIDS_HRH + + +#define KUidOnboardCameraTestDll 0x102070CC +#define KUidOnboardCameraTestPlugin 0x102070CD +#define KUidOnboardCameraTestInfo 0x102070CE + +#endif // TESTCAMERAUIDS_HRH diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_advanced_settings.cpp --- a/mmplugins/cameraplugins/source/testcamera/test_advanced_settings.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_advanced_settings.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,1602 +1,1602 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testadvancedsettings.cpp -// -// - -#include "test_advanced_settings.h" -#include -#include "ecamversion.h" - -CTestCamAdvSet::CTestCamAdvSet(CTestCamera& aOwner): iOwner(aOwner) - { - Init(); - } - -CTestCamAdvSet::~CTestCamAdvSet() - { - iSupportedISORates.Close(); - iSupportedApertures.Close(); - iSupportedShutterSpeeds.Close(); - - CDataGlobal* globalData = static_cast (Dll::Tls()); - if(globalData != NULL) - { - if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - globalData->iTestCamAdvSet = NULL; - Dll::SetTls(globalData); - } - } - } - -CTestCamAdvSet* CTestCamAdvSet::NewL(CTestCamera& aOwner) - { - CDataGlobal* globalData = static_cast (Dll::Tls()); - - if(globalData == NULL) - { - globalData = new (ELeave) CDataGlobal; - CleanupStack::PushL(globalData); - globalData->iAdvSetReferenceCount = 0; - globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner); - CleanupStack::PushL(globalData->iTestCamAdvSet); - globalData->iTestCamAdvSet->ConstructL(); - globalData->iTestCamAdvSet->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamAdvSet); - CleanupStack::Pop(globalData); - return globalData->iTestCamAdvSet; - } - else - { - if(globalData->iTestCamAdvSet == NULL) - { - globalData->iAdvSetReferenceCount = 0; - globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner); - CleanupStack::PushL(globalData->iTestCamAdvSet); - globalData->iTestCamAdvSet->ConstructL(); - globalData->iTestCamAdvSet->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamAdvSet); - return globalData->iTestCamAdvSet; - } - - CTestCamAdvSet* self = globalData->iTestCamAdvSet; - - globalData->iAdvSetReferenceCount++; - self->iRefCount = globalData->iAdvSetReferenceCount + 1; - if (globalData->iAdvSetReferenceCount == KNumOfAdvSetExtensions-1 ) - { - globalData->iTestCamAdvSet = NULL; - if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - return self; - } - } - -void CTestCamAdvSet::Release() - { - iRefCount--; - if(iRefCount == 0) - { - iOwner.iAdvSettingsImpl = NULL; - delete this; - } - } - -void CTestCamAdvSet::Init() - { - for(TUint i=0; i< KNumAvailableCameras; i++) - { - iCameraTypes[i] = CCamera::CCameraAdvancedSettings::ECameraPluggable; - } - - iFocusDistance = KDefaultFocusDistance; - iIsoRate = KDefaultIsoRate; - iISORateType = CCamera::CCameraAdvancedSettings::EISOManual; - iAperture = KDefaultAperture; - iShutterSpeed = KDefaultShutterSpeed; - } - -void CTestCamAdvSet::ConstructL() - { - iSupportedISORates.Reset(); - iSupportedISORates.AppendL(KDefaultIsoRate); - - iSupportedApertures.Reset(); - iSupportedApertures.AppendL(KDefaultAperture); - - iSupportedShutterSpeeds.Reset(); - iSupportedShutterSpeeds.AppendL(KDefaultShutterSpeed); - } - -CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType() const - { - return CCamera::CCameraAdvancedSettings::ECameraPluggable; - } - -CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType(TInt aCameraIndex) const - { - if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0) - { - return CCamera::CCameraAdvancedSettings::ECameraUnknown; - } - else - { - return iCameraTypes[aCameraIndex]; - } - } - -TBool CTestCamAdvSet::IsCameraPresent() const - { - return ETrue; - } - -TBool CTestCamAdvSet::IsCameraPresent(TInt aCameraIndex) const - { - if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0) - { - return EFalse; - } - else - { - return ETrue; - } - } - -TInt CTestCamAdvSet::CameraIndex() const - { - return iOwner.iCameraIndex; - } - -TInt CTestCamAdvSet::SupportedStabilizationModes() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TStabilizationMode CTestCamAdvSet::StabilizationMode() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationModeOff; - } - -void CTestCamAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode) - { - TInt eventError = KErrNotSupported; - if(aStabilizationMode == CCamera::CCameraAdvancedSettings::EStabilizationModeOff) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingStabilizationMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedFocusModes() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TFocusMode CTestCamAdvSet::FocusMode() const - { - return CCamera::CCameraAdvancedSettings::EFocusModeAuto; - } - -void CTestCamAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode) - { - TInt eventError = KErrNotSupported; - if(aFocusMode == CCamera::CCameraAdvancedSettings::EFocusModeAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingFocusMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedFocusRanges() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TFocusRange CTestCamAdvSet::FocusRange() const - { - return CCamera::CCameraAdvancedSettings::EFocusRangeAuto; - } - -void CTestCamAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange) - { - TInt eventError = KErrNotSupported; - if(aFocusRange == CCamera::CCameraAdvancedSettings::EFocusRangeAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent1(KUidECamEventCameraSettingFocusRange2, eventError); - TECAMEvent ecamevent2(KUidECamEventCameraSettingFocusRange, eventError); - - iOwner.iECamEvent = ecamevent1; - iOwner.iHandleEventAsync.CallBack(); - - iOwner.iECamEvent = ecamevent2; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedAutoFocusTypes() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TAutoFocusType CTestCamAdvSet::AutoFocusType() const - { - return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff; - } - -void CTestCamAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType) - { - TInt eventError = KErrNotSupported; - if(aAutoFocusType == CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent1(KUidECamEventCameraSettingAutoFocusType2, eventError); - TECAMEvent ecamevent2(KUidECamEventCameraSettingAutoFocusType, eventError); - - iOwner.iECamEvent = ecamevent1; - iOwner.iHandleEventAsync.CallBack(); - - iOwner.iECamEvent = ecamevent2; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedAutoFocusAreas() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TAutoFocusArea CTestCamAdvSet::AutoFocusArea() const - { - return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto; - } - -void CTestCamAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea) - { - TInt eventError = KErrNotSupported; - if(aAutoFocusArea == CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusArea, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::FocusDistance() const - { - return iFocusDistance; - } - -void CTestCamAdvSet::SetFocusDistance(TInt aDistance) - { - TInt eventError = KErrNone; - if(aDistance < 0) - { - eventError = KErrNotSupported; - } - else - { - iFocusDistance = aDistance; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingFocusDistance, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::GetMinFocalLength() const - { - return KErrNotSupported; - } - -void CTestCamAdvSet::GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const - { - if(iSupportedISORates.Count() == 0) - { - User::Leave(KErrNotSupported); - } - - for(TInt index=0; index < iSupportedISORates.Count(); index++) - { - aSupportedIsoRates.AppendL(iSupportedISORates[index]); - } - } - -TInt CTestCamAdvSet::IsoRate() const - { - return iIsoRate; - } - -void CTestCamAdvSet::SetIsoRate(TInt aRate) - { - TInt eventError = KErrNone; - if(iSupportedISORates.Find(aRate) == KErrNotFound) - { - eventError = KErrECamParameterNotInRange; - } - else - { - //set the ISO type to Manual - iISORateType = CCamera::CCameraAdvancedSettings::EISOManual; - iIsoRate = aRate; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRate, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const - { - aSupportedISORateTypes = KSupportedISORateTypes; - } - -void CTestCamAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam) - { - TInt eventError = KErrNone; - - if(!(aISORateType & KSupportedISORateTypes) || iSupportedISORates.Count() == 0) - { - eventError = KErrNotSupported; - } - else - { - switch(aISORateType) - { - case CCamera::CCameraAdvancedSettings::EISOManual: - { - if(iSupportedISORates.Find(aParam) == KErrNotFound) - { - eventError = KErrECamParameterNotInRange; - } - else - { - iISORateType = aISORateType; - if(aParam == iIsoRate) - { - eventError = KErrAlreadyExists; - } - else - { - iIsoRate = aParam; - } - } - break; - } - case CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised: - { - eventError = KErrNotSupported; - break; - } - case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised: - { - eventError = KErrNotSupported; - break; - } - case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised: - { - eventError = KErrNotSupported; - break; - } - case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised: - { - eventError = KErrNotSupported; - break; - } - default: - eventError = KErrNotSupported; - } - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRateType, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& /*aParam*/, TInt& aISORate) const - { - //If camera has no ISO rate supported, then leave - if(iSupportedISORates.Count() == 0) - { - User::Leave(KErrNotSupported); - } - - aISORateType = iISORateType; - aISORate = iIsoRate; -// aParam is redundant for manual ISO. - } - -void CTestCamAdvSet::GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const - { - if(iSupportedApertures.Count() == 0) - { - aFStops.Reset(); - aInfo = ENotActive; - } - - for(TInt index=0; index < iSupportedApertures.Count(); index++) - { - aFStops.AppendL(iSupportedApertures[index]); - } - - aInfo = EDiscreteSteps; - } - -TInt CTestCamAdvSet::Aperture() const - { - return iAperture; - } - -void CTestCamAdvSet::SetAperture(TInt aFStop) - { - TInt eventError = KErrNone; - if(iSupportedApertures.Find(aFStop) == KErrNotFound) - { - eventError = KErrECamParameterNotInRange; - } - else - { - iAperture = aFStop; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingAperture, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const - { - if(iSupportedShutterSpeeds.Count() == 0) - { - aShutterSpeeds.Reset(); - aInfo = ENotActive; - } - - for(TInt index=0; index < iSupportedShutterSpeeds.Count(); index++) - { - aShutterSpeeds.AppendL(iSupportedShutterSpeeds[index]); - aInfo = EDiscreteSteps; - } - } - -TInt CTestCamAdvSet::ShutterSpeed() const - { - return iShutterSpeed; - } - -void CTestCamAdvSet::SetShutterSpeed(TInt aShutterSpeed) - { - TInt eventError = KErrNone; - if(iSupportedShutterSpeeds.Find(aShutterSpeed) == KErrNotFound) - { - eventError = KErrECamParameterNotInRange; - } - else - { - iShutterSpeed = aShutterSpeed; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingShutterSpeed, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedMeteringModes() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TMeteringMode CTestCamAdvSet::MeteringMode() const - { - return CCamera::CCameraAdvancedSettings::EMeteringModeAuto; - } - -void CTestCamAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode) - { - TInt eventError = KErrNotSupported; - if(aMeteringMode == CCamera::CCameraAdvancedSettings::EMeteringModeAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingMeteringMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedDriveModes() const - { - return KSupportedDriveModes; - } - -CCamera::CCameraAdvancedSettings::TDriveMode CTestCamAdvSet::DriveMode() const - { - return iOwner.iDriveMode; - } - -void CTestCamAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode) - { - TInt eventError = KErrNone; - if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) - { - eventError = KErrNotReady; - } - else - { - if(!(aDriveMode & KSupportedDriveModes)) - { - eventError = KErrNotSupported; - } - else - { - if(eventError == KErrNone) - { - iOwner.iDriveMode = aDriveMode; - } - } - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingDriveMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedBracketModes() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketMode CTestCamAdvSet::BracketMode() const - { - return CCamera::CCameraAdvancedSettings::EBracketModeOff; - } - -void CTestCamAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode) - { - TInt eventError = KErrNotSupported; - if(aBracketMode == CCamera::CCameraAdvancedSettings::EBracketModeOff) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingBracketMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedBracketParameters() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketParameter CTestCamAdvSet::BracketParameter() const - { - return CCamera::CCameraAdvancedSettings::EBracketParameterNone; - } - -void CTestCamAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter) - { - TInt eventError = KErrNotSupported; - if(aBracketParameter == CCamera::CCameraAdvancedSettings::EBracketParameterNone) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingBracketParameter, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedBracketSteps() const - { - return KFeatureNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketStep CTestCamAdvSet::BracketStep() const - { - return CCamera::CCameraAdvancedSettings::EBracketStepNonConfig; - } - -void CTestCamAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep) - { - TInt eventError = KErrNotSupported; - if(aBracketStep == CCamera::CCameraAdvancedSettings::EBracketStepNonConfig) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingBracketStep, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const - { - aStartIndex = KFeatureNotSupported; - aFrames = KFeatureNotSupported; - } - -void CTestCamAdvSet::SetBracketMerge(TInt /*aStartIndex*/ , TInt /*aFrames*/) - { - TECAMEvent ecamevent(KUidECamEventBracketMerge, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedFlashModes() const - { - return KFeatureNotSupported; - } - -CCamera::TFlash CTestCamAdvSet::FlashMode() const - { - return CCamera::EFlashNone; - } - -void CTestCamAdvSet::SetFlashMode(CCamera::TFlash /*aMode*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingFlashMode, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::RedEyeReduceOn() const - { - return KDefaultRedEyeReduce; - } - -void CTestCamAdvSet::SetRedEyeReduceOn(TBool /*aState*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingFlashRedEyeReduce, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const - { - aFlashCompensationSteps.Reset(); - aInfo = ENotActive; - } - -TInt CTestCamAdvSet::FlashCompensationStep() const - { - return KFlashCompensationStep; - } - -TInt CTestCamAdvSet::GetFlashCompensationStep(TInt& aFlashCompensationStep) const - { - aFlashCompensationStep = KFlashCompensationStep; - return KErrNone; - } - -void CTestCamAdvSet::GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const - { - aNegativeCompensation = KFlashCompensationStep; - aPositiveCompensation = KFlashCompensationStep; - } - -void CTestCamAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensationStep, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::FlashCompensation() const - { - return KFlashCompensationStep; - } - -TInt CTestCamAdvSet::GetFlashCompensation(TInt& aFlashCompensation) const - { - aFlashCompensation = KFlashCompensationStep; - return KErrNone; - } - -void CTestCamAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensation, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::IsExternalFlashPresent() const - { - return KExternalFlashPresentState; - } - -void CTestCamAdvSet::GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const - { - aManualFlashPowerLevels.Reset(); - aInfo = ENotActive; - } - -TInt CTestCamAdvSet::ManualFlashPowerLevel() const - { - return KErrNotSupported; - } - -void CTestCamAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingFlashManualPower, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedExposureModes() const - { - return CCamera::EExposureAuto; - } - -CCamera::TExposure CTestCamAdvSet::ExposureMode() const - { - return CCamera::EExposureAuto; - } - -void CTestCamAdvSet::SetExposureMode(CCamera::TExposure aExposureMode) - { - TInt eventError = KErrNotSupported; - if(aExposureMode == CCamera::EExposureAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingExposureMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const - { - aExposureCompensationSteps.Reset(); - aInfo = ENotActive; - } - -void CTestCamAdvSet::GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const - { - aNegativeCompensation = KExposureCompensationStep; - aPositiveCompensation = KExposureCompensationStep; - } - -TInt CTestCamAdvSet::ExposureCompensationStep() const - { - return KExposureCompensationStep; - } - -TInt CTestCamAdvSet::GetExposureCompensationStep(TInt& aExposureCompensationStep) const - { - aExposureCompensationStep = KExposureCompensationStep; - return KErrNone; - } - -void CTestCamAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensationStep, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::ExposureCompensation() const - { - return KExposureCompensationStep; - } - -TInt CTestCamAdvSet::GetExposureCompensation(TInt& aExposureCompensation) const - { - aExposureCompensation = KExposureCompensationStep; - return KErrNone; - } - -void CTestCamAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensation, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedWhiteBalanceModes() const - { - return KFeatureNotSupported; - } - -CCamera::TWhiteBalance CTestCamAdvSet::WhiteBalanceMode() const - { - return CCamera::EWBAuto; - } - -void CTestCamAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode) - { - TInt eventError = KErrNotSupported; - if(aWhiteBalanceMode == CCamera::EWBAuto) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingWhiteBalanceMode, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::ApertureExposureLockOn() const - { - return KApertureExposureLockOn; - } - -void CTestCamAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/) - { - TECAMEvent ecamevent(KUidECamEventAELock, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::ShootClickOn() const - { - return KShootClickOn; - } - -void CTestCamAdvSet::SetShootClickOn(TBool /*aShootClickOn*/) - { - TECAMEvent ecamevent(KUidECamEventSoundClick, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const - { - aTimerIntervals.Reset(); - aInfo = ENotActive; - } - -TInt CTestCamAdvSet::TimerInterval() const - { - return KErrNotSupported; - } - -void CTestCamAdvSet::SetTimerInterval(TInt /*aTimerInterval*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingTimerInterval, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const - { - TTime timeLapse(KTimeLapse); - aTimeLapseMin = aTimeLapseMax = timeLapse; - } - -void CTestCamAdvSet::GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const - { - TTime timeLapse(KTimeLapse); - aStart = aEnd = aInterval = timeLapse; - } - -void CTestCamAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingTimeLapse, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -CCamera::CCameraAdvancedSettings::TPictureOrientation CTestCamAdvSet::PictureOrientation() const - { - return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown; - } - -void CTestCamAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation) - { - TInt eventError = KErrNotSupported; - - if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) - { - eventError = KErrNotReady; - } - else - { - if(aOrientation == CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown) - { - eventError = KErrAlreadyExists; - } - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingPictureOrientation, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedPixelAspectRatios() const - { - return KSupportedPixelAspectRatio; - } - -CCamera::CCameraAdvancedSettings::TPixelAspectRatio CTestCamAdvSet::PixelAspectRatio() const - { - return CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; - } - -void CTestCamAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio) - { - TInt eventError = KErrNotSupported; - - if(aPixelAspectRatio == CCamera::CCameraAdvancedSettings::EPixelAspectUnknown) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventPixelAspectRatio, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::SupportedYuvRanges() const - { - return KSupportedYuvRange; - } - -CCamera::CCameraAdvancedSettings::TYuvRange CTestCamAdvSet::YuvRange() const - { - return CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; - } - -void CTestCamAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange) - { - TInt eventError = KErrNotSupported; - - if(aYuvRange == CCamera::CCameraAdvancedSettings::EYuvRangeUnknown) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventYuvRange, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::BurstImages() const - { - return iOwner.iBurstImages; - } - -void CTestCamAdvSet::SetBurstImages(TInt aImages) - { - TInt eventError = iOwner.CheckReserveAndPower(); - - if(eventError == KErrNone) - { - if(aImages == iOwner.iBurstImages) - { - eventError = KErrAlreadyExists; - } - else - { - if(aImages<1) - { - eventError = KErrArgument; - } - } - } - - if(eventError != KErrNone) - { - TECAMEvent ecamevent(KUidECamEventBurstImages, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - return; - } - - if(aImages > KMaxBurstImages) - { - iOwner.iBurstImages = KMaxBurstImages; - } - else - { - iOwner.iBurstImages = aImages; - } - - TECAMEvent ecamevent(KUidECamEventBurstImages, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const - { - aOpticalZoomSteps.Reset(); - aOpticalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -TInt CTestCamAdvSet::OpticalZoom() const - { - return KECamFineResolutionFactor; - } - -void CTestCamAdvSet::SetOpticalZoom(TInt aOpticalZoom) - { - TInt eventError = KErrNotSupported; - - if(aOpticalZoom == KECamFineResolutionFactor) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingOpticalZoom, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, - TValueInfo& aInfo) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -void CTestCamAdvSet::GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aSizeIndex*/, - CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -void CTestCamAdvSet::GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aFrameRateIndex*/, - TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -TInt CTestCamAdvSet::DigitalZoom() const - { - return KECamFineResolutionFactor; - } - -void CTestCamAdvSet::SetDigitalZoom(TInt aDigitalZoom) - { - TInt eventError = KErrNotSupported; - - if(aDigitalZoom == KECamFineResolutionFactor) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingDigitalZoom, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::ExposureLockOn() const - { - return KExposureLockOn; - } - -void CTestCamAdvSet::SetExposureLockOn(TBool aState) - { - TInt eventError = KErrNotSupported; - - if(aState == KExposureLockOn) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingExposureLock, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::AutoFocusLockOn() const - { - return KAutoFocusLockOn; - } - -void CTestCamAdvSet::SetAutoFocusLockOn(TBool aState) - { - TInt eventError = KErrNotSupported; - - if(aState == KAutoFocusLockOn) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusLock, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetSupportedSettingsL(RArray& aSettings) const - { - aSettings.Reset(); - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::GetActiveSettingsL(RArray& aActiveSettings) const - { - aActiveSettings.Reset(); - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::GetDisabledSettingsL(RArray& aDisbledSettings) const - { - aDisbledSettings.Reset(); - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::SetAutomaticSizeSelectionChangeOn(TBool aSetOn) - { - TInt eventError = KErrNotSupported; - - if(aSetOn == KAutomaticSizeSelectionChangeOn) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingAutomaticSizeSelection, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TBool CTestCamAdvSet::AutomaticSizeSelectionChangeOn() const - { - return KAutomaticSizeSelectionChangeOn; - } - -void CTestCamAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const - { - aTimeouts.Reset(); - aInfo = ENotActive; - } - -void CTestCamAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingsContinuousAutoFocusTimeout, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect) - { - TInt eventError = KErrNotSupported; - - if(aEffect == KStabilizationEffect) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingsStabilizationEffect, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -CCamera::CCameraAdvancedSettings::TStabilizationEffect CTestCamAdvSet::StabilizationEffect() const - { - return KStabilizationEffect; - } - -TInt CTestCamAdvSet::SupportedStabilizationEffects() const - { - return KStabilizationEffect; - } - -TInt CTestCamAdvSet::SupportedStabilizationComplexityValues() const - { - return KStabilizationComplexity; - } - -CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CTestCamAdvSet::StabilizationComplexity() const - { - return KStabilizationComplexity; - } - -void CTestCamAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity) - { - TInt eventError = KErrNotSupported; - - if(aComplexity == KStabilizationComplexity) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventSettingsStabilizationAlgorithmComplexity, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -CCamera::CCameraAdvancedSettings::TWBUnits CTestCamAdvSet::SupportedWBUnits() const - { - return KSupportedWBUnits; - } - -void CTestCamAdvSet::SetWBRgbValue(const TRgb& /*aValue*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetWBRgbValue(TRgb& aValue) const - { - aValue = KRgbWhite; - } - -void CTestCamAdvSet::GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const - { - aWBColorTemperatures.Reset(); - aInfo = ENotActive; - } - -void CTestCamAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TInt CTestCamAdvSet::WBColorTemperature() const - { - return KErrNotSupported; - } - -TInt CTestCamAdvSet::ContinuousAutoFocusTimeout() const - { - return KErrNotSupported; - } - -TInt CTestCamAdvSet::IsFlashReady(TBool& aReady) const - { - aReady = KFlashReadyState; - return KErrNone; - } - -void CTestCamAdvSet::GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const - { - aFocusModeSteps.Reset(); - aInfo = ENotActive; - } - -void CTestCamAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/) - { - TECAMEvent ecamevent(KUidECamEventCameraSettingReferenceScreen, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& aPreCaptureWarningSupported) const - { - aPreCaptureWarningSupported = KPreCaptureWarning; - } - -void CTestCamAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/) - { - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::UnSubscribePreCaptureWarningL() - { - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const - { - aSupportedAFAssistantLight = KAFAssisstantLight; - } - -void CTestCamAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& /*aAFAssistantLight*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight) - { - TInt eventError = KErrNotSupported; - - if(aAFAssistantLight == KAFAssisstantLight) - { - eventError = KErrAlreadyExists; - } - - TECAMEvent ecamevent(KUidECamEventCameraSettingAFAssistantLight, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -/**********************************************************************************************************/ -/* CTestCamPresets */ -/**********************************************************************************************************/ - -CTestCamPresets::CTestCamPresets(CTestCamera& aOwner): iOwner(aOwner),iCurrentPreset(KNullUid) - {} - -CTestCamPresets::~CTestCamPresets() - { - iSupportedPresets.Close(); - iFactoryPresetAffectSettings.Close(); - - CDataGlobal* globalData = static_cast (Dll::Tls()); - if(globalData != NULL) - { - if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - globalData->iTestCamPresets = NULL; - Dll::SetTls(globalData); - } - } - } - -CTestCamPresets* CTestCamPresets::NewL(CTestCamera& aOwner) - { - CDataGlobal* globalData = static_cast (Dll::Tls()); - - if(globalData == NULL) - { - globalData = new (ELeave) CDataGlobal; - CleanupStack::PushL(globalData); - globalData->iPresetsReferenceCount = 0; - globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner); - globalData->iTestCamPresets->ConstructL(); - globalData->iTestCamPresets->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData); - return globalData->iTestCamPresets; - } - else - { - if(globalData->iTestCamPresets == NULL) - { - globalData->iPresetsReferenceCount = 0; - globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner); - CleanupStack::PushL(globalData->iTestCamPresets); - globalData->iTestCamPresets->ConstructL(); - globalData->iTestCamPresets->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamPresets); - return globalData->iTestCamPresets; - } - - CTestCamPresets* self = globalData->iTestCamPresets; - - globalData->iPresetsReferenceCount++; - self->iRefCount = globalData->iPresetsReferenceCount + 1; - if (globalData->iPresetsReferenceCount == KNumOfPresetExtensions-1 ) - { - globalData->iTestCamPresets = NULL; - if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - return self; - } - } - -void CTestCamPresets::Release() - { - iRefCount--; - if(iRefCount == 0) - { - delete this; - } - } - -void CTestCamPresets::ConstructL() - { - iSupportedPresets.Reset(); - iSupportedPresets.AppendL(KUidECamPresetFactoryDefault); - - iFactoryPresetAffectSettings.Reset(); - iFactoryPresetAffectSettings.AppendL(KUidECamEventCameraSettingDriveMode); - iFactoryPresetAffectSettings.AppendL(KUidECamEventBurstImages); - } - -void CTestCamPresets::GetSupportedPresetsL(RArray& aPresets) const - { - aPresets.Reset(); - for (TInt index=0; index < iSupportedPresets.Count(); index++) - { - User::LeaveIfError(aPresets.Append(iSupportedPresets[index])); - } - } - -void CTestCamPresets::SetPreset(TUid aPreset) - { - TInt eventError = iOwner.CheckReserveAndPower(); - if(eventError == KErrNone) - { - if(aPreset == iSupportedPresets[0]) - { - //ResetBrightness, Contrast, Drivemode, No. of burst mode images - iOwner.iBrightness = 0; - iOwner.iContrast = 0; - iOwner.iImgProcBrightness = 0; - iOwner.iImgProcContrast = 0; - iOwner.iDriveMode = KDefaultDriveMode; - iOwner.iBurstImages = KBurstImages; - } - else - { - eventError = KErrNotSupported; - } - } - - TECAMEvent ecamevent(aPreset, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -TUid CTestCamPresets::Preset() const - { - return iCurrentPreset; - } - -void CTestCamPresets::GetAffectedSettingsL(RArray& aSettings) const - { - aSettings.Reset(); - - if(iCurrentPreset == iSupportedPresets[0]) - { - for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++) - { - User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index])); - } - } - } - -void CTestCamPresets::GetAssociatedSettingsL(TUid aPreset, RArray& aSettings) const - { - switch(aPreset.iUid) - { - case KUidECamPresetFactoryDefaultUidValue: - { - aSettings.Reset(); - for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++) - { - User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index])); - } - break; - } - - //fall through - case KUidECamPresetOutdoorUidValue: - case KUidECamPresetOutdoorSportUidValue: - case KUidECamPresetSnowUidValue: - case KUidECamPresetBeachUidValue: - case KUidECamPresetNightPortraitUidValue: - case KUidECamPresetNightFireworksUidValue: - case KUidECamPresetFogUidValue: - case KUidECamPresetIndoorUidValue: - case KUidECamPresetIndoorSportUidValue: - { - User::Leave(KErrNotSupported); - } - //fall through - case KUidECamPresetNightPartyIndoorUidValue: - case KUidECamPresetNightCloseUpUidValue: - case KUidECamPresetNightMacroUidValue: - case KUidECamPresetTextDocumentUidValue: - case KUidECamPresetBarcodeUidValue: - case KUidECamPresetAutoUidValue: - case KUidECamPresetPortraitUidValue: - case KUidECamPresetLandscapeUidValue: - case KUidECamPresetAmbienceMoodUidValue: - { - if(iOwner.CameraVersion() == KCameraDefaultVersion) - { - User::Leave(KErrArgument); - } - else - { - User::Leave(KErrNotSupported); - } - } - - default: - User::Leave(KErrArgument); - - } - } +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testadvancedsettings.cpp +// +// + +#include "test_advanced_settings.h" +#include +#include + +CTestCamAdvSet::CTestCamAdvSet(CTestCamera& aOwner): iOwner(aOwner) + { + Init(); + } + +CTestCamAdvSet::~CTestCamAdvSet() + { + iSupportedISORates.Close(); + iSupportedApertures.Close(); + iSupportedShutterSpeeds.Close(); + + CDataGlobal* globalData = static_cast (Dll::Tls()); + if(globalData != NULL) + { + if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + globalData->iTestCamAdvSet = NULL; + Dll::SetTls(globalData); + } + } + } + +CTestCamAdvSet* CTestCamAdvSet::NewL(CTestCamera& aOwner) + { + CDataGlobal* globalData = static_cast (Dll::Tls()); + + if(globalData == NULL) + { + globalData = new (ELeave) CDataGlobal; + CleanupStack::PushL(globalData); + globalData->iAdvSetReferenceCount = 0; + globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner); + CleanupStack::PushL(globalData->iTestCamAdvSet); + globalData->iTestCamAdvSet->ConstructL(); + globalData->iTestCamAdvSet->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamAdvSet); + CleanupStack::Pop(globalData); + return globalData->iTestCamAdvSet; + } + else + { + if(globalData->iTestCamAdvSet == NULL) + { + globalData->iAdvSetReferenceCount = 0; + globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner); + CleanupStack::PushL(globalData->iTestCamAdvSet); + globalData->iTestCamAdvSet->ConstructL(); + globalData->iTestCamAdvSet->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamAdvSet); + return globalData->iTestCamAdvSet; + } + + CTestCamAdvSet* self = globalData->iTestCamAdvSet; + + globalData->iAdvSetReferenceCount++; + self->iRefCount = globalData->iAdvSetReferenceCount + 1; + if (globalData->iAdvSetReferenceCount == KNumOfAdvSetExtensions-1 ) + { + globalData->iTestCamAdvSet = NULL; + if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + return self; + } + } + +void CTestCamAdvSet::Release() + { + iRefCount--; + if(iRefCount == 0) + { + iOwner.iAdvSettingsImpl = NULL; + delete this; + } + } + +void CTestCamAdvSet::Init() + { + for(TUint i=0; i< KNumAvailableCameras; i++) + { + iCameraTypes[i] = CCamera::CCameraAdvancedSettings::ECameraPluggable; + } + + iFocusDistance = KDefaultFocusDistance; + iIsoRate = KDefaultIsoRate; + iISORateType = CCamera::CCameraAdvancedSettings::EISOManual; + iAperture = KDefaultAperture; + iShutterSpeed = KDefaultShutterSpeed; + } + +void CTestCamAdvSet::ConstructL() + { + iSupportedISORates.Reset(); + iSupportedISORates.AppendL(KDefaultIsoRate); + + iSupportedApertures.Reset(); + iSupportedApertures.AppendL(KDefaultAperture); + + iSupportedShutterSpeeds.Reset(); + iSupportedShutterSpeeds.AppendL(KDefaultShutterSpeed); + } + +CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType() const + { + return CCamera::CCameraAdvancedSettings::ECameraPluggable; + } + +CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType(TInt aCameraIndex) const + { + if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0) + { + return CCamera::CCameraAdvancedSettings::ECameraUnknown; + } + else + { + return iCameraTypes[aCameraIndex]; + } + } + +TBool CTestCamAdvSet::IsCameraPresent() const + { + return ETrue; + } + +TBool CTestCamAdvSet::IsCameraPresent(TInt aCameraIndex) const + { + if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0) + { + return EFalse; + } + else + { + return ETrue; + } + } + +TInt CTestCamAdvSet::CameraIndex() const + { + return iOwner.iCameraIndex; + } + +TInt CTestCamAdvSet::SupportedStabilizationModes() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TStabilizationMode CTestCamAdvSet::StabilizationMode() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationModeOff; + } + +void CTestCamAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode) + { + TInt eventError = KErrNotSupported; + if(aStabilizationMode == CCamera::CCameraAdvancedSettings::EStabilizationModeOff) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingStabilizationMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedFocusModes() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TFocusMode CTestCamAdvSet::FocusMode() const + { + return CCamera::CCameraAdvancedSettings::EFocusModeAuto; + } + +void CTestCamAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode) + { + TInt eventError = KErrNotSupported; + if(aFocusMode == CCamera::CCameraAdvancedSettings::EFocusModeAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingFocusMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedFocusRanges() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TFocusRange CTestCamAdvSet::FocusRange() const + { + return CCamera::CCameraAdvancedSettings::EFocusRangeAuto; + } + +void CTestCamAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange) + { + TInt eventError = KErrNotSupported; + if(aFocusRange == CCamera::CCameraAdvancedSettings::EFocusRangeAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent1(KUidECamEventCameraSettingFocusRange2, eventError); + TECAMEvent ecamevent2(KUidECamEventCameraSettingFocusRange, eventError); + + iOwner.iECamEvent = ecamevent1; + iOwner.iHandleEventAsync.CallBack(); + + iOwner.iECamEvent = ecamevent2; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedAutoFocusTypes() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TAutoFocusType CTestCamAdvSet::AutoFocusType() const + { + return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff; + } + +void CTestCamAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType) + { + TInt eventError = KErrNotSupported; + if(aAutoFocusType == CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent1(KUidECamEventCameraSettingAutoFocusType2, eventError); + TECAMEvent ecamevent2(KUidECamEventCameraSettingAutoFocusType, eventError); + + iOwner.iECamEvent = ecamevent1; + iOwner.iHandleEventAsync.CallBack(); + + iOwner.iECamEvent = ecamevent2; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedAutoFocusAreas() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TAutoFocusArea CTestCamAdvSet::AutoFocusArea() const + { + return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto; + } + +void CTestCamAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea) + { + TInt eventError = KErrNotSupported; + if(aAutoFocusArea == CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusArea, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::FocusDistance() const + { + return iFocusDistance; + } + +void CTestCamAdvSet::SetFocusDistance(TInt aDistance) + { + TInt eventError = KErrNone; + if(aDistance < 0) + { + eventError = KErrNotSupported; + } + else + { + iFocusDistance = aDistance; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingFocusDistance, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::GetMinFocalLength() const + { + return KErrNotSupported; + } + +void CTestCamAdvSet::GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const + { + if(iSupportedISORates.Count() == 0) + { + User::Leave(KErrNotSupported); + } + + for(TInt index=0; index < iSupportedISORates.Count(); index++) + { + aSupportedIsoRates.AppendL(iSupportedISORates[index]); + } + } + +TInt CTestCamAdvSet::IsoRate() const + { + return iIsoRate; + } + +void CTestCamAdvSet::SetIsoRate(TInt aRate) + { + TInt eventError = KErrNone; + if(iSupportedISORates.Find(aRate) == KErrNotFound) + { + eventError = KErrECamParameterNotInRange; + } + else + { + //set the ISO type to Manual + iISORateType = CCamera::CCameraAdvancedSettings::EISOManual; + iIsoRate = aRate; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRate, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const + { + aSupportedISORateTypes = KSupportedISORateTypes; + } + +void CTestCamAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam) + { + TInt eventError = KErrNone; + + if(!(aISORateType & KSupportedISORateTypes) || iSupportedISORates.Count() == 0) + { + eventError = KErrNotSupported; + } + else + { + switch(aISORateType) + { + case CCamera::CCameraAdvancedSettings::EISOManual: + { + if(iSupportedISORates.Find(aParam) == KErrNotFound) + { + eventError = KErrECamParameterNotInRange; + } + else + { + iISORateType = aISORateType; + if(aParam == iIsoRate) + { + eventError = KErrAlreadyExists; + } + else + { + iIsoRate = aParam; + } + } + break; + } + case CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised: + { + eventError = KErrNotSupported; + break; + } + case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised: + { + eventError = KErrNotSupported; + break; + } + case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised: + { + eventError = KErrNotSupported; + break; + } + case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised: + { + eventError = KErrNotSupported; + break; + } + default: + eventError = KErrNotSupported; + } + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRateType, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& /*aParam*/, TInt& aISORate) const + { + //If camera has no ISO rate supported, then leave + if(iSupportedISORates.Count() == 0) + { + User::Leave(KErrNotSupported); + } + + aISORateType = iISORateType; + aISORate = iIsoRate; +// aParam is redundant for manual ISO. + } + +void CTestCamAdvSet::GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const + { + if(iSupportedApertures.Count() == 0) + { + aFStops.Reset(); + aInfo = ENotActive; + } + + for(TInt index=0; index < iSupportedApertures.Count(); index++) + { + aFStops.AppendL(iSupportedApertures[index]); + } + + aInfo = EDiscreteSteps; + } + +TInt CTestCamAdvSet::Aperture() const + { + return iAperture; + } + +void CTestCamAdvSet::SetAperture(TInt aFStop) + { + TInt eventError = KErrNone; + if(iSupportedApertures.Find(aFStop) == KErrNotFound) + { + eventError = KErrECamParameterNotInRange; + } + else + { + iAperture = aFStop; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingAperture, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const + { + if(iSupportedShutterSpeeds.Count() == 0) + { + aShutterSpeeds.Reset(); + aInfo = ENotActive; + } + + for(TInt index=0; index < iSupportedShutterSpeeds.Count(); index++) + { + aShutterSpeeds.AppendL(iSupportedShutterSpeeds[index]); + aInfo = EDiscreteSteps; + } + } + +TInt CTestCamAdvSet::ShutterSpeed() const + { + return iShutterSpeed; + } + +void CTestCamAdvSet::SetShutterSpeed(TInt aShutterSpeed) + { + TInt eventError = KErrNone; + if(iSupportedShutterSpeeds.Find(aShutterSpeed) == KErrNotFound) + { + eventError = KErrECamParameterNotInRange; + } + else + { + iShutterSpeed = aShutterSpeed; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingShutterSpeed, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedMeteringModes() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TMeteringMode CTestCamAdvSet::MeteringMode() const + { + return CCamera::CCameraAdvancedSettings::EMeteringModeAuto; + } + +void CTestCamAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode) + { + TInt eventError = KErrNotSupported; + if(aMeteringMode == CCamera::CCameraAdvancedSettings::EMeteringModeAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingMeteringMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedDriveModes() const + { + return KSupportedDriveModes; + } + +CCamera::CCameraAdvancedSettings::TDriveMode CTestCamAdvSet::DriveMode() const + { + return iOwner.iDriveMode; + } + +void CTestCamAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode) + { + TInt eventError = KErrNone; + if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) + { + eventError = KErrNotReady; + } + else + { + if(!(aDriveMode & KSupportedDriveModes)) + { + eventError = KErrNotSupported; + } + else + { + if(eventError == KErrNone) + { + iOwner.iDriveMode = aDriveMode; + } + } + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingDriveMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedBracketModes() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketMode CTestCamAdvSet::BracketMode() const + { + return CCamera::CCameraAdvancedSettings::EBracketModeOff; + } + +void CTestCamAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode) + { + TInt eventError = KErrNotSupported; + if(aBracketMode == CCamera::CCameraAdvancedSettings::EBracketModeOff) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingBracketMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedBracketParameters() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketParameter CTestCamAdvSet::BracketParameter() const + { + return CCamera::CCameraAdvancedSettings::EBracketParameterNone; + } + +void CTestCamAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter) + { + TInt eventError = KErrNotSupported; + if(aBracketParameter == CCamera::CCameraAdvancedSettings::EBracketParameterNone) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingBracketParameter, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedBracketSteps() const + { + return KFeatureNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketStep CTestCamAdvSet::BracketStep() const + { + return CCamera::CCameraAdvancedSettings::EBracketStepNonConfig; + } + +void CTestCamAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep) + { + TInt eventError = KErrNotSupported; + if(aBracketStep == CCamera::CCameraAdvancedSettings::EBracketStepNonConfig) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingBracketStep, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const + { + aStartIndex = KFeatureNotSupported; + aFrames = KFeatureNotSupported; + } + +void CTestCamAdvSet::SetBracketMerge(TInt /*aStartIndex*/ , TInt /*aFrames*/) + { + TECAMEvent ecamevent(KUidECamEventBracketMerge, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedFlashModes() const + { + return KFeatureNotSupported; + } + +CCamera::TFlash CTestCamAdvSet::FlashMode() const + { + return CCamera::EFlashNone; + } + +void CTestCamAdvSet::SetFlashMode(CCamera::TFlash /*aMode*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingFlashMode, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::RedEyeReduceOn() const + { + return KDefaultRedEyeReduce; + } + +void CTestCamAdvSet::SetRedEyeReduceOn(TBool /*aState*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingFlashRedEyeReduce, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const + { + aFlashCompensationSteps.Reset(); + aInfo = ENotActive; + } + +TInt CTestCamAdvSet::FlashCompensationStep() const + { + return KFlashCompensationStep; + } + +TInt CTestCamAdvSet::GetFlashCompensationStep(TInt& aFlashCompensationStep) const + { + aFlashCompensationStep = KFlashCompensationStep; + return KErrNone; + } + +void CTestCamAdvSet::GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const + { + aNegativeCompensation = KFlashCompensationStep; + aPositiveCompensation = KFlashCompensationStep; + } + +void CTestCamAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensationStep, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::FlashCompensation() const + { + return KFlashCompensationStep; + } + +TInt CTestCamAdvSet::GetFlashCompensation(TInt& aFlashCompensation) const + { + aFlashCompensation = KFlashCompensationStep; + return KErrNone; + } + +void CTestCamAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensation, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::IsExternalFlashPresent() const + { + return KExternalFlashPresentState; + } + +void CTestCamAdvSet::GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const + { + aManualFlashPowerLevels.Reset(); + aInfo = ENotActive; + } + +TInt CTestCamAdvSet::ManualFlashPowerLevel() const + { + return KErrNotSupported; + } + +void CTestCamAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingFlashManualPower, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedExposureModes() const + { + return CCamera::EExposureAuto; + } + +CCamera::TExposure CTestCamAdvSet::ExposureMode() const + { + return CCamera::EExposureAuto; + } + +void CTestCamAdvSet::SetExposureMode(CCamera::TExposure aExposureMode) + { + TInt eventError = KErrNotSupported; + if(aExposureMode == CCamera::EExposureAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingExposureMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const + { + aExposureCompensationSteps.Reset(); + aInfo = ENotActive; + } + +void CTestCamAdvSet::GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const + { + aNegativeCompensation = KExposureCompensationStep; + aPositiveCompensation = KExposureCompensationStep; + } + +TInt CTestCamAdvSet::ExposureCompensationStep() const + { + return KExposureCompensationStep; + } + +TInt CTestCamAdvSet::GetExposureCompensationStep(TInt& aExposureCompensationStep) const + { + aExposureCompensationStep = KExposureCompensationStep; + return KErrNone; + } + +void CTestCamAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensationStep, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::ExposureCompensation() const + { + return KExposureCompensationStep; + } + +TInt CTestCamAdvSet::GetExposureCompensation(TInt& aExposureCompensation) const + { + aExposureCompensation = KExposureCompensationStep; + return KErrNone; + } + +void CTestCamAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensation, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedWhiteBalanceModes() const + { + return KFeatureNotSupported; + } + +CCamera::TWhiteBalance CTestCamAdvSet::WhiteBalanceMode() const + { + return CCamera::EWBAuto; + } + +void CTestCamAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode) + { + TInt eventError = KErrNotSupported; + if(aWhiteBalanceMode == CCamera::EWBAuto) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingWhiteBalanceMode, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::ApertureExposureLockOn() const + { + return KApertureExposureLockOn; + } + +void CTestCamAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/) + { + TECAMEvent ecamevent(KUidECamEventAELock, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::ShootClickOn() const + { + return KShootClickOn; + } + +void CTestCamAdvSet::SetShootClickOn(TBool /*aShootClickOn*/) + { + TECAMEvent ecamevent(KUidECamEventSoundClick, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const + { + aTimerIntervals.Reset(); + aInfo = ENotActive; + } + +TInt CTestCamAdvSet::TimerInterval() const + { + return KErrNotSupported; + } + +void CTestCamAdvSet::SetTimerInterval(TInt /*aTimerInterval*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingTimerInterval, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const + { + TTime timeLapse(KTimeLapse); + aTimeLapseMin = aTimeLapseMax = timeLapse; + } + +void CTestCamAdvSet::GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const + { + TTime timeLapse(KTimeLapse); + aStart = aEnd = aInterval = timeLapse; + } + +void CTestCamAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingTimeLapse, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +CCamera::CCameraAdvancedSettings::TPictureOrientation CTestCamAdvSet::PictureOrientation() const + { + return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown; + } + +void CTestCamAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation) + { + TInt eventError = KErrNotSupported; + + if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) + { + eventError = KErrNotReady; + } + else + { + if(aOrientation == CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown) + { + eventError = KErrAlreadyExists; + } + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingPictureOrientation, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedPixelAspectRatios() const + { + return KSupportedPixelAspectRatio; + } + +CCamera::CCameraAdvancedSettings::TPixelAspectRatio CTestCamAdvSet::PixelAspectRatio() const + { + return CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; + } + +void CTestCamAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio) + { + TInt eventError = KErrNotSupported; + + if(aPixelAspectRatio == CCamera::CCameraAdvancedSettings::EPixelAspectUnknown) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventPixelAspectRatio, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::SupportedYuvRanges() const + { + return KSupportedYuvRange; + } + +CCamera::CCameraAdvancedSettings::TYuvRange CTestCamAdvSet::YuvRange() const + { + return CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; + } + +void CTestCamAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange) + { + TInt eventError = KErrNotSupported; + + if(aYuvRange == CCamera::CCameraAdvancedSettings::EYuvRangeUnknown) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventYuvRange, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::BurstImages() const + { + return iOwner.iBurstImages; + } + +void CTestCamAdvSet::SetBurstImages(TInt aImages) + { + TInt eventError = iOwner.CheckReserveAndPower(); + + if(eventError == KErrNone) + { + if(aImages == iOwner.iBurstImages) + { + eventError = KErrAlreadyExists; + } + else + { + if(aImages<1) + { + eventError = KErrArgument; + } + } + } + + if(eventError != KErrNone) + { + TECAMEvent ecamevent(KUidECamEventBurstImages, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + return; + } + + if(aImages > KMaxBurstImages) + { + iOwner.iBurstImages = KMaxBurstImages; + } + else + { + iOwner.iBurstImages = aImages; + } + + TECAMEvent ecamevent(KUidECamEventBurstImages, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const + { + aOpticalZoomSteps.Reset(); + aOpticalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +TInt CTestCamAdvSet::OpticalZoom() const + { + return KECamFineResolutionFactor; + } + +void CTestCamAdvSet::SetOpticalZoom(TInt aOpticalZoom) + { + TInt eventError = KErrNotSupported; + + if(aOpticalZoom == KECamFineResolutionFactor) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingOpticalZoom, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, + TValueInfo& aInfo) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +void CTestCamAdvSet::GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aSizeIndex*/, + CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +void CTestCamAdvSet::GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aFrameRateIndex*/, + TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +TInt CTestCamAdvSet::DigitalZoom() const + { + return KECamFineResolutionFactor; + } + +void CTestCamAdvSet::SetDigitalZoom(TInt aDigitalZoom) + { + TInt eventError = KErrNotSupported; + + if(aDigitalZoom == KECamFineResolutionFactor) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingDigitalZoom, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::ExposureLockOn() const + { + return KExposureLockOn; + } + +void CTestCamAdvSet::SetExposureLockOn(TBool aState) + { + TInt eventError = KErrNotSupported; + + if(aState == KExposureLockOn) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingExposureLock, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::AutoFocusLockOn() const + { + return KAutoFocusLockOn; + } + +void CTestCamAdvSet::SetAutoFocusLockOn(TBool aState) + { + TInt eventError = KErrNotSupported; + + if(aState == KAutoFocusLockOn) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusLock, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetSupportedSettingsL(RArray& aSettings) const + { + aSettings.Reset(); + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::GetActiveSettingsL(RArray& aActiveSettings) const + { + aActiveSettings.Reset(); + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::GetDisabledSettingsL(RArray& aDisbledSettings) const + { + aDisbledSettings.Reset(); + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::SetAutomaticSizeSelectionChangeOn(TBool aSetOn) + { + TInt eventError = KErrNotSupported; + + if(aSetOn == KAutomaticSizeSelectionChangeOn) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingAutomaticSizeSelection, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TBool CTestCamAdvSet::AutomaticSizeSelectionChangeOn() const + { + return KAutomaticSizeSelectionChangeOn; + } + +void CTestCamAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const + { + aTimeouts.Reset(); + aInfo = ENotActive; + } + +void CTestCamAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingsContinuousAutoFocusTimeout, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect) + { + TInt eventError = KErrNotSupported; + + if(aEffect == KStabilizationEffect) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingsStabilizationEffect, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +CCamera::CCameraAdvancedSettings::TStabilizationEffect CTestCamAdvSet::StabilizationEffect() const + { + return KStabilizationEffect; + } + +TInt CTestCamAdvSet::SupportedStabilizationEffects() const + { + return KStabilizationEffect; + } + +TInt CTestCamAdvSet::SupportedStabilizationComplexityValues() const + { + return KStabilizationComplexity; + } + +CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CTestCamAdvSet::StabilizationComplexity() const + { + return KStabilizationComplexity; + } + +void CTestCamAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity) + { + TInt eventError = KErrNotSupported; + + if(aComplexity == KStabilizationComplexity) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventSettingsStabilizationAlgorithmComplexity, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +CCamera::CCameraAdvancedSettings::TWBUnits CTestCamAdvSet::SupportedWBUnits() const + { + return KSupportedWBUnits; + } + +void CTestCamAdvSet::SetWBRgbValue(const TRgb& /*aValue*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetWBRgbValue(TRgb& aValue) const + { + aValue = KRgbWhite; + } + +void CTestCamAdvSet::GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const + { + aWBColorTemperatures.Reset(); + aInfo = ENotActive; + } + +void CTestCamAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TInt CTestCamAdvSet::WBColorTemperature() const + { + return KErrNotSupported; + } + +TInt CTestCamAdvSet::ContinuousAutoFocusTimeout() const + { + return KErrNotSupported; + } + +TInt CTestCamAdvSet::IsFlashReady(TBool& aReady) const + { + aReady = KFlashReadyState; + return KErrNone; + } + +void CTestCamAdvSet::GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const + { + aFocusModeSteps.Reset(); + aInfo = ENotActive; + } + +void CTestCamAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/) + { + TECAMEvent ecamevent(KUidECamEventCameraSettingReferenceScreen, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& aPreCaptureWarningSupported) const + { + aPreCaptureWarningSupported = KPreCaptureWarning; + } + +void CTestCamAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/) + { + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::UnSubscribePreCaptureWarningL() + { + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const + { + aSupportedAFAssistantLight = KAFAssisstantLight; + } + +void CTestCamAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& /*aAFAssistantLight*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight) + { + TInt eventError = KErrNotSupported; + + if(aAFAssistantLight == KAFAssisstantLight) + { + eventError = KErrAlreadyExists; + } + + TECAMEvent ecamevent(KUidECamEventCameraSettingAFAssistantLight, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +/**********************************************************************************************************/ +/* CTestCamPresets */ +/**********************************************************************************************************/ + +CTestCamPresets::CTestCamPresets(CTestCamera& aOwner): iOwner(aOwner),iCurrentPreset(KNullUid) + {} + +CTestCamPresets::~CTestCamPresets() + { + iSupportedPresets.Close(); + iFactoryPresetAffectSettings.Close(); + + CDataGlobal* globalData = static_cast (Dll::Tls()); + if(globalData != NULL) + { + if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + globalData->iTestCamPresets = NULL; + Dll::SetTls(globalData); + } + } + } + +CTestCamPresets* CTestCamPresets::NewL(CTestCamera& aOwner) + { + CDataGlobal* globalData = static_cast (Dll::Tls()); + + if(globalData == NULL) + { + globalData = new (ELeave) CDataGlobal; + CleanupStack::PushL(globalData); + globalData->iPresetsReferenceCount = 0; + globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner); + globalData->iTestCamPresets->ConstructL(); + globalData->iTestCamPresets->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData); + return globalData->iTestCamPresets; + } + else + { + if(globalData->iTestCamPresets == NULL) + { + globalData->iPresetsReferenceCount = 0; + globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner); + CleanupStack::PushL(globalData->iTestCamPresets); + globalData->iTestCamPresets->ConstructL(); + globalData->iTestCamPresets->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamPresets); + return globalData->iTestCamPresets; + } + + CTestCamPresets* self = globalData->iTestCamPresets; + + globalData->iPresetsReferenceCount++; + self->iRefCount = globalData->iPresetsReferenceCount + 1; + if (globalData->iPresetsReferenceCount == KNumOfPresetExtensions-1 ) + { + globalData->iTestCamPresets = NULL; + if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + return self; + } + } + +void CTestCamPresets::Release() + { + iRefCount--; + if(iRefCount == 0) + { + delete this; + } + } + +void CTestCamPresets::ConstructL() + { + iSupportedPresets.Reset(); + iSupportedPresets.AppendL(KUidECamPresetFactoryDefault); + + iFactoryPresetAffectSettings.Reset(); + iFactoryPresetAffectSettings.AppendL(KUidECamEventCameraSettingDriveMode); + iFactoryPresetAffectSettings.AppendL(KUidECamEventBurstImages); + } + +void CTestCamPresets::GetSupportedPresetsL(RArray& aPresets) const + { + aPresets.Reset(); + for (TInt index=0; index < iSupportedPresets.Count(); index++) + { + User::LeaveIfError(aPresets.Append(iSupportedPresets[index])); + } + } + +void CTestCamPresets::SetPreset(TUid aPreset) + { + TInt eventError = iOwner.CheckReserveAndPower(); + if(eventError == KErrNone) + { + if(aPreset == iSupportedPresets[0]) + { + //ResetBrightness, Contrast, Drivemode, No. of burst mode images + iOwner.iBrightness = 0; + iOwner.iContrast = 0; + iOwner.iImgProcBrightness = 0; + iOwner.iImgProcContrast = 0; + iOwner.iDriveMode = KDefaultDriveMode; + iOwner.iBurstImages = KBurstImages; + } + else + { + eventError = KErrNotSupported; + } + } + + TECAMEvent ecamevent(aPreset, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +TUid CTestCamPresets::Preset() const + { + return iCurrentPreset; + } + +void CTestCamPresets::GetAffectedSettingsL(RArray& aSettings) const + { + aSettings.Reset(); + + if(iCurrentPreset == iSupportedPresets[0]) + { + for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++) + { + User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index])); + } + } + } + +void CTestCamPresets::GetAssociatedSettingsL(TUid aPreset, RArray& aSettings) const + { + switch(aPreset.iUid) + { + case KUidECamPresetFactoryDefaultUidValue: + { + aSettings.Reset(); + for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++) + { + User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index])); + } + break; + } + + //fall through + case KUidECamPresetOutdoorUidValue: + case KUidECamPresetOutdoorSportUidValue: + case KUidECamPresetSnowUidValue: + case KUidECamPresetBeachUidValue: + case KUidECamPresetNightPortraitUidValue: + case KUidECamPresetNightFireworksUidValue: + case KUidECamPresetFogUidValue: + case KUidECamPresetIndoorUidValue: + case KUidECamPresetIndoorSportUidValue: + { + User::Leave(KErrNotSupported); + } + //fall through + case KUidECamPresetNightPartyIndoorUidValue: + case KUidECamPresetNightCloseUpUidValue: + case KUidECamPresetNightMacroUidValue: + case KUidECamPresetTextDocumentUidValue: + case KUidECamPresetBarcodeUidValue: + case KUidECamPresetAutoUidValue: + case KUidECamPresetPortraitUidValue: + case KUidECamPresetLandscapeUidValue: + case KUidECamPresetAmbienceMoodUidValue: + { + if(iOwner.CameraVersion() == KCameraDefaultVersion) + { + User::Leave(KErrArgument); + } + else + { + User::Leave(KErrNotSupported); + } + } + + default: + User::Leave(KErrArgument); + + } + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_advanced_settings.h --- a/mmplugins/cameraplugins/source/testcamera/test_advanced_settings.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_advanced_settings.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,276 +1,276 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testadvancedsettings.h -// -// - -#ifndef TESTADVANCEDSETTINGS_H -#define TESTADVANCEDSETTINGS_H - -#include "TestCamera.h" -#include - -const TInt KNumOfAdvSetExtensions = 3; -const TInt KNumOfPresetExtensions = 1; -const TInt KNumAvailableCameras = 1; -const TInt KFeatureNotSupported = 0; -const TInt KSupportedDriveModes = CCamera::CCameraAdvancedSettings::EDriveModeAuto | CCamera::CCameraAdvancedSettings::EDriveModeSingleShot | CCamera::CCameraAdvancedSettings::EDriveModeBurst; -const CCamera::CCameraAdvancedSettings::TDriveMode KDefaultDriveMode = CCamera::CCameraAdvancedSettings::EDriveModeSingleShot; -const TBool KDefaultRedEyeReduce = EFalse; -const TInt KFlashCompensationStep = 0; -const TBool KExternalFlashPresentState = EFalse; -const TInt KExposureCompensationStep = 0; -const TBool KApertureExposureLockOn = EFalse; -const TBool KShootClickOn = EFalse; -const TInt64 KTimeLapse = 0; -const CCamera::CCameraAdvancedSettings::TPixelAspectRatio KSupportedPixelAspectRatio = CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; -const CCamera::CCameraAdvancedSettings::TYuvRange KSupportedYuvRange = CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; -const TInt KBurstImages = 4; -const TInt KMaxBurstImages = 10; -const TBool KExposureLockOn = EFalse; -const TBool KAutoFocusLockOn = EFalse; -const TBool KAutomaticSizeSelectionChangeOn = EFalse; -const CCamera::CCameraAdvancedSettings::TStabilizationEffect KStabilizationEffect = CCamera::CCameraAdvancedSettings::EStabilizationOff; -const CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity KStabilizationComplexity = CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto; -const CCamera::CCameraAdvancedSettings::TWBUnits KSupportedWBUnits = CCamera::CCameraAdvancedSettings::EWBUnknown; -const TBool KFlashReadyState = EFalse; -const CCamera::CCameraAdvancedSettings::TPreCaptureWarning KPreCaptureWarning = CCamera::CCameraAdvancedSettings::EPCWNone; -const CCamera::CCameraAdvancedSettings::TAFAssistantLight KAFAssisstantLight = CCamera::CCameraAdvancedSettings::EAFAssistantLightOff; -const CCamera::CCameraAdvancedSettings::TISORateType KSupportedISORateTypes = CCamera::CCameraAdvancedSettings::EISOManual; -const TInt KDefaultIsoRate = 200; -const TInt KDefaultAperture = 280; -const TInt KDefaultShutterSpeed = 100; -const TInt KDefaultFocusDistance = 100; - -// Implementations of the MCameraAdvancedSettings class -class CTestCamAdvSet : public CBase, - public MCameraAdvancedSettings, - public MCameraAdvancedSettings2, - public MCameraAdvancedSettings3 - { - friend class CTestCamera; -public: - static CTestCamAdvSet* NewL(CTestCamera& aOwner); - ~CTestCamAdvSet(); - -protected: - //from MCameraAdvancedSettings - void Release(); - CCamera::CCameraAdvancedSettings::TCameraType CameraType() const; - CCamera::CCameraAdvancedSettings::TCameraType CameraType(TInt aCameraIndex) const; - TBool IsCameraPresent() const; - TBool IsCameraPresent(TInt aCameraIndex) const; - TInt CameraIndex() const; - TInt SupportedStabilizationModes() const; - CCamera::CCameraAdvancedSettings::TStabilizationMode StabilizationMode() const; - void SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode); - TInt SupportedFocusModes() const; - CCamera::CCameraAdvancedSettings::TFocusMode FocusMode() const; - void SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode); - TInt SupportedFocusRanges() const; - CCamera::CCameraAdvancedSettings::TFocusRange FocusRange() const; - void SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange); - TInt SupportedAutoFocusTypes() const; - CCamera::CCameraAdvancedSettings::TAutoFocusType AutoFocusType() const; - void SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType); - TInt SupportedAutoFocusAreas() const; - CCamera::CCameraAdvancedSettings::TAutoFocusArea AutoFocusArea() const; - void SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea); - TInt FocusDistance() const; - void SetFocusDistance(TInt aDistance); - TInt GetMinFocalLength() const; - void GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const; - TInt IsoRate() const; - void SetIsoRate(TInt aRate); - void GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const; - TInt Aperture() const; - void SetAperture(TInt aFStop); - void GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const; - TInt ShutterSpeed() const; - void SetShutterSpeed(TInt aShutterSpeed); - TInt SupportedMeteringModes() const; - CCamera::CCameraAdvancedSettings::TMeteringMode MeteringMode() const; - void SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode); - TInt SupportedDriveModes() const; - CCamera::CCameraAdvancedSettings::TDriveMode DriveMode() const; - void SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode); - TInt SupportedBracketModes() const; - CCamera::CCameraAdvancedSettings::TBracketMode BracketMode() const; - void SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode); - TInt SupportedBracketParameters() const; - CCamera::CCameraAdvancedSettings::TBracketParameter BracketParameter() const; - void SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter); - TInt SupportedBracketSteps() const; - CCamera::CCameraAdvancedSettings::TBracketStep BracketStep() const; - void SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep); - void GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const; - void SetBracketMerge(TInt aStartIndex, TInt aFrames); - TInt SupportedFlashModes() const; - CCamera::TFlash FlashMode() const; - void SetFlashMode(CCamera::TFlash aMode); - TBool RedEyeReduceOn() const; - void SetRedEyeReduceOn(TBool aState); - void GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const; - TInt FlashCompensationStep() const; - TInt GetFlashCompensationStep(TInt& aFlashCompensationStep) const; - void SetFlashCompensationStep(TInt aFlashCompensationStep); - void GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; - TInt FlashCompensation() const; - TInt GetFlashCompensation(TInt& aFlashCompensation) const; - void SetFlashCompensation(TInt aFlashCompensationSteps); - TBool IsExternalFlashPresent() const; - void GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const; - TInt ManualFlashPowerLevel() const; - void SetManualFlashPowerLevel(TInt aManualFlashPowerLevel); - TInt SupportedExposureModes() const; - CCamera::TExposure ExposureMode() const; - void SetExposureMode(CCamera::TExposure aExposureMode); - void GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const; - TInt ExposureCompensationStep() const; - TInt GetExposureCompensationStep(TInt& aExposureCompensationStep) const; - void SetExposureCompensationStep(TInt aExposureCompensationStep); - void GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; - TInt ExposureCompensation() const; - TInt GetExposureCompensation(TInt& aExposureCompensation) const; - void SetExposureCompensation(TInt aExposureCompensationSteps); - TInt SupportedWhiteBalanceModes() const; - CCamera::TWhiteBalance WhiteBalanceMode() const; - void SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode); - TBool ApertureExposureLockOn() const; - void SetApertureExposureLockOn(TBool aAELock); - TBool ShootClickOn() const; - void SetShootClickOn(TBool aShootClickOn); - void GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const; - TInt TimerInterval() const; - void SetTimerInterval(TInt aTimerInterval); - void GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const; - void GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const; - void SetTimeLapse(const TTime& aStart, const TTime& aEnd, const TTime& aInterval); - CCamera::CCameraAdvancedSettings::TPictureOrientation PictureOrientation() const; - void SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation); - TInt SupportedPixelAspectRatios() const; - CCamera::CCameraAdvancedSettings::TPixelAspectRatio PixelAspectRatio() const; - void SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio); - TInt SupportedYuvRanges() const; - CCamera::CCameraAdvancedSettings::TYuvRange YuvRange() const; - void SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange); - TInt BurstImages() const; - void SetBurstImages(TInt aImages); - void GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const; - TInt OpticalZoom() const; - void SetOpticalZoom(TInt aOpticalZoom); - void GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const; - TInt DigitalZoom() const; - void SetDigitalZoom(TInt aDigitalZoom); - TBool ExposureLockOn() const; - void SetExposureLockOn(TBool aState); - TBool AutoFocusLockOn() const; - void SetAutoFocusLockOn(TBool aState); - void GetSupportedSettingsL(RArray& aSettings) const; - void GetActiveSettingsL(RArray& aActiveSettings) const; - void GetDisabledSettingsL(RArray& aDisabledSettings) const; - TBool AutomaticSizeSelectionChangeOn() const; - void SetAutomaticSizeSelectionChangeOn(TBool aSetOn); - void GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const; - TInt ContinuousAutoFocusTimeout() const; - void SetContinuousAutoFocusTimeout(TInt aTimeout); - TInt SupportedStabilizationEffects() const; - CCamera::CCameraAdvancedSettings::TStabilizationEffect StabilizationEffect() const; - void SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect); - TInt SupportedStabilizationComplexityValues() const; - CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity StabilizationComplexity() const; - void SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity); - CCamera::CCameraAdvancedSettings::TWBUnits SupportedWBUnits() const; - void GetWBRgbValue(TRgb& aValue) const; - void SetWBRgbValue(const TRgb& aValue); - void GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const; - TInt WBColorTemperature() const; - void SetWBColorTemperature(TInt aWBColorTemperature); - - //from MCameraAdvancedSettings2 - TInt IsFlashReady(TBool& aReady) const; - void GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const; - - //from MCameraAdvancedSettings3 - void GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const; - void SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam); - void GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& aParam, TInt& aISORate) const; - void SetReferenceScreen(CWsScreenDevice& aScreenDevice); - void GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aSizeIndex, - CCamera::TFormat aFormat, TBool& aIsInfluencePossible) const; - void GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aFrameRateIndex, - TInt aSizeIndex, CCamera::TFormat aFormat, TBool& aIsInfluencePossible, CCamera::TExposure aExposure) const; - void GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode aCameraMode, TInt& aPreCaptureWarningSupported) const; - void SubscribeToPreCaptureWarningL(TInt aPreCaptureWarning); - void UnSubscribePreCaptureWarningL(); - void GetPreCaptureWarningL(TInt& aPreCaptureWarning) const; - void GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const; - void GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& aAFAssistantLight) const; - void SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight); - -private: - CTestCamAdvSet(CTestCamera& aOwner); - void Init(); - void ConstructL(); - -private: - CTestCamera& iOwner; - - TInt iRefCount; - - CCamera::CCameraAdvancedSettings::TCameraType iCameraTypes[KNumAvailableCameras]; - TInt iFocusDistance; - RArray iSupportedISORates; - TInt iIsoRate; - CCamera::CCameraAdvancedSettings::TISORateType iISORateType; - RArray iSupportedApertures; - TInt iAperture; - RArray iSupportedShutterSpeeds; - TInt iShutterSpeed; - }; - -// Implementations of the MCameraPresets class -class CTestCamPresets : public CBase, - public MCameraPresets - { - //friend class CTestCamera; -public: - static CTestCamPresets* NewL(CTestCamera& aOwner); - ~CTestCamPresets(); - -protected: - //from MCameraPresets - void Release(); - void GetSupportedPresetsL(RArray& aPresets) const; - void SetPreset(TUid aPreset); - TUid Preset() const; - void GetAffectedSettingsL(RArray& aSettings) const; - void GetAssociatedSettingsL(TUid aPreset, RArray& aSettings) const; - -private: - CTestCamPresets(CTestCamera& aOwner); - void ConstructL(); - -private: - CTestCamera& iOwner; - - TInt iRefCount; - - RArray iSupportedPresets; - TUid iCurrentPreset; - - RArray iFactoryPresetAffectSettings; - }; - -#endif // TESTADVANCEDSETTINGS_H +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testadvancedsettings.h +// +// + +#ifndef TESTADVANCEDSETTINGS_H +#define TESTADVANCEDSETTINGS_H + +#include "TestCamera.h" +#include + +const TInt KNumOfAdvSetExtensions = 3; +const TInt KNumOfPresetExtensions = 1; +const TInt KNumAvailableCameras = 1; +const TInt KFeatureNotSupported = 0; +const TInt KSupportedDriveModes = CCamera::CCameraAdvancedSettings::EDriveModeAuto | CCamera::CCameraAdvancedSettings::EDriveModeSingleShot | CCamera::CCameraAdvancedSettings::EDriveModeBurst; +const CCamera::CCameraAdvancedSettings::TDriveMode KDefaultDriveMode = CCamera::CCameraAdvancedSettings::EDriveModeSingleShot; +const TBool KDefaultRedEyeReduce = EFalse; +const TInt KFlashCompensationStep = 0; +const TBool KExternalFlashPresentState = EFalse; +const TInt KExposureCompensationStep = 0; +const TBool KApertureExposureLockOn = EFalse; +const TBool KShootClickOn = EFalse; +const TInt64 KTimeLapse = 0; +const CCamera::CCameraAdvancedSettings::TPixelAspectRatio KSupportedPixelAspectRatio = CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; +const CCamera::CCameraAdvancedSettings::TYuvRange KSupportedYuvRange = CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; +const TInt KBurstImages = 4; +const TInt KMaxBurstImages = 10; +const TBool KExposureLockOn = EFalse; +const TBool KAutoFocusLockOn = EFalse; +const TBool KAutomaticSizeSelectionChangeOn = EFalse; +const CCamera::CCameraAdvancedSettings::TStabilizationEffect KStabilizationEffect = CCamera::CCameraAdvancedSettings::EStabilizationOff; +const CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity KStabilizationComplexity = CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto; +const CCamera::CCameraAdvancedSettings::TWBUnits KSupportedWBUnits = CCamera::CCameraAdvancedSettings::EWBUnknown; +const TBool KFlashReadyState = EFalse; +const CCamera::CCameraAdvancedSettings::TPreCaptureWarning KPreCaptureWarning = CCamera::CCameraAdvancedSettings::EPCWNone; +const CCamera::CCameraAdvancedSettings::TAFAssistantLight KAFAssisstantLight = CCamera::CCameraAdvancedSettings::EAFAssistantLightOff; +const CCamera::CCameraAdvancedSettings::TISORateType KSupportedISORateTypes = CCamera::CCameraAdvancedSettings::EISOManual; +const TInt KDefaultIsoRate = 200; +const TInt KDefaultAperture = 280; +const TInt KDefaultShutterSpeed = 100; +const TInt KDefaultFocusDistance = 100; + +// Implementations of the MCameraAdvancedSettings class +class CTestCamAdvSet : public CBase, + public MCameraAdvancedSettings, + public MCameraAdvancedSettings2, + public MCameraAdvancedSettings3 + { + friend class CTestCamera; +public: + static CTestCamAdvSet* NewL(CTestCamera& aOwner); + ~CTestCamAdvSet(); + +protected: + //from MCameraAdvancedSettings + void Release(); + CCamera::CCameraAdvancedSettings::TCameraType CameraType() const; + CCamera::CCameraAdvancedSettings::TCameraType CameraType(TInt aCameraIndex) const; + TBool IsCameraPresent() const; + TBool IsCameraPresent(TInt aCameraIndex) const; + TInt CameraIndex() const; + TInt SupportedStabilizationModes() const; + CCamera::CCameraAdvancedSettings::TStabilizationMode StabilizationMode() const; + void SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode); + TInt SupportedFocusModes() const; + CCamera::CCameraAdvancedSettings::TFocusMode FocusMode() const; + void SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode); + TInt SupportedFocusRanges() const; + CCamera::CCameraAdvancedSettings::TFocusRange FocusRange() const; + void SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange); + TInt SupportedAutoFocusTypes() const; + CCamera::CCameraAdvancedSettings::TAutoFocusType AutoFocusType() const; + void SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType); + TInt SupportedAutoFocusAreas() const; + CCamera::CCameraAdvancedSettings::TAutoFocusArea AutoFocusArea() const; + void SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea); + TInt FocusDistance() const; + void SetFocusDistance(TInt aDistance); + TInt GetMinFocalLength() const; + void GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const; + TInt IsoRate() const; + void SetIsoRate(TInt aRate); + void GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const; + TInt Aperture() const; + void SetAperture(TInt aFStop); + void GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const; + TInt ShutterSpeed() const; + void SetShutterSpeed(TInt aShutterSpeed); + TInt SupportedMeteringModes() const; + CCamera::CCameraAdvancedSettings::TMeteringMode MeteringMode() const; + void SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode); + TInt SupportedDriveModes() const; + CCamera::CCameraAdvancedSettings::TDriveMode DriveMode() const; + void SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode); + TInt SupportedBracketModes() const; + CCamera::CCameraAdvancedSettings::TBracketMode BracketMode() const; + void SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode); + TInt SupportedBracketParameters() const; + CCamera::CCameraAdvancedSettings::TBracketParameter BracketParameter() const; + void SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter); + TInt SupportedBracketSteps() const; + CCamera::CCameraAdvancedSettings::TBracketStep BracketStep() const; + void SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep); + void GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const; + void SetBracketMerge(TInt aStartIndex, TInt aFrames); + TInt SupportedFlashModes() const; + CCamera::TFlash FlashMode() const; + void SetFlashMode(CCamera::TFlash aMode); + TBool RedEyeReduceOn() const; + void SetRedEyeReduceOn(TBool aState); + void GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const; + TInt FlashCompensationStep() const; + TInt GetFlashCompensationStep(TInt& aFlashCompensationStep) const; + void SetFlashCompensationStep(TInt aFlashCompensationStep); + void GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; + TInt FlashCompensation() const; + TInt GetFlashCompensation(TInt& aFlashCompensation) const; + void SetFlashCompensation(TInt aFlashCompensationSteps); + TBool IsExternalFlashPresent() const; + void GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const; + TInt ManualFlashPowerLevel() const; + void SetManualFlashPowerLevel(TInt aManualFlashPowerLevel); + TInt SupportedExposureModes() const; + CCamera::TExposure ExposureMode() const; + void SetExposureMode(CCamera::TExposure aExposureMode); + void GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const; + TInt ExposureCompensationStep() const; + TInt GetExposureCompensationStep(TInt& aExposureCompensationStep) const; + void SetExposureCompensationStep(TInt aExposureCompensationStep); + void GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; + TInt ExposureCompensation() const; + TInt GetExposureCompensation(TInt& aExposureCompensation) const; + void SetExposureCompensation(TInt aExposureCompensationSteps); + TInt SupportedWhiteBalanceModes() const; + CCamera::TWhiteBalance WhiteBalanceMode() const; + void SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode); + TBool ApertureExposureLockOn() const; + void SetApertureExposureLockOn(TBool aAELock); + TBool ShootClickOn() const; + void SetShootClickOn(TBool aShootClickOn); + void GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const; + TInt TimerInterval() const; + void SetTimerInterval(TInt aTimerInterval); + void GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const; + void GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const; + void SetTimeLapse(const TTime& aStart, const TTime& aEnd, const TTime& aInterval); + CCamera::CCameraAdvancedSettings::TPictureOrientation PictureOrientation() const; + void SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation); + TInt SupportedPixelAspectRatios() const; + CCamera::CCameraAdvancedSettings::TPixelAspectRatio PixelAspectRatio() const; + void SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio); + TInt SupportedYuvRanges() const; + CCamera::CCameraAdvancedSettings::TYuvRange YuvRange() const; + void SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange); + TInt BurstImages() const; + void SetBurstImages(TInt aImages); + void GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const; + TInt OpticalZoom() const; + void SetOpticalZoom(TInt aOpticalZoom); + void GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const; + TInt DigitalZoom() const; + void SetDigitalZoom(TInt aDigitalZoom); + TBool ExposureLockOn() const; + void SetExposureLockOn(TBool aState); + TBool AutoFocusLockOn() const; + void SetAutoFocusLockOn(TBool aState); + void GetSupportedSettingsL(RArray& aSettings) const; + void GetActiveSettingsL(RArray& aActiveSettings) const; + void GetDisabledSettingsL(RArray& aDisabledSettings) const; + TBool AutomaticSizeSelectionChangeOn() const; + void SetAutomaticSizeSelectionChangeOn(TBool aSetOn); + void GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const; + TInt ContinuousAutoFocusTimeout() const; + void SetContinuousAutoFocusTimeout(TInt aTimeout); + TInt SupportedStabilizationEffects() const; + CCamera::CCameraAdvancedSettings::TStabilizationEffect StabilizationEffect() const; + void SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect); + TInt SupportedStabilizationComplexityValues() const; + CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity StabilizationComplexity() const; + void SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity); + CCamera::CCameraAdvancedSettings::TWBUnits SupportedWBUnits() const; + void GetWBRgbValue(TRgb& aValue) const; + void SetWBRgbValue(const TRgb& aValue); + void GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const; + TInt WBColorTemperature() const; + void SetWBColorTemperature(TInt aWBColorTemperature); + + //from MCameraAdvancedSettings2 + TInt IsFlashReady(TBool& aReady) const; + void GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const; + + //from MCameraAdvancedSettings3 + void GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const; + void SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam); + void GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& aParam, TInt& aISORate) const; + void SetReferenceScreen(CWsScreenDevice& aScreenDevice); + void GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aSizeIndex, + CCamera::TFormat aFormat, TBool& aIsInfluencePossible) const; + void GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aFrameRateIndex, + TInt aSizeIndex, CCamera::TFormat aFormat, TBool& aIsInfluencePossible, CCamera::TExposure aExposure) const; + void GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode aCameraMode, TInt& aPreCaptureWarningSupported) const; + void SubscribeToPreCaptureWarningL(TInt aPreCaptureWarning); + void UnSubscribePreCaptureWarningL(); + void GetPreCaptureWarningL(TInt& aPreCaptureWarning) const; + void GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const; + void GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& aAFAssistantLight) const; + void SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight); + +private: + CTestCamAdvSet(CTestCamera& aOwner); + void Init(); + void ConstructL(); + +private: + CTestCamera& iOwner; + + TInt iRefCount; + + CCamera::CCameraAdvancedSettings::TCameraType iCameraTypes[KNumAvailableCameras]; + TInt iFocusDistance; + RArray iSupportedISORates; + TInt iIsoRate; + CCamera::CCameraAdvancedSettings::TISORateType iISORateType; + RArray iSupportedApertures; + TInt iAperture; + RArray iSupportedShutterSpeeds; + TInt iShutterSpeed; + }; + +// Implementations of the MCameraPresets class +class CTestCamPresets : public CBase, + public MCameraPresets + { + //friend class CTestCamera; +public: + static CTestCamPresets* NewL(CTestCamera& aOwner); + ~CTestCamPresets(); + +protected: + //from MCameraPresets + void Release(); + void GetSupportedPresetsL(RArray& aPresets) const; + void SetPreset(TUid aPreset); + TUid Preset() const; + void GetAffectedSettingsL(RArray& aSettings) const; + void GetAssociatedSettingsL(TUid aPreset, RArray& aSettings) const; + +private: + CTestCamPresets(CTestCamera& aOwner); + void ConstructL(); + +private: + CTestCamera& iOwner; + + TInt iRefCount; + + RArray iSupportedPresets; + TUid iCurrentPreset; + + RArray iFactoryPresetAffectSettings; + }; + +#endif // TESTADVANCEDSETTINGS_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_image_processing.cpp --- a/mmplugins/cameraplugins/source/testcamera/test_image_processing.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_image_processing.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,441 +1,441 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testimageprocessing.cpp -// -// - -#include "test_image_processing.h" -#include -#include "ecamversion.h" - -CTestCamImgProc::CTestCamImgProc(CTestCamera& aOwner): iOwner(aOwner) - {} - -CTestCamImgProc::~CTestCamImgProc() - { - iSupportedTranformations.Close(); - iActiveTransformations.Close(); - iActiveTransformSequence.Close(); - - CDataGlobal* globalData = static_cast (Dll::Tls()); - if(globalData != NULL) - { - if(!globalData->iTestCamAdvSet && !globalData->iTestCamPresets && !globalData->iTestCamSnapshot) - { - delete globalData; - Dll::FreeTls(); - } - else - { - globalData->iTestCamImgProc = NULL; - Dll::SetTls(globalData); - } - } - } - -CTestCamImgProc* CTestCamImgProc::NewL(CTestCamera& aOwner) - { - CDataGlobal* globalData = static_cast (Dll::Tls()); - - if(globalData == NULL) - { - globalData = new (ELeave) CDataGlobal; - CleanupStack::PushL(globalData); - globalData->iImgProcReferenceCount = 0; - globalData->iTestCamImgProc = new (ELeave) CTestCamImgProc(aOwner); - CleanupStack::PushL(globalData->iTestCamImgProc); - globalData->iTestCamImgProc->ConstructL(); - globalData->iTestCamImgProc->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamImgProc); - CleanupStack::Pop(globalData); - return globalData->iTestCamImgProc; - } - else - { - if(globalData->iTestCamImgProc == NULL) - { - globalData->iImgProcReferenceCount = 0; - globalData->iTestCamImgProc = new (ELeave) CTestCamImgProc(aOwner); - CleanupStack::PushL(globalData->iTestCamImgProc); - globalData->iTestCamImgProc->ConstructL(); - globalData->iTestCamImgProc->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamImgProc); - return globalData->iTestCamImgProc; - } - - CTestCamImgProc* self = globalData->iTestCamImgProc; - - globalData->iImgProcReferenceCount++; - self->iRefCount = globalData->iImgProcReferenceCount + 1; - if (globalData->iImgProcReferenceCount == KNumOfImgProcExtensions-1) - { - globalData->iTestCamImgProc = NULL; - if(!globalData->iTestCamAdvSet && !globalData->iTestCamPresets && !globalData->iTestCamSnapshot) - { - delete globalData; - Dll::FreeTls(); - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - return self; - } - } - -void CTestCamImgProc::Release() - { - iRefCount--; - if(iRefCount == 0) - { - iOwner.iImgProcImpl = NULL; - delete this; - } - } - -void CTestCamImgProc::ConstructL() - { - iSupportedTranformations.Reset(); - iSupportedTranformations.AppendL(KUidECamEventImageProcessingAdjustBrightness); - iSupportedTranformations.AppendL(KUidECamEventImageProcessingAdjustContrast); - - iActiveTransformations.Reset(); - - iActiveTransformSequence.Reset(); - } - -void CTestCamImgProc::GetSupportedTransformationsL(RArray& aTransformations) const - { - aTransformations.Reset(); - for(TInt index=0; index < iSupportedTranformations.Count(); index++) - { - aTransformations.AppendL(iSupportedTranformations[index]); - } - } - -void CTestCamImgProc::GetActiveTransformationsL(RArray& aTransformations) const - { - aTransformations.Reset(); - for(TInt index=0; index < iActiveTransformations.Count(); index++) - { - aTransformations.AppendL(iActiveTransformations[index]); - } - } - -void CTestCamImgProc::GetTransformationSupportedValuesL(TUid aTransformation, RArray& aValues, TValueInfo& aInfo) const - { - TInt err = iActiveTransformations.Find(aTransformation); - if(err == KErrNotFound) - { - User::Leave(err); - } - - switch(aTransformation.iUid) - { - case KUidECamEventImageProcessingAdjustBrightnessUidValue: - { - aInfo = EContinuousRangeMinMax; - aValues.Reset(); - aValues.AppendL(KMinBrightness); - aValues.AppendL(KMaxBrightness); - break; - } - - case KUidECamEventImageProcessingAdjustContrastUidValue: - { - aInfo = EContinuousRangeMinMax; - aValues.Reset(); - aValues.AppendL(KMinContrast); - aValues.AppendL(KMaxContrast); - break; - } - - default: - User::Leave(KErrNotSupported); - } - } - -TInt CTestCamImgProc::TransformationValue(TUid aTransformation) const - { - switch(aTransformation.iUid) - { - case KUidECamEventImageProcessingAdjustBrightnessUidValue: - { - return iOwner.iImgProcBrightness; - } - - case KUidECamEventImageProcessingAdjustContrastUidValue: - { - return iOwner.iImgProcContrast; - } - - default: - return 0; - } - } - -TInt CTestCamImgProc::GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const - { - switch(aTransformation.iUid) - { - case KUidECamEventImageProcessingAdjustBrightnessUidValue: - { - aTransformationValue = iOwner.iImgProcBrightness; - return KErrNone; - } - - case KUidECamEventImageProcessingAdjustContrastUidValue: - { - aTransformationValue = iOwner.iImgProcContrast; - return KErrNone; - } - - default: - return KErrNotSupported; - } - } - -void CTestCamImgProc::SetTransformationValue(TUid aTransformation, TInt aValue) - { - TInt eventError = iOwner.CheckReserveAndPower(); - - if(eventError == KErrNone) - { - switch(aTransformation.iUid) - { - case KUidECamEventImageProcessingAdjustBrightnessUidValue: - { - if(aValue < KMinBrightness) - { - iOwner.iImgProcBrightness = KMinBrightness; - } - else - { - if(aValue > KMaxBrightness) - { - iOwner.iImgProcBrightness = KMaxBrightness; - } - else - { - iOwner.iImgProcBrightness = aValue; - } - } - break; - } - - case KUidECamEventImageProcessingAdjustContrastUidValue: - { - if(aValue < KMinContrast) - { - iOwner.iImgProcContrast = KMinContrast; - } - else - { - if(aValue > KMaxContrast) - { - iOwner.iImgProcContrast = KMaxContrast; - } - else - { - iOwner.iImgProcContrast = aValue; - } - } - break; - } - - default: - eventError = KErrNotSupported; - } - } - - if(eventError == KErrNone) - { - eventError = iActiveTransformations.Find(aTransformation); - - if(eventError == KErrNotFound) - { - eventError = iActiveTransformations.Append(aTransformation); - - if(eventError == KErrNone) - { - if(IsTransform(aTransformation)) - { - eventError = iActiveTransformSequence.Append(aTransformation); - } - } - } - else - { - eventError = KErrNone; - } - } - - TECAMEvent ecamevent(aTransformation, eventError); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamImgProc::GetActiveTransformSequenceL(RArray& aTransformSequence) const - { - aTransformSequence.Reset(); - for(TInt index=0; index < iActiveTransformSequence.Count(); index++) - { - aTransformSequence.AppendL(iActiveTransformSequence[index]); - } - } - -void CTestCamImgProc::SetActiveTransformSequenceL(RArray& aTransformSequence) - { - TInt err = KErrNone; - for(TInt index=0; index < aTransformSequence.Count(); index++) - { - err = iActiveTransformations.Find(aTransformSequence[index]); - if(err == KErrNotFound) - { - User::Leave(err); - } - } - - iActiveTransformSequence.Reset(); - for(TInt index=0; index < aTransformSequence.Count(); index++) - { - iActiveTransformSequence.AppendL(aTransformSequence[index]); - } - } - -void CTestCamImgProc::SetSourceRect(const TRect& /*aRect*/) - { - return; - } - -void CTestCamImgProc::GetSourceRect(TRect& /*aRect*/) const - { - return; - } - -void CTestCamImgProc::GetConcurrentColorSwappingsSupportedL(TInt& /*aConcurrentColorSwappingSupported*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::GetColorSwapCapabilitiesL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationCapabilities& /*aColorSwapCapabilities*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::SetColorSwapEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorSwapParameters*/) - { - TECAMEvent2 ecamevent2(KUidECamEventCIPSetColorSwapEntry, KErrNotSupported, aIndex); - - iOwner.iECamEvent2 = ecamevent2; - iOwner.iHandleEvent2Async.CallBack(); - } - -void CTestCamImgProc::RemoveColorSwapEntry(TInt aIndex) - { - TECAMEvent2 ecamevent2(KUidECamEventCIPRemoveColorSwapEntry, KErrNotSupported, aIndex); - - iOwner.iECamEvent2 = ecamevent2; - iOwner.iHandleEvent2Async.CallBack(); - } - -void CTestCamImgProc::GetColorSwapEntryL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorSwapParameters*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::StartColorSwapping() - { - TECAMEvent ecamevent(KUidECamEventCIPStartColorSwap, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamImgProc::CancelColorSwappingL() - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::GetConcurrentColorAccentSupportedL(TInt& /*aConcurrentColorAccentSupported*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::GetColorAccentCapabilitiesL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationCapabilities& /*aColorAccentCapabilities*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::SetColorAccentEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorAccentParameters*/) - { - TECAMEvent2 ecamevent2(KUidECamEventCIPSetColorAccentEntry, KErrNotSupported, aIndex); - - iOwner.iECamEvent2 = ecamevent2; - iOwner.iHandleEvent2Async.CallBack(); - } - -void CTestCamImgProc::RemoveColorAccentEntry(TInt aIndex) - { - TECAMEvent2 ecamevent2(KUidECamEventCIPRemoveColorAccentEntry, KErrNotSupported, aIndex); - - iOwner.iECamEvent2 = ecamevent2; - iOwner.iHandleEvent2Async.CallBack(); - } - -void CTestCamImgProc::GetColorAccentEntryL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorAccentParameters*/) const - { - User::Leave(KErrNotSupported); - } - -void CTestCamImgProc::StartColorAccent() - { - TECAMEvent ecamevent(KUidECamEventCIPStartColorAccent, KErrNotSupported); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - -void CTestCamImgProc::CancelColorAccentL() - { - User::Leave(KErrNotSupported); - } - -TBool CTestCamImgProc::IsTransform(TUid aTransformation) - { - switch(aTransformation.iUid) - { - //fall through - case KUidECamEventImageProcessingTransformCropUidValue: - case KUidECamEventImageProcessingTransformRotateUidValue: - case KUidECamEventImageProcessingTransformMirrorUidValue: - case KUidECamEventImageProcessingTransformScaleUidValue: - case KUidECamEventImageProcessingSourceRectUidValue: - case KUidECamEventImageProcessingNoiseReductionUidValue: - case KUidECamEventImageProcessingGlareRemovalUidValue: - { - return ETrue; - } - default: - return EFalse; - } - } +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testimageprocessing.cpp +// +// + +#include "test_image_processing.h" +#include +#include + +CTestCamImgProc::CTestCamImgProc(CTestCamera& aOwner): iOwner(aOwner) + {} + +CTestCamImgProc::~CTestCamImgProc() + { + iSupportedTranformations.Close(); + iActiveTransformations.Close(); + iActiveTransformSequence.Close(); + + CDataGlobal* globalData = static_cast (Dll::Tls()); + if(globalData != NULL) + { + if(!globalData->iTestCamAdvSet && !globalData->iTestCamPresets && !globalData->iTestCamSnapshot) + { + delete globalData; + Dll::FreeTls(); + } + else + { + globalData->iTestCamImgProc = NULL; + Dll::SetTls(globalData); + } + } + } + +CTestCamImgProc* CTestCamImgProc::NewL(CTestCamera& aOwner) + { + CDataGlobal* globalData = static_cast (Dll::Tls()); + + if(globalData == NULL) + { + globalData = new (ELeave) CDataGlobal; + CleanupStack::PushL(globalData); + globalData->iImgProcReferenceCount = 0; + globalData->iTestCamImgProc = new (ELeave) CTestCamImgProc(aOwner); + CleanupStack::PushL(globalData->iTestCamImgProc); + globalData->iTestCamImgProc->ConstructL(); + globalData->iTestCamImgProc->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamImgProc); + CleanupStack::Pop(globalData); + return globalData->iTestCamImgProc; + } + else + { + if(globalData->iTestCamImgProc == NULL) + { + globalData->iImgProcReferenceCount = 0; + globalData->iTestCamImgProc = new (ELeave) CTestCamImgProc(aOwner); + CleanupStack::PushL(globalData->iTestCamImgProc); + globalData->iTestCamImgProc->ConstructL(); + globalData->iTestCamImgProc->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamImgProc); + return globalData->iTestCamImgProc; + } + + CTestCamImgProc* self = globalData->iTestCamImgProc; + + globalData->iImgProcReferenceCount++; + self->iRefCount = globalData->iImgProcReferenceCount + 1; + if (globalData->iImgProcReferenceCount == KNumOfImgProcExtensions-1) + { + globalData->iTestCamImgProc = NULL; + if(!globalData->iTestCamAdvSet && !globalData->iTestCamPresets && !globalData->iTestCamSnapshot) + { + delete globalData; + Dll::FreeTls(); + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + return self; + } + } + +void CTestCamImgProc::Release() + { + iRefCount--; + if(iRefCount == 0) + { + iOwner.iImgProcImpl = NULL; + delete this; + } + } + +void CTestCamImgProc::ConstructL() + { + iSupportedTranformations.Reset(); + iSupportedTranformations.AppendL(KUidECamEventImageProcessingAdjustBrightness); + iSupportedTranformations.AppendL(KUidECamEventImageProcessingAdjustContrast); + + iActiveTransformations.Reset(); + + iActiveTransformSequence.Reset(); + } + +void CTestCamImgProc::GetSupportedTransformationsL(RArray& aTransformations) const + { + aTransformations.Reset(); + for(TInt index=0; index < iSupportedTranformations.Count(); index++) + { + aTransformations.AppendL(iSupportedTranformations[index]); + } + } + +void CTestCamImgProc::GetActiveTransformationsL(RArray& aTransformations) const + { + aTransformations.Reset(); + for(TInt index=0; index < iActiveTransformations.Count(); index++) + { + aTransformations.AppendL(iActiveTransformations[index]); + } + } + +void CTestCamImgProc::GetTransformationSupportedValuesL(TUid aTransformation, RArray& aValues, TValueInfo& aInfo) const + { + TInt err = iActiveTransformations.Find(aTransformation); + if(err == KErrNotFound) + { + User::Leave(err); + } + + switch(aTransformation.iUid) + { + case KUidECamEventImageProcessingAdjustBrightnessUidValue: + { + aInfo = EContinuousRangeMinMax; + aValues.Reset(); + aValues.AppendL(KMinBrightness); + aValues.AppendL(KMaxBrightness); + break; + } + + case KUidECamEventImageProcessingAdjustContrastUidValue: + { + aInfo = EContinuousRangeMinMax; + aValues.Reset(); + aValues.AppendL(KMinContrast); + aValues.AppendL(KMaxContrast); + break; + } + + default: + User::Leave(KErrNotSupported); + } + } + +TInt CTestCamImgProc::TransformationValue(TUid aTransformation) const + { + switch(aTransformation.iUid) + { + case KUidECamEventImageProcessingAdjustBrightnessUidValue: + { + return iOwner.iImgProcBrightness; + } + + case KUidECamEventImageProcessingAdjustContrastUidValue: + { + return iOwner.iImgProcContrast; + } + + default: + return 0; + } + } + +TInt CTestCamImgProc::GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const + { + switch(aTransformation.iUid) + { + case KUidECamEventImageProcessingAdjustBrightnessUidValue: + { + aTransformationValue = iOwner.iImgProcBrightness; + return KErrNone; + } + + case KUidECamEventImageProcessingAdjustContrastUidValue: + { + aTransformationValue = iOwner.iImgProcContrast; + return KErrNone; + } + + default: + return KErrNotSupported; + } + } + +void CTestCamImgProc::SetTransformationValue(TUid aTransformation, TInt aValue) + { + TInt eventError = iOwner.CheckReserveAndPower(); + + if(eventError == KErrNone) + { + switch(aTransformation.iUid) + { + case KUidECamEventImageProcessingAdjustBrightnessUidValue: + { + if(aValue < KMinBrightness) + { + iOwner.iImgProcBrightness = KMinBrightness; + } + else + { + if(aValue > KMaxBrightness) + { + iOwner.iImgProcBrightness = KMaxBrightness; + } + else + { + iOwner.iImgProcBrightness = aValue; + } + } + break; + } + + case KUidECamEventImageProcessingAdjustContrastUidValue: + { + if(aValue < KMinContrast) + { + iOwner.iImgProcContrast = KMinContrast; + } + else + { + if(aValue > KMaxContrast) + { + iOwner.iImgProcContrast = KMaxContrast; + } + else + { + iOwner.iImgProcContrast = aValue; + } + } + break; + } + + default: + eventError = KErrNotSupported; + } + } + + if(eventError == KErrNone) + { + eventError = iActiveTransformations.Find(aTransformation); + + if(eventError == KErrNotFound) + { + eventError = iActiveTransformations.Append(aTransformation); + + if(eventError == KErrNone) + { + if(IsTransform(aTransformation)) + { + eventError = iActiveTransformSequence.Append(aTransformation); + } + } + } + else + { + eventError = KErrNone; + } + } + + TECAMEvent ecamevent(aTransformation, eventError); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamImgProc::GetActiveTransformSequenceL(RArray& aTransformSequence) const + { + aTransformSequence.Reset(); + for(TInt index=0; index < iActiveTransformSequence.Count(); index++) + { + aTransformSequence.AppendL(iActiveTransformSequence[index]); + } + } + +void CTestCamImgProc::SetActiveTransformSequenceL(RArray& aTransformSequence) + { + TInt err = KErrNone; + for(TInt index=0; index < aTransformSequence.Count(); index++) + { + err = iActiveTransformations.Find(aTransformSequence[index]); + if(err == KErrNotFound) + { + User::Leave(err); + } + } + + iActiveTransformSequence.Reset(); + for(TInt index=0; index < aTransformSequence.Count(); index++) + { + iActiveTransformSequence.AppendL(aTransformSequence[index]); + } + } + +void CTestCamImgProc::SetSourceRect(const TRect& /*aRect*/) + { + return; + } + +void CTestCamImgProc::GetSourceRect(TRect& /*aRect*/) const + { + return; + } + +void CTestCamImgProc::GetConcurrentColorSwappingsSupportedL(TInt& /*aConcurrentColorSwappingSupported*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::GetColorSwapCapabilitiesL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationCapabilities& /*aColorSwapCapabilities*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::SetColorSwapEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorSwapParameters*/) + { + TECAMEvent2 ecamevent2(KUidECamEventCIPSetColorSwapEntry, KErrNotSupported, aIndex); + + iOwner.iECamEvent2 = ecamevent2; + iOwner.iHandleEvent2Async.CallBack(); + } + +void CTestCamImgProc::RemoveColorSwapEntry(TInt aIndex) + { + TECAMEvent2 ecamevent2(KUidECamEventCIPRemoveColorSwapEntry, KErrNotSupported, aIndex); + + iOwner.iECamEvent2 = ecamevent2; + iOwner.iHandleEvent2Async.CallBack(); + } + +void CTestCamImgProc::GetColorSwapEntryL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorSwapParameters*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::StartColorSwapping() + { + TECAMEvent ecamevent(KUidECamEventCIPStartColorSwap, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamImgProc::CancelColorSwappingL() + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::GetConcurrentColorAccentSupportedL(TInt& /*aConcurrentColorAccentSupported*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::GetColorAccentCapabilitiesL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationCapabilities& /*aColorAccentCapabilities*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::SetColorAccentEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorAccentParameters*/) + { + TECAMEvent2 ecamevent2(KUidECamEventCIPSetColorAccentEntry, KErrNotSupported, aIndex); + + iOwner.iECamEvent2 = ecamevent2; + iOwner.iHandleEvent2Async.CallBack(); + } + +void CTestCamImgProc::RemoveColorAccentEntry(TInt aIndex) + { + TECAMEvent2 ecamevent2(KUidECamEventCIPRemoveColorAccentEntry, KErrNotSupported, aIndex); + + iOwner.iECamEvent2 = ecamevent2; + iOwner.iHandleEvent2Async.CallBack(); + } + +void CTestCamImgProc::GetColorAccentEntryL(TInt /*aIndex*/, CCamera::CCameraImageProcessing::TColorOperationEntry& /*aColorAccentParameters*/) const + { + User::Leave(KErrNotSupported); + } + +void CTestCamImgProc::StartColorAccent() + { + TECAMEvent ecamevent(KUidECamEventCIPStartColorAccent, KErrNotSupported); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + +void CTestCamImgProc::CancelColorAccentL() + { + User::Leave(KErrNotSupported); + } + +TBool CTestCamImgProc::IsTransform(TUid aTransformation) + { + switch(aTransformation.iUid) + { + //fall through + case KUidECamEventImageProcessingTransformCropUidValue: + case KUidECamEventImageProcessingTransformRotateUidValue: + case KUidECamEventImageProcessingTransformMirrorUidValue: + case KUidECamEventImageProcessingTransformScaleUidValue: + case KUidECamEventImageProcessingSourceRectUidValue: + case KUidECamEventImageProcessingNoiseReductionUidValue: + case KUidECamEventImageProcessingGlareRemovalUidValue: + { + return ETrue; + } + default: + return EFalse; + } + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_image_processing.h --- a/mmplugins/cameraplugins/source/testcamera/test_image_processing.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_image_processing.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,85 +1,85 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testimageprocessing.h -// -// - -#ifndef TESTIMAGEPROCESSING_H -#define TESTIMAGEPROCESSING_H - -#include "TestCamera.h" -#include - -const TInt KNumOfImgProcExtensions = 2; -const TInt KMinBrightness = -100; -const TInt KMaxBrightness = 100; -const TInt KMinContrast = -100; -const TInt KMaxContrast = 100; - -// Implementations of the MCameraImageProcessing class -class CTestCamImgProc : public CBase, - public MCameraImageProcessing, - public MCameraImageProcessing2 - { - friend class CTestCamera; -public: - static CTestCamImgProc* NewL(CTestCamera& aOwner); - ~CTestCamImgProc(); - -protected: - //from MCameraImageProcessing - void Release(); - void GetSupportedTransformationsL(RArray& aTransformations) const; - void GetActiveTransformationsL(RArray& aTransformations) const; - void GetTransformationSupportedValuesL(TUid aTransformation, RArray& aValues, TValueInfo& aInfo) const; - TInt TransformationValue(TUid aTransformation) const; - TInt GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const; - void SetTransformationValue(TUid aTransformation, TInt aValue); - void GetActiveTransformSequenceL(RArray& aTransformSequence) const; - void SetActiveTransformSequenceL(RArray& aTransformSequence); - void SetSourceRect(const TRect& aRect); - void GetSourceRect(TRect& aRect) const; - - //from MCameraImageProcessing2 - void GetConcurrentColorSwappingsSupportedL(TInt& aConcurrentColorSwappingSupported) const; - void GetColorSwapCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorSwapCapabilities) const; - void SetColorSwapEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters); - void RemoveColorSwapEntry(TInt aIndex); - void GetColorSwapEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters) const; - void StartColorSwapping(); - void CancelColorSwappingL(); - void GetConcurrentColorAccentSupportedL(TInt& aConcurrentColorAccentSupported) const; - void GetColorAccentCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorAccentCapabilities) const; - void SetColorAccentEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters); - void RemoveColorAccentEntry(TInt aIndex); - void GetColorAccentEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters) const; - void StartColorAccent(); - void CancelColorAccentL(); - -private: - CTestCamImgProc(CTestCamera& aOwner); - void ConstructL(); - - TBool IsTransform(TUid aTransformation); - -private: - CTestCamera& iOwner; - - TInt iRefCount; - - RArray iSupportedTranformations; - RArray iActiveTransformations; - RArray iActiveTransformSequence; - }; -#endif // TESTIMAGEPROCESSING_H +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testimageprocessing.h +// +// + +#ifndef TESTIMAGEPROCESSING_H +#define TESTIMAGEPROCESSING_H + +#include "TestCamera.h" +#include + +const TInt KNumOfImgProcExtensions = 2; +const TInt KMinBrightness = -100; +const TInt KMaxBrightness = 100; +const TInt KMinContrast = -100; +const TInt KMaxContrast = 100; + +// Implementations of the MCameraImageProcessing class +class CTestCamImgProc : public CBase, + public MCameraImageProcessing, + public MCameraImageProcessing2 + { + friend class CTestCamera; +public: + static CTestCamImgProc* NewL(CTestCamera& aOwner); + ~CTestCamImgProc(); + +protected: + //from MCameraImageProcessing + void Release(); + void GetSupportedTransformationsL(RArray& aTransformations) const; + void GetActiveTransformationsL(RArray& aTransformations) const; + void GetTransformationSupportedValuesL(TUid aTransformation, RArray& aValues, TValueInfo& aInfo) const; + TInt TransformationValue(TUid aTransformation) const; + TInt GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const; + void SetTransformationValue(TUid aTransformation, TInt aValue); + void GetActiveTransformSequenceL(RArray& aTransformSequence) const; + void SetActiveTransformSequenceL(RArray& aTransformSequence); + void SetSourceRect(const TRect& aRect); + void GetSourceRect(TRect& aRect) const; + + //from MCameraImageProcessing2 + void GetConcurrentColorSwappingsSupportedL(TInt& aConcurrentColorSwappingSupported) const; + void GetColorSwapCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorSwapCapabilities) const; + void SetColorSwapEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters); + void RemoveColorSwapEntry(TInt aIndex); + void GetColorSwapEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters) const; + void StartColorSwapping(); + void CancelColorSwappingL(); + void GetConcurrentColorAccentSupportedL(TInt& aConcurrentColorAccentSupported) const; + void GetColorAccentCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorAccentCapabilities) const; + void SetColorAccentEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters); + void RemoveColorAccentEntry(TInt aIndex); + void GetColorAccentEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters) const; + void StartColorAccent(); + void CancelColorAccentL(); + +private: + CTestCamImgProc(CTestCamera& aOwner); + void ConstructL(); + + TBool IsTransform(TUid aTransformation); + +private: + CTestCamera& iOwner; + + TInt iRefCount; + + RArray iSupportedTranformations; + RArray iActiveTransformations; + RArray iActiveTransformSequence; + }; +#endif // TESTIMAGEPROCESSING_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_snapshot.cpp --- a/mmplugins/cameraplugins/source/testcamera/test_snapshot.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_snapshot.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,360 +1,359 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testsnapshot.cpp -// -// - -#include "test_snapshot.h" -#include - -CTestCamSnapshot::CTestCamSnapshot(CTestCamera& aOwner): iOwner(aOwner), iSnapshotBuffer(iSnapshot) - { - Init(); - } - -CTestCamSnapshot::~CTestCamSnapshot() - { - delete iSnapshotImage; - iSnapshotImage = NULL; - delete iSnapshotImageGc; - iSnapshotImage = NULL; - delete iSnapshotImageDev; - iSnapshotImageDev = NULL; - - delete iSnapshot; - iSnapshot = NULL; - delete iSnapshotGc; - iSnapshotGc = NULL; - delete iSnapshotDev; - iSnapshotDev = NULL; - - iSupportedSnapshotRect.Close(); - - CDataGlobal* globalData = static_cast (Dll::Tls()); - if(globalData != NULL) - { - if(!globalData->iTestCamPresets && !globalData->iTestCamAdvSet && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - globalData->iTestCamSnapshot = NULL; - Dll::SetTls(globalData); - } - } - } - -CTestCamSnapshot* CTestCamSnapshot::NewL(CTestCamera& aOwner) - { - CDataGlobal* globalData = static_cast (Dll::Tls()); - - if(globalData == NULL) - { - globalData = new (ELeave) CDataGlobal; - CleanupStack::PushL(globalData); - globalData->iSnapshotReferenceCount = 0; - globalData->iTestCamSnapshot = new (ELeave) CTestCamSnapshot(aOwner); - CleanupStack::PushL(globalData->iTestCamSnapshot); - globalData->iTestCamSnapshot->ConstructL(); - globalData->iTestCamSnapshot->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamSnapshot); - CleanupStack::Pop(globalData); - return globalData->iTestCamSnapshot; - } - else - { - if(globalData->iTestCamSnapshot == NULL) - { - globalData->iSnapshotReferenceCount = 0; - globalData->iTestCamSnapshot = new (ELeave) CTestCamSnapshot(aOwner); - CleanupStack::PushL(globalData->iTestCamSnapshot); - globalData->iTestCamSnapshot->ConstructL(); - globalData->iTestCamSnapshot->iRefCount = 1; - User::LeaveIfError(Dll::SetTls(globalData)); - CleanupStack::Pop(globalData->iTestCamSnapshot); - return globalData->iTestCamSnapshot; - } - - CTestCamSnapshot* self = globalData->iTestCamSnapshot; - - globalData->iSnapshotReferenceCount++; - self->iRefCount = globalData->iSnapshotReferenceCount + 1; - if (globalData->iSnapshotReferenceCount == KNumOfSnapshotExtensions-1 ) - { - globalData->iTestCamSnapshot = NULL; - if(!globalData->iTestCamPresets && !globalData->iTestCamAdvSet && !globalData->iTestCamImgProc) - { - delete globalData; - Dll::FreeTls(); - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - } - else - { - User::LeaveIfError(Dll::SetTls(globalData)); - } - return self; - } - } - -void CTestCamSnapshot::Release() - { - iRefCount--; - if(iRefCount == 0) - { - iOwner.iSnapshotImpl = NULL; - delete this; - } - } - -void CTestCamSnapshot::Init() - { - iImageFormatsSupported = 0; - iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor4K; - iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor64K; - iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor16M; - iSnapshotPrepared = EFalse; - iSnapshotActive = EFalse; - iBgColor = KRgbWhite; - } - -void CTestCamSnapshot::ConstructL() - { - iSupportedSnapshotRect.Reset(); - iSupportedSnapshotRect.AppendL(TRect(TPoint(0,0), iOwner.iImageSizes[0])); - iSupportedSnapshotRect.AppendL(TRect(TPoint(0,0), iOwner.iImageSizes[1])); - } - -TUint32 CTestCamSnapshot::SupportedFormats() - { - return iImageFormatsSupported; - } - -void CTestCamSnapshot::PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool /*aMaintainAspectRatio*/) - { - iOwner.CheckReserveAndPowerL(); - - if (iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) - { - User::Leave(KErrNotReady); - } - - if (!(aFormat & iImageFormatsSupported) ) - { - User::Leave(KErrNotSupported); - } - - //check if the snapshot size is supported - TRect snapshot_rect = TRect(aPosition, aSize); - - if(snapshot_rect != iSupportedSnapshotRect[0] && snapshot_rect != iSupportedSnapshotRect[1]) - { - User::Leave(KErrNotSupported); - } - - if (iSnapshotPrepared - && iSnapshotFormat == aFormat - && iSnapshotImageRect == snapshot_rect - && iBgColor == aBgColor - ) - { - return; - } - - TDisplayMode displayMode = ENone; - switch (aFormat) - { - case CCamera::EFormatFbsBitmapColor4K : - displayMode = EColor4K; - break; - case CCamera::EFormatFbsBitmapColor64K : - displayMode = EColor64K; - break; - case CCamera::EFormatFbsBitmapColor16M : - displayMode = EColor16M; - break; - default : - User::Leave(KErrNotSupported); - break; - } - - delete iSnapshotImage; - iSnapshotImage = NULL; - delete iSnapshotImageGc; - iSnapshotImageGc = NULL; - delete iSnapshotImageDev; - iSnapshotImageDev = NULL; - - iSnapshotImage = new(ELeave) CFbsBitmap; - User::LeaveIfError(iSnapshotImage->Create(aSize, displayMode)); - iSnapshotImageDev = CFbsBitmapDevice::NewL(iSnapshotImage); - User::LeaveIfError(iSnapshotImageDev->CreateContext(iSnapshotImageGc)); - iSnapshotImageGc->SetPenColor(KRgbBlack); - iSnapshotImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); - iSnapshotImageGc->SetBrushColor(aBgColor); - iSnapshotImageGc->SetFaded(ETrue); - - iSnapshotPrepared = ETrue; - iSnapshotImageRect = snapshot_rect; - iSnapshotFormat = aFormat; - iBgColor = aBgColor; - } - -void CTestCamSnapshot::PrepareSnapshotL(CCamera::TFormat /*aFormat*/, const TSize& /*aSize*/, TBool /*aMaintainAspectRatio*/) - { - User::Leave(KErrNotSupported); - } - -void CTestCamSnapshot::SetBgColorL(const TRgb& /*aBgColor*/) - { - User::Leave(KErrNotSupported); - } - -void CTestCamSnapshot::SetPositionL(const TPoint& /*aPosition*/) - { - User::Leave(KErrNotSupported); - } - -TBool CTestCamSnapshot::IsSnapshotActive() const - { - return iSnapshotActive; - } - -void CTestCamSnapshot::StartSnapshot() - { - TInt error = iOwner.CheckReserveAndPower(); - - if(error == KErrNone) - { - if(!iSnapshotPrepared) - { - error = KErrNotReady; - } - } - - if(error != KErrNone) - { - TECAMEvent ecamevent(KUidECamEventCameraSnapshot, error); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - return; - } - - delete iSnapshot; - iSnapshot = NULL; - delete iSnapshotGc; - iSnapshot = NULL; - delete iSnapshotDev; - iSnapshotDev = NULL; - - TRAP(error, DoStartSnapshotL()); - - if(error != KErrNone) - { - TECAMEvent ecamevent(KUidECamEventCameraSnapshot, error); - - iOwner.iECamEvent = ecamevent; - iOwner.iHandleEventAsync.CallBack(); - } - } - -void CTestCamSnapshot::DoStartSnapshotL() - { - CFbsBitmap* snapshot = new(ELeave) CFbsBitmap; - CleanupStack::PushL(snapshot); - User::LeaveIfError(snapshot->Create(iSnapshotImageRect.Size(), iSnapshotImage->DisplayMode())); - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(snapshot); - CleanupStack::PushL(dev); - CFbsBitGc* gc = NULL; - User::LeaveIfError(dev->CreateContext(gc)); - CleanupStack::Pop(dev); - CleanupStack::Pop(snapshot); - - iSnapshot = snapshot; - iSnapshotDev = dev; - iSnapshotGc = gc; - - iSnapshotActive = ETrue; - } - -void CTestCamSnapshot::StopSnapshot() - { - delete iSnapshotGc; - iSnapshotGc = NULL; - delete iSnapshotDev; - iSnapshotDev = NULL; - delete iSnapshot; - iSnapshot = NULL; - - iSnapshotActive = EFalse; - } - -MCameraBuffer& CTestCamSnapshot::SnapshotDataL(RArray& /*aFrameIndexOrder*/) - { - iSnapshotBuffer.iAvailable = EFalse; - return iSnapshotBuffer; - } - -void CTestCamSnapshot::ServiceSnapshot(const CFbsBitGc& aSourceBitmapGc) - { - TInt error = KErrNone; - if(!iSnapshotBuffer.iAvailable) - { - error = KErrInUse; - } - else - { - iSnapshotGc->BitBlt(TPoint(0,0), aSourceBitmapGc); - } - - iOwner.iObserver2->HandleEvent(TECAMEvent(KUidECamEventCameraSnapshot, error)); - } - -void CTestCamSnapshot::ServiceBurstImageSnapshot(const CFbsBitGc& aSourceBitmapGc) - { - TInt error = KErrNone; - if(!iSnapshotBuffer.iAvailable) - { - error = KErrInUse; - } - else - { - iSnapshotGc->BitBlt(TPoint(0,0), aSourceBitmapGc); - } - - iOwner.iObserver2->HandleEvent(TECAMEvent(KUidECamEventCameraSnapshot, error)); - - User::After(500000); - - iOwner.iStillImagePos.iX += KFramePosIncrement; - iOwner.iStillImagePos.iY += KFramePosIncrement; - - if (iOwner.iStillImagePos.iX >= iOwner.iStillImageSize.iWidth) - { - iOwner.iStillImagePos.iX = 0; - } - - if (iOwner.iStillImagePos.iY >= iOwner.iStillImageSize.iHeight) - { - iOwner.iStillImagePos.iY = 0; - } - } - +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testsnapshot.cpp +// +// + +#include "test_snapshot.h" +#include + +CTestCamSnapshot::CTestCamSnapshot(CTestCamera& aOwner): iOwner(aOwner), iSnapshotBuffer(iSnapshot) + { + Init(); + } + +CTestCamSnapshot::~CTestCamSnapshot() + { + delete iSnapshotImage; + iSnapshotImage = NULL; + delete iSnapshotImageGc; + iSnapshotImage = NULL; + delete iSnapshotImageDev; + iSnapshotImageDev = NULL; + + delete iSnapshot; + iSnapshot = NULL; + delete iSnapshotGc; + iSnapshotGc = NULL; + delete iSnapshotDev; + iSnapshotDev = NULL; + + iSupportedSnapshotRect.Close(); + + CDataGlobal* globalData = static_cast (Dll::Tls()); + if(globalData != NULL) + { + if(!globalData->iTestCamPresets && !globalData->iTestCamAdvSet && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + globalData->iTestCamSnapshot = NULL; + Dll::SetTls(globalData); + } + } + } + +CTestCamSnapshot* CTestCamSnapshot::NewL(CTestCamera& aOwner) + { + CDataGlobal* globalData = static_cast (Dll::Tls()); + + if(globalData == NULL) + { + globalData = new (ELeave) CDataGlobal; + CleanupStack::PushL(globalData); + globalData->iSnapshotReferenceCount = 0; + globalData->iTestCamSnapshot = new (ELeave) CTestCamSnapshot(aOwner); + CleanupStack::PushL(globalData->iTestCamSnapshot); + globalData->iTestCamSnapshot->ConstructL(); + globalData->iTestCamSnapshot->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamSnapshot); + CleanupStack::Pop(globalData); + return globalData->iTestCamSnapshot; + } + else + { + if(globalData->iTestCamSnapshot == NULL) + { + globalData->iSnapshotReferenceCount = 0; + globalData->iTestCamSnapshot = new (ELeave) CTestCamSnapshot(aOwner); + CleanupStack::PushL(globalData->iTestCamSnapshot); + globalData->iTestCamSnapshot->ConstructL(); + globalData->iTestCamSnapshot->iRefCount = 1; + User::LeaveIfError(Dll::SetTls(globalData)); + CleanupStack::Pop(globalData->iTestCamSnapshot); + return globalData->iTestCamSnapshot; + } + + CTestCamSnapshot* self = globalData->iTestCamSnapshot; + + globalData->iSnapshotReferenceCount++; + self->iRefCount = globalData->iSnapshotReferenceCount + 1; + if (globalData->iSnapshotReferenceCount == KNumOfSnapshotExtensions-1 ) + { + globalData->iTestCamSnapshot = NULL; + if(!globalData->iTestCamPresets && !globalData->iTestCamAdvSet && !globalData->iTestCamImgProc) + { + delete globalData; + Dll::FreeTls(); + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + } + else + { + User::LeaveIfError(Dll::SetTls(globalData)); + } + return self; + } + } + +void CTestCamSnapshot::Release() + { + iRefCount--; + if(iRefCount == 0) + { + iOwner.iSnapshotImpl = NULL; + delete this; + } + } + +void CTestCamSnapshot::Init() + { + iImageFormatsSupported = 0; + iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor4K; + iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor64K; + iImageFormatsSupported |= CCamera::EFormatFbsBitmapColor16M; + iSnapshotPrepared = EFalse; + iSnapshotActive = EFalse; + iBgColor = KRgbWhite; + } + +void CTestCamSnapshot::ConstructL() + { + iSupportedSnapshotRect.Reset(); + iSupportedSnapshotRect.AppendL(TRect(TPoint(0,0), iOwner.iImageSizes[0])); + iSupportedSnapshotRect.AppendL(TRect(TPoint(0,0), iOwner.iImageSizes[1])); + } + +TUint32 CTestCamSnapshot::SupportedFormats() + { + return iImageFormatsSupported; + } + +void CTestCamSnapshot::PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool /*aMaintainAspectRatio*/) + { + iOwner.CheckReserveAndPowerL(); + + if (iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive) + { + User::Leave(KErrNotReady); + } + + if (!(aFormat & iImageFormatsSupported) ) + { + User::Leave(KErrNotSupported); + } + + //check if the snapshot size is supported + TRect snapshot_rect = TRect(aPosition, aSize); + + if(snapshot_rect != iSupportedSnapshotRect[0] && snapshot_rect != iSupportedSnapshotRect[1]) + { + User::Leave(KErrNotSupported); + } + + if (iSnapshotPrepared + && iSnapshotFormat == aFormat + && iSnapshotImageRect == snapshot_rect + && iBgColor == aBgColor + ) + { + return; + } + + TDisplayMode displayMode = ENone; + switch (aFormat) + { + case CCamera::EFormatFbsBitmapColor4K : + displayMode = EColor4K; + break; + case CCamera::EFormatFbsBitmapColor64K : + displayMode = EColor64K; + break; + case CCamera::EFormatFbsBitmapColor16M : + displayMode = EColor16M; + break; + default : + User::Leave(KErrNotSupported); + break; + } + + delete iSnapshotImage; + iSnapshotImage = NULL; + delete iSnapshotImageGc; + iSnapshotImageGc = NULL; + delete iSnapshotImageDev; + iSnapshotImageDev = NULL; + + iSnapshotImage = new(ELeave) CFbsBitmap; + User::LeaveIfError(iSnapshotImage->Create(aSize, displayMode)); + iSnapshotImageDev = CFbsBitmapDevice::NewL(iSnapshotImage); + User::LeaveIfError(iSnapshotImageDev->CreateContext(iSnapshotImageGc)); + iSnapshotImageGc->SetPenColor(KRgbBlack); + iSnapshotImageGc->SetPenSize(TSize(KFrameFeatureBorderThickness, KFrameFeatureBorderThickness)); + iSnapshotImageGc->SetBrushColor(aBgColor); + iSnapshotImageGc->SetFaded(ETrue); + + iSnapshotPrepared = ETrue; + iSnapshotImageRect = snapshot_rect; + iSnapshotFormat = aFormat; + iBgColor = aBgColor; + } + +void CTestCamSnapshot::PrepareSnapshotL(CCamera::TFormat /*aFormat*/, const TSize& /*aSize*/, TBool /*aMaintainAspectRatio*/) + { + User::Leave(KErrNotSupported); + } + +void CTestCamSnapshot::SetBgColorL(const TRgb& /*aBgColor*/) + { + User::Leave(KErrNotSupported); + } + +void CTestCamSnapshot::SetPositionL(const TPoint& /*aPosition*/) + { + User::Leave(KErrNotSupported); + } + +TBool CTestCamSnapshot::IsSnapshotActive() const + { + return iSnapshotActive; + } + +void CTestCamSnapshot::StartSnapshot() + { + TInt error = iOwner.CheckReserveAndPower(); + + if(error == KErrNone) + { + if(!iSnapshotPrepared) + { + error = KErrNotReady; + } + } + + if(error != KErrNone) + { + TECAMEvent ecamevent(KUidECamEventCameraSnapshot, error); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + return; + } + + delete iSnapshot; + iSnapshot = NULL; + delete iSnapshotGc; + iSnapshot = NULL; + delete iSnapshotDev; + iSnapshotDev = NULL; + + TRAP(error, DoStartSnapshotL()); + + if(error != KErrNone) + { + TECAMEvent ecamevent(KUidECamEventCameraSnapshot, error); + + iOwner.iECamEvent = ecamevent; + iOwner.iHandleEventAsync.CallBack(); + } + } + +void CTestCamSnapshot::DoStartSnapshotL() + { + CFbsBitmap* snapshot = new(ELeave) CFbsBitmap; + CleanupStack::PushL(snapshot); + User::LeaveIfError(snapshot->Create(iSnapshotImageRect.Size(), iSnapshotImage->DisplayMode())); + CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(snapshot); + CleanupStack::PushL(dev); + CFbsBitGc* gc = NULL; + User::LeaveIfError(dev->CreateContext(gc)); + CleanupStack::Pop(dev); + CleanupStack::Pop(snapshot); + + iSnapshot = snapshot; + iSnapshotDev = dev; + iSnapshotGc = gc; + + iSnapshotActive = ETrue; + } + +void CTestCamSnapshot::StopSnapshot() + { + delete iSnapshotGc; + iSnapshotGc = NULL; + delete iSnapshotDev; + iSnapshotDev = NULL; + delete iSnapshot; + iSnapshot = NULL; + + iSnapshotActive = EFalse; + } + +MCameraBuffer& CTestCamSnapshot::SnapshotDataL(RArray& /*aFrameIndexOrder*/) + { + iSnapshotBuffer.iAvailable = EFalse; + return iSnapshotBuffer; + } + +void CTestCamSnapshot::ServiceSnapshot(const CFbsBitGc& aSourceBitmapGc) + { + TInt error = KErrNone; + if(!iSnapshotBuffer.iAvailable) + { + error = KErrInUse; + } + else + { + iSnapshotGc->BitBlt(TPoint(0,0), aSourceBitmapGc); + } + + iOwner.iObserver2->HandleEvent(TECAMEvent(KUidECamEventCameraSnapshot, error)); + } + +void CTestCamSnapshot::ServiceBurstImageSnapshot(const CFbsBitGc& aSourceBitmapGc) + { + TInt error = KErrNone; + if(!iSnapshotBuffer.iAvailable) + { + error = KErrInUse; + } + else + { + iSnapshotGc->BitBlt(TPoint(0,0), aSourceBitmapGc); + } + + iOwner.iObserver2->HandleEvent(TECAMEvent(KUidECamEventCameraSnapshot, error)); + + User::After(500000); + + iOwner.iStillImagePos.iX += KFramePosIncrement; + iOwner.iStillImagePos.iY += KFramePosIncrement; + + if (iOwner.iStillImagePos.iX >= iOwner.iStillImageSize.iWidth) + { + iOwner.iStillImagePos.iX = 0; + } + + if (iOwner.iStillImagePos.iY >= iOwner.iStillImageSize.iHeight) + { + iOwner.iStillImagePos.iY = 0; + } + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/testcamera/test_snapshot.h --- a/mmplugins/cameraplugins/source/testcamera/test_snapshot.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/testcamera/test_snapshot.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,95 +1,95 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// testsnapshot.h -// -// - -#ifndef TESTSNAPSHOT_H -#define TESTSNAPSHOT_H - -#include "TestCamera.h" -#include - -const TInt KNumOfSnapshotExtensions = 1; - -// Implementations of the MCameraSnapshot class -class CTestCamSnapshot : public CBase, - public MCameraSnapshot - { - friend class CTestCamera; -public: - static CTestCamSnapshot* NewL(CTestCamera& aOwner); - ~CTestCamSnapshot(); - -private: - void Release(); - - //from MCameraSnapshot - TUint32 SupportedFormats(); - - void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio); - - void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio); - - void SetBgColorL(const TRgb& aBgColor); - - void SetPositionL(const TPoint& aPosition); - - TBool IsSnapshotActive() const; - - void StartSnapshot(); - - void StopSnapshot(); - - MCameraBuffer& SnapshotDataL(RArray& aFrameIndexOrder); - - // New functions - void ServiceSnapshot(const CFbsBitGc& aSourceBitmapGc); - void ServiceBurstImageSnapshot(const CFbsBitGc& aSourceBitmapGc); - -private: - CTestCamSnapshot(CTestCamera& aOwner); - void Init(); - void ConstructL(); - void DoStartSnapshotL(); - -private: - CTestCamera& iOwner; - - TInt iRefCount; - - CFbsBitmap* iSnapshot; - CFbsBitmapDevice* iSnapshotDev; - CFbsBitGc* iSnapshotGc; - - CFbsBitmap* iSnapshotImage; - CFbsBitmapDevice* iSnapshotImageDev; - CFbsBitGc* iSnapshotImageGc; - - TRect iSnapshotImageRect; - CCamera::TFormat iSnapshotFormat; - TRgb iBgColor; - - TUint32 iImageFormatsSupported; - - RArray iSupportedSnapshotRect; - - RTestCameraFrameBuffer iSnapshotBuffer; - - volatile TBool iSnapshotPrepared; - volatile TBool iSnapshotActive; - - }; - -#endif // TESTSNAPSHOT_H +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// testsnapshot.h +// +// + +#ifndef TESTSNAPSHOT_H +#define TESTSNAPSHOT_H + +#include "TestCamera.h" +#include + +const TInt KNumOfSnapshotExtensions = 1; + +// Implementations of the MCameraSnapshot class +class CTestCamSnapshot : public CBase, + public MCameraSnapshot + { + friend class CTestCamera; +public: + static CTestCamSnapshot* NewL(CTestCamera& aOwner); + ~CTestCamSnapshot(); + +private: + void Release(); + + //from MCameraSnapshot + TUint32 SupportedFormats(); + + void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio); + + void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio); + + void SetBgColorL(const TRgb& aBgColor); + + void SetPositionL(const TPoint& aPosition); + + TBool IsSnapshotActive() const; + + void StartSnapshot(); + + void StopSnapshot(); + + MCameraBuffer& SnapshotDataL(RArray& aFrameIndexOrder); + + // New functions + void ServiceSnapshot(const CFbsBitGc& aSourceBitmapGc); + void ServiceBurstImageSnapshot(const CFbsBitGc& aSourceBitmapGc); + +private: + CTestCamSnapshot(CTestCamera& aOwner); + void Init(); + void ConstructL(); + void DoStartSnapshotL(); + +private: + CTestCamera& iOwner; + + TInt iRefCount; + + CFbsBitmap* iSnapshot; + CFbsBitmapDevice* iSnapshotDev; + CFbsBitGc* iSnapshotGc; + + CFbsBitmap* iSnapshotImage; + CFbsBitmapDevice* iSnapshotImageDev; + CFbsBitGc* iSnapshotImageGc; + + TRect iSnapshotImageRect; + CCamera::TFormat iSnapshotFormat; + TRgb iBgColor; + + TUint32 iImageFormatsSupported; + + RArray iSupportedSnapshotRect; + + RTestCameraFrameBuffer iSnapshotBuffer; + + volatile TBool iSnapshotPrepared; + volatile TBool iSnapshotActive; + + }; + +#endif // TESTSNAPSHOT_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/01000001.rss --- a/mmplugins/cameraplugins/source/webcamera/01000001.rss Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/01000001.rss Tue Oct 19 11:48:59 2010 +0900 @@ -1,58 +1,58 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "ecamwebcamerapluginuids.hrh" - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = KUidOnboardWebCameraDll; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardWebCameraPlugin; - version_no = 4; - display_name = "ECam WebCamera Plugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - }, - INTERFACE_INFO - { - interface_uid = KUidOnboardCameraInfoPlugin; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUidOnboardWebCameraInfo; - version_no = 4; - display_name = "ECam WebCamera InfoPlugin"; - opaque_data = "0;"; - default_data="*"; - } - }; - } - }; - } +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include "ecamwebcamerapluginuids.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidOnboardWebCameraDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardWebCameraPlugin; + version_no = 4; + display_name = "ECam WebCamera Plugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidOnboardCameraInfoPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOnboardWebCameraInfo; + version_no = 4; + display_name = "ECam WebCamera InfoPlugin"; + opaque_data = "0;"; + default_data="*"; + } + }; + } + }; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.cpp --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,140 +1,140 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include "ecamwebcameraactive.h" - - -// -// CWebCameraActive -// -CWebCameraActive* CWebCameraActive::NewL(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver) - { - CWebCameraActive* self = new(ELeave) CWebCameraActive(aOwner, aDriver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -CWebCameraActive::CWebCameraActive(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver) - :CActive(CActive::EPriorityStandard), - iOwner(aOwner), - iDriver(aDriver) - { - CActiveScheduler::Add(this); - } - -CWebCameraActive::~CWebCameraActive() - { - } - -/** -* RunL. -*/ -void CWebCameraActive::RunL() - { - TInt wError = iStatus.Int(); - - switch(iOperation) - { - case ECamActiveReserve: - iOwner->ReserveCallBack(wError); - break; - - case ECamActivePowerOn: - iOwner->PowerOnCallBack(wError); - break; - - case ECamActiveImageCapture: - iOwner->ImageCaptureCallBackL(wError); - break; - } - iOperation = ECamActiveIdle; - } - -void CWebCameraActive::DoCancel() - { - } - -void CWebCameraActive::ConstructL() - { - } - -/** -Asynchronous function that performs any required initialisation and reserves -the camera for exclusive use. - -Calls CWebCamera::ReserveCallBack when complete. -*/ -void CWebCameraActive::Reserve() - { - iOperation = ECamActiveReserve; - - //Because there is not a camera device, I do not handle it - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - -/** -Asynchronous method to switch on camera power. - -User must have successfully called Reserve() prior to calling this function. - -Calls CWebCamera::PowerOnCallBack when power on is complete. -*/ -void CWebCameraActive::PowerOn() - { - iOperation = ECamActivePowerOn; - - //Because there is not a camera device, I do not handle it - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - -/** -Cancels the asynchronous still image capture. - -Calls CWebCamera::ImageCaptureCallBackL when capture is complete. - -* @param aDes descriptor to store a capture image -*/ -void CWebCameraActive::ImageCapture(TDes8& aDes) - { - iOperation = ECamActiveImageCapture; - - // start capture image - // The division transfer is going to support in the next version. - iDriver.Capture(iStatus, aDes); - SetActive(); - } - -/** -Cancels the asynchronous still image capture. - -@see CWebCamera::CancelCaptureImage -*/ -void CWebCameraActive::CancelCaptureImage() - { - iOperation = ECamActiveIdle; - - iDriver.CaptureCancel(); - SetActive(); - } - +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include "ecamwebcameraactive.h" + + +// +// CWebCameraActive +// +CWebCameraActive* CWebCameraActive::NewL(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver) + { + CWebCameraActive* self = new(ELeave) CWebCameraActive(aOwner, aDriver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +CWebCameraActive::CWebCameraActive(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver) + :CActive(CActive::EPriorityStandard), + iOwner(aOwner), + iDriver(aDriver) + { + CActiveScheduler::Add(this); + } + +CWebCameraActive::~CWebCameraActive() + { + } + +/** +* RunL. +*/ +void CWebCameraActive::RunL() + { + TInt wError = iStatus.Int(); + + switch(iOperation) + { + case ECamActiveReserve: + iOwner->ReserveCallBack(wError); + break; + + case ECamActivePowerOn: + iOwner->PowerOnCallBack(wError); + break; + + case ECamActiveImageCapture: + iOwner->ImageCaptureCallBackL(wError); + break; + } + iOperation = ECamActiveIdle; + } + +void CWebCameraActive::DoCancel() + { + } + +void CWebCameraActive::ConstructL() + { + } + +/** +Asynchronous function that performs any required initialisation and reserves +the camera for exclusive use. + +Calls CWebCamera::ReserveCallBack when complete. +*/ +void CWebCameraActive::Reserve() + { + iOperation = ECamActiveReserve; + + //Because there is not a camera device, I do not handle it + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + +/** +Asynchronous method to switch on camera power. + +User must have successfully called Reserve() prior to calling this function. + +Calls CWebCamera::PowerOnCallBack when power on is complete. +*/ +void CWebCameraActive::PowerOn() + { + iOperation = ECamActivePowerOn; + + //Because there is not a camera device, I do not handle it + iDriver.PowerOn(iStatus); + + SetActive(); + } + +/** +Cancels the asynchronous still image capture. + +Calls CWebCamera::ImageCaptureCallBackL when capture is complete. + +* @param aDes descriptor to store a capture image +*/ +void CWebCameraActive::ImageCapture(TInt& aChunkSize) + { + iOperation = ECamActiveImageCapture; + + // start capture image + // The division transfer is going to support in the next version. + iDriver.Capture(iStatus, aChunkSize); + SetActive(); + } + +/** +Cancels the asynchronous still image capture. + +@see CWebCamera::CancelCaptureImage +*/ +void CWebCameraActive::CancelCaptureImage() + { + iOperation = ECamActiveIdle; + + iDriver.CaptureCancel(); + SetActive(); + } + diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.h --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraactive.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,115 +1,115 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERAACTIVE_H -#define ECAMWEBCAMERAACTIVE_H - -#include "ecamwebcameraplugin.h" - -/** - * Perform an Async demand of the camera application - */ -class CWebCameraActive : public CActive - { -private: - - /** - Active Operation of ECamWebCamera - */ - enum TECamWebCameraActiveOperation - { - ECamActiveIdle = 0, - ECamActiveReserve, - ECamActivePowerOn, - ECamActiveImageCapture, - }; - -public: - /** Constructor */ - /** - * @param aOwner - pointer to callback object. - * @param aDriver - reference to driver. - */ - CWebCameraActive(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver); - - /**> Destructor */ - ~CWebCameraActive(); - - /** - * Two-phased constructor. - * @param aOwner - pointer to callback object. - * @param aDriver - reference to driver. - */ - static CWebCameraActive* NewL(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver); - - /** - Asynchronous function that performs any required initialisation and reserves - the camera for exclusive use. - - Calls CWebCamera::ReserveCallBack when complete. - */ - void Reserve(); - - /** - Asynchronous method to switch on camera power. - - User must have successfully called Reserve() prior to calling this function. - - Calls CWebCamera::PowerOnCallBack when power on is complete. - */ - void PowerOn(); - - /** - Cancels the asynchronous still image capture. - - Calls CWebCamera::ImageCaptureCallBack when capture is complete. - - * @param aDes descriptor to store a capture image - */ - void ImageCapture(TDes8& aDes); - - /** - Cancels the asynchronous still image capture. - - @see CWebCamera::CancelCaptureImage - */ - void CancelCaptureImage(); - -private: - void ConstructL(); - -private: - /** - * RunL. - */ - void RunL(); - void DoCancel(); - void ViewFinderComplete(TInt aError); - -private: - - MWebCameraActiveCallBack* iOwner; // origin of start. - TECamWebCameraActiveOperation iOperation; // Status of the Active Operation of ECamWebCamera - RWebcameraDevice iDriver; // Camera driver - }; - - -#endif // ECAMWEBCAMERAPLUGIN_H +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERAACTIVE_H +#define ECAMWEBCAMERAACTIVE_H + +#include "ecamwebcameraplugin.h" + +/** + * Perform an Async demand of the camera application + */ +class CWebCameraActive : public CActive + { +private: + + /** + Active Operation of ECamWebCamera + */ + enum TECamWebCameraActiveOperation + { + ECamActiveIdle = 0, + ECamActiveReserve, + ECamActivePowerOn, + ECamActiveImageCapture, + }; + +public: + /** Constructor */ + /** + * @param aOwner + pointer to callback object. + * @param aDriver + reference to driver. + */ + CWebCameraActive(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver); + + /** Destructor */ + ~CWebCameraActive(); + + /** + * Two-phased constructor. + * @param aOwner + pointer to callback object. + * @param aDriver + reference to driver. + */ + static CWebCameraActive* NewL(MWebCameraActiveCallBack* aOwner, RWebcameraDevice& aDriver); + + /** + Asynchronous function that performs any required initialisation and reserves + the camera for exclusive use. + + Calls CWebCamera::ReserveCallBack when complete. + */ + void Reserve(); + + /** + Asynchronous method to switch on camera power. + + User must have successfully called Reserve() prior to calling this function. + + Calls CWebCamera::PowerOnCallBack when power on is complete. + */ + void PowerOn(); + + /** + Cancels the asynchronous still image capture. + + Calls CWebCamera::ImageCaptureCallBack when capture is complete. + + * @param aDes descriptor to store a capture image + */ + void ImageCapture(TInt& aChunkSize); + + /** + Cancels the asynchronous still image capture. + + @see CWebCamera::CancelCaptureImage + */ + void CancelCaptureImage(); + +private: + void ConstructL(); + +private: + /** + * RunL. + */ + void RunL(); + void DoCancel(); + void ViewFinderComplete(TInt aError); + +private: + + MWebCameraActiveCallBack* iOwner; // origin of start. + TECamWebCameraActiveOperation iOperation; // Status of the Active Operation of ECamWebCamera + RWebcameraDevice iDriver; // Camera driver + }; + + +#endif // ECAMWEBCAMERAPLUGIN_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.cpp --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,799 +1,799 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "ecamwebcameraadvset.h" - - -CWebCameraAdvSet::CWebCameraAdvSet(CWebCamera& aOwner) - :iOwner(aOwner) - { - } - -CWebCameraAdvSet::~CWebCameraAdvSet() - { - iSupportedISORates.Close(); - } - -CWebCameraAdvSet* CWebCameraAdvSet::NewL(CWebCamera& aOwner) - { - CWebCameraAdvSet* self = new(ELeave) CWebCameraAdvSet(aOwner); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -void CWebCameraAdvSet::Release() - { - } - -void CWebCameraAdvSet::Init() - { - } - -void CWebCameraAdvSet::ConstructL() - { - iSupportedISORates.Reset(); - iSupportedISORates.AppendL(KDefaultIsoRate); - } - -CCamera::CCameraAdvancedSettings::TCameraType CWebCameraAdvSet::CameraType() const - { - return CCamera::CCameraAdvancedSettings::ECameraPluggable; - } - -CCamera::CCameraAdvancedSettings::TCameraType CWebCameraAdvSet::CameraType(TInt /*aCameraIndex*/) const - { - return CCamera::CCameraAdvancedSettings::ECameraUnknown; - } - -TBool CWebCameraAdvSet::IsCameraPresent() const - { - return EFalse; - } - -TBool CWebCameraAdvSet::IsCameraPresent(TInt /*aCameraIndex*/) const - { - return EFalse; - } - -TInt CWebCameraAdvSet::CameraIndex() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::SupportedStabilizationModes() const - { - return 0; - } - -CCamera::CCameraAdvancedSettings::TStabilizationMode CWebCameraAdvSet::StabilizationMode() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationModeOff; - } - -void CWebCameraAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode /*aStabilizationMode*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedFocusModes() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TFocusMode CWebCameraAdvSet::FocusMode() const - { - return CCamera::CCameraAdvancedSettings::EFocusModeAuto; - } - -void CWebCameraAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode /*aFocusMode*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedFocusRanges() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TFocusRange CWebCameraAdvSet::FocusRange() const - { - return CCamera::CCameraAdvancedSettings::EFocusRangeAuto; - } - -void CWebCameraAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange /*aFocusRange*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedAutoFocusTypes() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TAutoFocusType CWebCameraAdvSet::AutoFocusType() const - { - return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff; - } - -void CWebCameraAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType /*aAutoFocusType*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedAutoFocusAreas() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TAutoFocusArea CWebCameraAdvSet::AutoFocusArea() const - { - return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto; - } - -void CWebCameraAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea /*aAutoFocusArea*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::FocusDistance() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetFocusDistance(TInt /*aDistance*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::GetMinFocalLength() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const - { - if(iSupportedISORates.Count() == 0) - { - User::Leave(KErrNotSupported); - } - - for(TInt index=0; index < iSupportedISORates.Count(); index++) - { - aSupportedIsoRates.AppendL(iSupportedISORates[index]); - } - } - -TInt CWebCameraAdvSet::IsoRate() const - { - return KDefaultIsoRate; - } - -void CWebCameraAdvSet::SetIsoRate(TInt /*aRate*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetSupportedISORateTypeL(TInt& /*aSupportedISORateTypes*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType /*aISORateType*/, TInt /*aParam*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& /*aISORateType*/, TInt& /*aParam*/, TInt& /*aISORate*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetAperturesL(RArray& /*aFStops*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::Aperture() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetAperture(TInt /*aFStop*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetShutterSpeedsL(RArray& /*aShutterSpeeds*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::ShutterSpeed() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetShutterSpeed(TInt /*aShutterSpeed*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedMeteringModes() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TMeteringMode CWebCameraAdvSet::MeteringMode() const - { - return CCamera::CCameraAdvancedSettings::EMeteringModeAuto; - } - -void CWebCameraAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode /*aMeteringMode*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedDriveModes() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TDriveMode CWebCameraAdvSet::DriveMode() const - { - return CCamera::CCameraAdvancedSettings::EDriveModeAuto; - } - -void CWebCameraAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode /*aDriveMode*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedBracketModes() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketMode CWebCameraAdvSet::BracketMode() const - { - return CCamera::CCameraAdvancedSettings::EBracketModeOff; - } - -void CWebCameraAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode /*aBracketMode*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedBracketParameters() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketParameter CWebCameraAdvSet::BracketParameter() const - { - return CCamera::CCameraAdvancedSettings::EBracketParameterNone; - } - -void CWebCameraAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter /*aBracketParameter*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedBracketSteps() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TBracketStep CWebCameraAdvSet::BracketStep() const - { - return CCamera::CCameraAdvancedSettings::EBracketStepNonConfig; - } - -void CWebCameraAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep /*aBracketStep*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetBracketMerge(TInt& /*aStartIndex*/, TInt& /*aFrames*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetBracketMerge(TInt /*aStartIndex*/ , TInt /*aFrames*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedFlashModes() const - { - return KErrNotSupported; - } - -CCamera::TFlash CWebCameraAdvSet::FlashMode() const - { - return CCamera::EFlashNone; - } - -void CWebCameraAdvSet::SetFlashMode(CCamera::TFlash /*aMode*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::RedEyeReduceOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::SetRedEyeReduceOn(TBool /*aState*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetFlashCompensationStepsL(RArray& /*aFlashCompensationSteps*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::FlashCompensationStep() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::GetFlashCompensationStep(TInt& /*aFlashCompensationStep*/) const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::GetFlashCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::FlashCompensation() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::GetFlashCompensation(TInt& /*aFlashCompensation*/) const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::IsExternalFlashPresent() const - { - return EFalse; - } - -void CWebCameraAdvSet::GetManualFlashPowerLevelsL(RArray& /*aManualFlashPowerLevels*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::ManualFlashPowerLevel() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedExposureModes() const - { - return CCamera::EExposureAuto; - } - -CCamera::TExposure CWebCameraAdvSet::ExposureMode() const - { - return CCamera::EExposureAuto; - } - -void CWebCameraAdvSet::SetExposureMode(CCamera::TExposure /*aExposureMode*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const - { - aExposureCompensationSteps.Reset(); - aInfo = ENotActive; - } - -void CWebCameraAdvSet::GetExposureCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::ExposureCompensationStep() const - { - return 0; - } - -TInt CWebCameraAdvSet::GetExposureCompensationStep(TInt& /*aExposureCompensationStep*/) const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::ExposureCompensation() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::GetExposureCompensation(TInt& /*aExposureCompensation*/) const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedWhiteBalanceModes() const - { - return KErrNotSupported; - } - -CCamera::TWhiteBalance CWebCameraAdvSet::WhiteBalanceMode() const - { - return CCamera::EWBAuto; - } - -void CWebCameraAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance /*aWhiteBalanceMode*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::ApertureExposureLockOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::ShootClickOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::SetShootClickOn(TBool /*aShootClickOn*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetTimerIntervalsL(RArray& /*aTimerIntervals*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::TimerInterval() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetTimerInterval(TInt /*aTimerInterval*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetTimeLapsePeriodRange(TTime& /*aTimeLapseMin*/, TTime& /*aTimeLapseMax*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetTimeLapse(TTime& /*aStart*/, TTime& /*aEnd*/, TTime& /*aInterval*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/) - { - User::Leave(KErrNotSupported); - } - -CCamera::CCameraAdvancedSettings::TPictureOrientation CWebCameraAdvSet::PictureOrientation() const - { - return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown; - } - -void CWebCameraAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation /*aOrientation*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedPixelAspectRatios() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TPixelAspectRatio CWebCameraAdvSet::PixelAspectRatio() const - { - return CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; - } - -void CWebCameraAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio /*aPixelAspectRatio*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::SupportedYuvRanges() const - { - return KErrNotSupported; - } - -CCamera::CCameraAdvancedSettings::TYuvRange CWebCameraAdvSet::YuvRange() const - { - return CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; - } - -void CWebCameraAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange /*aYuvRange*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::BurstImages() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetBurstImages(TInt /*aImages*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetOpticalZoomStepsL(RArray& /*aOpticalZoomSteps*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::OpticalZoom() const - { - return KECamFineResolutionFactor; - } - -void CWebCameraAdvSet::SetOpticalZoom(TInt /*aOpticalZoom*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -void CWebCameraAdvSet::GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aSizeIndex*/, - CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -void CWebCameraAdvSet::GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aFrameRateIndex*/, - TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const - { - aDigitalZoomSteps.Reset(); - aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); - aInfo = EDiscreteSteps; - } - -TInt CWebCameraAdvSet::DigitalZoom() const - { - return KErrNotSupported; - } - -void CWebCameraAdvSet::SetDigitalZoom(TInt /*aDigitalZoom*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::ExposureLockOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::SetExposureLockOn(TBool /*aState*/) - { - User::Leave(KErrNotSupported); - } - -TBool CWebCameraAdvSet::AutoFocusLockOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::SetAutoFocusLockOn(TBool /*aState*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetSupportedSettingsL(RArray& /*aSettings*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetActiveSettingsL(RArray& /*aActiveSettings*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetDisabledSettingsL(RArray& /*aDisbledSettings*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetAutomaticSizeSelectionChangeOn(TBool /*aSetOn*/) - { - } - -TBool CWebCameraAdvSet::AutomaticSizeSelectionChangeOn() const - { - return EFalse; - } - -void CWebCameraAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray& /*aTimeouts*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect /*aEffect*/) - { - User::Leave(KErrNotSupported); - } - -CCamera::CCameraAdvancedSettings::TStabilizationEffect CWebCameraAdvSet::StabilizationEffect() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationOff; - } - -TInt CWebCameraAdvSet::SupportedStabilizationEffects() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationOff; - } - -TInt CWebCameraAdvSet::SupportedStabilizationComplexityValues() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationOff; - } - -CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CWebCameraAdvSet::StabilizationComplexity() const - { - return CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto; - } - -void CWebCameraAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity /*aComplexity*/) - { - User::Leave(KErrNotSupported); - } - -CCamera::CCameraAdvancedSettings::TWBUnits CWebCameraAdvSet::SupportedWBUnits() const - { - return CCamera::CCameraAdvancedSettings::EWBUnknown; - } - -void CWebCameraAdvSet::SetWBRgbValue(const TRgb& /*aValue*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetWBRgbValue(TRgb& /*aValue*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetWBSupportedColorTemperaturesL(RArray& /*aWBColorTemperatures*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/) - { - User::Leave(KErrNotSupported); - } - -TInt CWebCameraAdvSet::WBColorTemperature() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::ContinuousAutoFocusTimeout() const - { - return KErrNotSupported; - } - -TInt CWebCameraAdvSet::IsFlashReady(TBool& aReady) const - { - aReady = 0; - return KErrNone; - } - -void CWebCameraAdvSet::GetCurrentFocusModeStepsL(RArray& /*aFocusModeSteps*/, TValueInfo& /*aInfo*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& /*aPreCaptureWarningSupported*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/) - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::UnSubscribePreCaptureWarningL() - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetSupportedAFAssistantLightL(TInt& /*aSupportedAFAssistantLight*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& /*aAFAssistantLight*/) const - { - User::Leave(KErrNotSupported); - } - -void CWebCameraAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight /*aAFAssistantLight*/) - { - User::Leave(KErrNotSupported); - } - - +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include "ecamwebcameraadvset.h" + + +CWebCameraAdvSet::CWebCameraAdvSet(CWebCamera& aOwner) + :iOwner(aOwner) + { + } + +CWebCameraAdvSet::~CWebCameraAdvSet() + { + iSupportedISORates.Close(); + } + +CWebCameraAdvSet* CWebCameraAdvSet::NewL(CWebCamera& aOwner) + { + CWebCameraAdvSet* self = new(ELeave) CWebCameraAdvSet(aOwner); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +void CWebCameraAdvSet::Release() + { + } + +void CWebCameraAdvSet::Init() + { + } + +void CWebCameraAdvSet::ConstructL() + { + iSupportedISORates.Reset(); + iSupportedISORates.AppendL(KDefaultIsoRate); + } + +CCamera::CCameraAdvancedSettings::TCameraType CWebCameraAdvSet::CameraType() const + { + return CCamera::CCameraAdvancedSettings::ECameraPluggable; + } + +CCamera::CCameraAdvancedSettings::TCameraType CWebCameraAdvSet::CameraType(TInt /*aCameraIndex*/) const + { + return CCamera::CCameraAdvancedSettings::ECameraUnknown; + } + +TBool CWebCameraAdvSet::IsCameraPresent() const + { + return EFalse; + } + +TBool CWebCameraAdvSet::IsCameraPresent(TInt /*aCameraIndex*/) const + { + return EFalse; + } + +TInt CWebCameraAdvSet::CameraIndex() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::SupportedStabilizationModes() const + { + return 0; + } + +CCamera::CCameraAdvancedSettings::TStabilizationMode CWebCameraAdvSet::StabilizationMode() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationModeOff; + } + +void CWebCameraAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode /*aStabilizationMode*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedFocusModes() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TFocusMode CWebCameraAdvSet::FocusMode() const + { + return CCamera::CCameraAdvancedSettings::EFocusModeAuto; + } + +void CWebCameraAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode /*aFocusMode*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedFocusRanges() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TFocusRange CWebCameraAdvSet::FocusRange() const + { + return CCamera::CCameraAdvancedSettings::EFocusRangeAuto; + } + +void CWebCameraAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange /*aFocusRange*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedAutoFocusTypes() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TAutoFocusType CWebCameraAdvSet::AutoFocusType() const + { + return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff; + } + +void CWebCameraAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType /*aAutoFocusType*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedAutoFocusAreas() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TAutoFocusArea CWebCameraAdvSet::AutoFocusArea() const + { + return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto; + } + +void CWebCameraAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea /*aAutoFocusArea*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::FocusDistance() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetFocusDistance(TInt /*aDistance*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::GetMinFocalLength() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const + { + if(iSupportedISORates.Count() == 0) + { + User::Leave(KErrNotSupported); + } + + for(TInt index=0; index < iSupportedISORates.Count(); index++) + { + aSupportedIsoRates.AppendL(iSupportedISORates[index]); + } + } + +TInt CWebCameraAdvSet::IsoRate() const + { + return KDefaultIsoRate; + } + +void CWebCameraAdvSet::SetIsoRate(TInt /*aRate*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetSupportedISORateTypeL(TInt& /*aSupportedISORateTypes*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType /*aISORateType*/, TInt /*aParam*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& /*aISORateType*/, TInt& /*aParam*/, TInt& /*aISORate*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetAperturesL(RArray& /*aFStops*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::Aperture() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetAperture(TInt /*aFStop*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetShutterSpeedsL(RArray& /*aShutterSpeeds*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::ShutterSpeed() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetShutterSpeed(TInt /*aShutterSpeed*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedMeteringModes() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TMeteringMode CWebCameraAdvSet::MeteringMode() const + { + return CCamera::CCameraAdvancedSettings::EMeteringModeAuto; + } + +void CWebCameraAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode /*aMeteringMode*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedDriveModes() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TDriveMode CWebCameraAdvSet::DriveMode() const + { + return CCamera::CCameraAdvancedSettings::EDriveModeAuto; + } + +void CWebCameraAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode /*aDriveMode*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedBracketModes() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketMode CWebCameraAdvSet::BracketMode() const + { + return CCamera::CCameraAdvancedSettings::EBracketModeOff; + } + +void CWebCameraAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode /*aBracketMode*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedBracketParameters() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketParameter CWebCameraAdvSet::BracketParameter() const + { + return CCamera::CCameraAdvancedSettings::EBracketParameterNone; + } + +void CWebCameraAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter /*aBracketParameter*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedBracketSteps() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TBracketStep CWebCameraAdvSet::BracketStep() const + { + return CCamera::CCameraAdvancedSettings::EBracketStepNonConfig; + } + +void CWebCameraAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep /*aBracketStep*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetBracketMerge(TInt& /*aStartIndex*/, TInt& /*aFrames*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetBracketMerge(TInt /*aStartIndex*/ , TInt /*aFrames*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedFlashModes() const + { + return KErrNotSupported; + } + +CCamera::TFlash CWebCameraAdvSet::FlashMode() const + { + return CCamera::EFlashNone; + } + +void CWebCameraAdvSet::SetFlashMode(CCamera::TFlash /*aMode*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::RedEyeReduceOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::SetRedEyeReduceOn(TBool /*aState*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetFlashCompensationStepsL(RArray& /*aFlashCompensationSteps*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::FlashCompensationStep() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::GetFlashCompensationStep(TInt& /*aFlashCompensationStep*/) const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::GetFlashCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::FlashCompensation() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::GetFlashCompensation(TInt& /*aFlashCompensation*/) const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::IsExternalFlashPresent() const + { + return EFalse; + } + +void CWebCameraAdvSet::GetManualFlashPowerLevelsL(RArray& /*aManualFlashPowerLevels*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::ManualFlashPowerLevel() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedExposureModes() const + { + return CCamera::EExposureAuto; + } + +CCamera::TExposure CWebCameraAdvSet::ExposureMode() const + { + return CCamera::EExposureAuto; + } + +void CWebCameraAdvSet::SetExposureMode(CCamera::TExposure /*aExposureMode*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const + { + aExposureCompensationSteps.Reset(); + aInfo = ENotActive; + } + +void CWebCameraAdvSet::GetExposureCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::ExposureCompensationStep() const + { + return 0; + } + +TInt CWebCameraAdvSet::GetExposureCompensationStep(TInt& /*aExposureCompensationStep*/) const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::ExposureCompensation() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::GetExposureCompensation(TInt& /*aExposureCompensation*/) const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedWhiteBalanceModes() const + { + return KErrNotSupported; + } + +CCamera::TWhiteBalance CWebCameraAdvSet::WhiteBalanceMode() const + { + return CCamera::EWBAuto; + } + +void CWebCameraAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance /*aWhiteBalanceMode*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::ApertureExposureLockOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::ShootClickOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::SetShootClickOn(TBool /*aShootClickOn*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetTimerIntervalsL(RArray& /*aTimerIntervals*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::TimerInterval() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetTimerInterval(TInt /*aTimerInterval*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetTimeLapsePeriodRange(TTime& /*aTimeLapseMin*/, TTime& /*aTimeLapseMax*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetTimeLapse(TTime& /*aStart*/, TTime& /*aEnd*/, TTime& /*aInterval*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/) + { + User::Leave(KErrNotSupported); + } + +CCamera::CCameraAdvancedSettings::TPictureOrientation CWebCameraAdvSet::PictureOrientation() const + { + return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown; + } + +void CWebCameraAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation /*aOrientation*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedPixelAspectRatios() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TPixelAspectRatio CWebCameraAdvSet::PixelAspectRatio() const + { + return CCamera::CCameraAdvancedSettings::EPixelAspectUnknown; + } + +void CWebCameraAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio /*aPixelAspectRatio*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::SupportedYuvRanges() const + { + return KErrNotSupported; + } + +CCamera::CCameraAdvancedSettings::TYuvRange CWebCameraAdvSet::YuvRange() const + { + return CCamera::CCameraAdvancedSettings::EYuvRangeUnknown; + } + +void CWebCameraAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange /*aYuvRange*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::BurstImages() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetBurstImages(TInt /*aImages*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetOpticalZoomStepsL(RArray& /*aOpticalZoomSteps*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::OpticalZoom() const + { + return KECamFineResolutionFactor; + } + +void CWebCameraAdvSet::SetOpticalZoom(TInt /*aOpticalZoom*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +void CWebCameraAdvSet::GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aSizeIndex*/, + CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +void CWebCameraAdvSet::GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aFrameRateIndex*/, + TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const + { + aDigitalZoomSteps.Reset(); + aDigitalZoomSteps.AppendL(KECamFineResolutionFactor); + aInfo = EDiscreteSteps; + } + +TInt CWebCameraAdvSet::DigitalZoom() const + { + return KErrNotSupported; + } + +void CWebCameraAdvSet::SetDigitalZoom(TInt /*aDigitalZoom*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::ExposureLockOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::SetExposureLockOn(TBool /*aState*/) + { + User::Leave(KErrNotSupported); + } + +TBool CWebCameraAdvSet::AutoFocusLockOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::SetAutoFocusLockOn(TBool /*aState*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetSupportedSettingsL(RArray& /*aSettings*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetActiveSettingsL(RArray& /*aActiveSettings*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetDisabledSettingsL(RArray& /*aDisbledSettings*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetAutomaticSizeSelectionChangeOn(TBool /*aSetOn*/) + { + } + +TBool CWebCameraAdvSet::AutomaticSizeSelectionChangeOn() const + { + return EFalse; + } + +void CWebCameraAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray& /*aTimeouts*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect /*aEffect*/) + { + User::Leave(KErrNotSupported); + } + +CCamera::CCameraAdvancedSettings::TStabilizationEffect CWebCameraAdvSet::StabilizationEffect() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationOff; + } + +TInt CWebCameraAdvSet::SupportedStabilizationEffects() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationOff; + } + +TInt CWebCameraAdvSet::SupportedStabilizationComplexityValues() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationOff; + } + +CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CWebCameraAdvSet::StabilizationComplexity() const + { + return CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto; + } + +void CWebCameraAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity /*aComplexity*/) + { + User::Leave(KErrNotSupported); + } + +CCamera::CCameraAdvancedSettings::TWBUnits CWebCameraAdvSet::SupportedWBUnits() const + { + return CCamera::CCameraAdvancedSettings::EWBUnknown; + } + +void CWebCameraAdvSet::SetWBRgbValue(const TRgb& /*aValue*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetWBRgbValue(TRgb& /*aValue*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetWBSupportedColorTemperaturesL(RArray& /*aWBColorTemperatures*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/) + { + User::Leave(KErrNotSupported); + } + +TInt CWebCameraAdvSet::WBColorTemperature() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::ContinuousAutoFocusTimeout() const + { + return KErrNotSupported; + } + +TInt CWebCameraAdvSet::IsFlashReady(TBool& aReady) const + { + aReady = 0; + return KErrNone; + } + +void CWebCameraAdvSet::GetCurrentFocusModeStepsL(RArray& /*aFocusModeSteps*/, TValueInfo& /*aInfo*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& /*aPreCaptureWarningSupported*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/) + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::UnSubscribePreCaptureWarningL() + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetSupportedAFAssistantLightL(TInt& /*aSupportedAFAssistantLight*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& /*aAFAssistantLight*/) const + { + User::Leave(KErrNotSupported); + } + +void CWebCameraAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight /*aAFAssistantLight*/) + { + User::Leave(KErrNotSupported); + } + + diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.h --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraadvset.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,203 +1,203 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERAADVSET_H -#define ECAMWEBCAMERAADVSET_H - -#include -#include "ecamwebcameraplugin.h" - - -const TInt KDefaultIsoRate = 200; - -// Implementations of the MCameraAdvancedSettings class -class CWebCameraAdvSet : public CBase, - public MCameraAdvancedSettings, - public MCameraAdvancedSettings2, - public MCameraAdvancedSettings3 - { - friend class CWebCamera; -public: - static CWebCameraAdvSet* NewL(CWebCamera& aOwner); - ~CWebCameraAdvSet(); - -protected: - //from MCameraAdvancedSettings - void Release(); - CCamera::CCameraAdvancedSettings::TCameraType CameraType() const; - CCamera::CCameraAdvancedSettings::TCameraType CameraType(TInt aCameraIndex) const; - TBool IsCameraPresent() const; - TBool IsCameraPresent(TInt aCameraIndex) const; - TInt CameraIndex() const; - TInt SupportedStabilizationModes() const; - CCamera::CCameraAdvancedSettings::TStabilizationMode StabilizationMode() const; - void SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode); - TInt SupportedFocusModes() const; - CCamera::CCameraAdvancedSettings::TFocusMode FocusMode() const; - void SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode); - TInt SupportedFocusRanges() const; - CCamera::CCameraAdvancedSettings::TFocusRange FocusRange() const; - void SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange); - TInt SupportedAutoFocusTypes() const; - CCamera::CCameraAdvancedSettings::TAutoFocusType AutoFocusType() const; - void SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType); - TInt SupportedAutoFocusAreas() const; - CCamera::CCameraAdvancedSettings::TAutoFocusArea AutoFocusArea() const; - void SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea); - TInt FocusDistance() const; - void SetFocusDistance(TInt aDistance); - TInt GetMinFocalLength() const; - void GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const; - TInt IsoRate() const; - void SetIsoRate(TInt aRate); - void GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const; - TInt Aperture() const; - void SetAperture(TInt aFStop); - void GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const; - TInt ShutterSpeed() const; - void SetShutterSpeed(TInt aShutterSpeed); - TInt SupportedMeteringModes() const; - CCamera::CCameraAdvancedSettings::TMeteringMode MeteringMode() const; - void SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode); - TInt SupportedDriveModes() const; - CCamera::CCameraAdvancedSettings::TDriveMode DriveMode() const; - void SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode); - TInt SupportedBracketModes() const; - CCamera::CCameraAdvancedSettings::TBracketMode BracketMode() const; - void SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode); - TInt SupportedBracketParameters() const; - CCamera::CCameraAdvancedSettings::TBracketParameter BracketParameter() const; - void SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter); - TInt SupportedBracketSteps() const; - CCamera::CCameraAdvancedSettings::TBracketStep BracketStep() const; - void SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep); - void GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const; - void SetBracketMerge(TInt aStartIndex, TInt aFrames); - TInt SupportedFlashModes() const; - CCamera::TFlash FlashMode() const; - void SetFlashMode(CCamera::TFlash aMode); - TBool RedEyeReduceOn() const; - void SetRedEyeReduceOn(TBool aState); - void GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const; - TInt FlashCompensationStep() const; - TInt GetFlashCompensationStep(TInt& aFlashCompensationStep) const; - void SetFlashCompensationStep(TInt aFlashCompensationStep); - void GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; - TInt FlashCompensation() const; - TInt GetFlashCompensation(TInt& aFlashCompensation) const; - void SetFlashCompensation(TInt aFlashCompensationSteps); - TBool IsExternalFlashPresent() const; - void GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const; - TInt ManualFlashPowerLevel() const; - void SetManualFlashPowerLevel(TInt aManualFlashPowerLevel); - TInt SupportedExposureModes() const; - CCamera::TExposure ExposureMode() const; - void SetExposureMode(CCamera::TExposure aExposureMode); - void GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const; - TInt ExposureCompensationStep() const; - TInt GetExposureCompensationStep(TInt& aExposureCompensationStep) const; - void SetExposureCompensationStep(TInt aExposureCompensationStep); - void GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; - TInt ExposureCompensation() const; - TInt GetExposureCompensation(TInt& aExposureCompensation) const; - void SetExposureCompensation(TInt aExposureCompensationSteps); - TInt SupportedWhiteBalanceModes() const; - CCamera::TWhiteBalance WhiteBalanceMode() const; - void SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode); - TBool ApertureExposureLockOn() const; - void SetApertureExposureLockOn(TBool aAELock); - TBool ShootClickOn() const; - void SetShootClickOn(TBool aShootClickOn); - void GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const; - TInt TimerInterval() const; - void SetTimerInterval(TInt aTimerInterval); - void GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const; - void GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const; - void SetTimeLapse(const TTime& aStart, const TTime& aEnd, const TTime& aInterval); - CCamera::CCameraAdvancedSettings::TPictureOrientation PictureOrientation() const; - void SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation); - TInt SupportedPixelAspectRatios() const; - CCamera::CCameraAdvancedSettings::TPixelAspectRatio PixelAspectRatio() const; - void SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio); - TInt SupportedYuvRanges() const; - CCamera::CCameraAdvancedSettings::TYuvRange YuvRange() const; - void SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange); - TInt BurstImages() const; - void SetBurstImages(TInt aImages); - void GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const; - TInt OpticalZoom() const; - void SetOpticalZoom(TInt aOpticalZoom); - void GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const; - TInt DigitalZoom() const; - void SetDigitalZoom(TInt aDigitalZoom); - TBool ExposureLockOn() const; - void SetExposureLockOn(TBool aState); - TBool AutoFocusLockOn() const; - void SetAutoFocusLockOn(TBool aState); - void GetSupportedSettingsL(RArray& aSettings) const; - void GetActiveSettingsL(RArray& aActiveSettings) const; - void GetDisabledSettingsL(RArray& aDisabledSettings) const; - TBool AutomaticSizeSelectionChangeOn() const; - void SetAutomaticSizeSelectionChangeOn(TBool aSetOn); - void GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const; - TInt ContinuousAutoFocusTimeout() const; - void SetContinuousAutoFocusTimeout(TInt aTimeout); - TInt SupportedStabilizationEffects() const; - CCamera::CCameraAdvancedSettings::TStabilizationEffect StabilizationEffect() const; - void SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect); - TInt SupportedStabilizationComplexityValues() const; - CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity StabilizationComplexity() const; - void SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity); - CCamera::CCameraAdvancedSettings::TWBUnits SupportedWBUnits() const; - void GetWBRgbValue(TRgb& aValue) const; - void SetWBRgbValue(const TRgb& aValue); - void GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const; - TInt WBColorTemperature() const; - void SetWBColorTemperature(TInt aWBColorTemperature); - - //from MCameraAdvancedSettings2 - TInt IsFlashReady(TBool& aReady) const; - void GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const; - - //from MCameraAdvancedSettings3 - void GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const; - void SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam); - void GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& aParam, TInt& aISORate) const; - void SetReferenceScreen(CWsScreenDevice& aScreenDevice); - void GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aSizeIndex, - CCamera::TFormat aFormat, TBool& aIsInfluencePossible) const; - void GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aFrameRateIndex, - TInt aSizeIndex, CCamera::TFormat aFormat, TBool& aIsInfluencePossible, CCamera::TExposure aExposure) const; - void GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode aCameraMode, TInt& aPreCaptureWarningSupported) const; - void SubscribeToPreCaptureWarningL(TInt aPreCaptureWarning); - void UnSubscribePreCaptureWarningL(); - void GetPreCaptureWarningL(TInt& aPreCaptureWarning) const; - void GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const; - void GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& aAFAssistantLight) const; - void SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight); - -private: - CWebCameraAdvSet(CWebCamera& aOwner); - void Init(); - void ConstructL(); - -private: - CWebCamera& iOwner; - RArray iSupportedISORates; - }; - -#endif // TESTADVANCEDSETTINGS_H +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERAADVSET_H +#define ECAMWEBCAMERAADVSET_H + +#include +#include "ecamwebcameraplugin.h" + + +const TInt KDefaultIsoRate = 200; + +// Implementations of the MCameraAdvancedSettings class +class CWebCameraAdvSet : public CBase, + public MCameraAdvancedSettings, + public MCameraAdvancedSettings2, + public MCameraAdvancedSettings3 + { + friend class CWebCamera; +public: + static CWebCameraAdvSet* NewL(CWebCamera& aOwner); + ~CWebCameraAdvSet(); + +protected: + //from MCameraAdvancedSettings + void Release(); + CCamera::CCameraAdvancedSettings::TCameraType CameraType() const; + CCamera::CCameraAdvancedSettings::TCameraType CameraType(TInt aCameraIndex) const; + TBool IsCameraPresent() const; + TBool IsCameraPresent(TInt aCameraIndex) const; + TInt CameraIndex() const; + TInt SupportedStabilizationModes() const; + CCamera::CCameraAdvancedSettings::TStabilizationMode StabilizationMode() const; + void SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode); + TInt SupportedFocusModes() const; + CCamera::CCameraAdvancedSettings::TFocusMode FocusMode() const; + void SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode); + TInt SupportedFocusRanges() const; + CCamera::CCameraAdvancedSettings::TFocusRange FocusRange() const; + void SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange); + TInt SupportedAutoFocusTypes() const; + CCamera::CCameraAdvancedSettings::TAutoFocusType AutoFocusType() const; + void SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType); + TInt SupportedAutoFocusAreas() const; + CCamera::CCameraAdvancedSettings::TAutoFocusArea AutoFocusArea() const; + void SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea); + TInt FocusDistance() const; + void SetFocusDistance(TInt aDistance); + TInt GetMinFocalLength() const; + void GetSupportedIsoRatesL(RArray& aSupportedIsoRates) const; + TInt IsoRate() const; + void SetIsoRate(TInt aRate); + void GetAperturesL(RArray& aFStops, TValueInfo& aInfo) const; + TInt Aperture() const; + void SetAperture(TInt aFStop); + void GetShutterSpeedsL(RArray& aShutterSpeeds, TValueInfo& aInfo) const; + TInt ShutterSpeed() const; + void SetShutterSpeed(TInt aShutterSpeed); + TInt SupportedMeteringModes() const; + CCamera::CCameraAdvancedSettings::TMeteringMode MeteringMode() const; + void SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode); + TInt SupportedDriveModes() const; + CCamera::CCameraAdvancedSettings::TDriveMode DriveMode() const; + void SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode); + TInt SupportedBracketModes() const; + CCamera::CCameraAdvancedSettings::TBracketMode BracketMode() const; + void SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode); + TInt SupportedBracketParameters() const; + CCamera::CCameraAdvancedSettings::TBracketParameter BracketParameter() const; + void SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter); + TInt SupportedBracketSteps() const; + CCamera::CCameraAdvancedSettings::TBracketStep BracketStep() const; + void SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep); + void GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const; + void SetBracketMerge(TInt aStartIndex, TInt aFrames); + TInt SupportedFlashModes() const; + CCamera::TFlash FlashMode() const; + void SetFlashMode(CCamera::TFlash aMode); + TBool RedEyeReduceOn() const; + void SetRedEyeReduceOn(TBool aState); + void GetFlashCompensationStepsL(RArray& aFlashCompensationSteps, TValueInfo& aInfo) const; + TInt FlashCompensationStep() const; + TInt GetFlashCompensationStep(TInt& aFlashCompensationStep) const; + void SetFlashCompensationStep(TInt aFlashCompensationStep); + void GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; + TInt FlashCompensation() const; + TInt GetFlashCompensation(TInt& aFlashCompensation) const; + void SetFlashCompensation(TInt aFlashCompensationSteps); + TBool IsExternalFlashPresent() const; + void GetManualFlashPowerLevelsL(RArray& aManualFlashPowerLevels, TValueInfo& aInfo) const; + TInt ManualFlashPowerLevel() const; + void SetManualFlashPowerLevel(TInt aManualFlashPowerLevel); + TInt SupportedExposureModes() const; + CCamera::TExposure ExposureMode() const; + void SetExposureMode(CCamera::TExposure aExposureMode); + void GetExposureCompensationStepsL(RArray& aExposureCompensationSteps, TValueInfo& aInfo) const; + TInt ExposureCompensationStep() const; + TInt GetExposureCompensationStep(TInt& aExposureCompensationStep) const; + void SetExposureCompensationStep(TInt aExposureCompensationStep); + void GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const; + TInt ExposureCompensation() const; + TInt GetExposureCompensation(TInt& aExposureCompensation) const; + void SetExposureCompensation(TInt aExposureCompensationSteps); + TInt SupportedWhiteBalanceModes() const; + CCamera::TWhiteBalance WhiteBalanceMode() const; + void SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode); + TBool ApertureExposureLockOn() const; + void SetApertureExposureLockOn(TBool aAELock); + TBool ShootClickOn() const; + void SetShootClickOn(TBool aShootClickOn); + void GetTimerIntervalsL(RArray& aTimerIntervals, TValueInfo& aInfo) const; + TInt TimerInterval() const; + void SetTimerInterval(TInt aTimerInterval); + void GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const; + void GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const; + void SetTimeLapse(const TTime& aStart, const TTime& aEnd, const TTime& aInterval); + CCamera::CCameraAdvancedSettings::TPictureOrientation PictureOrientation() const; + void SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation); + TInt SupportedPixelAspectRatios() const; + CCamera::CCameraAdvancedSettings::TPixelAspectRatio PixelAspectRatio() const; + void SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio); + TInt SupportedYuvRanges() const; + CCamera::CCameraAdvancedSettings::TYuvRange YuvRange() const; + void SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange); + TInt BurstImages() const; + void SetBurstImages(TInt aImages); + void GetOpticalZoomStepsL(RArray& aOpticalZoomSteps, TValueInfo& aInfo) const; + TInt OpticalZoom() const; + void SetOpticalZoom(TInt aOpticalZoom); + void GetDigitalZoomStepsL(RArray& aDigitalZoomSteps, TValueInfo& aInfo) const; + TInt DigitalZoom() const; + void SetDigitalZoom(TInt aDigitalZoom); + TBool ExposureLockOn() const; + void SetExposureLockOn(TBool aState); + TBool AutoFocusLockOn() const; + void SetAutoFocusLockOn(TBool aState); + void GetSupportedSettingsL(RArray& aSettings) const; + void GetActiveSettingsL(RArray& aActiveSettings) const; + void GetDisabledSettingsL(RArray& aDisabledSettings) const; + TBool AutomaticSizeSelectionChangeOn() const; + void SetAutomaticSizeSelectionChangeOn(TBool aSetOn); + void GetSupportedContinuousAutoFocusTimeoutsL(RArray& aTimeouts, TValueInfo& aInfo) const; + TInt ContinuousAutoFocusTimeout() const; + void SetContinuousAutoFocusTimeout(TInt aTimeout); + TInt SupportedStabilizationEffects() const; + CCamera::CCameraAdvancedSettings::TStabilizationEffect StabilizationEffect() const; + void SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect); + TInt SupportedStabilizationComplexityValues() const; + CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity StabilizationComplexity() const; + void SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity); + CCamera::CCameraAdvancedSettings::TWBUnits SupportedWBUnits() const; + void GetWBRgbValue(TRgb& aValue) const; + void SetWBRgbValue(const TRgb& aValue); + void GetWBSupportedColorTemperaturesL(RArray& aWBColorTemperatures, TValueInfo& aInfo) const; + TInt WBColorTemperature() const; + void SetWBColorTemperature(TInt aWBColorTemperature); + + //from MCameraAdvancedSettings2 + TInt IsFlashReady(TBool& aReady) const; + void GetCurrentFocusModeStepsL(RArray& aFocusModeSteps, TValueInfo& aInfo) const; + + //from MCameraAdvancedSettings3 + void GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const; + void SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam); + void GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& aParam, TInt& aISORate) const; + void SetReferenceScreen(CWsScreenDevice& aScreenDevice); + void GetDigitalZoomStepsForStillL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aSizeIndex, + CCamera::TFormat aFormat, TBool& aIsInfluencePossible) const; + void GetDigitalZoomStepsForVideoL(RArray& aDigitalZoomSteps, TValueInfo& aInfo, TInt aFrameRateIndex, + TInt aSizeIndex, CCamera::TFormat aFormat, TBool& aIsInfluencePossible, CCamera::TExposure aExposure) const; + void GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode aCameraMode, TInt& aPreCaptureWarningSupported) const; + void SubscribeToPreCaptureWarningL(TInt aPreCaptureWarning); + void UnSubscribePreCaptureWarningL(); + void GetPreCaptureWarningL(TInt& aPreCaptureWarning) const; + void GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const; + void GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& aAFAssistantLight) const; + void SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight); + +private: + CWebCameraAdvSet(CWebCamera& aOwner); + void Init(); + void ConstructL(); + +private: + CWebCamera& iOwner; + RArray iSupportedISORates; + }; + +#endif // TESTADVANCEDSETTINGS_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.cpp --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,224 +1,224 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "ecamwebcamerabuffer.h" - - -// --------------------------------------------------------------------------- -// NewL -// Takes ownership of aData, but not aBitmap -// --------------------------------------------------------------------------- -// -CWebCameraBuffer* CWebCameraBuffer::NewL(const CFbsBitmap& aBitmap, HBufC8* aData) - { - CWebCameraBuffer* self = CWebCameraBuffer::NewLC( aBitmap, aData ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// Takes ownership of aData, but not aBitmap -// --------------------------------------------------------------------------- -// -CWebCameraBuffer* CWebCameraBuffer::NewLC(const CFbsBitmap& aBitmap, HBufC8* aData) - { - CWebCameraBuffer* self = new (ELeave) CWebCameraBuffer; - CleanupStack::PushL( self ); - self->ConstructL( aBitmap, aData ); - return self; - } - - -// --------------------------------------------------------------------------- -// NewL -// Takes ownership of both objects. -// --------------------------------------------------------------------------- -// -CWebCameraBuffer* CWebCameraBuffer::NewL(CFbsBitmap* aBitmap, HBufC8* aData) - { - CWebCameraBuffer* self = CWebCameraBuffer::NewLC( aBitmap, aData ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// Takes ownership of both objects. -// --------------------------------------------------------------------------- -// -CWebCameraBuffer* CWebCameraBuffer::NewLC(CFbsBitmap* aBitmap, HBufC8* aData) - { - CWebCameraBuffer* self = new (ELeave) CWebCameraBuffer; - CleanupStack::PushL( self ); - self->ConstructL( aBitmap, aData ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor -// -// --------------------------------------------------------------------------- -// -CWebCameraBuffer::CWebCameraBuffer() - : iBitmap(NULL), - iImageData(NULL), - iOwnBitmap(ETrue), - iOwnData(ETrue) - { - } - -// --------------------------------------------------------------------------- -// Destructor -// *private, because Release() is supposed to be used.* -// --------------------------------------------------------------------------- -// -CWebCameraBuffer::~CWebCameraBuffer() - { - iChunk.Close(); - delete iBitmap; - delete iImageData; - } - -// --------------------------------------------------------------------------- -// ConstructL -// -// --------------------------------------------------------------------------- -// -void CWebCameraBuffer::ConstructL(const CFbsBitmap& aBitmap, HBufC8* aData) - { - iBitmap = new (ELeave) CFbsBitmap; - TInt error = iBitmap->Duplicate( aBitmap.Handle() ); - - iImageData = aData; - - User::LeaveIfError( error ); - } - -// --------------------------------------------------------------------------- -// ConstructL -// -// --------------------------------------------------------------------------- -// -void CWebCameraBuffer::ConstructL(CFbsBitmap* aBitmap, HBufC8* aData) - { - iImageData = aData; - iBitmap = aBitmap; - } - -// --------------------------------------------------------------------------- -// NumFrames -// -// Number of frames available in the buffer. -// --------------------------------------------------------------------------- -// -TInt -CWebCameraBuffer::NumFrames() - { - return 1; - } - - -// --------------------------------------------------------------------------- -// DataL -// -// Frame data as descriptor. -// *not supported here* -// --------------------------------------------------------------------------- -// -TDesC8* CWebCameraBuffer::DataL(TInt aFrameIndex) - { - if( aFrameIndex != 0 || !iImageData ) - { - User::Leave( KErrNotSupported ); - } - - return iImageData; - } - -// --------------------------------------------------------------------------- -// BitmapL -// -// Frame data as bitmap. -// --------------------------------------------------------------------------- -// -CFbsBitmap& CWebCameraBuffer::BitmapL(TInt aFrameIndex) - { - if( aFrameIndex != 0 || !iBitmap ) - { - User::Leave( KErrNotFound ); - } - - return *iBitmap; - } - -// --------------------------------------------------------------------------- -// DataL -// -// Frame data as chunk. -// *not supported here* -// --------------------------------------------------------------------------- -// -RChunk& CWebCameraBuffer::ChunkL() - { - User::Leave( KErrNotSupported ); - - return iChunk; - } - -// --------------------------------------------------------------------------- -// ChunkOffsetL -// -// Frame data offset in chunk. -// *not supported here* -// --------------------------------------------------------------------------- -// -TInt -CWebCameraBuffer::ChunkOffsetL(TInt /*aFrameIndex*/) - { - User::Leave( KErrNotSupported ); - - return 0; - } - -// --------------------------------------------------------------------------- -// FrameSize -// -// Frame data size. -// *not supported here, as only bitmap supported* -// --------------------------------------------------------------------------- -// -TInt CWebCameraBuffer::FrameSize(TInt /*aFrameIndex*/) - { - return -1; - } - -// --------------------------------------------------------------------------- -// Release -// -// Release this buffer. -// Simply deletes this object. -// --------------------------------------------------------------------------- -// -void CWebCameraBuffer::Release() - { - delete this; - } - - -// end of file +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "ecamwebcamerabuffer.h" + + +// --------------------------------------------------------------------------- +// NewL +// Takes ownership of aData, but not aBitmap +// --------------------------------------------------------------------------- +// +CWebCameraBuffer* CWebCameraBuffer::NewL(const CFbsBitmap& aBitmap, HBufC8* aData) + { + CWebCameraBuffer* self = CWebCameraBuffer::NewLC( aBitmap, aData ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// NewLC +// Takes ownership of aData, but not aBitmap +// --------------------------------------------------------------------------- +// +CWebCameraBuffer* CWebCameraBuffer::NewLC(const CFbsBitmap& aBitmap, HBufC8* aData) + { + CWebCameraBuffer* self = new (ELeave) CWebCameraBuffer; + CleanupStack::PushL( self ); + self->ConstructL( aBitmap, aData ); + return self; + } + + +// --------------------------------------------------------------------------- +// NewL +// Takes ownership of both objects. +// --------------------------------------------------------------------------- +// +CWebCameraBuffer* CWebCameraBuffer::NewL(CFbsBitmap* aBitmap, HBufC8* aData) + { + CWebCameraBuffer* self = CWebCameraBuffer::NewLC( aBitmap, aData ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// NewLC +// Takes ownership of both objects. +// --------------------------------------------------------------------------- +// +CWebCameraBuffer* CWebCameraBuffer::NewLC(CFbsBitmap* aBitmap, HBufC8* aData) + { + CWebCameraBuffer* self = new (ELeave) CWebCameraBuffer; + CleanupStack::PushL( self ); + self->ConstructL( aBitmap, aData ); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor +// +// --------------------------------------------------------------------------- +// +CWebCameraBuffer::CWebCameraBuffer() + : iBitmap(NULL), + iImageData(NULL), + iOwnBitmap(ETrue), + iOwnData(ETrue) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// *private, because Release() is supposed to be used.* +// --------------------------------------------------------------------------- +// +CWebCameraBuffer::~CWebCameraBuffer() + { + iChunk.Close(); + delete iBitmap; + delete iImageData; + } + +// --------------------------------------------------------------------------- +// ConstructL +// +// --------------------------------------------------------------------------- +// +void CWebCameraBuffer::ConstructL(const CFbsBitmap& aBitmap, HBufC8* aData) + { + iBitmap = new (ELeave) CFbsBitmap; + TInt error = iBitmap->Duplicate( aBitmap.Handle() ); + + iImageData = aData; + + User::LeaveIfError( error ); + } + +// --------------------------------------------------------------------------- +// ConstructL +// +// --------------------------------------------------------------------------- +// +void CWebCameraBuffer::ConstructL(CFbsBitmap* aBitmap, HBufC8* aData) + { + iImageData = aData; + iBitmap = aBitmap; + } + +// --------------------------------------------------------------------------- +// NumFrames +// +// Number of frames available in the buffer. +// --------------------------------------------------------------------------- +// +TInt +CWebCameraBuffer::NumFrames() + { + return 1; + } + + +// --------------------------------------------------------------------------- +// DataL +// +// Frame data as descriptor. +// *not supported here* +// --------------------------------------------------------------------------- +// +TDesC8* CWebCameraBuffer::DataL(TInt aFrameIndex) + { + if( aFrameIndex != 0 || !iImageData ) + { + User::Leave( KErrNotSupported ); + } + + return iImageData; + } + +// --------------------------------------------------------------------------- +// BitmapL +// +// Frame data as bitmap. +// --------------------------------------------------------------------------- +// +CFbsBitmap& CWebCameraBuffer::BitmapL(TInt aFrameIndex) + { + if( aFrameIndex != 0 || !iBitmap ) + { + User::Leave( KErrNotFound ); + } + + return *iBitmap; + } + +// --------------------------------------------------------------------------- +// DataL +// +// Frame data as chunk. +// *not supported here* +// --------------------------------------------------------------------------- +// +RChunk& CWebCameraBuffer::ChunkL() + { + User::Leave( KErrNotSupported ); + + return iChunk; + } + +// --------------------------------------------------------------------------- +// ChunkOffsetL +// +// Frame data offset in chunk. +// *not supported here* +// --------------------------------------------------------------------------- +// +TInt +CWebCameraBuffer::ChunkOffsetL(TInt /*aFrameIndex*/) + { + User::Leave( KErrNotSupported ); + + return 0; + } + +// --------------------------------------------------------------------------- +// FrameSize +// +// Frame data size. +// *not supported here, as only bitmap supported* +// --------------------------------------------------------------------------- +// +TInt CWebCameraBuffer::FrameSize(TInt /*aFrameIndex*/) + { + return -1; + } + +// --------------------------------------------------------------------------- +// Release +// +// Release this buffer. +// Simply deletes this object. +// --------------------------------------------------------------------------- +// +void CWebCameraBuffer::Release() + { + delete this; + } + + +// end of file diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.h --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcamerabuffer.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,59 +1,59 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERABUFFER_H -#define ECAMWEBCAMERABUFFER_H - -#include -#include - - -class CFbsBitmap; -class CWebCameraBuffer : public CBase - , public MCameraBuffer - { -public: - static CWebCameraBuffer* NewL(const CFbsBitmap& aBitmap, HBufC8* aData); - static CWebCameraBuffer* NewLC(const CFbsBitmap& aBitmap, HBufC8* aData); - static CWebCameraBuffer* NewL(CFbsBitmap* aBitmap, HBufC8* aData); - static CWebCameraBuffer* NewLC(CFbsBitmap* aBitmap, HBufC8* aData); - -public: - virtual TInt NumFrames(); - virtual TDesC8* DataL( TInt aFrameIndex ); - virtual CFbsBitmap& BitmapL( TInt aFrameIndex ); - virtual RChunk& ChunkL(); - virtual TInt ChunkOffsetL( TInt aFrameIndex ); - virtual TInt FrameSize( TInt aFrameIndex ); - virtual void Release(); - ~CWebCameraBuffer(); - -private: - void ConstructL(const CFbsBitmap& aBitmap, HBufC8* aData); - void ConstructL(CFbsBitmap* aBitmap, HBufC8* aData); - CWebCameraBuffer(); - -private: - CFbsBitmap* iBitmap; - HBufC8* iImageData; - RChunk iChunk; - - TBool iOwnBitmap; - TBool iOwnData; - }; - -#endif // ECAMWEBCAMERABUFFER_H +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERABUFFER_H +#define ECAMWEBCAMERABUFFER_H + +#include +#include + + +class CFbsBitmap; +class CWebCameraBuffer : public CBase + , public MCameraBuffer + { +public: + static CWebCameraBuffer* NewL(const CFbsBitmap& aBitmap, HBufC8* aData); + static CWebCameraBuffer* NewLC(const CFbsBitmap& aBitmap, HBufC8* aData); + static CWebCameraBuffer* NewL(CFbsBitmap* aBitmap, HBufC8* aData); + static CWebCameraBuffer* NewLC(CFbsBitmap* aBitmap, HBufC8* aData); + +public: + virtual TInt NumFrames(); + virtual TDesC8* DataL( TInt aFrameIndex ); + virtual CFbsBitmap& BitmapL( TInt aFrameIndex ); + virtual RChunk& ChunkL(); + virtual TInt ChunkOffsetL( TInt aFrameIndex ); + virtual TInt FrameSize( TInt aFrameIndex ); + virtual void Release(); + ~CWebCameraBuffer(); + +private: + void ConstructL(const CFbsBitmap& aBitmap, HBufC8* aData); + void ConstructL(CFbsBitmap* aBitmap, HBufC8* aData); + CWebCameraBuffer(); + +private: + CFbsBitmap* iBitmap; + HBufC8* iImageData; + RChunk iChunk; + + TBool iOwnBitmap; + TBool iOwnData; + }; + +#endif // ECAMWEBCAMERABUFFER_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.cpp --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,1332 +1,1303 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "ecamwebcameraplugin.h" -#include "ecamwebcamerapluginuids.hrh" -#include "ecamwebcamerabuffer.h" -#include "ecamwebcameraadvset.h" -#include "ecamwebcameraactive.h" -#include "ecamwebcameravfactive.h" - - -_LIT(KCameraDriverPddName, "webcamera.pdd"); -_LIT(KCameraDriverLddName, "ewebcamera.ldd"); - -const TInt KCaptureWidth = 160; // Capture image width -const TInt KCaptureHeight = 120; // Capture image height -const TInt KCaptureLineBytes = KCaptureWidth * 3; // bytes of one line - -// -// CWebCamera class -// - -CWebCamera::CWebCamera(): - iCaptureBufPtr(NULL, 0) - { - iInfo.iHardwareVersion.iMajor = 0; - iInfo.iHardwareVersion.iMinor = 0; - iInfo.iHardwareVersion.iBuild = 0; - iInfo.iSoftwareVersion.iMajor = 0; - iInfo.iSoftwareVersion.iMinor = 0; - iInfo.iSoftwareVersion.iBuild = 0; - iInfo.iOrientation = TCameraInfo::EOrientationOutwards; - - iInfo.iOptionsSupported = 0; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderDirectSupported; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderBitmapsSupported; - iInfo.iOptionsSupported |= TCameraInfo::EImageCaptureSupported; - iInfo.iOptionsSupported |= TCameraInfo::EVideoCaptureSupported; - iInfo.iOptionsSupported |= TCameraInfo::EContrastSupported; - iInfo.iOptionsSupported |= TCameraInfo::EBrightnessSupported; - iInfo.iOptionsSupported |= TCameraInfo::EViewFinderClippingSupported; - - iInfo.iFlashModesSupported = 0; // Bitfield of TFlash values - iInfo.iExposureModesSupported = 0; // Bitfield of TExposure values - iInfo.iWhiteBalanceModesSupported = 0; // Bitfield of TWhiteBalance values - - iInfo.iMinZoom = KMinTestCameraZoom; - // KMinTestCameraZoom is zero or negative - // note the algorithm for creating of zoom factor - iInfo.iMinZoomFactor = TReal32(1)/TReal32(1 << -KMinTestCameraZoom); - iInfo.iMaxZoom = KMaxTestCameraZoom; - iInfo.iMaxZoomFactor = 1 << KMaxTestCameraZoom; - - iInfo.iMaxDigitalZoom = KMaxTestCameraDigitalZoom; - iInfo.iMaxDigitalZoomFactor = KMaxTestCameraDigitalZoomFactor; - - iInfo.iImageFormatsSupported = 0; - iInfo.iImageFormatsSupported |= EFormatExif; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor4K; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor64K; - iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor16M; - - iInfo.iVideoFrameFormatsSupported = 0; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor4K; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor64K; - iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor16M; - iInfo.iMaxFramesPerBufferSupported = 1; - iInfo.iMaxBuffersSupported = 2; - } - -CWebCamera::~CWebCamera() - { - delete iCaptureBuf; - delete iAdvSettingsImpl; - delete iVfActive; - delete iActive; - iImageSizes.Close(); - iDriver.Close(); - } - -CWebCamera* CWebCamera::NewL() - { - CWebCamera* self = new(ELeave) CWebCamera; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -void CWebCamera::ConstructL() - { - RDebug::Print(_L("CWebCamera::ConstructL_S")); - // Open drivers. - TInt err; - - err = User::LoadPhysicalDevice(KCameraDriverPddName); - RDebug::Print(_L("CWebCamera::ConstructL LoadPhysicalDevice[%d]"), err); - - if (err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - - err = User::LoadLogicalDevice(KCameraDriverLddName); - RDebug::Print(_L("CWebCamera::ConstructL LoadLogicalDevice[%d]"), err); - - if (err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - - RDebug::Print(_L("CWebCamera::ConstructL iDriver.Open()")); - iDriver.Open(); - - iActive = CWebCameraActive::NewL(this, iDriver); - iVfActive = CWebCameraVfActive::NewL(this, iDriver); - - User::LeaveIfError(iImageSizes.Append(TSize(640, 480))); // VGA - User::LeaveIfError(iImageSizes.Append(TSize(160, 120))); // QQVGA - iInfo.iNumImageSizesSupported = iImageSizes.Count(); - - RDebug::Print(_L("CWebCamera::ConstructL_E")); - } - -/** -from CCameraPlugin - -A call to one of the factory functions firstly loads the plugin, followed by a -call to this function to complete construction. - -Creates an object representing a camera. - -@param aObserver - Reference to class derived from MCameraObserver2 designed to receive - notification of asynchronous event completion. -@param aCameraIndex - Index from 0 to CamerasAvailable()-1 inclusive specifying the - camera device to use. -@return Pointer to a fully constructed CCamera object. Ownership is passed - to the caller. - -@leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is - out of range. -*/ -void CWebCamera::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) - { - iObserver = &aObserver; - iCameraIndex = aCameraIndex; - } - -/** -from CCameraPlugin - -A call to one of the factory functions firstly loads the plugin, followed by a -call to this function to complete construction. - -Duplicates the original camera object for use by, for example, multimedia systems. - -May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid. - -@param aObserver - Reference to an observer. -@param aCameraHandle Handle of an existing camera object. - -@return Duplicate of the original camera object. -*/ -void CWebCamera::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) - { - iObserver = &aObserver; - iCameraHandle = aCameraHandle; - } - - /** -from CCameraPlugin - - A call to one of the factory functions firstly loads the plugin, followed by a -call to this function to complete construction. - -Creates an object representing a camera. - -@param aObserver - Reference to class derived from MCameraObserver2 designed to receive - notification of asynchronous event completion. -@param aCameraIndex - Index from 0 to CamerasAvailable()-1 inclusive specifying the - camera device to use. -@param aPriority - Value from -100 to 100 indicating relative priority of client to - use camera. - -@return Pointer to a fully constructed CCamera object. Ownership is passed - to the caller. - -@leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is - out of range. -*/ -void CWebCamera::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) - { - iObserver2 = &aObserver; - iCameraIndex = aCameraIndex; - iPriority = aPriority; - } - -/** -from CCameraPlugin - -Duplicates the original camera object for use by, for example, multimedia systems. - -@leave KErrNoMemory if out of memory. -@leave KErrNotFound if aCameraHandle is not valid. -@leave KErrPermissionDenied if the application does not have - the UserEnvironment capability. - -@param aObserver - Reference to an observer. -@param aCameraHandle Handle of an existing camera object. - -@return Duplicate of the original camera object. - -@capability UserEnvironment - An application that creates a CCamera object must have - the UserEnvironment capability. - -@note Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). - To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare - themselves to receive unrecognised values. -*/ -void CWebCamera::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) - { - iObserver2 = &aObserver; - iCameraHandle = aCameraHandle; - } - -// -// virtual functions -// - -/** -from CCamera - -Gets information about the camera device. - -@param aInfo - On return, information about the camera device. See TCameraInfo. -*/ -void CWebCamera::CameraInfo(TCameraInfo& aInfo) const - { - aInfo = iInfo; - } - -/** -from CCamera - -Asynchronous function that performs any required initialisation and reserves -the camera for exclusive use. - -Calls MCameraObserver:: ReserveComplete() when complete. -*/ -void CWebCamera::Reserve() - { - iActive->Reserve(); - } - -/** -from CCamera - -De-initialises the camera, allowing it to be used by other clients. -*/ -void CWebCamera::Release() - { - StopViewFinder(); - iReserved = EFalse; - } - -/** -from CCamera - -Asynchronous method to switch on camera power. - -User must have successfully called Reserve() prior to calling this function. - -Calls MCameraObserver::PowerOnComplete() when power on is complete. -*/ -void CWebCamera::PowerOn() - { - iActive->PowerOn(); - } - -/** -from CCamera - -Synchronous function for switching off camera power. -*/ -void CWebCamera::PowerOff() - { - StopViewFinder(); - iPowerOn = EFalse; - } - -/** -from CCamera - -Gets the device-unique handle of this camera object. - -@return The device-unique handle of this camera object. -*/ -TInt CWebCamera::Handle() - { - return 0; - } - -/** -from CCamera - -Sets the zoom factor. - -This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom -inclusive. May leave with KErrNotSupported if the specified zoom factor is -out of range. - -@param aZoomFactor - Required zoom factor. -*/ -void CWebCamera::SetZoomFactorL(TInt /*aZoomFactor = 0*/) - { - } - -/** -from CCamera - -Gets the currently set zoom factor. - -@return The currently set zoom factor. -*/ -TInt CWebCamera::ZoomFactor() const - { - return 0; - } - -/** -from CCamera - -Sets the digital zoom factor. - -This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive. - -May leave with KErrNotSupported if the zoom factor is out of range. - -@param aDigitalZoomFactor - The required digital zoom factor. -*/ -void CWebCamera::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/) - { - } - -/** -from CCamera - -Gets the currently set digital zoom factor. - -@return The currently set digital zoom factor. -*/ -TInt CWebCamera::DigitalZoomFactor() const - { - return 0; - } - -/** -from CCamera - -Sets the contrast adjustment of the device. - -This must be in the range of -100 to +100 or EContrastAuto. May leave with -KErrNotSupported if the specified contrast value is out of range. - -@param aContrast - Required contrast value. See TCameraInfo::iContrastSupported -*/ -void CWebCamera::SetContrastL(TInt /*aContrast*/) - { - } - -/** -from CCamera - -Gets the currently set contrast value. - -@return The currently set contrast value. -*/ -TInt CWebCamera::Contrast() const - { - return 0; - } - -/** -from CCamera - -Sets the brightness adjustment of the device. - -No effect if this is not supported, see TCameraInfo::iBrightnessSupported. - -This must be in the range of -100 to +100 or EBrightnessAuto. May leave -with KErrNotSupported if the brightness adjustment is out of range. - -@param aBrightness - The required brightness adjustment. -*/ -void CWebCamera::SetBrightnessL(TInt /*aBrightness*/) - { - } - -/** -from CCamera - -Gets the currently set brightness adjustment value. - -@return The currently set brightness adjustment value. -*/ -TInt CWebCamera::Brightness() const - { - return 0; - } - -/** -from CCamera - -Sets the flash mode. - -No effect if this is not supported, see TCameraInfo::iFlashModesSupported. - -May leave with KErrNotSupported if the specified flash mode is invalid. - -@param aFlash - The required flash mode. -*/ -void CWebCamera::SetFlashL(TFlash /*aFlash = EFlashNone*/) - { - } - -/** -from CCamera - -Gets the currently set flash mode. - -@return The currently set flash mode. -@note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that -application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) -(set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. -To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() -to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. -In this case, application is assumed to be prepared to receive unrecognised enum values. - -@see CCamera::CCameraAdvancedSettings::FlashMode() -*/ -CCamera::TFlash CWebCamera::Flash() const - { - return EFlashNone; - } - -/** -from CCamera - -Sets the exposure adjustment of the device. - -No effect if this is not supported, see CameraInfo::iExposureModesSupported. - -May leave with KErrNotSupported if the specified exposure adjustment is invalid. - -@param aExposure - The required exposure adjustment. -*/ -void CWebCamera::SetExposureL(TExposure /*aExposure = EExposureAuto*/) - { - } - -/** -from CCamera - -Gets the currently set exposure setting value. - -@return The currently set exposure setting value. -*/ -CCamera::TExposure CWebCamera::Exposure() const - { - return EExposureAuto; - } - -/** -from CCamera - -Sets the white balance adjustment of the device. - -No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported. - -@param aWhiteBalance - The required white balance adjustment. - -@leave KErrNotSupported if the specified white balance adjustment - is invalid. -*/ -void CWebCamera::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/) - { - } - -/** -from CCamera - -Gets the currently set white balance adjustment value. - -@return The currently set white balance adjustment value. - -@note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that -application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) -(set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. -To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() -to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. -In this case, application is assumed to be prepared to receive unrecognised enum values. -Refer CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation - -@see CCamera::CCameraAdvancedSettings::WhiteBalanceMode() -*/ -CCamera::TWhiteBalance CWebCamera::WhiteBalance() const - { - return EWBAuto; - } - -/** -from CCamera - -Starts transfer of view finder data to the given portion of the screen using -direct screen access. - -The aScreenRect parameter is in screen co-ordinates and may be modified if, -eg, the camera requires the destination to have a certain byte alignment, etc. - -@param aWs - Window server session. -@param aScreenDevice - Screen device. -@param aWindow - Displayable window. -@param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. - -@leave KErrNotReady if PowerOn() has either not - been called, or has not yet completed. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraV2DirectViewFinder -*/ -void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect) - { - RDebug::Print(_L("CWebCamera::StartViewFinderDirectL")); - TRect emptyRect; - StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, emptyRect); - } - -/** -from CCamera - -Starts transfer of view finder data to the given portion of the screen using -direct screen access and also clips to the specified portion of the screen. - -The view finder has the same size and position as aScreenRect but is only -visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported -or KErrNotReady if Reserve() has not been called, or has not yet completed. - -@param aWs - Window server session. -@param aScreenDevice - Screen device. -@param aWindow - Displayable window. -@param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. -@param aClipRect - The rectangle to which the screen will be clipped. - -@leave KErrNotReady if PowerOn() hasn't been called successfully. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect) - { - RDebug::Print(_L("CWebCamera::StartViewFinderDirectL'")); - iVfActive->StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect); - } - -/** -from CCamera - -Starts transfer of view finder data. - -Bitmaps are returned by MCameraObserver::ViewFinderFrameReady(). - -@param aSize - On return, the size used. -@leave KErrNotReady if PowerOn() has not been called, or has not yet completed. - -@note This method is assumed to be meant for default display only. - -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/) - { - } - -/** -from CCamera - -Starts transfer of view finder data and clips the bitmap to the specified clip -rectangle. - -The bitmap is the size of the intersection of aSize and aClipRect, not simply -aSize padded with white space. - -@param aSize - On return, the size used. -@param aClipRect - Required clip rectangle. May be modified if, for example, - the camera only supports certain byte alignments. - -@leave KErrInUse if Reserve() hasn't been called successfully. -@leave KErrNotReady if PowerOn() hasn't been called successfully. - -@note This method is assumed to be meant for default display only. - -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/) - { - } - -/** -from CCamera - -Starts transfer of view finder data. - -Picture data is returned by MCameraObserver2::ViewFinderReady(). - -@param aImageFormat - The image format requested by the client. -@param aSize - On return, the size used. -@leave KErrNotSupported -@leave KErrNotReady if Reserve() has not been - called, or has not yet completed. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/) - { - } - -/** -from CCamera - -Starts transfer of view finder data and clips the picture to the specified clip -rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady(). - -The picture is the size of the intersection of aSize and aClipRect, not simply -aSize padded with white space. - -@param aImageFormat - The image format. -@param aSize - On return, the size used. -@param aClipRect - Required clip rectangle. May be modified if, for example, - the camera only supports certain byte alignments. - -@leave KErrInUse if Reserve() hasn't been called successfully, -@leave KErrNotReady if PowerOn() hasn't been called successfully. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/) - { - } - -/** -Stops transfer of view finder data to the screen. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraV2DirectViewFinder -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::StopViewFinder() - { - iVfActive->StopViewFinder(); - } - -/** -from CCamera - -Queries whether the view finder is active. - -@return ETrue if the view finder is active. EFalse if the view finder is not - active. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraV2DirectViewFinder -@see CCamera::CCameraClientViewFinder -*/ -TBool CWebCamera::ViewFinderActive() const - { - return iVfActive->ViewFinderActive(); - } - -/** -from CCamera - -Sets whether view finder mirroring is on. - -Used to switch between what the camera sees and what you would see if the -device were a mirror. - -@param aMirror - ETrue to set mirroring on, EFalse to set mirroring off. - -@leave KErrNotSupported. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraV2DirectViewFinder -@see CCamera::CCameraClientViewFinder -*/ -void CWebCamera::SetViewFinderMirrorL(TBool /*aMirror*/) - { - } - -/** -from CCamera - -Gets whether view finder mirroring is active. - -@return ETrue if mirroring is set, EFalse if mirroring is not set. - -@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - -@see CCamera::CCameraV2DirectViewFinder -@see CCamera::CCameraClientViewFinder -*/ -TBool CWebCamera::ViewFinderMirror() const - { - return EFalse; - } - -/** -from CCamera - -Performs setup and allocation of memory. - -Called prior to calling CaptureImage() to keep the latency of that function -to a minimum. - -Needs to be called only once for multiple CaptureImage() calls. May leave -with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady. - -The specified image format must be one of the formats supported -(see TCameraInfo::iImageFormatsSupported). - -The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 -inclusive. - -@param aImageFormat - The image format. -@param aSizeIndex - Size index. - -@leave KErrNotSupported -@leave KErrNoMemory -@leave KErrNotReady if PowerOn() hasn't been called successfully. - -@see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) -*/ -void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/) - { - } - -/** -from CCamera - -Performs setup and allocation of memory and clips the image to the specified -rectangle. - -No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The -image captured is the intersection of aClipRect and the rectangle from (0,0) -to aSize. Needs to be called only once for multiple CaptureImage() calls. -May leave with KErrNotSupported or KErrNoMemory. - -The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported). - -The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 -inclusive. - -@param aImageFormat - The image format. -@param aSizeIndex - Size index. -@param aClipRect - The rectangle to which the image is to be clipped. - -@leave KErrNotSupported -@leave KErrNoMemory -@leave KErrInUse if Reserve() hasn't been called successfully -@leave KErrNotReady if PowerOn() - hasn't been called successfully. - -@see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) -*/ -void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) - { - } - -/** -from CCamera - -Asynchronously performs still image capture. - -Calls MCameraObserver::ImageReady() when complete. - -@see CCamera::CCameraImageCapture -@see CCamera::CCameraPreImageCaptureControl -*/ -void CWebCamera::CaptureImage() - { - delete iCaptureBuf; - iCaptureBuf = NULL; - - iCaptureBuf = HBufC8::NewL(KMaxBufSize); - iCaptureBufPtr.Set(iCaptureBuf->Des()); - iCaptureBufPtr.SetLength(0); - - iActive->ImageCapture(iCaptureBufPtr); - - iImageCaptureActive = ETrue; - } - -/** -from CCamera - -Cancels the asynchronous still image capture. - -@see CCamera::CCameraImageCapture -*/ -void CWebCamera::CancelCaptureImage() - { - iImageCaptureActive = EFalse; - } - -/** -from CCamera - -Enumerates through the available image capture sizes, based on the specified -size index and format - -The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 -inclusive. - -@param aSize - Image size. -@param aSizeIndex - Size index. -@param aFormat - The image format. -*/ -void CWebCamera::EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const - { - if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumImageSizesSupported || - !(aFormat & iInfo.iImageFormatsSupported) ) - { - aSize = TSize(0,0); - } - else - { - aSize = iImageSizes[aSizeIndex]; - } - } - -/** -from CCamera - -Prepares for video capture. - -Performs setup and allocation of memory prior to calling StartVideoCapture() -to keep the latency of that function to a minimum. - -May leave with KErrNotSupported or KErrNoMemory. - -@param aFormat - Format must be one of the video frame formats supported (see - TCameraInfo::iVideoFrameFormatsSupported). -@param aSizeIndex - Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive. -@param aRateIndex - The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. -@param aBuffersToUse - The number of discrete buffers to use. -@param aFramesPerBuffer - How large the buffers are to be. Must be less than - or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned - to MCameraObserver::FrameBufferReady() at a time. - -@leave May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() - hasn't been called successfully. - -@see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) -*/ -void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/) - { - } - -/** -from CCamera - -Prepares for video capture and clips the frames to the given rectangle. - -Performs setup and allocation of memory prior to calling StartVideoCapture() -to keep the latency of that function to a minimum. - -May leave with KErrNotSupported or KErrNoMemory. - -@param aFormat - Format must be one of the video frame formats supported (see - TCameraInfo::iVideoFrameFormatsSupported). -@param aSizeIndex - Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive. -@param aRateIndex - The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. -@param aBuffersToUse - The number of discrete buffers to use. -@param aFramesPerBuffer - How large the buffers are to be. Must be less than - or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned - to MCameraObserver::FrameBufferReady() at a time. -@param aClipRect - The rectangle to which the image is to be clipped. -@leave KErrNotSupported -@leave KErrNoMemory, -@leave KErrInUse if Reserve() hasn't been called successfully -@leave KErrNotReady if PowerOn() hasn't been called successfully. - -@see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) -*/ -void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) - { - } - -/** -from CCamera - -Starts capturing video. - -Calls MCameraObserver::FrameBufferReady() when each buffer has been filled -with the required number of frames, as set by PrepareVideoCaptureL(). -*/ -void CWebCamera::StartVideoCapture() - { - } - -/** -from CCamera - -Stops video capture. -*/ -void CWebCamera::StopVideoCapture() - { - } - -/** -from CCamera - -Tests whether video capture is active. - -@return ETrue if video capture is active. EFalse if video capture is not active -*/ -TBool CWebCamera::VideoCaptureActive() const - { - return EFalse; - } - -/** -from CCamera - -Enumerates through the available video frame sizes, based on the specified -size index and format. - -@param aSize - On return the available video frame sizes. Sizes should be returned - in order, largest first, so clients do not have to iterate through every one. -@param aSizeIndex - Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive -@param aFormat - Image format. -*/ -void CWebCamera::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const - { - } - -/** -from CCamera - -Enumerates through the available video frame rates, based on the specified -rate index, video frame format, size index and exposure mode. - -@param aRate - On return, the available video frame rates. Some rates may not - be available due to, for example, current flash mode setting. In those cases - a rate of 0 will be returned. Rates should be returned in order, highest first, - so clients do not have to iterate through every one. -@param aRateIndex - The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. -@param aFormat - The format. -@param aSizeIndex - The size index. -@param aExposure - The exposure mode. -*/ -void CWebCamera::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const - { - } - -/** -from CCamera - -Gets the frame size currently in use. - -@param aSize - The frame size currently in use. -*/ -void CWebCamera::GetFrameSize(TSize& /*aSize*/) const - { - } - -/** -from CCamera - -Gets the frame rate currently in use. - -@return The frame rate currently in use. -*/ -TReal32 CWebCamera::FrameRate() const - { - return 0.0; - } - -/** -from CCamera - -Gets the number of buffers currently in use. - -@return The number of buffers currently in use. -*/ -TInt CWebCamera::BuffersInUse() const - { - return 0; - } - -/** -from CCamera - -Gets the number of frames per buffer currently in use. - -@return The number of frames per buffer currently in use. -*/ -TInt CWebCamera::FramesPerBuffer() const - { - return 0; - } - -/** -from CCamera - -Sets the quality value to use if jpeg is a supported image for video format. - -Ignored if jpeg is not a supported image for video format. - -@param aQuality - The quality value to use, clamped to the range 1 to 100. - -@see CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize -*/ -void CWebCamera::SetJpegQuality(TInt /*aQuality*/) - { - } - -/** -from CCamera - -Gets the currently set jpeg quality value. - -Returns 0 if not supported. - -@return The currently set jpeg quality value. - -@see CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize) -*/ -TInt CWebCamera::JpegQuality() const - { - return 0; - } - -/** -from CCamera - -Gets a custom interface. The client has to cast the returned pointer -to the appropriate type. - -@param aInterface - The Uid of the particular interface function required. - -@return Custom interface pointer. NULL if the requested interface is not supported. -*/ -TAny* CWebCamera::CustomInterface(TUid aInterface) - { - switch(aInterface.iUid) - { - // advanced settings interface pointers - case KECamMCameraAdvancedSettingsUidValue: - iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); - return static_cast(iAdvSettingsImpl); - - case KECamMCameraAdvancedSettings2UidValue: - iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); - return static_cast(iAdvSettingsImpl); - - case KECamMCameraAdvancedSettings3UidValue: - iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); - return static_cast(iAdvSettingsImpl); - - default: - return NULL; - } - } - -/** -from MWebCameraActiveCallBack - -CallBack function of the Reserve -*/ -void CWebCamera::ReserveCallBack(TInt aError) - { - RDebug::Print(_L("CWebCamera::ReserveCallBack")); - - if (iObserver) - { - iObserver->ReserveComplete(aError); - } - else if (iObserver2) - { - const TECAMEvent wEvent(KUidECamEventReserveComplete, aError); - iObserver2->HandleEvent(wEvent); - } - } - -/** -from MWebCameraActiveCallBack - -CallBack function of the PowerOn -*/ -void CWebCamera::PowerOnCallBack(TInt aError) - { - RDebug::Print(_L("CWebCamera::PowerOnCallBack")); - - if (iObserver) - { - iObserver->PowerOnComplete(aError); - } - else if (iObserver2) - { - const TECAMEvent wEvent(KUidECamEventPowerOnComplete, aError); - iObserver2->HandleEvent(wEvent); - } - } - -/** -from MWebCameraActiveCallBack - -CallBack function of the ImageCapture -*/ -void CWebCamera::ImageCaptureCallBackL(TInt aError) - { - RDebug::Print(_L("CWebCamera::ImageCaptureCallBack_S")); - - iImageCaptureActive = EFalse; - - iCaptureBitmap = NULL; - CFbsBitmap* image = new (ELeave) CFbsBitmap(); - CleanupStack::PushL(image); - User::LeaveIfError(image->Create(TSize(KCaptureWidth, KCaptureHeight), EColor16M)); - CleanupStack::Pop(image); - iCaptureBitmap = image; - -//////////////////////////////////////////////////////////////////////////////////////// -// output receive data log -// RDebug::Print(_L("CWebCameraVfActive::ImageCaptureCallBack iCaptureBufPtr[%d]"), iCaptureBufPtr.Length()); -// TBuf<256> hexBuf; -// for (TInt i = 0; i < iCaptureBufPtr.Length(); i++) -// { -// hexBuf.AppendFormat(_L("%02X "), iCaptureBufPtr[i]); -// if ((i % 16) == 15) -// { -// RDebug::Print(hexBuf); -// hexBuf = KNullDesC; -// } -// } -// RDebug::Print(hexBuf); -//////////////////////////////////////////////////////////////////////////////////////// - - RDebug::Print(_L("CWebCamera::ImageCaptureCallBack start setscanline_S")); - for (TInt height=0; heightMid(pos, KCaptureLineBytes); - TBuf8 buf; - buf.Copy(posptr); - iCaptureBitmap->SetScanLine(buf, ((KCaptureHeight-1)-height)); - } - RDebug::Print(_L("CWebCamera::ImageCaptureCallBack start setscanline_E")); - - if (iObserver) - { - iObserver->ImageReady(iCaptureBitmap, iCaptureBuf, aError); - } - else if (iObserver2) - { - iObserver2->ImageBufferReady(*iCaptureCameraBuf, aError); - } - - RDebug::Print(_L("CWebCamera::ImageCaptureCallBack_E")); - } - -//from MWebCameraVfActiveCallBack -void CWebCamera::ViewFinderCallBack(TInt /*aError*/) - { - RDebug::Print(_L("CWebCamera::ViewFinderCallBack")); - } - - -// -// CWebCameraInfo class -// - -CWebCameraInfo::CWebCameraInfo() - { - } - -CWebCameraInfo::~CWebCameraInfo() - { - } - -CWebCameraInfo* CWebCameraInfo::NewL() - { - return new (ELeave) CWebCameraInfo; - } - -/** -from CCameraInfoPlugin - -Determines the number of cameras on the device. - -@return Count of cameras present on the device. -*/ -TInt CWebCameraInfo::CamerasAvailable() - { - return 1; - } - - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraPlugin, CWebCamera::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraInfo, CWebCameraInfo::NewL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include "ecamwebcameraplugin.h" +#include "ecamwebcamerapluginuids.hrh" +#include "ecamwebcamerabuffer.h" +#include "ecamwebcameraadvset.h" +#include "ecamwebcameraactive.h" +#include "ecamwebcameravfactive.h" + + +_LIT(KCameraDriverPddName, "webcamera.pdd"); +_LIT(KCameraDriverLddName, "ewebcamera.ldd"); + +const TInt KCaptureWidth = 640; // Capture image width +const TInt KCaptureHeight = 480; // Capture image height + +const TInt KCaptureLineBytes = KCaptureWidth * 3; // bytes of one line + +// +// CWebCamera class +// + +CWebCamera::CWebCamera(): + iCaptureBufPtr(NULL, 0) + { + + iInfo.iHardwareVersion.iMajor = 0; + iInfo.iHardwareVersion.iMinor = 0; + iInfo.iHardwareVersion.iBuild = 0; + iInfo.iSoftwareVersion.iMajor = 0; + iInfo.iSoftwareVersion.iMinor = 0; + iInfo.iSoftwareVersion.iBuild = 0; + iInfo.iOrientation = TCameraInfo::EOrientationOutwards; + + iInfo.iOptionsSupported = 0; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderDirectSupported; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderBitmapsSupported; + iInfo.iOptionsSupported |= TCameraInfo::EImageCaptureSupported; + iInfo.iOptionsSupported |= TCameraInfo::EVideoCaptureSupported; + iInfo.iOptionsSupported |= TCameraInfo::EContrastSupported; + iInfo.iOptionsSupported |= TCameraInfo::EBrightnessSupported; + iInfo.iOptionsSupported |= TCameraInfo::EViewFinderClippingSupported; + + iInfo.iFlashModesSupported = 0; // Bitfield of TFlash values + iInfo.iExposureModesSupported = 0; // Bitfield of TExposure values + iInfo.iWhiteBalanceModesSupported = 0; // Bitfield of TWhiteBalance values + + iInfo.iMinZoom = KMinTestCameraZoom; + // KMinTestCameraZoom is zero or negative + // note the algorithm for creating of zoom factor + iInfo.iMinZoomFactor = TReal32(1)/TReal32(1 << -KMinTestCameraZoom); + iInfo.iMaxZoom = KMaxTestCameraZoom; + iInfo.iMaxZoomFactor = 1 << KMaxTestCameraZoom; + + iInfo.iMaxDigitalZoom = KMaxTestCameraDigitalZoom; + iInfo.iMaxDigitalZoomFactor = KMaxTestCameraDigitalZoomFactor; + + iInfo.iImageFormatsSupported = 0; + iInfo.iImageFormatsSupported |= EFormatExif; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor4K; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor64K; + iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor16M; + + iInfo.iVideoFrameFormatsSupported = 0; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor4K; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor64K; + iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor16M; + iInfo.iMaxFramesPerBufferSupported = 1; + iInfo.iMaxBuffersSupported = 2; + } + +CWebCamera::~CWebCamera() + { + delete iCaptureBuf; + delete iAdvSettingsImpl; + delete iVfActive; + delete iActive; + delete iCaptureBitmap; + iChunk.Close(); + iImageSizes.Close(); + iDriver.Close(); + } + +CWebCamera* CWebCamera::NewL() + { + CWebCamera* self = new(ELeave) CWebCamera; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +void CWebCamera::ConstructL() + { + // Open drivers. + TInt err; + + err = User::LoadPhysicalDevice(KCameraDriverPddName); + + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + + err = User::LoadLogicalDevice(KCameraDriverLddName); + + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + + iDriver.Open(); + + iActive = CWebCameraActive::NewL(this, iDriver); + iVfActive = CWebCameraVfActive::NewL(this, iDriver); + + User::LeaveIfError(iImageSizes.Append(TSize(640, 480))); // VGA + User::LeaveIfError(iImageSizes.Append(TSize(160, 120))); // QQVGA + iInfo.iNumImageSizesSupported = iImageSizes.Count(); + + // Open chunk + err = iDriver.OpenSharedChunks(iChunk, iChunkInfo); + if (err != KErrNone) + { + User::Leave(err); + } + iChuckBase=iChunk.Base(); + } + +/** +from CCameraPlugin + +A call to one of the factory functions firstly loads the plugin, followed by a +call to this function to complete construction. + +Creates an object representing a camera. + +@param aObserver + Reference to class derived from MCameraObserver2 designed to receive + notification of asynchronous event completion. +@param aCameraIndex + Index from 0 to CamerasAvailable()-1 inclusive specifying the + camera device to use. +@return Pointer to a fully constructed CCamera object. Ownership is passed + to the caller. + +@leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is + out of range. +*/ +void CWebCamera::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) + { + iObserver = &aObserver; + iCameraIndex = aCameraIndex; + } + +/** +from CCameraPlugin + +A call to one of the factory functions firstly loads the plugin, followed by a +call to this function to complete construction. + +Duplicates the original camera object for use by, for example, multimedia systems. + +May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid. + +@param aObserver Reference to an observer. +@param aCameraHandle Handle of an existing camera object. +@return Duplicate of the original camera object. +*/ +void CWebCamera::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) + { + iObserver = &aObserver; + iCameraHandle = aCameraHandle; + } + + /** +from CCameraPlugin + + A call to one of the factory functions firstly loads the plugin, followed by a +call to this function to complete construction. + +Creates an object representing a camera. + +@param aObserver + Reference to class derived from MCameraObserver2 designed to receive + notification of asynchronous event completion. +@param aCameraIndex + Index from 0 to CamerasAvailable()-1 inclusive specifying the + camera device to use. +@param aPriority + Value from -100 to 100 indicating relative priority of client to + use camera. +@return Pointer to a fully constructed CCamera object. Ownership is passed + to the caller. +@leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is + out of range. +*/ +void CWebCamera::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) + { + iObserver2 = &aObserver; + iCameraIndex = aCameraIndex; + iPriority = aPriority; + } + +/** +from CCameraPlugin + +Duplicates the original camera object for use by, for example, multimedia systems. + +@leave KErrNoMemory if out of memory. +@leave KErrNotFound if aCameraHandle is not valid. +@leave KErrPermissionDenied if the application does not have + the UserEnvironment capability. + +@param aObserver + Reference to an observer. +@param aCameraHandle Handle of an existing camera object. + +@return Duplicate of the original camera object. + +@capability UserEnvironment + An application that creates a CCamera object must have + the UserEnvironment capability. + +@note Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). + To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare + themselves to receive unrecognised values. +*/ +void CWebCamera::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) + { + iObserver2 = &aObserver; + iCameraHandle = aCameraHandle; + } + +// +// virtual functions +// + +/** +from CCamera Gets information about the camera device. +@param aInfo On return, information about the camera device. See TCameraInfo. +*/ +void CWebCamera::CameraInfo(TCameraInfo& aInfo) const + { + aInfo = iInfo; + } + +/** +from CCamera + +Asynchronous function that performs any required initialisation and reserves +the camera for exclusive use. + +Calls MCameraObserver:: ReserveComplete() when complete. +*/ +void CWebCamera::Reserve() + { + iActive->Reserve(); + } + +/** +from CCamera + +De-initialises the camera, allowing it to be used by other clients. +*/ +void CWebCamera::Release() + { + StopViewFinder(); + iReserved = EFalse; + } + +/** +from CCamera +Asynchronous method to switch on camera power. +User must have successfully called Reserve() prior to calling this function. +Calls MCameraObserver::PowerOnComplete() when power on is complete. +*/ +void CWebCamera::PowerOn() + { + iActive->PowerOn(); + } + +/** +from CCamera + +Synchronous function for switching off camera power. +*/ +void CWebCamera::PowerOff() + { + StopViewFinder(); + iPowerOn = EFalse; + } + +/** +from CCamera + +Gets the device-unique handle of this camera object. + +@return The device-unique handle of this camera object. +*/ +TInt CWebCamera::Handle() + { + return 0; + } + +/** +from CCamera + +Sets the zoom factor. + +This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom +inclusive. May leave with KErrNotSupported if the specified zoom factor is +out of range. + +@param aZoomFactor + Required zoom factor. +*/ +void CWebCamera::SetZoomFactorL(TInt /*aZoomFactor = 0*/) + { + } + +/** +from CCamera + +Gets the currently set zoom factor. + +@return The currently set zoom factor. +*/ +TInt CWebCamera::ZoomFactor() const + { + return 0; + } + +/** +from CCamera + +Sets the digital zoom factor. + +This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive. + +May leave with KErrNotSupported if the zoom factor is out of range. +@param aDigitalZoomFactor + The required digital zoom factor. +*/ +void CWebCamera::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/) + { + } + +/** +from CCamera + +Gets the currently set digital zoom factor. + +@return The currently set digital zoom factor. +*/ +TInt CWebCamera::DigitalZoomFactor() const + { + return 0; + } + +/** +from CCamera + +Sets the contrast adjustment of the device. + +This must be in the range of -100 to +100 or EContrastAuto. May leave with +KErrNotSupported if the specified contrast value is out of range. + +@param aContrast + Required contrast value. See TCameraInfo::iContrastSupported +*/ +void CWebCamera::SetContrastL(TInt /*aContrast*/) + { + } + +/** +from CCamera + +Gets the currently set contrast value. + +@return The currently set contrast value. +*/ +TInt CWebCamera::Contrast() const + { + return 0; + } + +/** +from CCamera + +Sets the brightness adjustment of the device. + +No effect if this is not supported, see TCameraInfo::iBrightnessSupported. + +This must be in the range of -100 to +100 or EBrightnessAuto. May leave +with KErrNotSupported if the brightness adjustment is out of range. + +@param aBrightness + The required brightness adjustment. +*/ +void CWebCamera::SetBrightnessL(TInt /*aBrightness*/) + { + } + +/** +from CCamera + +Gets the currently set brightness adjustment value. + +@return The currently set brightness adjustment value. +*/ +TInt CWebCamera::Brightness() const + { + return 0; + } + +/** +from CCamera + +Sets the flash mode. +No effect if this is not supported, see TCameraInfo::iFlashModesSupported. +May leave with KErrNotSupported if the specified flash mode is invalid. +@param aFlash + The required flash mode. +*/ +void CWebCamera::SetFlashL(TFlash /*aFlash = EFlashNone*/) + { + } + +/** +from CCamera + +Gets the currently set flash mode. +@return The currently set flash mode. +@note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that +application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) +(set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. +To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() +to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. +In this case, application is assumed to be prepared to receive unrecognised enum values. + +@see CCamera::CCameraAdvancedSettings::FlashMode() +*/ +CCamera::TFlash CWebCamera::Flash() const + { + return EFlashNone; + } + +/** +from CCamera + +Sets the exposure adjustment of the device. + +No effect if this is not supported, see CameraInfo::iExposureModesSupported. + +May leave with KErrNotSupported if the specified exposure adjustment is invalid. + +@param aExposure + The required exposure adjustment. +*/ +void CWebCamera::SetExposureL(TExposure /*aExposure = EExposureAuto*/) + { + } + +/** +from CCamera + +Gets the currently set exposure setting value. + +@return The currently set exposure setting value. +*/ +CCamera::TExposure CWebCamera::Exposure() const + { + return EExposureAuto; + } + +/** +from CCamera + +Sets the white balance adjustment of the device. + +No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported. + +@param aWhiteBalance + The required white balance adjustment. + +@leave KErrNotSupported if the specified white balance adjustment + is invalid. +*/ +void CWebCamera::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/) + { + } + +/** +from CCamera + +Gets the currently set white balance adjustment value. + +@return The currently set white balance adjustment value. + +@note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that +application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) +(set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. +To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() +to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. +In this case, application is assumed to be prepared to receive unrecognised enum values. +Refer CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation + +@see CCamera::CCameraAdvancedSettings::WhiteBalanceMode() +*/ +CCamera::TWhiteBalance CWebCamera::WhiteBalance() const + { + return EWBAuto; + } + +/** +from CCamera + +Starts transfer of view finder data to the given portion of the screen using +direct screen access. + +The aScreenRect parameter is in screen co-ordinates and may be modified if, +eg, the camera requires the destination to have a certain byte alignment, etc. + +@param aWs + Window server session. +@param aScreenDevice + Screen device. +@param aWindow + Displayable window. +@param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. + +@leave KErrNotReady if PowerOn() has either not + been called, or has not yet completed. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraV2DirectViewFinder +*/ +void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect) + { + TRect emptyRect; + StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, emptyRect); + } + +/** +from CCamera + +Starts transfer of view finder data to the given portion of the screen using +direct screen access and also clips to the specified portion of the screen. + +The view finder has the same size and position as aScreenRect but is only +visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported +or KErrNotReady if Reserve() has not been called, or has not yet completed. + +@param aWs + Window server session. +@param aScreenDevice + Screen device. +@param aWindow + Displayable window. +@param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. +@param aClipRect + The rectangle to which the screen will be clipped. + +@leave KErrNotReady if PowerOn() hasn't been called successfully. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect) + { + iVfActive->StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect, iChuckBase, iChunkRemSize); + } + +/** +from CCamera + +Starts transfer of view finder data. + +Bitmaps are returned by MCameraObserver::ViewFinderFrameReady(). + +@param aSize + On return, the size used. +@leave KErrNotReady if PowerOn() has not been called, or has not yet completed. + +@note This method is assumed to be meant for default display only. + +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/) + { + } + +/** +from CCamera + +Starts transfer of view finder data and clips the bitmap to the specified clip +rectangle. + +The bitmap is the size of the intersection of aSize and aClipRect, not simply +aSize padded with white space. + +@param aSize + On return, the size used. +@param aClipRect + Required clip rectangle. May be modified if, for example, + the camera only supports certain byte alignments. + +@leave KErrInUse if Reserve() hasn't been called successfully. +@leave KErrNotReady if PowerOn() hasn't been called successfully. + +@note This method is assumed to be meant for default display only. + +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/) + { + } + +/** +from CCamera + +Starts transfer of view finder data. + +Picture data is returned by MCameraObserver2::ViewFinderReady(). + +@param aImageFormat + The image format requested by the client. +@param aSize + On return, the size used. +@leave KErrNotSupported +@leave KErrNotReady if Reserve() has not been + called, or has not yet completed. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/) + { + } + +/** +from CCamera + +Starts transfer of view finder data and clips the picture to the specified clip +rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady(). + +The picture is the size of the intersection of aSize and aClipRect, not simply +aSize padded with white space. + +@param aImageFormat + The image format. +@param aSize + On return, the size used. +@param aClipRect + Required clip rectangle. May be modified if, for example, + the camera only supports certain byte alignments. + +@leave KErrInUse if Reserve() hasn't been called successfully, +@leave KErrNotReady if PowerOn() hasn't been called successfully. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/) + { + } + +/** +Stops transfer of view finder data to the screen. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraV2DirectViewFinder +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::StopViewFinder() + { + iVfActive->StopViewFinder(); + } + +/** +from CCamera + +Queries whether the view finder is active. + +@return ETrue if the view finder is active. EFalse if the view finder is not + active. +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. +@see CCamera::CCameraV2DirectViewFinder +@see CCamera::CCameraClientViewFinder +*/ +TBool CWebCamera::ViewFinderActive() const + { + return iVfActive->ViewFinderActive(); + } + +/** +from CCamera + +Sets whether view finder mirroring is on. + +Used to switch between what the camera sees and what you would see if the +device were a mirror. + +@param aMirror + ETrue to set mirroring on, EFalse to set mirroring off. +@leave KErrNotSupported. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraV2DirectViewFinder +@see CCamera::CCameraClientViewFinder +*/ +void CWebCamera::SetViewFinderMirrorL(TBool /*aMirror*/) + { + } + +/** +from CCamera + +Gets whether view finder mirroring is active. + +@return ETrue if mirroring is set, EFalse if mirroring is not set. + +@note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + +@see CCamera::CCameraV2DirectViewFinder +@see CCamera::CCameraClientViewFinder +*/ +TBool CWebCamera::ViewFinderMirror() const + { + return EFalse; + } + +/** +from CCamera + +Performs setup and allocation of memory. + +Called prior to calling CaptureImage() to keep the latency of that function +to a minimum. + +Needs to be called only once for multiple CaptureImage() calls. May leave +with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady. + +The specified image format must be one of the formats supported +(see TCameraInfo::iImageFormatsSupported). + +The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 +inclusive. + +@param aImageFormat + The image format. +@param aSizeIndex + Size index. + +@leave KErrNotSupported +@leave KErrNoMemory +@leave KErrNotReady if PowerOn() hasn't been called successfully. + +@see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) +*/ +void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/) + { + } + +/** +from CCamera + +Performs setup and allocation of memory and clips the image to the specified +rectangle. + +No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The +image captured is the intersection of aClipRect and the rectangle from (0,0) +to aSize. Needs to be called only once for multiple CaptureImage() calls. +May leave with KErrNotSupported or KErrNoMemory. + +The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported). + +The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 +inclusive. + +@param aImageFormat + The image format. +@param aSizeIndex + Size index. +@param aClipRect + The rectangle to which the image is to be clipped. + +@leave KErrNotSupported +@leave KErrNoMemory +@leave KErrInUse if Reserve() hasn't been called successfully +@leave KErrNotReady if PowerOn() + hasn't been called successfully. + +@see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) +*/ +void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) + { + } + +/** +from CCamera + +Asynchronously performs still image capture. + +Calls MCameraObserver::ImageReady() when complete. + +@see CCamera::CCameraImageCapture +@see CCamera::CCameraPreImageCaptureControl +*/ +void CWebCamera::CaptureImage() + { + delete iCaptureBuf; + iCaptureBuf = NULL; + + iCaptureBuf = HBufC8::NewL(KMaxBufSize); + iCaptureBufPtr.Set(iCaptureBuf->Des()); + iCaptureBufPtr.SetLength(0); + + iActive->ImageCapture(iChunkRemSize); + + iImageCaptureActive = ETrue; + } + +/** +from CCamera + +Cancels the asynchronous still image capture. + +@see CCamera::CCameraImageCapture +*/ +void CWebCamera::CancelCaptureImage() + { + iImageCaptureActive = EFalse; + } + +/** +from CCamera + +Enumerates through the available image capture sizes, based on the specified +size index and format + +The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 +inclusive. + +@param aSize + Image size. +@param aSizeIndex + Size index. +@param aFormat + The image format. +*/ +void CWebCamera::EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const + { + if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumImageSizesSupported || + !(aFormat & iInfo.iImageFormatsSupported) ) + { + aSize = TSize(0,0); + } + else + { + aSize = iImageSizes[aSizeIndex]; + } + } + +/** +from CCamera + +Prepares for video capture. + +Performs setup and allocation of memory prior to calling StartVideoCapture() +to keep the latency of that function to a minimum. + +May leave with KErrNotSupported or KErrNoMemory. + +@param aFormat + Format must be one of the video frame formats supported (see + TCameraInfo::iVideoFrameFormatsSupported). +@param aSizeIndex + Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive. +@param aRateIndex + The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. +@param aBuffersToUse + The number of discrete buffers to use. +@param aFramesPerBuffer + How large the buffers are to be. Must be less than + or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned + to MCameraObserver::FrameBufferReady() at a time. + +@leave May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() + hasn't been called successfully. + +@see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) +*/ +void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/) + { + } + +/** +from CCamera + +Prepares for video capture and clips the frames to the given rectangle. + +Performs setup and allocation of memory prior to calling StartVideoCapture() +to keep the latency of that function to a minimum. + +May leave with KErrNotSupported or KErrNoMemory. + +@param aFormat + Format must be one of the video frame formats supported (see + TCameraInfo::iVideoFrameFormatsSupported). +@param aSizeIndex + Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive. +@param aRateIndex + The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. +@param aBuffersToUse + The number of discrete buffers to use. +@param aFramesPerBuffer + How large the buffers are to be. Must be less than + or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned + to MCameraObserver::FrameBufferReady() at a time. +@param aClipRect + The rectangle to which the image is to be clipped. +@leave KErrNotSupported +@leave KErrNoMemory, +@leave KErrInUse if Reserve() hasn't been called successfully +@leave KErrNotReady if PowerOn() hasn't been called successfully. + +@see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) +*/ +void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) + { + } + +/** +from CCamera + +Starts capturing video. + +Calls MCameraObserver::FrameBufferReady() when each buffer has been filled +with the required number of frames, as set by PrepareVideoCaptureL(). +*/ +void CWebCamera::StartVideoCapture() + { + } + +/** +from CCamera + +Stops video capture. +*/ +void CWebCamera::StopVideoCapture() + { + } + +/** +from CCamera + +Tests whether video capture is active. + +@return ETrue if video capture is active. EFalse if video capture is not active +*/ +TBool CWebCamera::VideoCaptureActive() const + { + return EFalse; + } + +/** +from CCamera + +Enumerates through the available video frame sizes, based on the specified +size index and format. + +@param aSize + On return the available video frame sizes. Sizes should be returned + in order, largest first, so clients do not have to iterate through every one. +@param aSizeIndex + Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive +@param aFormat + Image format. +*/ +void CWebCamera::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const + { + } + +/** +from CCamera + +Enumerates through the available video frame rates, based on the specified +rate index, video frame format, size index and exposure mode. + +@param aRate + On return, the available video frame rates. Some rates may not + be available due to, for example, current flash mode setting. In those cases + a rate of 0 will be returned. Rates should be returned in order, highest first, + so clients do not have to iterate through every one. +@param aRateIndex + The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. +@param aFormat + The format. +@param aSizeIndex + The size index. +@param aExposure + The exposure mode. +*/ +void CWebCamera::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const + { + } + +/** +from CCamera + +Gets the frame size currently in use. + +@param aSize + The frame size currently in use. +*/ +void CWebCamera::GetFrameSize(TSize& /*aSize*/) const + { + } + +/** +from CCamera + +Gets the frame rate currently in use. + +@return The frame rate currently in use. +*/ +TReal32 CWebCamera::FrameRate() const + { + return 0.0; + } + +/** +from CCamera + +Gets the number of buffers currently in use. + +@return The number of buffers currently in use. +*/ +TInt CWebCamera::BuffersInUse() const + { + return 0; + } + +/** +from CCamera + +Gets the number of frames per buffer currently in use. + +@return The number of frames per buffer currently in use. +*/ +TInt CWebCamera::FramesPerBuffer() const + { + return 0; + } + +/** +from CCamera + +Sets the quality value to use if jpeg is a supported image for video format. + +Ignored if jpeg is not a supported image for video format. + +@param aQuality + The quality value to use, clamped to the range 1 to 100. + +@see CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize +*/ +void CWebCamera::SetJpegQuality(TInt /*aQuality*/) + { + } + +/** +from CCamera + +Gets the currently set jpeg quality value. + +Returns 0 if not supported. +@return The currently set jpeg quality value. +@see CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize) +*/ +TInt CWebCamera::JpegQuality() const + { + return 0; + } + +/** +from CCamera + +Gets a custom interface. The client has to cast the returned pointer +to the appropriate type. + +@param aInterface + The Uid of the particular interface function required. +@return Custom interface pointer. NULL if the requested interface is not supported. +*/ +TAny* CWebCamera::CustomInterface(TUid aInterface) + { + switch(aInterface.iUid) + { + // advanced settings interface pointers + case KECamMCameraAdvancedSettingsUidValue: + iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); + return static_cast(iAdvSettingsImpl); + + case KECamMCameraAdvancedSettings2UidValue: + iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); + return static_cast(iAdvSettingsImpl); + + case KECamMCameraAdvancedSettings3UidValue: + iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); + return static_cast(iAdvSettingsImpl); + + default: + return NULL; + } + } + +/** +from MWebCameraActiveCallBack +CallBack function of the Reserve +*/ +void CWebCamera::ReserveCallBack(TInt aError) + { + + if (iObserver) + { + iObserver->ReserveComplete(aError); + } + else if (iObserver2) + { + const TECAMEvent wEvent(KUidECamEventReserveComplete, aError); + iObserver2->HandleEvent(wEvent); + } + } + +/** +from MWebCameraActiveCallBack +CallBack function of the PowerOn +*/ +void CWebCamera::PowerOnCallBack(TInt aError) + { + + if (iObserver) + { + iObserver->PowerOnComplete(aError); + } + else if (iObserver2) + { + const TECAMEvent wEvent(KUidECamEventPowerOnComplete, aError); + iObserver2->HandleEvent(wEvent); + } + } + +/** +from MWebCameraActiveCallBack + +CallBack function of the ImageCapture +*/ +void CWebCamera::ImageCaptureCallBackL(TInt aError) + { + iImageCaptureActive = EFalse; + if (!iCaptureBitmap) + { + CFbsBitmap* image = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(image); + User::LeaveIfError(image->Create(TSize(KCaptureWidth, KCaptureHeight), EColor16M)); + CleanupStack::Pop(image); + iCaptureBitmap = image; + } + + iCaptureBufPtr.Copy(iChuckBase,iChunkRemSize); + +//////////////////////////////////////////////////////////////////////////////////////// +// output receive data log +// RDebug::Print(_L("CWebCameraVfActive::ImageCaptureCallBack iCaptureBufPtr[%d]"), iCaptureBufPtr.Length()); +// TBuf<256> hexBuf; +// for (TInt i = 0; i < iCaptureBufPtr.Length(); i++) +// { +// hexBuf.AppendFormat(_L("%02X "), iCaptureBufPtr[i]); +// if ((i % 16) == 15) +// { +// RDebug::Print(hexBuf); +// hexBuf = KNullDesC; +// } +// } +// RDebug::Print(hexBuf); +//////////////////////////////////////////////////////////////////////////////////////// + + if (iObserver) + { + TUint32 *wData = iCaptureBitmap->DataAddress(); + Mem::Copy(wData, iCaptureBufPtr.Ptr(), (KCaptureHeight * KCaptureLineBytes)); + + iObserver->ImageReady(iCaptureBitmap, iCaptureBuf, aError); + delete iCaptureBitmap; + iCaptureBitmap = NULL; + } + else if (iObserver2) + { + iObserver2->ImageBufferReady(*iCaptureCameraBuf, aError); + } + + } + +//from MWebCameraVfActiveCallBack +void CWebCamera::ViewFinderCallBack(TInt /*aError*/) + { + } + + +// +// CWebCameraInfo class +// + +CWebCameraInfo::CWebCameraInfo() + { + } + +CWebCameraInfo::~CWebCameraInfo() + { + } + +CWebCameraInfo* CWebCameraInfo::NewL() + { + return new (ELeave) CWebCameraInfo; + } + +/** +from CCameraInfoPlugin + +Determines the number of cameras on the device. + +@return Count of cameras present on the device. +*/ +TInt CWebCameraInfo::CamerasAvailable() + { + return 1; + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraPlugin, CWebCamera::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraInfo, CWebCameraInfo::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.h --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameraplugin.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,1027 +1,1032 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERAPLUGIN_H -#define ECAMWEBCAMERAPLUGIN_H - -#include -#include -#include -#include -#include - - -class CWebCameraBuffer; -class CWebCameraActive; -class CWebCameraVfActive; -class CWebCameraAdvSet; - -/** Min of Camera Zoom */ -const TInt KMinTestCameraZoom = -3; -/** Max of Camera Zoom */ -const TInt KMaxTestCameraZoom = 3; -/** Max of Camera Digital Zoom Factor */ -const TReal32 KMaxTestCameraDigitalZoomFactor = 1.0; -/** Max of Camera Digital Zoom */ -const TInt KMaxTestCameraDigitalZoom = 0; -/** Size of Viewfinder buffer, Capture buffer */ -const TInt KMaxBufSize = 1024 * 100; - - -// Callback Class of WebCameraActive -class MWebCameraActiveCallBack - { -public: - virtual void ReserveCallBack(TInt aError) = 0; - virtual void PowerOnCallBack(TInt aError) = 0; - virtual void ImageCaptureCallBackL(TInt aError) = 0; - }; - -// Callback Class of WebCameraVfActive -class MWebCameraVfActiveCallBack - { -public: - virtual void ViewFinderCallBack(TInt aError) = 0; - }; - -/** - * Perform WebCamera function. - */ -class CWebCamera : public CCameraPlugin - , public MWebCameraActiveCallBack - , public MWebCameraVfActiveCallBack - { -public: - static CWebCamera* NewL(); - ~CWebCamera(); - -protected: - - //from CCameraPlugin - /** - from CCameraPlugin - - A call to one of the factory functions firstly loads the plugin, followed by a - call to this function to complete construction. - - Creates an object representing a camera. - - @param aObserver - Reference to class derived from MCameraObserver2 designed to receive - notification of asynchronous event completion. - @param aCameraIndex - Index from 0 to CamerasAvailable()-1 inclusive specifying the - camera device to use. - @return Pointer to a fully constructed CCamera object. Ownership is passed - to the caller. - - @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is - out of range. - */ - void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); - - /** - from CCameraPlugin - - A call to one of the factory functions firstly loads the plugin, followed by a - call to this function to complete construction. - - Duplicates the original camera object for use by, for example, multimedia systems. - - May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid. - - @param aObserver - Reference to an observer. - @param aCameraHandle Handle of an existing camera object. - - @return Duplicate of the original camera object. - */ - void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); - - /** - from CCameraPlugin - - A call to one of the factory functions firstly loads the plugin, followed by a - call to this function to complete construction. - - Creates an object representing a camera. - - @param aObserver - Reference to class derived from MCameraObserver2 designed to receive - notification of asynchronous event completion. - @param aCameraIndex - Index from 0 to CamerasAvailable()-1 inclusive specifying the - camera device to use. - @param aPriority - Value from -100 to 100 indicating relative priority of client to - use camera. - - @return Pointer to a fully constructed CCamera object. Ownership is passed - to the caller. - - @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is - out of range. - */ - void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); - - /** - from CCameraPlugin - - Duplicates the original camera object for use by, for example, multimedia systems. - - @leave KErrNoMemory if out of memory. - @leave KErrNotFound if aCameraHandle is not valid. - @leave KErrPermissionDenied if the application does not have - the UserEnvironment capability. - - @param aObserver - Reference to an observer. - @param aCameraHandle Handle of an existing camera object. - - @return Duplicate of the original camera object. - - @capability UserEnvironment - An application that creates a CCamera object must have - the UserEnvironment capability. - - @note Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). - To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare - themselves to receive unrecognised values. - */ - void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); - - // from CCamera - /** - from CCamera - - Gets information about the camera device. - - @param aInfo - On return, information about the camera device. See TCameraInfo. - */ - void CameraInfo(TCameraInfo& aInfo) const; - - /** - from CCamera - - Asynchronous function that performs any required initialisation and reserves - the camera for exclusive use. - - Calls MCameraObserver:: ReserveComplete() when complete. - */ - void Reserve(); - - /** - from CCamera - - De-initialises the camera, allowing it to be used by other clients. - */ - void Release(); - - - /** - from CCamera - - Asynchronous method to switch on camera power. - - User must have successfully called Reserve() prior to calling this function. - - Calls MCameraObserver::PowerOnComplete() when power on is complete. - */ - void PowerOn(); - - /** - from CCamera - - Synchronous function for switching off camera power. - */ - void PowerOff(); - - - /** - from CCamera - - Gets the device-unique handle of this camera object. - - @return The device-unique handle of this camera object. - */ - TInt Handle(); - - - /** - from CCamera - - Sets the zoom factor. - - This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom - inclusive. May leave with KErrNotSupported if the specified zoom factor is - out of range. - - @param aZoomFactor - Required zoom factor. - */ - void SetZoomFactorL(TInt aZoomFactor = 0); - - - /** - from CCamera - - Gets the currently set zoom factor. - - @return The currently set zoom factor. - */ - TInt ZoomFactor() const; - - /** - from CCamera - - Sets the digital zoom factor. - - This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive. - - May leave with KErrNotSupported if the zoom factor is out of range. - - @param aDigitalZoomFactor - The required digital zoom factor. - */ - void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); - - - /** - from CCamera - - Gets the currently set digital zoom factor. - - @return The currently set digital zoom factor. - */ - TInt DigitalZoomFactor() const; - - - /** - from CCamera - - Sets the contrast adjustment of the device. - - This must be in the range of -100 to +100 or EContrastAuto. May leave with - KErrNotSupported if the specified contrast value is out of range. - - @param aContrast - Required contrast value. See TCameraInfo::iContrastSupported - */ - void SetContrastL(TInt aContrast); - - - /** - from CCamera - - Gets the currently set contrast value. - - @return The currently set contrast value. - */ - TInt Contrast() const; - - /** - from CCamera - - Sets the brightness adjustment of the device. - - No effect if this is not supported, see TCameraInfo::iBrightnessSupported. - - This must be in the range of -100 to +100 or EBrightnessAuto. May leave - with KErrNotSupported if the brightness adjustment is out of range. - - @param aBrightness - The required brightness adjustment. - */ - void SetBrightnessL(TInt aBrightness); - - /** - from CCamera - - Gets the currently set brightness adjustment value. - - @return The currently set brightness adjustment value. - */ - TInt Brightness() const; - - /** - from CCamera - - Sets the flash mode. - - No effect if this is not supported, see TCameraInfo::iFlashModesSupported. - - May leave with KErrNotSupported if the specified flash mode is invalid. - - @param aFlash - The required flash mode. - */ - void SetFlashL(TFlash aFlash = EFlashNone); - - /** - from CCamera - - Gets the currently set flash mode. - - @return The currently set flash mode. - @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that - application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) - (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. - To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() - to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. - In this case, application is assumed to be prepared to receive unrecognised enum values. - - @see CCamera::CCameraAdvancedSettings::FlashMode() - */ - TFlash Flash() const; - - /** - from CCamera - - Sets the exposure adjustment of the device. - - No effect if this is not supported, see CameraInfo::iExposureModesSupported. - - May leave with KErrNotSupported if the specified exposure adjustment is invalid. - - @param aExposure - The required exposure adjustment. - */ - void SetExposureL(TExposure aExposure = EExposureAuto); - - /** - from CCamera - - Gets the currently set exposure setting value. - - @return The currently set exposure setting value. - */ - TExposure Exposure() const; - - /** - from CCamera - - Sets the white balance adjustment of the device. - - No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported. - - @param aWhiteBalance - The required white balance adjustment. - - @leave KErrNotSupported if the specified white balance adjustment - is invalid. - */ - void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); - - /** - from CCamera - - Gets the currently set white balance adjustment value. - - @return The currently set white balance adjustment value. - - @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that - application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) - (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. - To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() - to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. - In this case, application is assumed to be prepared to receive unrecognised enum values. - Refer CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation - - @see CCamera::CCameraAdvancedSettings::WhiteBalanceMode() - */ - TWhiteBalance WhiteBalance() const; - - /** - from CCamera - - Starts transfer of view finder data to the given portion of the screen using - direct screen access. - - The aScreenRect parameter is in screen co-ordinates and may be modified if, - eg, the camera requires the destination to have a certain byte alignment, etc. - - @param aWs - Window server session. - @param aScreenDevice - Screen device. - @param aWindow - Displayable window. - @param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. - - @leave KErrNotReady if PowerOn() has either not - been called, or has not yet completed. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraV2DirectViewFinder - */ - void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); - - /** - from CCamera - - Starts transfer of view finder data to the given portion of the screen using - direct screen access and also clips to the specified portion of the screen. - - The view finder has the same size and position as aScreenRect but is only - visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported - or KErrNotReady if Reserve() has not been called, or has not yet completed. - - @param aWs - Window server session. - @param aScreenDevice - Screen device. - @param aWindow - Displayable window. - @param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. - @param aClipRect - The rectangle to which the screen will be clipped. - - @leave KErrNotReady if PowerOn() hasn't been called successfully. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraClientViewFinder - */ - void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); - - /** - from CCamera - - Starts transfer of view finder data. - - Bitmaps are returned by MCameraObserver::ViewFinderFrameReady(). - - @param aSize - On return, the size used. - @leave KErrNotReady if PowerOn() has not been called, or has not yet completed. - - @note This method is assumed to be meant for default display only. - - @see CCamera::CCameraClientViewFinder - */ - void StartViewFinderBitmapsL(TSize& aSize); - - /** - from CCamera - - Starts transfer of view finder data and clips the bitmap to the specified clip - rectangle. - - The bitmap is the size of the intersection of aSize and aClipRect, not simply - aSize padded with white space. - - @param aSize - On return, the size used. - @param aClipRect - Required clip rectangle. May be modified if, for example, - the camera only supports certain byte alignments. - - @leave KErrInUse if Reserve() hasn't been called successfully. - @leave KErrNotReady if PowerOn() hasn't been called successfully. - - @note This method is assumed to be meant for default display only. - - @see CCamera::CCameraClientViewFinder - */ - void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); - - /** - from CCamera - - Starts transfer of view finder data. - - Picture data is returned by MCameraObserver2::ViewFinderReady(). - - @param aImageFormat - The image format requested by the client. - @param aSize - On return, the size used. - @leave KErrNotSupported - @leave KErrNotReady if Reserve() has not been - called, or has not yet completed. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraClientViewFinder - */ - void StartViewFinderL(TFormat aImageFormat,TSize& aSize); - - /** - from CCamera - - Starts transfer of view finder data and clips the picture to the specified clip - rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady(). - - The picture is the size of the intersection of aSize and aClipRect, not simply - aSize padded with white space. - - @param aImageFormat - The image format. - @param aSize - On return, the size used. - @param aClipRect - Required clip rectangle. May be modified if, for example, - the camera only supports certain byte alignments. - - @leave KErrInUse if Reserve() hasn't been called successfully, - @leave KErrNotReady if PowerOn() hasn't been called successfully. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraClientViewFinder - */ - void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); - - /** - Stops transfer of view finder data to the screen. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraV2DirectViewFinder - @see CCamera::CCameraClientViewFinder - */ - void StopViewFinder(); - - /** - from CCamera - - Queries whether the view finder is active. - - @return ETrue if the view finder is active. EFalse if the view finder is not - active. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraV2DirectViewFinder - @see CCamera::CCameraClientViewFinder - */ - TBool ViewFinderActive() const; - - /** - from CCamera - - Sets whether view finder mirroring is on. - - Used to switch between what the camera sees and what you would see if the - device were a mirror. - - @param aMirror - ETrue to set mirroring on, EFalse to set mirroring off. - - @leave KErrNotSupported. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraV2DirectViewFinder - @see CCamera::CCameraClientViewFinder - */ - void SetViewFinderMirrorL(TBool aMirror); - - /** - from CCamera - - Gets whether view finder mirroring is active. - - @return ETrue if mirroring is set, EFalse if mirroring is not set. - - @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to - refer viewfinders started using CCamera methods. - - @see CCamera::CCameraV2DirectViewFinder - @see CCamera::CCameraClientViewFinder - */ - TBool ViewFinderMirror() const; - - /** - from CCamera - - Performs setup and allocation of memory. - - Called prior to calling CaptureImage() to keep the latency of that function - to a minimum. - - Needs to be called only once for multiple CaptureImage() calls. May leave - with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady. - - The specified image format must be one of the formats supported - (see TCameraInfo::iImageFormatsSupported). - - The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 - inclusive. - - @param aImageFormat - The image format. - @param aSizeIndex - Size index. - - @leave KErrNotSupported - @leave KErrNoMemory - @leave KErrNotReady if PowerOn() hasn't been called successfully. - - @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) - */ - void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); - - /** - from CCamera - - Performs setup and allocation of memory and clips the image to the specified - rectangle. - - No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The - image captured is the intersection of aClipRect and the rectangle from (0,0) - to aSize. Needs to be called only once for multiple CaptureImage() calls. - May leave with KErrNotSupported or KErrNoMemory. - - The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported). - - The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 - inclusive. - - @param aImageFormat - The image format. - @param aSizeIndex - Size index. - @param aClipRect - The rectangle to which the image is to be clipped. - - @leave KErrNotSupported - @leave KErrNoMemory - @leave KErrInUse if Reserve() hasn't been called successfully - @leave KErrNotReady if PowerOn() - hasn't been called successfully. - - @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) - */ - void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); - - /** - from CCamera - - Asynchronously performs still image capture. - - Calls MCameraObserver::ImageReady() when complete. - - @see CCamera::CCameraImageCapture - @see CCamera::CCameraPreImageCaptureControl - */ - void CaptureImage(); - - /** - from CCamera - - Cancels the asynchronous still image capture. - - @see CCamera::CCameraImageCapture - */ - void CancelCaptureImage(); - - /** - from CCamera - - Enumerates through the available image capture sizes, based on the specified - size index and format - - The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 - inclusive. - - @param aSize - Image size. - @param aSizeIndex - Size index. - @param aFormat - The image format. - */ - void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - - /** - from CCamera - - Prepares for video capture. - - Performs setup and allocation of memory prior to calling StartVideoCapture() - to keep the latency of that function to a minimum. - - May leave with KErrNotSupported or KErrNoMemory. - - @param aFormat - Format must be one of the video frame formats supported (see - TCameraInfo::iVideoFrameFormatsSupported). - @param aSizeIndex - Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive. - @param aRateIndex - The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. - @param aBuffersToUse - The number of discrete buffers to use. - @param aFramesPerBuffer - How large the buffers are to be. Must be less than - or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned - to MCameraObserver::FrameBufferReady() at a time. - - @leave May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() - hasn't been called successfully. - - @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) - */ - void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); - - /** - from CCamera - - Prepares for video capture and clips the frames to the given rectangle. - - Performs setup and allocation of memory prior to calling StartVideoCapture() - to keep the latency of that function to a minimum. - - May leave with KErrNotSupported or KErrNoMemory. - - @param aFormat - Format must be one of the video frame formats supported (see - TCameraInfo::iVideoFrameFormatsSupported). - @param aSizeIndex - Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive. - @param aRateIndex - The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. - @param aBuffersToUse - The number of discrete buffers to use. - @param aFramesPerBuffer - How large the buffers are to be. Must be less than - or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned - to MCameraObserver::FrameBufferReady() at a time. - @param aClipRect - The rectangle to which the image is to be clipped. - @leave KErrNotSupported - @leave KErrNoMemory, - @leave KErrInUse if Reserve() hasn't been called successfully - @leave KErrNotReady if PowerOn() hasn't been called successfully. - - @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) - */ - void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); - - /** - from CCamera - - Starts capturing video. - - Calls MCameraObserver::FrameBufferReady() when each buffer has been filled - with the required number of frames, as set by PrepareVideoCaptureL(). - */ - void StartVideoCapture(); - - /** - from CCamera - - Stops video capture. - */ - void StopVideoCapture(); - - /** - from CCamera - - Tests whether video capture is active. - - @return ETrue if video capture is active. EFalse if video capture is not active - */ - TBool VideoCaptureActive() const; - - /** - from CCamera - - Enumerates through the available video frame sizes, based on the specified - size index and format. - - @param aSize - On return the available video frame sizes. Sizes should be returned - in order, largest first, so clients do not have to iterate through every one. - @param aSizeIndex - Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 - inclusive - @param aFormat - Image format. - */ - void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; - - /** - from CCamera - - Enumerates through the available video frame rates, based on the specified - rate index, video frame format, size index and exposure mode. - - @param aRate - On return, the available video frame rates. Some rates may not - be available due to, for example, current flash mode setting. In those cases - a rate of 0 will be returned. Rates should be returned in order, highest first, - so clients do not have to iterate through every one. - @param aRateIndex - The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 - inclusive. - @param aFormat - The format. - @param aSizeIndex - The size index. - @param aExposure - The exposure mode. - */ - void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; - - /** - from CCamera - - Gets the frame size currently in use. - - @param aSize - The frame size currently in use. - */ - void GetFrameSize(TSize& aSize) const; - - /** - from CCamera - - Gets the frame rate currently in use. - - @return The frame rate currently in use. - */ - TReal32 FrameRate() const; - - /** - from CCamera - - Gets the number of buffers currently in use. - - @return The number of buffers currently in use. - */ - TInt BuffersInUse() const; - - /** - from CCamera - - Gets the number of frames per buffer currently in use. - - @return The number of frames per buffer currently in use. - */ - TInt FramesPerBuffer() const; - - /** - from CCamera - - Sets the quality value to use if jpeg is a supported image for video format. - - Ignored if jpeg is not a supported image for video format. - - @param aQuality - The quality value to use, clamped to the range 1 to 100. - - @see CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize - */ - void SetJpegQuality(TInt aQuality); - - /** - from CCamera - - Gets the currently set jpeg quality value. - - Returns 0 if not supported. - - @return The currently set jpeg quality value. - - @see CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize) - */ - TInt JpegQuality() const; - - /** - from CCamera - - Gets a custom interface. The client has to cast the returned pointer - to the appropriate type. - - @param aInterface - The Uid of the particular interface function required. - - @return Custom interface pointer. NULL if the requested interface is not supported. - */ - TAny* CustomInterface(TUid aInterface); - -private: - CWebCamera(); - void ConstructL(); - -private: // from MWebCameraActiveCallBack - /** - from MWebCameraActiveCallBack - - CallBack function of the Reserve - */ - virtual void ReserveCallBack(TInt aError); - - /** - from MWebCameraActiveCallBack - - CallBack function of the PowerOn - */ - virtual void PowerOnCallBack(TInt aError); - - /** - from MWebCameraActiveCallBack - - CallBack function of the ImageCapture - */ - virtual void ImageCaptureCallBackL(TInt aError); - -private: // from MWebCameraActiveCallBack - /** - from MWebCameraActiveCallBack - - CallBack function of the ViewFinder - */ - virtual void ViewFinderCallBack(TInt aError); - -private: - - RWebcameraDevice iDriver; ///< Camera driver. - MCameraObserver* iObserver; ///< The callback 'notify' party - MCameraObserver2* iObserver2; ///< The callback 'notify' party(V2). - CWebCameraActive* iActive; ///< For async demand. - CWebCameraVfActive* iVfActive; ///< For viewfinder. - CWebCameraAdvSet* iAdvSettingsImpl; ///< Expansion setting class. - - TCameraInfo iInfo; ///< Camera Information. - TInt iCameraIndex; ///< Camera Index. - TInt iCameraHandle; ///< Camera handle. - TInt iPriority; ///< priority. - - TBool iReserved; ///< Reserved Flag. - TBool iPowerOn; ///< PowerOn Flag. - TBool iImageCaptureActive;///< Flag during the still image . - - CWebCameraBuffer* iCaptureCameraBuf; ///< Camera buffer for capture. - CFbsBitmap* iCaptureBitmap; ///< Bitmap Data for capture. - HBufC8* iCaptureBuf; ///< Data buffer for capture. - TPtr8 iCaptureBufPtr; ///< pointer to Data buffer for capture. - - RArray iImageSizes; ///< Image size. - }; - - -class CWebCameraInfo : public CCameraInfoPlugin - { -public: - - /** - * Two-phased constructor. - */ - static CWebCameraInfo* NewL(); - - /**> Destructor */ - ~CWebCameraInfo(); - -// from CCameraInfoPlugin -public: - /** - from CCameraInfoPlugin - - Determines the number of cameras on the device. - - @return Count of cameras present on the device. - */ - TInt CamerasAvailable(); - -private: - CWebCameraInfo(); - }; - - -#endif // ECAMWEBCAMERAPLUGIN_H +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERAPLUGIN_H +#define ECAMWEBCAMERAPLUGIN_H + +#include +#include +#include +#include +#include + + +class CWebCameraBuffer; +class CWebCameraActive; +class CWebCameraVfActive; +class CWebCameraAdvSet; + +/** Min of Camera Zoom */ +const TInt KMinTestCameraZoom = -3; +/** Max of Camera Zoom */ +const TInt KMaxTestCameraZoom = 3; +/** Max of Camera Digital Zoom Factor */ +const TReal32 KMaxTestCameraDigitalZoomFactor = 1.0; +/** Max of Camera Digital Zoom */ +const TInt KMaxTestCameraDigitalZoom = 0; +/** Size of Viewfinder buffer, Capture buffer */ + +const TInt KMaxBufSize = 900 * 1024; + + +// Callback Class of WebCameraActive +class MWebCameraActiveCallBack + { +public: + virtual void ReserveCallBack(TInt aError) = 0; + virtual void PowerOnCallBack(TInt aError) = 0; + virtual void ImageCaptureCallBackL(TInt aError) = 0; + }; + +// Callback Class of WebCameraVfActive +class MWebCameraVfActiveCallBack + { +public: + virtual void ViewFinderCallBack(TInt aError) = 0; + }; + +/** + * Perform WebCamera function. + */ +class CWebCamera : public CCameraPlugin + , public MWebCameraActiveCallBack + , public MWebCameraVfActiveCallBack + { +public: + static CWebCamera* NewL(); + ~CWebCamera(); + +protected: + + //from CCameraPlugin + /** + from CCameraPlugin + + A call to one of the factory functions firstly loads the plugin, followed by a + call to this function to complete construction. + + Creates an object representing a camera. + + @param aObserver + Reference to class derived from MCameraObserver2 designed to receive + notification of asynchronous event completion. + @param aCameraIndex + Index from 0 to CamerasAvailable()-1 inclusive specifying the + camera device to use. + @return Pointer to a fully constructed CCamera object. Ownership is passed + to the caller. + + @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is + out of range. + */ + void Construct2L(MCameraObserver& aObserver,TInt aCameraIndex); + + /** + from CCameraPlugin + + A call to one of the factory functions firstly loads the plugin, followed by a + call to this function to complete construction. + + Duplicates the original camera object for use by, for example, multimedia systems. + + May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid. + + @param aObserver + Reference to an observer. + @param aCameraHandle Handle of an existing camera object. + + @return Duplicate of the original camera object. + */ + void Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle); + + /** + from CCameraPlugin + + A call to one of the factory functions firstly loads the plugin, followed by a + call to this function to complete construction. + + Creates an object representing a camera. + + @param aObserver + Reference to class derived from MCameraObserver2 designed to receive + notification of asynchronous event completion. + @param aCameraIndex + Index from 0 to CamerasAvailable()-1 inclusive specifying the + camera device to use. + @param aPriority + Value from -100 to 100 indicating relative priority of client to + use camera. + + @return Pointer to a fully constructed CCamera object. Ownership is passed + to the caller. + + @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is + out of range. + */ + void Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority); + + /** + from CCameraPlugin + + Duplicates the original camera object for use by, for example, multimedia systems. + + @leave KErrNoMemory if out of memory. + @leave KErrNotFound if aCameraHandle is not valid. + @leave KErrPermissionDenied if the application does not have + the UserEnvironment capability. + + @param aObserver + Reference to an observer. + @param aCameraHandle Handle of an existing camera object. + + @return Duplicate of the original camera object. + + @capability UserEnvironment + An application that creates a CCamera object must have + the UserEnvironment capability. + + @note Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). + To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare + themselves to receive unrecognised values. + */ + void Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle); + + // from CCamera + /** + from CCamera + + Gets information about the camera device. + + @param aInfo + On return, information about the camera device. See TCameraInfo. + */ + void CameraInfo(TCameraInfo& aInfo) const; + + /** + from CCamera + + Asynchronous function that performs any required initialisation and reserves + the camera for exclusive use. + + Calls MCameraObserver:: ReserveComplete() when complete. + */ + void Reserve(); + + /** + from CCamera + + De-initialises the camera, allowing it to be used by other clients. + */ + void Release(); + + + /** + from CCamera + + Asynchronous method to switch on camera power. + + User must have successfully called Reserve() prior to calling this function. + + Calls MCameraObserver::PowerOnComplete() when power on is complete. + */ + void PowerOn(); + + /** + from CCamera + + Synchronous function for switching off camera power. + */ + void PowerOff(); + + + /** + from CCamera + + Gets the device-unique handle of this camera object. + + @return The device-unique handle of this camera object. + */ + TInt Handle(); + + + /** + from CCamera + + Sets the zoom factor. + + This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom + inclusive. May leave with KErrNotSupported if the specified zoom factor is + out of range. + + @param aZoomFactor + Required zoom factor. + */ + void SetZoomFactorL(TInt aZoomFactor = 0); + + + /** + from CCamera + + Gets the currently set zoom factor. + + @return The currently set zoom factor. + */ + TInt ZoomFactor() const; + + /** + from CCamera + + Sets the digital zoom factor. + + This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive. + + May leave with KErrNotSupported if the zoom factor is out of range. + + @param aDigitalZoomFactor + The required digital zoom factor. + */ + void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); + + + /** + from CCamera + + Gets the currently set digital zoom factor. + + @return The currently set digital zoom factor. + */ + TInt DigitalZoomFactor() const; + + + /** + from CCamera + + Sets the contrast adjustment of the device. + + This must be in the range of -100 to +100 or EContrastAuto. May leave with + KErrNotSupported if the specified contrast value is out of range. + + @param aContrast + Required contrast value. See TCameraInfo::iContrastSupported + */ + void SetContrastL(TInt aContrast); + + + /** + from CCamera + + Gets the currently set contrast value. + + @return The currently set contrast value. + */ + TInt Contrast() const; + + /** + from CCamera + + Sets the brightness adjustment of the device. + + No effect if this is not supported, see TCameraInfo::iBrightnessSupported. + + This must be in the range of -100 to +100 or EBrightnessAuto. May leave + with KErrNotSupported if the brightness adjustment is out of range. + + @param aBrightness + The required brightness adjustment. + */ + void SetBrightnessL(TInt aBrightness); + + /** + from CCamera + + Gets the currently set brightness adjustment value. + + @return The currently set brightness adjustment value. + */ + TInt Brightness() const; + + /** + from CCamera + + Sets the flash mode. + + No effect if this is not supported, see TCameraInfo::iFlashModesSupported. + + May leave with KErrNotSupported if the specified flash mode is invalid. + + @param aFlash + The required flash mode. + */ + void SetFlashL(TFlash aFlash = EFlashNone); + + /** + from CCamera + + Gets the currently set flash mode. + + @return The currently set flash mode. + @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that + application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) + (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. + To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() + to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. + In this case, application is assumed to be prepared to receive unrecognised enum values. + + @see CCamera::CCameraAdvancedSettings::FlashMode() + */ + TFlash Flash() const; + + /** + from CCamera + + Sets the exposure adjustment of the device. + + No effect if this is not supported, see CameraInfo::iExposureModesSupported. + + May leave with KErrNotSupported if the specified exposure adjustment is invalid. + + @param aExposure + The required exposure adjustment. + */ + void SetExposureL(TExposure aExposure = EExposureAuto); + + /** + from CCamera + + Gets the currently set exposure setting value. + + @return The currently set exposure setting value. + */ + TExposure Exposure() const; + + /** + from CCamera + + Sets the white balance adjustment of the device. + + No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported. + + @param aWhiteBalance + The required white balance adjustment. + + @leave KErrNotSupported if the specified white balance adjustment + is invalid. + */ + void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); + + /** + from CCamera + + Gets the currently set white balance adjustment value. + + @return The currently set white balance adjustment value. + + @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that + application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) + (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. + To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() + to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. + In this case, application is assumed to be prepared to receive unrecognised enum values. + Refer CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation + + @see CCamera::CCameraAdvancedSettings::WhiteBalanceMode() + */ + TWhiteBalance WhiteBalance() const; + + /** + from CCamera + + Starts transfer of view finder data to the given portion of the screen using + direct screen access. + + The aScreenRect parameter is in screen co-ordinates and may be modified if, + eg, the camera requires the destination to have a certain byte alignment, etc. + + @param aWs + Window server session. + @param aScreenDevice + Screen device. + @param aWindow + Displayable window. + @param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. + + @leave KErrNotReady if PowerOn() has either not + been called, or has not yet completed. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraV2DirectViewFinder + */ + void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); + + /** + from CCamera + + Starts transfer of view finder data to the given portion of the screen using + direct screen access and also clips to the specified portion of the screen. + + The view finder has the same size and position as aScreenRect but is only + visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported + or KErrNotReady if Reserve() has not been called, or has not yet completed. + + @param aWs + Window server session. + @param aScreenDevice + Screen device. + @param aWindow + Displayable window. + @param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. + @param aClipRect + The rectangle to which the screen will be clipped. + + @leave KErrNotReady if PowerOn() hasn't been called successfully. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraClientViewFinder + */ + void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); + + /** + from CCamera + + Starts transfer of view finder data. + + Bitmaps are returned by MCameraObserver::ViewFinderFrameReady(). + + @param aSize + On return, the size used. + @leave KErrNotReady if PowerOn() has not been called, or has not yet completed. + + @note This method is assumed to be meant for default display only. + + @see CCamera::CCameraClientViewFinder + */ + void StartViewFinderBitmapsL(TSize& aSize); + + /** + from CCamera + + Starts transfer of view finder data and clips the bitmap to the specified clip + rectangle. + + The bitmap is the size of the intersection of aSize and aClipRect, not simply + aSize padded with white space. + + @param aSize + On return, the size used. + @param aClipRect + Required clip rectangle. May be modified if, for example, + the camera only supports certain byte alignments. + + @leave KErrInUse if Reserve() hasn't been called successfully. + @leave KErrNotReady if PowerOn() hasn't been called successfully. + + @note This method is assumed to be meant for default display only. + + @see CCamera::CCameraClientViewFinder + */ + void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); + + /** + from CCamera + + Starts transfer of view finder data. + + Picture data is returned by MCameraObserver2::ViewFinderReady(). + + @param aImageFormat + The image format requested by the client. + @param aSize + On return, the size used. + @leave KErrNotSupported + @leave KErrNotReady if Reserve() has not been + called, or has not yet completed. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraClientViewFinder + */ + void StartViewFinderL(TFormat aImageFormat,TSize& aSize); + + /** + from CCamera + + Starts transfer of view finder data and clips the picture to the specified clip + rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady(). + + The picture is the size of the intersection of aSize and aClipRect, not simply + aSize padded with white space. + + @param aImageFormat + The image format. + @param aSize + On return, the size used. + @param aClipRect + Required clip rectangle. May be modified if, for example, + the camera only supports certain byte alignments. + + @leave KErrInUse if Reserve() hasn't been called successfully, + @leave KErrNotReady if PowerOn() hasn't been called successfully. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraClientViewFinder + */ + void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); + + /** + Stops transfer of view finder data to the screen. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraV2DirectViewFinder + @see CCamera::CCameraClientViewFinder + */ + void StopViewFinder(); + + /** + from CCamera + + Queries whether the view finder is active. + + @return ETrue if the view finder is active. EFalse if the view finder is not + active. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraV2DirectViewFinder + @see CCamera::CCameraClientViewFinder + */ + TBool ViewFinderActive() const; + + /** + from CCamera + + Sets whether view finder mirroring is on. + + Used to switch between what the camera sees and what you would see if the + device were a mirror. + + @param aMirror + ETrue to set mirroring on, EFalse to set mirroring off. + + @leave KErrNotSupported. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraV2DirectViewFinder + @see CCamera::CCameraClientViewFinder + */ + void SetViewFinderMirrorL(TBool aMirror); + + /** + from CCamera + + Gets whether view finder mirroring is active. + + @return ETrue if mirroring is set, EFalse if mirroring is not set. + + @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to + refer viewfinders started using CCamera methods. + + @see CCamera::CCameraV2DirectViewFinder + @see CCamera::CCameraClientViewFinder + */ + TBool ViewFinderMirror() const; + + /** + from CCamera + + Performs setup and allocation of memory. + + Called prior to calling CaptureImage() to keep the latency of that function + to a minimum. + + Needs to be called only once for multiple CaptureImage() calls. May leave + with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady. + + The specified image format must be one of the formats supported + (see TCameraInfo::iImageFormatsSupported). + + The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 + inclusive. + + @param aImageFormat + The image format. + @param aSizeIndex + Size index. + + @leave KErrNotSupported + @leave KErrNoMemory + @leave KErrNotReady if PowerOn() hasn't been called successfully. + + @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) + */ + void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); + + /** + from CCamera + + Performs setup and allocation of memory and clips the image to the specified + rectangle. + + No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The + image captured is the intersection of aClipRect and the rectangle from (0,0) + to aSize. Needs to be called only once for multiple CaptureImage() calls. + May leave with KErrNotSupported or KErrNoMemory. + + The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported). + + The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 + inclusive. + + @param aImageFormat + The image format. + @param aSizeIndex + Size index. + @param aClipRect + The rectangle to which the image is to be clipped. + + @leave KErrNotSupported + @leave KErrNoMemory + @leave KErrInUse if Reserve() hasn't been called successfully + @leave KErrNotReady if PowerOn() + hasn't been called successfully. + + @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) + */ + void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); + + /** + from CCamera + + Asynchronously performs still image capture. + + Calls MCameraObserver::ImageReady() when complete. + + @see CCamera::CCameraImageCapture + @see CCamera::CCameraPreImageCaptureControl + */ + void CaptureImage(); + + /** + from CCamera + + Cancels the asynchronous still image capture. + + @see CCamera::CCameraImageCapture + */ + void CancelCaptureImage(); + + /** + from CCamera + + Enumerates through the available image capture sizes, based on the specified + size index and format + + The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 + inclusive. + + @param aSize + Image size. + @param aSizeIndex + Size index. + @param aFormat + The image format. + */ + void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + + /** + from CCamera + + Prepares for video capture. + + Performs setup and allocation of memory prior to calling StartVideoCapture() + to keep the latency of that function to a minimum. + + May leave with KErrNotSupported or KErrNoMemory. + + @param aFormat + Format must be one of the video frame formats supported (see + TCameraInfo::iVideoFrameFormatsSupported). + @param aSizeIndex + Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive. + @param aRateIndex + The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. + @param aBuffersToUse + The number of discrete buffers to use. + @param aFramesPerBuffer + How large the buffers are to be. Must be less than + or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned + to MCameraObserver::FrameBufferReady() at a time. + + @leave May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() + hasn't been called successfully. + + @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) + */ + void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); + + /** + from CCamera + + Prepares for video capture and clips the frames to the given rectangle. + + Performs setup and allocation of memory prior to calling StartVideoCapture() + to keep the latency of that function to a minimum. + + May leave with KErrNotSupported or KErrNoMemory. + + @param aFormat + Format must be one of the video frame formats supported (see + TCameraInfo::iVideoFrameFormatsSupported). + @param aSizeIndex + Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive. + @param aRateIndex + The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. + @param aBuffersToUse + The number of discrete buffers to use. + @param aFramesPerBuffer + How large the buffers are to be. Must be less than + or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned + to MCameraObserver::FrameBufferReady() at a time. + @param aClipRect + The rectangle to which the image is to be clipped. + @leave KErrNotSupported + @leave KErrNoMemory, + @leave KErrInUse if Reserve() hasn't been called successfully + @leave KErrNotReady if PowerOn() hasn't been called successfully. + + @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) + */ + void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); + + /** + from CCamera + + Starts capturing video. + + Calls MCameraObserver::FrameBufferReady() when each buffer has been filled + with the required number of frames, as set by PrepareVideoCaptureL(). + */ + void StartVideoCapture(); + + /** + from CCamera + Stops video capture. + */ + void StopVideoCapture(); + + /** + from CCamera + + Tests whether video capture is active. + @return ETrue if video capture is active. EFalse if video capture is not active + */ + TBool VideoCaptureActive() const; + + /** + from CCamera + + Enumerates through the available video frame sizes, based on the specified + size index and format. + + @param aSize + On return the available video frame sizes. Sizes should be returned + in order, largest first, so clients do not have to iterate through every one. + @param aSizeIndex + Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 + inclusive + @param aFormat + Image format. + */ + void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; + + /** + from CCamera + + Enumerates through the available video frame rates, based on the specified + rate index, video frame format, size index and exposure mode. + + @param aRate + On return, the available video frame rates. Some rates may not + be available due to, for example, current flash mode setting. In those cases + a rate of 0 will be returned. Rates should be returned in order, highest first, + so clients do not have to iterate through every one. + @param aRateIndex + The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 + inclusive. + @param aFormat + The format. + @param aSizeIndex + The size index. + @param aExposure + The exposure mode. + */ + void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; + + /** + from CCamera + + Gets the frame size currently in use. + + @param aSize + The frame size currently in use. + */ + void GetFrameSize(TSize& aSize) const; + + /** + from CCamera + + Gets the frame rate currently in use. + + @return The frame rate currently in use. + */ + TReal32 FrameRate() const; + + /** + from CCamera + + Gets the number of buffers currently in use. + + @return The number of buffers currently in use. + */ + TInt BuffersInUse() const; + + /** + from CCamera + + Gets the number of frames per buffer currently in use. + + @return The number of frames per buffer currently in use. + */ + TInt FramesPerBuffer() const; + + /** + from CCamera + + Sets the quality value to use if jpeg is a supported image for video format. + + Ignored if jpeg is not a supported image for video format. + + @param aQuality + The quality value to use, clamped to the range 1 to 100. + + @see CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize + */ + void SetJpegQuality(TInt aQuality); + + /** + from CCamera + + Gets the currently set jpeg quality value. + + Returns 0 if not supported. + + @return The currently set jpeg quality value. + + @see CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize) + */ + TInt JpegQuality() const; + + /** + from CCamera + + Gets a custom interface. The client has to cast the returned pointer + to the appropriate type. + + @param aInterface + The Uid of the particular interface function required. + + @return Custom interface pointer. NULL if the requested interface is not supported. + */ + TAny* CustomInterface(TUid aInterface); + + +private: + CWebCamera(); + void ConstructL(); + +private: // from MWebCameraActiveCallBack + /** + from MWebCameraActiveCallBack + + CallBack function of the Reserve + */ + virtual void ReserveCallBack(TInt aError); + + /** + from MWebCameraActiveCallBack + + CallBack function of the PowerOn + */ + virtual void PowerOnCallBack(TInt aError); + + /** + from MWebCameraActiveCallBack + + CallBack function of the ImageCapture + */ + virtual void ImageCaptureCallBackL(TInt aError); + +private: // from MWebCameraActiveCallBack + /** + from MWebCameraActiveCallBack + + CallBack function of the ViewFinder + */ + virtual void ViewFinderCallBack(TInt aError); + +private: + + RWebcameraDevice iDriver; ///< Camera driver. + MCameraObserver* iObserver; ///< The callback 'notify' party + MCameraObserver2* iObserver2; ///< The callback 'notify' party(V2). + CWebCameraActive* iActive; ///< For async demand. + CWebCameraVfActive* iVfActive; ///< For viewfinder. + CWebCameraAdvSet* iAdvSettingsImpl; ///< Expansion setting class. + + TCameraInfo iInfo; ///< Camera Information. + TInt iCameraIndex; ///< Camera Index. + TInt iCameraHandle; ///< Camera handle. + TInt iPriority; ///< priority. + + TBool iReserved; ///< Reserved Flag. + TBool iPowerOn; ///< PowerOn Flag. + TBool iImageCaptureActive;///< Flag during the still image . + + CWebCameraBuffer* iCaptureCameraBuf; ///< Camera buffer for capture. + CFbsBitmap* iCaptureBitmap; ///< Bitmap Data for capture. + HBufC8* iCaptureBuf; ///< Data buffer for capture. + TPtr8 iCaptureBufPtr; ///< pointer to Data buffer for capture. + + RArray iImageSizes; ///< Image size. + + RChunk iChunk; ///< For Chunk process . + RWebcameraDevice::TChunkInfo iChunkInfo; ///< Chunk Information. + TUint8* iChuckBase; + TInt iChunkRemSize; ///< Chunk size. + }; + + +class CWebCameraInfo : public CCameraInfoPlugin + { +public: + + /** + * Two-phased constructor. + */ + static CWebCameraInfo* NewL(); + + /**> Destructor */ + ~CWebCameraInfo(); + +// from CCameraInfoPlugin +public: + /** + from CCameraInfoPlugin + + Determines the number of cameras on the device. + + @return Count of cameras present on the device. + */ + TInt CamerasAvailable(); + +private: + CWebCameraInfo(); + }; + + +#endif // ECAMWEBCAMERAPLUGIN_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcamerapluginuids.hrh --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcamerapluginuids.hrh Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcamerapluginuids.hrh Tue Oct 19 11:48:59 2010 +0900 @@ -1,26 +1,26 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERAUIDS_HRH -#define ECAMWEBCAMERAUIDS_HRH - - -#define KUidOnboardWebCameraDll 0x10000001 -#define KUidOnboardWebCameraPlugin 0x10000002 -#define KUidOnboardWebCameraInfo 0x10000003 - -#endif // ECAMWEBCAMERAUIDS_HRH +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERAUIDS_HRH +#define ECAMWEBCAMERAUIDS_HRH + + +#define KUidOnboardWebCameraDll 0x10000001 +#define KUidOnboardWebCameraPlugin 0x10000002 +#define KUidOnboardWebCameraInfo 0x10000003 + +#endif // ECAMWEBCAMERAUIDS_HRH diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.cpp --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,246 +1,245 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#include "ecamwebcameravfactive.h" - -const TInt KVfWidth = 160; // viewfinder image width -const TInt KVfHeight = 120; // viewfinder image height -const TInt KVfLineBytes = KVfWidth * 3; // bytes of one line - -// -// CWebCameraVfActive -// -CWebCameraVfActive* CWebCameraVfActive::NewL(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver) - { - CWebCameraVfActive* self = new(ELeave) CWebCameraVfActive(aOwner, aDriver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -CWebCameraVfActive::CWebCameraVfActive(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver) - :CActive(CActive::EPriorityStandard), - iOwner(aOwner), - iDriver(aDriver), - iVfBufPtr(NULL, 0) - { - CActiveScheduler::Add(this); - } - -CWebCameraVfActive::~CWebCameraVfActive() - { - delete iVfBitmap; - delete iDSA; - delete iVfBuf; - } - -void CWebCameraVfActive::ConstructL() - { - } - -/** -* RunL. -*/ -void CWebCameraVfActive::RunL() - { - TInt wError = iStatus.Int(); - RDebug::Print(_L("CWebCameraVfActive::RunL wError = %d"), wError); - - if (iViewFinderActive) - { - //The whole view finder start repeats screen update and the data acquisition. - UpdateViewL(); - Start(); - } - } - -void CWebCameraVfActive::DoCancel() - { - iDriver.StopViewFinder(); - } - -/** -Starts transfer of view finder data to the given portion of the screen using -direct screen access. - -The aScreenRect parameter is in screen co-ordinates and may be modified if, -eg, the camera requires the destination to have a certain byte alignment, etc. - -@param aWs - Window server session. -@param aScreenDevice - Screen device. -@param aWindow - Displayable window. -@param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. -*/ -void CWebCameraVfActive::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect) - { - iScreenRect = aScreenRect; - iClipRect = aClipRect; - - // create buffer for view finder data - iVfBuf = HBufC8::NewL(KMaxBufSize); - - // create DirectScreenAccess - delete iDSA; - iDSA = NULL; - iViewFinderActive = EFalse; - iDSA = CDirectScreenAccess::NewL(aWs, aScreenDevice, aWindow, *this); - iDSA->StartL(); - iViewFinderActive = ETrue; - - iDSA->Gc()->SetOrigin(); - if (!iClipRect.IsEmpty()) - { - iDSA->Gc()->SetClippingRect(iClipRect); - } - - // start view finder - // The division transfer is going to support in the next version. - Start(); - } - -/** -Stops transfer of view finder data to the screen. -*/ -void CWebCameraVfActive::StopViewFinder() - { - if (!iViewFinderActive) - { - return; - } - - iViewFinderActive = EFalse; - - delete iDSA; - iDSA = NULL; - - delete iVfBuf; - iVfBuf = NULL; - - //Stop view finder - iDriver.StopViewFinder(); - Cancel(); - } - -/** -Queries whether the view finder is active. - -@return ETrue if the view finder is active. EFalse if the view finder is not - active. -*/ -TBool CWebCameraVfActive::ViewFinderActive() - { - return iViewFinderActive; - } - -/** -Start viewfinder process. -*/ -void CWebCameraVfActive::Start() - { - RDebug::Print(_L("CWebCameraVfActive::Start")); - - iVfBufPtr.Set(iVfBuf->Des()); - iVfBufPtr.SetLength(0); - //Start view finder - iDriver.StartViewFinder(iStatus, iVfBufPtr); - - SetActive(); - } - -/** -Draw the image of the view finder on screen. -*/ -void CWebCameraVfActive::UpdateViewL() - { - RDebug::Print(_L("CWebCameraVfActive::UpdateViewL")); - - delete iVfBitmap; - iVfBitmap = NULL; - - CFbsBitmap* image = new (ELeave) CFbsBitmap(); - CleanupStack::PushL(image); - User::LeaveIfError(image->Create(TSize(KVfWidth, KVfHeight), EColor16M)); - CleanupStack::Pop(image); - - iVfBitmap = image; - -// output received data log -// RDebug::Print(_L("CWebCameraVfActive::UpdateView iVfBufLength[%d]"), iVfBufPtr.Length()); -// TBuf<256> hexBuf; -// for (TInt i = 0; i < iVfBufPtr.Length(); i++) -// { -// hexBuf.AppendFormat(_L("%02X "), iVfBufPtr[i]); -// if ((i % 16) == 15) -// { -// RDebug::Print(hexBuf); -// hexBuf = KNullDesC; -// } -// } -// RDebug::Print(hexBuf); - - // convert buffer data to Bitmap - for (TInt height=0; heightMid(pos, KVfLineBytes); - TBuf8 buf; - buf.Copy(posptr); - iVfBitmap->SetScanLine(buf, (KVfHeight-1)-height); - } - - // view position setting for test application - iScreenRect.iTl.iY = 50; - iScreenRect.iBr.iY = 169; - - // update view - iDSA->Gc()->DrawBitmap(iScreenRect, iVfBitmap); - iDSA->ScreenDevice()->Update(); - } - -/** -from MAbortDirectScreenAccess - -This function is called by the window server when direct screen access must stop -(for example because a dialogue is moved in front of the area where direct screen access is taking place). - -@param aScreenDevice - The reason why direct screen access was terminated. -*/ -void CWebCameraVfActive::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) - { - } - -/** -from from MDirectScreenAccess - -This function is called by the window server as soon as direct screen access can resume. - -@param aScreenDevice - Provides the reason why direct screen access was terminated. -*/ -void CWebCameraVfActive::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) - { - } - +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#include "ecamwebcameravfactive.h" + + +// +// CWebCameraVfActive +// +CWebCameraVfActive* CWebCameraVfActive::NewL(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver) + { + CWebCameraVfActive* self = new(ELeave) CWebCameraVfActive(aOwner, aDriver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +CWebCameraVfActive::CWebCameraVfActive(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver) + :CActive(CActive::EPriorityStandard), + iOwner(aOwner), + iDriver(aDriver), + iVfBufPtr(NULL, 0) + { + CActiveScheduler::Add(this); + } + +CWebCameraVfActive::~CWebCameraVfActive() + { + delete iVfBitmap; + delete iDSA; + delete iVfBuf; + } + +void CWebCameraVfActive::ConstructL() + { + } + +/** +* RunL. +*/ +void CWebCameraVfActive::RunL() + { + TInt wError = iStatus.Int(); + + if (iViewFinderActive) + { + //The whole view finder start repeats screen update and the data acquisition. + UpdateViewL(); + Start(); + } + } + +void CWebCameraVfActive::DoCancel() + { + iDriver.StopViewFinder(); + } + + /** + */ +TInt CWebCameraVfActive::InitViewFinder() + { + return iDriver.InitViewFinder(); + } + +/** +Starts transfer of view finder data to the given portion of the screen using +direct screen access. + +The aScreenRect parameter is in screen co-ordinates and may be modified if, +eg, the camera requires the destination to have a certain byte alignment, etc. + +@param aWs + Window server session. +@param aScreenDevice + Screen device. +@param aWindow + Displayable window. +@param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. +@leave KErrGeneral Init error. +*/ +void CWebCameraVfActive::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect, TUint8* aChunkBase, TInt& aChunkSize) + { + + iScreenRect = aScreenRect; + iClipRect = aClipRect; + iChuckBase = aChunkBase; + + // create buffer for view finder data + iVfBuf = HBufC8::NewL(KMaxBufSize); + + // create DirectScreenAccess + delete iDSA; + iDSA = NULL; + iViewFinderActive = EFalse; + iDSA = CDirectScreenAccess::NewL(aWs, aScreenDevice, aWindow, *this); + iDSA->StartL(); + iViewFinderActive = ETrue; + + iDSA->Gc()->SetOrigin(); + if (!iClipRect.IsEmpty()) + { + iDSA->Gc()->SetClippingRect(iClipRect); + } + + // init camera device. + if (InitViewFinder() != KErrNone) + { + //TODO The error value is examined. + User::Leave(KErrGeneral); + } + delete iVfBitmap; + iVfBitmap = NULL; + + CFbsBitmap* image = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(image); + User::LeaveIfError(image->Create(TSize(KVfWidth, KVfHeight), EColor16M)); + CleanupStack::Pop(image); + + iVfBitmap = image; + + // start view finder + // The division transfer is going to support in the next version. + Start(); + } + +/** +Stops transfer of view finder data to the screen. +*/ +void CWebCameraVfActive::StopViewFinder() + { + if (!iViewFinderActive) + { + return; + } + + iViewFinderActive = EFalse; + + delete iDSA; + iDSA = NULL; + + delete iVfBuf; + iVfBuf = NULL; + + //Stop view finder + iDriver.StopViewFinder(); + Cancel(); + } + +/** +Queries whether the view finder is active. + +@return ETrue if the view finder is active. EFalse if the view finder is not + active. +*/ +TBool CWebCameraVfActive::ViewFinderActive() + { + return iViewFinderActive; + } + +/** +Start viewfinder process. +*/ +void CWebCameraVfActive::Start() + { + iDriver.StartViewFinder(iStatus, iChuckRemSize); + + SetActive(); + } + +/** +Draw the image of the view finder on screen. +*/ +void CWebCameraVfActive::UpdateViewL() + { + iVfBufPtr.Set(iVfBuf->Des()); + iVfBufPtr.SetLength(0); + iVfBufPtr.Copy(iChuckBase,iChuckRemSize); + BitmapDataSet(iVfBufPtr, *iVfBitmap); + + // view position setting for test application + iScreenRect.iTl.iY = 50; + iScreenRect.iBr.iY = 169; + // update view + iDSA->Gc()->DrawBitmap(iScreenRect, iVfBitmap); + iDSA->ScreenDevice()->Update(); + } + +/** +Bitmap data is set in CFbsBitmap. + +@param aBitmap [in] Bitmap data. + aVfBitmap [out] After Bitmap data is set in CFbsBitmap. +@return KErrNone. +*/ +TInt CWebCameraVfActive::BitmapDataSet(TDes8& aBitmap, CFbsBitmap& aVfBitmap) + { + TUint32 *wData = aVfBitmap.DataAddress(); + Mem::Copy(wData, aBitmap.Ptr(), (KVfHeight * KVfLineBytes)); + return KErrNone; + } + +/** +from MAbortDirectScreenAccess + +This function is called by the window server when direct screen access must stop +(for example because a dialogue is moved in front of the area where direct screen access is taking place). + +@param aScreenDevice + The reason why direct screen access was terminated. +*/ +void CWebCameraVfActive::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + } + +/** +from from MDirectScreenAccess + +This function is called by the window server as soon as direct screen access can resume. + +@param aScreenDevice + Provides the reason why direct screen access was terminated. +*/ +void CWebCameraVfActive::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) + { + } + diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.h --- a/mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/source/webcamera/ecamwebcameravfactive.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,132 +1,152 @@ -/* -* Copyright (c) 2010 ISB. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Symbian Foundation License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -* -* Initial Contributors: -* ISB - Initial contribution -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ECAMWEBCAMERAVFACTIVE_H -#define ECAMWEBCAMERAVFACTIVE_H - -#include "ecamwebcameraplugin.h" - -/** - * Perform a viewfinder function. - */ -class CWebCameraVfActive : public CActive - , public MDirectScreenAccess - { -public: - /** - * Two-phased constructor. - * @param aOwner pointer to callback object. - * @param aDriver reference to driver. - */ - static CWebCameraVfActive* NewL(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver); - - CWebCameraVfActive(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver); - - /**> Destructor */ - ~CWebCameraVfActive(); - - /** - Starts transfer of view finder data to the given portion of the screen using - direct screen access. - - The aScreenRect parameter is in screen co-ordinates and may be modified if, - eg, the camera requires the destination to have a certain byte alignment, etc. - - @param aWs - Window server session. - @param aScreenDevice - Screen device. - @param aWindow - Displayable window. - @param aScreenRect - Portion of the screen to which view finder data is to be - transferred. This is in screen co-ordinates and may be modified if, for example, - the camera requires the destination to have a certain byte alignment. - */ - void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect); - - /** - Stops transfer of view finder data to the screen. - */ - void StopViewFinder(); - - /** - Queries whether the view finder is active. - - @return ETrue if the view finder is active. EFalse if the view finder is not - active. - */ - TBool ViewFinderActive(); - -private: - /** - from MAbortDirectScreenAccess - - This function is called by the window server when direct screen access must stop - (for example because a dialogue is moved in front of the area where direct screen access is taking place). - - @param aScreenDevice - The reason why direct screen access was terminated. - */ - virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); - -private: - /** - from from MDirectScreenAccess - - This function is called by the window server as soon as direct screen access can resume. - - @param aScreenDevice - Provides the reason why direct screen access was terminated. - */ - virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason); - -private: - void ConstructL(); - - /** - Start viewfinder process. - */ - void Start(); - - /** - Draw the image of the view finder on screen. - */ - void UpdateViewL(); - -private: - void RunL(); - void DoCancel(); - -private: - MWebCameraVfActiveCallBack* iOwner; ///< origin of start. - TBool iViewFinderActive; ///< Status of viewfinder - RWebcameraDevice iDriver; ///< Camera driver - - CFbsBitmap* iVfBitmap; ///< Bitmap data of viewfinder. - HBufC8* iVfBuf; ///< Data buffer of viewfinder. - TPtr8 iVfBufPtr; ///< Pointer to data buffer of viewfinder. - - CDirectScreenAccess* iDSA; ///< DirectScreenAccess object. - TRect iScreenRect; ///< The region to draw. - TRect iClipRect; ///< The clipping region to draw. - - TBool iTestFlug; ///< for test - }; - - -#endif // ECAMWEBCAMERAPLUGIN_H +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ECAMWEBCAMERAVFACTIVE_H +#define ECAMWEBCAMERAVFACTIVE_H + +#include "ecamwebcameraplugin.h" + +const TInt KVfWidth = 640; // viewfinder image width +const TInt KVfHeight = 480; // viewfinder image height + +const TInt KVfLineBytes = KVfWidth * 3; // bytes of one line + +/** + * Perform a viewfinder function. + */ +class CWebCameraVfActive : public CActive + , public MDirectScreenAccess + { +public: + /** + * Two-phased constructor. + * @param aOwner pointer to callback object. + * @param aDriver reference to driver. + */ + static CWebCameraVfActive* NewL(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver); + + CWebCameraVfActive(MWebCameraVfActiveCallBack* aOwner, RWebcameraDevice& aDriver); + + /** + Destructor + */ + ~CWebCameraVfActive(); + + /** + Init ViewFinder. + */ + TInt InitViewFinder(); + + /** + Starts transfer of view finder data to the given portion of the screen using + direct screen access. + + The aScreenRect parameter is in screen co-ordinates and may be modified if, + eg, the camera requires the destination to have a certain byte alignment, etc. + + @param aWs + Window server session. + @param aScreenDevice + Screen device. + @param aWindow + Displayable window. + @param aScreenRect + Portion of the screen to which view finder data is to be + transferred. This is in screen co-ordinates and may be modified if, for example, + the camera requires the destination to have a certain byte alignment. + */ + void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect, TUint8* aChunkBase, TInt& aChunkSize); + + /** + Stops transfer of view finder data to the screen. + */ + void StopViewFinder(); + + /** + Queries whether the view finder is active. + + @return ETrue if the view finder is active. EFalse if the view finder is not + active. + */ + TBool ViewFinderActive(); + +private: + /** + from MAbortDirectScreenAccess + + This function is called by the window server when direct screen access must stop + (for example because a dialogue is moved in front of the area where direct screen access is taking place). + + @param aScreenDevice + The reason why direct screen access was terminated. + */ + virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); + +private: + /** + from from MDirectScreenAccess + + This function is called by the window server as soon as direct screen access can resume. + + @param aScreenDevice + Provides the reason why direct screen access was terminated. + */ + virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason); + +private: + void ConstructL(); + + /** + Start viewfinder process. + */ + void Start(); + + /** + Draw the image of the view finder on screen. + */ + void UpdateViewL(); + + /** + bitmap data set for CFbsBitmap. + */ + TInt BitmapDataSet(TDes8& aBitmap, CFbsBitmap& aVfBitmap); + +private: + void RunL(); + void DoCancel(); + +private: + MWebCameraVfActiveCallBack* iOwner; ///< origin of start. + TBool iViewFinderActive; ///< Status of viewfinder + RWebcameraDevice iDriver; ///< Camera driver + + CFbsBitmap* iVfBitmap; ///< Bitmap data of viewfinder. + HBufC8* iVfBuf; ///< Data buffer of viewfinder. + TPtr8 iVfBufPtr; ///< Pointer to data buffer of viewfinder. + + CDirectScreenAccess* iDSA; ///< DirectScreenAccess object. + TRect iScreenRect; ///< The region to draw. + TRect iClipRect; ///< The clipping region to draw. + + TBool iTestFlug; ///< for test + + TUint8* iChuckBase; ///< + TInt iChuckRemSize; ///< + }; + + +#endif // ECAMWEBCAMERAPLUGIN_H diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/group/BLD.INF --- a/mmplugins/cameraplugins/testapp/testcameraapps60/group/BLD.INF Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/group/BLD.INF Tue Oct 19 11:48:59 2010 +0900 @@ -1,28 +1,28 @@ -// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// On board camera API -// -// - - - -/** - @file -*/ - -PRJ_EXPORTS -../group/TestCameraApp.iby /epoc32/rom/include/TestCameraApp.iby - -PRJ_MMPFILES -../group/TestCameraAppS60.mmp +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// On board camera API +// +// + + + +/** + @file +*/ + +PRJ_EXPORTS +../group/TestCameraApp.iby /epoc32/rom/include/TestCameraApp.iby + +PRJ_MMPFILES +../group/TestCameraAppS60.mmp diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraApp.iby --- a/mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraApp.iby Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraApp.iby Tue Oct 19 11:48:59 2010 +0900 @@ -1,28 +1,28 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef __TESTCAMERAAPP_IBY__ -#define __TESTCAMERAAPP_IBY__ - -// Application -S60_APP_EXE(TestCameraApp) - -// Resources (not localised) -S60_APP_RESOURCE(TestCameraApp) - -// Application information files -S60_APP_AIF_RSC(TestCameraApp) - -#endif +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __TESTCAMERAAPP_IBY__ +#define __TESTCAMERAAPP_IBY__ + +// Application +S60_APP_EXE(TestCameraApp) + +// Resources (not localised) +S60_APP_RESOURCE(TestCameraApp) + +// Application information files +S60_APP_AIF_RSC(TestCameraApp) + +#endif diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraAppS60.mmp --- a/mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraAppS60.mmp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/group/TestCameraAppS60.mmp Tue Oct 19 11:48:59 2010 +0900 @@ -1,64 +1,65 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -TARGET TestCameraApp.exe -TARGETTYPE exe - -CAPABILITY ALL -TCB -//UID 0x100039CE 0x101F7D32 -UID 0x100039CE 0x101F857A -VENDORID 0x70000001 - -USERINCLUDE ../inc - -SYSTEMINCLUDE /epoc32/include -SYSTEMINCLUDE /epoc32/include/mw -SYSTEMINCLUDE /epoc32/include/platform -SYSTEMINCLUDE /epoc32/include/platform/mw - -SOURCEPATH ../src -SOURCE TestCameraApp.cpp - -START RESOURCE TestCameraApp.rss -HEADER -TARGETPATH /resource/apps -lang sc -END - -LIBRARY euser.lib fbscli.lib -LIBRARY apparc.lib ws32.lib cone.lib -LIBRARY avkon.lib -LIBRARY eikcore.lib -LIBRARY ecam.lib - - - -SOURCEPATH ../src -START RESOURCE testcameraapp_reg.rss -TARGETPATH /private/10003a3f/apps -END - -START RESOURCE testcameraapp_loc.RSS -TARGETPATH /resource/apps -lang sc -END - -START BITMAP TestCameraApp.mbm -HEADER -TARGETPATH /resource/apps -SOURCEPATH ../src -SOURCE c8 AP24.BMP AP24M.BMP AP32.BMP AP32M.BMP AP48.BMP AP48M.BMP -END - +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET TestCameraApp.exe +TARGETTYPE exe + +CAPABILITY ALL -TCB +//UID 0x100039CE 0x101F7D32 +UID 0x100039CE 0x101F857A +VENDORID 0x70000001 + +USERINCLUDE ../inc + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/mw +SYSTEMINCLUDE /epoc32/include/platform +SYSTEMINCLUDE /epoc32/include/platform/mw + +SOURCEPATH ../src +SOURCE TestCameraApp.cpp + +START RESOURCE TestCameraApp.rss +HEADER +TARGETPATH /resource/apps +lang sc +END + +LIBRARY euser.lib fbscli.lib +LIBRARY apparc.lib ws32.lib cone.lib +LIBRARY avkon.lib +LIBRARY eikcore.lib +LIBRARY ecam.lib +LIBRARY bitgdi.lib + + +SOURCEPATH ../src +START RESOURCE testcameraapp_reg.rss +TARGETPATH /private/10003a3f/apps +END + +START RESOURCE testcameraapp_loc.RSS +TARGETPATH /resource/apps +lang sc +END + +START BITMAP TestCameraApp.mbm +HEADER +TARGETPATH /resource/apps +SOURCEPATH ../src +SOURCE c8 AP24.BMP AP24M.BMP AP32.BMP AP32M.BMP AP48.BMP AP48M.BMP +END + +EPOCHEAPSIZE 0x1000 0x0400000 diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.h --- a/mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.h Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.h Tue Oct 19 11:48:59 2010 +0900 @@ -1,92 +1,94 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef __TESTCAMERAAPP_H__ -#define __TESTCAMERAAPP_H__ - -#include -#include -#include -#include - -#include - -//const TUid KUidTestCameraApp={ 268450181 }; -//const TUid KUidTestCameraApp={ 270499122 }; -//const TUid KUidTestCameraApp={ 0x101F7D32 }; -#define KUidTestCameraApp 0x101F857A - -// class CTCamAppView - -class CTCamAppView : public CCoeControl - { -public: - CTCamAppView(); - ~CTCamAppView(); - void ConstructL(const TRect& aRect); - void DrawImage(CFbsBitmap* aImage) const; - TPoint DrawBorders(const TSize& aSize) const; -private: - // from CCoeControl - void Draw(const TRect& /*aRect*/) const; - }; - -// CTCamAppUi - -class CTCamAppUi : public CAknAppUi, public MCameraObserver - { -public: - void ConstructL(); - ~CTCamAppUi(); -private: - // From CEikAppUi - virtual void HandleCommandL(TInt aCommand); - // New functions - void ViewFinderL(); - void CaptureImageL(); - void CaptureVideoL(); - // From MCameraObserver - virtual void ReserveComplete(TInt aError); - virtual void PowerOnComplete(TInt aError); - virtual void ViewFinderFrameReady(CFbsBitmap& aFrame); - virtual void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError); - virtual void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError); -private: - CCamera* iCamera; - CTCamAppView* iAppView; - }; - -// CTCamDocument - -class CTCamDocument : public CAknDocument - { -public: - CTCamDocument(CEikApplication& aApp); -private: - // from CEikDocument - CEikAppUi* CreateAppUiL(); - }; - -// CTCamApp - -class CTCamApp : public CAknApplication - { -private: - // from CApaApplication - CApaDocument* CreateDocumentL(); - TUid AppDllUid() const; - }; - -#endif +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __TESTCAMERAAPP_H__ +#define __TESTCAMERAAPP_H__ + +#include +#include +#include +#include + +#include + +//const TUid KUidTestCameraApp={ 268450181 }; +//const TUid KUidTestCameraApp={ 270499122 }; +//const TUid KUidTestCameraApp={ 0x101F7D32 }; +#define KUidTestCameraApp 0x101F857A + +// class CTCamAppView + +class CTCamAppView : public CCoeControl + { +public: + CTCamAppView(); + ~CTCamAppView(); + void ConstructL(const TRect& aRect); + void DrawImage(CFbsBitmap* aImage, TRect aScreenRect) const; + TPoint DrawBorders(const TSize& aSize) const; +private: + // from CCoeControl + void Draw(const TRect& /*aRect*/) const; + }; + +// CTCamAppUi + +class CTCamAppUi : public CAknAppUi, public MCameraObserver + { +public: + void ConstructL(); + ~CTCamAppUi(); +public: + TRect iScreenRect; +private: + // From CEikAppUi + virtual void HandleCommandL(TInt aCommand); + // New functions + void ViewFinderL(); + void CaptureImageL(); + void CaptureVideoL(); + // From MCameraObserver + virtual void ReserveComplete(TInt aError); + virtual void PowerOnComplete(TInt aError); + virtual void ViewFinderFrameReady(CFbsBitmap& aFrame); + virtual void ImageReady(CFbsBitmap* aBitmap,HBufC8* aData,TInt aError); + virtual void FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError); +private: + CCamera* iCamera; + CTCamAppView* iAppView; + }; + +// CTCamDocument + +class CTCamDocument : public CAknDocument + { +public: + CTCamDocument(CEikApplication& aApp); +private: + // from CEikDocument + CEikAppUi* CreateAppUiL(); + }; + +// CTCamApp + +class CTCamApp : public CAknApplication + { +private: + // from CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; + +#endif diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.hrh --- a/mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.hrh Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/inc/TestCameraApp.hrh Tue Oct 19 11:48:59 2010 +0900 @@ -1,29 +1,29 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -enum - { - ETCamCmdPowerOn=1, - ETCamCmdPowerOff, - ETCamCmdViewFinder, - ETCamCmdCaptureImage, - ETCamCmdCaptureVideo, - ETCamCmdIncBrightness, - ETCamCmdIncContrast, - ETCamCmdDecBrightness, - ETCamCmdDecContrast, - ETCamCmdResetBrightness, - ETCamCmdResetContrast - }; +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +enum + { + ETCamCmdPowerOn=1, + ETCamCmdPowerOff, + ETCamCmdViewFinder, + ETCamCmdCaptureImage, + ETCamCmdCaptureVideo, + ETCamCmdIncBrightness, + ETCamCmdIncContrast, + ETCamCmdDecBrightness, + ETCamCmdDecContrast, + ETCamCmdResetBrightness, + ETCamCmdResetContrast + }; diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/AIF.RSS --- a/mmplugins/cameraplugins/testapp/testcameraapps60/src/AIF.RSS Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/src/AIF.RSS Tue Oct 19 11:48:59 2010 +0900 @@ -1,33 +1,33 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include - -RESOURCE AIF_DATA - { - caption_list= - { - CAPTION { code=ELangEnglish; caption="TestCameraApp"; } - }; - // -// app_uid=268450181; - app_uid=0x101F857A; - // - num_icons=3; - // - hidden=KAppNotHidden; - embeddability=KAppNotEmbeddable; - newfile=KAppDoesNotSupportNewFile; - } +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +RESOURCE AIF_DATA + { + caption_list= + { + CAPTION { code=ELangEnglish; caption="TestCameraApp"; } + }; + // +// app_uid=268450181; + app_uid=0x101F857A; + // + num_icons=3; + // + hidden=KAppNotHidden; + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.cpp --- a/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.cpp Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.cpp Tue Oct 19 11:48:59 2010 +0900 @@ -1,389 +1,404 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include -#include -#include "TestCameraApp.h" -#include "TestCameraApp.hrh" - -const TInt KMaxErrLength=50; -_LIT(KErrorFormat,"Error - %d (%S)"); - -// -// CTCamAppUi -// - -void CTCamAppUi::ConstructL() - { - RDebug::Print(_L("CTCamAppUi::ConstructL()_S")); - - BaseConstructL(); - iAppView = new(ELeave) CTCamAppView; - iAppView->ConstructL(ClientRect()); - AddToStackL(iAppView); - - RDebug::Print(_L("CTCamAppUi::ConstructL() CCamera::NewL()_S")); - iCamera = CCamera::NewL(*this,0); - RDebug::Print(_L("CTCamAppUi::ConstructL() CCamera::NewL()_E")); - - RDebug::Print(_L("CTCamAppUi::ConstructL() iCamera->Reserve()_S")); - iCamera->Reserve(); - RDebug::Print(_L("CTCamAppUi::ConstructL() iCamera->Reserve()_E")); - - RDebug::Print(_L("CTCamAppUi::ConstructL()_E")); - } - -CTCamAppUi::~CTCamAppUi() - { - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi()_S")); - - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() iCamera->Release()_S")); - iCamera->Release(); - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() iCamera->Release()_E")); - - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() delete iCamera_S")); - delete iCamera; - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() delete iCamera_E")); - - if (iAppView) - { - RemoveFromStack(iAppView); - delete iAppView; - } - RDebug::Print(_L("CTCamAppUi::~CTCamAppUi()_E")); - } - -void CTCamAppUi::HandleCommandL(TInt aCommand) - { - switch (aCommand) - { - case ETCamCmdPowerOn: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdPowerOn)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOn()_S")); - iCamera->PowerOn(); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOn()_E")); - break; - - case ETCamCmdPowerOff: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdPowerOff)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOff()_S")); - iCamera->PowerOff(); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOff()_E")); - break; - - case ETCamCmdViewFinder: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdViewFinder)")); - - ViewFinderL(); - break; - - case ETCamCmdCaptureImage: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdCaptureImage)")); - - CaptureImageL(); - break; - - case ETCamCmdCaptureVideo: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdCaptureVideo)")); - - CaptureVideoL(); - break; - - case ETCamCmdIncBrightness: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdIncBrightness)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); - iCamera->SetBrightnessL(iCamera->Brightness() + 10); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); - break; - - case ETCamCmdIncContrast: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdIncContrast)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); - iCamera->SetContrastL(iCamera->Contrast() + 10); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); - break; - - case ETCamCmdDecBrightness: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdDecBrightness)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); - iCamera->SetBrightnessL(iCamera->Brightness() - 10); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); - break; - - case ETCamCmdDecContrast: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdDecContrast)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); - iCamera->SetContrastL(iCamera->Contrast() - 10); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); - break; - - case ETCamCmdResetBrightness: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdResetBrightness)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); - iCamera->SetBrightnessL(0); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); - break; - - case ETCamCmdResetContrast: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdResetContrast)")); - - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); - iCamera->SetContrastL(0); - RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); - break; - - case EAknSoftkeyBack: - RDebug::Print(_L("CTCamAppUi::HandleCommandL(EAknSoftkeyBack)")); - - Exit(); - break; - } - } - -void CTCamAppUi::ViewFinderL() - { - TSize imageSize; - - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->EnumerateCaptureSizes()_S")); - iCamera->EnumerateCaptureSizes(imageSize,1,CCamera::EFormatFbsBitmapColor16M); - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->EnumerateCaptureSizes()_E")); - - const TPoint pos = iAppView->DrawBorders(imageSize); - TRect screenRect(pos,imageSize); - TRect clipRect; - - if (!iCamera->ViewFinderActive()) - { - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StartViewFinderDirectL()_S")); - iCamera->StartViewFinderDirectL(iCoeEnv->WsSession(),*iCoeEnv->ScreenDevice(),*iAppView->DrawableWindow(),screenRect,clipRect); - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StartViewFinderDirectL()_E")); - } - else - { - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StopViewFinder()_S")); - iCamera->StopViewFinder(); - RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StopViewFinder()_E")); - } - } - -void CTCamAppUi::CaptureImageL() - { - TSize size; - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->EnumerateCaptureSizes()_S")); - iCamera->EnumerateCaptureSizes(size,1,CCamera::EFormatFbsBitmapColor16M); - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->EnumerateCaptureSizes()_E")); - - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->PrepareImageCaptureL()_S")); - iCamera->PrepareImageCaptureL(CCamera::EFormatFbsBitmapColor16M,1); - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->PrepareImageCaptureL()_E")); - - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->CaptureImage()_S")); - iCamera->CaptureImage(); - RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->CaptureImage()_E")); - } - -void CTCamAppUi::CaptureVideoL() - { - if (!iCamera->VideoCaptureActive()) - { - TSize size; - TReal32 rate = 0; - iCamera->EnumerateVideoFrameSizes(size,0,CCamera::EFormatFbsBitmapColor16M); - iCamera->EnumerateVideoFrameRates(rate,0,CCamera::EFormatFbsBitmapColor16M,0); - iCamera->PrepareVideoCaptureL(CCamera::EFormatFbsBitmapColor16M,0,0,2,1); - iCamera->StartVideoCapture(); - } - else - iCamera->StopVideoCapture(); - } - -void CTCamAppUi::ReserveComplete(TInt /*aError*/) - { - RDebug::Print(_L("CTCamAppUi::ReserveComplete()")); - } - -void CTCamAppUi::PowerOnComplete(TInt /*aError*/) - { - RDebug::Print(_L("CTCamAppUi::PowerOnComplete()")); - } - -void CTCamAppUi::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/) - { - } - -void CTCamAppUi::ImageReady(CFbsBitmap* aBitmap,HBufC8* /*aData*/,TInt aError) - { - RDebug::Print(_L("CTCamAppUi::ImageReady()_S")); - - TBuf msgBuffer; - _LIT(KErrMessage,"CTCamAppUi::ImageReady"); - if (aBitmap) - { - iAppView->DrawImage(aBitmap); - delete aBitmap; - } - if (aError) - { - msgBuffer.Format(KErrorFormat,aError,&KErrMessage); - iEikonEnv->InfoMsg(msgBuffer); - } - - RDebug::Print(_L("CTCamAppUi::ImageReady()_E")); - } - -void CTCamAppUi::FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError) - { - RDebug::Print(_L("CTCamAppUi::FrameBufferReady()_S")); - - TBuf msgBuffer; - _LIT(KErrMessage,"CTCamAppUi::FrameBufferReady"); - if (aError) - { - msgBuffer.Format(KErrorFormat,aError,&KErrMessage); - iEikonEnv->InfoMsg(msgBuffer); - return; - } - TRAPD(error,iAppView->DrawImage(aFrameBuffer->FrameL(0))); - aFrameBuffer->Release(); - if (error) - { - msgBuffer.Format(KErrorFormat,error,&KErrMessage); - iEikonEnv->InfoMsg(msgBuffer); - } - - RDebug::Print(_L("CTCamAppUi::FrameBufferReady()_E")); - } - -//_LIT(KContrastDialogTitle,"Contrast"); -//_LIT(KBrightnessDialogTitle,"Brightness"); - -// -// CTCamAppView -// - -CTCamAppView::CTCamAppView(): - CCoeControl() - {} - -void CTCamAppView::ConstructL(const TRect& aRect) - { - CreateWindowL(); - SetRect(aRect); - EnableDragEvents(); - ActivateL(); - } - -CTCamAppView::~CTCamAppView() - {} - -void CTCamAppView::DrawImage(CFbsBitmap* aImage) const - { - CWindowGc& gc = SystemGc(); - gc.Activate(Window()); - TRect drawRect(Rect()); - TPoint pos; - pos.iX = (drawRect.iBr.iX - aImage->SizeInPixels().iWidth) / 2; -// pos.iY = (drawRect.iBr.iY - aImage->SizeInPixels().iHeight) / 2; - pos.iY = ((drawRect.iBr.iY + 122) - aImage->SizeInPixels().iHeight) / 2; - gc.BitBlt(pos,aImage); - gc.Deactivate(); - iCoeEnv->WsSession().Flush(); - } - -void CTCamAppView::Draw(const TRect& /*aRect*/) const - { - CWindowGc& gc = SystemGc(); - TRect drawRect(Rect()); - drawRect.Shrink(1,1); - gc.DrawRect(drawRect); - gc.Clear(); - } - -TPoint CTCamAppView::DrawBorders(const TSize& aSize) const - { - CWindowGc& gc = SystemGc(); - gc.Activate(Window()); - TRect drawRect(Rect()); - TPoint pos; - pos.iX = (drawRect.iBr.iX - aSize.iWidth) / 2; -// pos.iY = (drawRect.iBr.iY - aSize.iHeight) / 2; - pos.iY = ((drawRect.iBr.iY + 122) - aSize.iHeight) / 2; - TRect border(pos,aSize); - border.Grow(1,1); - gc.SetPenColor(KRgbBlack); - gc.DrawRect(border); - gc.Deactivate(); - iCoeEnv->WsSession().Flush(); - return pos; - } - -// -// CTCamDocument -// - -CTCamDocument::CTCamDocument(CEikApplication& aApp) - : CAknDocument(aApp) - { - } - -CEikAppUi* CTCamDocument::CreateAppUiL() - { - RDebug::Print(_L("CTCamDocument::CreateAppUiL()")); - return (static_cast(new (ELeave) CTCamAppUi)); - } - -// -// CTCamApp -// - -TUid CTCamApp::AppDllUid() const - { - return TUid::Uid(KUidTestCameraApp); - } - -CApaDocument* CTCamApp::CreateDocumentL() - { -// return new(ELeave) CTCamDocument(*this); - RDebug::Print(_L("CTCamApp::CreateDocumentL()")); - return (static_cast(new(ELeave) CTCamDocument(*this))); - } - - -// -// Base factory function -// - -#include -LOCAL_C CApaApplication* NewApplication() - { - RDebug::Print(_L("CApaApplication* NewApplication()")); - return new CTCamApp; - } - -// -// EXE Entry point -// - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "TestCameraApp.h" +#include "TestCameraApp.hrh" + +const TInt KMaxErrLength=50; +_LIT(KErrorFormat,"Error - %d (%S)"); + +// +// CTCamAppUi +// + +void CTCamAppUi::ConstructL() + { + RDebug::Print(_L("CTCamAppUi::ConstructL()_S")); + + BaseConstructL(); + iAppView = new(ELeave) CTCamAppView; + iAppView->ConstructL(ClientRect()); + AddToStackL(iAppView); + + RDebug::Print(_L("CTCamAppUi::ConstructL() CCamera::NewL()_S")); + iCamera = CCamera::NewL(*this,0); + RDebug::Print(_L("CTCamAppUi::ConstructL() CCamera::NewL()_E")); + + RDebug::Print(_L("CTCamAppUi::ConstructL() iCamera->Reserve()_S")); + iCamera->Reserve(); + RDebug::Print(_L("CTCamAppUi::ConstructL() iCamera->Reserve()_E")); + + RDebug::Print(_L("CTCamAppUi::ConstructL()_E")); + } + +CTCamAppUi::~CTCamAppUi() + { + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi()_S")); + + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() iCamera->Release()_S")); + iCamera->Release(); + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() iCamera->Release()_E")); + + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() delete iCamera_S")); + delete iCamera; + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi() delete iCamera_E")); + + if (iAppView) + { + RemoveFromStack(iAppView); + delete iAppView; + } + RDebug::Print(_L("CTCamAppUi::~CTCamAppUi()_E")); + } + +void CTCamAppUi::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case ETCamCmdPowerOn: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdPowerOn)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOn()_S")); + iCamera->PowerOn(); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOn()_E")); + break; + + case ETCamCmdPowerOff: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdPowerOff)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOff()_S")); + iCamera->PowerOff(); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->PowerOff()_E")); + break; + + case ETCamCmdViewFinder: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdViewFinder)")); + + ViewFinderL(); + + break; + + case ETCamCmdCaptureImage: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdCaptureImage)")); + + CaptureImageL(); + break; + + case ETCamCmdCaptureVideo: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdCaptureVideo)")); + + CaptureVideoL(); + break; + + case ETCamCmdIncBrightness: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdIncBrightness)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); + iCamera->SetBrightnessL(iCamera->Brightness() + 10); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); + break; + + case ETCamCmdIncContrast: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdIncContrast)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); + iCamera->SetContrastL(iCamera->Contrast() + 10); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); + break; + + case ETCamCmdDecBrightness: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdDecBrightness)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); + iCamera->SetBrightnessL(iCamera->Brightness() - 10); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); + break; + + case ETCamCmdDecContrast: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdDecContrast)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); + iCamera->SetContrastL(iCamera->Contrast() - 10); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); + break; + + case ETCamCmdResetBrightness: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdResetBrightness)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_S")); + iCamera->SetBrightnessL(0); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetBrightnessL()_E")); + break; + + case ETCamCmdResetContrast: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(ETCamCmdResetContrast)")); + + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_S")); + iCamera->SetContrastL(0); + RDebug::Print(_L("CTCamAppUi::HandleCommandL() iCamera->SetContrastL()_E")); + break; + + case EAknSoftkeyBack: + RDebug::Print(_L("CTCamAppUi::HandleCommandL(EAknSoftkeyBack)")); + + Exit(); + break; + } + } + +void CTCamAppUi::ViewFinderL() + { + TSize imageSize; + + RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->EnumerateCaptureSizes()_S")); + iCamera->EnumerateCaptureSizes(imageSize,1,CCamera::EFormatFbsBitmapColor16M); + RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->EnumerateCaptureSizes()_E")); + + const TPoint pos = iAppView->DrawBorders(imageSize); + iScreenRect.SetRect(pos, imageSize); + + TRect clipRect; + + if (!iCamera->ViewFinderActive()) + { + iCamera->StartViewFinderDirectL(iCoeEnv->WsSession(),*iCoeEnv->ScreenDevice(),*iAppView->DrawableWindow(),iScreenRect, clipRect); + } + else + { +// RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StopViewFinder()_S")); +// iCamera->StopViewFinder(); +// RDebug::Print(_L("CTCamAppUi::ViewFinderL() iCamera->StopViewFinder()_E")); + } + } + +void CTCamAppUi::CaptureImageL() + { + TSize size; + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->EnumerateCaptureSizes()_S")); + iCamera->EnumerateCaptureSizes(size,1,CCamera::EFormatFbsBitmapColor16M); + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->EnumerateCaptureSizes()_E")); + + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->PrepareImageCaptureL()_S")); + iCamera->PrepareImageCaptureL(CCamera::EFormatFbsBitmapColor16M,1); + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->PrepareImageCaptureL()_E")); + + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->CaptureImage()_S")); + iCamera->CaptureImage(); + RDebug::Print(_L("CTCamAppUi::CaptureImageL() iCamera->CaptureImage()_E")); + } + +void CTCamAppUi::CaptureVideoL() + { + if (!iCamera->VideoCaptureActive()) + { + TSize size; + TReal32 rate = 0; + iCamera->EnumerateVideoFrameSizes(size,0,CCamera::EFormatFbsBitmapColor16M); + iCamera->EnumerateVideoFrameRates(rate,0,CCamera::EFormatFbsBitmapColor16M,0); + iCamera->PrepareVideoCaptureL(CCamera::EFormatFbsBitmapColor16M,0,0,2,1); + iCamera->StartVideoCapture(); + } + else + iCamera->StopVideoCapture(); + } + +void CTCamAppUi::ReserveComplete(TInt /*aError*/) + { + RDebug::Print(_L("CTCamAppUi::ReserveComplete()")); + } + +void CTCamAppUi::PowerOnComplete(TInt /*aError*/) + { + RDebug::Print(_L("CTCamAppUi::PowerOnComplete()")); + } + +void CTCamAppUi::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/) + { + } + +void CTCamAppUi::ImageReady(CFbsBitmap* aBitmap,HBufC8* /*aData*/,TInt aError) + { + RDebug::Print(_L("CTCamAppUi::ImageReady()_S")); + + TBuf msgBuffer; + _LIT(KErrMessage,"CTCamAppUi::ImageReady"); + if (aBitmap) + { + iAppView->DrawImage(aBitmap, iScreenRect); + } + if (aError) + { + msgBuffer.Format(KErrorFormat,aError,&KErrMessage); + iEikonEnv->InfoMsg(msgBuffer); + } + + RDebug::Print(_L("CTCamAppUi::ImageReady()_E")); + } + +void CTCamAppUi::FrameBufferReady(MFrameBuffer* aFrameBuffer,TInt aError) + { + RDebug::Print(_L("CTCamAppUi::FrameBufferReady()_S")); + + TBuf msgBuffer; + _LIT(KErrMessage,"CTCamAppUi::FrameBufferReady"); + if (aError) + { + msgBuffer.Format(KErrorFormat,aError,&KErrMessage); + iEikonEnv->InfoMsg(msgBuffer); + return; + } + TRAPD(error,iAppView->DrawImage(aFrameBuffer->FrameL(0), iScreenRect)); + aFrameBuffer->Release(); + if (error) + { + msgBuffer.Format(KErrorFormat,error,&KErrMessage); + iEikonEnv->InfoMsg(msgBuffer); + } + + RDebug::Print(_L("CTCamAppUi::FrameBufferReady()_E")); + } + +//_LIT(KContrastDialogTitle,"Contrast"); +//_LIT(KBrightnessDialogTitle,"Brightness"); + +// +// CTCamAppView +// + +CTCamAppView::CTCamAppView(): + CCoeControl() + {} + +void CTCamAppView::ConstructL(const TRect& aRect) + { + CreateWindowL(); + SetRect(aRect); + EnableDragEvents(); + ActivateL(); + } + +CTCamAppView::~CTCamAppView() + {} + +void CTCamAppView::DrawImage(CFbsBitmap* aImage, TRect aScreenRect) const + { + RDebug::Print(_L("aImage->DataAddress() = %d"),aImage->DataAddress()); + // view position setting for test application + RDebug::Print(_L("Set view position_S")); + TRect wRect = aScreenRect; + wRect.iTl.iY = 123; + wRect.iBr.iY = 244; + + RDebug::Print(_L("Set view position_E")); + // draw bitmap + CWindowGc& gc = SystemGc(); + if (IsReadyToDraw()) + { + gc.Activate(Window()); + TBool back = IsBackedUp(); + if (!back) + { + Window().Invalidate(wRect); + Window().BeginRedraw(wRect); + } + gc.DrawBitmap(wRect, aImage); + if (!back) + { + Window().EndRedraw(); + } + gc.Deactivate(); + } + iCoeEnv->WsSession().Flush(); + } + +void CTCamAppView::Draw(const TRect& /*aRect*/) const + { + CWindowGc& gc = SystemGc(); + TRect drawRect(Rect()); + drawRect.Shrink(1,1); + gc.DrawRect(drawRect); + gc.Clear(); + } + +TPoint CTCamAppView::DrawBorders(const TSize& aSize) const + { + CWindowGc& gc = SystemGc(); + gc.Activate(Window()); + TRect drawRect(Rect()); + TPoint pos; + pos.iX = (drawRect.iBr.iX - aSize.iWidth) / 2; + pos.iY = ((drawRect.iBr.iY + 122) - aSize.iHeight) / 2; + TRect border(pos,aSize); + border.Grow(1,1); + gc.SetPenColor(KRgbBlack); + gc.DrawRect(border); + gc.Deactivate(); + iCoeEnv->WsSession().Flush(); + return pos; + } + +// +// CTCamDocument +// + +CTCamDocument::CTCamDocument(CEikApplication& aApp) + : CAknDocument(aApp) + { + } + +CEikAppUi* CTCamDocument::CreateAppUiL() + { + RDebug::Print(_L("CTCamDocument::CreateAppUiL()")); + return (static_cast(new (ELeave) CTCamAppUi)); + } + +// +// CTCamApp +// + +TUid CTCamApp::AppDllUid() const + { + return TUid::Uid(KUidTestCameraApp); + } + +CApaDocument* CTCamApp::CreateDocumentL() + { +// return new(ELeave) CTCamDocument(*this); + RDebug::Print(_L("CTCamApp::CreateDocumentL()")); + return (static_cast(new(ELeave) CTCamDocument(*this))); + } + + +// +// Base factory function +// + +#include +LOCAL_C CApaApplication* NewApplication() + { + RDebug::Print(_L("CApaApplication* NewApplication()")); + return new CTCamApp; + } + +// +// EXE Entry point +// + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.rss --- a/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.rss Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp.rss Tue Oct 19 11:48:59 2010 +0900 @@ -1,75 +1,75 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -NAME TCAM - -#include -#include -#include -#include - -#include "TestCameraApp.hrh" - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - -RESOURCE EIK_APP_INFO - { - menubar=r_tcam_menubar; - cba=R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -RESOURCE MENU_BAR r_tcam_menubar - { - titles= - { - MENU_TITLE { menu_pane=r_tcam_main_menu; txt="Options"; } - }; - } - -RESOURCE MENU_BAR r_tcam_main_menu - { - titles= - { - MENU_ITEM { cascade=r_tcam_control_menu; txt="Control"; }, - MENU_ITEM { cascade=r_tcam_settings_menu; txt="Settings"; } - }; - } - -RESOURCE MENU_PANE r_tcam_control_menu - { - items= - { - MENU_ITEM { command=ETCamCmdPowerOn; txt="Power on"; }, - MENU_ITEM { command=ETCamCmdPowerOff; txt="Power off"; }, - MENU_ITEM { command=ETCamCmdViewFinder; txt="View finder"; }, - MENU_ITEM { command=ETCamCmdCaptureImage; txt="Capture image"; }, - MENU_ITEM { command=ETCamCmdCaptureVideo; txt="Toggle video"; } - }; - } - -RESOURCE MENU_PANE r_tcam_settings_menu - { - items= - { - MENU_ITEM { command=ETCamCmdIncContrast; txt="Contrast+"; }, - MENU_ITEM { command=ETCamCmdDecContrast; txt="Contrast-"; }, - MENU_ITEM { command=ETCamCmdResetContrast; txt="Reset contrast"; }, - MENU_ITEM { command=ETCamCmdIncBrightness; txt="Brightness+"; }, - MENU_ITEM { command=ETCamCmdDecBrightness; txt="Brightness-"; }, - MENU_ITEM { command=ETCamCmdResetBrightness; txt="Reset brightness"; } - }; - } +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +NAME TCAM + +#include +#include +#include +#include + +#include "TestCameraApp.hrh" + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +RESOURCE EIK_APP_INFO + { + menubar=r_tcam_menubar; + cba=R_AVKON_SOFTKEYS_OPTIONS_BACK; + } + +RESOURCE MENU_BAR r_tcam_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_tcam_main_menu; txt="Options"; } + }; + } + +RESOURCE MENU_BAR r_tcam_main_menu + { + titles= + { + MENU_ITEM { cascade=r_tcam_control_menu; txt="Control"; }, + MENU_ITEM { cascade=r_tcam_settings_menu; txt="Settings"; } + }; + } + +RESOURCE MENU_PANE r_tcam_control_menu + { + items= + { + MENU_ITEM { command=ETCamCmdPowerOn; txt="Power on"; }, + MENU_ITEM { command=ETCamCmdPowerOff; txt="Power off"; }, + MENU_ITEM { command=ETCamCmdViewFinder; txt="View finder"; }, + MENU_ITEM { command=ETCamCmdCaptureImage; txt="Capture image"; }, + MENU_ITEM { command=ETCamCmdCaptureVideo; txt="Toggle video"; } + }; + } + +RESOURCE MENU_PANE r_tcam_settings_menu + { + items= + { + MENU_ITEM { command=ETCamCmdIncContrast; txt="Contrast+"; }, + MENU_ITEM { command=ETCamCmdDecContrast; txt="Contrast-"; }, + MENU_ITEM { command=ETCamCmdResetContrast; txt="Reset contrast"; }, + MENU_ITEM { command=ETCamCmdIncBrightness; txt="Brightness+"; }, + MENU_ITEM { command=ETCamCmdDecBrightness; txt="Brightness-"; }, + MENU_ITEM { command=ETCamCmdResetBrightness; txt="Reset brightness"; } + }; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_loc.RSS --- a/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_loc.RSS Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_loc.RSS Tue Oct 19 11:48:59 2010 +0900 @@ -1,30 +1,30 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include - -RESOURCE LOCALISABLE_APP_INFO - { - short_caption = "TestCamera"; - caption_and_icon = - { - CAPTION_AND_ICON_INFO - { - caption="TestCameraAPP"; - number_of_icons=3; - icon_file="z:\\resource\\apps\\testcameraapp.mbm"; - } - }; - } +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +RESOURCE LOCALISABLE_APP_INFO + { + short_caption = "TestCamera"; + caption_and_icon = + { + CAPTION_AND_ICON_INFO + { + caption="TestCameraAPP"; + number_of_icons=3; + icon_file="z:\\resource\\apps\\testcameraapp.mbm"; + } + }; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_reg.rss --- a/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_reg.rss Thu Mar 25 11:21:36 2010 +0900 +++ b/mmplugins/cameraplugins/testapp/testcameraapps60/src/TestCameraApp_reg.rss Tue Oct 19 11:48:59 2010 +0900 @@ -1,34 +1,34 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// TestCameraApp application's registration resource file -// -// - -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x101F857A - -RESOURCE APP_REGISTRATION_INFO - { - app_file="TestCameraApp"; - // - localisable_resource_file="\\resource\\apps\\TestCameraApp_loc"; - localisable_resource_id = 0x5bf50006; - // - hidden=KAppNotHidden; - embeddability=KAppNotEmbeddable; - newfile=KAppDoesNotSupportNewFile; - } +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestCameraApp application's registration resource file +// +// + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x101F857A + +RESOURCE APP_REGISTRATION_INFO + { + app_file="TestCameraApp"; + // + localisable_resource_file="\\resource\\apps\\TestCameraApp_loc"; + localisable_resource_id = 0x5bf50006; + // + hidden=KAppNotHidden; + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } diff -r 9ae0fe04e757 -r 92a82bc706f7 mmplugins/cameraplugins/testapp/testcameraapps60/src/webcamapi.dll Binary file mmplugins/cameraplugins/testapp/testcameraapps60/src/webcamapi.dll has changed