--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+ <!ENTITY layer_real_source_path "sf/app/videotelephony" >
+]>
+
+<SystemDefinition name="videotelephony" schema="1.5.1">
+ <systemModel>
+ <layer name="app_layer">
+ <module name="videotelephony">
+ <unit name="videotelephony_plat" unitID="tedo.videotelephony_plat" bldFile="&layer_real_source_path;/videotelephony_plat/group" mrp="" />
+ <unit name="PacketVideoEngine" unitID="tedo.PacketVideoEngine" bldFile="&layer_real_source_path;/packetvideoengine/group" mrp="" filter="!sf_build" />
+ <unit name="vtprotocolsstub" unitID="tedo.vtprotocolsstub" bldFile="&layer_real_source_path;/vtprotocolsstub/group" mrp="" filter="sf_build" />
+ <unit name="vtprotocols" unitID="tedo.vtprotocols" bldFile="&layer_real_source_path;/vtprotocols/group" mrp="" filter="!sf_build" />
+ <unit name="vtprotocolplugins" unitID="tedo.vtprotocolplugins" bldFile="&layer_real_source_path;/vtprotocolplugins/group" mrp="" />
+ <unit name="vtengines" unitID="tedo.vtengines" bldFile="&layer_real_source_path;/vtengines/Group" mrp="" />
+ <unit name="lcvtplugin" unitID="tedo.lcvtplugin" bldFile="&layer_real_source_path;/vtuis/lcvtplugin/group" mrp="" />
+ <unit name="lcvtapp" unitID="tedo.lcvtapp" bldFile="&layer_real_source_path;/vtuis/lcvtapp" mrp="" proFile="lcvtapp.pro" />
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lcvtplugin.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,16 @@
+; Languages
+;
+&EN
+
+; Header
+#{"lcvtplugin patch"}, (0xF0112235), 1, 0, 0, TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\udeb\lcvtengineplugin.dll" - "!:\sys\bin\lcvtengineplugin.dll"
+"\epoc32\data\Z\Resource\Plugins\lcvtengineplugin.RSC"-"!:\resource\plugins\lcvtengineplugin.RSC"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videosource.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,29 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videosource"}, (0x101F8692), 1, 0, 0, TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\udeb\videosource.dll" - "!:\sys\bin\videosource.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoteleng.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,17 @@
+; Languages
+;
+&EN
+
+; Header
+#{"videoteleng patch"}, (0x101F867F), 1, 0, 0, TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\udeb\videoteleng.dll" - "!:\sys\bin\videoteleng.dll"
+"\epoc32\release\armv5\urel\cscallctrl.dll" - "!:\sys\bin\cscallctrl.dll"
+"\epoc32\release\armv5\urel\vtlogger.dll" - "!:\sys\bin\vtlogger.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony.pro Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,30 @@
+# Copyright (c) 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:
+#
+#
+
+TEMPLATE = subdirs
+CONFIG += ordered
+
+symbian: {
+
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"packetvideoengine/group/bld.inf\""
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"vtprotocols/group/bld.inf\""
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"vtprotocolplugins/group/bld.inf\""
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"vtengines/group/bld.inf\""
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"vtuis/lcvtplugin/group/bld.inf\""
+ :BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videotelephony_plat/group/bld.inf\""
+}
+
+SUBDIRS += vtuis/lcvtapp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2006 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: Includes all the Domain API specific bld.inf files, which
+* export files.
+*
+*/
+
+
+
+#include "../video_telephony_media_configuration_api/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_media_configuration_api/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 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: File that exports the files belonging to
+: Video Telephony Media Configuration API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/VideoTelephonyDomainPSKeys.h APP_LAYER_PLATFORM_EXPORT_PATH(videotelephonydomainpskeys.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_media_configuration_api/inc/VideoTelephonyDomainPSKeys.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 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: Video Telephony Domain Publish and Subscribe keys.
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYDOMAINPSKEYS_H
+#define VIDEOTELEPHONYDOMAINPSKEYS_H
+
+#include <e32std.h>
+
+
+// CONSTANTS
+
+/**
+* Media Configuration API for video telephony.
+*/
+const TUid KPSUidVTMediaConfiguration = {0x1020736A};
+
+/**
+* Preferred camera that the application should use as source.
+* @type RProperty::EInt
+*/
+const TUint32 KPSPreferredCamera = 0x00000000;
+enum EPSPreferredCamera
+ {
+ EPSPreferredCameraUnknown,
+ EPSPreferredCameraInwards,
+ EPSPreferredCameraOutwards
+ };
+
+
+#endif // VIDEOTELEPHONYDOMAINPSKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_media_configuration_api/video_telephony_media_configuration_api.metaxml Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="427f4a40c8f79845b018f1dccadea15f" dataversion="2.0">
+ <name>Video Telephony Media Configuration API</name>
+ <description>An interface to access transient (run-time) media configuration related to video telephony, e.g. preferred camera in VT.</description>
+ <type>c++</type>
+ <collection>vtengines</collection>
+ <libs>
+ </libs>
+ <release category="platform"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>no</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelui.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videotelui"}, (0x101F8681), 1, 0, 0, TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\urel\videotelui.exe" - "!:\sys\bin\videotelui.exe"
+"\epoc32\data\z\resource\apps\videotelui.rsc"-"!:\resource\apps\videotelui.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\videotelui_reg.rsc"-"!:\private\10003a3f\import\apps\videotelui_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004 - 2006 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: Build information for Vtengines subsystem.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Include components' bld.inf files
+#include "../videoteleng/Group/bld.inf"
+#include "../vtmediatorplugin/group/bld.inf"
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Bmarm/VIDEOTELENGU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+ Audio__C11CVtEngModel @ 1 NONAME R3UNUSED ; CVtEngModel::Audio(void) const
+ CommandHandler__C11CVtEngModel @ 2 NONAME R3UNUSED ; CVtEngModel::CommandHandler(void) const
+ Extension__FRC4TUid @ 3 NONAME R3UNUSED ; Extension(TUid const &)
+ Media__C11CVtEngModel @ 4 NONAME R3UNUSED ; CVtEngModel::Media(void) const
+ NewL__11CVtEngModelR19MVtEngEventObserverR21MVtEngCommandObserver @ 5 NONAME R3UNUSED ; CVtEngModel::NewL(MVtEngEventObserver &, MVtEngCommandObserver &)
+ Session__C11CVtEngModel @ 6 NONAME R3UNUSED ; CVtEngModel::Session(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Bmarm/CSCALLCTRLU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ CreateFactory__Fv @ 1 NONAME R3UNUSED ; CreateFactory(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Bwins/CSCALLCTRLU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateFactory@@YAPAVCVtCtlFactory@@XZ @ 1 NONAME ; class CVtCtlFactory * __cdecl CreateFactory(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/EABI/CSCallCtrlU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z13CreateFactoryv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2004 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: videocallctrl build information file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+../Group/videocallctrl.mmp
+
+//PRJ_TESTMMPFILES
+// CsCallCtrl CVT case.
+//../tsrc/group/CsCallCtrl_CVT_Test.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Group/videocallctrl.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2004 - 2006 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: This is project specification file for the Video Call Control.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../Inc/VtCtlConfig.hrh"
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET cscallctrl.dll
+TARGETTYPE dll
+UID 0x1000008d 0x101F867F
+
+SOURCEPATH ../Src
+SOURCE CVtCtlFactory.cpp
+#if defined VTCALLCONTROLSTUB
+// call state connected, previous state alerting
+SOURCE CVtCtlCallControlStub.cpp
+DOCUMENT CVtCtlCallControl.cpp
+#else
+SOURCE CVtCtlCallControl.cpp
+DOCUMENT CVtCtlCallControlStub.cpp
+#endif
+SOURCE CVtCtlSessionContainer.cpp
+SOURCE CVtCtlCallStatusMonitor.cpp
+SOURCE CVtCtlLineMonitor.cpp
+SOURCE CVtCtlVideoCall.cpp
+SOURCE VtCtlPanic.cpp
+
+DOCUMENT ../Group/bld.inf
+
+USERINCLUDE ../Inc
+SYSTEMINCLUDE ../../../../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY etel.lib
+LIBRARY etelmm.lib
+DEBUGLIBRARY vtlogger.lib
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallControl.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2004 - 2007 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: Call control
+*
+*/
+
+
+
+#ifndef CVTCTLCALLCONTROL_H
+#define CVTCTLCALLCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtCtlCallControl.h"
+#include "MVtCtlCallStatusObserver.h"
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+class MVtCtlEventObserver;
+class CVtCtlSessionContainer;
+
+// CLASS DECLARATION
+
+/**
+* Call control implementation.
+*
+* @lib CSCallCtrl.lib
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlCallControl ) :
+ public CBase,
+ public MVtCtlCallControl,
+ public MVtCtlCallStatusObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aEventObserver reference to event observer
+ * @param aCommandObserver reference to command observer
+ * @return call control
+ */
+ static CVtCtlCallControl* NewL(
+ MVtCtlEventObserver& aEventObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtCtlCallControl();
+
+ public: // From MVtCtlCallControl
+
+ /**
+ * @see MVtCtlCallControl::GetDuration
+ */
+ virtual TInt GetDuration(
+ TVtCtlSessionId aId,
+ TVtCtlDuration& aDuration );
+
+
+ /**
+ * @see MVtCtlCallControl::GetSessionInfoL
+ */
+ virtual void GetSessionInfoL(
+ TVtCtlSessionId aId,
+ TDes8& aInfo );
+
+ /**
+ * @see MVtCtlCallControl::GetSessionState
+ */
+ virtual TVtCtlState GetSessionState(
+ TVtCtlSessionId aId ) const;
+
+ /**
+ * @see MVtCtlCallControl::GetPreviousPreviousState
+ */
+ virtual TVtCtlState GetPreviousPreviousState(
+ TVtCtlSessionId aId ) const;
+
+ public: // from MVtCtlCallStatusObserver
+
+ /**
+ * @see MVtCtlCallStatusObserver::HandleCallStatusChangeL
+ */
+ virtual void HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus );
+
+ private:
+
+ /**
+ * C++ constructor.
+ */
+ CVtCtlCallControl(
+ MVtCtlEventObserver& aEventObserver );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private:
+
+ /**
+ * Validates that data passed as descriptor is of
+ * correct type. If not leaves KErrNotSupported.
+ * @param aData TVtCtlType derived class represented as descriptor
+ * @param aExtension expected type
+ */
+ static void ValidateDataExtensionL(
+ TDesC8& aData,
+ TInt aExtension );
+
+ private: // Data
+
+ // Event observer
+ MVtCtlEventObserver& iEventObserver;
+
+ // Container for ETel sessions
+ CVtCtlSessionContainer* iContainer;
+ };
+
+#endif // CVTCTLCALLCONTROL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallStatusMonitor.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2004 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: Monitors call status.
+*
+*/
+
+
+
+#ifndef CVTCTLCALLSTATUSMONITOR_H
+#define CVTCTLCALLSTATUSMONITOR_H
+
+// INCLUDES
+
+#include "MVtCtlCallControl.h"
+#include <e32base.h>
+#include <etelmm.h>
+
+/**
+* Array for resolving call status (TMobileCallStatus) transition validity.
+* Transition to lower value is not possible with exception to 0 priority
+* (always possible to go to idle state). Initial state is EStatusUnknown.
+*/
+static const TInt KVtCtlStatusTransitionPriorities[] =
+ {
+ 1, // EStatusUnknown
+ 0, // EStatusIdle, possible from any
+ 2, // EStatusDialling
+ 2, // EStatusRinging
+ 3, // EStatusAnswering
+ 3, // EStatusConnecting
+ 4, // EStatusConnected
+ 5, // EStatusDisconnecting
+ // Status values below are not valid in video calls => should not happen.
+ 5, // EStatusDisconnectingWithInband
+ 0, // EStatusReconnectPending
+ 0, // EStatusHold
+ 0, // EStatusWaitingAlternatingCallSwitch
+ 0, // EStatusTransferring
+ 0 // EStatusTransferAlerting
+ };
+
+// FORWARD DECLARATIONS
+class MVtCtlCallStatusObserver;
+
+// CLASS DECLARATION
+
+/**
+* Monitor for call status
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlCallStatusMonitor ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ * @param aCall call subsession
+ * @param aObserver call status observer
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ CVtCtlCallStatusMonitor(
+ RMobileCall& aCall,
+ MVtCtlCallStatusObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtCtlCallStatusMonitor();
+
+ public: // New functions
+
+ /**
+ * Starts monitoring
+ */
+ void Start();
+
+ private: // From CActive
+
+ /**
+ * Cancel monitoring.
+ */
+ virtual void DoCancel();
+
+ /**
+ * Handles call status change.
+ */
+ virtual void RunL();
+
+ /**
+ * Handles leave in RunL.
+ * @param aError error code
+ * @return KErrNone
+ */
+ virtual TInt RunError( TInt aError );
+
+ public: // New functions
+
+ /**
+ * Maps Etel status to internal state
+ * @param aStatus mobile call status
+ * @return session state, see TVtCtlState
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ static MVtCtlCallControl::TVtCtlState MapState(
+ const RMobileCall::TMobileCallStatus aStatus );
+
+ /**
+ * Checks if call state transition specified by arguments is legal.
+ * @param aNewState proposed new call state
+ * @param aCurrentState current call state
+ * @return ETrue if transition is valid
+ */
+ static TBool IsLegalNewState(
+ const RMobileCall::TMobileCallStatus aNewState,
+ const RMobileCall::TMobileCallStatus aCurrentState );
+
+ private: // Data
+
+ // Data call
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileCall& iCall;
+
+ // Observer for call status changes
+ MVtCtlCallStatusObserver& iObserver;
+
+ // Call status and previous status
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileCall::TMobileCallStatus iCallStatus;
+ RMobileCall::TMobileCallStatus iPreviousStatus;
+ };
+
+#endif // CVTCTLCALLSTATUSMONITOR_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlFactory.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2004 - 2007 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: Factory for creating call control
+*
+*/
+
+
+
+#ifndef CVTCTLFACTORY_H
+#define CVTCTLFACTORY_H
+
+// INCLUDES
+#include <e32base.h>
+#include "VtCtlDefs.h"
+
+// CONSTANTS
+_LIT( KVtCtlLibraryName, "CSCallCtrl" );
+
+// FORWARD DECLARATIONS
+class MVtCtlEventObserver;
+class MVtCtlCommandObserver;
+class MVtCtlCallControl;
+
+/**
+* Factory class for instantiating call control.
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlFactory ) : public CBase
+ {
+ public:
+
+ /**
+ * Instantiates call control
+ * @param aEventObserver
+ * @param aCommandObserver
+ * @return call control
+ */
+ virtual MVtCtlCallControl* CreateCallControlL(
+ MVtCtlEventObserver& aEventObserver );
+
+ /**
+ * Destructs call control created with CreateCallControlL.
+ * @param aCallControl pointer to call control instance
+ */
+ virtual void Delete( MVtCtlCallControl* aCallControl );
+ };
+
+/**
+* Creates call control factory
+* @return factory
+*/
+IMPORT_C CVtCtlFactory* CreateVtCtlFactory();
+
+#endif // CVTCTLFACTORY_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlLineMonitor.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2004 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: Monitors new calls on data line.
+*
+*/
+
+
+
+#ifndef CVTCTLLINEMONITOR_H
+#define CVTCTLLINEMONITOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+
+class MVtCtlLineEventObserver;
+
+// CLASS DECLARATION
+
+/**
+* Monitor for new calls
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlLineMonitor ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ * @param aLine line subsession
+ * @param aObserver line event observer
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ CVtCtlLineMonitor(
+ RMobileLine& aLine,
+ MVtCtlLineEventObserver& aObserver);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtCtlLineMonitor();
+
+ public: // New functions
+
+ /**
+ * Starts monitoring
+ */
+ void Start();
+
+ private: // Functions from CActive
+
+ /**
+ * Cancel monitoring.
+ */
+ virtual void DoCancel();
+
+ /**
+ * Handles new call on line.
+ */
+ virtual void RunL();
+
+ /**
+ * Error handler for leave in RunL
+ * @param aError error code
+ * @return KErrNone
+ */
+ virtual TInt RunError( TInt aError );
+
+ private: // Data
+
+ // Data line
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileLine& iLine;
+
+ // Observer for new calls on line
+ MVtCtlLineEventObserver& iObserver;
+
+ // Call name
+ TName iName;
+
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileCall::TMobileCallStatus iLastLineStatus;
+ RMobileCall::TMobileCallStatus iLineStatus;
+ };
+
+#endif // CVTCTLLINEMONITOR_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlSessionContainer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2004 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: Container for ETel session and subsessions
+*
+*/
+
+
+
+#ifndef CVTCTLSESSIONCONTAINER_H
+#define CVTCTLSESSIONCONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+#include "MVtCtlLineEventObserver.h"
+#include "MVtCtlCallStatusObserver.h"
+#include "MVtCtlCallControl.h"
+
+// FORWARD DECLARATIONS
+class CVtCtlLineMonitor;
+class CVtCtlCallMonitor;
+class CVtCtlVideoCall;
+
+// CLASS DECLARATION
+
+/**
+* Container for ETel (sub)session(s).
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlSessionContainer ) :
+ public CBase,
+ public MVtCtlLineEventObserver,
+ public MVtCtlCallStatusObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver call status observer
+ */
+ static CVtCtlSessionContainer* NewL(
+ MVtCtlCallStatusObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtCtlSessionContainer();
+
+ public: // MVtCtlLineEventObserver
+
+ /**
+ * @see MVtCtlLineEventObserver::HandleLineEventL
+ */
+ virtual void HandleLineEventL(
+ const TLineEvent aEvent,
+ TDesC& aCallName );
+
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ virtual void HandleLineEventL(
+ const TLineEvent aEvent,
+ const RMobileCall::TMobileCallStatus aStatus );
+
+ public: // MVtCtlCallStatusObserver
+
+ /**
+ * @see MVtCtlLineEventObserver::HandleCallStatusChangeL
+ */
+ virtual void HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus );
+
+ public: // New functions
+
+ /**
+ * Finds call by name.
+ * @param aCallName search key
+ * @return call or NULL if not found
+ */
+ CVtCtlVideoCall* FindCall( TDesC& aCallName ) const;
+
+ /**
+ * Finds call by session id.
+ * @param aId search key
+ * @return call or NULL if not found
+ */
+ CVtCtlVideoCall* FindCall( TVtCtlSessionId aId ) const;
+
+ /**
+ * Gets sessions.
+ * @param aArray sessions are returned in this
+ * @return number of sessions in aArray
+ */
+ TInt GetSessions( RVtCtlSessionIdArray& aArray ) const;
+
+ private:
+
+ /**
+ * Removes call from array and deletes it.
+ * @param aId session id
+ */
+ void DestructCall( TVtCtlSessionId aId );
+
+ /**
+ * Checks that call is of correct type (multimedia)
+ * @param aName call object
+ * @param aName call name
+ * @return ETrue if call is multimedia call
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ TBool CheckCallTypeL(
+ RMobileCall& aCall,
+ const TName& aName );
+
+ /**
+ * Initializes video call object
+ * @param aCallName call name
+ * @return ETrue if call was initialized
+ */
+ TBool InitCallL( const TName& aCallName );
+
+ private:
+
+ /**
+ * C++ constructor.
+ * @param aObserver call status observer
+ */
+ CVtCtlSessionContainer( MVtCtlCallStatusObserver& aObserver );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private:
+
+ /**
+ * Class for maintaining session identities
+ */
+ class TVtCtlSessionIdentities
+ {
+ public:
+ // c++ default constructor
+ TVtCtlSessionIdentities();
+
+ /**
+ * Create new session id
+ * @return session id
+ */
+ TVtCtlSessionId Create();
+
+ /**
+ * Returns current session id
+ * @return session id
+ */
+ TVtCtlSessionId Current() const;
+
+ private:
+ // Last session id
+ TVtCtlSessionId iCurrentId;
+ };
+
+ private: // Data
+
+ // ETel session
+ RTelServer iServer;
+
+ // Phone session
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobilePhone iPhone;
+
+ // Data line
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileLine iLine;
+
+ // Monitors new calls on line.
+ CVtCtlLineMonitor* iLineMonitor;
+
+ // Array of ongoing video calls
+ RPointerArray<CVtCtlVideoCall> iCalls;
+
+ // Session id management
+ TVtCtlSessionIdentities iSessionIds;
+
+ // Call status observer
+ MVtCtlCallStatusObserver& iObserver;
+ };
+
+#endif // CVTCTLSESSIONCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlVideoCall.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2004 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: Video call abstraction
+*
+*/
+
+
+
+#ifndef CVTCTLVIDEOCALL_H
+#define CVTCTLVIDEOCALL_H
+
+// INCLUDES
+#include <etelmm.h>
+#include "MVtCtlCallControl.h"
+#include "MVtCtlCallStatusObserver.h"
+
+
+// FORWARD DECLARATIONS
+class CVtCtlCallStatusMonitor;
+
+// CLASS DECLARATION
+
+/**
+* Video call abstraction
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlVideoCall ) :
+ public CBase,
+ public MVtCtlCallStatusObserver
+ {
+ public:
+
+ /**
+ * Call information
+ */
+ struct TVtCtlCallInfo
+ {
+ // Session state
+ MVtCtlCallControl::TVtCtlState iStatus;
+ // Previous session state
+ MVtCtlCallControl::TVtCtlState iPreviousStatus;
+ // Session id
+ TVtCtlSessionId iId;
+ // Session direction
+ MVtCtlCallControl::TVtCtlDirection iDirection;
+ };
+
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aDataLine line subsession
+ * @param aId session id
+ * @param aObserver call status observer
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ static CVtCtlVideoCall* NewL(
+ RMobileLine& aDataLine,
+ TVtCtlSessionId aId,
+ MVtCtlCallStatusObserver& aObserver
+ );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtCtlVideoCall();
+
+ public: // New functions
+
+ /**
+ * Returns call info
+ * @return reference to call info
+ */
+ const CVtCtlVideoCall::TVtCtlCallInfo& CallInfo() const;
+
+ /**
+ * Returns Etel call info
+ * @return call info
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ const RMobileCall::TMobileCallInfoV1& MobileInfo() const;
+
+ /**
+ * Opens call subsession and starts monitoring call status.
+ * @param aCallName call name
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ void InitializeCallL( RMobileCall& aCall );
+
+ /**
+ * Updates call information from ETel
+ * @return Symbian OS error code
+ */
+ TInt UpdateCallInfo();
+
+ /**
+ * Returns call duration from Etel
+ * @param aDuration duration
+ * @return Symbian OS error code
+ */
+ TInt GetDuration( TVtCtlDuration& aDuration );
+
+ /**
+ * Obtains video call state from the server and returns it.
+ * @param aState updated call state
+ * @return Symbian OS error code
+ * @since S60 3.1
+ */
+ TInt GetCallState( MVtCtlCallControl::TVtCtlState& aState );
+
+ protected: // From MVtCtlCallStatusObserver
+
+ /**
+ * @see MVtCtlCallStatusObserver::HandleCallStatusChangeL
+ */
+ virtual void HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus );
+
+ private:
+
+ /**
+ * C++ constructor.
+ * @param aDataLine data line
+ * @param aId session id
+ * @param aObserver observer
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ CVtCtlVideoCall(
+ RMobileLine& aDataLine,
+ TVtCtlSessionId aId,
+ MVtCtlCallStatusObserver& aObserver );
+
+ private: // Data
+
+ // Call information
+ TVtCtlCallInfo iCallInfo;
+
+ // Etel call
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileCall* iCall;
+
+ // Data line
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileLine& iLine;
+
+ // Etel call information
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ RMobileCall::TMobileCallInfoV1 iMobileCallInfo;
+
+ // Call status monitor
+ CVtCtlCallStatusMonitor* iStatusMonitor;
+
+ // Call status observer
+ MVtCtlCallStatusObserver& iObserver;
+ };
+
+#endif // CVTCTLVIDEOCALL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallControl.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2004 - 2007 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: Call control interface
+*
+*/
+
+
+
+#ifndef MVTCTLCALLCONTROL_H
+#define MVTCTLCALLCONTROL_H
+
+// INCLUDES
+#include "VtCtlDefs.h"
+#include "TVtCtlType.h"
+
+// CLASS DECLARATION
+
+/**
+* Call control class
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class MVtCtlCallControl
+ {
+ public: // new functions
+
+ /**
+ * Session state
+ * EIdle idle, no connection
+ * EInitializing initializing MO session
+ * EAlerting alerting at remote end
+ * ERinging incoming session ringing
+ * EConnected session is established
+ * EDisconnecting disconnecting session
+ */
+ enum TVtCtlState {
+ EUnknown, // 0
+ EIdle, // 1
+ EInitializing, // 2
+ EAlerting, // 3
+ ERinging, // 4
+ EConnected, // 5
+ EDisconnecting // 6
+ };
+
+ /**
+ * Session direction
+ * EDirectionUnknown unknown direction
+ * EDirectionMobileOriginated MO session
+ * DirectionMobileTerminated MT session
+ */
+ enum TVtCtlDirection
+ {
+ EDirectionUnknown,
+ EDirectionMobileOriginated,
+ DirectionMobileTerminated
+ };
+
+ /**
+ * Gets session duration
+ * @param aId session id
+ * @param aDuration session duration
+ * @return Symbian OS error code
+ */
+ virtual TInt GetDuration(
+ TVtCtlSessionId aId,
+ TVtCtlDuration& aDuration ) = 0;
+
+ /**
+ * Gets information on a session.
+ * @param aId session id
+ * @param aInfo packetized object derived from TVtCtlType
+ */
+ virtual void GetSessionInfoL(
+ TVtCtlSessionId aId,
+ TDes8& aInfo ) = 0;
+
+ /**
+ * Returns session state
+ * @param aId session id
+ * @return session state
+ */
+ virtual TVtCtlState GetSessionState(
+ TVtCtlSessionId aId ) const = 0;
+
+ /**
+ * Returns previous session state
+ * @param aId session id
+ * @return session state
+ */
+ virtual TVtCtlState GetPreviousPreviousState(
+ TVtCtlSessionId aId ) const = 0;
+
+ };
+
+#endif // MVTCTLCALLCONTROL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallStatusObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2004 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: Call status observer interface
+*
+*/
+
+
+
+#ifndef MVTCTLCALLSTATUSOBSERVER_H
+#define MVTCTLCALLSTATUSOBSERVER_H
+
+// INCLUDES
+#include "MVtCtlCallControl.h"
+
+// CLASS DECLARATION
+
+/**
+* Call status observer interface
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class MVtCtlCallStatusObserver
+ {
+ public: // new functions
+
+ /**
+ * Handles call status change.
+ * @param aId session id
+ * @param aStatus new session status
+ * @param aPreviousStatus previous session status
+ */
+ virtual void HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus ) = 0;
+ };
+
+#endif // MVTCTLCALLSTATUSOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCommandObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2004 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: Session command observer interface
+*
+*/
+
+
+
+#ifndef MVTCTLCOMMANDOBSERVER_H
+#define MVTCTLCOMMANDOBSERVER_H
+
+// INCLUDES
+#include "MVtCtlCallControl.h"
+
+// CLASS DECLARATION
+
+/**
+* Session command observer interface
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class MVtCtlCommandObserver
+ {
+ public: // new functions
+
+ /**
+ * Handles command completion in session control.
+ * @param aCmd command
+ * @param aResult completion result
+ */
+ virtual void HandleVtSessionCommandL(
+ MVtCtlCallControl::TVtCtlCmd aCmd,
+ TInt aResult ) = 0;
+ };
+
+#endif // MVTCTLCOMMANDOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlEventObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2004 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: Session event observer interface.
+*
+*/
+
+
+
+#ifndef MVTCTLEVENTOBSERVER_H
+#define MVTCTLEVENTOBSERVER_H
+
+// INCLUDES
+#include "VtCtlEvents.h"
+
+/**
+* Session event observer interface
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class MVtCtlEventObserver
+ {
+ public: // new functions
+
+ /**
+ * Handles event from session control.
+ * @param aEvent session event
+ * @param aParams parameters related to event.
+ * Actual type depends on event.
+ */
+ virtual void HandleVtSessionEventL(
+ TInt aEvent,
+ TAny* aParams ) = 0;
+ };
+
+#endif // MVTCTLEVENTOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlLineEventObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2004 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: Observer interface for line events.
+*
+*/
+
+
+
+#ifndef MVTCTLLINEEVENTOBSERVER_H
+#define MVTCTLLINEEVENTOBSERVER_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for line events
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class MVtCtlLineEventObserver
+ {
+ public: // new functions
+
+ /**
+ * ELineEventCallAdded call added to line
+ * ELineEventIncomingCall incoming call
+ * ELineEventStatusChange line status changed
+ */
+ enum TLineEvent {
+ ELineEventCallAdded,
+ ELineEventIncomingCall,
+ ELineEventStatusChange
+ };
+
+ /**
+ * Event handler for line events.
+ * @param aEvent line event
+ * @param aCallName call name
+ */
+ virtual void HandleLineEventL(
+ const TLineEvent aEvent,
+ TDesC& aCallName ) = 0;
+
+ /**
+ * Event handler for line events.
+ * @param aEvent line event
+ * @param aCallName call name
+ * @param aStatus call status
+ */
+ /*****************************************************
+ * Series 60 Customer / ETel
+ * Series 60 ETel API
+ *****************************************************/
+ virtual void HandleLineEventL(
+ const TLineEvent aEvent,
+ const RMobileCall::TMobileCallStatus aStatus ) = 0;
+ };
+
+#endif // MVTCTLLINEEVENTOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004 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: Session type base class.
+*
+*/
+
+
+
+#ifndef MVTCTLSESSIONINFO_H
+#define MVTCTLSESSIONINFO_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CLASS DECLARATION
+
+/**
+* Base class data types.
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class TVtCtlType
+ {
+ public:
+
+ /**
+ * Returns extension id
+ * @return extension id
+ */
+ inline TInt Extension() const;
+
+ protected:
+ // Extension id to be used in defining actual data type.
+ TInt iExtension;
+ };
+
+#include "TVtCtlType.inl"
+
+#endif // MVTCTLSESSIONINFO_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004 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: Inline methods of class TVtCtlType.
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// TVtCtlType::Extension
+// Returns extension id.
+// -----------------------------------------------------------------------------
+//
+inline TInt TVtCtlType::Extension() const { return iExtension; }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlConfig.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2004 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: Project configuration file.
+*
+*/
+
+
+#ifndef VTCTLCONFIG_HRH
+#define VTCTLCONFIG_HRH
+
+// INCLUDES
+
+/**
+* Macro that chooses stub implementation for CsCallCtrl.
+* In stub following attributes are effective
+* - duration = 5
+* - session info returns :
+* direction = MO
+* state = connected
+* previous state = alerting
+* tel number = 0501234567
+* duration = 5
+*/
+//#define VTCALLCONTROLSTUB
+
+#endif // VTCTLCONFIG_HRH
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlDefs.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2004 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: General definitions for Video telephony call control
+*
+*/
+
+
+
+#ifndef VTCTLDEFS_H
+#define VTCTLDEFS_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// Null session id
+const TInt KNullSessionId = -1;
+
+// Session id for active session
+const TInt KActiveSessionId = -2;
+
+/**
+* Active object priorities
+*/
+const TInt KVtCtlCallAdditionMonitorPriority = CActive::EPriorityStandard;
+const TInt KVtCtlCallStatusMonitorPriority = CActive::EPriorityStandard;
+
+/**
+* Maximum length for telephone number
+*/
+const TInt KVtCtlTelNumberLength = 100;
+
+
+// DATA TYPES
+
+/**
+* Remote end address
+*/
+typedef TBuf<KVtCtlTelNumberLength> TVtCtlTelNumber;
+
+/**
+* Session duration
+*/
+typedef TTimeIntervalSeconds TVtCtlDuration;
+
+/**
+* Session array
+*/
+typedef RArray<TInt> RVtCtlSessionIdArray;
+
+/**
+* Session id
+*/
+typedef TInt TVtCtlSessionId;
+
+/**
+* Session command
+*/
+typedef TInt TVtCtlCmd;
+
+/**
+* Extension ids
+*/
+enum {
+ EVtCtlCSSessionInfoExtensionId = 1
+ };
+
+#endif // VTCTLDEFS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlEvents.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2004 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: Call control events
+*
+*/
+
+
+
+#ifndef VTCLTDEFS_H
+#define VTCLTDEFS_H
+
+// INCLUDES
+#include <e32base.h>
+
+// DATA TYPES
+typedef TInt TVtCtlEvent;
+
+// CONSTANTS
+
+/**
+* Session status is changed. aParams in
+* MVtCtlEventObserver::HandleVtSessionEventL is of
+* type MVtCtlCallControl::TVtCtlState
+*/
+const TVtCtlEvent KVtCtlEventSessionStatusChanged = 1;
+
+/**
+* Session duration is changed. aParams
+* MVtCtlEventObserver::HandleVtSessionEventL is of
+* type TVtCtlDuration
+*/
+const TVtCtlEvent KVtCtlEventDurationChanged = 2;
+
+#endif // VTCLTDEFS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlPanic.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2004 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: Data types for call control
+*
+*/
+
+
+
+#ifndef VTCTLPANIC_H
+#define VTCTLPANIC_H
+
+// INCLUDES
+
+#include <e32std.h>
+
+// CONSTANTS
+
+/**
+* Panic text
+*/
+_LIT( KVtCtlPanicCategory, "VtCSCall" );
+
+// DATA TYPES
+
+/**
+* Panic values
+*/
+enum TVtCtlPanic {
+ //** Line subsession handle is null */
+ EVtCtlPanicLineHandleNull,
+ /** Call subsession handle is null */
+ EVtCtlPanicCallHandleNull
+ };
+
+// FUNCTION PROTOTYPES
+
+/**
+* Call control panic.
+* @param aPanic panic value
+*/
+void Panic( TVtCtlPanic aPanic );
+
+#endif // VTCTLPANIC_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2004 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: Data types for call control
+*
+*/
+
+
+#ifndef VTCTLTYPES_H
+#define VTCTLTYPES_H
+
+// INCLUDES
+#include "VtCtlDefs.h"
+#include "TVtCtlType.h"
+
+/**
+* CS Session information.
+*
+* @lib CSCallCtrl
+* @since 2.6
+*/
+class TVtCtlCSSessionInfoV1 : public TVtCtlType
+ {
+ public: // constructors
+ /**
+ * C++ default contructor.
+ */
+ inline TVtCtlCSSessionInfoV1();
+
+ public: // data members
+
+ // Session duration
+ TVtCtlDuration iDuration;
+
+ // Address
+ TVtCtlTelNumber iTelNumber;
+
+ // Session state
+ MVtCtlCallControl::TVtCtlState iState;
+
+ // Previous session state
+ MVtCtlCallControl::TVtCtlState iPreviousState;
+
+ // Session direction MO/MT
+ MVtCtlCallControl::TVtCtlDirection iDirection;
+ };
+
+/**
+* Data passed in MVtCtlEventObserver::HandleVtSessionEventL
+* when event is KVtCtlEventSessionStatusChanged.
+*/
+struct TVtCtlSessionStateEvent
+ {
+ /**
+ * Session state
+ */
+ MVtCtlCallControl::TVtCtlState iState;
+
+ /**
+ * Previous session state
+ */
+ MVtCtlCallControl::TVtCtlState iPreviousState;
+
+ /**
+ * Session id
+ */
+ TVtCtlSessionId iSessionId;
+ };
+
+#include "VtCtlTypes.inl"
+
+#endif // VTCTLTYPES_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2004 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: Data types for call control
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// TVtCtlCSSessionInfoV1::TVtCtlSessionInfoV1
+// c++ default constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtCtlCSSessionInfoV1::TVtCtlCSSessionInfoV1()
+ : iDuration( 0 ),
+ iState( MVtCtlCallControl::EUnknown ),
+ iPreviousState( MVtCtlCallControl::EUnknown ),
+ iDirection( MVtCtlCallControl::EDirectionUnknown )
+ {
+ iExtension = EVtCtlCSSessionInfoExtensionId;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControl.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2007 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: CVtCtlCallControl class implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include <cvtlogger.h>
+#include "CVtCtlCallControl.h"
+#include "MVtCtlEventObserver.h"
+#include "CVtCtlSessionContainer.h"
+#include "CVtCtlVideoCall.h"
+#include "VtCtlTypes.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::NewL
+// two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl* CVtCtlCallControl::NewL(
+ MVtCtlEventObserver& aEventObserver )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.NewL" )
+ CVtCtlCallControl* self = new ( ELeave )
+ CVtCtlCallControl( aEventObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "CVtCtlCallControl.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::~CVtCtlCallControl
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::~CVtCtlCallControl()
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.~" )
+ delete iContainer;
+ // uninitialize logging (if enabled)
+ VTLOGUNINIT
+ __VTPRINTEXIT( "CVtCtlCallControl.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::CVtCtlCallControl
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::CVtCtlCallControl(
+ MVtCtlEventObserver& aEventObserver ) :
+ iEventObserver( aEventObserver )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.CVtCtlCallControl" )
+ __VTPRINTEXIT( "CVtCtlCallControl.CVtCtlCallControl" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ConstructL()
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.ConstructL" )
+ // initialize logging (if enabled)
+ VTLOGINIT
+ iContainer = CVtCtlSessionContainer::NewL( *this );
+ __VTPRINTEXIT( "CVtCtlCallControl.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetDuration
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallControl::GetDuration(
+ TVtCtlSessionId aId,
+ TVtCtlDuration& aDuration )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.GetDuration" )
+ CVtCtlVideoCall* call = iContainer->FindCall( aId );
+ TInt err( KErrNotFound );
+ if ( call )
+ {
+ err = call->GetDuration( aDuration );
+ }
+ __VTPRINTEXIT( "CVtCtlCallControl.GetDuration" )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetSessionInfoL
+//
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlCallControl::GetSessionInfoL(
+ TVtCtlSessionId aId,
+ TDes8& aInfo )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.GetSessionInfoL" )
+ ValidateDataExtensionL( aInfo, EVtCtlCSSessionInfoExtensionId );
+ CVtCtlVideoCall* call = iContainer->FindCall( aId );
+ if ( call )
+ {
+ TPckg<TVtCtlCSSessionInfoV1>& pckg =
+ reinterpret_cast<TPckg<TVtCtlCSSessionInfoV1>&>( aInfo );
+ TVtCtlCSSessionInfoV1& info = pckg();
+ TInt err( call->UpdateCallInfo() );
+ if ( err == KErrNone )
+ {
+ const RMobileCall::TMobileCallInfoV1& mobileInfo = call->MobileInfo();
+ info.iDuration = mobileInfo.iDuration;
+ info.iTelNumber = mobileInfo.iRemoteParty.iRemoteNumber.iTelNumber;
+ __VTPRINT2( DEBUG_SESSION, "VtCtl: mobile dir=%d",
+ mobileInfo.iRemoteParty.iDirection )
+ switch ( mobileInfo.iRemoteParty.iDirection )
+ {
+ case RMobileCall::EMobileOriginated:
+ info.iDirection = EDirectionMobileOriginated;
+ break;
+ case RMobileCall::EMobileTerminated:
+ info.iDirection = DirectionMobileTerminated;
+ break;
+ case RMobileCall::EDirectionUnknown:
+ default:
+ info.iDirection = EDirectionUnknown;
+ break;
+ }
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_SESSION, "CallCtrl.GetSessionInfoL not found" )
+ User::Leave( KErrNotFound );
+ }
+ __VTPRINTEXIT( "CVtCtlCallControl.GetSessionInfoL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetState
+//
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetSessionState(
+ TVtCtlSessionId aId ) const
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.GetSessionState" )
+ __VTPRINT2( DEBUG_SESSION, "CallCtrl.GetSessionState for id:%d",aId )
+ MVtCtlCallControl::TVtCtlState state = EUnknown;
+ CVtCtlVideoCall* call = iContainer->FindCall( aId );
+ if ( call )
+ {
+ call->GetCallState( state );
+ }
+ __VTPRINT3( DEBUG_SESSION, " callPtr=%d state=%d", (TInt) call, state )
+ __VTPRINTEXIT( "CVtCtlCallControl.GetSessionState" )
+ return state;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetPreviousState
+//
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetPreviousPreviousState(
+ TVtCtlSessionId aId ) const
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.GetPreviousPreviousState" )
+ MVtCtlCallControl::TVtCtlState state = EUnknown;
+ const CVtCtlVideoCall* call = iContainer->FindCall( aId );
+ if ( call )
+ {
+ state = call->CallInfo().iPreviousStatus;
+ }
+ __VTPRINTEXIT( "CVtCtlCallControl.GetPreviousPreviousState" )
+ return state;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::HandleCallStatusChangeL
+// Notifies observer about call status change.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.HandleCallStatusChangeL" )
+ __VTPRINT2( DEBUG_SESSION, " status=%d", (TInt) aStatus )
+
+ TVtCtlSessionStateEvent event;
+ event.iPreviousState = aPreviousStatus;
+ event.iState = aStatus;
+ event.iSessionId = aId;
+
+ TAny* parameter = &event;
+ iEventObserver.HandleVtSessionEventL(
+ KVtCtlEventSessionStatusChanged,
+ parameter );
+ __VTPRINTEXIT( "CVtCtlCallControl.HandleCallStatusChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ValidateDataExtensionL
+// Validates extension id of descriptor representation of data type.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ValidateDataExtensionL(
+ TDesC8& aData,
+ TInt aExtension )
+ {
+ __VTPRINTENTER( "CVtCtlCallControl.ValidateDataExtensionL" )
+ TVtCtlType type;
+ TPckg<TVtCtlType> pckg(type);
+ TPtrC8 ptr( aData.Ptr(), sizeof( TVtCtlType ) );
+ pckg.Copy( ptr );
+ if ( type.Extension() != aExtension )
+ {
+ __VTPRINT( DEBUG_SESSION, "CallCtrl.Validate not supported" )
+ User::Leave( KErrNotSupported );
+ }
+ __VTPRINTEXIT( "CVtCtlCallControl.ValidateDataExtensionL" )
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControlStub.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2007 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: Stub version of call control.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlCallControl.h"
+#include "MVtCtlEventObserver.h"
+#include "CVtCtlSessionContainer.h"
+#include "CVtCtlVideoCall.h"
+#include "VtCtlTypes.h"
+#include <CVtLogger.h>
+
+// CONSTANTS
+_LIT( KVtCtlStubTelNumber, "0501234567" );
+
+// Duration
+const TInt KVtCtlStubDuration = 5;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::NewL
+// Two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl* CVtCtlCallControl::NewL(
+ MVtCtlEventObserver& aEventObserver )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.NewL" )
+ CVtCtlCallControl* self = new ( ELeave )
+ CVtCtlCallControl( aEventObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "CVtCtlCallControlStub.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::~CVtCtlCallControl
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::~CVtCtlCallControl()
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.~" )
+ delete iContainer;
+ // uninitialize logging
+ VTLOGUNINIT
+ __VTPRINTEXIT( "CVtCtlCallControlStub.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::CVtCtlCallControl
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::CVtCtlCallControl(
+ MVtCtlEventObserver& aEventObserver) :
+ iEventObserver( aEventObserver )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.CVtCtlCallControl" )
+ __VTPRINTEXIT( "CVtCtlCallControlStub.CVtCtlCallControl" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ConstructL()
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.ConstructL" )
+ // initialize logging
+ VTLOGINIT
+ iContainer = CVtCtlSessionContainer::NewL( *this );
+ __VTPRINTEXIT( "CVtCtlCallControlStub.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetDuration
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallControl::GetDuration(
+ TVtCtlSessionId ,
+ TVtCtlDuration& aDuration )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.GetDuration" )
+ aDuration = 5;
+ __VTPRINTEXIT( "CVtCtlCallControlStub.GetDuration" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetSessionInfoL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::GetSessionInfoL(
+ TVtCtlSessionId ,
+ TDes8& aInfo )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.GetSessionInfoL" )
+
+ TPckg<TVtCtlCSSessionInfoV1>& pckg =
+ reinterpret_cast<TPckg<TVtCtlCSSessionInfoV1>&>( aInfo );
+ __VTPRINT( DEBUG_SESSION, "VtCtl:CallCtrl. 1" )
+ TVtCtlCSSessionInfoV1& info = pckg();
+ __VTPRINT( DEBUG_SESSION, "VtCtl:CallCtrl. 2" )
+ info.iDirection = MVtCtlCallControl::EDirectionMobileOriginated;
+ info.iDuration = KVtCtlStubDuration;
+ info.iState = MVtCtlCallControl::EConnected;
+ info.iPreviousState = MVtCtlCallControl::EAlerting;
+ info.iTelNumber = KVtCtlStubTelNumber;
+ __VTPRINTEXIT( "CVtCtlCallControlStub.GetSessionInfoL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetState
+//
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetSessionState(
+ TVtCtlSessionId ) const
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.GetSessionState" )
+ MVtCtlCallControl::TVtCtlState state = MVtCtlCallControl::EConnected;
+ __VTPRINTEXIT( "CVtCtlCallControlStub.GetSessionState" )
+ return state;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetPreviousState
+//
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetPreviousPreviousState(
+ TVtCtlSessionId ) const
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.GetPreviousPreviousState" )
+ MVtCtlCallControl::TVtCtlState state = EAlerting;
+ __VTPRINTEXIT( "CVtCtlCallControlStub.GetPreviousPreviousState" )
+ return state;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::HandleCallStatusChangeL
+// Notifies
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::HandleCallStatusChangeL(
+ TVtCtlSessionId ,
+ MVtCtlCallControl::TVtCtlState ,
+ MVtCtlCallControl::TVtCtlState )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.HandleCallStatusChangeL" )
+ __VTPRINTEXIT( "CVtCtlCallControlStub.HandleCallStatusChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ValidateDataExtensionL
+// Validates extension id of descriptor representation of data type.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ValidateDataExtensionL(
+ TDesC8& ,
+ TInt )
+ {
+ __VTPRINTENTER( "CVtCtlCallControlStub.ValidateDataExtensionL" )
+ __VTPRINTEXIT( "CVtCtlCallControlStub.ValidateDataExtensionL" )
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallStatusMonitor.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2007 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: Monitors call status.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlCallStatusMonitor.h"
+#include "MVtCtlCallStatusObserver.h"
+#include "VtCtlDefs.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::CVtCtlCallStatusMonitor
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+CVtCtlCallStatusMonitor::CVtCtlCallStatusMonitor(
+ RMobileCall& aCall,
+ MVtCtlCallStatusObserver& aObserver ) :
+ CActive( KVtCtlCallStatusMonitorPriority ),
+ iCall( aCall ),
+ iObserver( aObserver ),
+ iCallStatus( RMobileCall::EStatusUnknown ),
+ iPreviousStatus( RMobileCall::EStatusUnknown )
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.CVtCtlCallStatusMonitor" )
+ CActiveScheduler::Add( this );
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.CVtCtlCallStatusMonitor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::~CVtCtlCallStatusMonitor
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallStatusMonitor::~CVtCtlCallStatusMonitor()
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.~" )
+ Cancel();
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.~" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::Start
+// Starts monitoring
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlCallStatusMonitor::Start()
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.Start" )
+ if ( iPreviousStatus == RMobileCall::EStatusUnknown )
+ {
+ RMobileCall::TMobileCallStatus status( RMobileCall::EStatusUnknown );
+ if ( iCall.GetMobileCallStatus( status ) == KErrNone )
+ {
+ iPreviousStatus = status;
+ }
+ }
+ if ( !IsActive() )
+ {
+ iCall.NotifyMobileCallStatusChange( iStatus, iCallStatus );
+ SetActive();
+ }
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.Start" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::DoCancel
+// Cancels monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallStatusMonitor::DoCancel()
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.DoCancel" )
+ iCall.CancelAsyncRequest( EMobileCallNotifyMobileCallStatusChange );
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::RunL
+// Receives call status change and notifies observer
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlCallStatusMonitor::RunL()
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.RunL" )
+ __VTPRINT2( DEBUG_SESSION , "CallStatMon.RunL err=%d",iStatus.Int() )
+ __VTPRINT2( DEBUG_SESSION , "CallStatMon.RunL sta=%d",
+ (TInt)iCallStatus )
+ if ( iStatus == KErrNone )
+ {
+ const RMobileCall::TMobileCallStatus cache( iCallStatus );
+ Start();
+ MVtCtlCallControl::TVtCtlState state = MapState( cache );
+ if ( CVtCtlCallStatusMonitor::IsLegalNewState(
+ cache, iPreviousStatus ) )
+ {
+ iPreviousStatus = cache;
+ if ( state != MVtCtlCallControl::EUnknown )
+ {
+ iObserver.HandleCallStatusChangeL(
+ KNullSessionId, // unknown by this
+ state,
+ MapState( iPreviousStatus ) );
+ }
+ }
+ }
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::RunError
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallStatusMonitor::RunError(
+#ifdef VTDEBUG
+ TInt aError )
+#else
+ TInt /*aError*/ )
+#endif
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.RunError" )
+ __VTPRINTEXITR( "CVtCtlCallStatusMonitor.RunError err=%d", aError )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::MapState
+// Maps Etel call status to internal type
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+MVtCtlCallControl::TVtCtlState CVtCtlCallStatusMonitor::MapState(
+ const RMobileCall::TMobileCallStatus aStatus )
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.MapState" )
+ MVtCtlCallControl::TVtCtlState state( MVtCtlCallControl::EUnknown );
+ switch ( aStatus )
+ {
+ case RMobileCall::EStatusIdle:
+ state = MVtCtlCallControl::EIdle;
+ break;
+ case RMobileCall::EStatusDialling:
+ state = MVtCtlCallControl::EInitializing;
+ break;
+ case RMobileCall::EStatusRinging:
+ state = MVtCtlCallControl::ERinging;
+ break;
+ case RMobileCall::EStatusAnswering:
+ state = MVtCtlCallControl::ERinging;
+ break;
+ case RMobileCall::EStatusConnecting:
+ state = MVtCtlCallControl::EInitializing;
+ break;
+ case RMobileCall::EStatusConnected:
+ state = MVtCtlCallControl::EConnected;
+ break;
+ case RMobileCall::EStatusDisconnecting:
+ case RMobileCall::EStatusDisconnectingWithInband:
+ state = MVtCtlCallControl::EDisconnecting;
+ break;
+ case RMobileCall::EStatusUnknown:
+ state = MVtCtlCallControl::EUnknown;
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.MapState state" )
+ return state;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::IsLegalNewState
+// Checks if call state transition specified by arguments is legal.
+// -----------------------------------------------------------------------------
+//
+TBool CVtCtlCallStatusMonitor::IsLegalNewState(
+ const RMobileCall::TMobileCallStatus aNewState,
+ const RMobileCall::TMobileCallStatus aCurrentState )
+ {
+ // check state transition priority
+ const TInt newPrio = KVtCtlStatusTransitionPriorities[ aNewState ];
+ const TInt prevPrio = KVtCtlStatusTransitionPriorities[ aCurrentState ];
+
+ /**
+ * Legal transition if new state is logically consecutive compared to old
+ * state. Exception: transition to idle always possible ( !newPrio )
+ */
+ const TBool isLegal = ( newPrio > prevPrio || !newPrio );
+ return isLegal;
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlFactory.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 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: CVtCtlFactory class implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlFactory.h"
+#include "CVtCtlCallControl.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// MVtCtlCallControl::CreateCallControlL
+// Creates call control.
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl* CVtCtlFactory::CreateCallControlL(
+ MVtCtlEventObserver& aEventObserver )
+ {
+ __VTPRINTENTER( "CVtCtlCallStatusMonitor.IsLegalNewState" )
+ MVtCtlCallControl* control = CVtCtlCallControl::NewL(
+ aEventObserver );
+ __VTPRINTEXIT( "CVtCtlCallStatusMonitor.IsLegalNewState" )
+ return control;
+ }
+
+// -----------------------------------------------------------------------------
+// MVtCtlCallControl::Delete
+// Destructs call control object.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlFactory::Delete( MVtCtlCallControl* aCallControl )
+ {
+ __VTPRINTENTER( "CVtCtlFactory.Delete" )
+ CVtCtlCallControl* callControl =
+ static_cast<CVtCtlCallControl*>( aCallControl );
+ delete callControl;
+ __VTPRINTEXIT( "CVtCtlFactory.Delete" )
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// CreateFactory
+// Returns: Factory for creating and destructing call control.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtCtlFactory* CreateFactory()
+ {
+ CVtCtlFactory* factory = new CVtCtlFactory;
+ return factory;
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlLineMonitor.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2007 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: Monitors new calls on data line
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlLineMonitor.h"
+#include "MVtCtlLineEventObserver.h"
+#include "VtCtlDefs.h"
+#include <cvtlogger.h>
+#include <etelmm.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::CVtCtlLineMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+CVtCtlLineMonitor::CVtCtlLineMonitor(
+ RMobileLine& aLine,
+ MVtCtlLineEventObserver& aObserver) :
+ CActive( KVtCtlCallAdditionMonitorPriority ),
+ iLine ( aLine ),
+ iObserver( aObserver ),
+ iLastLineStatus( RMobileCall::EStatusIdle ),
+ iLineStatus( RMobileCall::EStatusIdle )
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
+ CActiveScheduler::Add( this );
+ __VTPRINTEXIT( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
+ }
+
+// Destructor
+CVtCtlLineMonitor::~CVtCtlLineMonitor()
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.~" )
+ Cancel();
+ __VTPRINTEXIT( "CVtCtlLineMonitor.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::Start
+// Start monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::Start()
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.Start" )
+ if ( !IsActive() )
+ {
+ iLine.NotifyMobileLineStatusChange( iStatus, iLineStatus );
+ SetActive();
+ }
+ __VTPRINTEXIT( "CVtCtlLineMonitor.Start" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::DoCancel
+// Stop monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::DoCancel()
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.DoCancel" )
+ iLine.CancelAsyncRequest( EMobileLineNotifyMobileLineStatusChange );
+ __VTPRINTEXIT( "CVtCtlLineMonitor.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::RunL
+// Notifies observer on the event.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::RunL()
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.RunL" )
+ __VTPRINT2( DEBUG_SESSION , "VtCtl:LineMon.RunL %d", iStatus.Int() )
+ if ( iStatus == KErrNone )
+ {
+ if ( iLineStatus != iLastLineStatus )
+ {
+ iObserver.HandleLineEventL(
+ MVtCtlLineEventObserver::ELineEventStatusChange, iLineStatus );
+ iLastLineStatus = iLineStatus;
+ }
+ Start();
+ }
+ __VTPRINTEXIT( "CVtCtlLineMonitor.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::RunError
+// Starts monitoring after error
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlLineMonitor::RunError(
+#ifdef VTDEBUG
+ TInt aError )
+#else
+ TInt )
+#endif
+ {
+ __VTPRINTENTER( "CVtCtlLineMonitor.RunError" )
+ Start();
+ __VTPRINTEXITR( "CVtCtlLineMonitor.RunError err=%d", aError )
+ return KErrNone;
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlSessionContainer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2004 - 2007 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: Container for ETel session and subsessions.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlSessionContainer.h"
+#include "CVtCtlLineMonitor.h"
+#include "CVtCtlVideoCall.h"
+#include <mmtsy_names.h>
+#include <cvtlogger.h>
+
+// CONSTANTS
+
+// Retrials for connecting to ETel server
+const TInt KVtCtlETelConnectRetrials = 5;
+
+// Granularity
+const TInt KVtCtlMaxCalls = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::CVtCtlSessionContainer
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer::CVtCtlSessionContainer(
+ MVtCtlCallStatusObserver& aObserver ) :
+ iCalls( KVtCtlMaxCalls ),
+ iObserver( aObserver )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.CVtCtlSessionContainer" )
+ __VTPRINTEXIT( "CVtCtlSessionContainer.CVtCtlSessionContainer" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlSessionContainer::ConstructL()
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.ConstructL" )
+ TInt retries( KVtCtlETelConnectRetrials );
+ TInt err( KErrNone );
+ while ( retries-- &&
+ iServer.Handle() == KNullHandle )
+ {
+ err = iServer.Connect();
+ }
+ User::LeaveIfError( err );
+ User::LeaveIfError( iServer.LoadPhoneModule( KMmTsyModuleName() ) );
+ User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );
+ User::LeaveIfError( iLine.Open( iPhone, KMmTsyDataLineName() ) );
+
+ iLineMonitor = new ( ELeave ) CVtCtlLineMonitor( iLine, *this );
+ iLineMonitor->Start();
+
+ RMobileCall::TMobileCallStatus lineStatus;
+ User::LeaveIfError( iLine.GetMobileLineStatus( lineStatus ) );
+ if ( lineStatus != RMobileCall::EStatusIdle )
+ {
+ __VTPRINT( DEBUG_SESSION | DEBUG_CONSTRUCT,
+ "VtCtl:SesConL line active" )
+ TInt calls( 0 );
+ User::LeaveIfError( iLine.EnumerateCall( calls ) );
+ while ( calls-- )
+ {
+ RLine::TCallInfo callInfo;
+ iLine.GetCallInfo( calls, callInfo );
+ if ( InitCallL( callInfo.iCallName ) )
+ {
+ __VTPRINT( DEBUG_SESSION | DEBUG_CONSTRUCT,
+ "VtCtl:SesConL call found and created" )
+ calls = 0;
+ }
+ }
+ }
+
+ __VTPRINTEXIT( "CVtCtlSessionContainer.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer* CVtCtlSessionContainer::NewL(
+ MVtCtlCallStatusObserver& aObserver )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.NewL" )
+ CVtCtlSessionContainer* self =
+ new ( ELeave ) CVtCtlSessionContainer( aObserver );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ __VTPRINTEXIT( "CVtCtlSessionContainer.NewL" )
+ return self;
+ }
+
+
+// Destructor
+CVtCtlSessionContainer::~CVtCtlSessionContainer()
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.~" )
+
+ TInt count( iCalls.Count() );
+ CVtCtlVideoCall* call = NULL;
+ while ( count-- )
+ {
+ call = iCalls[count];
+ delete call;
+ }
+ iCalls.Close();
+ delete iLineMonitor;
+ iLine.Close();
+ iPhone.Close();
+ iServer.UnloadPhoneModule( KMmTsyModuleName() );
+ iServer.Close();
+ __VTPRINTEXIT( "CVtCtlSessionContainer.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleLineEventL
+// Handle new call on data line
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::HandleLineEventL(
+ const TLineEvent aEvent,
+ TDesC& aCallName )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.HandleLineEventL" )
+ if ( aEvent == ELineEventCallAdded )
+ {
+ CVtCtlVideoCall* call = FindCall( aCallName );
+ if ( call == NULL )
+ {
+ InitCallL( aCallName );
+ }
+ }
+ __VTPRINTEXITR( "CVtCtlSessionContainer.HandleLineEventL event=%d",
+ aEvent )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleLineEventL
+//
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlSessionContainer::HandleLineEventL(
+ const TLineEvent aEvent,
+ const RMobileCall::TMobileCallStatus aStatus )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.HandleLineEventL" )
+ __VTPRINT3( DEBUG_SESSION, "SesCont.LineEvent2 event=%d,status=%d",
+ (TInt) aEvent,
+ (TInt) aStatus )
+ if ( aEvent == ELineEventStatusChange &&
+ ( aStatus == RMobileCall::EStatusRinging ||
+ aStatus == RMobileCall::EStatusDialling ) )
+ {
+ TInt calls( 0 );
+ iLine.EnumerateCall( calls );
+ while ( calls-- )
+ {
+ RLine::TCallInfo callInfo;
+ TInt err( iLine.GetCallInfo( calls, callInfo ) );
+ // ensure we're opening correct call
+ if ( err == KErrNone &&
+ ( callInfo.iStatus == RCall::EStatusDialling ||
+ callInfo.iStatus == RCall::EStatusRinging ) )
+ {
+ calls = 0; // break
+ CVtCtlVideoCall* call = FindCall( callInfo.iCallName );
+ if ( call == NULL )
+ {
+ InitCallL( callInfo.iCallName );
+ }
+ }
+ }
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.HandleLineEventL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleCallStatusChangeL
+// passes call status change event to observer
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::HandleCallStatusChangeL(
+ TVtCtlSessionId aId,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.HandleCallStatusChangeL" )
+ iObserver.HandleCallStatusChangeL( aId, aStatus, aPreviousStatus );
+ if ( aStatus == MVtCtlCallControl::EIdle )
+ {
+ DestructCall( aId );
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.HandleCallStatusChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::FindCall
+// Finds call by name
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+CVtCtlVideoCall* CVtCtlSessionContainer::FindCall( TDesC& aCallName ) const
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.FindCall" )
+ TInt count( iCalls.Count() );
+ CVtCtlVideoCall* call = NULL;
+ while ( count-- )
+ {
+ call = iCalls[count];
+ const RMobileCall::TMobileCallInfoV1& mobileInfo = call->MobileInfo();
+ if ( aCallName == mobileInfo.iCallName )
+ {
+ count = 0; // break
+ }
+ else
+ {
+ call = NULL;
+ }
+ }
+ __VTPRINT2( DEBUG_SESSION | DEBUG_DETAIL,
+ "SesCont.FindCall by name --> %d",(TInt)call )
+ __VTPRINTEXIT( "CVtCtlSessionContainer.FindCall" )
+ return call;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::FindCall
+// Finds call by id.
+// -----------------------------------------------------------------------------
+//
+CVtCtlVideoCall* CVtCtlSessionContainer::FindCall( TVtCtlSessionId aId ) const
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.FindCall" )
+ TInt count( iCalls.Count() );
+ CVtCtlVideoCall* call = NULL;
+ if ( aId == KActiveSessionId && count == 1 )
+ {
+ call = iCalls[0];
+ count = 0;
+ }
+ while ( count-- )
+ {
+ call = iCalls[count];
+ const CVtCtlVideoCall::TVtCtlCallInfo& info =
+ call->CallInfo();
+ if ( aId == info.iId )
+ {
+ count = 0; // break
+ }
+ else
+ {
+ call = NULL;
+ }
+ }
+ __VTPRINT2( DEBUG_SESSION | DEBUG_DETAIL,
+ "SesCont.FindCall by id --> %d",(TInt)call )
+ __VTPRINTEXIT( "CVtCtlSessionContainer.FindCall" )
+ return call;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::Sessions
+// Returns sessions.
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlSessionContainer::GetSessions( RVtCtlSessionIdArray& aArray ) const
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.GetSessions" )
+ const TInt count( iCalls.Count() );
+ for ( TInt ii = 0; ii < count; ii++ )
+ {
+ TInt err( aArray.Append( iCalls[ii]->CallInfo().iId ) );
+ if ( err != KErrNone )
+ {
+ __VTPRINTEXIT( "CVtCtlSessionContainer.GetSessions" )
+ return err;
+ }
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.GetSessions" )
+ return count;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::DestructCall
+// Destructs call
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::DestructCall( TVtCtlSessionId aId )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.DestructCall" )
+ TInt count( iCalls.Count() );
+ CVtCtlVideoCall* call = NULL;
+ while ( count-- )
+ {
+ call = iCalls[count];
+ const CVtCtlVideoCall::TVtCtlCallInfo& info =
+ call->CallInfo();
+ if ( aId == info.iId )
+ {
+ delete call;
+ iCalls.Remove( count );
+ count = 0; // break
+ }
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.DestructCall" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::CheckCallTypeL
+// Checks call type
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+TBool CVtCtlSessionContainer::CheckCallTypeL(
+ RMobileCall& aCall,
+ const TName& aName )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.CheckCallTypeL" )
+ User::LeaveIfError( aCall.OpenExistingCall( iLine, aName ) );
+ TBool typeOk( EFalse );
+ RMobileCall::TMobileCallDataCapsV1 caps;
+ RMobileCall::TMobileCallDataCapsV1Pckg pckg( caps );
+ User::LeaveIfError( aCall.GetMobileDataCallCaps( pckg ) );
+ __VTPRINT3( DEBUG_SESSION | DEBUG_DETAIL,
+ "SesCont.ChkCall speedCaps=%d,protCaps=%d",
+ caps.iSpeedCaps, caps.iProtocolCaps )
+ if ( caps.iProtocolCaps & RMobileCall::KCapsIsdnMultimedia )
+ {
+ typeOk = ETrue;
+ }
+ else
+ {
+ aCall.Close();
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.CheckCallTypeL" )
+ return typeOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::InitCallL
+// Initializes call if it is video call.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+TBool CVtCtlSessionContainer::InitCallL( const TName& aCallName )
+ {
+ __VTPRINTENTER( "CVtCtlSessionContainer.InitCallL" )
+ RMobileCall* mobilecall = new ( ELeave ) RMobileCall;
+ CleanupStack::PushL( mobilecall );
+
+ // check that type is multimedia call
+ const TBool callTypeOk = CheckCallTypeL( *mobilecall, aCallName );
+ if ( callTypeOk )
+ {
+ __VTPRINT( DEBUG_SESSION | DEBUG_DETAIL,
+ "SesCont.InitCall ok" )
+ TVtCtlSessionId id = iSessionIds.Create();
+ CVtCtlVideoCall* call = CVtCtlVideoCall::NewL(
+ iLine, id, *this );
+ CleanupStack::PushL( call );
+ User::LeaveIfError( iCalls.Append( call ) );
+ call->InitializeCallL( *mobilecall ); // takes ownership
+ const CVtCtlVideoCall::TVtCtlCallInfo& callInfo = call->CallInfo();
+ iObserver.HandleCallStatusChangeL(
+ id, callInfo.iStatus, callInfo.iPreviousStatus );
+ CleanupStack::Pop(2); // mobilecall, call
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy(); // mobilecall
+ }
+ __VTPRINTEXIT( "CVtCtlSessionContainer.InitCallL" )
+ return callTypeOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::TVtCtlSessionIdentities
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer::TVtCtlSessionIdentities::TVtCtlSessionIdentities()
+ : iCurrentId( 0 )
+ {
+ __VTPRINTENTER( "TVtCtlSessionIdentities.TVtCtlSessionIdentities" )
+ __VTPRINTEXIT( "TVtCtlSessionIdentities.TVtCtlSessionIdentities" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::Create
+// Increment session id.
+// -----------------------------------------------------------------------------
+//
+TVtCtlSessionId CVtCtlSessionContainer::TVtCtlSessionIdentities::Create()
+ {
+ __VTPRINTENTER( "TVtCtlSessionIdentities.Create" )
+ __VTPRINTEXIT( "TVtCtlSessionIdentities.Create" )
+ return ++iCurrentId;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::Current
+// Return current session id.
+// -----------------------------------------------------------------------------
+//
+TVtCtlSessionId CVtCtlSessionContainer::TVtCtlSessionIdentities::Current() const
+ {
+ __VTPRINTENTER( "TVtCtlSessionIdentities.Current" )
+ __VTPRINTEXIT( "TVtCtlSessionIdentities.Current" )
+ return iCurrentId;
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlVideoCall.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2007 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: Video call abstraction implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlVideoCall.h"
+#include "CVtCtlCallStatusMonitor.h"
+#include "VtCtlPanic.h"
+#include "cvtlogger.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::CVtCtlVideoCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+CVtCtlVideoCall::CVtCtlVideoCall(
+ RMobileLine& aDataLine,
+ TVtCtlSessionId aId,
+ MVtCtlCallStatusObserver& aObserver )
+ : iLine( aDataLine ), iObserver( aObserver )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.CVtCtlVideoCall" )
+ iCallInfo.iId = aId;
+ __VTPRINTEXIT( "CVtCtlVideoCall.CVtCtlVideoCall" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+CVtCtlVideoCall* CVtCtlVideoCall::NewL(
+ RMobileLine& aDataLine,
+ TVtCtlSessionId aId,
+ MVtCtlCallStatusObserver& aObserver )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.NewL" )
+ CVtCtlVideoCall* self = new( ELeave )
+ CVtCtlVideoCall( aDataLine, aId, aObserver );
+ __VTPRINTEXIT( "CVtCtlVideoCall.NewL" )
+ return self;
+ }
+
+
+// Destructor
+CVtCtlVideoCall::~CVtCtlVideoCall()
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.~" )
+ __VTPRINT( DEBUG_SESSION | DEBUG_DESTRUCT, "VtCtl:Call~")
+ delete iStatusMonitor;
+ if ( iCall )
+ {
+ iCall->Close();
+ delete iCall;
+ }
+ __VTPRINTEXIT( "CVtCtlVideoCall.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::CallInfo
+// Returns call information containing information not associated to ETel
+// -----------------------------------------------------------------------------
+//
+const CVtCtlVideoCall::TVtCtlCallInfo& CVtCtlVideoCall::CallInfo() const
+ {
+ return iCallInfo;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::MobileInfo
+// Returns ETel call information.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+const RMobileCall::TMobileCallInfoV1& CVtCtlVideoCall::MobileInfo() const
+ {
+ return iMobileCallInfo;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::InitializeCallL
+// Opens call subsession and starts status monitor.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+void CVtCtlVideoCall::InitializeCallL(
+ RMobileCall& aCall )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.InitializeCallL" )
+ __ASSERT_ALWAYS( iLine.SubSessionHandle(),
+ Panic( EVtCtlPanicLineHandleNull ) );
+ iCall = &aCall;
+ iStatusMonitor = new ( ELeave ) CVtCtlCallStatusMonitor( *iCall, *this );
+ iStatusMonitor->Start();
+ UpdateCallInfo();
+ iCallInfo.iPreviousStatus = MVtCtlCallControl::EIdle;
+ iCallInfo.iStatus =
+ CVtCtlCallStatusMonitor::MapState( iMobileCallInfo.iStatus );
+
+ __VTPRINTEXIT( "CVtCtlVideoCall.InitializeCallL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::UpdateCallInfo
+// Updates call information from ETel
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+* Series 60 Customer / ETel
+* Series 60 ETel API
+*****************************************************/
+TInt CVtCtlVideoCall::UpdateCallInfo()
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.UpdateCallInfo" )
+ __ASSERT_ALWAYS( iCall->SubSessionHandle(),
+ Panic( EVtCtlPanicCallHandleNull ) );
+
+ RMobileCall::TMobileCallInfoV1Pckg pckg( iMobileCallInfo );
+ const TInt err( iCall->GetMobileCallInfo( pckg ) );
+ __VTPRINT2( DEBUG_SESSION, "VtCtl:Call. dir %d",
+ iMobileCallInfo.iRemoteParty.iDirection )
+ __VTPRINT2( DEBUG_SESSION, "VtCtl:Call. status %d",
+ iMobileCallInfo.iStatus )
+#ifdef VTDEBUG
+ RDebug::Print(_L(" VtCtl.RemoteNumber=%S"),
+ &iMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber );
+#endif
+ __VTPRINTEXITR( "CVtCtlVideoCall.UpdateCallInfo err=%d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::GetDuration
+// Returns call duration
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlVideoCall::GetDuration( TVtCtlDuration& aDuration )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.GetDuration" )
+ const TInt res( UpdateCallInfo() );
+ if ( res == KErrNone )
+ {
+ aDuration = iMobileCallInfo.iDuration;
+ }
+ __VTPRINTEXITR( "CVtCtlVideoCall.GetDuration err=%d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::GetCallState
+// Gets call state
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlVideoCall::GetCallState(
+ MVtCtlCallControl::TVtCtlState& aState )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.GetCallState" )
+ RMobileCall::TMobileCallStatus status;
+ aState = iCallInfo.iStatus;
+ const TInt res( iCall->GetMobileCallStatus( status ) );
+
+ // update internal state only if differs from previous state
+ if ( res == KErrNone &&
+ CVtCtlCallStatusMonitor::IsLegalNewState(
+ status, iMobileCallInfo.iStatus ) )
+ {
+ // update 1) internal values, and
+ iMobileCallInfo.iStatus = status;
+ iCallInfo.iPreviousStatus = iCallInfo.iStatus;
+ iCallInfo.iStatus = CVtCtlCallStatusMonitor::MapState( status );
+
+ // 2) return value
+ aState = iCallInfo.iStatus;
+ }
+ __VTPRINTEXITR( "CVtCtlVideoCall.GetCallState err=%d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::HandleCallStatusChangeL
+// Handles status change
+// -----------------------------------------------------------------------------
+//
+void CVtCtlVideoCall::HandleCallStatusChangeL(
+ TVtCtlSessionId ,
+ MVtCtlCallControl::TVtCtlState aStatus,
+ MVtCtlCallControl::TVtCtlState aPreviousStatus )
+ {
+ __VTPRINTENTER( "CVtCtlVideoCall.HandleCallStatusChangeL" )
+ // If monitor has received outdated notification ignore the event.
+ // This may happen if call status has asked from ETel and there
+ // are still old completed status notifications that are not handled.
+ // => contradition between internal status in this object and one
+ // received from ststus monitor. Ignore it.
+ if ( aStatus > iCallInfo.iStatus || aStatus == MVtCtlCallControl::EIdle )
+ {
+ iCallInfo.iPreviousStatus = iCallInfo.iStatus;
+ iCallInfo.iStatus = aStatus;
+
+ iObserver.HandleCallStatusChangeL(
+ iCallInfo.iId,
+ aStatus,
+ aPreviousStatus );
+ }
+ __VTPRINTEXIT( "CVtCtlVideoCall.HandleCallStatusChangeL" )
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/VtCtlPanic.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 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: Call control panic
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "VtCtlPanic.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+//
+// -----------------------------------------------------------------------------
+//
+void Panic( TVtCtlPanic aPanic )
+ {
+ User::Panic( KVtCtlPanicCategory(), aPanic );
+ }
+#pragma CTC ENDSKIP
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/EABI/videotelengU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+ _ZN11CVtEngModel4NewLER19MVtEngEventObserverR21MVtEngCommandObserver @ 1 NONAME
+ _ZN11CVtEngModel9ExtensionERK4TUid @ 2 NONAME
+ _ZNK11CVtEngModel14CommandHandlerEv @ 3 NONAME
+ _ZNK11CVtEngModel5AudioEv @ 4 NONAME
+ _ZNK11CVtEngModel5MediaEv @ 5 NONAME
+ _ZNK11CVtEngModel7SessionEv @ 6 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2004 - 2007 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: videoteleng build information file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../Inc/Base/VtEngEvents.h |../../../inc/vtengevents.h
+../Inc/Base/CVtEngModel.h |../../../inc/cvtengmodel.h
+../Inc/Base/MVtEngEventObserver.h |../../../inc/mvtengeventobserver.h
+../Inc/Commands/vtengcommands.h |../../../inc/vtengcommands.h
+../Inc/Commands/MVtEngCommandHandler.h |../../../inc/mvtengcommandhandler.h
+../Inc/Commands/MVtEngCommandObserver.h |../../../inc/mvtengcommandobserver.h
+../Inc/Session/MVtEngSessionInfo.h |../../../inc/mvtengsessioninfo.h
+../Inc/Audio/MVtEngAudio.h |../../../inc/mvtengaudio.h
+../Inc/Media/MVtEngMedia.h |../../../inc/mvtengmedia.h
+../Inc/Media/MVtEngFrameObserver.h |../../../inc/mvtengframeobserver.h
+../Inc/Media/TVtEngRendering.h |../../../inc/tvtengrendering.h
+../Inc/Media/TVtEngRendering.inl |../../../inc/tvtengrendering.inl
+../Inc/Media/TVtEngRenderingDSA.h |../../../inc/tvtengrenderingdsa.h
+../Inc/Media/TVtEngRenderingDSA.inl |../../../inc/tvtengrenderingdsa.inl
+../Inc/Media/TVtEngRenderingDP.h |../../../inc/tvtengrenderingdp.h
+../Inc/Media/TVtEngRenderingDP.inl |../../../inc/tvtengrenderingdp.inl
+../Inc/Media/TVtEngRenderingNGA.h |../../../inc/tvtengrenderingnga.h
+../Inc/Media/TVtEngRenderingNGA.inl |../../../inc/tvtengrenderingnga.inl
+../Inc/Extensions/MVtEngCameraPreferences.h |../../../inc/mvtengcamerapreferences.h
+../Inc/Extensions/mvtengrecord2file.h |../../../inc/mvtengrecord2file.h
+
+
+../data/videoteleng_stub.SIS /epoc32/data/z/system/install/videoteleng_stub.sis
+
+../Logger/Inc/cvtlogger.h |../../../inc/cvtlogger.h
+../Logger/Inc/vtlogger.hrh |../../../inc/vtlogger.hrh
+
+// Export IBY file
+../Rom/videoteleng.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videoteleng.iby)
+
+PRJ_MMPFILES
+
+../Logger/Group/vtlogger.mmp
+../CallCtrl/Group/videocallctrl.mmp
+../Group/videoteleng.mmp
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Group/videoteleng.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2004 - 2006 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: This is project specification file for the Videoteleng.
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../Inc/Base/VtEngDefs.hrh"
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET videoteleng.dll
+TARGETTYPE dll
+UID 0x1000008d 0x101F867F
+
+SOURCEPATH ../Src/Audio
+SOURCE CVtEngAudioHandler.cpp
+
+SOURCEPATH ../Src/Base
+SOURCE CVtEngModel.cpp
+SOURCE CVtEngEventManager.cpp
+SOURCE CVtEngHandlerContainer.cpp
+SOURCE CVtEngSettings.cpp
+SOURCE CVtEngPubSubsListener.cpp
+SOURCE cvtengincomingcallmonitor.cpp
+
+SOURCE cvtengmdtrcommandsender.cpp
+SOURCE cvtengmdtrmessagelistener.cpp
+SOURCE cvtengmediatorservice.cpp
+SOURCE CVtEngAccessoryHandler.cpp
+
+SOURCE CVtEngCRProxy.cpp
+SOURCE CVtEngCRObserverItem.cpp
+SOURCE CVtEngInitializer.cpp
+SOURCE CVtEngSATClient.cpp
+SOURCE CVtEngDeviceLockMonitor.cpp
+SOURCE VtEngUtils.cpp
+
+SOURCEPATH ../Src/Commands
+SOURCE CVtEngCommandHandler.cpp
+SOURCE CVtEngOperation.cpp
+SOURCE cvtenginternaloperation.cpp
+SOURCE TVtEngOperationUtils.cpp
+
+SOURCEPATH ../Src/Extensions
+SOURCE CVtEngExtensions.cpp
+SOURCE CVtEngExtensionBase.cpp
+SOURCE CVtEngCameraPreferences.cpp
+#if defined (RD_VT_RTF)
+SOURCE cvtengrecord2file.cpp
+SOURCE cvtengr2ftoneplayer.cpp
+#endif // RD_VT_RTF
+
+
+SOURCEPATH ../Src/Media
+SOURCE CVtEngMediaHandler.cpp
+SOURCE CVtEngDrawDP.cpp
+SOURCE CVtEngDrawDSA.cpp
+SOURCE CVtEngDrawNGA.cpp
+SOURCE CVtEngDtmfHandler.cpp
+SOURCE CVtEngLocalVideo.cpp
+SOURCE CVtEngRemoteVideo.cpp
+SOURCE CVtEngImageScaler.cpp
+
+SOURCEPATH ../Src/Session
+SOURCE CVtEngSessionHandler.cpp
+
+SOURCEPATH ../Src/State
+SOURCE CVtEngStateManager.cpp
+SOURCE CVtEngStateAlerting.cpp
+SOURCE CVtEngStateBase.cpp
+SOURCE CVtEngStateClearing.cpp
+SOURCE CVtEngStateConnected.cpp
+SOURCE CVtEngStateIdle.cpp
+SOURCE CVtEngStateInitializing.cpp
+SOURCE CVtEngStateNegotiating.cpp
+SOURCE CVtEngStateOpen.cpp
+SOURCE CVtEngStateRinging.cpp
+SOURCE CVtEngDtmfState.cpp
+SOURCE CVtEngDtmfIdle.cpp
+SOURCE CVtEngDtmfSending.cpp
+SOURCE CVtEngDtmfBuffered.cpp
+
+DOCUMENT ../../Group/bld.inf
+
+USERINCLUDE ../Inc/Base
+USERINCLUDE ../Inc/Audio
+USERINCLUDE ../Inc/Commands
+USERINCLUDE ../Inc/Session
+USERINCLUDE ../Inc/Media
+USERINCLUDE ../Inc/State
+USERINCLUDE ../Inc/Extensions
+USERINCLUDE ../CallCtrl/Inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/mmf/common
+SYSTEMINCLUDE /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY ws32.lib
+LIBRARY videosource.lib
+LIBRARY bitgdi.lib
+LIBRARY displaysink.lib
+LIBRARY featmgr.lib
+LIBRARY phoneclient.lib
+LIBRARY dsclient.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY sysutil.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+
+LIBRARY commonengine.lib
+LIBRARY mediaclientaudio.lib
+
+LIBRARY accclient.lib
+LIBRARY telephonyaudiorouting.lib
+
+LIBRARY vtimagetransforms.lib
+
+DEBUGLIBRARY vtlogger.lib
+
+
+LIBRARY satclient.lib
+
+LIBRARY esock.lib // BigEndian
+
+LIBRARY mmfdevsound.lib
+
+LIBRARY gdi.lib
+
+LIBRARY mediatorclient.lib
+LIBRARY videotelproto.lib
+LIBRARY surfaceupdateclient.lib
+LIBRARY surfacemanager.lib
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Audio/CVtEngAudioHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2004-2006 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: Audio handler class.
+*
+*/
+
+
+
+#ifndef CVTENGAUDIOHANDLER_H
+#define CVTENGAUDIOHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtEngAudio.h"
+#include "CVtEngOperation.h"
+#include "MVtEngSettingPSObserver.h"
+#include "CVTEngPubSubsListener.h"
+#include "CVtEngAccessoryHandler.h"
+#include "MVtEngAccessoryObserver.h"
+// new audio routing
+#include "TelephonyAudioRouting.h"
+#include "MTelephonyAudioRoutingObserver.h"
+#include <rphcltserver.h>
+#include <mmf/server/sounddevice.h>
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+class CRoutingEnabler;
+
+/**
+* Class for audio handling.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngAudioHandler )
+ : public CBase,
+ public MVtEngAudio,
+ private MVtEngAccessoryObserver,
+ private MTelephonyAudioRoutingObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngAudioHandler* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngAudioHandler();
+
+ public: // New functions.
+
+ /**
+ * Performs on operation in the handler.
+ * @param operation to be performed on the handler
+ */
+ void HandleL( CVtEngOperation& aOperation );
+
+ /**
+ * Creates/releases temporary DevSound instance.
+ * @param aEnable
+ * ETrue creates devSound
+ * EFalse destructs devSound
+ */
+ void SetRoutingEnablerL( const TBool aEnable );
+
+ /**
+ * Increases audio volume
+ */
+ TBool IncreaseVolume();
+
+ /**
+ * Decreases audio volume
+ */
+ TBool DecreaseVolume();
+
+ private: // Functions from base classes.
+
+ // from MVtEngAccessoryObserver
+
+ /** @see MVtEngAccessoryObserver */
+ virtual void AccessoryModeChanged( const TAccMode& aMode,
+ const TBool aActivated );
+
+ // from MTelephonyAudioRoutingObserver
+
+ /** @see MTelephonyAudioRoutingObserver::AvailableOutputsChanged */
+ virtual void AvailableOutputsChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
+
+ /** @see MTelephonyAudioRoutingObserver::OutputChanged */
+ virtual void OutputChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
+
+ /** @see MTelephonyAudioRoutingObserver::SetOutputComplete */
+ virtual void SetOutputComplete( CTelephonyAudioRouting& aTelephonyAudioRouting,
+ TInt aError );
+
+ public: // Functions from base classes.
+
+ /** @see MVtEngAudio::GetRoutingState. */
+ virtual TInt GetRoutingState( TAudioRoutingState& aAudioRoutingState );
+
+ /** @see MVtEngAudio::GetRoutingAvailability. */
+ virtual TInt GetRoutingAvailability(
+ const TAudioRoutingState aAudioRoutingState,
+ TBool& aAvailable );
+
+ /** @see MVtEngAudio::GetHeadsetType. */
+ virtual TInt GetHeadsetType( TWiredHeadsetType& aHeadsetType );
+
+ /** @see MVtEngAudio::OutputVolume. */
+ virtual TInt OutputVolume( const TBool aHandsetVolume ) const;
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngAudioHandler();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * Completes operation.
+ * @param aResult error code
+ */
+ void CompleteOperation( TInt aResult );
+
+ /**
+ * Sets loudspeaker on / off.
+ * @param aTurnOn ETrue if on, EFalse if off
+ * @param aShowNote ETrue if note is allowed to be shown, EFalse if not
+ */
+ void SetLoudspeakerL( TBool aTurnOn, TBool aShowNote );
+
+ /**
+ * Sets Bluetooth on / off.
+ * @param aTurnOn ETrue if on, EFalse if off
+ */
+ void SetBluetoothL( TBool aTurnOn );
+
+ /**
+ * Updates current volume that should be used.
+ */
+ void UpdateCurrentVolume();
+
+ /**
+ * Checks if given audio output route is available.
+ * @return ETrue if given audio output route is available
+ */
+ TBool IsOutputAvailable( const CTelephonyAudioRouting::TAudioOutput aOutput );
+
+ /**
+ * Modifies the volume by aDelta.
+ */
+ TBool AdjustVolume( const TInt aDelta );
+
+ private: // Data
+
+ // Enumeration flags used in the implementation.
+ enum
+ {
+ // Handset
+ EFlagHandset = 1,
+ // Loudspeaker
+ EFlagLoudspeaker = 2,
+ // Bluetooth handsfree
+ EFlagBT = 4,
+ // Wired headset
+ EFlagWiredHeadset = 8
+ };
+
+ // Accessory mode listener class.
+ CVtEngAccessoryHandler* iAccHandler;
+
+ // Contains the current accessory and it's audio mode.
+ TAccPolAccessoryMode iAccMode;
+
+ // Pointer to telephony audio routing instance
+ CTelephonyAudioRouting* iTelephonyAudioRouting;
+
+ // Current audio routing state
+ CTelephonyAudioRouting::TAudioOutput iCurrentAudioOutput;
+
+ // Holds old routing state.
+ TAudioRoutingState iOldAudioRoutingState;
+
+ // Pointer to an operation.
+ CVtEngOperation* iOperation;
+
+ /**
+ * For enabling audio routing before actual
+ * DevSound for play is created.
+ */
+ CRoutingEnabler* iRoutingEnabler;
+ };
+
+/**
+* Class for handling dummy DevSound. It enables audio routing
+* before video call is connected. Proper devSound instance
+* must exist in order to control audio routing. Actual instance
+* is created in protocol in later phase of the stack
+* initialization and one in here is deleted.
+*/
+NONSHARABLE_CLASS( CRoutingEnabler ) :
+ public CBase,
+ private MDevSoundObserver
+ {
+ public: // constructor and destructor
+
+ // Constructor
+ static CRoutingEnabler* NewL();
+
+ // Destructor
+ ~CRoutingEnabler();
+
+ private: // constructors
+
+ // c++ constructor
+ CRoutingEnabler();
+
+ /**
+ * Creates and starts devSound.
+ */
+ void StartL();
+
+ public: // new functions
+
+ public: // from MDevSoundObserver
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void InitializeComplete( TInt aError );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void ToneFinished( TInt aError );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void BufferToBeFilled( CMMFBuffer* aBuffer );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void PlayError( TInt aError );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void BufferToBeEmptied( CMMFBuffer* aBuffer );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void RecordError( TInt aError );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void ConvertError( TInt aError );
+
+ /**
+ * @see MDevSoundObserver
+ */
+ virtual void DeviceMessage(
+ TUid aMessageType,
+ const TDesC8& aMsg );
+
+ private:
+ // Temporary DevSound instance to enable audio routing
+ // before actual instance in protocol is ready.
+ // Routing can be changed already when MO call is alerting.
+ CMMFDevSound* iDevSound;
+
+ // Variable to detect failure in Devsound initialization or PlayInitL().
+ // If failure happens, Devsound instance is deleted outside callback
+ // in desctructor. ETrue; failure happened, EFalse; all OK
+ TBool iDevsoundInitializeFailure;
+ };
+
+
+#endif // CVTENGAUDIOHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Audio/MVtEngAudio.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 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: Audio volume and routing interface
+*
+*/
+
+
+
+#ifndef MVTENGAUDIO_H
+#define MVTENGAUDIO_H
+
+// INCLUDES
+#include <e32def.h>
+
+/**
+* Interface for audio related information.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngAudio
+ {
+ public:
+
+ /**
+ * Current routing state
+ */
+ enum TAudioRoutingState
+ {
+ EAudioHandset,
+ EAudioLoudspeaker,
+ EAudioBT,
+ EAudioWiredHeadset
+ };
+
+ /**
+ * Wired headset type
+ */
+ enum TWiredHeadsetType
+ {
+ EWiredHeadset,
+ EWiredLoopset,
+ EWiredTty,
+ EWiredNone
+ };
+
+ /**
+ * Audio routing setting to be used when changing
+ * audio routing from client.
+ */
+ enum TVtEngRoutingSetting
+ {
+ EActivateHandsfree,
+ EDeactivateHansfree,
+ EActivateBT,
+ EDeactivateBT
+ };
+
+ /**
+ * Speaker volume levels for Handset and Handsfree.
+ */
+ struct TVtEngOutputVolume
+ {
+ TInt iHandsetVolume;
+ TInt iHandsfreeVolume;
+ };
+
+ /**
+ * Returns target where audio is currently routed to.
+ * @param aAudioRoutingState routing target
+ * @return Symbian OS error code
+ */
+ virtual TInt GetRoutingState(
+ TAudioRoutingState& aAudioRoutingState ) = 0;
+
+ /**
+ * Returns if routing to specified target can be
+ * done.
+ * @param aAudioRoutingState routing target
+ * @param aAvailable ETrue if possible to do
+ * @return Symbian OS error code
+ */
+ virtual TInt GetRoutingAvailability(
+ const TAudioRoutingState aAudioRoutingState,
+ TBool& aAvailable ) = 0;
+
+ /**
+ * Returns type of wired headset
+ * @return Symbian OS error code.
+ */
+ virtual TInt GetHeadsetType(
+ TWiredHeadsetType& aHeadsetType ) = 0;
+
+ /**
+ * Returns speaker volume
+ * @param aHandsetVolume if ETrue returns handset volume,
+ * otherwise loudspeaker volume.
+ * @return output volume ranging from 1 to 10 or Symbian OS error code.
+ */
+ virtual TInt OutputVolume(
+ const TBool aHandsetVolume ) const = 0;
+
+
+ };
+
+#endif // MVTENGAUDIO_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVTEngPubSubsListener.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2004-2006 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: Listener for Publish and subscribe data.
+*
+*/
+
+
+#ifndef CVTENGPUBSUBSGSETTINGS_H
+#define CVTENGPUBSUBSGSETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <e32property.h>
+
+// FORWARD DECLARATIONS
+class MVtEngSettingPSObserver;
+
+// CLASS DECLARATION
+
+/**
+* RProperty poller.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.8
+*/
+NONSHARABLE_CLASS( CVtEngPubSubsListener ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aUid the Uid to use
+ * @param aKey item's key
+ * @param aObserver callback interface for notification
+ * @return instance of CVtEngPubSubsListener
+ */
+ static CVtEngPubSubsListener* NewL( const TUid aUid, const TInt aKey,
+ MVtEngSettingPSObserver* aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngPubSubsListener();
+
+ public: // New functions.
+
+ /**
+ * Gets integer value from P & S.
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( TInt& aVal );
+
+ /**
+ * Gets 8 bit string value from P&S.
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( TDes8& aVal );
+
+ /**
+ * Gets 16 bit descriptor value from P&S.
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( TDes16& aVal );
+
+ private: // New functions.
+
+ /**
+ * Starts the listening (RunL).
+ */
+ void StartListening();
+
+ private: // From CActive.
+
+ /** @see CActive::RunL */
+ virtual void RunL();
+
+ /** @see CActive::Cancel */
+ virtual void DoCancel();
+
+ /** @see CActive::RunError */
+ virtual TInt RunError( TInt aError );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ * @param aUid the Uid to use
+ * @param aKey item's key
+ * @param aObserver callback interface for notification
+ */
+ CVtEngPubSubsListener( const TUid aUid, TInt aKey,
+ MVtEngSettingPSObserver* aObserver );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ // UID of the monitored item.
+ TUid iUid;
+
+ // ID of the monitored item.
+ TInt iId;
+
+ // Property to subscribe to.
+ RProperty iProperty;
+
+ // The notification interface.
+ MVtEngSettingPSObserver* iCallback;
+ };
+
+#endif // CVTENGPUBSUBSGSETTINGS_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngAccessoryHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2004-2005 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: Accessory handler.
+*
+*/
+
+
+
+#ifndef CVTENGACCHANDLER_H
+#define CVTENGACCHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <AccPolAccessoryMode.h>
+#include <AccessoryServer.h>
+#include <AccessoryMode.h>
+
+// FORWARD DECLARATIONS
+class MVtEngAccessoryObserver;
+
+// CLASS DECLARATION
+
+/**
+* Accessory mode listener for video telephony.
+*
+* @lib videoteleng
+* @since 3.0
+*/
+NONSHARABLE_CLASS( CVtEngAccessoryHandler ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ ? @return instance of CVtEngAccessoryHandler
+ */
+ static CVtEngAccessoryHandler* NewL( );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngAccessoryHandler();
+
+ public: // From base classes.
+
+ /**
+ * Handles accessory mode changes.
+ */
+ void RunL();
+
+ /**
+ * Cancels accessory mode monitoring.
+ */
+ void DoCancel();
+
+ /**
+ * Handles exceptions in RunL.
+ * @param aError error code.
+ * @return error code.
+ */
+ TInt RunError( TInt aError );
+
+ public: // New functions
+
+ /**
+ * Sets a new listener interested in accessory changes.
+ * @param aObserver call back interface for notifications.
+ */
+ void RegisterObserverL( MVtEngAccessoryObserver* aObserver );
+
+ /**
+ * Unregisters a listener.
+ * NOTE, do not call this from NotifyObserversL!
+ * @param aObserver call back interface for notifications.
+ */
+ void RemoveObserver( MVtEngAccessoryObserver* aObserver );
+
+ /**
+ * Returns current accessory mode.
+ * @param aAccessoryMode accessory mode in return
+ * @return Symbian error code
+ */
+ TInt AccessoryMode( TAccPolAccessoryMode& aAccessoryMode ) const;
+
+ private: // New functions.
+
+ /**
+ * Removes all observers
+ */
+ void RemoveAllObservers();
+
+ /**
+ * Sets object active and renews subscription.
+ */
+ void StartListening();
+
+ /**
+ * Notifies all registered listeners.
+ */
+ void NotifyObserversL();
+
+ private: // Constructors.
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngAccessoryHandler();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ private: // Data
+ // Current accessory mode.
+ TAccPolAccessoryMode iCurrentAccessoryMode;
+
+ // Owned array of accessory mode observers.
+ RPointerArray< MVtEngAccessoryObserver > iAccessoryObservers;
+
+ // Owned accessory server session.
+ RAccessoryServer iAccessoryServer;
+
+ // Owned accessory mode subsession.
+ RAccessoryMode iAccessoryMode;
+
+ // Accessory mode structure.
+ TAccPolAccessoryMode iMode;
+
+ };
+
+#endif // CVTENGACCHANDLER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngCRObserverItem.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2004-2006 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: Central repository observer class.
+*
+*/
+
+
+#ifndef CVTENGCROBSITEM_H
+#define CVTENGCROBSITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include "cenrepnotifyhandler.h"
+
+// FORWARD DECLARATIONS
+class MVtEngCRSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+* Central repository listener for video telephony.
+*
+* @lib videoteleng.lib
+* @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngCRObserverItem ) : public CBase,
+ public MCenRepNotifyHandlerCallback
+ {
+ public: // Constructors and destructor.
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver the real observer to notify
+ * @param aUid UID for this listener
+ * @param aKey ID for this listener
+ * @param aType type of information interested in
+ * @return this CR observer
+ */
+ static CVtEngCRObserverItem* NewL(
+ MVtEngCRSettingObserver* aObserver,
+ TUid aUid, TUint32 aKey,
+ CCenRepNotifyHandler::TCenRepKeyType aType );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngCRObserverItem();
+
+ public: // From MCenRepNotifyHandlerCallback.
+
+ /**
+ * Callback to notify changed integer setting.
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyInt( TUint32 aId, TInt aNewValue );
+
+ /**
+ * Callback to notify changed real setting.
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyReal( TUint32 aId, TReal aNewValue );
+
+ /**
+ * Callback to notify changed string setting.
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue );
+
+ /**
+ * Callback to notify changed binary setting.
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyBinary( TUint32 aId, const TDesC8& aNewValue );
+
+ /**
+ * Callback to notify changed setting.
+ * @param aId changed id
+ */
+ void HandleNotifyGeneric( TUint32 aId);
+
+ /**
+ * Callback to notify of an occurred error.
+ * @param aId changed id
+ * @param aError
+ * @param aHandler which handler
+ */
+ void HandleNotifyError( TUint32 aId, TInt aError,
+ CCenRepNotifyHandler* aHandler );
+
+ public: // New functions.
+
+ /**
+ * Checks if this one matches given UID and key.
+ * @param aUID UID to use in comparison
+ * @param aKey key to use in comparison
+ * @return ETrue if match
+ */
+ TBool Offer( const TUid aUid, const TUint32 aKey ) const;
+
+ /**
+ * Checks if this one matches given UID.
+ * @param aUID UID to use in comparison
+ * @return ETrue if match
+ */
+ TBool Offer( const TUid aUid ) const;
+
+ /**
+ * Checks if this one matches given key.
+ * @param aKey key to use in comparison
+ * @return ETrue if match
+ */
+ TBool Offer( const TUint32 aKey ) const;
+
+ /**
+ * Returns UID of this handler.
+ * @return UID
+ */
+ TUid Uid() const;
+
+ /**
+ * Returns key of this handler.
+ * @return key
+ */
+ TUint32 Key() const;
+
+ /**
+ * Returns notifier of this handler.
+ * @return notifier
+ */
+ CCenRepNotifyHandler* Notifier() const;
+
+ /**
+ * Returns type of this handler.
+ * @return type
+ */
+ CCenRepNotifyHandler::TCenRepKeyType Type() const;
+
+ /**
+ * Returns observer of this handler.
+ * @return observer
+ */
+ MVtEngCRSettingObserver* Observer() const;
+
+ /**
+ * Sets CenRep notifier
+ * @param notifier to set.
+ */
+ void SetCenRepNotifier( CCenRepNotifyHandler* aNotifier );
+
+
+ private: // Constructor.
+
+ /**
+ * C++ default constructor.
+ * @param aObserver the real observer to notify
+ * @param aUid UID for this listener
+ * @param aKey ID for this listener
+ * @param aType type of information interested in
+ */
+ CVtEngCRObserverItem( MVtEngCRSettingObserver* Observer,
+ TUid aUid, TUint32 aKey,
+ CCenRepNotifyHandler::TCenRepKeyType aType );
+
+ private: // Data
+
+ // Callback for notifications.
+ MVtEngCRSettingObserver* iObserver;
+
+ // UID for this item.
+ TUid iUid;
+
+ // Key for this item.
+ TUint32 iKey;
+
+ // Type of listener.
+ CCenRepNotifyHandler::TCenRepKeyType iType;
+
+ // Central repository notifier.
+ CCenRepNotifyHandler* iNotifier;
+};
+#endif // CVTENGCROBSITEM_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngCRProxy.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2004-2006 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: Central repository proxy, which is used by all CR dependent.
+*
+*/
+
+
+
+#ifndef CVTENGCRPROXY_H
+#define CVTENGCRPROXY_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <centralrepository.h>
+
+// FORWARD DECLARATIONS
+class CVtEngCRObserverItem;
+class CRepository;
+class MVtEngCRSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+* Central repository interface for video telephony.
+*
+* @lib videoteleng.lib
+* @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngCRProxy ) : public CBase
+ {
+ public: // Data structures.
+
+ // Internal data structure for storing CR sessions.
+ NONSHARABLE_CLASS( CCRSession ) : public CBase
+ {
+ public:
+ /**
+ * Destructor needed.
+ */
+ ~CCRSession();
+
+ // CenRep session.
+ CRepository* iSession;
+ // Uid attached to CenRep session.
+ TUid iUid;
+ };
+
+ public: // Constructors and destructor.
+
+ /**
+ * Two-phased constructor.
+ * @return instance of CVtEngCRProxy
+ */
+ static CVtEngCRProxy* NewL( );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngCRProxy();
+
+ public: // New functions
+
+ /**
+ * Sets integer value to Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value to set
+ * @return error code
+ */
+ TInt Set( const TUid aUid, const TUint32 aId, TInt aVal );
+
+ /**
+ * Sets real value to Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value to set
+ * @return error code
+ */
+ TInt Set( const TUid aUid, const TUint32 aId, const TReal& aVal );
+
+ /**
+ * Sets binary value to Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value to set
+ * @return error code
+ */
+ TInt Set( const TUid aUid, const TUint32 aId, const TDesC8& aVal );
+
+ /**
+ * Sets string value to Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value to set
+ * @return error code
+ */
+ TInt Set( const TUid aUid, const TUint32 aId, const TDesC16& aVal );
+
+ /**
+ * Gets integer value from Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( const TUid aUid, const TUint32 aId, TInt& aVal );
+
+ /**
+ * Gets real value from Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( const TUid aUid, const TUint32 aId, TReal& aVal );
+
+ /**
+ * Gets binary value from Central Repository
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( const TUid aUid, const TUint32 aId, TDes8& aVal );
+
+ /**
+ * Gets string value from Central Repository.
+ * @param aUid used UID
+ * @param aId which key to use
+ * @param aVal a value in return
+ * @return error code
+ */
+ TInt Get( const TUid aUid, const TUint32 aId, TDes16& aVal );
+
+ /**
+ * Add a new Cen Rep interested object.
+ * @param aObserver callback interface
+ */
+ void RegisterInterestedL( CVtEngCRObserverItem* aObserver );
+
+ /**
+ * Removes an observer.
+ * @param aObserver to be removed
+ */
+ void RemoveInterested( CVtEngCRObserverItem& aObserver );
+
+ private: // New functions
+
+ /**
+ * Gets a Cen Rep session matching UID.
+ * @param aUid UID to use in search
+ * @param aCRSession found session or a new session
+ * @return error code
+ */
+ TInt GetSessionL( const TUid aUid, CRepository*& aCRSession );
+
+ /**
+ * Creates an id-CenRep paired session.
+ * @param aUid the UID to use
+ * @return new session or NULL
+ */
+ CCRSession* NewCRSessionL( TUid aUid );
+
+ /**
+ * Finds observer item.
+ * @param aKey
+ * @param aIndex
+ * @return observer item or NULL
+ */
+ CVtEngCRObserverItem* FindItem(
+ const TUint32 aKey, TInt& aIndex ) const;
+
+ /**
+ * Removes all observers
+ *
+ */
+ void RemoveAllObservers();
+
+ /**
+ * Removes all Central repository instances
+ *
+ */
+ void RemoveSessions();
+
+ /**
+ * Maps a given UID to a certain central repository instance
+ * @param aUid the UID to map
+ * @return found CRepository item or NULL
+ */
+ CRepository* MapUidToCR( const TUid aUid );
+
+ /**
+ * Finds observer item.
+ * @param aUid
+ * @param aKey
+ * @param aIndex
+ * @return observer item or NULL
+ */
+ CVtEngCRObserverItem* FindItem( const TUid& aUid, const TUint32 aKey,
+ TInt& aIndex ) const;
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngCRProxy();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ private: // Data
+
+ // Storage for data observers.
+ RPointerArray<CVtEngCRObserverItem> iObserverItems;
+
+ // Array for central repository sessions.
+ RPointerArray<CVtEngCRProxy::CCRSession> iCRSessions;
+ };
+
+#endif // CVTENGCRPROXY_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngDeviceLockMonitor.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006 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: Monitor for device lock (autolock)
+*
+*/
+
+
+
+#ifndef CVTENGDEVICELOCKMONITOR_H
+#define CVTENGDEVICELOCKMONITOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtEngSettingPSObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngPubSubsListener;
+
+// CLASS DECLARATION
+
+/**
+* Monitor for autolock state.
+*
+* @lib videoteleng
+* @since 3.1
+*/
+NONSHARABLE_CLASS( CVtEngDeviceLockMonitor ) : public CBase, public MVtEngSettingPSObserver
+ {
+ public: // Constructors and destructor
+
+ static CVtEngDeviceLockMonitor* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngDeviceLockMonitor();
+
+ public: // New functions
+
+ /**
+ * Sends event to UI of current autolock state
+ */
+ void NotifyState() const;
+
+ public: // From MVtEngSettingPSObserver
+
+ /**
+ * @see MVtEngSettingPSObserver::HandleNotifyPSL
+ */
+ void HandleNotifyPSL( const TUid aUid, const TInt& aKey,
+ const TRequestStatus& aStatus );
+
+ private:
+ /**
+ * C++ constructor.
+ */
+ CVtEngDeviceLockMonitor();
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+ private:
+
+ // Listener for autolock state
+ CVtEngPubSubsListener* iAutolockListener;
+ };
+
+#endif // CVTENGDEVICELOCKMONITOR_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngEventManager.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2006 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: Event manager
+*
+*/
+
+
+
+#ifndef CVTENGEVENTMANAGER_H
+#define CVTENGEVENTMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "VtEngEvents.h"
+
+// FORWARD DECLARATIONS
+class MVtEngEventObserver;
+
+// CLASS DECLARATION
+
+/**
+* This class is responsible for notifying client
+* on engine events.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngEventManager ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngEventManager* NewL(
+ MVtEngEventObserver& aEventObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngEventManager();
+
+ public: // New functions
+
+ /**
+ * Notifies client on session state change.
+ */
+ void SessionStateChanged();
+
+ /**
+ * Notifies event to observer.
+ * @param aEvent event
+ */
+ static void NotifyEvent( const TInt aEvent );
+
+ void AddObserverL( MVtEngEventObserver* aObserver );
+
+ void RemoveObserver( const MVtEngEventObserver* aObserver );
+
+ private: // from CActive
+
+ void RunL();
+
+ void DoCancel();
+
+ private:
+
+ /**
+ * Notifies event to observer
+ */
+ void DoNotifyEvent( const TInt aEvent );
+
+ TBool QueueAsyncEvent( const TInt aEvent );
+
+ /**
+ * Queue event and signal AO.
+ * @param aEvent Asynchronous event to be signalled.
+ */
+ void QueueAndSignal( const TInt aEvent );
+
+ /**
+ * Signals AO.
+ */
+ void Signal();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngEventManager();
+
+ // 2nd phase constructor
+ void ConstructL( MVtEngEventObserver& aEventObserver );
+
+ private: // Data
+
+ RPointerArray<MVtEngEventObserver> iObservers;
+
+ // Asynchronous events are stored in this array and
+ // executed in order
+ CArrayFixFlat< TInt >* iEventQueue;
+
+ };
+
+#endif // CVTENGEVENTMANAGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2006 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: Handler container
+*
+*/
+
+
+
+#ifndef CVTENGHANDLERCONTAINER_H
+#define CVTENGHANDLERCONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CVtEngMediaHandler.h"
+#include "CVtEngSessionHandler.h"
+#include "CVtEngAudioHandler.h"
+#include "CVtEngDtmfHandler.h"
+
+// FORWARD DECLARATIONS
+class MVtEngSessionInfo;
+class MVtEngMedia;
+class MVtEngAudio;
+
+// CLASS DECLARATION
+
+/**
+* Container for media, audio and session handlers.
+*
+* @lib videoteleng
+* @since Series60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngHandlerContainer ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngHandlerContainer* NewL( );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngHandlerContainer();
+
+ public: // New functions
+
+
+ /**
+ * Returns session handler.
+ * @return session handler
+ */
+ inline MVtEngSessionInfo& Session() const;
+
+ /**
+ * Returns media handler.
+ * @return media handler
+ */
+ inline MVtEngMedia& Media() const;
+
+ /**
+ * Returns audio handler.
+ * @return audio handler
+ */
+ inline MVtEngAudio& Audio() const;
+
+
+ /**
+ * Returns DTMF handler.
+ * @return DTMF handler
+ */
+ inline CVtEngDtmfHandler& Dtmf() const;
+
+ /*
+ * Uninitializes audio and session handlers.
+ * Media handler uninitialization is done
+ * asynchronously using directly the handler.
+ */
+ void Uninitialize();
+
+ /**
+ * Creates DTMF handler
+ * @param aH324Config H324 configure interface
+ */
+ void CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngHandlerContainer();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // member data
+
+ // media handler
+ CVtEngMediaHandler* iMedia;
+
+ // session handler
+ CVtEngSessionHandler* iSession;
+
+ // audio handler
+ CVtEngAudioHandler* iAudio;
+
+
+ // DTMF handler
+ CVtEngDtmfHandler* iDtmf;
+
+ };
+
+#include "CVtEngHandlerContainer.inl"
+
+#endif // CVTENGHANDLERCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 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: handler container
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Session
+// Returns specific handler
+//
+// -----------------------------------------------------------------------------
+//
+inline MVtEngSessionInfo& CVtEngHandlerContainer::Session() const
+ {
+ return *iSession;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Media
+// Returns specific handler
+//
+// -----------------------------------------------------------------------------
+//
+inline MVtEngMedia& CVtEngHandlerContainer::Media() const { return *iMedia; }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Audio
+// Returns specific handler
+//
+// -----------------------------------------------------------------------------
+//
+inline MVtEngAudio& CVtEngHandlerContainer::Audio() const { return *iAudio; }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Dtmf
+// Returns specific handler
+//
+// -----------------------------------------------------------------------------
+//
+inline CVtEngDtmfHandler& CVtEngHandlerContainer::Dtmf() const { return *iDtmf; }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngInitializer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2004 - 2006 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: Class for initializing the engine gradually.
+* Active object initializes one "subsystem" on each
+* round. In case of failure timer is started and
+* retrial is done after time-out. Uninitialization
+* is done is one shot.
+*
+*/
+
+
+
+#ifndef CVTENGINITIALIZER_H
+#define CVTENGINITIALIZER_H
+
+// INCLUDES
+#include "MVtEngSettingObserver.h"
+#include <e32base.h>
+#include <mvtprotocolhandler.h>
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+
+
+/**
+* Engine initializer.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngInitializer ) :
+ public CActive,
+ public MVtEngSettingObserver
+ {
+ public: // Constructors and destructor
+
+ static CVtEngInitializer* NewL( CVtEngHandlerContainer& aHandlers );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngInitializer();
+
+ public: // new functions
+
+ /**
+ * Starts initialization process.
+ */
+ void InitializeL( CVtEngOperation& aCallback );
+
+ /**
+ * Cancels initialiation
+ * @return ETrue if CActive::Cancel was called
+ */
+ TBool CancelInit();
+
+ /**
+ * Uninitializes engine.
+ */
+ void Uninitialize( CVtEngOperation& aCallback );
+
+ /**
+ * Gets GetSessionCommand ownership after initialization.
+ * @return CSessionCommand interface.
+ */
+ MVtSessionCommand* GetSessionCommand();
+
+ /**
+ * Returns if engine is initialized.
+ * @return ETrue if initialized
+ */
+ TBool Initialized() const;
+
+ /**
+ * Creates handler for DTMF sending.
+ * @param aH324Config H324 configure interface
+ */
+ void CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config );
+
+ /**
+ * Gets pointer to comms. Still owns the comms.
+ * @return Pointer to comms.
+ */
+ MCommServer* GetVtComms();
+
+ private: // from CActive
+
+ /**
+ * performs one initialization step.
+ */
+ void RunL();
+
+ /**
+ * Cancels initialization process.
+ */
+ void DoCancel();
+
+ /**
+ * Handles error in the process.
+ * @return always returns KErrNone
+ */
+ TInt RunError( TInt aError );
+
+ public: // from MVtEngSettingObserver
+ virtual void HandleSettingChangedL(
+ CVtEngSettings::TSettingId aId,
+ const TDesC& aValue );
+
+
+ private: // Constructors
+
+ /**
+ * c++ constructor
+ */
+ CVtEngInitializer( CVtEngHandlerContainer& aHandlers );
+
+ /**
+ *
+ */
+ void ConstructL();
+
+ private:
+
+ enum TProcess
+ {
+ // Go to next step
+ EContinue,
+ // Reset engine
+ EReset,
+ // Retry current step when failed.
+ ERetry
+ };
+
+ private: // new functions
+
+ /**
+ * Reads bit reversal information from locally variated flags.
+ * @return ETrue if reversed.
+ */
+ TBool BitReversalUsed();
+
+ /**
+ * Proceeds to next step or starts retrial of
+ * previously failed step.
+ */
+ void ContinueOrRetry( const TProcess aOperation );
+
+ /**
+ * Notifies observer on initialization completion.
+ */
+ void Notify( const TInt aResult );
+
+ /**
+ * Callback for retrial timer.
+ */
+ static TInt HandleTimer( TAny* aAny );
+
+ /**
+ * Handles retrial timer expiration.
+ */
+ void DoHandleTimer();
+
+ TBool ActivateAndSignal( TInt aSignalValue );
+
+ private:
+
+
+ /**
+ * Initialization steps
+ */
+ enum TVtEngInitializationSteps
+ {
+ EInitNone,
+ EInitSession,
+ EInitMedia,
+ EInitProto,
+ EInitDataportCompleted,
+ EInitComplete,
+ EResetMedia,
+ EResetMediaPhase2
+ };
+
+ /**
+ * Dataport information handling flags.
+ */
+ enum TVtEngDataportInformationFlags
+ {
+ EDataportListened = 0x01,
+ EDataportReceived = 0x02
+ };
+
+ private:
+
+ // handler container
+ CVtEngHandlerContainer& iHandlers;
+
+ // Current (un)initialization step
+ TInt iStep;
+
+ // Operation to be notified on completion
+ CVtEngOperation* iCallback;
+
+ // Retrial count
+ TInt iRetrials;
+
+ // Retrial timer
+ CPeriodic* iTimer;
+
+ // Protocol Session Engine
+ MVtSessionCommand* iSessionCommand;
+
+ // Protocol Comms Server
+ MCommServer* iComms;
+
+ // Has subscription been made for dataport name.
+ TInt iDataportHandled;
+
+ // If MediaHandler has taken ownership of 2-way, this is true,
+ // otherwise false.
+ TBool iOwnershipInMH;
+
+ };
+
+
+#endif // CVTENGINITIALIZER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngModel.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 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: Video telephony engine class
+*
+*/
+
+
+
+#ifndef CVTENGMODEL_H
+#define CVTENGMODEL_H
+
+// INCLUDES
+#include <e32base.h>
+//#include <MVtEngEngine.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MVtEngEventObserver;
+class MVtEngCommandObserver;
+class CVtEngEventManager;
+class CVtEngHandlerContainer;
+class MVtEngCommandHandler;
+class CVtEngCommandHandler;
+class MVtEngSessionInfo;
+class MVtEngMedia;
+class MVtEngAudio;
+class CVtEngStateManager;
+class CVtEngUtility;
+class CVtEngExtensions;
+
+// CLASS DECLARATION
+
+/**
+* Model for video telephony engine.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngModel ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aEventObserver event observer
+ * @param aCommandObserver command observer
+ */
+ IMPORT_C static CVtEngModel* NewL(
+ MVtEngEventObserver& aEventObserver,
+ MVtEngCommandObserver& aCommandObserver );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CVtEngModel();
+
+ public: // New functions
+
+ IMPORT_C MVtEngCommandHandler& CommandHandler() const;
+
+ IMPORT_C MVtEngSessionInfo& Session() const;
+
+ IMPORT_C MVtEngMedia& Media() const;
+
+ IMPORT_C MVtEngAudio& Audio() const;
+
+ /**
+ * Returns extension or NULL if extension cannot be found.
+ * @param aExtensionUid extension uid
+ * @return pointer to extension
+ */
+ IMPORT_C TAny* Extension( const TUid& aExtensionUid );
+
+
+
+ protected: // New functions
+
+ /**
+ * ?member_description.
+ * @since ?Series60_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+
+ protected: // Functions from base classes
+
+ /**
+ * From ?base_class ?member_description
+ */
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngModel();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( MVtEngEventObserver& aEventObserver,
+ MVtEngCommandObserver& aCommandObserver );
+
+ private: // Data
+
+ // Event manager acting as event mediator.
+ CVtEngEventManager* iEventManager;
+
+ // Container for functional units.
+ CVtEngHandlerContainer* iHandlers;
+
+ // Handler for UI commands
+ CVtEngCommandHandler* iCommandHandler;
+
+ // Manager for engine states
+ CVtEngStateManager* iStateManager;
+
+ // Utility for TLS access
+ CVtEngUtility* iUtils;
+
+ // Container for engine extensions
+ CVtEngExtensions* iExtensions;
+
+ };
+
+#endif // CVTENGMODEL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSATClient.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2005 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: SAT listener.
+*
+*/
+
+
+
+#ifndef CVTENGSATCLIENT_H
+#define CVTENGSATCLIENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <rsatrefresh.h>
+#include <rsatsession.h>
+
+
+// CLASS DECLARATION
+
+/**
+* SAT listener.
+*
+* @lib videoteleng.lib
+* @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngSATClient ) : public CBase, MSatRefreshObserver
+ {
+ public: // Constructors and destructor.
+
+ /**
+ * Two-phased constructor.
+ * @return instance of CVtEngSATClient
+ */
+ static CVtEngSATClient* NewL( );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngSATClient();
+
+ public: // Functions from base classes
+
+ /**
+ * From MSatRefreshObserver
+ */
+ TBool AllowRefresh(
+ TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+ /**
+ * From MSatRefreshObserver.
+ */
+ void Refresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngSATClient();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ private: // Data
+
+ // Session & Refresh for SAT listening.
+ RSatSession iSatSession;
+ RSatRefresh iSatRefresh;
+
+ };
+
+#endif // CVTENGSATCLIENT_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSettings.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,484 @@
+/*
+* Copyright (c) 2004-2006 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: Video call setting data.
+*
+*/
+
+
+
+#ifndef CVTENGSETTINGS_H
+#define CVTENGSETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <bautils.h>
+#include "MVtEngCRSettingObserver.h"
+#include "CVtEngCRObserverItem.h"
+#include "CVtEngCRProxy.h"
+#include "MVtEngAudio.h"
+#include "MVtEngMedia.h"
+#include "MVtEngSessionInfo.h"
+
+// CONSTANTS
+// Default routing.
+const MVtEngAudio::TVtEngRoutingSetting
+ KVtEngDefaultAudioRouting = MVtEngAudio::EActivateHandsfree;
+
+// FORWARD DECLARATIONS
+class MVtEngSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+* Container for video call settings.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngSettings ) : public CBase
+, public MVtEngCRSettingObserver
+ {
+ public:
+
+ /**
+ * Settings ids
+ */
+ enum TSettingId
+ {
+ EStillImage,
+ EStillImagePath,
+ ECallTimer,
+ EHandsetVolume,
+ EHandsfreeVolume,
+ EBTAudioAccessory,
+ EIhfMode,
+ ESelectVolume, // select Handset / Handsfree volume
+ EDataportInfo
+ };
+
+ /**
+ * Audio configuration
+ */
+ struct TVtEngAudioConfig
+ {
+ // Current volume in use, EFalse: handset,
+ // ETrue: loudspeaker.
+ TBool iCurrentVolume;
+ // Speaker volume
+ MVtEngAudio::TVtEngOutputVolume iVolume;
+ // Audio routing
+ MVtEngAudio::TVtEngRoutingSetting iRouting;
+ };
+
+ /**
+ * Video configuration
+ */
+ struct TVtEngVideoConfig
+ {
+ // Still image file name
+ TFileName iStillImageFile;
+ // Determines if still image is valid.
+ TBool iImageIsValid;
+ // Determines if video is enabled.
+ TBool iVideoEnabled;
+ };
+
+ /**
+ * Video quality framerates
+ */
+ struct TVtEngVideoQualityFrameRateConfig
+ {
+ // Frame rate for videoquality settings detail
+ TInt iDetail;
+
+ // Frame rate for videoquality settings normal
+ TInt iNormal;
+
+ // Frame rate for videoquality settings motion
+ TInt iMotion;
+ };
+
+ /**
+ * Media configuration
+ */
+ struct TVtEngVideoCallConfig
+ {
+ // @see TVtEngAudioConfig
+ TVtEngAudioConfig iAudio;
+ // @see TVtEngVideoConfig
+ TVtEngVideoConfig iVideo;
+ // defines if call timer is enabled
+ TBool iCallTimerOn;
+ // Engine has green light to make connect on Protocol.
+ TBool iReadyForConnect;
+ // Dataport loaning status
+ TBool iIsDataportLoaned;
+ };
+
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @return instance of CVtEngSettings
+ */
+ static CVtEngSettings* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngSettings();
+
+ public: // New functions
+
+ /**
+ * Creates stored data observers.
+ * @param aObserver callback interface
+ * @param aUid UID to monitor
+ * @param aKey ID to monitor
+ * @param aType which data type
+ */
+ void CreateDataObserverL(
+ MVtEngCRSettingObserver* aObserver, TUid aUid, TUint32 aKey,
+ CCenRepNotifyHandler::TCenRepKeyType aType );
+
+ /**
+ * Returns configuration.
+ * @return settings data
+ */
+ const CVtEngSettings::TVtEngVideoCallConfig& Config() const;
+
+ /**
+ * Sets current volume.
+ * @param aVolume selected volume,
+ * EFalse: handset, ETrue: loudspeaker.
+ */
+ void SetCurrentVolume( TBool aVolume );
+
+ /**
+ * Returns current volume.
+ * @return EFalse: handset, ETrue: loudspeaker.
+ */
+ TBool CurrentVolume() const;
+
+ /**
+ * Sets audio output volume levels.
+ * @param aHandsetVolume handset volume level.
+ * @param aHandsfreeVolume handsfree volume level.
+ * @param aInternal not stored to shared data but
+ * internal variable to be used when correct state
+ * is entered.
+ * @return Symbian error code
+ */
+ TInt SetVolume(
+ const TInt aHandsetVolume,
+ const TInt aHandsfreeVolume,
+ const TBool aInternal );
+
+ /**
+ * Gets audio output volume levels from Shared Data.
+ * @param aVolume volume level.
+ * @param aHandsfree if true handsfree volume is read,
+ * otherwise handset.
+ * @param aInternal not read from shared data but
+ * from internal variable
+ * @return error code
+ */
+ TInt GetVolume(
+ TInt& aVolume,
+ const TBool aHandsfree,
+ const TBool aInternal ) const;
+
+ /**
+ * Gets maximum audio output volume level.
+ * @return max volume for device
+ */
+ inline TInt MaxVolume( ) const;
+
+
+ /**
+ * Gets minimum audio output volume level.
+ * @return max volume for device
+ */
+ inline TInt MinVolume( ) const;
+
+ /**
+ * Checks the validity of the volume level.
+ * return either constant minimum, constant maximum
+ * or the passed value level.
+ * @param aVolume the volume level to check
+ * @return suitable volume level
+ */
+ inline TInt ValidVolume( const TInt aVolume ) const;
+
+ /**
+ * Sets audio routing setting.
+ * @param aState audio routing state.
+ */
+ void SetRouting( const MVtEngAudio::TVtEngRoutingSetting& aState );
+
+ /**
+ * Sets output video state setting.
+ * @param aEnabled ETrue if sending is enabled
+ */
+ void SetVideoEnabled( const TBool aEnabled );
+
+ /**
+ * Sets connected state.
+ */
+ void SetConnectReady();
+
+ /**
+ * Reads local variations.
+ */
+ void ReadVariationsL();
+
+ /**
+ * Gets camera orientations for primary and secondary camera.
+ * @see MVtEngMedia::TCameraOrientation
+ * @param aPrimaryCameraOrientation primary camera orientation.
+ * @param aSecondaryCameraOrientation secondary camera orientation.
+ */
+ void GetCameraOrientations(
+ MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation,
+ MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const;
+
+ /**
+ * Checks if given bits is turned on in local variation.
+ * @param aBits bits to check
+ * @return ETrue if turned on
+ */
+ TBool CheckBits( const TInt aBits );
+
+ /**
+ * Returns video quality frame rate configuration.
+ * @return Reference to video quality frame rate
+ * configuration.
+ */
+ const TVtEngVideoQualityFrameRateConfig&
+ VideoQualityFrameRateConfig() const;
+
+ /**
+ * Resets settings to default values.
+ */
+ void ResetAll();
+
+ /**
+ * Registers interest on setting change.
+ * @param aId event to observe for
+ * @param aObserver setting observer
+ */
+ void NotifyChangeL(
+ TSettingId aId,
+ MVtEngSettingObserver& aObserver );
+
+ /**
+ * Cancels observering setting changes.
+ * @param aId event to cancel
+ * @param aObserver setting observer
+ */
+ void CancelNotifyChange(
+ TSettingId aId,
+ const MVtEngSettingObserver& aObserver );
+
+ /**
+ * Informs setting is dataport loaned or not yet.
+ * @param aLoaned TBool value is loaned (ETrue) or not (EFalse)
+ */
+ void SetDataportLoaned( TBool aLoaned );
+
+ /**
+ * Checks if still image exists.
+ * @return ETrue if still image exists.
+ */
+ TBool IsDefaultStillImageDefined();
+
+
+
+ /**
+ * Sets CLI.
+ * @since S60 5.0
+ * @params aCLI call id and address (MSISDN) availability
+ */
+ void SetCLI( const MVtEngSessionInfo::TCLI& aCLI );
+
+ /**
+ * Returns CLI
+ * @since S60 5.0
+ * @param aCLI call id and address (MSISDN) availability
+ * @return ETrue if CLI is valid (stored in the first place)
+ */
+ TBool GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const;
+
+ /**
+ * Sets dataport info
+ * @since S60 5.0
+ * @param aPortInfo port name and number as string
+ */
+ void SetDataportInfoL( const TDesC& aPortInfo );
+
+ /**
+ * Returns dataport info or NULL if not available yet
+ * @since S60 5.0
+ * @return dataport info
+ */
+ const TDesC* DataportInfo() const;
+
+ public: // From MVtEngCRSettingObserver.
+
+ /**
+ * Callback to notify changed setting.
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyInt( const TUid aUid, const TUint32 aId,
+ TInt aNewValue );
+
+ /**
+ * Callback to notify changed setting.
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyReal( const TUid aUid, const TUint32 aId,
+ TReal aNewValue );
+
+ /**
+ * Callback to notify changed setting.
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue
+ */
+ void HandleNotifyString( const TUid aUid, const TUint32 aId,
+ const TDesC16& aNewValue );
+
+ private: // New functions.
+ struct TObserverItem
+ {
+ // Callback interface.
+ MVtEngSettingObserver* iObserver;
+ // UID of item.
+ TUid iUid;
+ // Key of observer.
+ TPtrC iKey;
+ // Integer key, used with CR.
+ TInt iIntKey;
+ // Settings internal id.
+ TSettingId iId;
+ };
+
+ /**
+ * Finds observer item.
+ * @param aUid
+ * @param aKey
+ * @return observer item or NULL
+ */
+ TObserverItem* FindItem( const TUid& aUid, const TDesC& aKey ) const;
+
+ /**
+ * Finds observer item.
+ * @param aUid
+ * @param aKey
+ * @return observer item or NULL
+ */
+ TObserverItem* FindItem( const TUid& aUid, const TInt& aKey ) const;
+
+ /**
+ * Returns value as integer.
+ * @param aValue value to convert
+ * @return value as integer
+ */
+ static TInt SettingAsTInt( const TDesC& aValue );
+
+ /**
+ * Derived class for internal book keeping. Engine knows whether
+ * CLI has been received from call handling
+ */
+ struct TVtEngCLI : public MVtEngSessionInfo::TCLI
+ {
+ // Set to True when CLI received from call handling.
+ TBool iValid;
+ };
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngSettings();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * Callback function to inform the observer.
+ * @param aAny pointer to instance of this class.
+ * @return KErrNone always.
+ */
+ static TInt DoInformSelectVolumeObserver( TAny* aAny );
+
+
+ /**
+ * Parses VQ frame rates read from cenrep.
+ */
+ void ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR,
+ const TDesC& aBuffer );
+
+ private: // Data
+ // Central Repository proxy.
+ CVtEngCRProxy* iCRProxy;
+
+ // Settings data.
+ TVtEngVideoCallConfig iConfig;
+
+ // Setting data observers.
+ CArrayFixFlat<TObserverItem>* iObserverItems;
+
+ // File system handle.
+ RFs iFs;
+
+ // Owned idle callback instance.
+ CIdle* iSelectVolumeIdle;
+
+ // Observer for ESelectVolume.
+ MVtEngSettingObserver* iSelectVolumeObserver;
+
+ // Observer for EDataportInfo
+ MVtEngSettingObserver* iDataportObserver;
+
+ // Locally variated bits are read to this.
+ TInt iVariantReadOnlyValues;
+
+ // If local variations are read
+ TBool iVariationsRead;
+
+ // Video quality frame rate configuration holder
+ TVtEngVideoQualityFrameRateConfig iVQFRConfig;
+
+ // If default still image is defined
+ TBool iDefaultStillImageDefined;
+
+ // CLI information of video call.
+ TVtEngCLI iCLI;
+
+ HBufC* iDataportInfo;
+ };
+
+#include "CVtEngSettings.inl"
+
+#endif // CVTENGSETTINGS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSettings.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 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: Settings inline methods
+*
+*/
+
+
+//Constants
+const TInt8 KVTEngMaxVolume = 10;
+const TInt8 KVTEngMinVolume = 0;
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetMinVolume
+// Return device min volume.
+//
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::MinVolume() const
+ { return KVTEngMinVolume; }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetMaxVolume
+// Return event manager.
+//
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::MaxVolume() const
+ { return KVTEngMaxVolume; }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ValidVolume
+// Checks if the volume is within allowed limits
+//
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::ValidVolume( const TInt aVolume ) const
+ {
+ if ( aVolume < KVTEngMinVolume )
+ {
+ return KVTEngMinVolume;
+ }
+ else if ( aVolume > KVTEngMaxVolume )
+ {
+ return KVTEngMaxVolume;
+ }
+ else
+ {
+ return aVolume;
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngAccessoryObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2004-2006 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: Observer interface for indicating changes in accessories.
+*
+*/
+
+#ifndef MVTENGACCESSORYOBSERVER_H
+#define MVTENGACCESSORYOBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <AccPolAccessoryMode.h>
+
+// CLASS DECLARATION
+
+/**
+* Interface to indicate changes in accessories.
+*
+* @lib videoteleng
+* @since 3.0
+*/
+class MVtEngAccessoryObserver
+ {
+ public: // New functions
+
+ /**
+ * Callback to notify mode change in accessories.
+ * @param aMode new mode
+ * @param aActivated audio is on
+ */
+ virtual void AccessoryModeChanged( const TAccMode& aMode,
+ const TBool aActivated ) = 0;
+ };
+
+#endif // MVTENGACCESSORYOBSERVER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngCRSettingObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2004-2006 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: Observer interface for indicating setting changes in Cent Rep
+*
+*/
+
+
+#ifndef MVTENGSETTINCRGOBSERVER_H
+#define MVTENGSETTINGCROBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for indicating setting changes
+*
+* @lib videoteleng.lib
+* @since Series 60 3.0
+*/
+class MVtEngCRSettingObserver
+ {
+ public: // New functions
+
+ /**
+ * Callback to notify changed setting
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue new value
+ */
+ virtual void HandleNotifyInt( const TUid aUid, const TUint32 aId,
+ TInt aNewValue ) = 0;
+
+ /**
+ * Callback to notify changed setting
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue new value
+ */
+ virtual void HandleNotifyReal( const TUid aUid, const TUint32 aId,
+ TReal aNewValue ) = 0;
+
+ /**
+ * Callback to notify changed setting
+ * @param aUid changed Uid
+ * @param aId changed id
+ * @param aNewValue new value
+ */
+ virtual void HandleNotifyString( const TUid aUid, const TUint32 aId,
+ const TDesC16& aNewValue ) = 0;
+ };
+
+#endif // MVTENGCRSETTINGOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngEventObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 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: Observer interface for video telephony events.
+*
+*/
+
+
+
+#ifndef MVTENGEVENTOBSERVER_H
+#define MVTENGEVENTOBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Video telephony event observer interface.
+*
+* @lib videlteleng
+* @since 2.6
+*/
+class MVtEngEventObserver
+ {
+ public: // New functions
+
+ /**
+ * Handler method for events
+ * @param aEvent events defined in VtEngEvents.h
+ */
+ virtual void HandleVtEventL(
+ TInt aEvent ) = 0;
+
+ };
+
+#endif // MVTENGEVENTOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngSettingObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 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: Observer interface for indicating setting changes
+*
+*/
+
+
+
+#ifndef MVTENGSETTINGOBSERVER_H
+#define MVTENGSETTINGOBSERVER_H
+
+// INCLUDES
+#include "CVtEngSettings.h"
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for indicating setting changes
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngSettingObserver
+ {
+ public: // New functions
+
+ /**
+ * Handler for setting changed event
+ * @param aId id of setting
+ * @param aValue new value for the setting
+ */
+ virtual void HandleSettingChangedL(
+ CVtEngSettings::TSettingId aId,
+ const TDesC& aValue ) = 0;
+ };
+
+#endif // MVTENGSETTINGOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngSettingPSObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2004-2006 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: Observer interface for indicating publish and subscribe
+* changes
+*
+*/
+
+
+
+#ifndef MVTENGSETTINGPSOBSERVER_H
+#define MVTENGSETTINGPSOBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for indicating P&S changes
+*
+* @lib videoteleng.lib
+* @since Series 60 2.8
+*/
+class MVtEngSettingPSObserver
+ {
+ public: // New functions
+
+ /**
+ * Handler for changed event.
+ * @param aUid uid of setting
+ * @param aKey id of setting
+ * @param aStatus status of completed AO operation
+ */
+ virtual void HandleNotifyPSL( const TUid aUid, const TInt& aKey,
+ const TRequestStatus& aStatus ) = 0;
+ };
+
+#endif // MVTENGSETTINGPSOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/TVtEngType.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006 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: Base class for data types that can be identified by an
+* identifier (extension id).
+*
+*/
+
+
+
+#ifndef TVTENGTTYPE_H
+#define TVTENGTTYPE_H
+
+// INCLUDES
+#include <e32std.h>
+
+// DATA TYPES
+
+enum TVtEngTypeId
+ {
+ EVtEngTypeV1 = 0,
+ EVtEngTypeDtmf
+ };
+
+// CLASS DECLARATION
+
+/**
+* Base class for data types
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngtType
+ {
+ public: // constructor
+
+ inline TInt TypeId() const;
+
+ protected: // constructors
+ /**
+ * C++ constructor that only for descendant classes may call.
+ */
+ inline TVtEngtType( TVtEngTypeId aTypeId );
+
+ /**
+ * copy constructor
+ */
+ inline TVtEngtType( const TVtEngtType& aType );
+
+ protected: // operators
+
+ inline TVtEngtType& operator=( const TVtEngtType& aType );
+
+ protected:
+ // Extension id
+ TInt iTypeId;
+ };
+
+#include "TVtEngType.inl"
+
+#endif // TVTENGTTYPE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/TVtEngType.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 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: Inline methods for TVtEngtType.
+*
+*/
+
+
+inline TVtEngtType::TVtEngtType( TVtEngTypeId aTypeId )
+ : iTypeId( aTypeId ) {}
+
+inline TInt TVtEngtType::TypeId() const { return iTypeId; }
+
+inline TVtEngtType::TVtEngtType( const TVtEngtType& aType )
+ : iTypeId( aType.iTypeId ) {}
+
+inline TVtEngtType& TVtEngtType::operator=( const TVtEngtType& aType )
+ { iTypeId = aType.iTypeId;
+ return *this; }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngConstants.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 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: Constants for video telephony
+*
+*/
+
+
+
+#ifndef VTENGCONSTANTS_H
+#define VTENGCONSTANTS_H
+
+// INCLUDES
+#include <e32std.h>
+#include <gdi.h>
+// CONSTANTS
+
+/**
+* Remote video default size.
+* QCIF where one pixel removed from left, top and right side.
+*/
+//const TSize KVtEngRemoteVideoDefaultSize( 174, 143 );
+
+/**
+* View finder default size.
+*/
+//const TSize KVtEngLocalVideoDefaultSize( 44, 36 );
+
+/**
+* Display mode
+*/
+//const TDisplayMode KVtEngDisplayMode( EColor64K );
+
+// MACROS
+
+
+#endif // VTENGCONSTANTS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngDefs.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 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: engine macro define
+*
+*/
+
+
+#ifndef VTDEFS_HRH
+#define VTDEFS_HRH
+
+
+// DATA TYPES
+// MACROS
+
+
+#if defined(_DEBUG) || defined(WINS)
+/**
+* Debugging enabled always in debug builds
+*/
+#define VTDEBUG
+#else
+/**
+* Define here for release builds (disabled by default)
+* Uncomment VTDEBUG below if you want to enable logging in UREL.
+*/
+//#define VTDEBUG
+#endif
+
+#ifdef VTDEBUG
+/**
+* 0 = No logging
+* 1 = File logging
+* 2 = RDebug
+*/
+#if defined(__WINSCW) || defined(__WINS__) || defined (WINS)
+// In emulator log to output window
+#define VTLOGGING 1
+#else
+/**
+* In HW to which ever is desired (File (1) by default)
+* Change VTLOGGING to 1 (file) or 2 (RDebug) as desired.
+*/
+#define VTLOGGING 1
+#endif
+
+#else // !VTDEBUG
+
+// no logging
+#define VTLOGGING 0
+
+#endif //VTDEBUG
+
+#if VTLOGGING == 1
+#define VTFILELOGGING 1
+#else
+#define VTFILELOGGING 0
+#endif
+
+#endif // VTDEFS_HRH
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngEvents.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2004-2006 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: Video telephony engine events
+*
+*/
+
+
+
+#ifndef VTENGEVENTS_H
+#define VTENGEVENTS_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CONSTANTS
+
+const TInt KVtEngEventNone = -1;
+
+const TInt KVtEngEventBase = 0;
+
+/**
+* Engine configuration events
+*/
+const TInt KVtEngConfigureEventBase = KVtEngEventBase + 100; // 100
+const TInt KVtEngDurationSettingChanged = KVtEngConfigureEventBase + 1;
+const TInt KVtEngInitializationProblem = KVtEngConfigureEventBase + 2;
+
+/**
+* Engine media events
+*/
+const TInt KVtEngMediaEventBase = KVtEngConfigureEventBase + 100; // 200
+const TInt KVtEngCameraChanged = KVtEngMediaEventBase + 1;
+const TInt KVtEngSourceChanged = KVtEngMediaEventBase + 2;
+const TInt KVtEngRemoteVideoPaused = KVtEngMediaEventBase + 3;
+const TInt KVtEngRemoteVideoResumed = KVtEngMediaEventBase + 4;
+const TInt KVtEngRemoteAudioPaused = KVtEngMediaEventBase + 5;
+const TInt KVtEngRemoteAudioResumed = KVtEngMediaEventBase + 6;
+const TInt KVtEngAudioMuted = KVtEngMediaEventBase + 7;
+const TInt KVtEngAudioUnmuted = KVtEngMediaEventBase + 8;
+const TInt KVtEngRemoteVideoStarted = KVtEngMediaEventBase + 10;
+const TInt KVtEngRemoteVideoStopped = KVtEngMediaEventBase + 11;
+const TInt KVtEngRemoteAudioStarted = KVtEngMediaEventBase + 12;
+const TInt KVtEngRemoteRenderingProblem = KVtEngMediaEventBase + 14;
+const TInt KVtEngLocalRenderingProblem = KVtEngMediaEventBase + 15;
+const TInt KVtEngSourceCapsChanged = KVtEngMediaEventBase + 16;
+const TInt KVtEngRemoteRenderStopped = KVtEngMediaEventBase + 17;
+const TInt KVtEngViewFinderStopped = KVtEngMediaEventBase + 18;
+const TInt KVtEngResolutionToSQCIF = KVtEngMediaEventBase + 19;
+const TInt KVtEngResolutionToQCIF = KVtEngMediaEventBase + 20;
+
+// Problems in starting negotiation with remote end
+const TInt KVtEngNegotiationProblem = KVtEngMediaEventBase + 21;
+
+// Initializing media component failed
+const TInt KVtEngMediaInitFailure = KVtEngMediaEventBase + 22;
+
+// Begin initialization of image sharing (convert, scale, etc.)
+const TInt KVtEngShareImageInitializeBegin = KVtEngMediaEventBase + 23;
+
+// End initialization of image sharing (convert, scale, etc.)
+const TInt KVtEngShareImageInitializeEnd = KVtEngMediaEventBase + 24;
+
+// Informs status change in outgoing video channel.
+const TInt KVtEngMediaOutgoingVideoChannelStatusChanged =
+ KVtEngMediaEventBase + 25;
+
+// Informs status change in outgoing audio channel.
+const TInt KVtEngMediaOutgoingAudioChannelStatusChanged =
+ KVtEngMediaEventBase + 26;
+
+// Informs UI that decoding error happened during image share
+const TInt KVtEngShareImageDecodingError = KVtEngMediaEventBase + 27;
+
+// Informs UI that volume is already maximum
+const TInt KVtEngAudioVolumeMax = KVtEngMediaEventBase + 28;
+
+// Informs UI that volume is already minimum
+const TInt KVtEngAudioVolumeMin = KVtEngMediaEventBase + 29;
+
+// Informs UI that Locvid layoutchange has been done
+const TInt KVtEngLCHProviderSwitchDone = KVtEngMediaEventBase + 30;
+
+/**
+* Engine audio events
+*/
+const TInt KVtEngAudioEventBase = KVtEngMediaEventBase + 100; // 300
+const TInt KVtEngAudioOutputVolumeChanged = KVtEngAudioEventBase + 1;
+const TInt KVtEngAudioRoutingChanged = KVtEngAudioEventBase + 2;
+const TInt KVtEngAudioRoutingAvailabilityChanged = KVtEngAudioEventBase + 3;
+const TInt KVtEngAudioRoutingIHFActivated = KVtEngAudioEventBase + 4;
+const TInt KVtEngAudioRoutingIHFDeactivated = KVtEngAudioEventBase + 5;
+
+/**
+* Engine session events
+*/
+const TInt KVtEngSessionEventBase = KVtEngAudioEventBase + 100; // 400
+const TInt KVtEngSessionStateChanged = KVtEngSessionEventBase + 1;
+const TInt KVtEngSessionAnswerPossible = KVtEngSessionEventBase + 2;
+const TInt KVtEngSessionWaitingCallActive = KVtEngSessionEventBase + 3;
+const TInt KVtEngSessionWaitingCallInactive = KVtEngSessionEventBase + 4;
+const TInt KVtEngCLIAvailable = KVtEngSessionEventBase + 5;
+
+/**
+* General events
+*/
+const TInt KVtEngGeneralEventBase = KVtEngSessionEventBase + 100; // 500
+const TInt KVtEngResourceMemAllocFailure = KVtEngGeneralEventBase + 1;
+const TInt KVtEngDtmfFailure = KVtEngGeneralEventBase + 2;
+/**
+* Remote supports UII DTMF.
+*/
+const TInt KVtEngRemoteUIIDtmfSupport = KVtEngGeneralEventBase + 13;
+/**
+* Remote supports UII basic string.
+*/
+const TInt KVtEngRemoteUIIBasicStringSupport = KVtEngGeneralEventBase + 14;
+/**
+* Remote supports UII IA5 string.
+*/
+const TInt KVtEngRemoteUIIIA5StringSupport = KVtEngGeneralEventBase + 15;
+/**
+* Remote supports UII general string.
+*/
+const TInt KVtEngRemoteUIIGeneralStringSupport = KVtEngGeneralEventBase + 6;
+
+
+// Device is locked or unlocked (autolock feature)
+const TInt KVtEngDeviceLockOn = KVtEngGeneralEventBase + 3;
+const TInt KVtEngDeviceLockOff = KVtEngGeneralEventBase + 4;
+
+// Remote disconnected
+const TInt KVtEngRemoteDisconnect = KVtEngGeneralEventBase + 5;
+
+#endif // VTENGEVENTS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngPanic.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 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: Panic definitions for video telephone engine.
+*
+*/
+
+
+
+#ifndef CVTENGPANIC_H
+#define CVTENGPANIC_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+_LIT( KVtEngPanicCategory, "VTENG" );
+
+// DATA TYPES
+enum TVtEngPanic
+ {
+ EVtEngPanicInvalidInitializationEntry, /** 0 */
+ EVtEngPanicInvalidInitializationState, /** 1 */
+ EVtEngPanicIncorrectUtility, /** 2 */
+ EVtEngPanicTlsPanic, /** 3 */
+ EVtEngPanicNoVideoProvider, /** 4 */
+ EVtEngPanicInvalidSessionState, /** 5 */
+ EVtEngPanicMediaHandlerOpStateFailure, /** 6 */
+ EVtEngPanicInvalidFlag, /** 7 */
+ EVtEngPanicInvalidPointer, /** 8 */
+ EVtEngPanicInvalidAudioPointer, /** 9 */
+ EVtEngPanicCommsDestructOnInvalidState, /** 10 */
+ EVtEngPanicUnInitIncorrectOperation, /** 11 */
+ EVtEngPanicDisconnectTimerExpired, /** 12 */
+ EVtEngPanicInvalidDtmfState, /** 13 */
+ EVtEngPanicInvalidBitmapHandle, /** 14 */
+ EVtEngPanicInvalidPortRead, /** 15 */
+ /** Too many asynchronous events pending in queue */
+ EVtEngPanicInvalidTooManyPendingEvents, /** 16 */
+ /** VT variation cenrep file is missing or corrupt */
+ EVtEngPanicVtCenrepVariation, /** 17 */
+ /** VT configuration cenrep file is missing or corrupt */
+ EVtEngPanicVtCenrepConfiguration, /** 18 */
+ EVtEngPanicInvalidVideoQualityValue, /** 19 */
+ EVtEngPanicWrongMediatorSenderState /** 20 */
+ };
+
+// FUNCTION PROTOTYPES
+void Panic( TVtEngPanic aPanic );
+
+#endif // CVTENGPANIC_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngUtils.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2004-2006 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: Video telephony engine TLS container.
+*
+*/
+
+
+
+#ifndef VTENGUTILS_H
+#define VTENGUTILS_H
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CVtEngInitializer;
+class CVtEngHandlerContainer;
+class CVtEngDebug;
+class CVtEngStateManager;
+class CVtEngSettings;
+class CVtEngEventManager;
+class CVtEngCRProxy;
+class CVtEngAccessoryHandler;
+class CVtEngSATClient;
+class CVtEngDeviceLockMonitor;
+class CVtEngExtensions;
+class CVtEngMdtrMessageListener;
+class CVtEngMdtrCommandSender;
+
+// CLASS DECLARATION
+
+/**
+* TLS container for pointers to essential objects.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngUtility ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngUtility* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngUtility();
+
+ public: // New functions
+
+ /**
+ * Creates SAT listener for updates.
+ */
+ void StartSATListenL();
+
+ /**
+ * Returns engine initializer.
+ * @return initializer
+ */
+ inline CVtEngInitializer& Initializer() const;
+
+ /**
+ * Returns engine utility.
+ * @return utility
+ */
+ static CVtEngUtility* EngineUtils();
+
+ /**
+ * Returns state manager.
+ * @return state manager
+ */
+ static CVtEngStateManager* StateManager();
+
+ /**
+ * Returns event manager.
+ * @return event manager
+ */
+ static CVtEngEventManager& EventManager();
+
+ /**
+ * Returns Central repository proxy.
+ * @return ref to CR proxy
+ */
+ static CVtEngCRProxy& CRProxy();
+
+ /**
+ * Returns accessory listener.
+ * @return accessory handler
+ */
+ static CVtEngAccessoryHandler& AccessoryHandler();
+
+ /**
+ * Returns settings.
+ * @return ref to settings
+ */
+ static CVtEngSettings& Settings();
+
+ /**
+ * Returns mediator command sender.
+ * @return ref to command sender
+ */
+ static CVtEngMdtrCommandSender& MediatorCommands();
+
+ /**
+ * Prepares the utility
+ * @param aHandlers handler container
+ * @param aStateManagerPtr state manager pointer ref
+ * @param aEventManagerPtr event manager pointer ref
+ * @param aExtensionPtr extension container pointer
+ */
+ void PrepareL(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngStateManager*& aStateManagerPtr,
+ CVtEngEventManager*& aEventManagerPtr,
+ CVtEngExtensions* aExtensionPtr );
+
+ /**
+ * Notifies device lock to UI.
+ */
+ void NotifyLockState();
+
+ /**
+ * Returns Extension container.
+ * @since S60 v3.2
+ * @return pointer to extensions
+ */
+ static CVtEngExtensions* Extensions();
+ /**
+ * Starts listening mediator messages.
+ */
+ void StartMediatorListenerL();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngUtility();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ // Initializater for the engine
+ CVtEngInitializer* iEngineInit;
+
+ // State manager pointer
+ CVtEngStateManager** iStateManager;
+
+ // Settigs
+ CVtEngSettings* iSettings;
+
+ // Event manager pointer
+ CVtEngEventManager** iEventManager;
+
+ // Central repository interface
+ CVtEngCRProxy* iCRProxy;
+
+ // Accessory handler
+ CVtEngAccessoryHandler* iAccessoryHandler;
+
+ // SAT refresh listener
+ CVtEngSATClient* iSATClient;
+
+ // Monitor for device lock state
+ CVtEngDeviceLockMonitor* iLockMonitor;
+
+ // Extension pointer
+ CVtEngExtensions* iExtensions;
+ // For receiving Mediator commands and events
+ CVtEngMdtrMessageListener* iMdtrMessageListener;
+
+ // For sending Mediator commands
+ CVtEngMdtrCommandSender* iMdtrCommandSender;
+
+ };
+
+#include "VtEngUtils.inl"
+
+#endif // VTENGUTILS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngUtils.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 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: Video telephony engine TLS container.
+*
+*/
+
+
+// MEMBER FUNCTIONS
+
+inline CVtEngInitializer& CVtEngUtility::Initializer() const
+ {
+ return *iEngineInit;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengincomingcallmonitor.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 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: Monitor for incoming call
+*
+*/
+
+
+
+#ifndef C_VTENGINCOMINGCALLMONITOR_H
+#define C_VTENGINCOMINGCALLMONITOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtEngSettingPSObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngPubSubsListener;
+
+// CLASS DECLARATION
+/**
+* Monitor for incoming call state.
+*
+* @lib videoteleng
+* @since S60 v3.2
+*/
+NONSHARABLE_CLASS( CVtEngIncomingCallMonitor ) : public CBase, public MVtEngSettingPSObserver
+ {
+public: // Constructors and destructor
+
+ static CVtEngIncomingCallMonitor* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngIncomingCallMonitor();
+
+public: // New functions
+
+ /**
+ * Sends event to UI of current incoming call state
+ */
+ void NotifyState() const;
+
+public: // From MVtEngSettingPSObserver
+
+ /**
+ * @see MVtEngSettingPSObserver::HandleNotifyPSL
+ */
+ void HandleNotifyPSL( const TUid aUid, const TInt& aKey,
+ const TRequestStatus& aStatus );
+
+private:
+ /**
+ * C++ constructor.
+ */
+ CVtEngIncomingCallMonitor();
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+private:
+
+ // Listener for incoming call state
+ CVtEngPubSubsListener* iIncomingCallListener;
+ };
+
+#endif // C_VTENGINCOMINGCALLMONITOR_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmdtrcommandsender.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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: Sender class for mediator commands
+*
+*/
+
+
+#ifndef C_VTENGMDTRCOMMANDSENDER_H
+#define C_VTENGMDTRCOMMANDSENDER_H
+
+// INCLUDES
+
+#include <e32cmn.h>
+#include <MediatorCommandInitiator.h>
+#include "MVtEngEventObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngUtility;
+class CVtEngOperation;
+class CVtEngMdtrCommandSender;
+class TVtMdtrStateIdle;
+// CLASS DECLARATION
+
+/**
+* Mediator command sender
+*
+* @lib videoteleng
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMdtrCommandSender ) :
+ public CBase,
+ public MMediatorCommandResponseObserver,
+ public MVtEngEventObserver
+ {
+public: // constructor and destructors
+
+ /**
+ * two-phase constructor
+ */
+ static CVtEngMdtrCommandSender* NewL( CVtEngUtility& aUtils );
+
+ // Destructor
+ ~CVtEngMdtrCommandSender();
+
+public: // new methods
+
+ /**
+ * Requests telephony to end video call
+ */
+ void EndCall();
+
+ /**
+ * Requests telephony to fallback to voice call
+ */
+ void VoiceFallback();
+
+ /**
+ * Requests telephony to make voice call
+ */
+ void SwitchToVoiceL( CVtEngOperation& aOperation );
+
+ /**
+ * Notifies telephony about outgoing audio state change
+ */
+ void NotifyOutgoingAudioState( const TBool aMicEnabled );
+
+ void SetSenderState( TVtMdtrStateIdle& aNewState );
+
+
+public: // from MMediatorCommandResponseObserver
+
+ // responses are not handled but required by mediator api
+ virtual void CommandResponseL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TInt aStatus,
+ const TDesC8& aData );
+
+public: // from MVtEngEventObserver
+
+ // handles event accordint to ongoing operation
+ virtual void HandleVtEventL( TInt aEvent );
+
+private: // constructors
+
+ CVtEngMdtrCommandSender( CVtEngUtility& aUtils );
+
+ void ConstructL();
+
+private:
+ // for switch to voice operation, signaled when mediator command is issued.
+ CVtEngOperation* iOperation;
+
+ // for mediator command reception
+ CMediatorCommandInitiator* iMediatorInitiator;
+
+ CVtEngUtility& iUtils;
+
+ TVtMdtrStateIdle* iSenderState;
+ };
+
+#endif // C_VTENGMDTRCOMMANDSENDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmdtrmessagelistener.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* 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: Listener class for mediator commands
+*
+*/
+
+
+#ifndef C_VTENGMDTRMESSAGELISTENER_H
+#define C_VTENGMDTRMESSAGELISTENER_H
+
+// INCLUDES
+
+//#include <e32cmn.h>
+#include <MediatorCommandResponder.h>
+#include <MediatorEventConsumer.h>
+#include "MVtEngEventObserver.h"
+#include "CVtEngStateManager.h"
+#include "MVtEngSessionInfo.h"
+
+// FORWARD DECLARATIONS
+class CMediatorCommandResponder;
+class CVtEngUtility;
+
+// CLASS DECLARATION
+
+/**
+* Mediator command and event listener
+*
+* @lib videoteleng
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMdtrMessageListener ) :
+ public CBase,
+ private MMediatorCommandObserver,
+ private MMediatorEventObserver,
+ private MVtEngEventObserver
+
+ {
+public: // constructor and destructors
+
+ /**
+ * two-phase constructor
+ */
+ static CVtEngMdtrMessageListener* NewL( CVtEngUtility& aUtils );
+
+ // Destructor
+ ~CVtEngMdtrMessageListener();
+
+public: // from MMediatorCommandObserver
+
+ virtual void MediatorCommandL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TVersion aVersion,
+ const TDesC8& aData );
+
+ virtual void CancelMediatorCommand( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId );
+
+public: // from MMediatorEventObserver
+
+ virtual void MediatorEventL( TUid aDomain,
+ TUid aCategory,
+ TInt aEventId,
+ const TDesC8& aData );
+
+public: // from MVtEngEventObserver
+
+ // handles deferred CLI event dispatching
+ virtual void HandleVtEventL( TInt aEvent );
+
+private: // constructors
+
+ CVtEngMdtrMessageListener( CVtEngUtility& aUtils );
+
+ void ConstructL();
+
+private: // new functions
+
+ void HandleCLIEventL( const TDesC8& aData );
+
+ TBool IsReadyForCLIEvent() const;
+
+private:
+ CVtEngUtility& iUtils;
+
+ // for mediator command reception
+ CMediatorCommandResponder* iMediatorResponder;
+
+ CMediatorEventConsumer* iMediatorEvents;
+
+ // supported mediator commands
+ MediatorService::RCommandList iCommandList;
+ };
+
+#endif // C_VTENGMDTRMESSAGELISTENER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmediatorservice.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* 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: Handles commands received via Mediator
+*
+*/
+
+
+#ifndef C_VTENGMEDIATORSERVICE_H
+#define C_VTENGMEDIATORSERVICE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mvtengoperationobserver.h"
+#include "MVtEngEventObserver.h"
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CMediatorCommandResponder;
+class CVtEngOperation;
+class CVtEngInternalOperation;
+class CVtEngUtility;
+
+// CLASS DECLARATION
+
+/**
+* Handles shutdown and audio commands from mediator. Deletes itself
+* after service is completed.
+*
+* @lib videoteleng
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMediatorService ) :
+ public CBase,
+ private MVtEngOperationObserver,
+ private MVtEngEventObserver
+ {
+public: // constructor and destructors
+
+ /**
+ * Starts requested service.
+ * @param aResponder target for mediator response
+ * @param aUtils engine internal utility
+ * @param aCommandId service to start
+ */
+ static void StartLD(
+ CMediatorCommandResponder& aResponder,
+ CVtEngUtility& aUtils,
+ const TUid aCategory,
+ const TInt aCommandId );
+
+ ~CVtEngMediatorService();
+
+public: // from MVtEngOperationObserver
+
+ /**
+ * @see MVtEngOperationObserver
+ */
+ virtual void SetOperation( CVtEngOperation* aActiveOp );
+
+ /**
+ * @see MVtEngOperationObserver
+ */
+ virtual void CommandCompleteL(
+ const TVtEngCommandId aCommand,
+ const TInt aResult );
+
+public: // from MVtEngEventObserver
+
+ // handles event according to ongoing operation
+ virtual void HandleVtEventL( TInt aEvent );
+
+private: // c++ constructor
+
+ CVtEngMediatorService(
+ CMediatorCommandResponder& aResponder,
+ CVtEngUtility& aUtils,
+ const TUid aCategory,
+ const TInt aCommandId );
+
+private:
+
+ // prepares and starts requested operation
+ void ConstructAndDoServiceL();
+
+ // sends response to shutdown command if shutdown already ongoing
+ TBool IsShuttingDown() const;
+
+ void StartOperationL( const TVtEngCommandId aCommand );
+
+ // Sends mediator response for shutdown or audio mute/unmute commands.
+ // deletes itself if not waiting internal command response.
+ void SendMediatorResponseD( const TBool aDeleteThis );
+
+private:
+ CMediatorCommandResponder& iResponder;
+
+ CVtEngInternalOperation* iOperation;
+
+ CVtEngUtility& iUtils;
+
+ // mediator Category [KCatVideotelInternalCommands, KCatPhoneToVideotelCommands]
+ TUid iCategory;
+
+ // mediator command [shutdown, mute mic, unmute mic]
+ TInt iCommandId;
+
+ // this is used for controlling
+ TInt iServiceStatus;
+ };
+
+#endif // T_VTENGMEDIATORSERVICE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngCommandHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2006 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: Command handler of the engine.
+*
+*/
+
+
+
+#ifndef CVTENGCOMMANDHANDLER_H
+#define CVTENGCOMMANDHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtEngCommandHandler.h"
+#include "mvtengoperationobserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+* Handler for commands from client.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngCommandHandler ) : public CBase,
+ public MVtEngCommandHandler,
+ public MVtEngOperationObserver
+ {
+ public: // constructor and destructors
+
+ static CVtEngCommandHandler* NewL(
+ CVtEngHandlerContainer& aHandlers );
+
+ virtual ~CVtEngCommandHandler();
+
+ public: // from MVtEngCommandHandler
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual void ExecuteL(
+ const TVtEngCommandId aCommand,
+ TDesC8* aParams );
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual TInt CancelCommand( const TVtEngCommandId aCommandId );
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual TInt GetCommandCaps(
+ const TVtEngCommandId aCommand );
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual TVtEngCommandId PendingCommand();
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual TVtEngCommandId InvalidCommand();
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual void AddObserverL( MVtEngCommandObserver& aObserver );
+
+ /**
+ * @see MVtEngCommandHandler
+ */
+ virtual void RemoveObserver( MVtEngCommandObserver& aObserver );
+
+ public: // from MVtEngOperationObserver
+
+ /**
+ * Handles command completion.
+ * @param aCommand command id
+ * @param aResult Symbian OS error code.
+ */
+ virtual void CommandCompleteL(
+ const TVtEngCommandId aCommand,
+ const TInt aResult );
+
+ /**
+ * Sets pending asynch operation
+ * @param aActiveOp pending operation or NULL.
+ */
+ virtual void SetOperation( CVtEngOperation* aActiveOp );
+
+ private: // constructors
+
+ /**
+ * Second phase constructor
+ */
+ void ConstructL();
+
+ /**
+ * c++ constructor
+ */
+ CVtEngCommandHandler( CVtEngHandlerContainer& aHandlers );
+
+ private:
+
+ void AddToPoolL( TVtEngCommandId aCommand );
+
+ /**
+ * Validates command
+ */
+ void ValidateL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* aParams );
+
+ /**
+ * Check if command is async.
+ */
+ void CheckAsynchronity(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps );
+
+ /**
+ * Check if command is supported.
+ */
+ void CheckSupport(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps );
+
+ /**
+ * Check if command is applicable in current state.
+ */
+ void CheckState(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps );
+
+ private: // command pool
+
+ struct TVtOpItem
+ {
+ TVtEngCommandId iId;
+ CVtEngOperation* iOperation;
+ };
+ /**
+ * Command pool for commands instantiated at construction
+ * time to guarantee certain operations.
+ */
+ NONSHARABLE_CLASS( CVtEngCmdPool ): public CArrayPtrFlat<CVtEngOperation>
+ {
+ public: // constructor and destructor
+
+ // Constructor
+ CVtEngCmdPool( TInt aGranularity );
+
+ // Destructor
+ ~CVtEngCmdPool();
+
+ public: // data structures
+
+
+ public: // new methods
+
+ /**
+ * Returns operation stored in the pool.
+ * @param aId command id
+ * @return operation or NULL if not found.
+ */
+ CVtEngOperation* Get( const TVtEngCommandId aId );
+
+ };
+
+ private: // Data members
+
+ RPointerArray<MVtEngCommandObserver> iObservers;
+ CVtEngHandlerContainer& iHandlers;
+ CVtEngOperation* iActiveOp;
+ CVtEngCmdPool* iCommandPool;
+ TVtEngCommandId iInvalidCommandId;
+
+ };
+
+#endif //CVTENGCOMMANDHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngOperation.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2006 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: Operation base class.
+*
+*/
+
+
+
+#ifndef CVTENGOPERATION_H
+#define CVTENGOPERATION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngCommandHandler;
+class CVtEngHandlerContainer;
+class MVtEngOperationObserver;
+
+/**
+* Operation base class.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngOperation ) : public CBase
+ {
+ public: // constructor and destructors
+
+ /**
+ * two-phase constructor
+ * @param aCommandId command id
+ * @param aHandlers handler container
+ * @param aObserver observer called back when operation is completed
+ * @param aDelete if ETrue command deletes itself after completion
+ */
+ static CVtEngOperation* NewL(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete = ETrue );
+
+ /**
+ * Destructor
+ */
+ ~CVtEngOperation( );
+
+ public: // new functions
+
+ /**
+ * Performs operations.
+ * @return ETrue is operation is complete (i.e. sync).
+ */
+ virtual TBool ExecuteL( TDesC8* aParams );
+
+ /**
+ * Cancels pending command.
+ * @return ETrue if cancelled was succesfull or there
+ * is nothing to cancel.
+ */
+ TBool Cancel();
+
+ /**
+ * Returns command identifier.
+ * @return command identifier
+ */
+ inline TVtEngCommandId Command() const;
+
+ /**
+ * Returns command parameter buffer.
+ * @return parameter buffer
+ */
+ inline const TDesC8* Parameters() const;
+
+ /**
+ * Notifies observer on completion.
+ * @param aResult Symbian OS error code
+ */
+ virtual void HandleOpComplete( const TInt aResult );
+
+ protected: // new functions
+
+ /**
+ *
+ */
+ TBool OfferExecuteSyncL( TDesC8* aParams );
+
+ protected:
+ /**
+ * c++ constructor
+ */
+ CVtEngOperation(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aCommandHandler,
+ TBool aDelete );
+
+ /**
+ * Handles asynchronous operation complete
+ */
+ static TInt ASyncHandleOpComplete( TAny* aPtr );
+
+ protected:
+
+ // Command identifier
+ const TVtEngCommandId iCommand;
+
+ // Handler container
+ CVtEngHandlerContainer& iHandlers;
+
+ // observer for command response
+ MVtEngOperationObserver& iObserver;
+
+ // Parameter
+ TDesC8* iParams;
+
+ // Delete command when complete
+ TBool iDelete;
+
+ // Pointer to asynchronous callback
+ CAsyncCallBack* iAsyncCallback;
+
+ // Asynchronous callback error identifier
+ TInt iAsyncErr;
+ };
+
+/**
+* Utility class for unpacking data type with descriptor data.
+* @lib videoteleng
+* @since 2.6
+*/
+template <class T>
+class TVtEngOpParamUtil
+ {
+ public:
+ /**
+ * Sets parameter in aDes to aRef.
+ */
+ inline void static Set( T& aRef , const CVtEngOperation& aOp );
+ };
+
+#include "CVtEngOperation.inl"
+
+#endif // CVTENGOPERATION_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngOperation.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 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: Operation inline methods
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Command
+// -----------------------------------------------------------------------------
+inline TVtEngCommandId CVtEngOperation::Command() const { return iCommand; }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Parameters
+// -----------------------------------------------------------------------------
+inline const TDesC8* CVtEngOperation::Parameters() const { return iParams; }
+
+// -----------------------------------------------------------------------------
+// TVtEngOpParamUtil::Set
+// -----------------------------------------------------------------------------
+template <class T>
+inline void TVtEngOpParamUtil<T>::Set(
+ T& aRef,
+ const CVtEngOperation& aOp )
+ {
+ TPckgC<T> pckg( aRef );
+ pckg.Set( *aOp.Parameters() );
+ aRef = pckg();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/MVtEngCommandHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2006 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: Command handler interface of the engine.
+*
+*/
+
+
+
+#ifndef MVTENGCOMMANDHANDLER_H
+#define MVTENGCOMMANDHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+class MVtEngCommandObserver;
+
+// CLASS DECLARATION
+
+/**
+* Handler for commands from client.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngCommandHandler
+ {
+ public:
+
+ /**
+ * EAttribAsync
+ * command is asynchronous.
+ * EAttribEnabled
+ * Command can be executed at the moment.
+ * EAttribSupported
+ * Command is supported by the engine.
+ */
+ enum TCommandCaps
+ {
+ EAttribAsync = 0x00000001,
+ EAttribEnabled = 0x00000002,
+ EAttribSupported = 0x00000004
+ };
+
+ /**
+ * Excecutes a command. This function leaves KErrNotReady
+ * if engine is in such a state that command cannot be
+ * executed.
+ *
+ * @param aCommandId command to be executed.
+ * @param aParams command parameters, NULL if command
+ * does not require any.
+ */
+ virtual void ExecuteL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* aParams ) = 0;
+
+ /**
+ * Cancels a command.
+ * @param aCommandId command to cancel.
+ * @return KErrNotFound if command is not pending.
+ */
+ virtual TInt CancelCommand( const TVtEngCommandId aCommandId ) = 0;
+
+ /**
+ * Returns capabilities of a command.
+ * @return command caps
+ */
+ virtual TInt GetCommandCaps(
+ const TVtEngCommandId aCommand ) = 0;
+
+ /**
+ * Returns pending command.
+ * @return pending command
+ */
+ virtual TVtEngCommandId PendingCommand() = 0;
+
+ /**
+ * Returns invalid command.
+ * @return invalid command
+ */
+ virtual TVtEngCommandId InvalidCommand() = 0;
+
+ /**
+ * Sets command observer. First call on this is guaranteed
+ * to succeed.
+ * @param aObserver command observer.
+ */
+ virtual void AddObserverL( MVtEngCommandObserver& aObserver ) = 0;
+
+ /**
+ * Removes a command observer or if non-op if specified observer
+ * is not found.
+ * @param aObserver command observer to be removed.
+ */
+ virtual void RemoveObserver( MVtEngCommandObserver& aObserver ) = 0;
+ };
+
+#endif //MVTENGCOMMANDHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/MVtEngCommandObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 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: Observer for asynchronous commands.
+*
+*/
+
+
+
+#ifndef MVTENGCOMMANDOBSERVER_H
+#define MVTENGCOMMANDOBSERVER_H
+
+// INCLUDES
+#include <vtengcommands.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+* Observer for asynchronous commands.
+*
+* @since 2.6
+*/
+class MVtEngCommandObserver
+ {
+ public: // new functions
+
+ /**
+ * Callback for command completion.
+ * @param aCommand completed command. This is
+ * same instance as passed in MVtEngCommandHandler::ExecuteL.
+ * Client may delete the command.
+ * @param aError Symbian OS error code.
+ */
+ virtual void HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError ) = 0;
+ };
+
+#endif // MVTENGCOMMANDOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/TVtEngOperationUtils.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2006 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: Handler utili
+*
+*
+*/
+
+
+
+#ifndef TVTENGOPERATIONUTILS
+#define TVTENGOPERATIONUTILS
+
+// INCLUDES
+#include <e32std.h>
+#include "vtengcommands.h"
+
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+// CLASS DECLARATION
+
+/**
+* Handles rendering operation
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngRenderUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+
+ static void Cancel(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+ };
+
+/**
+* Handles audio routing operation.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngAudioRoutingUtil
+ {
+ public:
+
+ /**
+ *
+ * @param aOperation operation
+ */
+ static void HandleL(
+ CVtEngOperation& aOperation );
+ };
+
+
+/**
+* Handles audio playback operation.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngAudioPlaybackUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+ };
+
+/**
+* Handles media transport operation like pausing/resuming.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngMediaTransportUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+ };
+
+/**
+*
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngViewFinderConfigureUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+ };
+
+/**
+*
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngCameraConfigUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+ };
+
+/**
+* Handles engine initialization.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngEngineInitUtil
+ {
+ public:
+
+ static void HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers );
+
+ static void Cancel( CVtEngOperation& aOperation );
+ };
+
+
+/**
+* Handles extension operations.
+*
+* @lib videoteleng
+* @since S60 v3.2
+*/
+class TVtEngExtensionUtil
+ {
+ public:
+
+ /**
+ * Handles extension operations
+ * @param aOperation operation
+ */
+ static void HandleL(
+ CVtEngOperation& aOperation );
+ };
+#endif // TVTENGOPERATIONUTILS
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/cvtenginternaloperation.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,88 @@
+/*
+* 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: Operation class for commands not originated by UI but
+* engine itself.
+*
+*/
+
+
+#ifndef C_VTENGINTERNALOPERATION_H
+#define C_VTENGINTERNALOPERATION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CVtEngOperation.h"
+
+// FORWARD DECLARATIONS
+class CVtEngCommandHandler;
+class CVtEngHandlerContainer;
+
+/**
+* Class for handling operation (command) originated engine itself.
+* Deviation from base class behavior: does not set itself as "active
+* operation" in command handler (observer of the operation). Also
+* response is given in synchronous manner.
+*
+* @lib videoteleng
+* @since S60 5.0
+*/
+NONSHARABLE_CLASS( CVtEngInternalOperation ) : public CVtEngOperation
+ {
+public: // constructor and destructors
+
+ /**
+ * two-phase constructor
+ * @param aCommandId command id
+ * @param aHandlers handler container
+ * @param aCommandHandler command handler
+ * @param aDelete if ETrue command deletes itself after completion
+ * @return internal operation
+ */
+ static CVtEngInternalOperation* NewL(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete = ETrue );
+
+ /**
+ * Destructor
+ */
+ ~CVtEngInternalOperation( );
+
+public: // from CVtEngOperation
+
+ /**
+ * @see CVtEngOperation
+ */
+ virtual TBool ExecuteL();
+
+ /**
+ * @see CVtEngOperation
+ */
+ virtual void HandleOpComplete( const TInt aResult );
+
+private:
+ /**
+ * c++ constructor
+ */
+ CVtEngInternalOperation(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete );
+ };
+
+#endif // C_VTENGINTERNALOPERATION_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/mvtengoperationobserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* 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: Observer interface for engine operations
+*
+*/
+
+
+#ifndef M_VTENGOPERATIONOBSERVER_H
+#define M_VTENGOPERATIONOBSERVER_H
+
+// INCLUDES
+#include <e32def.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+* Interface for setting active operation and responding to commands
+*
+* @lib videoteleng
+* @since 5.0
+*/
+class MVtEngOperationObserver
+ {
+public:
+
+ virtual void SetOperation( CVtEngOperation* aActiveOp ) = 0;
+
+ virtual void CommandCompleteL(
+ const TVtEngCommandId aCommand,
+ const TInt aResult ) = 0;
+ };
+
+#endif // M_VTENGOPERATIONOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/vtengcommands.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2006 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: Video telephony engine command identifiers.
+*
+*/
+
+
+
+#ifndef CVTENGCOMMANDS_H
+#define CVTENGCOMMANDS_H
+
+// INCLUDES
+#include <e32def.h>
+
+// DATA TYPES
+typedef TInt TVtEngCommandId;
+
+// CONSTANTS
+
+
+const TInt KVtEngCommandNone = -1;
+
+const TInt KVtEngCommandBase = 0;
+
+/**
+* Configuration commands
+*/
+const TInt KVtEngConfigureCommandBase = KVtEngCommandBase + 100;
+
+// Allocates essential resources when application starts up
+const TInt KVtEngInitializeEngine = KVtEngConfigureCommandBase + 1;
+
+// Resets engine. Use when all video calls are ended.
+const TInt KVtEngResetEngine = KVtEngConfigureCommandBase + 2;
+
+/**
+* Makes voice call to existing peer.
+*/
+const TInt KVtEngSwitchToVoice = KVtEngConfigureCommandBase + 4;
+
+// Allocates essential resources when application starts up - TEST MODE
+const TInt KVtEngInitializeEngineDiag = KVtEngConfigureCommandBase + 50;
+
+// Allocates essential resources when application starts up - TEST MODE
+const TInt KVtEngInitializeEngineTest = KVtEngConfigureCommandBase + 51;
+//
+
+/**
+* Media commands for controlling local display and sending
+* of media (audio/video) to the peer.
+*/
+const TInt KVtEngMediaCommandBase = KVtEngConfigureCommandBase + 100; // 200
+
+// Actual commands
+
+/**
+* Selects source,
+* @see MVtEngMedia::TMediaSource for command parameters.
+*/
+const TInt KVtEngSetSource = KVtEngMediaCommandBase + 1;
+
+/**
+* Async
+* Initializes default or selected camera.
+* Does not take parameters. See KVtEngSetSource command parameters.
+*/
+const TInt KVtEngPrepareCamera = KVtEngMediaCommandBase + 2;
+
+/**
+* prepares engine to pass view finder frames to UI
+* @see MVtEngMedia::TVtEngViewFinderConfig for command parameters.
+*/
+const TInt KVtEngPrepareViewFinder = KVtEngMediaCommandBase + 3;
+
+/**
+* Sync
+* prepares engine to render view finder frames using DSA
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngPrepareViewFinderDSA = KVtEngMediaCommandBase + 4;
+
+/**
+* Async
+* Starts view finder
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngStartViewFinder = KVtEngMediaCommandBase + 5;
+
+/**
+* Async
+* View finder control commands, do not take parameters.
+*/
+const TInt KVtEngPauseViewFinder = KVtEngMediaCommandBase + 6;
+const TInt KVtEngStopViewFinder = KVtEngMediaCommandBase + 7;
+
+/**
+* Prepares engine for rendering video (with DSA) from peer
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRenderDSA = KVtEngMediaCommandBase + 8;
+
+/**
+* Prepares engine for rendering video from peer
+* @see MVtEngMedia::TVtEngViewFinderConfig for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRender = KVtEngMediaCommandBase + 9;
+
+/**
+* Remote video rendering commands, do not take parameters.
+*/
+const TInt KVtEngStartRenderRemote = KVtEngMediaCommandBase + 10;
+const TInt KVtEngPauseRenderRemote = KVtEngMediaCommandBase + 11;
+const TInt KVtEngStopRenderRemote = KVtEngMediaCommandBase + 12;
+
+/**
+* Media transport control commands, do not take parameters.
+*/
+// Audio
+const TInt KVtEngMuteOutgoingAudio = KVtEngMediaCommandBase + 13;
+const TInt KVtEngUnmuteOutgoingAudio = KVtEngMediaCommandBase + 14;
+const TInt KVtEngPauseIncomigAudio = KVtEngMediaCommandBase + 15;
+const TInt KVtEngResumeIncomigAudio = KVtEngMediaCommandBase + 16;
+
+/**
+* Sync.
+* Sets video source provider zoom step.
+* Parameter is TInt from zero to maximum zoom step.
+* @see MVtEngMedia::GetMaxZoomStep.
+*/
+const TInt KVtEngSetZoomStep = KVtEngMediaCommandBase + 17;
+
+/**
+* Sync
+* Sets size of remote video, parameter is of type TSize
+*/
+const TInt KVtEngSetRemoteVideoSize = KVtEngMediaCommandBase + 18;
+
+/**
+* Sets UI foreground state (ETrue or EFalse)
+*/
+const TInt KVtEngSetUIForeground = KVtEngMediaCommandBase + 19;
+
+/**
+* Freeze provider video.
+*/
+const TInt KVtEngFreeze = KVtEngMediaCommandBase + 20;
+
+/**
+* Unfreeze provider video.
+*/
+const TInt KVtEngUnfreeze = KVtEngMediaCommandBase + 21;
+
+/**
+* Adjusts video quality.
+*/
+const TInt KVtEngSetVideoQuality = KVtEngMediaCommandBase + 22;
+
+/**
+* Initialize image sharing.
+*/
+const TInt KVtEngInitializeShareImage = KVtEngMediaCommandBase + 23;
+
+/**
+* Start image sharing (must be initialized first).
+*/
+const TInt KVtEngStartShareImage = KVtEngMediaCommandBase + 24;
+
+/**
+* Stop image sharing.
+*/
+const TInt KVtEngStopShareImage = KVtEngMediaCommandBase + 25;
+
+/**
+* Sync
+* prepares engine to render view finder frames using DP
+* @see MVtEngMedia::TRenderingOptionsDP for command parameters.
+*/
+const TInt KVtEngPrepareViewFinderDP = KVtEngMediaCommandBase + 26;
+
+/**
+* Prepares engine for rendering video (with DP) from peer
+* @see MVtEngMedia::TRenderingOptionsDP for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRenderDP = KVtEngMediaCommandBase + 27;
+
+/**
+* Engine reintializes camera instance when layout change happens and active
+* provider is onboard camera. If anyother provider is selected, then nothing
+* will be done by the engine.
+*/
+const TInt KVtEngHandleLayoutChange = KVtEngMediaCommandBase + 28;
+
+/**
+ * Sync
+ * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+ */
+const TInt KVtEngRequestLastRemoteFrame = KVtEngMediaCommandBase + 29;
+
+
+const TInt KVtEngPrepareRemoteRenderNGA = KVtEngMediaCommandBase + 30;
+
+/**
+* Audio control
+*/
+const TInt KVtEngAudioCommandBase = KVtEngMediaCommandBase + 100; // 300
+
+// Actual commands
+
+/**
+* Sets output volume level [1..10] for active audio device
+*/
+const TInt KVtEngSetAudioVolume = KVtEngAudioCommandBase + 1;
+
+/**
+* Audiorouting command
+*/
+const TInt KVtEngSetAudioRouting = KVtEngAudioCommandBase + 2;
+
+/**
+* Increase volume by one step.
+*/
+const TInt KVtEngIncreaseAudioVolume = KVtEngAudioCommandBase + 3;
+
+/**
+* Decrease volume by one step.
+*/
+const TInt KVtEngDecreaseAudioVolume = KVtEngAudioCommandBase + 4;
+
+/**
+* Session commands
+*/
+const TInt KVtEngSessionCommandBase = KVtEngAudioCommandBase + 100;
+
+// Actual commands
+
+/**
+* Terminates session and tears down connection
+*/
+const TInt KVtEngTerminateSession = KVtEngSessionCommandBase + 1;
+
+const TInt KVtEngSendDtmf = KVtEngSessionCommandBase + 2;
+
+/**
+* Starts sending a DTMF tone. Takes TChar parameter. Sync
+*/
+const TInt KVtEngStartDtmfTone = KVtEngSessionCommandBase + 3;
+
+/**
+* Stops previously started tone. Does not take parametners. Sync
+*/
+const TInt KVtEngStopDtmfTone = KVtEngSessionCommandBase + 4;
+
+/**
+* Remote supports UII DTMF.
+*/
+const TInt KVtEngSetUIIDtmfSupport = KVtEngSessionCommandBase + 5;
+
+/**
+* Remote supports UII basic string.
+*/
+const TInt KVtEngSetUIIBasicStringSupport = KVtEngSessionCommandBase + 6;
+
+/**
+* Remote supports UII IA5 string.
+*/
+const TInt KVtEngSetUIIIA5StringSupport = KVtEngSessionCommandBase + 7;
+
+/**
+* Remote supports UII general string.
+*/
+const TInt KVtEngSetUIIGeneralStringSupport = KVtEngSessionCommandBase + 8;
+
+
+/**
+* Extension commands.
+*/
+const TInt KVtEngExtensionCommandBase = KVtEngSessionCommandBase + 100; //500
+const TInt KVtEngSetContrast = KVtEngExtensionCommandBase + 1;
+const TInt KVtEngSetBrightness = KVtEngExtensionCommandBase + 2;
+const TInt KVtEngSetWhiteBalance = KVtEngExtensionCommandBase + 3;
+const TInt KVtEngSetColorTone = KVtEngExtensionCommandBase + 4;
+#if defined ( RD_VT_RTF )
+const TInt KVtEngStartRecord = KVtEngExtensionCommandBase + 5;
+const TInt KVtEngStopRecord = KVtEngExtensionCommandBase + 6;
+#endif // RD_VT_RTF
+
+#endif // CVTENGCOMMANDS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngCameraPreferences.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Camera Preferences extension
+*
+*/
+
+
+#ifndef CVTENGCAMERAPREFERENCES_H
+#define CVTENGCAMERAPREFERENCES_H
+
+// INCLUDES
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngOperation.h"
+
+#include <cvtlogger.h>
+#include <e32base.h>
+
+#include <mvtengcamerapreferences.h>
+#include "CVtEngExtensionBase.h"
+
+// FORWARD DECLARATIONS
+class CVSDataProvider;
+class MVtEngCameraPreferencesObserver;
+
+// CLASS DECLARATION
+
+/**
+* Videoteleng extension base class.
+*
+* @lib videoteleng.lib
+* @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngCameraPreferences ): public CVtEngExtensionBase,
+ public MVtEngCameraPreferences
+ {
+ public: //Constructor and destructor.
+
+ /**
+ * Symbian two-phase constructor.
+ * @return engine extension instance
+ */
+ static CVtEngCameraPreferences* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVtEngCameraPreferences();
+
+ public: // from base class CVtEngExtensionBase
+
+ /**
+ * @see CVtEngExtensionBase::GetInterface
+ */
+ virtual TAny* GetInterface();
+
+ /**
+ * @see CVtEngExtensionBase::HandleL
+ */
+ virtual TBool HandleL( CVtEngOperation* aOp );
+
+ /**
+ * @see CVtEngExtensionBase::ValidateCommand
+ */
+ virtual TBool ValidateCommand( const TVtEngCommandId aCommandId );
+
+ public: // from base class MVtEngCameraPreferences
+
+ /**
+ * @see MVtEngCameraPreferences::GetColorTone
+ */
+ virtual TInt GetColorTone(
+ MVtEngCameraPreferences::TColorTone& aColortone ) const;
+
+ /**
+ * @see MVtEngCameraPreferences::GetSupportedColorTones
+ */
+ virtual TInt GetSupportedColorTones(
+ TUint32& aSupportedColorTones ) const;
+
+ /**
+ * @see MVtEngCameraPreferences::GetWhiteBalance
+ */
+ virtual TInt GetWhiteBalance(
+ MVtEngCameraPreferences::TWhiteBalance& aWhiteBalance ) const;
+
+ /**
+ * @see MVtEngCameraPreferences::GetSupportedWhiteBalanceModes
+ */
+ virtual TInt GetSupportedWhiteBalanceModes(
+ TUint32& aWhiteBalance ) const;
+
+ /**
+ * @see MVtEngCameraPreferences::GetBrightness
+ */
+ virtual TInt GetBrightness( TInt& aBrightness) const;
+
+ /**
+ * @see MVtEngCameraPreferences::GetContrast
+ */
+ virtual TInt GetContrast( TInt& aContrast ) const;
+
+ public:
+
+ /**
+ * Sets data provider to camera prefefrences
+ * @param aProvider pointer to current active data provider
+ * @param aObserver reference to observer
+ */
+ virtual void SetProvider( CVSDataProvider* aProvider,
+ MVtEngCameraPreferencesObserver& aObserver );
+
+ /**
+ * Detaches observer from preference instance.
+ * @param aObserver reference to observer
+ */
+ void Detach( MVtEngCameraPreferencesObserver& aObserver );
+
+ private:
+
+ /*
+ * C++ default constructor.
+ */
+ CVtEngCameraPreferences();
+
+ /**
+ * Symbian two-phase constructor.
+ */
+ void ConstructL();
+
+ private:
+
+ // Video source data provider pointer
+ CVSDataProvider* iProvider;
+
+ // Preference observer pointer
+ MVtEngCameraPreferencesObserver* iObserver;
+
+ };
+
+#endif //CVTENGCAMERAPREFERENCES_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngExtensionBase.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006 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: Videoteleng extension base class
+*
+*/
+
+
+#ifndef CVTENGEXTENSIONSBASE_H
+#define CVTENGEXTENSIONSBASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+* Videoteleng extension base class.
+*
+* @lib videoteleng.lib
+* @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngExtensionBase ): public CBase
+
+ {
+ public: // pure virtuals.
+
+ /**
+ * Returns extension API interface
+ * @return API IF as TAny pointer
+ */
+ virtual TAny* GetInterface() = 0;
+
+ /**
+ * Handles requested extension operation
+ * @param aOp requested operation pointer
+ * @return TBool if operation succeed or not
+ */
+ virtual TBool HandleL( CVtEngOperation* aOp ) = 0;
+
+ /**
+ * Validates requested extension command
+ * @param aCommandId requested command identifier (TInt)
+ * @return TBool if command is valid or not
+ */
+ virtual TBool ValidateCommand( const TVtEngCommandId aCommandId ) = 0;
+
+ /**
+ * Gets extension UID
+ * @return extension UID
+ */
+ const TUid& Uid() const;
+
+ protected:// Constructor.
+ /*
+ * C++ default constructor.
+ */
+ CVtEngExtensionBase( TUid aExtensionUid );
+
+ private:
+
+ // Extension UID
+ const TUid iExtensionUid;
+ };
+
+#endif //CVTENGEXTENSIONSBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngExtensions.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 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: Videoteleng API extension configuration
+*
+*/
+
+
+#ifndef CVTENGEXTENSIONS_H
+#define CVTENGEXTENSIONS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// CONSTANTS AND MACROS
+const TInt KExtensionGranularity = 1;
+
+// FORWARD DECLARATIONS
+class CVtEngExtensionBase;
+class CVtEngCameraPreferences;
+class CVtEngOperation;
+class CVtEngMediaHandler;
+
+// CLASS DECLARATION
+
+/**
+* Video telephony extension handling.
+*
+* @lib videoteleng.lib
+* @since S60 v3.2
+*/
+NONSHARABLE_CLASS(CVtEngExtensions): public CBase
+
+ {
+ public: // Constructor and destructor.
+
+ /**
+ * Symbian two-phase constructor.
+ * @return engine extension instance
+ */
+ static CVtEngExtensions* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVtEngExtensions();
+
+ public:
+
+ /**
+ * Gets client interface from certain extension
+ * @param aInterfacePtr a pointer to client IF pointer
+ * @param aUid requested client IF extension UID
+ * @param aHandler a handle to media handler
+ */
+ TInt GetClientInterface( TAny** aInterfacePtr,
+ const TUid& aUid , CVtEngMediaHandler& aHandler );
+
+ /**
+ * Offers operation for extensions
+ * @param aOp operation pointer
+ * @return TBool value indicating if any of exsisting extension
+ * was able to handle operation
+ */
+ TBool OfferOperationL( CVtEngOperation* aOp );
+
+ /**
+ * Validates extension command
+ * @param aCommandId command ID (TInt)
+ * @return TBool value indicating if any of exsisting extension
+ * was able to validate operation
+ */
+ TBool ValidateCommand( const TVtEngCommandId aCommandId );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngExtensions();
+
+ /**
+ * Symbian constructor that may leave.
+ */
+ void ConstructL();
+
+ /**
+ * Creates certain extension
+ */
+ CVtEngExtensionBase* CreateExtensionsL( const TUid& aUid,
+ CVtEngMediaHandler& aHandler );
+
+ /**
+ * Search extensions using UID
+ */
+ TInt LookupExtensions( const TUid& aUid) const;
+
+ private:
+
+ // Extension handle container
+ RPointerArray <CVtEngExtensionBase> iExtensionArray;
+
+ };
+
+#endif //CVTENGEXTENSIONS_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/MVtEngCameraPreferences.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Camera Preferences extension API
+*
+*/
+
+
+#ifndef MVTENGCAMERAPREFERENCES_H
+#define MVTENGCAMERAPREFERENCES_H
+
+// INCLUDES
+#include <ecam.h>
+#include <ecamimageprocessing.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// CONSTANTS
+const TUid KVtEngExtensionCameraPreferences = {0x10282814};
+
+/**
+* Camera preferences extension API class.
+*
+* @lib videoteleng.lib
+* @since S60 v3.2
+*/
+
+class MVtEngCameraPreferences
+ {
+ public:
+
+ enum TColorTone
+ {
+ /** Normal colors. */
+ ENormal = CCamera::CCameraImageProcessing::EEffectNone,
+ /** Sepial. */
+ ESepia = CCamera::CCameraImageProcessing::EEffectSepia,
+ /** Black and White. */
+ EGrayscale = CCamera::CCameraImageProcessing::EEffectMonochrome,
+ /** Inverted colors. */
+ ENegative = CCamera::CCameraImageProcessing::EEffectNegative
+ };
+
+ enum TWhiteBalance
+ {
+ /** Automatically adjusted. */
+ EAuto = CCamera::EWBAuto,
+ /** Normal daylight. */
+ EDaylight = CCamera::EWBDaylight,
+ /** Overcast daylight. */
+ ECloudy = CCamera::EWBCloudy,
+ /** Tungsten filament lighting. */
+ ETungsten = CCamera::EWBTungsten,
+ /** Fluorescent bulb lighting. */
+ EFluorescent = CCamera::EWBFluorescent,
+ /** Flash lighting. */
+ EFlash = CCamera::EWBFlash,
+ /** High contrast daylight primarily snowy. */
+ ESnow = CCamera::EWBSnow,
+ /** High contrast daylight primarily near the sea. */
+ EBeach = CCamera::EWBBeach,
+ /** User configurable mode. */
+ EManual = CCamera::EWBManual,
+ /** Shade. */
+ EShade = CCamera::EWBShade
+ };
+
+ enum TBrightness
+ {
+ /** Automatically set brightness value*/
+ EAutomaticBrightness = KMinTInt
+ };
+
+ enum TContrasts
+ {
+ /** Automatically set contrast value*/
+ EAutomaticContrast = KMinTInt
+ };
+
+ /**
+ * Gets current color tone value from camera
+ * @param aColortone reference value for current color tone
+ * @return Symbian error code
+ */
+ virtual TInt GetColorTone( TColorTone& aColortone ) const = 0;
+
+ /**
+ * Gets all suported color tone values from camera
+ * @param aSupportedColorTones reference value for supported colortone
+ * values (a bit field)
+ * @return Symbian error code
+ */
+ virtual TInt GetSupportedColorTones(
+ TUint32& aSupportedColorTones ) const = 0;
+
+ /**
+ * Gets current whitebalance value from camera
+ * @param aWhiteBalance reference value for current whitebalance
+ * @return Symbian error code
+ */
+ virtual TInt GetWhiteBalance(
+ TWhiteBalance& aWhiteBalance ) const = 0;
+
+ /**
+ * Gets all suported whitebalance values from camera
+ * @param aWhiteBalance reference value for supported whitebalance
+ * values (a bit field)
+ * @return Symbian error code
+ */
+ virtual TInt GetSupportedWhiteBalanceModes(
+ TUint32& aWhiteBalance ) const = 0;
+
+ /**
+ * Gets current brightness value from camera
+ * @param aBrightness reference value for current brightness
+ * @return Symbian error code
+ */
+ virtual TInt GetBrightness( TInt& aBrightness) const = 0;
+
+ /**
+ * Gets current contrast value from camera
+ * @param aContrast reference value for current brightness
+ * @return Symbian error code
+ */
+ virtual TInt GetContrast( TInt& aContrast ) const = 0;
+
+ };
+
+#endif //MVTENGCAMERAPREFERENCES_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/cvtengr2ftoneplayer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 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: Plays video start/stop sounds.
+*
+*/
+
+
+#ifndef CVTENGR2FTONEPLAYER_H
+#define CVTENGR2FTONEPLAYER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mdaaudiosampleplayer.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Plays video start/stop sounds.
+* @since s60 v5.0
+*/
+NONSHARABLE_CLASS ( CVtEngR2FTonePlayer ) : public CBase,
+ public MMdaAudioPlayerCallback
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngR2FTonePlayer* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngR2FTonePlayer();
+
+ public: // New functions
+ /**
+ * Play a sound with given id.
+ * @param aSound identifies which sound to play
+ * (see r_ccor_sound_list in resources).
+ * @return Symbian error code.
+ */
+ TInt PlaySound( TInt aSound );
+
+ /**
+ * Stop any ongoing sound.
+ */
+ void StopSound();
+
+ private: // Functions from base classes
+ /**
+ * From MMdaAudioPlayerCallback.
+ */
+ void MapcInitComplete( TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration );
+
+ /**
+ * From MMdaAudioPlayerCallback.
+ */
+ void MapcPlayComplete( TInt aError );
+
+ private: // New functions
+ /**
+ * C++ constructor.
+ */
+ CVtEngR2FTonePlayer();
+
+ /**
+ * Symbian OS 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ TBool iOpenFileInProgress;
+ TBool iSoundInProgress;
+ CMdaAudioPlayerUtility* iAudioPlayer; // owned
+
+ HBufC* iVideoStartSound; // owned
+ HBufC* iVideoStopSound; // owned
+
+ public:
+
+ /**
+ * Enum for tone player sound ID's
+ */
+ enum TVtR2FSoundId
+ {
+ /** Video record start sound*/
+ EVtR2FVideoStartSoundId = 1,
+ /** Video record stopt sound*/
+ EVtR2FVideoStopSoundId
+ };
+ };
+
+#endif //CVTENGR2FTONEPLAYER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/cvtengrecord2file.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Camera Preferences extension
+*
+*/
+
+
+#ifndef CVTENGRECORD2FILE_H
+#define CVTENGRECORD2FILE_H
+
+// INCLUDES
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngOperation.h"
+
+#include "cvtengr2ftoneplayer.h"
+
+#include <cvtlogger.h>
+#include <e32base.h>
+
+#include <mvtengrecord2file.h>
+#include "CVtEngExtensionBase.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CVtEngR2FTonePlayer;
+/**
+* Videoteleng extension base class.
+*
+* @lib videoteleng.lib
+* @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngRecord2File ): public CVtEngExtensionBase,
+ public MVtEngRecord2File
+ {
+ public: //Constructor and destructor.
+
+ /**
+ * Symbian two-phase constructor.
+ * @return engine extension instance
+ */
+ static CVtEngRecord2File* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVtEngRecord2File();
+
+ public: // from base class CVtEngExtensionBase
+
+ /**
+ * @see CVtEngExtensionBase::GetInterface
+ */
+ virtual TAny* GetInterface();
+
+ /**
+ * @see CVtEngExtensionBase::HandleL
+ */
+ virtual TBool HandleL( CVtEngOperation* aOp );
+
+ /**
+ * @see CVtEngExtensionBase::ValidateCommand
+ */
+ virtual TBool ValidateCommand( const TVtEngCommandId aCommandId );
+
+ public: // from base class MVtEngRecord2File
+
+ /**
+ * For testin puposes only
+ * @see MVtEngRecord2File::IsTonePlaySupported
+ */
+ virtual TInt IsTonePlaySupported( TBool& aSupported) const;
+
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngRecord2File();
+
+ /**
+ * Symbian two-phase constructor.
+ */
+ void ConstructL();
+
+ public: // data
+
+ private: // data
+ CVtEngR2FTonePlayer* iTonePlayer;
+ };
+
+#endif //CVTENGRECORD2FILE_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/mvtengcamerapreferencesobserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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: Videoteleng Camera Preferences extension Observer
+*
+*/
+
+
+#ifndef MVTENGCAMERAPREFERENCESOBSERVER_H
+#define MVTENGCAMERAPREFERENCESOBSERVER_H
+
+// INCLUDES
+#include <mvtengcamerapreferences.h>
+
+/**
+* Camera preferences extension observer.
+*
+* @lib videoteleng.lib
+* @since S60 v5.0
+*/
+class MVtEngCameraPreferencesObserver
+ {
+
+public:
+
+ /**
+ * Called when observer is attached to camera preferences instance.
+ * @param aCamPrefs Reference to camera preferences instance this observer
+ * was attached to.
+ */
+ virtual void Attach( MVtEngCameraPreferences& aCamPrefs ) = 0;
+
+ /**
+ * Called when color tone is updated.
+ * @param aColorTone New color tone value.
+ */
+ virtual void ColorToneUpdated(
+ MVtEngCameraPreferences::TColorTone aColorTone ) = 0;
+
+ /**
+ * Called when white balance is updated.
+ * @param aWhiteBalance New white balance value.
+ */
+ virtual void WhiteBalanceUpdated(
+ MVtEngCameraPreferences::TWhiteBalance aWhiteBalance ) = 0;
+
+ /**
+ * Called when brightness is updated.
+ * @param aBrightness New brightness value set.
+ */
+ virtual void BrightnessUpdated( TInt aBrightness ) = 0;
+
+ /**
+ * Called when contrast is updated.
+ * @param aContrast New contrast value set.
+ */
+ virtual void ContrastUpdated( TInt aContrast ) = 0;
+
+ /**
+ * Called when observer is detached from camera preferences instance.
+ * @param aCamPrefs Reference to camera preferences instance this observer
+ * was detached from.
+ */
+ virtual void Detach( MVtEngCameraPreferences& aCamPrefs ) = 0;
+
+ };
+
+#endif // MVTENGCAMERAPREFERENCESOBSERVER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/mvtengrecord2file.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Record to file extension API
+*
+*/
+
+
+#ifndef MVTENGRECORD2FILE_H
+#define MVTENGRECORD2FILE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// CONSTANTS
+const TUid KVtEngExtensionRecord2File = {0x10283156};
+
+/**
+* Record to file extension API class.
+*
+* @lib videoteleng.lib
+* @since S60 v5.0
+*/
+
+class MVtEngRecord2File
+ {
+ public:
+
+ /**
+ * For testin puposes only REMOVE
+ * @param aSupported boolean for tone play support
+ * @return Symbian error code
+ */
+ virtual TInt IsTonePlaySupported( TBool& aSupported) const = 0;
+ };
+#endif //MVTENGRECORD2FILE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawDP.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,509 @@
+/*
+* Copyright (c) 2004-2005 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: Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGDRAWDP_H
+#define CVTENGDRAWDP_H
+
+// INCLUDES
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigDP.h"
+
+#include <cvtimagescaler.h>
+
+// FORWARDS
+
+class TDisplaySinkParamsDP;
+class CVtImageBitmap;
+class CVtImageScaler;
+
+// CONSTANTS AND MACROS
+
+const TInt KVtEngMaxBuffers = 2;
+
+// CLASSES
+
+/**
+* Buffer waiter observer API
+*
+* @lib videoteleng.lib
+* @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( MVtEngBufferWaiterObserver )
+ {
+ public: // New methods
+
+ /**
+ * Buffer fetched without errors.
+ * @param aBuffer Pointer to fetched buffer.
+ */
+ virtual void BufferReady(
+ CPostingSurface::TPostingBuff* aBuffer ) = 0;
+
+ /**
+ * Buffer fetch error.
+ * @param aError Error code.
+ */
+ virtual void FetchError( TInt aError ) = 0;
+ };
+
+/**
+* Display Posting drawer
+*
+* @lib videoteleng.lib
+* @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CVtEngDrawDP ) : public CVtEngRemoteVideo::CVtEngDraw,
+ public MVtEngBufferWaiterObserver,
+ public MVtImageScalerObserver
+
+ {
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver call back interface to Display Sink
+ * @return instance of CVtEngDrawDP
+ */
+ static CVtEngDrawDP* NewL( MDisplaySinkObserver* aObserver );
+
+ // Destructor
+ ~CVtEngDrawDP();
+
+ private:
+
+ /**
+ * C++ constructor as private.
+ * @param aObserver callback interface for Display Sink
+ */
+ CVtEngDrawDP( MDisplaySinkObserver* aObserver );
+
+ private: // from MVtEngDraw
+
+ /**
+ * @see CVtEngDraw::BaseConstructL
+ */
+ void BaseConstructL();
+
+ /**
+ * @see CVtEngDraw::CreateSinkL
+ */
+ MDisplaySink* CreateSinkL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshL
+ */
+ void BaseRefreshL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshBitmapsL
+ */
+ void BaseRefreshBitmapsL();
+
+ /**
+ * @see CVtEngDraw::BaseDoCancel
+ */
+ void BaseDoCancel();
+
+ /**
+ * @see CVtEngDraw::BaseVerifyConfigL
+ */
+ void BaseVerifyConfigL();
+
+ /**
+ * @see CVtEngDraw::BaseRestartL
+ */
+ void BaseRestartL();
+
+ /**
+ * @see CVtEngDraw::BaseAbortNow
+ */
+ void BaseAbortNow();
+
+ /**
+ * @see CVtEngDraw::BaseStartDrawL
+ */
+ void BaseStartDrawL();
+
+ /**
+ * @see CVtEngDraw::BaseStopDraw
+ */
+ void BaseStopDraw();
+
+ /**
+ * @see CVtEngDraw::BaseSetConfigL
+ */
+ void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+ /**
+ * @see CVtEngDraw::BaseSetUIForegroundL
+ */
+ void BaseSetUIForegroundL( TBool aForeground );
+
+ /**
+ * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& aTo );
+
+ /**
+ * @see CVtEngDraw::BaseRequestLastFrame
+ */
+ void BaseRequestLastFrame();
+
+ /**
+ * @see CVtEngDraw::Config
+ */
+ TVtEngRenderConfig& Config();
+
+ private: // new methods
+
+ /**
+ * Handles all delayed calls.
+ */
+ void HandleDelayedCallsL();
+
+ /**
+ * Base construct implementation
+ */
+ void DoBaseConstructL();
+
+ /**
+ * Base start drawing implementation
+ */
+ void DoBaseStartDrawL();
+
+ /**
+ * Initialize posting surface implementation
+ */
+ void DoInitializePostingSurfaceL();
+
+ /**
+ * Update sink params implementation.
+ */
+ void DoUpdateSinkParamsL();
+
+ /**
+ * Updates sink params.
+ */
+ void UpdateSinkParamsL();
+
+ /**
+ * Checks if the alpha has been trashed on screen buffer (ETrue if it
+ * has been trashed, EFalse otherwise).
+ */
+ TBool IsAlphaTrashed() const;
+
+ /**
+ * Sets clipping region (read from DSA).
+ */
+ void SetClipRegionL();
+
+ /**
+ * Initializes DP.
+ */
+ void InitializePostingSurfaceL();
+
+ /**
+ * Fills posting source params structure.
+ */
+ void GetPostingSourceParams(
+ CPostingSurface::TPostingSourceParams& aParams ) const;
+
+ /**
+ * Fills posting params structure.
+ */
+ void GetPostingParams(
+ CPostingSurface::TPostingParams& aParams ) const;
+
+ /**
+ * Returns ETrue if given format is supported, EFalse otherwise.
+ */
+ TBool SupportsFormat(
+ const CPostingSurface::TPostingFormat& aFormat ) const;
+
+ /**
+ * Returns ETrue if given size is supported, EFalse otherwise.
+ */
+ TBool SupportsSize( const TSize& aSize ) const;
+
+ /**
+ * Returns ETrue if given rotation is supported,
+ * EFalse otherwise.
+ */
+ TBool SupportsRotation(
+ CPostingSurface::TRotationType aRotation ) const;
+
+ /**
+ * Returns ETrue if mirroring is supported, EFalse otherwise.
+ */
+ TBool SupportsMirroring() const;
+
+ /**
+ * Returns ETrue if scaling is supported, EFalse otherwise.
+ */
+ TBool SupportsScaling() const;
+
+ /**
+ * Returns ETrue if brightness controlling is supported,
+ * EFalse otherwise.
+ */
+ TBool SupportsBrightness() const;
+
+ /**
+ * Returns ETrue if contrast controlling is supported,
+ * EFalse otherwise.
+ */
+ TBool SupportsContrast() const;
+
+ /**
+ * Returns buffer size in bytes for given size and current posting
+ * format.
+ */
+ TInt GetFrameBufferSize( const TSize& aTo ) const;
+
+ /**
+ * Recreates clipregion. May leave with KErrNoMemory.
+ */
+ void RecalculateClipRegionL();
+
+ /**
+ * Fixes rect for DP.
+ */
+ void FixRectForDP( TRect& aRect ) const;
+
+ /**
+ * Fills sink parameters.
+ */
+ void GetSinkParams( TDisplaySinkParamsDP& aSinkParams );
+
+ /**
+ * Returns reference to sink.
+ */
+ MDisplaySink& DisplaySink();
+
+ /**
+ * Stores given frame buffer.
+ */
+ void StoreFrameBuffer( CPostingSurface::TPostingBuff* aPostingBuffer );
+
+ /**
+ * Creates frame buffer.
+ */
+ void CreateFrameBufferL( const TSize& aSize );
+
+ /**
+ * Async draw callback.
+ */
+ static TInt CallBack( TAny* aPtr );
+
+ /**
+ * Sets given buffer available to display sink.
+ */
+ void SetAvailableToSink( CPostingSurface::TPostingBuff* aBuffer );
+
+ /**
+ * Creates instance of posting surface.
+ */
+ CPostingSurface* CreatePostingSurfaceL();
+
+ /**
+ * Close the DP API library and free the allocated instance.
+ */
+ void CloseDPLibrary();
+
+ /**
+ * Loads DP API library.
+ */
+ void LoadDPLibraryL();
+
+ /**
+ * Converts YUV420 image to bitmap.
+ */
+ void Convert420ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget );
+
+ /**
+ * Converts YUV422 image to bitmap.
+ */
+ void Convert422ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget );
+
+ /**
+ * Updates Vt frame to frame observer.
+ */
+ void UpdateVtFrame();
+
+ public: // From MVtImageScalerObserver.
+
+ /**
+ * @ see MVtImageScalerObserver.
+ */
+ virtual void ScalingFinished( TInt aError );
+
+
+ private: // from CActive
+
+ /**
+ * Handles prepared bitmap from display sink.
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ private: // from MVtEngBufferWaiterObserver
+
+ /**
+ * @see MVtEngBufferWaiterObserver::BufferReady
+ */
+ void BufferReady( CPostingSurface::TPostingBuff* aBuffer );
+
+ /**
+ * @see MVtEngBufferWaiterObserver::FetchError
+ */
+ void FetchError( TInt aError );
+
+ private: // inner classes
+
+ // Buffer class for storing buffer.
+ NONSHARABLE_CLASS( TVtEngBuffer )
+ {
+ public:
+
+ /**
+ * C++ constructor
+ */
+ TVtEngBuffer();
+
+ /**
+ * Sets buffer
+ */
+ void Set( CPostingSurface::TPostingBuff* aBuffer );
+
+ /**
+ * Unsets buffer
+ */
+ void UnSet();
+
+ /**
+ * Returns ETrue if buffer is set
+ */
+ TBool IsSet() const;
+
+ /**
+ * Returns pointer reference to stored buffer.
+ */
+ CPostingSurface::TPostingBuff*& Buffer();
+
+ private:
+
+ // Pointer's pointer to buffer
+ CPostingSurface::TPostingBuff* iBuffer;
+ };
+
+ // Waiter class for asynchronous events.
+ NONSHARABLE_CLASS( CVtEngBufferWaiter ) : public CActive
+ {
+ public:
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngBufferWaiter( CPostingSurface& aPostingSurface,
+ MVtEngBufferWaiterObserver& aObserver );
+
+ /**
+ * Destructor, frees all resources allocated by this instance.
+ */
+ ~CVtEngBufferWaiter();
+
+ /**
+ * Fetch new buffer (also activates listening).
+ */
+ TInt FetchBuffer();
+
+ private: // new methods
+
+ /**
+ * Activate buffer listening (also calls CActive::SetActive()).
+ */
+ void Activate();
+
+ private: // from CActive
+
+ /**
+ * @see CActive::RunL()
+ */
+ void RunL();
+
+ /**
+ * @see CActive::DoCancel()
+ */
+ void DoCancel();
+
+ private: // data
+
+ // Posting surface instance (not owned)
+ CPostingSurface* iPostingSurface;
+
+ // BufferWaiter observer who gets informed about buffers
+ MVtEngBufferWaiterObserver* iObserver;
+ };
+
+ private: // data
+
+ // Posting surface instance
+ CPostingSurface* iPostingSurface;
+
+ // Posting capabilities
+ CPostingSurface::TPostingCapab iPostingCaps;
+
+ // Posting buffers
+ TVtEngBuffer
+ iBuffers[ MDisplaySink::EFirstBitmap + KVtEngMaxBuffers ];
+
+ // Buffer waiter instance
+ CVtEngBufferWaiter* iBufferWaiter;
+
+ // Rendering configuration
+ TVtEngRenderConfigDP iConfig;
+
+ // Clipping region
+ RRegion iClipRegion;
+
+ // Frame buffer
+ HBufC8* iFrameBuffer;
+
+ // Selected posting format
+ CPostingSurface::TPostingFormat iPostingFormat;
+
+ // DP API DLL
+ RLibrary* iDPLib;
+
+ // Source image contains converted YUV frame
+ CVtImageBitmap* iSource;
+
+ // Target image contains scaled bitmap
+ CVtImageBitmap* iTarget;
+
+ // Image scaler instance
+ CVtImageScaler* iImageScaler;
+
+ // Clip region updated
+ TBool iClipRegionUpdated;
+
+ };
+
+#endif // CVTENGDRAWDP_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawDSA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2004-2006 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: Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGDRAWDSA_H
+#define CVTENGDRAWDSA_H
+
+// INCLUDES
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigDSA.h"
+
+// FORWARDS
+
+class TDisplaySinkParamsDSA;
+
+/**
+* Direct Screen Access drawer
+*
+* @lib videoteleng.lib
+* @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CVtEngDrawDSA ) : public CVtEngRemoteVideo::CVtEngDraw,
+ public MVtEngScalerObserver
+ {
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver call back interface to Display Sink
+ * @return instance of CVtEngDrawDSA
+ */
+ static CVtEngDrawDSA* NewL( MDisplaySinkObserver* aObserver );
+
+ // Destructor
+ ~CVtEngDrawDSA();
+
+ private: // construction
+
+ /**
+ * C++ constructor as private.
+ * @param aObserver callback interface for Display Sink
+ */
+ CVtEngDrawDSA( MDisplaySinkObserver* aObserver );
+
+ private: // from CVtEngDraw
+
+ /**
+ * @see CVtEngDraw::BaseConstructL
+ */
+ void BaseConstructL();
+
+ /**
+ * @see CVtEngDraw::CreateSinkL
+ */
+ MDisplaySink* CreateSinkL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshL
+ */
+ void BaseRefreshL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshBitmapsL
+ */
+ void BaseRefreshBitmapsL();
+
+ /**
+ * @see CVtEngDraw::BaseDoCancel
+ */
+ void BaseDoCancel();
+
+ /**
+ * @see CVtEngDraw::BaseVerifyConfigL
+ */
+ void BaseVerifyConfigL();
+
+ /**
+ * @see CVtEngDraw::BaseRestartL
+ */
+ void BaseRestartL();
+
+ /**
+ * @see CVtEngDraw::BaseAbortNow
+ */
+ void BaseAbortNow();
+
+ /**
+ * @see CVtEngDraw::BaseStartDrawL
+ */
+ void BaseStartDrawL();
+
+ /**
+ * @see CVtEngDraw::BaseStopDraw
+ */
+ void BaseStopDraw();
+
+ /**
+ * @see CVtEngDraw::BaseSetConfigL
+ */
+ void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+ /**
+ * @see CVtEngDraw::BaseSetUIForegroundL
+ */
+ void BaseSetUIForegroundL( TBool aForeground );
+
+ /**
+ * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& );
+
+ /**
+ * @see CVtEngDraw::BaseRequestLastFrame
+ */
+ void BaseRequestLastFrame();
+
+ /**
+ * @see CVtEngDraw::Config
+ */
+ TVtEngRenderConfig& Config();
+
+ private: // from CActive
+
+ /**
+ * Handles prepared bitmap from display sink.
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ public: // from MVtEngScalerObserver
+
+ /**
+ * From MVtEngScalerObserver, this method is called when
+ * scaling is finished.
+ * @see MVtEngScalerObserver::ScalingCompleted
+ */
+ virtual void ScalingCompleted(
+ CFbsBitmap* aBitmap, TInt aError );
+
+ private: // New functions
+
+ /**
+ * Does the drawing.
+ * @param aBitmap a bitmap to draw
+ */
+ void DrawBitmap( CFbsBitmap& aBitmap );
+
+ /**
+ * Fills TDisplaySinkParamsDSA struct
+ */
+ void GetSinkParams( TDisplaySinkParamsDSA& aSinkParams );
+
+ private: // data
+
+ // Bitmapts for remote video (double buffering).
+ CFbsBitmap* iBitmap1;
+ CFbsBitmap* iBitmap2;
+
+ // Bitmap indexes indicating which.
+ // bitmap was provided.
+ MDisplaySink::TBitmapNo iBitmapNo;
+
+ // If a bitmap has been set available.
+ TBool iBitmapSetAvail;
+
+ // VT image scaler
+ MVtEngImageScaler* iImageScaler;
+
+ // DSA configuration
+ TVtEngRenderConfigDSA iConfig;
+ };
+
+#endif // CVTENGDRAWDSA_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawNGA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2004-2006 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: Class for NGA Drawer.
+*
+*/
+
+
+#ifndef CVTENGDRAWNGA_H
+#define CVTENGDRAWNGA_H
+
+// INCLUDES
+//#include <videorenderer.h>
+#include <Posting_Surface.h>
+#include <Posting_Surface_Factory.h>
+#include <pixelformats.h>
+//#include <videoframebuffer.h>
+// GCE Surface
+#include "graphics/surfacemanager.h"
+#include "graphics/surface.h"
+#include "graphics/surfaceupdateclient.h"
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigNGA.h"
+
+// FORWARDS
+
+class TDisplaySinkParamsNGA;
+
+// CONSTANTS AND MACROS
+const TInt KVtEngMaxSurfaceBuffers = 2;
+
+NONSHARABLE_CLASS( TVTSurfaceBuffer )
+ {
+ public:
+
+ /**
+ * C++ constructor
+ */
+ TVTSurfaceBuffer( TUint8* aBuffer = NULL, TInt aSurfaceNo = KErrNotFound );
+
+ /**
+ * Returns pointer reference to stored buffer.
+ */
+ TUint8* &Buffer();
+
+ /**
+ * Returns surface no..
+ */
+ TInt SurfaceNo();
+
+ void Set( TUint8* aBuffer, TInt aSurfaceNo );
+
+ void UnSet();
+
+ private:
+
+ // Pointer's pointer to buffer
+ TUint8* iBuffer;
+ TInt iSurfaceBufferNo;
+ };
+
+/**
+* Buffer waiter observer API
+*
+* @lib videoteleng.lib
+* @since Series 60 MCL
+*/
+NONSHARABLE_CLASS( MVtEngNGABufferWaiterObserver )
+ {
+ public: // New methods
+
+ /**
+ * Buffer fetched without errors.
+ * @param aBuffer Pointer to fetched buffer.
+ */
+ virtual void BufferReadyL(
+ TVTSurfaceBuffer* aBuffer ) = 0;
+
+ /**
+ * Buffer fetch error.
+ * @param aError Error code.
+ */
+ virtual void FetchError( TInt aError ) = 0;
+ };
+
+
+/**
+* DNGA drawer
+*
+* @lib videoteleng.lib
+* @since Series 60 MCL
+*/
+NONSHARABLE_CLASS( CVtEngDrawNGA ) :
+ public CVtEngRemoteVideo::CVtEngDraw,
+ public MVtEngNGABufferWaiterObserver
+ {
+
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver call back interface to Display Sink
+ * @return instance of CVtEngDrawDSA
+ */
+ static CVtEngDrawNGA* NewL( MDisplaySinkObserver* aObserver );
+
+ // Destructor
+ ~CVtEngDrawNGA();
+
+ private: // construction
+
+ /**
+ * C++ constructor as private.
+ * @param aObserver callback interface for Display Sink
+ */
+ CVtEngDrawNGA( MDisplaySinkObserver* aObserver );
+
+ private: // from CVtEngDraw
+
+ /**
+ * @see CVtEngDraw::BaseConstructL
+ */
+ void BaseConstructL();
+
+ /**
+ * @see CVtEngDraw::CreateSinkL
+ */
+ MDisplaySink* CreateSinkL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshL
+ */
+ void BaseRefreshL();
+
+ /**
+ * @see CVtEngDraw::BaseRefreshBitmapsL
+ */
+ void BaseRefreshBitmapsL();
+
+ /**
+ * @see CVtEngDraw::BaseDoCancel
+ */
+ void BaseDoCancel();
+
+ /**
+ * @see CVtEngDraw::BaseVerifyConfigL
+ */
+ void BaseVerifyConfigL();
+
+ /**
+ * @see CVtEngDraw::BaseRestartL
+ */
+ void BaseRestartL();
+
+ /**
+ * @see CVtEngDraw::BaseAbortNow
+ */
+ void BaseAbortNow();
+
+ /**
+ * @see CVtEngDraw::BaseStartDrawL
+ */
+ void BaseStartDrawL();
+
+ /**
+ * @see CVtEngDraw::BaseStopDraw
+ */
+ void BaseStopDraw();
+
+ /**
+ * @see CVtEngDraw::BaseSetConfigL
+ */
+ void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+ /**
+ * @see CVtEngDraw::BaseSetUIForegroundL
+ */
+ void BaseSetUIForegroundL( TBool aForeground );
+
+ /**
+ * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& );
+
+ /**
+ * @see CVtEngDraw::BaseRequestLastFrame
+ */
+ void BaseRequestLastFrame();
+
+ /**
+ * @see CVtEngDraw::Config
+ */
+ TVtEngRenderConfig& Config();
+
+ private: // New mothod
+
+ /**
+ * Returns reference to sink.
+ */
+ MDisplaySink& DisplaySink();
+
+ /**
+ * Base construct implementation
+ */
+ void DoBaseConstructL();
+
+ /**
+ * Base start drawing implementation
+ */
+ void DoBaseStartDrawL();
+
+ /**
+ * Sets given buffer available to display sink.
+ */
+ void SetAvailableToSink( TVTSurfaceBuffer* aBuffer );
+
+ /**
+ * Update sink params implementation.
+ */
+ void DoUpdateSinkParamsL();
+
+ /**
+ * Updates sink params.
+ */
+ void UpdateSinkParamsL();
+
+ /**
+ * Create surface
+ */
+ void CreateSurfaceL();
+
+ /**
+ * Create surface implementation
+ */
+ void DoCreateSurfaceL();
+
+ /**
+ *clearing a surface buffer to given colour
+ */
+ void ClearSurfacebuffer(
+ TUint8* aStartAddr,
+ TInt aOffset,
+ const RSurfaceManager::TSurfaceInfoV01 aInfo,
+ TRgb &aColor );
+
+ static TInt SurfaceBuffer0Ready(TAny* aAny);
+
+ static TInt SurfaceBuffer1Ready(TAny* aAny);
+
+ TBool DoSurfaceBuffer0Ready();
+
+ TBool DoSurfaceBuffer1Ready();
+
+ public: //from MVtEngNGABufferWaiterObserver
+
+ /**
+ * @see MVtEngNGABufferWaiterObserver::BufferReadyL
+ */
+ void BufferReadyL( TVTSurfaceBuffer* aBuffer );
+
+ /**
+ * @see MVtEngNGABufferWaiterObserver::FetchError
+ */
+ void FetchError( TInt aError );
+
+
+ private:
+ /**
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ private: // New functions
+ /**
+ * Fills TDisplaySinkParamsNGA struct
+ */
+ void GetSinkParams( TDisplaySinkParamsNGA& aSinkParams );
+
+ private: //inner class
+
+ // Buffer class for storing buffer.
+ NONSHARABLE_CLASS( TVtEngBuffer )
+ {
+ public:
+
+ /**
+ * C++ constructor
+ */
+ TVtEngBuffer();
+
+ /**
+ * Sets buffer
+ */
+ void Set( TVTSurfaceBuffer* aBuffer );
+
+ /**
+ * Unsets buffer
+ */
+ void UnSet();
+
+ /**
+ * Returns ETrue if buffer is set
+ */
+ TBool IsSet() const;
+
+ /**
+ * Returns pointer reference to stored buffer.
+ */
+ TVTSurfaceBuffer* &SurfaceBuffer();
+
+ /**
+ * Returns pointer reference to stored buffer.
+ */
+ TUint8* &Buffer();
+
+ private:
+
+ // Pointer's pointer to buffer
+ TUint8* iBuffer;
+ TVTSurfaceBuffer* iSurfaceBuffer;
+ };
+
+ // Waiter class for asynchronous events.
+ NONSHARABLE_CLASS( CVtEngBufferWaiter ) : public CActive
+ {
+ public:
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngBufferWaiter( //CVideoRenderer& aVideoRenderer,
+ MVtEngNGABufferWaiterObserver& aObserver );
+
+ /**
+ * Destructor, frees all resources allocated by this instance.
+ */
+ ~CVtEngBufferWaiter();
+
+ /**
+ * Fetch new buffer (also activates listening).
+ */
+ TInt FetchBuffer();
+
+ /**
+ * One SurfaceBuffer is available
+ */
+ void BufferAvailable(TVTSurfaceBuffer& aBuffer);
+
+ private: // new methods
+
+ /**
+ * Activate buffer listening (also calls CActive::SetActive()).
+ */
+ void Activate();
+
+ private: // from CActive
+
+ /**
+ * @see CActive::RunL()
+ */
+ void RunL();
+
+ /**
+ * @see CActive::DoCancel()
+ */
+ void DoCancel();
+
+ private: // data
+
+ // Video frame renderer (not owned)
+ //CVideoRenderer* iVideoRenderer;
+
+ // BufferWaiter observer who gets informed about buffers
+ MVtEngNGABufferWaiterObserver* iObserver;
+
+ //Avaiable surface buffers
+ TVTSurfaceBuffer* iBuffers[KVtEngMaxSurfaceBuffers];
+
+ };
+
+ // Surface Buffer Active Call back.
+ NONSHARABLE_CLASS( CActiveCallBack ) : public CActive
+ {
+ public:
+ CActiveCallBack( TCallBack aCallBack, TInt aPriority): CActive(aPriority), iCallBack(aCallBack)
+ {};
+ CActiveCallBack();
+
+ public: // Functions from base classes
+ void SetActive()
+ {
+ CActive::SetActive();
+ };
+ void RunL()
+ {
+ iCallBack.CallBack();
+ };
+ void DoCancel()
+ {};
+
+ private: // Data
+ TCallBack iCallBack;
+ };
+
+ private: // data
+
+ //Video frame renderer
+ //CVideoRenderer *iVideoRenderer;
+ RSurfaceManager* iSurfaceManager;
+ RSurfaceUpdateSession iSurfaceUpdateSession;
+ //Surface pixel format
+ TUidPixelFormat iSurfaceFormat;
+
+ RChunk* iSurfaceChunk;
+
+ TInt8* iChunkBuffer0;
+
+ TInt8* iChunkBuffer1;
+
+ TVTSurfaceBuffer iSurfaceBuffer0;
+
+ TVTSurfaceBuffer iSurfaceBuffer1;
+
+ //CActiveCallBack* iSurfaceBufferAo0;
+
+ //CActiveCallBack* iSurfaceBufferAo1;
+
+ CActiveCallBack* iCallBackTable[KVtEngMaxSurfaceBuffers];
+
+ //NGA surface id
+ TSurfaceId iSurfaceId;
+
+ //NGA surface has created
+ TBool iSurfaceCreated;
+
+ // Buffer waiter instance
+ CVtEngBufferWaiter* iBufferWaiter;
+
+ // Surface buffers
+ TVtEngBuffer
+ iSurfaceBuffers[ MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers ];
+
+ TSglQue<TVtEngBuffer> iWaitingBuffers; // buffers waiting to be submitted
+ TBool iSubmitPending;
+
+ // Configuration
+ TVtEngRenderConfigNGA iConfig;
+
+ // Time stamp for surface update
+ TTimeStamp iTimeStamp;
+ };
+
+#endif // CVTENGDRAWDSA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDtmfHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2006 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: DTMF handler
+*
+*/
+
+
+
+#ifndef CVTENGDTMFHANDLER_H
+#define CVTENGDTMFHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <mvtprotocolhandler.h>
+#include "CVtEngDtmfState.h"
+#include "CVtEngOperation.h"
+#include "MVtEngDtmfHandler.h"
+
+// FORWARD DECLARATIONS
+class MVTUserInput;
+
+// CLASS DECLARATION
+
+/**
+* Base class for data types
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfHandler ) : public CBase, public MVtEngDtmfHandler
+ {
+ public: // Data structures
+ enum TUIISupport
+ {
+ EBasicString = 2,
+ EIA5String = 4,
+ EGeneralString = 8,
+ EDTMFString = 16
+ };
+
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aH324Config H324 configure interface
+ * @return dtmf handler
+ */
+ static CVtEngDtmfHandler* NewL(
+ MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * Destructor
+ */
+ ~CVtEngDtmfHandler();
+
+ public: // from MVtEngDtmfHandler
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual void HandleL( CVtEngOperation& aOp );
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual CVtEngDtmfState& ActivateState(
+ MVtEngDtmfHandler::TVtEngDtmfState aNewState );
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual void SendComplete( TInt aError );
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual MVTUserInput& ReserveProtoDtmfL(
+ const TVtEngDtmfTone& aTone );
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual void ReleaseProtoDtmf();
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual TBool CheckCommandId( TInt aCheckCommandId ) const;
+
+ /**
+ * @see MVtEngDtmfHandler
+ */
+ virtual void StoreCommandId( TInt aStoreCommandId );
+
+
+ public: // Protocol DTMF Support
+
+ /**
+ * Specifies the UII support
+ * @param aValue the support to be used
+ */
+ void SetUIISupport( TUIISupport aValue );
+
+ /**
+ * Gets the current UII support
+ * @return UII support
+ */
+ TUIISupport GetUIISupport() const;
+
+ private: // constructors
+
+ /**
+ * C++ constructor
+ */
+ CVtEngDtmfHandler( MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+ private: // new functions
+
+ /**
+ * Handles completion of DTMF sending, leavable method.
+ */
+ void HandleSendCompleteL( TInt aError );
+
+ /**
+ * Creates a state instance
+ * @param EVtDtmfStateIdle, EVtDtmfStateSending or EVtDtmfStateBuffered
+ */
+ void CreateStateL( TInt aState );
+
+ private: // member data
+
+ // DTMF states
+ CArrayPtrFlat<CVtEngDtmfState>* iDtmfStates;
+
+ // current state index
+ TVtEngDtmfState iCurrentState;
+
+ // protocol tone
+ MVTUserInput* iProtoDtmf;
+
+ // H324 interface
+ MVtH324ConfigCommand& iH324Config;
+
+ // Indicates supported UII type:
+ // 16 DTMF
+ // 8 General String
+ // 4 IA5 String
+ // 2 Basic string
+ TUIISupport iUIISupport;
+
+ // DTMF command ID returned by H324 interface for last tone
+ TInt iIssuedDtmfCommandId;
+ };
+
+
+#endif CVTENGDTMFHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngImageScaler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2004-2006 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: Scaler for bitmaps.
+*
+*/
+
+
+
+#ifndef CVTENGIMAGESCALER_H
+#define CVTENGIMAGESCALER_H
+
+// INCLUDES
+#include "MVtEngImageScaler.h"
+#include <cvtimagescaler.h>
+
+// FORWARD DECLARATIONS
+class MVtEngScalerObserver;
+class CVtImageScaler;
+class CVtImageBitmap;
+
+/**
+* Image scaler implementation class.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.8
+*/
+NONSHARABLE_CLASS( CVtEngImageScaler ) : public CBase,
+ public MVtImageScalerObserver,
+ public MVtEngImageScaler
+ {
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver scaling finished callback.
+ * @return scaler
+ */
+ static MVtEngImageScaler* NewL(
+ MVtEngScalerObserver& aObserver );
+
+ /**
+ * Destructor
+ */
+ virtual ~CVtEngImageScaler();
+
+ private: // constructor
+
+ /**
+ * C++ constructor.
+ * @param aObserver scaling finished callback.
+ */
+ CVtEngImageScaler(
+ MVtEngScalerObserver& aObserver );
+
+
+ /**
+ * Symbian constructor that may leave.
+ */
+ void ConstructL();
+
+ public: // From MVtEngImageScaler.
+
+ /**
+ * @see MVtEngImageScaler.
+ */
+ virtual void ScaleL(
+ TInt aSourceIndex );
+
+ /**
+ * @see MVtEngImageScaler
+ */
+ virtual TBool ConfigureL(
+ TDisplayMode aDisplayMode,
+ TSize aSize,
+ TInt aSourceHandle1,
+ TInt aSourceHandle2 );
+
+ /**
+ * @see MVtEngImageScaler.
+ */
+ virtual void Release();
+
+ /**
+ * @see MVtEngImageScaler.
+ */
+ virtual TInt Cancel();
+
+ public: // From MVtImageScalerObserver.
+
+ /**
+ * @ see MVtImageScalerObserver.
+ */
+ virtual void ScalingFinished( TInt aError );
+
+ private:
+ /**
+ * EFirstBitmap
+ * Use the first bitmap.
+ * ESecondBitmap
+ * Use the second bitmap.
+ */
+ enum
+ {
+ EFirstBitmap = 0,
+ ESecondBitmap = 1
+ };
+
+ /**
+ * Fetches the used scaling method from locally.
+ * variated properties, and stores it into iScalingMethod.
+ */
+ void GetScalingMethodL();
+
+ private:
+
+ // Observer receiving scaled bitmaps.
+ MVtEngScalerObserver& iObserver;
+
+ // Actual component doing the scaling.
+ CVtImageScaler* iVtScaler;
+
+ // Target bitmaps.
+ RPointerArray<CVtImageBitmap> iTargets;
+
+ // Source bitmaps.
+ RPointerArray<CVtImageBitmap> iSources;
+
+ // Bitmap index in targets.
+ TInt iTargetBitmapInUse;
+
+ // Display mode.
+ TDisplayMode iMode;
+
+ // Scaled size.
+ TSize iSize;
+
+ // Method of scaling
+ CVtImageScaler::TQuality iScalingMethod;
+ };
+
+#endif // CVTENGIMAGESCALER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngLocalVideo.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1575 @@
+/*
+* Copyright (c) 2004-2007 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: Local video handler.
+*
+*/
+
+
+#ifndef CVTENGLOCALVIDEO_H
+#define CVTENGLOCALVIDEO_H
+
+// INCLUDES
+#include <e32base.h>
+#include <capivideosource.h>
+#include "TVtEngRendering.h"
+#include "TVtEngRenderingDSA.h"
+#include "TVtEngRenderingDP.h"
+#include "TVtEngRenderingNGA.h"
+#include "VtEngEvents.h"
+#include "MVtEngMedia.h" //TMediaSource
+#include "MVtEngSettingPSObserver.h"
+#include "CVTEngPubSubsListener.h"
+#include "mvtengcamerapreferencesobserver.h"
+
+#include "graphics/surfacemanager.h"
+#include "graphics/surface.h"
+#include "graphics/surfaceupdateclient.h"
+
+// FORWARD DECLARATIONS
+class CVSDataProvider;
+class CVtEngMediaHandler;
+class CVtEngCameraPreferences;
+
+
+// LOCAL CONSTANTS
+// Default source width.
+static const TInt KVtEngLocalVideoDefaultWidth = 176;
+
+// Default source height.
+static const TInt KVtEngLocalVideoDefaultHeight = 144;
+
+// CLASS DECLARATION
+
+/**
+* Local (uplink) video handling.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngLocalVideo ) :
+ public CActive,
+ public MVSDataProviderObserver,
+ public MVSDataSourceObserver,
+ public MVSControllerObserver,
+ public MVtEngSettingPSObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian two-phase constructor.
+ * @param aObserver callback interface to Media Handler
+ * @return local video instance
+ */
+ static CVtEngLocalVideo* NewL(
+ CVtEngMediaHandler& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngLocalVideo();
+
+ public: // Public data structures
+ enum TVtEngProviderType
+ {
+ KVtEngProviderUndefined = -1,
+ /** Blank imnage provider */
+ KVtEngProviderNone = 0,
+ /** Primary camera provider */
+ KVtEngProviderCam1,
+ /** Secondary camera provider */
+ KVtEngProviderCam2,
+ /** GS image provider */
+ KVtEngProviderImage,
+ /** ? */
+ KVtEngProviderTempImage,
+ /** Still share provider */
+ KVtEngProviderShareImage,
+ /** Video share provider */
+ KVtEngProviderShareVideoClip,
+ /** Default image provider */
+ KVtEngProviderDefaultStillImage
+ };
+
+ public: // from MVSDataProviderObserver
+
+ /**
+ * @see MVSDataProviderObserver::vsProviderError
+ */
+ virtual void vsProviderError( TInt aError );
+
+ /**
+ * @see MVSDataProviderObserver::vsProviderReady
+ */
+ virtual void vsProviderReady();
+
+ /**
+ * @see MVSDataProviderObserver::vsViewFinderFrameReady
+ */
+ virtual void vsViewFinderFrameReady( CFbsBitmap& aFrame );
+
+ public: // from MVSDataSourceObserver
+
+ /**
+ * @see MVSDataSourceObserver::vsProviderSwitchDone
+ */
+ virtual void vsProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+ public: // from MVSControllerObserver
+
+ /**
+ * @see MVSControllerObserver::vsProvidersChanged
+ */
+ void vsProvidersChanged( TBool aAttached );
+
+ public: // From MVtEngSettingPSObserver.
+
+ /** @see MVtEngSettingPSObserver */
+ virtual void HandleNotifyPSL( const TUid aUid,
+ const TInt& aKey, const TRequestStatus& aStatus );
+
+ public: // New functions
+
+ /**
+ * Pauses frame sending from video source (this method is called when
+ * VT is initializing and video source has not yet been added to stack)
+ *
+ */
+ void PauseVideoSending();
+
+ /**
+ * Resumes frame sending from video source.
+ *
+ */
+ void ResumeVideoSending();
+
+ /**
+ * Tells if the provider has started viewfinder.
+ * @return ETrue if started
+ */
+ TBool ViewFinderStarted() const;
+
+ /**
+ * Tells if the provider has been frozen.
+ * @return ETrue if frozen
+ */
+ TBool IsFrozen() const;
+
+ /**
+ * Creates an audio source.
+ * @return an error code
+ */
+ TInt CreateAudioSource();
+
+ /**
+ * Sets configuration for view finder.
+ * @param aParams view finder configuration
+ */
+ void SetViewFinderParameters( const TVtEngRenderingOptions& aParams );
+
+ /**
+ * Sets DSA configuration for view finder.
+ * @param aDSA DSA configuration
+ */
+ void SetViewFinderParameters( const TVtEngRenderingOptionsDSA& aDSA );
+
+ /**
+ * Sets DP configuration for view finder.
+ * @param aDP DP configuration
+ */
+ void SetViewFinderParameters( const TVtEngRenderingOptionsDP& aDP );
+
+
+ /**
+ * Sets NGA configuration for view finder.
+ * @param aNGA NGA configuration
+ */
+ void SetViewFinderParameters( const TVtEngRenderingOptionsNGA &aNGA );
+
+ /**
+ * Sets default still image.
+ */
+ void SetDefaultStillImageL();
+
+ /**
+ * Sets still image or none.
+ * @param aSetAsActive sets as active provider
+ */
+ void SetStillImageL( TBool aSetAsActive );
+
+ /**
+ * Initializes default blank provider.
+ */
+ void InitializeL();
+
+ /**
+ * Selects camera1, camera2, still image or none as source.
+ * @param aSource video source
+ * @return ETrue if selecting started
+ */
+ TBool SelectSourceL( TVtEngProviderType aSource );
+
+ /**
+ * Returns currently active video provider.
+ * @return provider type
+ */
+ TVtEngProviderType ActiveProvider( ) const;
+
+ /**
+ * Starts view finder if it was started earlier and current state is
+ * ELocReady.
+ */
+ void StartViewFinderIfWasStartedL();
+
+ /**
+ * Starts view finder. Uses either DSA or WS depending on
+ * which configuration is active.
+ * @param aClientRequest request issued by user
+ */
+ void StartViewFinderL( TBool aClientRequest = EFalse );
+
+ /**
+ * Stops view finder.
+ * @param aClientRequest request issued by user
+ */
+ void StopViewFinder( TBool aClientRequest = EFalse );
+
+ /**
+ * Freeze video sending (i.e. start sending last frame only).
+ */
+ void FreezeL();
+
+ /**
+ * Unfreeze video sending (i.e. resume sending).
+ */
+ void UnfreezeL();
+
+ /**
+ * Checks that all other providers don't have
+ * view finder active and stops if found.
+ * @param aProvider provider that should not be stopped
+ */
+ void CheckOthersStopped( const CVSDataProvider& aProvider );
+
+ /**
+ * Returns video source.
+ * @return video source
+ */
+ MVTVideoSource* Source() const;
+
+ /**
+ * Returns audio source.
+ * @return audio source
+ */
+ MVTAudioSource* AudioSource() const;
+
+ /**
+ * Gets media state.
+ * @param aActiveMedia returns active TMediaType
+ * @return Symbian OS error code
+ */
+ TInt GetMediaState( TInt& aActiveMedia );
+
+ /**
+ * Gets source type.
+ * @return media source type
+ */
+ MVtEngMedia::TMediaSource GetMediaSource();
+
+ /**
+ * Gets source capabilities.
+ * @param aCaps capability of providers
+ * @return Symbian OS error code
+ */
+ TInt GetSourceCaps( TInt& aCaps );
+
+ /**
+ * Sets boolean to indicate if the provider is to be initialized only.
+ * Selected camera is not necessary activated. If current media is
+ * other than camera, initialization can be done on the background.
+ * @param aInitOnly boolean value stating if to initialize only
+ */
+ void InitializeOnly( TBool aInitOnly = ETrue );
+
+ /**
+ * Sets boolean to indicate if the provider is to be initialized only.
+ * @param aInitOnly boolean value stating if to initialize only
+ */
+ void InitializeOnlyEx( TBool aInitOnly = ETrue );
+
+ /**
+ * Indicates if camera provider is initialized.
+ * @param aId provider ID
+ * @param aInitialized
+ * @return Symbian OS error code
+ */
+ TInt IsInitialized( MVtEngMedia::TCameraId aId, TBool& aInitialized );
+
+ /**
+ * Gets camera info.
+ * @param TCameraId camera ID
+ * @param aInfo camera info
+ * @return Symbian OS error code
+ */
+ TInt GetCameraInfo( MVtEngMedia::TCameraId aId,
+ MVtEngMedia::TCameraInfo& aInfo );
+
+ /**
+ * Gets current digital zoom step (Factor in VS camera terminology).
+ * @param aCurrentStep current zoom step
+ * @return Symbian OS error code
+ */
+ TInt GetDigitalZoomFactor( TInt& aCurrentStep );
+
+ /**
+ * Gets maximum digital zoom value that may be passed to camera.
+ * @param aMaxZoomStep maximum zoom step
+ * @return Symbian OS error code
+ */
+ TInt GetMaxDigitalZoomStep( TInt& aMaxZoomStep );
+
+ /**
+ * Gets number of major zoom level leaps.
+ * One to maximum digital zoom steps plus one.
+ * Less than or equal to maximum digital zoom steps plus one.
+ * @param aCount number of leaps
+ * @param aProviderSupplied use original or mapped
+ * @return Symbian OS error code
+ */
+ TInt GetMajorDigitalZoomStepCount( TInt& aCount,
+ TBool aProviderSupplied = EFalse );
+
+ /**
+ * Maps major zoom leap step to corresponding step index.
+ * @param aIndex major zoom step
+ * @param aStep zoom step
+ */
+ void GetMajorDigitalZoomStep( const TInt aIndex, TInt& aStep );
+
+ /**
+ * Sets video provider's digital zoom step.
+ * @param aDigitalZoomFactor step
+ */
+ void SetDigitalZoomFactorL( TInt aDigitalZoomFactor );
+
+ /**
+ * Gets video provider's freeze support.
+ * @param aFreezeSupported Freeze support status
+ * @return KErrNotReady if provider not initialized.
+ */
+ TInt GetFreezeSupported( TBool& aFreezeSupported ) const;
+
+ /**
+ * Returns ETrue if it is ok to freeze provider.
+ */
+ TBool OkToFreeze() const;
+
+ /**
+ * Returns ETrue if it is ok to unfreeze provider.
+ */
+ TBool OkToUnfreeze() const;
+
+ /**
+ * Sets audio as muted.
+ */
+ void Mute();
+
+ /**
+ * Resumes audio output.
+ */
+ void UnMute();
+
+ /**
+ * Sets UI foreground state (i.e. is the Application
+ * current active application or not).
+ * @param aForeground ETrue if the VT application is
+ * in foreground, EFalse otherwise.
+ */
+ void SetUIForeground( TBool aForeground );
+
+ /**
+ * Gets current media object sharing state. Only local video related
+ * checks do here. Connection issues have been checked by
+ * the caller.
+ * @param aObjectSharingState On return contains current media object
+ * sharing state. @see MVtEngMedia::TShareObjectState.
+ */
+ void GetObjectSharingState(
+ MVtEngMedia::TShareObjectState& aObjectSharingState ) const;
+
+ /**
+ * Start Image sharing initialization.
+ */
+ void InitializeShareImageL(
+ const MVtEngMedia::TShareObjectImageParameters& aParameters,
+ TBool& aFirstTime );
+
+ /**
+ * Cancel Image sharing initialization.
+ */
+ void CancelInitializeShareImage();
+
+ /**
+ * Start Image sharing.
+ */
+ void StartShareImageL();
+
+ /**
+ * Stop Image sharing.
+ */
+ void StopShareImageL();
+
+ /**
+ * Report error.
+ */
+ void ShareError( TInt aError );
+
+ /**
+ * Returns share's stored media source.
+ */
+ TVtEngProviderType ShareStoredSource() const;
+
+ /**
+ * General settings changed.
+ */
+ void SettingsChanged();
+
+ /**
+ * Creates camera preferences extension
+ * @since S60 v3.2
+ * @return pointer to extension
+ * @exeption Leaves if creation fails
+ */
+ CVtEngCameraPreferences* CreateCameraPreferencesL();
+
+ /**
+ * Called when prepare camera has been handled in media handler.
+ */
+ void SetIsPrepareCameraCalled( TBool aCalled );
+
+ /**
+ * Returns ETrue if prepare camera has been handled in media handler,
+ * EFalse otherwise.
+ */
+ TBool IsPrepareCameraCalled() const;
+
+ /**
+ * Reinitializes camera if onboard camera is being used as a provider.
+ */
+ void HandleLayoutChangeL();
+
+ /**
+ * Returns ETrue if delayed select is pending.
+ */
+ TBool IsDelayedSelectPending() const;
+
+ /**
+ * Completes operation to mediahandler.
+ */
+ void CompleteOperation( const TInt aResult );
+
+ /**
+ * Called when video channel is opened.
+ */
+ void VideoChannelOpenedL();
+
+ private: // constructors
+
+ /**
+ * C++ constructor.
+ * @param aObserver callback interface to Media Handler
+ */
+ CVtEngLocalVideo(
+ CVtEngMediaHandler& aObserver );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ /**
+ * Async callback method
+ */
+ static TInt CallBackFunc( TAny* aPtr );
+
+ /**
+ * Returns result.
+ */
+ TInt Result() const;
+
+ /**
+ * Sets result.
+ */
+ void SetResult( const TInt aResult );
+
+ private: // Rendering configuration
+
+ /**
+ * Options for window server rendering.
+ * iObserver callback interface
+ * iSize VF image size
+ */
+ struct TOptions
+ {
+ MVtEngFrameObserver* iObserver;
+ TSize iSize;
+ };
+
+ /**
+ * Direct screen access options.
+ * iWsSession windor server session
+ * iWsSD screen device
+ * iWindow handle to server based window
+ * iRect iRect window size
+ * iClipRect drawing size
+ */
+ struct TDsaOptions
+ {
+ RWsSession* iWs;
+ CWsScreenDevice* iWsSD;
+ RWindowBase* iWindow;
+ TRect iRect;
+ TRect iClipRect;
+ };
+
+ /**
+ * Internal state of a video provider.
+ */
+ enum TProviderState
+ {
+ /** initial state */
+ EUndefined = KErrNone,
+ /** never deleted */
+ EPermanent,
+ /** to be deleted when another provider selected */
+ EFading,
+ /** waiting for blank provider switch */
+ EWaiting,
+ /** changing still image */
+ ERefreshing
+ };
+
+ private: // inner classes
+
+ /**
+ * Provider information.
+ */
+ NONSHARABLE_CLASS( TProviderItem ) :
+ public MVtEngCameraPreferencesObserver
+ {
+ public:
+
+ /**
+ * C++ constructor
+ */
+ TProviderItem();
+
+ /**
+ * Destructor
+ */
+ ~TProviderItem();
+
+ /**
+ * Sets zoom factor to resetted state.
+ */
+ void ResetStoredValues();
+
+ /**
+ * Tries to restore preferences.
+ */
+ TInt RestoreZoomFactor();
+
+ /**
+ * Tries to restore preferences.
+ */
+ TInt RestorePreferences();
+
+ public:
+ // pointer to provider
+ CVSDataProvider* iProvider;
+
+ // provider type
+ TVtEngProviderType iType;
+
+ // provider initialized
+ TBool iInitialized;
+
+ // provider has errors
+ TInt iErrorCode;
+
+ // state of a provider
+ TProviderState iProviderState;
+
+ // Stored zoom value
+ TInt iStoredZoomFactor;
+
+ // Error code setting zoom factor
+ TInt iZFErr;
+
+ public: // MVtEngCameraPreferencesObserver
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::Attach
+ */
+ void Attach( MVtEngCameraPreferences& aCamPrefs );
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::ColorToneUpdated
+ */
+ void ColorToneUpdated(
+ MVtEngCameraPreferences::TColorTone aColorTone );
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::WhiteBalanceUpdated
+ */
+ void WhiteBalanceUpdated(
+ MVtEngCameraPreferences::TWhiteBalance aWhiteBalance );
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::BrightnessUpdated
+ */
+ void BrightnessUpdated( TInt aBrightness );
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::ContrastUpdated
+ */
+ void ContrastUpdated( TInt aContrast );
+
+ /**
+ * @see MVtEngCameraPreferencesObserver::Detach
+ */
+ void Detach( MVtEngCameraPreferences& aCamPrefs );
+
+ public:
+
+ /**
+ * Detach from preference and reset pointer.
+ */
+ void DetachFromCameraPreferences();
+
+ private:
+
+ // Pointer to camera preferences object this provider item is
+ // attached to
+ MVtEngCameraPreferences* iCamPrefs;
+
+ // Stored color tone value
+ MVtEngCameraPreferences::TColorTone iColorTone;
+
+ // Error code reading color tone value
+ TInt iCtErr;
+
+ // Stored white balance
+ MVtEngCameraPreferences::TWhiteBalance iWhiteBalance;
+
+ // Error code reading white balance value
+ TInt iWbErr;
+
+ // Stored brightness
+ TInt iBrightness;
+
+ // Error code reading brightness value
+ TInt iBrErr;
+
+ // Stored contrast
+ TInt iContrast;
+
+ // Error code reading contrast value
+ TInt iCrErr;
+
+ // ETrue if Attach is called first time
+ TBool iFirstTime;
+
+ };
+
+ /**
+ * Inner class for hiding image sharing details.
+ */
+ NONSHARABLE_CLASS( CVtEngShareImage ) : public CBase
+ {
+ private: // enumerations
+
+ /**
+ * Media object sharing internal state.
+ */
+ enum TState
+ {
+ EStopped,
+ EInitializing,
+ ESharing
+ };
+
+ public: // New public methods
+
+ /**
+ * Constructor.
+ */
+ static CVtEngShareImage* NewL( CVtEngLocalVideo& aLocalVideo );
+
+ /**
+ * C++ destructor.
+ */
+ ~CVtEngShareImage();
+
+ /**
+ * Start initialization of image sharing.
+ * @param aParameters Image sharing parameters (from UI)
+ * @param aCurrent Currently active provider's type.
+ * @param aFirstTime After call ETrue if this call was first to
+ * share initialize, EFalse otherwise.
+ * @exception May leave with KErrNotReady already initializing. May
+ * also leave with system wide error code if something goes wrong
+ * during provider initialization.
+ */
+ void InitializeL(
+ const MVtEngMedia::TShareObjectImageParameters& aParameters,
+ TVtEngProviderType aCurrent,
+ TBool& aFirstTime );
+
+ /**
+ * Cancel sharing initialized image.
+ */
+ void CancelInitialize();
+
+ /**
+ * Start sharing initialized image.
+ * @exception May leave with KErrNotReady if not initialized. May
+ * also leave with system wide error code if something goes wrong
+ * during provider swap.
+ */
+ void ShareL();
+
+ /**
+ * Stop sharing image.
+ * @exception May leave with KErrNotReady if not sharing. May also
+ * leave with system wide error code if something goes wrong during
+ * provider swap.
+ */
+ void StopL();
+
+ /**
+ * An error happened during initialization, sharing or stopping.
+ * @param aError Error reason.
+ */
+ void Error( TInt aError );
+
+ /**
+ * Returns stored source from sharer.
+ * @return Stored source (source that was selected before share).
+ */
+ TVtEngProviderType StoredSource() const;
+
+ /**
+ * Get sharing state.
+ * @param aObjectSharingState On return contains current object
+ * sharing state.
+ */
+ void GetObjectSharingState(
+ MVtEngMedia::TShareObjectState& aObjectSharingState ) const;
+
+ /**
+ * Check whether share is being initialized or not.
+ * @return ETrue if share is being initialized EFalse otherwise.
+ */
+ TBool IsInitializingShare() const;
+
+ /**
+ * Called when General settings have been changed.
+ */
+ void SettingsChanged();
+
+ /**
+ * Called when vsProviderSwitchDone() is called to local video.
+ */
+ void ProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+ /**
+ * Called when camera change event is received from PS.
+ */
+ void NotifyCameraChanged( const TVtEngProviderType& aProviderType );
+
+ private: // New private methods
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngShareImage( CVtEngLocalVideo& aLocalVideo );
+
+ /**
+ * 2nd constructor, may leave.
+ */
+ void ConstructL();
+
+ /**
+ * Get image sharing parameters.
+ * @return Constant reference to image sharing parameters.
+ */
+ const MVtEngMedia::TShareObjectImageParameters& Parameters() const;
+
+ /**
+ * Get initialization state.
+ * @return ETrue if sharing is being initialized, EFalse otherwise.
+ */
+ TBool IsInitializing() const;
+
+ /**
+ * Set sharing state.
+ * @param aNewState New image sharing state.
+ */
+ void SetState( const TState aNewState );
+
+ /**
+ * Fetches next available provider item pointer.
+ * @return Pointer to next available provider item or NULL if none
+ * could be found.
+ */
+ TProviderItem* FetchProviderItem() const;
+
+ /**
+ * Creates provider.
+ */
+ void CreateProviderL( TProviderItem& aProviderItem );
+
+ /**
+ * Initializes provider.
+ */
+ void InitializeProviderL( TProviderItem& aProviderItem );
+
+ /**
+ * Deletes provider.
+ */
+ void DeleteProvider( TVtEngProviderType aProviderType );
+
+ /**
+ * Deletes all precreated providers.
+ */
+ void DeleteProviders();
+
+ private: // Data
+
+ // Pointer to local video instance
+ CVtEngLocalVideo* iLocalVideo;
+
+ // Current state
+ TState iState;
+
+ // Previous state
+ TState iPreviousState;
+
+ // Copy of image sharing parameters
+ MVtEngMedia::TShareObjectImageParameters iParameters;
+
+ // Type of provider that was active before image sharing
+ TVtEngProviderType iStoredType;
+
+ // Type of provider that was originally active before image sharing
+ // This is needed because iStoredType may change according to PS
+ // events.
+ TVtEngProviderType iOriginalStoredType;
+
+ // Currently active provider
+ TProviderItem* iActiveProvider;
+
+ // Currently initialized provider
+ TProviderItem* iInitializingProvider;
+
+ // Buffered items
+ RPointerArray< TProviderItem > iBuffered;
+
+ // General settings were changed while sharing
+ TBool iSettingsChanged;
+ };
+
+ /**
+ * Inner class for handling delayed provider switches (e.g. PS signalled
+ * camera changes)
+ */
+ NONSHARABLE_CLASS( TVtEngDelayedSelect )
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ TVtEngDelayedSelect();
+
+ /**
+ * Called when camera change event is received from PS.
+ */
+ void NotifyDelayedSelect( const TVtEngProviderType& aProviderType );
+
+ /**
+ * Returns ETrue if delayed select is pending, EFalse otherwise.
+ */
+ TBool IsDelayedSelectPending() const;
+
+ /**
+ * Returns delayed select target and resets stored value.
+ */
+ TVtEngProviderType DelayedSelectTarget();
+
+ private: // data
+
+ TVtEngProviderType iDelayedProviderType;
+ };
+
+ /**
+ * Inner class for handling layout change reinitialization.
+ */
+ NONSHARABLE_CLASS( TVtEngLayoutChangeHandler )
+ {
+
+ public:
+
+ /**
+ * Constructor
+ */
+ TVtEngLayoutChangeHandler( CVtEngLocalVideo& aLocalVideo );
+
+ /**
+ * Called when layout change has happened
+ */
+ void HandleLayoutChangeL();
+
+ /**
+ * Called when layout change needs to be cancelled
+ */
+ void CancelHandleLayoutChange();
+
+ /**
+ * Called when provider is unfrozen.
+ * @return ETrue if unfreeze was handled by the layout change handler,
+ * EFalse otherwise.
+ */
+ TBool UnfreezeL();
+
+ /**
+ * Called by the local video when provider error happens.
+ * @param aError Type of error
+ * @return ETrue If error was handled by the layout change handler
+ */
+ TBool ProviderError( TInt aError );
+
+ /**
+ * Called by the local video when provider is ready after initialization.
+ * @return ETrue If callback was handled by the layout change handler.
+ */
+ TBool ProviderReady();
+
+ /**
+ * Called by the local video when provider has been switched.
+ * @param CVSDataProvider Pointer of old provider instance.
+ * @return ETrue If callback was handled by the layout change handler.
+ */
+ TBool ProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+ private:
+
+ /**
+ * 2nd constructor
+ */
+ void ConstructL();
+
+ /**
+ * Does the layout change handling.
+ */
+ void DoHandleLayoutChangeL();
+
+ /**
+ * Call to CompleteL() that is trapped.
+ */
+ TInt Complete( const TInt aError );
+
+ /**
+ * Completes handling and resets state to EIdle.
+ */
+ void CompleteL( const TInt aError );
+
+ /**
+ * Completes asynchronous request.
+ */
+ void CompleteOperation( const TInt aError );
+
+ private: // data
+
+ // Pointer to local video instance
+ CVtEngLocalVideo* iLocalVideo;
+
+ /**
+ * Layout change handler internal state.
+ */
+ enum TState
+ {
+ /** Layout change handler is ready to be called */
+ EIdle,
+ /** Layout change handler has been called, but layout update is
+ pending */
+ ELayoutChangePending,
+ /** Layout change handler is switching blank provider */
+ ESwitchingBlank,
+ /** Layout change handler is initializing camera provider */
+ EInitializingCamera,
+ /** Layout change handler is switching camera provider */
+ ESwitchingCamera
+ };
+
+ // Handler's internal state
+ TState iState;
+
+ // Stored provider type
+ TVtEngProviderType iStored;
+
+ };
+
+ // class for NGA rendering viewfinder bitmap.
+ NONSHARABLE_CLASS( CVtEngVFBitmapNGARender ) : public CActive
+ {
+
+ public: // constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aObserver call back interface to Display Sink
+ * @return instance of CVtEngDrawDSA
+ */
+ static CVtEngVFBitmapNGARender * NewL();
+
+ // Destructor.
+ ~CVtEngVFBitmapNGARender();
+
+ public: // New mothod
+
+ // update the buffer for bitmap, also activate this AO
+ TInt UpdateBitmapL( CFbsBitmap& aFrame );
+
+ // Initialize surface and set it to the background
+ TInt AttachSurfaceL( RWsSession *aWs, RWindow *aWindow );
+
+ private: // constructors
+
+ // C++ constructor.
+ CVtEngVFBitmapNGARender();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ private: // From CActive.
+
+ /*
+ * @see CActive::RunL
+ */
+ virtual void RunL();
+
+ /**
+ * @see CActive::DoCancel()
+ */
+ virtual void DoCancel();
+
+ private: // enumerations
+
+ enum { EVtEngVFMaxBuffers = 1 };
+
+ private: // Data
+
+ RSurfaceManager iSurfaceManager;
+ RSurfaceUpdateSession iSurfaceUpdateSession;
+
+ //Surface pixel format
+ const TUidPixelFormat iSurfaceFormat;
+
+ RChunk* iSurfaceChunk;
+
+ TUint8* iBuffer;
+
+ //NGA surface id
+ TSurfaceId iSurfaceId;
+
+ RWsSession *iWs;
+ RWindow *iWindow;
+
+ //NGA surface has created
+ TBool iSurfaceCreated;
+
+ TTimeStamp iTimeStamp;
+
+ };
+
+ private:
+
+ /**
+ * Rendering method.
+ */
+ enum TRenderingMethod
+ {
+ // Unspecified
+ EUnspecified,
+ // Through window server
+ EWindowServer,
+ // Direct screen access
+ EDSA,
+ // Display posting
+ EDP
+ };
+
+ /**
+ * View finder state.
+ */
+ enum TViewFinderState
+ {
+ // View finder not active.
+ EVFNone,
+ // View finder started to reveive bitmaps.
+ EVFReceivingBitmaps,
+ // View finder started to render with DSA.
+ EVFRenderingDsa
+ };
+
+ /**
+ * Internal state.
+ */
+ enum TState
+ {
+ // Initial and state when error occurred.
+ ELocNone,
+ // Provider initialization ongoing.
+ ELocInitializing,
+ // Switch to another provider ongoing.
+ ELocSwichingProvider,
+ // Provider initialization or switch completed.
+ ELocReady
+ };
+
+ public:
+
+ /**
+ * Deletes provider.
+ * @param aItem provider to delete
+ */
+ void DeleteProvider( TProviderItem& aItem );
+
+ /**
+ * Deletes provider.
+ * @param aType type of provider to delete.
+ */
+ void DeleteProvider( TVtEngProviderType aType );
+
+ /**
+ * Resets local video after a video call.
+ */
+ void Reset();
+
+ private: // New functions
+
+ /**
+ * Sets current camera id.
+ */
+ void SetCurrentCameraId( MVtEngMedia::TCameraId aCamId );
+
+ /**
+ * Configures provider item for outwards camera in
+ * construction phase.
+ */
+ void ConfigureOutwardsCameraItem(
+ TProviderItem& aItem,
+ const TInt aCurrentIndex );
+
+ /**
+ * Calculater digital zoom steps.
+ * @param aProvider the used provider in counting
+ * @return amount of major zoom steps
+ */
+ TInt CalculateMajorDigitalZoomStepCount(
+ CVSDataProvider* aProvider );
+
+ /**
+ * Calculater digital zoom steps.
+ * @param aInfo provider info structure from which zoom steps will be
+ * calculated
+ * @return amount of major zoom steps
+ */
+ TInt CalculateMajorDigitalZoomStepCount(
+ const TVSDataProviderInfo& aInfo ) const;
+
+ /**
+ * Deletes audio source.
+ */
+ void DeleteAudioSource();
+
+ /**
+ * Gets a provider for a given type.
+ * @param aType type to search for
+ * @param aItem returned provider item
+ * @return index in provider array or KErrNotFound
+ */
+ TInt GetProviderByType(
+ TVtEngProviderType aType, TProviderItem& aItem );
+
+ /**
+ * Gets a provider for a given type.
+ * @param aType type to search for
+ * @param aItem returned provider item
+ * @return index in provider array or KErrNotFound
+ */
+ TInt GetProviderByType(
+ TVtEngProviderType aType, TProviderItem*& aItem );
+
+ /**
+ * Gets a provider for a given provider instance.
+ * @param aInstance Instance to search for
+ * @param aItem returned provider item
+ * @return index in provider array or KErrNotFound
+ */
+ TInt GetProviderByInstance(
+ const CVSDataProvider* aInstance,
+ TProviderItem*& aItem ) const;
+
+ /**
+ * Initializes provider.
+ * @param aProviderItem provider
+ */
+ void InitializeProviderL( TProviderItem& aProviderItem );
+
+ /**
+ * Initializes provider for sharing.
+ */
+ void InitializeShareProviderL( TProviderItem& aProviderItem,
+ const TDesC8& aParams );
+
+ /**
+ * Re-creates provider. First deletes old instance inside provider
+ * item structure and then creates a new instance, using given
+ * provider type.
+ * @param aProviderItem Provider to be recreated.
+ * @param aType Type of the new provider to be created.
+ */
+ void ReCreateProviderL(
+ TProviderItem& aProviderItem, const TVtEngProviderType aType );
+
+ /**
+ * Provider index by provider type.
+ * @param aType Type of provider
+ */
+ TInt ProviderIndex( TVtEngProviderType aType ) const;
+
+ /**
+ * Gets a provider index by state.
+ * @param aState state of returned provider
+ * @return Index of provider
+ */
+ TInt ProviderIndexByState( TProviderState aState ) const;
+
+ /**
+ * Gets a provider index by provider instance.
+ * @param aInstance instance of provider to be found
+ * @return Index of provider or KErrNotFound if given provider item
+ * is not found
+ */
+ TInt ProviderIndexByInstance( const CVSDataProvider* aInstance ) const;
+
+ /**
+ * Creates VideoSource provider by type.
+ * @param aType Engine provider type
+ * @return CVSDataProvider pointer
+ */
+ CVSDataProvider* CreateDataProviderL( TVtEngProviderType aType );
+
+ /**
+ * Maps camera orientation to provider type.
+ * @param aOrientation camera orientation
+ * @return provider type
+ */
+ static TVtEngProviderType
+ OrientationToType( TCameraInfo::TCameraOrientation aOrientation );
+
+ /**
+ * Maps camera ID to provider type.
+ * @param aId camera ID
+ * @return provider type
+ */
+ static TVtEngProviderType CameraIdToType( MVtEngMedia::TCameraId aId );
+
+ /**
+ * Creates blank still image provider.
+ * @param aIndex index of still image provider
+ */
+ void CreateBlankProviderL( const TInt aIndex );
+
+ /**
+ * Creates default still image provider.
+ * @param aIndex index of default still image provider
+ */
+ void CreateDefaultStillImageProviderL( const TInt aIndex );
+
+ /**
+ * Updates available camera providers.
+ * @return primary provider
+ */
+ TVtEngProviderType UpdateAvailableProvidersL();
+
+ /**
+ * Switches to active provider.
+ */
+ void SwitchProvider( TProviderItem* aProviderItem );
+
+ /**
+ * Overloaded SwitchProvider() that takes new provider as a parameter.
+ */
+ void SwitchProvider( TProviderItem& aProviderItem );
+
+ /**
+ * Uninitializes non-permanent provider.
+ */
+ void UninitializeProviderL();
+
+ /**
+ * Updates iState if view finder is active.
+ */
+ void UpdateState();
+
+ /**
+ * Checks if initialization or provider switch is pending.
+ * @return ETrue if either one is pending
+ */
+ TBool InitializingOrSwitching() const;
+
+ /**
+ * Resets provider info index variables.
+ */
+ void ResetIndices();
+
+ /**
+ * Sets active camera tracking.
+ * @param aProviderIndex current camera in use
+ * @return error code
+ */
+ TInt SetCameraTrackingL( TInt& aProviderIndex );
+
+ /**
+ * Maps pubsub provided camera id to internal indexes.
+ * @param aCameraId id to map
+ * @return internally mapped id
+ */
+ MVtEngMedia::TCameraId MapCameraInternally( TInt aCameraId );
+
+ /**
+ * Checks if desired camera is available.
+ * @param aType provider type to return
+ */
+ void CameraAvailable( CVtEngLocalVideo::TVtEngProviderType &aType );
+
+ /**
+ * checks if given provider type is already waiting for initialization
+ * or switch.
+ * @param aType Provider type.
+ * @return ETrue if given provider type is in waiting state, EFalse
+ * otherwise.
+ */
+ TBool IsProviderWaiting( TVtEngProviderType aType ) const;
+
+ /**
+ * Returns highest provider type which is available for selection.
+ * Priority is following:
+ * KVtEngProviderCam1 << highest
+ * KVtEngProviderCam2
+ * KVtEngProviderImage
+ * KVtEngProviderNone
+ * If eg. cam2 is designated as preferred, possible returns values are
+ * Cam2, Image and None.
+ *
+ * @param aType in/out argument. In => preferred provider which
+ * caller of the method wishes to select
+ * Out => highest available provider
+ * @return ETrue if preferred == highest i.e. aPreferred is intact
+ *
+ */
+ TBool GetHighestSelectableProvider( TVtEngProviderType& aPreferred ) const;
+
+ /**
+ * checks if given provider type is acitven
+ * @param aType Provider type.
+ * @return ETrue if given provider is already active, EFalse
+ * otherwise.
+ */
+ TBool IsActiveProvider( TVtEngProviderType aType ) const;
+
+
+ private: // From CActive.
+
+ /**
+ * Handles sync operations as async.
+ * @see CActive::RunL
+ */
+ virtual void RunL();
+
+ /**
+ * @see CActive::DoCancel()
+ */
+ virtual void DoCancel();
+
+ private:
+
+ // Local video flags
+ enum TVtEngLocalVideoFlags
+ {
+ // Camera 1 is available (inwards)
+ EFlagCamera1Available = 0x00000001,
+ // Camera 2 is available (outwards)
+ EFlagCamera2Available = 0x00000002,
+ // video call ongoing
+ EFlagInitialized = 0x00000004,
+ // view finder enabled from UI
+ EFlagVFEnabled = 0x00000008,
+ // Non-user orginated switch
+ EFlagAutomaticSwitchCallback = 0x00000010,
+ // Audio muted
+ EFlagAudioMuted = 0x00000020,
+ // Only initialize a provider (no switch when initialized)
+ EFlagInitializeOnly = 0x00000040,
+ // Signal observer when switch is complete
+ EFlagSignalSourceSelection = 0x00000080,
+ // Provider event received while switch ongoing.
+ // When this is set and switch completes it
+ // is checked if revert to previous is needed.
+ EFlagCheckRevertToPrevious = 0x00000100,
+ // Avoid calculating the step count by using flag.
+ EFlagZoomStepCountNeedsMapping = 0x00000200,
+ // VT application foreground state
+ EFlagUIForeground = 0x00000400,
+ // VT application background state ( notification purpose)
+ EFlagUIBackground = 0x00000800,
+ // Provider is frozen
+ EFlagFrozen = 0x00001000
+ };
+
+ /**
+ * Sets a flag on.
+ * @param aFlag flag to set
+ */
+ void SetFlag( const TInt aFlag );
+
+ /**
+ * Removes a flag.
+ * @param aFlag flag to remove
+ */
+ void ClearFlag( const TInt aFlag );
+
+ /**
+ * Checks if a flag has been set.
+ * @param aFlag flag to check
+ * @return ETsrue if set
+ */
+ TBool IsFlag( const TInt aFlag ) const;
+
+ private: // Data
+
+ // Options for window server rendering.
+ TOptions iOptions;
+
+ // Options for DSA rendering.
+ TDsaOptions iDsaOptions;
+
+ // Video source controller.
+ CVSController* iSourceController;
+
+ // Video source.
+ CVSDataSource* iSource;
+
+ // Audio source.
+ MVTAudioSource* iAudioSource;
+
+ // Video providers (cameras and still image).
+ CArrayFixFlat<TProviderItem>* iVideoProviders;
+
+ // Currently active provider.
+ TProviderItem* iActiveProvider;
+
+ // Provider item we're switching away from.
+ TProviderItem* iFadingProvider;
+
+ // Provider that is selected as next one and
+ // is initializing or switching.
+ TProviderItem* iSelectedProvider;
+
+ // DSA or window server.
+ TRenderingMethod iRenderingMethod;
+
+ // Local video status.
+ TState iState;
+
+ // View finder state.
+ TViewFinderState iViewFinderState;
+
+ // Callback interface to Media Handler.
+ CVtEngMediaHandler& iObserver;
+
+ // Still image file name.
+ TFileName iStillImage;
+
+ // Local video state flags.
+ TInt iFlags;
+
+ // Friend declaration provides extended access.
+ friend class TProviderItem;
+
+ // Member variables to use in referencing to
+ // provider information
+ TInt iProviderInfoIndexCam1;
+ TInt iProviderInfoIndexCam2;
+ TInt iProviderInfoIndexStill;
+
+ // Used for default camera notifications.
+ CVtEngPubSubsListener* iCameraListener;
+
+ // Camera received from pubsub.
+ MVtEngMedia::TCameraId iCurrentCamera;
+
+ // Contains logics for image sharing.
+ CVtEngShareImage* iShareImage;
+
+ // Pointer to camera preferences extension
+ CVtEngCameraPreferences* iCameraPref;
+
+ // Logics for delayed provider selection
+ TVtEngDelayedSelect iDelayedSelect;
+
+ // Active provider's info
+ TVSDataProviderInfo iProviderInfo;
+
+ // ETrue if prepare camera has been handled in media handler
+ TBool iPrepareCameraCalled;
+
+ // Layout change handler
+ TVtEngLayoutChangeHandler iLayoutChangeHandler;
+
+ // ASync callback
+ CAsyncCallBack* iAsyncCallBack;
+
+ // Result
+ TInt iResult;
+
+ // Pointer to provider item that is being initialized
+ TProviderItem* iInitializingProvider;
+
+ // Number of cameras in the device
+ TInt iNumSupportedCameras;
+
+ CVtEngVFBitmapNGARender *iNGARender;
+ RWindow *iWindow;
+ RWsSession *iWs;
+ };
+
+#endif // CVTENGLOCALVIDEO_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngMediaHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1299 @@
+/*
+* Copyright (c) 2004-2007 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: Video session interface.
+*
+*/
+
+
+
+#ifndef CVTENGMEDIAHANDLER_H
+#define CVTENGMEDIAHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mvtprotocolhandler.h>
+#include "MVtEngMedia.h"
+#include "vtengcommands.h"
+#include "CVtEngLocalVideo.h"
+#include "MVtEngSettingObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngLocalVideo;
+class CVtEngRemoteVideo;
+class MVtEngFrameObserver;
+class CVtEngOperation;
+class CVtEngExtensionBase;
+
+// CLASS DECLARATION
+
+/**
+* Media control.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngMediaHandler ) :
+ public CBase,
+ public MVtEngMedia,
+ public MVtEngSettingObserver,
+ public MVtProtocolHandler
+ {
+ public: // Constructor and destructor.
+
+ /**
+ * Symbian two-phase constructor.
+ * @return media handler instance
+ */
+ static CVtEngMediaHandler* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVtEngMediaHandler();
+
+ public: // From MVtEngMedia.
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetMediaState(
+ const TMediaDirection aMediaDirection,
+ TInt& aActiveMedia ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TBool RenderingStarted(
+ const TMediaDirection
+ aDirection ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetSource( TMediaSource& aSource ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetSourcesCaps( TInt& aCaps ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetCurrentCameraId( TCameraId& aId ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetCameraInfo(
+ const TCameraId aId,
+ TCameraInfo& aInfo ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetCurrentZoomStep( TInt& aCurrentStep );
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetMaxZoomStep( TInt& aMaxZoomStep );
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetMajorZoomStepCount( TInt& aCount );
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual void GetMajorZoomStep( TInt aIndex, TInt& aStep );
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetFreezeSupported( TBool& aFreezeSupported ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetFreezeState( TBool& aFrozen ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TInt GetDsaState(
+ const TMediaDirection aMediaDirection,
+ TBool& aActive ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual TBool VideoCallConnected () const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual void GetVideoQuality( TVideoQuality& aVideoQuality ) const;
+
+ /**
+ * @see MVtEngMedia
+ */
+ virtual void GetObjectSharingState(
+ TShareObjectState& aObjectSharingState ) const;
+
+ /**
+ * @ see MVtEngMedia
+ */
+ virtual void GetCameraOrientations(
+ TCameraOrientation& aPrimaryCameraOrientation,
+ TCameraOrientation& aSecondaryCameraOrientation ) const;
+
+public: // New functions.
+
+ /**
+ * Tells if the Protocol initialization has completed.
+ * @return ETrue if initialized
+ */
+ TBool ProtoInitialized() const;
+
+ /**
+ * Performs an operation in the handler.
+ * @param operation to be performed on the handler
+ */
+ virtual void HandleL( CVtEngOperation& aOperation );
+
+ /**
+ * Returns if command can be performed by media handler.
+ * @return KErrNone if a command can be perfomed
+ * KErrNotReady if not in appropriate state
+ * KErrNotSupported if command is not for media handler
+ */
+ TInt ValidateCommand( const TVtEngCommandId aCommand ) const;
+
+ /**
+ * Returns ETrue if video channel is closed.
+ */
+ TBool IsVideoChannelClosed() const;
+
+ /**
+ * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+ */
+ void RequestLastRemoteFrame();
+
+ public: // from MVtProtocolHandler
+
+ /**
+ * Handles callback from protocol.
+ * @param aResponse response
+ */
+ virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse);
+
+ public: // From MVtProtocolHandler.
+
+ /**
+ * Handles callback from protocol audiocontroller.
+ * @param aId which command
+ * @param aCmd which audio command
+ * @param aContextData any additional data
+ * @param aStatus how did it end up with
+ */
+ virtual void HandleAudioOutputControlCommandComplete(TInt aId,
+ TVtAudioOutputControlCommand aCmd,
+ TAny *aContextData,
+ TInt aStatus);
+
+ public: // From MVtProtocolHandler.
+
+ /**
+ * Handles event from protocol.
+ * @param aEvent event
+ */
+ virtual void HandleSessionInformationalEventL(
+ const TVtIndicationEvent& aEvent);
+
+ public: // from MVtProtocolHandler
+
+ /**
+ * Handles error event from protocol.
+ * @param aEvent error event
+ */
+ virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent);
+
+ public: // from MVtEngSettingObserver
+
+ /**
+ * Handles shared data setting change.
+ * @param aId setting id
+ * @param aValue setting value
+ */
+ virtual void HandleSettingChangedL(
+ CVtEngSettings::TSettingId aId,
+ const TDesC& aValue );
+
+ public: // From MVtProtocolHandler.
+
+ /**
+ * @see MVtProtocolHandler.
+ */
+ void HandleVideoEncoderCommandCompletedL(
+ const TVtCommandResponse& aResponse );
+
+ /**
+ * @see MVtProtocolHandler.
+ */
+ void HandleVideoEncoderInformationalEventL(
+ const TVtIndicationEvent& aEvent);
+
+ public: // From MVtProtocolHandler
+
+ /**
+ * @see MVtProtocolHandler.
+ * @since 3.1
+ */
+ void HandleH324MConfigCommandCompletedL( const TVtCommandResponse& aResponse );
+
+ /**
+ * @see MVtProtocolHandler.
+ * @since 3.1
+ */
+ void HandleH324MConfigInformationalEventL(
+ const TVtIndicationEvent& aEvent );
+
+ public: // New functions.
+
+ /**
+ * Initializes media handler.
+ * @param aStatus signaling handle
+ */
+ void InitializeL( TRequestStatus& aStatus );
+
+ /**
+ * Cancels media handler initialization.
+ */
+ void CancelInitialize();
+
+ /**
+ * Initializes default blank provider.
+ * @param aStatus signaling handle
+ */
+ void InitializeProviderL( TRequestStatus& aStatus );
+
+ /**
+ * Cancel Image sharing initialization.
+ */
+ void CancelInitializeShareImage();
+
+ /**
+ * Sets protocol interface.
+ * aProto2Way protocol interface
+ */
+ void SetSessionCommand( MVtSessionCommand* aProto2Way );
+
+ /**
+ * Unitializes media handler.
+ * @param aStatus request semaphore to complete
+ * when uninitialization is complete
+ */
+ void Uninitialize( TRequestStatus& aStatus );
+
+ /**
+ * Goes to next step of uninitialization process, it can
+ * be one of following
+ * - Cancel all Protocol commands
+ * - Protocol disconnect
+ * - Protocol reset
+ * - Switch blank provider.
+ */
+ void UninitializeNextStep();
+
+ /**
+ * Sets selected camera ID.
+ * @param aId camera ID (primary or secondary)
+ * @param aUpdateRequired if ETrue switch could not be performed
+ * Switch will be done when engine has been initialized.
+ */
+ void SetSelectedCameraId(
+ const TCameraId aId,
+ TBool aUpdateRequired = EFalse );
+
+ /**
+ * Handles source initialization or switch.
+ * @param aResult Symbian OS error code
+ */
+ void HandleLocalVideoOperationCompleteL( const TInt aResult );
+
+ /**
+ * SDK init info.
+ * @return Protocol initialization info
+ */
+ TVtInitInfo& SdkInitInfo();
+
+ /**
+ * Returns protocol state maintained by VTEngine, not by Protocol.
+ * @return state
+ */
+ MVtProtocolCommand::TVtProtocolState ProtoState();
+
+ /**
+ * Sets up video connection to remote terminal.
+ * @return Symbian OS error code
+ */
+ TInt Connect();
+
+ /**
+ * Disconnects session.
+ * @return Symbian OS error code
+ */
+ TInt Disconnect();
+
+ /**
+ * Adds video data source to protocol engine.
+ * @param Video channel logical channel ID number.
+ * @return Symbian OS error code
+ */
+ TInt AddVideoSource( TUint aChannelId );
+
+ /**
+ * Adds audio data source to protocol engine.
+ * @param Audio channel logical channel ID number.
+ * @return Symbian OS error code
+ */
+ TInt AddAudioSource( TUint aChannelId );
+
+ /**
+ * Adds video sink.
+ * @param Video channel logical channel ID number.
+ * @return Symbian OS error code
+ */
+ TInt AddVideoSink( TUint aChannelId );
+
+ /**
+ * Adds audio sink.
+ * @param Audio channel logical channel ID number.
+ * @return Symbian OS error code
+ */
+ TInt AddAudioSink( TUint aChannelId );
+
+ /**
+ * Sets the output volume for Protocol.
+ * @param aVolume the level of the volume
+ * @return Symbian OS error code
+ */
+ TInt SetVolume( const TInt aVolume,
+ CVtEngOperation* aOperation = NULL );
+
+ /**
+ * Enables video when primary camera becomes available.
+ * @param aEnable do we enable or disable
+ * @return Symbian OS error code
+ */
+ TInt AutoEnableVideo( TBool aEnable = ETrue );
+
+ /**
+ * Deletes protocol instance and associated Protocol interfaces.
+ */
+ void FinalizeUninitialization();
+
+ /**
+ * Creates extension according to API Uid.
+ * @since S60 v3.2
+ * @param aUid extension API Uid.
+ * @return Extension pointer
+ * @exeption Leaves if creation fails
+ *
+ */
+ CVtEngExtensionBase* CreateExtensionsL( const TUid& aUid );
+
+ /**
+ * Checks if there is already an operation pending.
+ * @return KVtEngCommandNone if no operation is pending or Command identifier
+ */
+ TVtEngCommandId GetPendingCommand();
+
+ private: // new functions
+
+ /**
+ * Sends a sync message to Protocol after provider switch.
+ */
+ void RequestFrame( );
+
+ /**
+ * Sets video quality
+ */
+ void SetVideoQualityL(
+ const TVideoQuality aVideoQuality,
+ const TBool aSetPeerVideoQuality );
+
+ /**
+ * Sets peer video quality
+ */
+ void SetPeerVideoQuality( const TVideoQuality aVideoQuality );
+
+ /**
+ * Check's flag's validity. If not valid, panic's in debug mode.
+ * @param aFlag flag to check.
+ */
+ void AssertFlag( const TInt aFlag ) const;
+
+ /**
+ * Gets the version information from SysUtil
+ * and sets it into Protocol.
+ */
+ void SetVersionInfoL();
+
+ /**
+ * Sets supported resolutions to Protocol.
+ */
+ void SetSupportedResolutions();
+
+ /**
+ * Sets used call setup enhancement parameters.
+ */
+ void SetFastCsupOptions();
+
+ /**
+ * Does Protocol reset.
+ */
+ void ResetProtoL();
+
+ /**
+ * Does the actual disconnecting with Protocol.
+ */
+ void DisconnectProtoL();
+
+ /**
+ * Sets the defaults for volumes.
+ */
+ void InitializeVolume();
+
+ /**
+ * Checks if a flag in iProtoInitFlags is set.
+ * @return ETrue if flag is set
+ */
+ TBool IsFlag( const TInt aFlag ) const;
+
+ /**
+ * Sets a flag in iProtoInitFlags.
+ * @param aFlag flag to set
+ */
+ inline void SetFlag( const TInt aFlag );
+
+ /**
+ * Clears a flag in iProtoInitFlags.
+ * @param aFlag flag to clear
+ */
+ inline void ClearFlag( const TInt aFlag );
+
+ /**
+ * Requests the volume controller.
+ * @return ETrue if retrieved ok
+ */
+ TBool RequestAudioControllerL();
+
+ /**
+ * Spatial trade off indication handling method. Indication is
+ * sent by the peer every time when its spatial trade off is updated.
+ * @param aLogicalChannelId Indication's logical channel Id.
+ * @param aTradeOff Indication trade off value.
+ */
+ void HandleSpatialTradeoffIndication(
+ const TUint16 aLogicalChannelId, const TUint8 aTradeOff );
+
+ /**
+ * Spatial trade off command handling method. Spatial trade off
+ * command is sent by the peer whenever peer wants to adjust our
+ * video quality.
+ * @param aLogicalChannelId Command's logical channel Id.
+ * @param aTradeOff New trade off value.
+ */
+ void HandleSpatialTradeoffCommandL(
+ const TUint16 aLogicalChannelId, const TUint8 aTradeOff );
+
+ private: // constructor and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CVtEngMediaHandler();
+
+ /**
+ * Symbian constructor that may leave.
+ */
+ void ConstructL();
+
+ private:
+ /**
+ * Operation values
+ */
+ enum TOperation
+ {
+ /**
+ * No-op.
+ * 0
+ */
+ ENone,
+
+ /**
+ * Add video source to protocol.
+ * 1
+ */
+ EAddVideoSource,
+
+ /**
+ * Add video source to protocol.
+ * 2
+ */
+ EAddVideoSink,
+
+ /**
+ * Add audio source to protocol.
+ * 3
+ */
+ EAddAudioSource,
+
+ /**
+ * Add audio source to protocol.
+ * 4
+ */
+ EAddAudioSink,
+
+ /**
+ * Connect protocol.
+ * 5
+ */
+ EConnectProto,
+
+ /**
+ * Mute audio.
+ * 6
+ */
+ EMuteAudio,
+
+ /**
+ * Resume audio sending.
+ * 7
+ */
+ EUnmuteAudio,
+
+ /**
+ * Enable video for peer.
+ * 8
+ */
+ EEnableVideo,
+
+ /**
+ * Disable video for peer.
+ * 9
+ */
+ EDisableVideo,
+
+ /**
+ * Cancel ongoing request to Protocol
+ * as part of uninitiazation process.
+ * 10
+ */
+ EUninitializeCancelAllProto,
+
+ /**
+ * Disconnect protocol.
+ * 11
+ */
+ EDisconnectProto,
+
+ /**
+ * Destructs local/remote video and VS instances.
+ * 12
+ */
+ EDestructInternals,
+
+ /**
+ * Terminates H.324 session.
+ * 13
+ */
+ ETerminateSession,
+
+ /**
+ * Removing sinks and sources.
+ * 14
+ */
+ ERemovingSinksAndSources,
+
+ /**
+ * Request 324 control interface from protocol.
+ * 15
+ */
+ EGet324CtrlInterface,
+
+ /**
+ * Set volume.
+ * 16
+ */
+ ESetAudioVolume,
+
+ /**
+ * Gets the maximum volume for Protocol.
+ * 17
+ */
+ EGetAudioGetMaxVolume,
+
+ /**
+ * Reset protocol.
+ * 18
+ */
+ EDestructProtoPhaseDisconnect,
+
+ /**
+ * Destruct switch blank.
+ * 19
+ */
+ EDestructSwitchBlank,
+
+ /**
+ * Reset protocol.
+ * 20
+ */
+ EDestructProtoPhaseReset,
+
+ /**
+ * Check Protocol state.
+ * 21
+ */
+ ECheckProtoState,
+
+ /**
+ * Enables video internally (not originated by UI).
+ * 22
+ */
+ EEnableVideoInternal,
+
+ /**
+ * Disables video internally (not originated by UI).
+ * 23
+ */
+ EDisableVideoInternal,
+
+ /**
+ * Request H263Enc interface from protocol.
+ * 24
+ */
+ EGetH263EncInterface,
+
+ /**
+ * Requests an intra frame.
+ * 25
+ */
+ ESendIntraframe,
+
+ /**
+ * Set supported resolutions.
+ * 26
+ */
+ ESetSupportedResolutions,
+
+ /**
+ * Set video quality (by changing framerate)
+ * 27
+ */
+ ESetVideoQuality,
+
+ /**
+ * Remove H324 interface
+ * 28
+ */
+ ERemove324CtrlInterface,
+
+ /**
+ * Remove video encoder interface
+ * 29
+ */
+ ERemoveH263EncInterface,
+
+ /**
+ * Sends Video Temporal-spatial trade off command
+ * 30
+ */
+ ESendVTSTO,
+
+ /**
+ * Sets fast call setup options
+ * 31
+ */
+ ESetFastCsupOptions,
+
+ /**
+ * Sets vendor id
+ * 32
+ */
+ ESetVendorId,
+
+ /**
+ * Set interval when I-frames are sent
+ * 33
+ */
+ ESetIFrameInterval
+ };
+
+ /**
+ * Operation and related command id.
+ */
+ struct TCmdOpPair
+ {
+ // Operation
+ TOperation iOp;
+ // Command id returned by proto2way asynch request
+ TInt iProtoCmdId;
+ };
+
+ /**
+ * Enables/Disables video sending.
+ * @param aEnable ETrue if video is to be enabled
+ * @param aOp operation to be added
+ * NOTE. Valid only for enabling video, not when disabled.
+ * @see void AutoEnableVideo
+ * @return started operation or ENone
+ */
+ TOperation EnableVideoL(
+ const TBool aEnable,
+ const TOperation aOp = EEnableVideo );
+
+ /**
+ * Calls Protocol pausing and acts according to the result.
+ * @return operation id for performed operation
+ */
+ TOperation DoPauseVideo();
+
+ /**
+ * Continues to next step of uninitialization.
+ * @param aOp operation to perform
+ * @return command id
+ */
+ void ContinueUninitializeL( const TOperation aOp );
+
+ /**
+ * Cancels all the running commands within Protocol.
+ * @param operation to be returned
+ * EUninitializeCancelAllProto if cancellation is ongoing
+ * (either because was already or just started)
+ * ENone if cancellation is not ongoing
+ * @return error code
+ * KErrNotReady if engine not in suitable state
+ * KErrAlreadyExists if cancel was already pending
+ * KErrNone if cancellation request succeeded
+ * other Symbian OS error code if cancellation fails
+ */
+ TInt CancelAllProtoCommands( TOperation &aOp );
+
+ /**
+ * Stops view finder and remote video rendering.
+ */
+ void StopRendering();
+
+ /**
+ * Updates volume to Protocol (if possible).
+ */
+ void UpdateVolume();
+
+ /**
+ * Initiates protocol engine reset.
+ */
+ void ResetProto2WayL();
+
+ /**
+ * Removes operation from pending operations array.
+ * @param aOp TOperation
+ * @return ETrue if operation was found (and hence removed)
+ */
+ template<class T>
+ TBool RemoveOperation( const T& aOp );
+
+ /**
+ * Adds operation pending for callback.
+ * @param aOp operation value
+ * @param aCmdId protocol commd id or 0 if not Protocol cmd
+ * @param aResetExisting if ETrue removes existing operations
+ * from array
+ * @return index of the operation in array (i.e. >= 0 )
+ */
+ TInt AddOperation(
+ const TOperation aOp,
+ TInt aCmdId,
+ const TBool aResetExisting = EFalse );
+
+ /**
+ * Checks if an operation is pending.
+ * @param aOp operation
+ * @return index if operation is pending or KErrNotFound
+ */
+ TInt IsPending( const TOperation aOp ) const;
+
+ /**
+ * Checks if an operation is pending.
+ * @param aCmdId command id
+ * @return index if operation is pending or KErrNotFound
+ */
+ TInt IsPending( const TInt aCmdId ) const;
+
+ /**
+ * Completes asynchronous operation.
+ * @param aResult
+ * @return KErrNotFound if no operation else KErrNone
+ */
+ TInt CompleteOp( const TInt aResult );
+
+ /**
+ * Completes asynchronous operation asynchronously.
+ * @param aResult
+ * @return KErrNotFound if no operation else KErrNone
+ */
+ void AsyncCompleteOp( const TInt aResult = KErrNone );
+
+ /**
+ * Checks if specific operation matches to response from protocol.
+ * @param aProtoCmdId command id returned by protocol
+ * @param aOperation operation to search for in pending commands
+ * @param aIndex index in iPendingOps array if found
+ * @return ETrue if there's corrensponding entry in pending ops
+ */
+ TBool MatchResponseToPendingOps(
+ const TInt aProtoCmdId,
+ const TOperation aOperation,
+ TInt* aIndex = NULL );
+
+ /**
+ * Starts "self-destruction" timer.
+ */
+ void StartDisconnectTimerL();
+
+ /**
+ * Assigns new pending operation. Only one can be pending at a time
+ * so if there already is pending operation it is completed with error.
+ * @param aOperation operation to assign as pending
+ * @param aReplaceError error code to complete penging operation if
+ * one exists. If KErrNone is passed, replacement is not done.
+ * @return KErrNone if assignment done successfully i.e. there was
+ not pending operation that was completed.
+ * KErrCancel if some other operation was pending and was
+ * completed with aReplaceError. Operation is
+ * still assigned successfully.
+ * KErrGeneral if operation was not assigned.
+ */
+ TInt AssignPendingOp(
+ CVtEngOperation& aOperation,
+ TInt aReplaceError = KErrCancel );
+
+ /**
+ * Callback function that completes ongoing operation.
+ * @param aAny pointer to an instance of the class.
+ * @return always KErrNone.
+ */
+ static TInt DoCompleteOp( TAny* aAny );
+
+ /**
+ * Implementation of self-destruction timer activity.
+ * Causes a panic.
+ * @param aAny pointer to an instance of the class
+ * Not used.
+ * @return KErrNone;
+ */
+ static TInt TimerCallback( TAny* aAny );
+
+ /**
+ * Creates and enques async callback for uninitialization.
+ * @see iNextStepCallback
+ */
+ void NextUninitStepCallbackL();
+
+ /**
+ * Callback method for async uninitialization step.
+ * @seeiNextStepCallback
+ * @return KErrNone;
+ */
+ static TInt UninitCallback( TAny* aAny );
+
+ /**
+ * Query 2-way's additional interfaces, encoder and H324
+ * @return KErrNone;
+ */
+ void QueryProtoInterfacesL();
+
+ /**
+ * Release 2-way's additional interfaces, encoder and H324
+ * @return KErrNone;
+ */
+ void ReleaseProtoInterfacesL();
+
+ /**
+ * Check for pending Protocol extension interface commands.
+ * @return ETrue if one or more extension command is pending
+ */
+ TBool ExtensionCommandsPending() const;
+
+ /**
+ * Checks is it possible to add sink / source from session
+ * state point of view.
+ * @return ETrue if adding is allowed.
+ */
+ TBool MediaAddingValidity() const;
+
+ /**
+ * Provider initialization state
+ */
+ enum TInitState
+ {
+ /**
+ * Initialization not ongoing.
+ */
+ EInitStateNone,
+
+ /**
+ * Initialize still image.
+ */
+ EStateInitStillImage,
+
+ /**
+ * Initilize default blank provider.
+ */
+ EStateInitProvider,
+
+ /**
+ * Provider is set to none.
+ */
+ EStateWaitingProviderChangeForUninit,
+
+ /**
+ * Initialization has been cancelled.
+ */
+ EStateInitCanceled
+ };
+
+ /**
+ * State flags.
+ */
+ enum
+ {
+ // Protocol state flags
+ // Sink/source added
+ EProtoAudioSourceAdded = 0x000001,
+ EProtoVideoSourceAdded = 0x000002,
+ EProtoAudioSinkAdded = 0x000004,
+ EProtoVideoSinkAdded = 0x000008,
+ // Track paused
+ EProtoAudioTrackPaused = 0x000040,
+ EProtoVideoTrackPaused = 0x000080,
+
+ // Pause/resume related flags.
+ ETwoStageOperation = 0x000100,
+ ESourceUpdateNeeded = 0x000200,
+ EProtoPauseVideoRequested= 0x000400,
+ EProtoPauseVideoBlankProv= 0x000800,
+ EProtoContVideoBlankProv = 0x001000,
+ EProtoContVideoBlankInit = 0x002000,
+
+ // Must send intra
+ EProtoSendIntraFrame = 0x004000,
+
+ // 324 interface acquired
+ EProto324IFAcquired = 0x008000,
+
+ // Cancel all command is called on Protocol
+ // or there's nothing to cancel
+ EProtoCancelProtoCmdsOk = 0x010000,
+
+ // NON Protocol related flags
+
+ EVideoQualitySetByPeer= 0x020000,
+
+ // Outgoing video channel closed (after being open)
+ // Used for preventing video pause/resume when
+ // the channel is not open
+ EOutVideoChannelClosed = 0x040000,
+
+ // Outgoing audio channel closed (after being open)
+ // Used for preventing audio pause/resume
+ // the channel is not open
+ EOutAudioChannelClosed = 0x080000
+ };
+
+
+ /**
+ * Defines actions that can be taken when sharing started
+ * and/or stopped
+ */
+ enum TVideoEngAction
+ {
+ EVideoActionNone,
+ EVideoActionEnable,
+ EVideoActionDisable
+ };
+
+ /**
+ * Helper class for handling video quality manipulation.
+ */
+ class TVtEngVideoQuality
+ {
+
+ public:
+
+ // Forward for inner class
+ class TVQSParams;
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ TVtEngVideoQuality();
+
+ /**
+ * Destructor.
+ */
+ ~TVtEngVideoQuality();
+
+ /**
+ * Sets new local video quality setting.
+ * @param aId Operation id.
+ * @param aSetPeer ETrue if peer video quality needs to be set,
+ * EFalse otherwise.
+ */
+ void SettingVideoQuality( TInt aId, const TVideoQuality aValue,
+ TBool aSetPeer );
+
+ /**
+ * Get current local video quality setting.
+ * @return Current local video quality setting.
+ */
+ TVideoQuality VideoQuality() const;
+
+ /**
+ * Setting video quality succeeded.
+ * @return ETrue if record with given id was found, EFalse other
+ * wise.
+ */
+ TBool SettingSucceeded( TInt aId, TVQSParams& aParams );
+
+ /**
+ * Setting video quality failed.
+ */
+ void SettingFailed( TInt aId );
+
+ /**
+ * Called when video quality indication is received from peer.
+ */
+ void UpdateVideoQuality( const TVideoQuality aVideoQuality );
+
+ /**
+ * Converts given trade off value to video quality enum.
+ */
+ TVideoQuality FromTradeOff( const TInt aTradeOff ) const;
+
+ /**
+ * Converts given video quality enum to trade off value.
+ */
+ TInt ToFrameRate( const TVideoQuality aVideoQuality ) const;
+
+ /**
+ * Converts given video quality value to frame rate.
+ */
+ TUint8 ToTradeOff( const TVideoQuality aVideoQuality ) const;
+
+ /**
+ * Finds id of setting param and returns index to it.
+ */
+ TInt FindVQSParam( TInt aId ) const;
+
+ public:
+
+ /**
+ * Video quality parameters.
+ */
+ struct TVQSParams
+ {
+
+ public:
+
+ // Default constructor
+ TVQSParams();
+
+ // Constructor with initializing parameters
+ TVQSParams( TInt aId, const TVideoQuality aValue,
+ TBool aSetPeer );
+
+ public: // data
+
+ // Operation id
+ TInt iId;
+
+ // VideoQuality value to be set
+ TVideoQuality iValue;
+
+ // Defines whether peer video quality needs to be set or not
+ TBool iSetPeer;
+
+ };
+
+ private:
+
+ // Current local video quality
+ TVideoQuality iCurrent;
+
+ // Qued params
+ RArray< TVQSParams > iParamList;
+ };
+
+ // Class for handling different kind of H.245 logical
+ // channels and their state in different MONA call setup
+ // scenarios
+ class TLogicalChannel
+ {
+ public:
+
+ // H.245 logical channel ID to be established or
+ // already active
+ TUint iLogicalChannelId;
+
+ // H.245 logical channel ID that is currently closing.
+ TUint iLogicalChannelIdClosing;
+
+ // Variable to tell is same type (video or audio, incoming or outgoing)
+ // channel already started to close but not closed yet. If closing is pending
+ // same type channel cannot be opened until closing has finished or sink/source
+ // addition has failed for some reason.
+ TBool iSameTypeClosingPending;
+
+ // Variable to tell is same type (video or audio, incoming or outgoing)
+ // channel ready to be opened.
+ TBool iSameTypeChannelReadyToOpen;
+
+ };
+
+ private: // Data members.
+
+ // Protocol engine pointer.
+ MVtSessionCommand* iSessionCommand;
+
+ // Local video configuration.
+ CVtEngLocalVideo* iLocalVideo;
+
+ // Remote video configuration.
+ CVtEngRemoteVideo* iRemoteVideo;
+
+ // Pending internal operations.
+ TInt iCmdId;
+ CArrayFixFlat<TCmdOpPair>* iPendingOps;
+
+ // Video Source initialization state.
+ TInitState iVSInitState;
+
+ // Flags used to determine if audio and video sink/source
+ // is added to protocol and media state.
+ TInt iProtoStateFlags;
+
+ // protocol state.
+ MVtProtocolCommand::TVtProtocolState iProtoState;
+
+ // Initialization flag.
+ TBool iInitialized;
+
+ // Remote media state.
+ TInt iRemoteMediaState;
+
+ // Pending operation from client.
+ CVtEngOperation* iPendingOp;
+
+ // Protocol initialization information.
+ TVtInitInfo iSdkInitInfo;
+
+
+ // Request status for (un)initialization.
+ TRequestStatus* iRequestStatus;
+
+ // Audio controller handle.
+ MVtAudioConfigCommand* iAudioCtrl;
+
+ // Timer to detect failure in disconnection.
+ CPeriodic* iTimer;
+
+ // Protocol max volume.
+ TInt iProtoMaxVolume;
+
+ // Selected camera is not necessary activated also.
+ TCameraId iSelectedCameraId;
+
+ // ETrue when it is allowed to update volume.
+ TBool iUpdateVolumeAllowed;
+
+ // ETrue when it is needed to update volume.
+ TBool iUpdateVolumeRequired;
+
+ // Owned asynch callback.
+ CIdle* iAsyncCallback;
+
+ // Pending volume operation.
+ CVtEngOperation* iPendingVolumeOp;
+
+ // Used for various connection related operations.
+ TInt iConnectionStates;
+
+ // Used while pausing and resuming video.
+ CVtEngLocalVideo::TVtEngProviderType iTempProviderInfo;
+
+ // Used for setting the vendor info.
+ MVtH324ConfigCommand* iH324Config;
+
+
+ // Used H263 interface.
+ MVtVideoConfigCommand* iH263Encoder;
+
+ // Video quality
+ TVtEngVideoQuality iVideoQuality;
+
+ // Sharing object while video is disable will set this flag
+ TVideoEngAction iVideoAction;
+
+ // Logical channel structure for outgoing video channel(s).
+ TLogicalChannel iVideoOutgoingLogicalChannel;
+
+ // Logical channel structure for outgoing audio channel(s).
+ TLogicalChannel iAudioOutgoingLogicalChannel;
+
+ // Logical channel structure for incoming video channel(s).
+ TLogicalChannel iVideoIncomingLogicalChannel;
+
+ // Logical channel structure for incoming audio channel(s).
+ TLogicalChannel iAudioIncomingLogicalChannel;
+
+ /* For proceeding to next uninit step asynchronously.
+ * Needed because Proto extension interface cannot be released within
+ * callback
+ */
+ CAsyncCallBack* iNextStepCallback;
+
+
+ /* Do not complete operation on pause command. This flag
+ * is used when image sharing is stopped and video was disabled
+ * when sharing was initially started to prevent black frame sending
+ * during blank switch.
+ */
+ TBool iPauseNoCompleteOp;
+
+ /**
+ * Result for asynchronous operation completion.
+ */
+ TInt iAsyncCompleteOpResult;
+ };
+
+#endif // CVTENGMEDIAHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngRemoteVideo.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,441 @@
+/*
+* Copyright (c) 2006 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: Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGREMOTEVIDEO_H
+#define CVTENGREMOTEVIDEO_H
+
+// INCLUDES
+#include <e32base.h>
+#include <w32std.h>
+#include "MVtEngImageScaler.h"
+#include "MVtEngDraw.h"
+#include "TVtEngRendering.h"
+#include "TVtEngRenderConfig.h"
+#include <mdisplaysink.h>
+#include <mvtprotocolhandler.h>
+
+// FORWARD DECLARATIONS
+class CDirectScreenAccess;
+class CFbsBitmap;
+class CVtEngStateManager;
+class MVtEngScalerObserver;
+
+class TVtEngRenderingOptionsDSA;
+class TVtEngRenderingOptionsDP;
+class TVtEngRenderingOptionsNGA;
+
+// Define image sizes.
+// QCIF.
+const TInt KVtEngResolutionQCIFWidth = 176;
+const TInt KVtEngResolutionQCIFHeight = 144;
+
+// SQCIF.
+const TInt KVtEngResolutionSQCIFWidth = 128;
+const TInt KVtEngResolutionSQCIFHeight = 96;
+
+// Default video screen width.
+const TInt KVtEngRemoteVideoDefaultWidth = 176;
+
+// Default video screen height.
+const TInt KVtEngRemoteVideoDefaultHeight = 144;
+
+// Watcher checks point time-out 400 ms.
+const TInt KVtEngWatcherTimeout = 400000;
+
+// When the watcher has timed out 15 times without new frame, send event to UI.
+const TInt KVtEngWatcherThreshold = 15;
+
+// CLASS DECLARATION
+
+/**
+* Class handling remote video.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngRemoteVideo ) :
+ public CBase,
+ public MDisplaySinkObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPv2Way a reference to PV instance.
+ * @param aStateManager reference to VT state manager
+ * @return instance of CVtEngRemoteVideo
+ */
+ static CVtEngRemoteVideo* NewL(
+ MVtSessionCommand& aSessionCommand,
+ CVtEngStateManager& aStateManager );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngRemoteVideo();
+
+ public: // From MDisplaySinkObserver
+
+ /**
+ * @see MDisplaySinkObserver
+ */
+ void VideoFrameSizeChangedL( const TSize& aFrom,
+ const TSize& aTo );
+
+ public: // New functions
+
+ /**
+ * Sets parameters used when rendering remote video.
+ */
+ void SetRenderingParametersL(
+ const TVtEngRenderingOptionsNGA& aParams );
+
+ /**
+ * Sets parameters used when rendering remote video.
+ * @param aParams direct screen access parameters
+ */
+ void SetRenderingParametersL(
+ const TVtEngRenderingOptionsDSA& aParams );
+
+ /**
+ * Sets parameters used when rendering remote video.
+ * @param aParams direct screen access parameters
+ */
+ void SetRenderingParametersL(
+ const TVtEngRenderingOptionsDP& aParams );
+
+ /**
+ * Starts remote video rendering.
+ */
+ void StartVideoL();
+
+ /**
+ * Stops remote video rendering.
+ */
+ void StopVideoRendering();
+
+ /**
+ * Pauses remote video rendering.
+ * @return command id from PV
+ */
+ TInt PauseVideoL();
+
+ /**
+ * Adds Display sink into PV.
+ * @param Video channel logical channel ID number.
+ * @return PV command ID
+ */
+ TInt AddVideoSinkL( TInt aChannelId );
+
+ /**
+ * Adds Audio sink into PV.
+ * @param Audio channel logical channel ID number.
+ * @return PV command ID
+ */
+ TInt AddAudioSinkL( TInt aChannelId );
+
+ /**
+ * Returns state of Direct Screen Access.
+ * @return state of Direct Screen Access
+ */
+ TBool GetDsaState() const;
+
+ /**
+ * Returns the audiosink of nested CVtEngDraw class.
+ * @return the audiosink of nested CVtEngDraw class
+ */
+ MVTAudioSink* AudioSink();
+
+ /**
+ * Sets UI foreground state (i.e. is the Application
+ * current active application or not).
+ * @param aForeground ETrue if the VT application is
+ * in foreground, EFalse otherwise.
+ * @exception May leave with KErrNotReady.
+ */
+ void SetUIForegroundL( TBool aForeground );
+
+ /**
+ * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+ */
+ void RequestLastFrame();
+
+ private:
+
+ /**
+ * C++ constructor.
+ * @param aPv2Way a reference to PV instance
+ * @param aStateManager reference to VT state manager
+ */
+ CVtEngRemoteVideo(
+ MVtSessionCommand& aSessionCommand,
+ CVtEngStateManager& aStateManager );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+
+ public:
+
+ /**
+ * Base rendering class
+ */
+ NONSHARABLE_CLASS( CVtEngDraw ) :
+ public CActive,
+ public MVtEngDraw,
+ public MDirectScreenAccess
+ {
+
+ protected: // new methods
+ /**
+ * C++ constructor as private.
+ * @param aObserver callback interface for Display Sink
+ */
+ CVtEngDraw( MDisplaySinkObserver* aObserver );
+
+ /**
+ * Destructor
+ */
+ ~CVtEngDraw();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * If not active, set iStatus to KRequestPending and calls
+ * SetActive();
+ */
+ void Activate();
+
+ /**
+ * Creates DSA instance.
+ */
+ void CreateAndStartDSAL();
+
+ public: // from MDirectScreenAccess
+
+ /**
+ * From MDirectScreenAccess, this function is called by the
+ * window server when direct screen access must stop.
+ * @see MDirectScreenAccess::AbortNow
+ */
+ virtual void AbortNow(
+ RDirectScreenAccess::TTerminationReasons aReason );
+
+ /**
+ * From MDirectScreenAccess, this method is called by the direct
+ * screen access instance as soon as direct screen access can
+ * resume.
+ * @see MDirectScreenAccess::Restart
+ */
+ virtual void Restart(
+ RDirectScreenAccess::TTerminationReasons aReason );
+
+ public: // new functions
+
+ /**
+ * Configuration was updated.
+ */
+ void ConfigUpdatedL();
+
+ /**
+ * Display Sink pointer.
+ * @return instance of MDisplaySink
+ */
+ MDisplaySink* DisplaySink();
+
+ /**
+ * Returns state of Direct Screen Access.
+ * @return true if rendering
+ */
+ TBool GetDsaState() const;
+
+ /**
+ * Checks frame watcher expiration.
+ * @param aAny pointer to CVtEngDrawDSA
+ * @return Symbian OS error code
+ */
+ static TInt WatcherExpired( TAny* aAny );
+
+ /**
+ * Handles frame watcher expiration.
+ */
+ void HandleWatcherExpired();
+
+ /**
+ * Sets certain flag on.
+ * @param aFlags flags to turn on.
+ */
+ void SetFlag( TUint aFlags );
+
+ /**
+ * Clears certain flag.
+ * @param aFlags flags to clear.
+ */
+ void ClearFlag( TUint aFlags );
+
+ /**
+ * Checks if certain flag is on.
+ * @param aFlags flags to check.
+ */
+ TBool IsFlag( TUint aFlag ) const;
+
+ /**
+ * Called by CVtEngRemoteVideo, when video sink is added
+ * to PV.
+ */
+ void VideoSinkAdded();
+
+ private: // from CActive
+
+ /**
+ * Handles active object cancellation.
+ * @see CActive::Cancel
+ */
+ void DoCancel();
+
+ /**
+ * Handles active object execution errors.
+ * @see CActive::RunError
+ */
+ TInt RunError( TInt aError );
+
+ protected:
+
+ /**
+ * Defines if drawing can be done
+ * and if we have not received frames
+ * for some time and observer is notified
+ * (and no new frames since then).
+ */
+ enum TFlags
+ {
+ // Start the rendering.
+ EStarted = ( 1 << 0 ),
+ // Ready by window server.
+ EReadyForeground = ( 1 << 1 ),
+ // Ready by internal state.
+ EReadyInternal = ( 1 << 2 ),
+ // Ready to draw.
+ EReady = EReadyInternal | EReadyForeground,
+ // Watcher expired because no frames received in time.
+ EFrameWatcherExpired= ( 1 << 3 ),
+ // First frame has been received.
+ EFirstFrameReceived = ( 1 << 4 ),
+ // Drawing ongoing flag
+ ERemoteVideoDrawing = ( 1 << 5 ),
+ // VT UI foreground status (if set, UI is foreground)
+ EFlagUIForeground = ( 1 << 6 ),
+ // Components have been initialized
+ EFlagInitialized = ( 1 << 7 ),
+ // VT UI has been sent to background
+ ESentToBackground = ( 1 << 8 ),
+ // Frame buffer contains data when this flag is set (DP,NGA)
+ EFrameBufferFilled = ( 1 << 9 ),
+ // BaseConstructL() call is pending (DP,NGA)
+ EBaseConstructCalled = ( 1 << 10 ),
+ // BaseSetConfigL() call is pending (DP,NGA)
+ EBaseSetConfigCalled = ( 1 << 11 ),
+ // BaseStartDrawL() call is pending (DP,NGA)
+ EBaseBaseStartDrawCalled = ( 1 << 12 ),
+ // UpdateSinkParamsL() needs to be called (DP,NGA)
+ ESinkParamUpdateRequired = ( 1 << 13 ),
+ // Sink().Resume() needs to be called (DP,NGA)
+ ESinkResumeRequired = ( 1 << 14 ),
+ // InitializePostingSurfaceL() call is pending (DP), CreateSurfaceL call is pending (NGA)
+ EInitializePostingSurfaceCalled = ( 1 << 15 ),
+ // New frame buffer is store, not coverted and scaled yet
+ EFrameBufferNeedsConvertAndScale = ( 1 << 16 ),
+
+ // Bitmask for all pending calls (DP)
+ EDelayedCallsMask = EBaseConstructCalled |
+ EBaseSetConfigCalled |
+ EBaseBaseStartDrawCalled |
+ ESinkParamUpdateRequired |
+ EInitializePostingSurfaceCalled
+ };
+
+ protected : // data
+
+ // Direct Screen Access.
+ CDirectScreenAccess* iDSA;
+
+ // Display sink providing bitmaps.
+ MDisplaySink* iDisplaySink;
+
+ // @see TFlags
+ TInt iFlags;
+
+ // For checking if display sink stops feeding.
+ // drawer with bitmaps
+ CPeriodic* iWatcher;
+
+ // to reduce watcher restarts do cancel it
+ // only every 15 frames
+ // Counter for frame expiration.
+ TInt iCheckpoint;
+
+ // DisplaySink callback interface.
+ MDisplaySinkObserver* iObserver;
+
+ // Frame watcher callback.
+ TCallBack iCallback;
+
+ // Container class as a friend.
+ friend class CVtEngRemoteVideo;
+
+ // Temporarily store image size when size changes on the fly.
+ TSize iSourceSize;
+
+ // DisplaySink status boolean.
+ TBool iDSUpdated;
+ };
+
+ private: // Data
+ // Packet Video interface.
+ MVtSessionCommand& iSessionCommand;
+
+ // State manager.
+ CVtEngStateManager& iStateManager;
+
+ // Draws remote video with DSA.
+ CVtEngDraw* iDrawer;
+
+ // Display sink.
+ MDisplaySink* iDisplaySink;
+
+ // Audio sink interface.
+ MVTAudioSink* iAudioSink;
+
+ // Information from PV regarding sink.
+ TInt iTrackId;
+
+ // @see TFlags
+ TInt iStateFlags;
+
+ TBool iEnableNGA;
+ };
+
+#endif // CVTENGREMOTEVIDEO_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngDraw.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004-2006 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: Remote video handling class.
+*
+*/
+
+
+
+#ifndef MVTENGDRAW_H
+#define MVTENGDRAW_H
+
+// INCLUDE
+
+#include <e32base.h>
+
+// FORWARD
+
+class MDisplaySink;
+class MDisplaySinkObserver;
+class TVtEngRenderConfig;
+
+/**
+* Drawer API.
+*
+* @lib videoteleng.lib
+* @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( MVtEngDraw )
+ {
+ public:
+
+ /**
+ * Base construction for derived classes.
+ */
+ virtual void BaseConstructL() = 0;
+
+ /**
+ * Instantiates display sink.
+ */
+ virtual MDisplaySink* CreateSinkL() = 0;
+
+ /**
+ * Refresh view.
+ */
+ virtual void BaseRefreshL() = 0;
+
+ /**
+ * Updates the target bitmaps and/or displaymode
+ * and/or the sizes of bitmaps
+ */
+ virtual void BaseRefreshBitmapsL() = 0;
+
+ /**
+ * DoCancel method for inherited classes.
+ */
+ virtual void BaseDoCancel() = 0;
+
+ /**
+ * Configuration verifying routine for derived classes. If
+ * new configuration is not supported, then may this method
+ * leaves with appropriate error code.
+ */
+ virtual void BaseVerifyConfigL() = 0;
+
+ /**
+ * Called when DSA calls Restart() to start drawing again.
+ */
+ virtual void BaseRestartL() = 0;
+
+ /**
+ * Called when DSA calls AbortNow() to stop drawing.
+ */
+ virtual void BaseAbortNow() = 0;
+
+ /**
+ * Starts rendering.
+ */
+ virtual void BaseStartDrawL() = 0;
+
+ /**
+ * Stops rendering.
+ */
+ virtual void BaseStopDraw() = 0;
+
+ /**
+ * Sets configuration.
+ */
+ virtual void BaseSetConfigL( const TVtEngRenderConfig& aConfig ) = 0;
+
+ /**
+ * Called when UI foreground status changes.
+ */
+ virtual void BaseSetUIForegroundL( TBool aForeground ) = 0;
+
+ /**
+ * Called when incoming video frame size changes.
+ */
+ virtual void BaseVideoFrameSizeChangedL( const TSize& aTo ) = 0;
+
+ /**
+ * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame.
+ */
+ virtual void BaseRequestLastFrame() = 0;
+
+ protected:
+
+ /**
+ * Returns current configuration settings.
+ */
+ virtual TVtEngRenderConfig& Config() = 0;
+
+ };
+
+/**
+* Remote drawer factory.
+*
+* @lib videoteleng.lib
+* @since Series 60 3.2
+*/
+class VtEngDrawFactory
+ {
+ public:
+ /**
+ * Factory method for creating drawer
+ * @param aObserver a callback interface
+ */
+ static MVtEngDraw* CreateDrawerL( MDisplaySinkObserver* aObserver, TBool );
+ };
+
+#endif // MVTENGDRAW_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngFrameObserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 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: Observer interface for video frames.
+*
+*/
+
+
+
+#ifndef MVTENGFRAMEOBSERVER_H
+#define MVTENGFRAMEOBSERVER_H
+
+// INCLUDES
+#include <e32def.h>
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for video frames.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngFrameObserver
+ {
+ public:
+
+ enum TFrameType
+ {
+ ELocalVideoFrame,
+ ERemoteVideoFrame
+ };
+
+ virtual void vtHandleFrameL( TFrameType aType,
+ CFbsBitmap* aBitmap ) = 0;
+
+ /**
+ * Sets last drawn frame. This frame will be stored by UI
+ * and will be drawn when DSA is temporarily disabled (e.g.
+ * when a menu is opened)
+ */
+ virtual void vtSetFrame( TFrameType aType,
+ CFbsBitmap* aBitmap ) = 0;
+
+ };
+
+#endif // MVTENGFRAMEOBSERVER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngImageScaler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2004-2006 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: Interface used for scaling images to certain size.
+*
+*/
+
+
+
+#ifndef VTENGIMAGESCALER_H
+#define VTENGIMAGESCALER_H
+
+// INCLUDES
+#include <gdi.h>
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+/**
+* Image scaler observer.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.8
+*/
+class MVtEngScalerObserver
+ {
+ public:
+
+ /**
+ * Called when scaling is ready.
+ * @param aBitmap a scaled bitmap
+ * @param aError Symbian OS error code
+ */
+ virtual void ScalingCompleted(
+ CFbsBitmap* aBitmap,
+ TInt aError ) = 0;
+ };
+
+/**
+* Image scaler.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngImageScaler
+ {
+ public: // new functions
+
+ /**
+ * Used to start the scaling of an image.
+ * @param aSourceIndex the index of the source to use.
+ */
+ virtual void ScaleL(
+ TInt aSourceIndex ) = 0;
+
+ /**
+ * Configures the scaler.
+ * @param aDisplayMode which kind of display
+ * @param aSize the width and height of the display
+ * @return ETrue if previous scaling was cancelled
+ */
+ virtual TBool ConfigureL(
+ TDisplayMode aDisplayMode,
+ TSize aSize,
+ TInt aSourceHandle1,
+ TInt aSourceHandle2 ) = 0;
+
+ /**
+ * Deletes the scaling object.
+ */
+ virtual void Release() = 0;
+
+ /**
+ * Possibility to cancel the scaling.
+ * @return error code of canceling.
+ */
+ virtual TInt Cancel() = 0;
+ };
+
+/**
+* Image scaler factory.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.8
+*/
+class VtEngScalerFactory
+ {
+ public:
+ /**
+ * Factory method for creating scaler
+ * @param aObserver a callback interface
+ */
+ static MVtEngImageScaler* CreateScalerL(
+ MVtEngScalerObserver& aObserver );
+ };
+
+#endif // VTENGIMAGESCALER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngMedia.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,357 @@
+/*
+* Copyright (c) 2004-2006 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: Media interface
+*
+*/
+
+
+
+#ifndef MVTENGMEDIA_H
+#define MVTENGMEDIA_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MVtEngLocalVideoDisplay;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+* Media interface for defining data types for media transport and
+* presentation of it locally as well methods for obtaining current
+* configuration.
+*
+* @lib videoteleng.lib
+* @since Series 60 2.6
+*/
+class MVtEngMedia
+ {
+ public: // New functions.
+
+ enum TMediaType
+ {
+ EMediaAudio = (1 << 0 ),
+ EMediaVideo = ( 1 << 1 ),
+ EMediaAudioPreparing = ( 1 << 2 ),
+ EMediaVideoPreparing = ( 1 << 3 ),
+ // Status of audio channel, applicable only for outgoing audio.
+ EMediaAudioChannelOpen = ( 1 << 4 ),
+ // Status of video channel, applicable only for outgoing video.
+ EMediaVideoChannelOpen = ( 1 << 5 )
+ };
+
+ /**
+ * ESourceCapsPrimaryCamera
+ * primary camera can be selected.
+ * ESourceCapsSecondaryCamera
+ * secondary camera can be selected.
+ * ESourceCapsStillImage
+ * still image can be selected.
+ */
+ enum TSourceCapsFlags
+ {
+ ESourceCapsPrimaryCamera = ( 1 << 0 ),
+ ESourceCapsSecondaryCamera = ( 1 << 1 ),
+ ESourceCapsStillImage = ( 1 << 2 )
+ };
+
+ /**
+ * EMediaOutgoing
+ * outbound media
+ * EMediaIncoming
+ * inbound media
+ */
+ enum TMediaDirection
+ {
+ EMediaOutgoing,
+ EMediaIncoming
+ };
+
+ /**
+ * EMediaNone
+ * No media source selected.
+ * EMediaCamera
+ * Camera selected
+ * EMediaCameraPri
+ * Primary camera selected.
+ * Camera is inwards
+ * EMediaCameraSec
+ * Secondary camera selected.
+ * Camera is outwards
+ * EMediaStillImage
+ * Still image as source.
+ * EMediaVideoStream
+ * Video stream selected.
+ */
+ enum TMediaSource
+ {
+ EMediaNone,
+ EMediaCamera,
+ EMediaCameraPri,
+ EMediaCameraSec,
+ EMediaStillImage,
+ EMediaVideoStream,
+ EMediaShare
+ };
+
+ /**
+ * EPrimaryCamera
+ * Primary camera is inwards faced.
+ * ESecondaryCamera
+ * Camera is facing outwards.
+ */
+ enum TCameraId
+ {
+ EPrimaryCamera,
+ ESecondaryCamera
+ };
+
+ /**
+ * Camera information (zoom mainly).
+ */
+ struct TCameraInfo
+ {
+ TInt iMinZoom;
+ TInt iMaxZoom;
+ TInt iMaxDigitalZoom;
+ TInt iMajorZoomStepCount;
+ };
+
+ /**
+ *
+ * Video quality enumeration.
+ *
+ * EVideoQualityUndefined video quality has not been set
+ * yet.
+ * EVideoQualityDetail means slow frame rate, good image
+ * quality..
+ * EVideoQualityNormal smoother video with somewhat lower
+ * image quality than EVideoQualityDetail.
+ * EVideoQualityMotion the smoothest video with the worst
+ * image quality.
+ */
+ enum TVideoQuality
+ {
+ EVideoQualityUndefined,
+ EVideoQualityDetail,
+ EVideoQualityNormal,
+ EVideoQualityMotion
+ };
+
+ /**
+ * Enumerates object sharing state.
+ *
+ * ENotAbleToShare Is not able to share any objects (engine in wrong
+ * state)
+ * ENotSharing Is not sharing anything
+ * EInitializingShareImage Initializing still image sharing.
+ * ESharingImage Is sharing image
+ * ESharingVideoClip Is sharing video clip
+ */
+ enum TShareObjectState
+ {
+ ENotAbleToShare,
+ ENotSharing,
+ EInitializingShareImage,
+ EInitializingShareVideoClip,
+ ESharingImage,
+ ESharingVideoClip
+ };
+
+ /**
+ * Defines layout (screen orientation) used by
+ * Video Telephone application per active camera.
+ * Each camera has one of the following values:
+ *
+ * EOrientationLandscape Layout is always landscape.
+ * EOrientationPortrait Layout is always portrait.
+ * EOrientationObeyLayoutSwitch Obey layout in specific device mode.
+ */
+ enum TCameraOrientation
+ {
+ EOrientationLandscape,
+ EOrientationPortrait,
+ EOrientationObeyLayoutSwitch
+ };
+
+ /**
+ * Command parameters for Image sharing.
+ */
+ typedef TFileName TShareObjectImageParameters;
+
+ /**
+ * Command parameters for Video Clip sharing.
+ */
+ typedef TFileName TShareObjectVideoClipParameters;
+
+ /**
+ * Parameters for Prepare Camera.
+ */
+ struct TPrepareCameraParams
+ {
+ TMediaSource iMediaSource;
+ TBool iInitialize;
+ };
+
+ /**
+ * Returns state of transmission local video/audio to remote end.
+ *
+ * @param aMediaDirection
+ * @param aActiveMedia returns active media as bitmap (see TMediaType).
+ * @return Symbian OS error code.
+ */
+ virtual TInt GetMediaState(
+ const TMediaDirection aMediaDirection,
+ TInt& aActiveMedia ) const = 0;
+
+ /**
+ * Returns active source for video transmission and
+ * local display.
+ * @param aSource source in return
+ * @return Symbian OS error code
+ */
+ virtual TInt GetSource( TMediaSource& aSource ) const = 0;
+
+ /**
+ * Returns source capabilities.
+ * @param combination of capability flags
+ * @return Symbian OS error code
+ */
+ virtual TInt GetSourcesCaps( TInt& aCaps ) const = 0;
+
+ /**
+ * Returns currently active camera.
+ * @param returns current camera id.
+ * @return Symbian OS error code.
+ * KErrNotReady if the engine is not ready or it's in wrong state,
+ * KErrInUse if camera is used by other application.
+ * Camera must be initialized, by async KVtEngPrepareCamera command or
+ * KVtEngSetSource command with camera parameter, in order to get
+ * KErrInUse indication.
+ */
+ virtual TInt GetCurrentCameraId( TCameraId& aId ) const = 0;
+
+ /**
+ * Returns camera information.
+ * @param aId camera to query information for.
+ * @param aInfo returns camera information
+ * @return Symbian OS error code. If camera is not
+ * available returns KErrNotFound.
+ */
+ virtual TInt GetCameraInfo(
+ const TCameraId aId,
+ TCameraInfo& aInfo ) const = 0;
+
+ /**
+ * Gets current zoom step
+ * @param aCurrentStep current zoom step
+ * @return Symbian OS error code.
+ */
+ virtual TInt GetCurrentZoomStep( TInt& aCurrentStep ) = 0;
+
+ /**
+ * Gets maximum zoom value that may be passed to camera.
+ * @param aMaxZoomStep maximum zoom step.
+ * @return Symbian OS error code.
+ */
+ virtual TInt GetMaxZoomStep( TInt& aMaxZoomStep ) = 0;
+
+ /**
+ * Gets number of major zoom level leaps.
+ * Less than or equal to maximum digital zoom steps.
+ * @param aCount number of leaps
+ * @return Symbian OS error code.
+ */
+ virtual TInt GetMajorZoomStepCount( TInt& aCount ) = 0;
+
+ /**
+ * Maps major zoom leap step to corresponding step index.
+ * @param aIndex major zoom step.
+ * @param aStep zoom step
+ */
+ virtual void GetMajorZoomStep( TInt aIndex, TInt& aStep ) = 0;
+
+ /**
+ * Gets freeze support status.
+ * @param aFreezeSupported ETrue if freeze is supported, EFalse otherwise.
+ * @return KErrNotReady if provider is not ready yet.
+ * @since S60 3.1
+ */
+ virtual TInt GetFreezeSupported( TBool& aFreezeSupported ) const = 0;
+
+ /**
+ * Gets freeze current status.
+ * @param aFreezeSupported ETrue if active provider is frozen, EFalse otherwise.
+ * @return KErrNotReady if provider is not ready yet.
+ * @since S60 3.1
+ */
+ virtual TInt GetFreezeState( TBool& aFrozen ) const = 0;
+
+ /**
+ * Returns state of DSA drawing, whether is active or not.
+ * @param aMediaDirection in or out direction
+ * @param aState returns state of Direct Screen Access
+ * @return Symbian OS error code
+ */
+ virtual TInt GetDsaState(
+ const TMediaDirection aMediaDirection,
+ TBool& aActive ) const = 0;
+
+ /**
+ * Returns state of VideoCall, whether is connected or not.
+ * @return state
+ */
+ virtual TBool VideoCallConnected () const = 0;
+
+ /**
+ * Returns ETrue if rendering has been started.
+ *
+ * @param aDirection specifies the rendering direction to check
+ * @return ETrue if rendering has been started.
+ */
+ virtual TBool RenderingStarted( const TMediaDirection
+ aDirection ) const = 0;
+
+ /**
+ * Gets current local video quality setting.
+ * @param aVideoQuality Current local video quality settings.
+ * @since S60 3.1
+ */
+ virtual void GetVideoQuality( TVideoQuality& aVideoQuality ) const = 0;
+
+ /**
+ * Gets current object sharing state.
+ * @param aObjectSharingState On return contains current object sharing
+ * state. @see MVtEngMedia::TShareObjectState.
+ * @since S60 3.1
+ */
+ virtual void GetObjectSharingState(
+ TShareObjectState& aObjectSharingState ) const = 0;
+
+ /**
+ * Gets camera orientations for primary and secondary camera.
+ * @see MVtEngMedia::TCameraOrientation
+ * @param aPrimaryCameraOrientation priamry camera orientation.
+ * @param aSecondaryCameraOrientation secondary camera orientation.
+ */
+ virtual void GetCameraOrientations(
+ TCameraOrientation& aPrimaryCameraOrientation,
+ TCameraOrientation& aSecondaryCameraOrientation ) const = 0;
+ };
+
+#endif // MVTENGMEDIA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfig.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIG_H
+#define TVTENGRENDERCONFIG_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class RWindow;
+
+
+// CLASS DECLARATION
+
+/**
+* Configuration for representation of local or remote video.
+* Used only internally.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+struct TVtEngRenderConfig
+ {
+ public: // enumerations
+
+ /**
+ * Indication of type of rendering specified by configuration.
+ * EWsRender fields applicable for window server are valid
+ * EDsaRender fields applicable for DSA are valid
+ */
+ enum TRenderType
+ {
+ EWsRender,
+ EDsaRender,
+ EDpRender,
+ ENgaRender
+ };
+
+ public: // data
+ RWindow* iRemoteWindow;
+
+ RWsSession* iWsSession;
+ CWsScreenDevice* iWsSreenDevice;
+ RWindowBase* iWindow;
+
+ MVtEngFrameObserver* iObserver;
+ TRect iRect;
+ TRect iClipRect;
+ TPoint iOffset;
+ TRenderType iType;
+ };
+
+#endif // TVTENGRENDERCONFIG_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIGDP_H
+#define TVTENGRENDERCONFIGDP_H
+
+// INCLUDES
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingDP.h"
+#include <Posting_Surface.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Configuration for representation of local or remote video.
+* Used only internally.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigDP ) : public TVtEngRenderConfig
+ {
+public: // new functions
+
+ TVtEngRenderConfigDP();
+
+ TVtEngRenderConfigDP( const TVtEngRenderingOptionsDP& aOptions );
+
+ TVtEngRenderConfigDP& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data
+ // Background color value. This color is filled to areas that are not
+ // covered by the image.
+ TUint iBackGround;
+ };
+
+#include "TVtEngRenderConfigDP.inl"
+
+#endif // TVTENGRENDERCONFIGDP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP::TVtEngRenderConfigDP()
+ {
+ Mem::FillZ( this, sizeof( TVtEngRenderConfigDP ) );
+ iType = EDpRender;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP::TVtEngRenderConfigDP(
+ const TVtEngRenderingOptionsDP& aOptions )
+ {
+ iType = EDpRender;
+ iWsSession = &aOptions.iWs;
+ iWsSreenDevice = &aOptions.iWsSD;
+ iWindow = &aOptions.iWindow;
+ iObserver = aOptions.iObserver;
+ iRect = aOptions.iRect;
+ iClipRect = aOptions.iClipRect;
+ iOffset = aOptions.iOffset;
+ iBackGround = 0;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::operator=
+//
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP& TVtEngRenderConfigDP::operator=(
+ const TVtEngRenderConfig& aConfig )
+ {
+ iWsSession = aConfig.iWsSession;
+ iWsSreenDevice = aConfig.iWsSreenDevice;
+ iWindow = aConfig.iWindow;
+ iObserver = aConfig.iObserver;
+ iRect = aConfig.iRect;
+ iClipRect = aConfig.iClipRect;
+ iOffset = aConfig.iOffset;
+ iType = aConfig.iType;
+ return *this;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIGDSA_H
+#define TVTENGRENDERCONFIGDSA_H
+
+// INCLUDES
+#include <e32std.h>
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingDSA.h"
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Configuration for representation of local or remote video.
+* Used only internally.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigDSA ) : public TVtEngRenderConfig
+ {
+public: // new functions
+
+ TVtEngRenderConfigDSA();
+
+ TVtEngRenderConfigDSA( const TVtEngRenderingOptionsDSA& aOptions );
+
+ TVtEngRenderConfigDSA& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data
+ };
+
+#include "TVtEngRenderConfigDSA.inl"
+
+#endif // TVTENGRENDERCONFIGDSA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::TVtEngRenderConfigDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA::TVtEngRenderConfigDSA()
+ {
+ Mem::FillZ( this, sizeof( TVtEngRenderConfigDSA ) );
+ iType = EDsaRender;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::TVtEngRenderConfigDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA::TVtEngRenderConfigDSA(
+ const TVtEngRenderingOptionsDSA& aOptions )
+ {
+ iType = EDsaRender;
+ iWsSession = &aOptions.iWs;
+ iWsSreenDevice = &aOptions.iWsSD;
+ iWindow = &aOptions.iWindow;
+ iObserver = aOptions.iObserver;
+ iRect = aOptions.iRect;
+ iClipRect = aOptions.iClipRect;
+ }
+
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::operator=
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA& TVtEngRenderConfigDSA::operator=(
+ const TVtEngRenderConfig& aConfig )
+ {
+ iWsSession = aConfig.iWsSession;
+ iWsSreenDevice = aConfig.iWsSreenDevice;
+ iWindow = aConfig.iWindow;
+ iObserver = aConfig.iObserver;
+ iRect = aConfig.iRect;
+ iClipRect = aConfig.iClipRect;
+ iOffset = aConfig.iOffset;
+ iType = aConfig.iType;
+ return *this;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2004-2006 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: Class for NGA render configuration.
+*
+*/
+
+
+#ifndef TVTENGRENDERCONFIGNGA_H
+#define TVTENGRENDERCONFIGNGA_H
+
+// INCLUDES
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingNGA.h"
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Configuration for representation of local or remote video.
+* Used only internally.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigNGA ) : public TVtEngRenderConfig
+ {
+public: // new functions
+
+ TVtEngRenderConfigNGA();
+
+ TVtEngRenderConfigNGA( const TVtEngRenderingOptionsNGA& aOptions );
+
+ TVtEngRenderConfigNGA& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data
+ };
+
+#include "TVtEngRenderConfigNGA.inl"
+
+#endif // TVTENGRENDERCONFIGNGA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2004-2006 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: Inline implementation for TVtEngRenderConfigNGA.
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigNGA::TVtEngRenderConfigNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA::TVtEngRenderConfigNGA()
+ {
+ Mem::FillZ( this, sizeof( TVtEngRenderConfigNGA ) );
+ iType = ENgaRender;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA::TVtEngRenderConfigNGA(
+ const TVtEngRenderingOptionsNGA& aOptions )
+ {
+ iType = ENgaRender;
+ iWsSession = &aOptions.iWs;
+ //iWsSreenDevice = &aOptions.iWsSD;
+ //iWindow = &aOptions.iWindow;
+ //iObserver = aOptions.iObserver;
+ //iRect = aOptions.iRect;
+ //iClipRect = aOptions.iClipRect;
+ //iOffset = aOptions.iOffset;
+ iRemoteWindow = &aOptions.iWindow;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::operator=
+//
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA& TVtEngRenderConfigNGA::operator=(
+ const TVtEngRenderConfig& aConfig )
+ {
+ iWsSession = aConfig.iWsSession;
+ // iWsSreenDevice = aConfig.iWsSreenDevice;
+ // iWindow = aConfig.iWindow;
+ iObserver = aConfig.iObserver;
+ // iRect = aConfig.iRect;
+ //iClipRect = aConfig.iClipRect;
+ // iOffset = aConfig.iOffset;
+ iType = aConfig.iType;
+ iRemoteWindow = aConfig.iRemoteWindow;
+ return *this;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRendering.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERING_H
+#define TVTENGRENDERING_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Configuration for representation of local or remote video
+* via window server.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptions )
+ {
+ public: // constructor
+
+ /**
+ * C++ constructor
+ */
+ inline TVtEngRenderingOptions(
+ MVtEngFrameObserver& aObserver,
+ TSize aRect );
+
+ /**
+ * copy constructor
+ */
+ inline TVtEngRenderingOptions( const TVtEngRenderingOptions& aOptions );
+
+ private:
+ TVtEngRenderingOptions& operator=( const TVtEngRenderingOptions& );
+
+ public:
+ // Frame observer
+ MVtEngFrameObserver* iObserver;
+
+ // Bitmap size
+ TSize iSize;
+ };
+
+#include <tvtengrendering.inl>
+
+#endif // TVTENGRENDERING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRendering.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptions::TVtEngRenderingOptions
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptions::TVtEngRenderingOptions(
+ MVtEngFrameObserver& aObserver,
+ TSize aSize ) :
+ iObserver( &aObserver ),
+ iSize( aSize)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptions::TVtEngRenderingOptions
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptions::TVtEngRenderingOptions(
+ const TVtEngRenderingOptions& aOptions ) :
+ iObserver( aOptions.iObserver ),
+ iSize( aOptions.iSize )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERINGDP_H
+#define TVTENGRENDERINGDP_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Display posting access rendering definitions.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsDP )
+ {
+ public: // constructor
+
+ /**
+ * C++ constructor
+ */
+ inline TVtEngRenderingOptionsDP(
+ MVtEngFrameObserver& aObserver,
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ const TRect& aScreenRect,
+ const TRect& aClipRect,
+ const TPoint& aOffset );
+
+ /**
+ * C++ copy constructor.
+ * @param aOptions options to be copied to this instance.
+ */
+ inline TVtEngRenderingOptionsDP(
+ const TVtEngRenderingOptionsDP& aOptions );
+
+ private:
+ TVtEngRenderingOptionsDP& operator=(
+ const TVtEngRenderingOptionsDP& );
+
+ public: // data members
+ RWsSession& iWs;
+ CWsScreenDevice& iWsSD;
+ RWindowBase& iWindow;
+ TRect iRect;
+ TRect iClipRect;
+ TPoint iOffset;
+
+ // Frame observer
+ MVtEngFrameObserver* iObserver;
+ };
+
+#include <tvtengrenderingdp.inl>
+
+#endif // TVTENGRENDERINGDP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP(
+ MVtEngFrameObserver& aObserver,
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ const TRect& aScreenRect,
+ const TRect& aClipRect,
+ const TPoint& aOffset ) :
+ iWs( aWs ),
+ iWsSD( aScreenDevice ),
+ iWindow( aWindow ),
+ iRect( aScreenRect ),
+ iClipRect( aClipRect ),
+ iOffset( aOffset ),
+ iObserver( &aObserver )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDP
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP(
+ const TVtEngRenderingOptionsDP& aOptions )
+ : iWs( aOptions.iWs ),
+ iWsSD( aOptions.iWsSD ),
+ iWindow( aOptions.iWindow ),
+ iRect( aOptions.iRect ),
+ iClipRect( aOptions.iClipRect ),
+ iOffset( aOptions.iOffset ),
+ iObserver( aOptions.iObserver )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+#ifndef TVTENGRENDERINGDSA_H
+#define TVTENGRENDERINGDSA_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+* Direct screen access rendering definitions.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsDSA )
+ {
+ public: // constructor
+
+ /**
+ * C++ constructor
+ */
+ inline TVtEngRenderingOptionsDSA(
+ MVtEngFrameObserver& aObserver,
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ const TRect& aScreenRect,
+ const TRect& aClipRect );
+
+ /**
+ * C++ copy constructor.
+ * @param aOptions options to be copied to this instance.
+ */
+ inline TVtEngRenderingOptionsDSA(
+ const TVtEngRenderingOptionsDSA& aOptions );
+
+ private:
+ TVtEngRenderingOptionsDSA& operator=(
+ const TVtEngRenderingOptionsDSA& );
+
+ public: // data members
+ RWsSession& iWs;
+ CWsScreenDevice& iWsSD;
+ RWindowBase& iWindow;
+ TRect iRect;
+ TRect iClipRect;
+
+ // Frame observer
+ MVtEngFrameObserver* iObserver;
+ };
+
+#include <tvtengrenderingdsa.inl>
+
+#endif // TVTENGRENDERINGDSA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2006 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA(
+ MVtEngFrameObserver& aObserver,
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ const TRect& aScreenRect,
+ const TRect& aClipRect ) :
+ iWs( aWs ),
+ iWsSD( aScreenDevice ),
+ iWindow( aWindow ),
+ iRect( aScreenRect ),
+ iClipRect( aClipRect ),
+ iObserver( &aObserver )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA(
+ const TVtEngRenderingOptionsDSA& aOptions )
+ : iWs( aOptions.iWs ),
+ iWsSD( aOptions.iWsSD ),
+ iWindow( aOptions.iWindow ),
+ iRect( aOptions.iRect ),
+ iClipRect( aOptions.iClipRect ),
+ iObserver( aOptions.iObserver )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2004-2006 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: Class for NGA Rendering.
+*
+*/
+
+#ifndef TVTENGRENDERINGNGA_H
+#define TVTENGRENDERINGNGA_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWindow;
+class RWsSession;
+// CLASS DECLARATION
+
+/**
+* Direct screen access rendering definitions.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsNGA )
+ {
+ public: // constructor
+
+ /**
+ * C++ constructor
+ */
+ inline TVtEngRenderingOptionsNGA(
+ RWindow& aWindow, RWsSession& aWs );
+
+ /**
+ * C++ copy constructor.
+ * @param aOptions options to be copied to this instance.
+ */
+ inline TVtEngRenderingOptionsNGA(
+ const TVtEngRenderingOptionsNGA& aOptions );
+
+ private:
+ TVtEngRenderingOptionsNGA& operator=(
+ const TVtEngRenderingOptionsNGA& );
+
+ public: // data members
+ RWindow& iWindow;
+
+ RWsSession& iWs;
+ };
+
+#include <tvtengrenderingnga.inl>
+
+#endif // TVTENGRENDERINGNGA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2004-2006 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: Inline implementation for TVtEngRenderingOptionsNGA
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA(
+ RWindow& aWindow, RWsSession& aWs) :
+ iWindow( aWindow ),
+ iWs( aWs )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA(
+ const TVtEngRenderingOptionsNGA& aOptions )
+ : iWindow( aOptions.iWindow ),
+ iWs( aOptions.iWs)
+ {
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/CVtEngSessionHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 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: Video session interface.
+*
+*/
+
+
+
+#ifndef CVTENGSESSIONHANDLER_H
+#define CVTENGSESSIONHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include "MVtEngSessionInfo.h"
+#include "MVtCtlEventObserver.h"
+#include "MVtCtlCallControl.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+class CVtCtlFactory;
+class CVtEngOperation;
+class CVtEngIncomingCallMonitor;
+// CLASS DECLARATION
+
+/**
+* Abstraction for video telephony session with remote end.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngSessionHandler ) :
+ public CActive,
+ public MVtEngSessionInfo,
+ public MVtCtlEventObserver
+ {
+ public: // constructor and destructors
+
+ static CVtEngSessionHandler* NewL( );
+
+ virtual ~CVtEngSessionHandler();
+
+ public: // New functions
+
+ /**
+ * Performs on operation in the handler.
+ * @param operation to be performed on the handler
+ */
+ void HandleL( CVtEngOperation& aOperation );
+
+ public: // from MVtEngSessionInfo
+
+ /**
+ * Gets session state.
+ * @return
+ */
+ virtual TSessionState State( TBool aForcedRefresh ) const;
+
+ /**
+ * Gets session direction.
+ * @return
+ */
+ virtual TInt GetDirection( TDirection& aDirection ) const;
+
+ /**
+ * Gets session duration.
+ * @param
+ * @param
+ */
+ virtual TInt GetDuration(
+ TDuration& aDuration,
+ TBool& aEnabled ) const;
+
+ /*
+ * @see MVtEngSessionInfo::aCLI
+ */
+ virtual TInt GetCLI( TCLI& aCLI ) const;
+
+ public: // From MVtCtlEventObserver
+ virtual void HandleVtSessionEventL(
+ TVtCtlEvent aEvent,
+ TAny* aParams );
+
+ public: // new functions
+ /**
+ * Initializes session handler.
+ */
+ void InitializeL();
+
+ /**
+ * Frees resources used by session handler.
+ */
+ void Uninitialize();
+
+ MVtCtlCallControl::TVtCtlState RealState() const;
+
+ /**
+ * Starts Incoming call PS key monitoring
+ */
+ void StartIncomingCallMonitorL();
+
+ private: // constructors
+
+ void ConstructL();
+
+ CVtEngSessionHandler( );
+
+ private: // from CActive
+ void RunL();
+
+ void DoCancel();
+
+ private: // Member data
+ MVtCtlCallControl* iSessionControl;
+ CVtCtlFactory* iFactory;
+
+ RLibrary iLib;
+
+ CVtEngIncomingCallMonitor* iIncomingCallMonitor;
+ };
+
+
+#endif // CVTENGSESSIONHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/MVtEngDtmfHandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2004 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: DTMF handler interface for DTMF states and media
+* handler to use.
+*
+*/
+
+
+
+#ifndef MVTENGDTMFHANDLER_H
+#define MVTENGDTMFHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+
+// DATA TYPES
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+class TVtEngDtmfTone;
+class MVTUserInput;
+class CVtEngDtmfState;
+
+// CLASS DECLARATION
+
+/**
+* Base class for data types
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngDtmfHandler
+ {
+ public: //
+ /**
+ * Dtmf states
+ */
+ enum TVtEngDtmfState
+ {
+ // Not sending DTMF
+ EVtDtmfStateIdle = 0,
+ // Sending DTMF
+ EVtDtmfStateSending,
+ // Sending DTMF, another waiting in buffer
+ EVtDtmfStateBuffered
+ };
+
+ public:
+
+ /**
+ * Handles a DTMF command.
+ * @param
+ */
+ virtual void HandleL( CVtEngOperation& aOp ) = 0;
+
+ /**
+ * Activates a DTMF state.
+ * @param aNewState state index
+ * @return activated state
+ */
+ virtual CVtEngDtmfState& ActivateState(
+ MVtEngDtmfHandler::TVtEngDtmfState aNewState ) = 0;
+
+ /**
+ * Handles completion of DTMF sending, non-leavable method.
+ * @param aError Symbian OS error code
+ */
+ virtual void SendComplete( TInt aError ) = 0;
+
+ /**
+ * Returns new instance used for sending DTMF tone to protocol
+ * @param aTone tone to send
+ * @return protocol DTMF tone.
+ */
+ virtual MVTUserInput& ReserveProtoDtmfL(
+ const TVtEngDtmfTone& aTone ) = 0;
+
+ /**
+ * Releses protocol DTMF instance.
+ */
+ virtual void ReleaseProtoDtmf() = 0;
+
+ /**
+ * Compares last issued DTMF command ID to given command ID.
+ * @param aCheckCommandId command ID to be compared against
+ * @return ETrue if IDs are same, otherwise EFalse
+ */
+ virtual TBool CheckCommandId( TInt aCheckCommandId ) const = 0 ;
+
+ /**
+ * Stores command ID, used in CheckCommandID.
+ * @param aStoreCommandId command ID to be stored.
+ */
+ virtual void StoreCommandId( TInt aStoreCommandId ) = 0;
+ };
+
+#endif MVTENGDTMFHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/MVtEngSessionInfo.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006 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: Video session interface.
+*
+*/
+
+
+
+#ifndef MVTENGSESSIONINFO_H
+#define MVTENGSESSIONINFO_H
+
+// INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Abstraction for video telephony session with remote end.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class MVtEngSessionInfo
+ {
+ public: //
+
+ /**
+ * Session state
+ * EIdle Session not established.
+ * EInitializing Initializing MO session
+ * ERemoteAlerting Remote end is alerting
+ * EReceiving Incoming session request from network
+ * EConnected Connection to peer is established.
+ * ENegotiating Handshaking with peer.
+ * EOpen Session active and media channels are open.
+ * EClearing Clearing connection.
+ */
+ enum TSessionState
+ {
+ EUnknown = -1,
+ EIdle,
+ EInitializing,
+ ERemoteAlerting,
+ EReceiving,
+ EConnected,
+ ENegotiating,
+ EOpen,
+ EClearing
+ };
+
+ typedef TTimeIntervalSeconds TDuration;
+
+ /**
+ * Session direction
+ * EDirectionNone In idle there's no direction .
+ * EDirectionMO Mobile originated sesison
+ * EDirectionMT Mobile terminated session
+ */
+ enum TDirection
+ {
+ EDirectionNone,
+ EDirectionMO,
+ EDirectionMT
+ };
+
+ enum { KCallNameLength = 50 };
+ enum { KCallNumberLength = 50 };
+
+ typedef TBuf<KCallNameLength> TCallName;
+
+ typedef TBuf<KCallNumberLength> TCallNumber;
+
+ /**
+ * CLI data related to a call
+ */
+ struct TCLI {
+ // call id of the call
+ TInt iCallId;
+
+ // caller name
+ TCallName iName;
+
+ // indicates if voice call can be made to peer
+ TBool iVoiceCallPossible;
+
+ TCallNumber iCallNumber;
+ };
+
+ /**
+ * Returns session state
+ * @aForcedRefresh if ETrue current state is forced to update.
+ * Should be EFalse when called in frequently because forced
+ * refresh is more time consuming (requires context switch)
+ * @return
+ */
+ virtual TSessionState State( TBool aForcedRefresh ) const = 0;
+
+ /**
+ *
+ * @return direction
+ */
+ virtual TInt GetDirection( TDirection& aDirection ) const = 0;
+
+ /**
+ *
+ * @param
+ * @param aEnabled
+ */
+ virtual TInt GetDuration(
+ TDuration& aDuration,
+ TBool& aEnabled ) const = 0;
+
+
+ virtual TInt GetCLI( TCLI& aCLI ) const = 0;
+ };
+
+
+#endif // TVTENGSESSIONINFO_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004 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: Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGDTMFTONE_H
+#define TVTENGDTMFTONE_H
+
+// INCLUDES
+#include "TVtEngType.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Abstraction for DTMF tone
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class TVtEngDtmfTone : public TVtEngtType
+ {
+ public: // constructor
+
+ /**
+ * C++ constructor
+ */
+ TVtEngDtmfTone( const TChar& aTone );
+
+ public:
+ // Tone
+ TChar iTone;
+ };
+#include "TVtEngDtmfTone.inl"
+
+#endif // TVTENGDTMFTONE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2004 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: Inline methods for TVtEngDtmfTone
+*
+*/
+
+
+
+inline TVtEngDtmfTone::TVtEngDtmfTone( const TChar& aTone )
+: TVtEngtType( EVtEngTypeDtmf ) { iTone = aTone; }
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngDtmfState.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2006 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: DTMF state classes.
+*
+*/
+
+
+
+#ifndef CVTENGDTMFSTATE_H
+#define CVTENGDTMFSTATE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mvtprotocolhandler.h>
+#include "TVtEngDtmfTone.h"
+#include "MVtEngDtmfHandler.h"
+
+
+
+// CLASS DECLARATION
+
+/**
+* Base class for DTMF states.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfState ) : public CBase
+ {
+ public:
+ /**
+ * C++ constructor.
+ * @param aDtmfHandler
+ * @param aH324Config H324 configure interface
+ */
+ CVtEngDtmfState(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ public: // new methods
+
+ /**
+ * Sends a DTMF tone. Derived classes implement this
+ * and each vary in behavior.
+ * @param aTone tone to send
+ */
+ virtual void SendDtmfL( const TVtEngDtmfTone& aTone ) = 0;
+
+ /**
+ * Handles callback about DTMF sending. Releases pv2way dtmf instance.
+ * @param aError Symbian OS error code
+ */
+ virtual void DtmfSendCompleteL( TInt aError );
+
+ protected: // new methods
+ /**
+ * Sends tone and changes state
+ * @param aDtmf tone to send
+ * @param aNewState new DTMF state
+ */
+ void DoSendAndActivateStateL(
+ const TVtEngDtmfTone& aDtmf,
+ MVtEngDtmfHandler::TVtEngDtmfState aNewState );
+
+ protected: // member data
+
+ // DTMF handler
+ MVtEngDtmfHandler& iDtmfHandler;
+
+ // H324 configure interface
+ MVtH324ConfigCommand& iH324Config;
+ };
+
+/**
+* Idle DTMF state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfIdle ) : public CVtEngDtmfState
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aDtmfHandler
+ * @param aH324Config H324 configure interface
+ */
+ static CVtEngDtmfState* NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngDtmfIdle();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Sends DTMF tone and changes state to "sending".
+ * @param aTone tone to send
+ */
+ virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+ /**
+ * @see CVtEngDtmfState
+ */
+ virtual void DtmfSendCompleteL( TInt aError );
+
+ private: // constructors
+
+ /**
+ * C++ constructor.
+ * @param aDtmfHandler
+ * @param aH324Config H324 configure interface
+ */
+ CVtEngDtmfIdle(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+ };
+
+/**
+* Sending DTMF state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfSending ) : public CVtEngDtmfState
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aDtmfHandler
+ * @param aH324Config H324 configure interface
+ */
+ static CVtEngDtmfState* NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngDtmfSending();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Changes state to "buffered".
+ * @param aTone tone to send
+ */
+ virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+ /**
+ * @see CVtEngDtmfState
+ */
+ virtual void DtmfSendCompleteL( TInt aError );
+
+ private: // constructor
+
+ /**
+ * C++ constructor.
+ * @param aDtmfHandler
+ * @param aH324Config
+ */
+ CVtEngDtmfSending(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ };
+
+/**
+* Buffered DTMF state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfBuffered ) : public CVtEngDtmfState
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aDtmfHandler
+ * @param aH324Config H324 configure interface
+ */
+ static CVtEngDtmfState* NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngDtmfBuffered();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Buffers DTMF tone that is sent when previous
+ * tones in buffer are sent.
+ * @param aTone tone that is added to the buffer
+ */
+ virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+ /**
+ * @see CVtEngDtmfState
+ */
+ virtual void DtmfSendCompleteL( TInt aError );
+
+ private: // constructors
+
+ /**
+ * C++ constructor.
+ * @param aDtmfHandler
+ * @param aH324Config
+ */
+ CVtEngDtmfBuffered(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Member data
+
+ // Buffered DTMF tones.
+ CArrayFixFlat<TVtEngDtmfTone>* iTones;
+ };
+
+#endif // CVTENGDTMFSTATE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateAlerting.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006 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: Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATEALERTING_H
+#define CVTENGSTATEALERTING_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+//#include <?include_file>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Alerting state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateAlerting ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateAlerting(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateAlerting();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ virtual TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ *
+ */
+ virtual TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Handles state transition to alerting.
+ */
+ void DoOpenL();
+
+
+
+ };
+
+#endif // CVTENGSTATEALERTING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateBase.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2006 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: Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATEBASE_H
+#define CVTENGSTATEBASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngMediaHandler.h"
+#include "CVtEngSessionHandler.h"
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+
+// FORWARD DECLARATIONS
+class CVtEngSessionHandler;
+class CVtEngMediaHandler;
+class CVtEngAudioHandler;
+
+// CLASS DECLARATION
+
+/**
+* State base class
+
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateBase ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateBase();
+
+ public: // New functions
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL() = 0;
+
+ /**
+ * Checks if a command is valid in current state.
+ * @param aCommandId command to be validated
+ * @return ETrue if command is valid.
+ */
+ virtual TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * Handles an operation. Base class method is empty
+ * and derived classes may handle the operation if applicable.
+ * @param aOp operation to be handled
+ * @return ETrue if handled
+ */
+ virtual TBool HandleL( CVtEngOperation& aOp );
+
+ /**
+ * Returns session handler.
+ * @return reference to session handler
+ */
+ CVtEngSessionHandler& SessionHandler();
+
+ /**
+ * Returns media handler.
+ * @return reference to media handler
+ */
+ CVtEngMediaHandler& MediaHandler();
+
+ /**
+ * Returns audio handler.
+ * @return reference to audio handler
+ */
+ CVtEngAudioHandler& AudioHandler();
+
+ /**
+ * Creates new state if needed.
+ * @return new state or NULL
+ */
+ CVtEngStateBase* NewStateL(
+ const MVtEngSessionInfo::TSessionState aState );
+
+ virtual MVtEngSessionInfo::TSessionState State() const = 0;
+
+ public: // New functions
+
+ /**
+ * Sets new current state.
+ * @param aOldState old state.
+ */
+ void OpenL( CVtEngStateBase* aOldState );
+
+ /**
+ * For derived classes to handle state change
+ */
+ virtual void DoOpenL( ) = 0;
+
+
+ /**
+ * State uninitialization.
+ */
+ virtual void Close();
+
+ protected: // new functions
+
+ /**
+ * Saves configuration to settings for later
+ * usage.
+ */
+ void SaveToSettingsL( CVtEngOperation& aOp );
+
+ /**
+ * Notifies state change to event manager.
+ * @param aNewState new session state.
+ */
+ void NotifyStateChange( MVtEngSessionInfo::TSessionState aNewState );
+
+ /**
+ * Saves video state to settings. Used e.g. when video can not be
+ * started in current state.
+ * @param aEnabled video is enabled
+ */
+ void SetVideoEnabled( TBool aEnabled );
+
+ /**
+ * Goes to disconnecting or idle state if needed.
+ * @return state object if transition is required.
+ */
+ //CVtEngStateBase* DisconnectingOrIdleStateL();
+
+ /**
+ * Creates negotiating state if bearer state is connected
+ * and pv state is ESetup, and UI has indicated state changte
+ * is permitted.
+ * @return negotiating state object or NULL
+ */
+ CVtEngStateBase* NegotiatingOrConnectedStateL(
+ TBool aAcceptOnlyNegotiating = EFalse );
+
+
+ /**
+ * Saves video state to settings. Used e.g. when video can not be
+ * started in current state.
+ * @param aEnabled video is enabled
+ */
+ void TerminateSessionL( CVtEngOperation& aOp );
+
+ protected:
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateBase(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+ protected: // Data
+ // State manager
+ CVtEngStateManager& iStateManager;
+
+ // Event manager
+ CVtEngEventManager& iEventManager;
+
+ private:
+ };
+
+#endif // CVTENGSTATEBASE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateClearing.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 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: Clearing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATECLEARING_H
+#define CVTENGSTATECLEARING_H
+
+// INCLUDES
+
+#include "CVtEngStateBase.h"
+
+/**
+* Clearing state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateClearing ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateClearing(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateClearing();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ * @see CVtEngStateBase::HandleL
+ */
+ TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Handles state transition to clearing.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATECLEARING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateConnected.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2006 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: Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATECONNECTED_H
+#define CVTENGSTATECONNECTED_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Clearing state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateConnected ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateConnected(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateConnected();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ * @see CVtEngStateBase::HandleL
+ */
+ TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Handles state transition to connected.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATECONNECTED_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateIdle.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2006 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: Idle state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEIDLE_H
+#define CVTENGSTATEIDLE_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Idle state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateIdle ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateIdle(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateIdle();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ private:
+
+ /**
+ * Handles state transition to idle.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATEIDLE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateInitializing.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2006 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: Initializing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEINITIALIZING_H
+#define CVTENGSTATEINITIALIZING_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Initializing state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateInitializing ): public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateInitializing(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateInitializing();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ * @see CVtEngStateBase::HandleL
+ */
+ TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Handles state transition to initializing.
+ */
+ void DoOpenL();
+ };
+
+#endif // CVTENGSTATEINITIALIZING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateManager.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2006 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: State manager for session and audio routing states.
+*
+*/
+
+
+
+#ifndef CVTENGSTATEMANAGER_H
+#define CVTENGSTATEMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+#include "MVtEngSessionInfo.h"
+// FORWARD DECLARATIONS
+class CVtEngStateBase;
+class CVtEngHandlerContainer;
+class CVtEngEventManager;
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+* Owner of engine states. Delegates update request
+* to active state when requested. Provides method
+* to enquire command availability in current state.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateManager ): public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtEngStateManager* NewL(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngEventManager& aEventManager );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateManager();
+
+ public: // New functions
+
+ /**
+ * Requests updates for current state.
+ */
+ void Update( );
+
+ /**
+ * Checks if a command is possible in current state
+ * @param aCommandId command to check
+ * @return ETrue if command can be performed
+ */
+ TBool IsCommandPossible(
+ const TVtEngCommandId aCommandId ) const;
+
+ /**
+ * Sets new session state.
+ * @param aNewState new session state
+ */
+ void SetState( CVtEngStateBase& aNewState );
+
+ /**
+ * Passes an operation to current state for
+ * handling.
+ * @param aOp operation to be handled
+ * @return ETrue if operation handled
+ */
+ TBool HandleOperationL( CVtEngOperation& aOp );
+
+ /**
+ * Previous session state.
+ */
+ MVtEngSessionInfo::TSessionState PreviousSessionState() const;
+
+ /**
+ * Current session state.
+ */
+ MVtEngSessionInfo::TSessionState SessionState() const;
+
+ /**
+ * Returns handler container.
+ * @return handler container
+ */
+ inline CVtEngHandlerContainer& Handlers();
+
+ /**
+ * Returns event manager.
+ * @return event manager
+ */
+ inline CVtEngEventManager& EventManager();
+
+ private:
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateManager(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngEventManager& aEventManager );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Data
+ // Previous session state
+ MVtEngSessionInfo::TSessionState iPreviousSessionState;
+
+ // Current session state
+ CVtEngStateBase* iSessionState;
+
+ // Handler container
+ CVtEngHandlerContainer& iHandlers;
+
+ // Event manager
+ CVtEngEventManager& iEventManager;
+
+ };
+
+#include "CVtEngStateManager.inl"
+
+#endif // CVTENGSTATEMANAGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateManager.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 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: State manager inline methods.
+*
+*/
+
+
+// MEMBER FUNCTIONS
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::Handlers
+// Return handler container.
+//
+// -----------------------------------------------------------------------------
+//
+inline CVtEngHandlerContainer& CVtEngStateManager::Handlers()
+ { return iHandlers; }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::EventManager
+// Return event manager.
+//
+// -----------------------------------------------------------------------------
+//
+inline CVtEngEventManager& CVtEngStateManager::EventManager()
+ { return iEventManager; }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateNegotiating.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006 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: Negotiating state
+*
+*/
+
+
+
+#ifndef CVTENGSTATENEGOTIATING_H
+#define CVTENGSTATENEGOTIATING_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Negotiatimg state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateNegotiating ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateNegotiating(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateNegotiating();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Handles state transition to negotiating.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATENEGOTIATING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateOpen.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 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: Open state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEOPEN_H
+#define CVTENGSTATEOPEN_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Open state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateOpen ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateOpen(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateOpen();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ /**
+ * @see CVtEngStateBase::HandleL
+ */
+ TBool HandleL( CVtEngOperation& aOp );
+
+ private:
+
+ /**
+ * Changes audio routing
+ * @param aOp audio routing or null if value should
+ * be read from settings
+ */
+ void RouteAudioL(
+ CVtEngOperation* aOp );
+
+ /**
+ * Uses extension framework to complete
+ * from operation.
+ * @since S60 v3.2
+ * @param aOp audio routing or null
+ */
+ void CallExtensionL( CVtEngOperation* aOp );
+
+ private:
+
+ /**
+ * Handles state transition to open.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATEOPEN_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateRinging.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2006 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: Ringing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATERINGING_H
+#define CVTENGSTATERINGING_H
+
+// INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+* Ringing state class
+*
+* @lib videoteleng
+* @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateRinging ) : public CVtEngStateBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ */
+ CVtEngStateRinging(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager );
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtEngStateRinging();
+
+ public: // From CVtEngStateBase
+
+ /**
+ * Updates state. May result to state transition
+ */
+ virtual void UpdateL();
+
+ /**
+ * Validates a command.
+ */
+ TBool ValidateCommand(
+ const TVtEngCommandId aCommandId );
+
+ /**
+ * @see CVtEngStateBase
+ */
+ virtual MVtEngSessionInfo::TSessionState State() const;
+
+ private:
+
+ /**
+ * Handles state transition to ringing.
+ */
+ void DoOpenL();
+
+ };
+
+#endif // CVTENGSTATERINGING_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Bmarm/VTLOGGERU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+ Initialize__9CVtLogger @ 1 NONAME R3UNUSED ; CVtLogger::Initialize(void)
+ Print__9CVtLoggeriG7TPtrC16 @ 2 NONAME ; CVtLogger::Print(int, TPtrC16)
+ Print__9CVtLoggeriG7TPtrC16i @ 3 NONAME ; CVtLogger::Print(int, TPtrC16, int)
+ Print__9CVtLoggeriG7TPtrC16ii @ 4 NONAME ; CVtLogger::Print(int, TPtrC16, int, int)
+ Uninitialize__9CVtLogger @ 5 NONAME R3UNUSED ; CVtLogger::Uninitialize(void)
+ Flags__9CVtLogger @ 6 NONAME R3UNUSED ; CVtLogger::Flags(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Bwins/VTLOGGERU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+ ?Initialize@CVtLogger@@SAXXZ @ 1 NONAME ; public: static void __cdecl CVtLogger::Initialize(void)
+ ?Print@CVtLogger@@SAXHVTPtrC16@@@Z @ 2 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16)
+ ?Print@CVtLogger@@SAXHVTPtrC16@@H@Z @ 3 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16,int)
+ ?Print@CVtLogger@@SAXHVTPtrC16@@HH@Z @ 4 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16,int,int)
+ ?Uninitialize@CVtLogger@@SAXXZ @ 5 NONAME ; public: static void __cdecl CVtLogger::Uninitialize(void)
+ ?Flags@CVtLogger@@SAHXZ @ 6 NONAME ; public: static int __cdecl CVtLogger::Flags(void)
+ ?Print@CVtLogger@@SAXHHVTPtrC16@@H@Z @ 7 NONAME ; void CVtLogger::Print(int, int, class TPtrC16, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/EABI/vtloggerU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,11 @@
+EXPORTS
+ _ZN9CVtLogger10InitializeEv @ 1 NONAME
+ _ZN9CVtLogger12UninitializeEv @ 2 NONAME
+ _ZN9CVtLogger5FlagsEv @ 3 NONAME
+ _ZN9CVtLogger5PrintEi7TPtrC16 @ 4 NONAME
+ _ZN9CVtLogger5PrintEi7TPtrC16i @ 5 NONAME
+ _ZN9CVtLogger5PrintEi7TPtrC16ii @ 6 NONAME
+ _ZTI9CVtLogger @ 7 NONAME ; #<TI>#
+ _ZTV9CVtLogger @ 8 NONAME ; #<VT>#
+ _ZN9CVtLogger5PrintEii7TPtrC16i @ 9 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2004 - 2006 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: Video Telephony logger build information file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cvtlogger.h |../../../inc/cvtlogger.h
+../inc/vtlogger.hrh |../../../inc/vtlogger.hrh
+
+PRJ_MMPFILES
+../Group/vtlogger.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Group/vtlogger.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2004 - 2006 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: This is project specification file video telephony logger.
+*
+*/
+
+#include <platform_paths.hrh>
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET vtlogger.dll
+TARGETTYPE dll
+UID 0x1000008d 0x101F8699
+
+SOURCEPATH ../Src
+
+SOURCE CVtLogger.cpp
+
+DOCUMENT ../Group/bld.inf
+
+USERINCLUDE ../Inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY flogger.lib
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Inc/cvtlogger.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2004 - 2005 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: Video telephony engine debugging support.
+*
+*/
+
+
+
+#ifndef CVTLOGGER_H
+#define CVTLOGGER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <flogger.h>
+#include <f32file.h>
+#include "vtlogger.hrh"
+
+// CONSTANTS
+const TInt KVtDebugBufferSize = 100;
+const TInt KVtDebugReturnValNotApplicable = -1;
+
+// MACROS
+
+#define DEBUG_CONSTRUCT CVtLogger::ELogConstruction
+#define DEBUG_DESTRUCT CVtLogger::ELogDestruction
+#define DEBUG_MEDIA CVtLogger::ELogMedia
+#define DEBUG_AUDIO CVtLogger::ELogAudio
+#define DEBUG_SESSION CVtLogger::ELogSession
+#define DEBUG_DETAIL CVtLogger::ELogDetails
+#define DEBUG_ALL CVtLogger::ELogLogEverything
+#define DEBUG_GEN CVtLogger::ELogGeneric
+#define DEBUG_RETURN CVtLogger::ELogReturn
+
+#define DEBUG_FLAG1 CVtLogger::ELogApp1
+#define DEBUG_FLAG2 CVtLogger::ELogApp2
+#define DEBUG_FLAG3 CVtLogger::ELogApp3
+#define DEBUG_FLAG4 CVtLogger::ELogApp4
+
+#if defined(VTDEBUG) && defined(__CS_VIDEO_TELEPHONY)
+/**
+* Write a text buffer to log.
+*/
+#define __VTPRINT(level,x) CVtLogger::Print(level, _L(x));
+
+/**
+* Write a text buffer and integer value to log.
+*/
+#define __VTPRINT2(level,x,y) CVtLogger::Print(level, _L(x), y);
+
+/**
+* Write a text buffer and two integer values to log.
+*/
+#define __VTPRINT3(level,x,y,z) CVtLogger::Print(level, _L(x), y, z);
+
+#define __VTPRINTENTER(x) CVtLogger::Print( CVtLogger::ELogGeneric, ETrue, _L(x));
+
+#define __VTPRINTEXIT(x) CVtLogger::Print( CVtLogger::ELogGeneric, EFalse, _L(x) );
+
+#define __VTPRINTEXITR(x,y) CVtLogger::Print( CVtLogger::ELogGeneric, EFalse, _L(x), y );
+
+/**
+* Initialize VT logging, must be called before any __VTPRINT's are called.
+*/
+#define VTLOGINIT CVtLogger::Initialize();
+
+/**
+* Uninitializes VT logging, must be called client using logging is deleted.
+*/
+#define VTLOGUNINIT CVtLogger::Uninitialize();
+
+/**
+* Returns logging and configuration flags
+*/
+#define VTFLAGS CVtLogger::Flags();
+
+/**
+* check if baseband loopback is enabled
+*/
+#define DEBUG_CFG_BB_LOOPBACK ( CVtLogger::Flags() & CVtLogger::ECfgBBLoopbackEnabled )
+
+/**
+* check if PV engine loopback is enabled
+*/
+#define DEBUG_CFG_PV_LOOPBACK ( CVtLogger::Flags() & CVtLogger::ECfgPVLoopbackEnabled )
+
+/**
+* Disables passing of audio source to PV
+*/
+#define DEBUG_CFG_NO_AUDIO_SOURCE ( CVtLogger::Flags() & CVtLogger::ECfgNoAudioSource )
+
+/**
+* Disables passing of audio source to PV
+*/
+#define DEBUG_CFG_NO_AUDIO_SINK ( CVtLogger::Flags() & CVtLogger::ECfgNoAudioSink )
+
+/**
+* Disables passing of video sink to PV
+*/
+#define DEBUG_CFG_NO_VIDEO_SINK ( CVtLogger::Flags() & CVtLogger::ECfgNoVideoSink )
+
+/**
+* Disables passing of video source to PV
+*/
+#define DEBUG_CFG_NO_VIDEO_SOURCE ( CVtLogger::Flags() & CVtLogger::ECfgNoVideoSource )
+
+#else
+
+/**
+* Disables VT Debug mode if __CS_VIDEO_TELEPHONY is undefined
+*/
+#undef VTDEBUG
+
+#define __VTPRINT(level,x)
+#define __VTPRINT2(level,x,y)
+#define __VTPRINT3(level,x,y,z)
+#define __VTPRINTENTER(x)
+#define __VTPRINTEXIT(x)
+#define __VTPRINTEXITR(x,y)
+#define VTLOGINIT
+#define VTLOGUNINIT
+#define VTFLAGS 0
+#define DEBUG_CFG_BB_LOOPBACK 0
+#define DEBUG_CFG_PV_LOOPBACK 0
+#define DEBUG_CFG_NO_AUDIO_SINK 0
+#define DEBUG_CFG_NO_AUDIO_SOURCE 0
+#define DEBUG_CFG_NO_VIDEO_SINK 0
+#define DEBUG_CFG_NO_VIDEO_SOURCE 0
+
+#endif // VTDEBUG
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+* Debbuging support.
+* To enable logging (either with RDebug or RFileLogger) follow steps below:
+* 1. Create folder c:\Logs\VT
+* 2. Create file VTLOGCONF.txt
+* 3. Open the file and define logging level by hexadecimal digit,
+* see TLogLevel in class declaration below. Example: 2007 means that
+* constructors (0x1), destructors (0x2 ) in media subsystem (0x4) are
+* logged to file (0x2000), i.e. the values are bitwise or'ed. Log file
+* name is "<thread name>.txt" where <thread name> is name of the thread
+* where logging takes places.
+*
+* @lib videoteleng
+* @since 2.6
+*/
+class CVtLogger : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVtLogger* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVtLogger();
+
+ public: // New functions
+
+ /**
+ * Writes to log file or RDebug.
+ * @param aDes text output
+ */
+ virtual void Print( TDesC& aDes );
+
+ /**
+ * Log level defining logging behavior.
+ */
+ enum TLogLevel {
+ // Constructors are logged
+ ELogConstruction = 0x00000001,
+ // Destructors are logged
+ ELogDestruction = 0x00000002,
+ // Media subsystem methods are logged
+ ELogMedia = 0x00000004,
+ // Session subsystem methods are logged
+ ELogSession = 0x00000008,
+ // Audio subsystem methods are logged
+ ELogAudio = 0x00000010,
+ // Details in methods are logged
+ ELogDetails = 0x00000020,
+ // Generic framework methods are logged
+ ELogGeneric = 0x00000040,
+ // Log return from function
+ ELogReturn = 0x00000080,
+ // Everything is logged, as if all above were set.
+ ELogLogEverything = 0x0000007F,
+ // Insert time at the beginning of each log entry
+ // For file logging time is always written because
+ // it is automatically done by RFileLogger.
+ ELogTime = 0x00001000,
+ // Log to file instead of using RDebug
+ ELogToFile = 0x00002000,
+ // Application specific flag 1
+ ELogApp1 = 0x00004000,
+ // Application specific flag 2
+ ELogApp2 = 0x00008000,
+ // Application specific flag 3
+ ELogApp3 = 0x00010000,
+ // Application specific flag 4
+ ELogApp4 = 0x00020000,
+
+ // Configuration flags
+
+ /** Loopback configuration (set only
+ * one of the following flags
+ */
+ // Baseband loopback enabled
+ ECfgBBLoopbackEnabled = 0x00100000,
+ // PV Engine loopback enabled
+ ECfgPVLoopbackEnabled = 0x00200000,
+
+ // Disable passing of audio source
+ ECfgNoAudioSink = 0x00400000,
+
+ // Disable passing of audio sink
+ ECfgNoAudioSource = 0x00800000,
+
+ // Disable passing of video source
+ ECfgNoVideoSource = 0x01000000,
+
+ // Disable passing of video sink
+ ECfgNoVideoSink = 0x02000000
+ };
+
+ /**
+ * Writes buffer to log.
+ * @param aLevel combination of TLogLevel values
+ * @param aBuffer buffer to log
+ */
+ IMPORT_C static void Print(
+ TInt aLevel,
+ TPtrC aBuffer );
+
+ /**
+ * Writes buffer to log.
+ * @param aLevel combination of TLogLevel values
+ * @param aBuffer buffer to log
+ * @param aValue value appended to buffer
+ */
+ IMPORT_C static void Print(
+ TInt aLevel,
+ TPtrC aBuffer,
+ TInt aValue );
+
+ /**
+ * Writes buffer to log.
+ * @param aLevel combination of TLogLevel values
+ * @param aBuffer buffer to log
+ * @param aValue1 first value appended to buffer
+ * @param aValue2 second value appended to buffer
+ */
+ IMPORT_C static void Print(
+ TInt aLevel,
+ TPtrC aBuffer,
+ TInt aValue1,
+ TInt aValue2 );
+
+ /**
+ * Writes buffer to log. This overloaded method is used
+ * for printing entry or exit from a function.
+ * @since Series60 2.8
+ * @param aLevel combination of TLogLevel values
+ * @param aEntry if ETrue "<" is appended to end of string
+ * if EFalse ">" is appended to end of string
+ * @param aBuffer buffer to log
+ * @param aRetVal return value of the function. If this value
+ * is present (i.e. other than KVtDebugReturnValNotApplicable
+ * is passed) then aBuffer should include format tag '%d' where
+ * aRetValue should be placed.
+ */
+ IMPORT_C static void Print(
+ TInt aLevel,
+ const TBool aEntry,
+ TPtrC aBuffer,
+ TInt aRetVal = KVtDebugReturnValNotApplicable );
+
+ /**
+ * Initializes logging. This must be called before
+ * any use of __VTPRINT macros.
+ */
+ IMPORT_C static void Initialize();
+
+ /**
+ * Uninitializes logging. This must be called when
+ * client of logging service is deleted.
+ */
+ IMPORT_C static void Uninitialize();
+
+ /**
+ * Returns flags in configuration file
+ * @return flags
+ */
+ IMPORT_C static TInt Flags();
+
+ private:
+
+ /**
+ * Returns logger.
+ * @return logger
+ */
+ static CVtLogger* Logger();
+
+ /**
+ * Returns if certain log levels are set.
+ * @param aLevels bitmap of TLogLevel values
+ * @return ETrue if all aLevels are set.
+ */
+ TBool CheckLevels( TInt aLevels ) const;
+
+ /**
+ * Reads configuration file and starts
+ * monitoring changes on it.
+ */
+ void ReadCongigFile();
+
+ private: // from CActive
+
+ /**
+ * Handles file change notification
+ */
+ void RunL();
+
+ /**
+ * Cancels monitoring file change
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVtLogger();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ private: // Data
+
+ // Buffer size for printed lines
+ enum
+ {
+ ETempBufLength = 80
+ };
+
+ TFileName iFileName;
+ RFs iFs;
+ TInt iLogLevel;
+ TInt iAccessCount;
+ TBuf<ETempBufLength> iBuffer;
+ TBuf<ETempBufLength> iTempBuf;
+ };
+
+
+#endif // CVTLOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Inc/vtlogger.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2004 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: Defines when logger is enabled.
+*
+*/
+
+
+#ifndef VTLOGGER_HRH
+#define VTLOGGER_HRH
+
+// DATA TYPES
+// MACROS
+
+#if defined(_DEBUG)
+/**
+* Debugging enabled always in debug builds
+*/
+#define VTDEBUG
+
+#endif
+
+#endif // VTLOGGER_HRH
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Src/CVtLogger.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2004 - 2005 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: Video telephony logger
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "cvtlogger.h"
+
+
+// LOCAL CONSTANTS
+_LIT( KVtEngLogConfig, "c:\\Logs\\VT\\VTLOGCONF.txt" );
+_LIT( KVtEngLogFolder, "c:\\Logs\\VT" );
+_LIT( KVtEngLogFolderLogger, "VT" );
+_LIT( KVtEngLogPrefix, "VT: " );
+_LIT( KVtEngLogExtension, ".txt" );
+_LIT( KVtLoggerEnterFunc, "<" );
+_LIT( KVtLoggerExitFunc, ">" );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CVtLogger
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtLogger::CVtLogger() : CActive( CActive::EPriorityStandard - 1 ),
+ iLogLevel( ELogLogEverything )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::ConstructL( )
+ {
+ User::LeaveIfError( iFs.Connect() );
+ TFindFile find( iFs );
+ TUint logLevel( 0 );
+ TInt ret = iFs.Att(KVtEngLogFolder, logLevel );
+ if ( ret == KErrNone )
+ {
+ if ( find.FindByPath( KVtEngLogConfig, NULL ) == KErrNone )
+ {
+ CActiveScheduler::Add( this );
+ ReadCongigFile();
+ }
+ if ( iLogLevel & ELogToFile )
+ {
+ RThread thread;
+ iFileName.Copy( thread.Name() );
+ iFileName.Append( KVtEngLogExtension );
+ }
+ }
+ Dll::SetTls( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::NewL( )
+ {
+ CVtLogger* self = new( ELeave ) CVtLogger;
+
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::~CVtLogger
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtLogger::~CVtLogger()
+ {
+ Cancel();
+ iFs.Close();
+ Dll::SetTls( NULL );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::Print( TDesC& aDes )
+ {
+ if ( iLogLevel & ELogTime && !(iLogLevel & ELogToFile) )
+ {
+ TTime time;
+ time.HomeTime();
+ const TDateTime dt= time.DateTime();
+
+ iTempBuf.Zero();
+ iTempBuf.AppendNum( dt.Minute() );
+ iTempBuf.Append(':');
+ iTempBuf.AppendNum( dt.Second() );
+ iTempBuf.Append(':');
+ iTempBuf.AppendNum( dt.MicroSecond() );
+ iTempBuf.Append(' ');
+
+ const TInt currentLength( iTempBuf.Length() );
+
+ iTempBuf.Append( aDes.Left( Min( iTempBuf.MaxLength() - currentLength, aDes.Length() ) ) );
+ RDebug::Print( iTempBuf );
+ }
+ else
+ {
+ if ( iLogLevel & ELogToFile )
+ {
+ RFileLogger::Write(
+ KVtEngLogFolderLogger,
+ iFileName,
+ EFileLoggingModeAppend,
+ aDes );
+ }
+ else
+ {
+ RDebug::Print( aDes );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt aLevel,
+ TPtrC aBuffer )
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if ( logger && logger->CheckLevels( aLevel ) )
+ {
+ logger->iBuffer.Copy( KVtEngLogPrefix );
+ logger->iBuffer.Append( aBuffer);
+ logger->Print( logger->iBuffer );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt aLevel,
+ TPtrC aBuffer,
+ TInt aValue )
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if ( logger && logger->CheckLevels( aLevel ) )
+ {
+ logger->iBuffer.Zero();
+ logger->iBuffer.AppendNum( aValue );
+ logger->iBuffer.Format( aBuffer, aValue );
+ logger->iBuffer.Insert( 0, KVtEngLogPrefix );
+ logger->Print( logger->iBuffer );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt aLevel,
+ TPtrC aBuffer,
+ TInt aValue1,
+ TInt aValue2 )
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if ( logger && logger->CheckLevels( aLevel ) )
+ {
+ logger->iBuffer.Format( aBuffer, aValue1, aValue2 );
+ logger->iBuffer.Insert( 0, KVtEngLogPrefix );
+ logger->Print( logger->iBuffer );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt aLevel,
+ const TBool aEntry,
+ TPtrC aBuffer,
+ TInt aRetVal )
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if ( logger && logger->CheckLevels( aLevel ) )
+ {
+ logger->iBuffer.Copy( KVtEngLogPrefix );
+ if ( aEntry )
+ {
+ logger->iBuffer.Append( aBuffer );
+ logger->iBuffer.Append( KVtLoggerEnterFunc );
+ }
+ else
+ {
+ if ( aRetVal != KVtDebugReturnValNotApplicable )
+ {
+ logger->iTempBuf.Format( aBuffer, aRetVal );
+ logger->iBuffer.Append( logger->iTempBuf );
+ }
+ else
+ {
+ logger->iBuffer.Append( aBuffer );
+ }
+ logger->iBuffer.Append( KVtLoggerExitFunc );
+ }
+ logger->Print( logger->iBuffer );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Logger
+// Returns logger.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::Logger()
+ {
+ TAny* tls = Dll::Tls();
+ if ( tls )
+ {
+ return reinterpret_cast<CVtLogger*>( tls );
+ }
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Initialize
+// Initialize logger.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Initialize()
+ {
+ CVtLogger* logger = NULL;
+ if ( Dll::Tls() == NULL )
+ {
+ TRAPD( err, logger = CVtLogger::NewL() );
+ if ( err == KErrNone )
+ {
+ Dll::SetTls( logger );
+ }
+ }
+ else
+ {
+ logger = CVtLogger::Logger();
+ }
+ if ( logger )
+ {
+ (logger->iAccessCount)++;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Uninitialize
+// Uninitialize logger.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Uninitialize()
+ {
+ TAny* tls = Dll::Tls();
+ if ( tls )
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if( logger )
+ {
+ TInt count( --(logger->iAccessCount) );
+ if ( !count )
+ {
+ delete reinterpret_cast<CVtLogger*>( tls );
+ Dll::SetTls( NULL );
+ }
+ }
+ }
+
+ }
+
+void CVtLogger::ReadCongigFile()
+ {
+#ifdef _DEBUG
+ RDebug::Print(_L(" VT: ReadConfigFile" ) );
+#endif
+ RFile config;
+ if ( config.Open( iFs, KVtEngLogConfig, EFileShareAny ) == KErrNone )
+ {
+ TBuf8<16> buf;
+ if ( config.Read( buf ) == KErrNone )
+ {
+ TLex8 lex( buf );
+ TUint logLevel( 0 );
+ if ( lex.Val( logLevel, EHex ) == KErrNone )
+ {
+ iLogLevel = logLevel;
+ }
+ }
+ config.Close();
+ }
+ iFs.NotifyChange( ENotifyEntry, iStatus, KVtEngLogConfig() );
+ SetActive();
+ }
+
+void CVtLogger::RunL()
+ {
+ if ( iStatus == KErrNone )
+ {
+ ReadCongigFile();
+ }
+ }
+
+void CVtLogger::DoCancel()
+ {
+ iFs.NotifyChangeCancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Flags
+// Returns flags.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CVtLogger::Flags()
+ {
+ CVtLogger* logger = CVtLogger::Logger();
+ if ( logger )
+ {
+ return logger->iLogLevel;
+ }
+ return KErrGeneral;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CheckLevels
+// Check debug level.
+// -----------------------------------------------------------------------------
+//
+TBool CVtLogger::CheckLevels( TInt aLevels ) const
+ {
+ if ( aLevels & iLogLevel )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+#pragma CTC ENDSKIP
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Src/CVtLoggerStub.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2004 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: Video telephony logger stub
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtLogger.h"
+#include <f32file.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CVtLogger
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtLogger::CVtLogger()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::ConstructL( )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::NewL( )
+ {
+ return NULL;
+ }
+
+// Destructor
+CVtLogger::~CVtLogger()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::Print( TDesC& )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt ,
+ TDesC& )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt ,
+ TDesC& ,
+ TInt )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+ TInt ,
+ TDesC& ,
+ TInt ,
+ TInt )
+ {
+ }
+
+CVtLogger* CVtLogger::Logger()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CheckLevels
+// Check debug level.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtLogger::CheckLevels( TInt aLevels ) const
+ {
+ return EFalse;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Rom/videoteleng.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2004-2007 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: IBY file
+ *
+*/
+
+
+#ifndef __VIDEOTELENG_IBY__
+#define __VIDEOTELENG_IBY__
+
+REM Video telephony engine libraries
+
+#ifdef __CS_VIDEO_TELEPHONY
+file=ABI_DIR\BUILD_DIR\videotelproto.dll SHARED_LIB_DIR\videotelproto.dll
+file=ABI_DIR\BUILD_DIR\Videoteleng.dll SHARED_LIB_DIR\Videoteleng.dll
+file=ABI_DIR\BUILD_DIR\cscallctrl.dll SHARED_LIB_DIR\cscallctrl.dll
+file=ABI_DIR\BUILD_DIR\vtlogger.dll SHARED_LIB_DIR\vtlogger.dll
+
+// Enabler for eclipsing ROM binaries
+data=ZSYSTEM\install\videoteleng_stub.sis system\install\videoteleng_stub.sis
+
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Audio/CVtEngAudioHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,709 @@
+/*
+* Copyright (c) 2004-2006 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: Audio handler implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngAudioHandler.h"
+#include "CVtEngSettings.h"
+#include "CVtEngEventManager.h"
+#include "VtEngUtils.h"
+#include <cvtlogger.h>
+#include <featmgr.h>
+#include <mmf/server/sounddevice.h>
+#include <AudioPreference.h>
+#include "VtEngUtils.h"
+#include "CVtEngStateManager.h"
+#include "MVtEngSessionInfo.h"
+#include "CVtEngHandlerContainer.h"
+
+// CONSTANTS
+
+// For DevSound initialization
+//const TInt KVtEngUidControlHwDevice = 0x10206593;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::CVtEngAudioHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler::CVtEngAudioHandler()
+ {
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.c++" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::ConstructL()
+ {
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.ConstructL<" )
+
+ iAccHandler = &CVtEngUtility::AccessoryHandler();
+ iAccHandler->RegisterObserverL( this );
+ iTelephonyAudioRouting = CTelephonyAudioRouting::NewL( *this );
+ iCurrentAudioOutput = iTelephonyAudioRouting->Output();
+
+ // Fetch the mode.
+ User::LeaveIfError( iAccHandler->AccessoryMode( iAccMode ) );
+ __VTPRINT2( DEBUG_AUDIO, "AH.iAccMode %d", ( TInt )iAccMode.iAccessoryMode )
+
+ UpdateCurrentVolume();
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.ConstructL>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler* CVtEngAudioHandler::NewL()
+ {
+ CVtEngAudioHandler* self = new( ELeave ) CVtEngAudioHandler;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::~CVtEngAudioHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler::~CVtEngAudioHandler()
+ {
+ __VTPRINT( DEBUG_AUDIO, "AH.~<" )
+ delete iRoutingEnabler;
+
+ delete iTelephonyAudioRouting;
+ if ( iAccHandler )
+ {
+ iAccHandler->RemoveObserver( this );
+ }
+ __VTPRINT( DEBUG_AUDIO, "AH.~>" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::HandleL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::HandleL( CVtEngOperation& aOperation )
+ {
+ __VTPRINT2( DEBUG_AUDIO, "AH.HandleL op=%d", ( TInt )iOperation )
+ if ( iOperation )
+ {
+ // While operation is ongoing, another call should not be made.
+ User::Leave( KErrArgument );
+ }
+
+ MVtEngAudio::TVtEngRoutingSetting routeSetting;
+ TVtEngOpParamUtil<MVtEngAudio::TVtEngRoutingSetting>::Set(
+ routeSetting, aOperation );
+
+ switch( routeSetting )
+ {
+ case EActivateHandsfree:
+ SetLoudspeakerL( ETrue, ETrue );
+ break;
+
+ case EDeactivateHansfree:
+ SetLoudspeakerL( EFalse, ETrue );
+ break;
+
+ case EActivateBT:
+ SetBluetoothL( ETrue ); // asynchronous
+ break;
+
+ case EDeactivateBT:
+ SetBluetoothL( EFalse );
+ break;
+ }
+
+ iOperation = &aOperation;
+ __VTPRINT( DEBUG_AUDIO | DEBUG_RETURN, "AH.HandleL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetRoutingEnablerL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetRoutingEnablerL( const TBool aEnable )
+ {
+ __VTPRINTENTER( "AHRout.SetRoutingEnablerL" )
+
+ if ( aEnable && !iRoutingEnabler )
+ {
+ // Before connected state audio routing can be changed by the user
+ // only in MO calls. Create temporary devsound only if call is such.
+ const CVtEngHandlerContainer& handlers =
+ CVtEngUtility::StateManager()->Handlers();
+ const MVtEngSessionInfo& session = handlers.Session();
+ MVtEngSessionInfo::TDirection direction =
+ MVtEngSessionInfo::EDirectionNone; // init to MO, if
+ const TInt err( session.GetDirection( direction ) );
+ if ( err == KErrNone && direction == MVtEngSessionInfo::EDirectionMO )
+ {
+ iRoutingEnabler = CRoutingEnabler::NewL();
+ }
+ }
+ else if ( !aEnable )
+ {
+ delete iRoutingEnabler;
+ iRoutingEnabler = NULL;
+ }
+ __VTPRINTEXIT( "AHRout.ReleaseRoutingEnablerL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::IncreaseVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::IncreaseVolume()
+ {
+ __VTPRINTENTER( "AH.IncreaseVolume" )
+ TBool adjustOk( AdjustVolume( 1 ) );
+ if ( !adjustOk )
+ {
+ // only reason for AdjustVolume to fail is that volume is max already
+ CVtEngEventManager::NotifyEvent( KVtEngAudioVolumeMax );
+ }
+ __VTPRINTEXITR( "AH.IncreaseVolume %d", adjustOk )
+ return adjustOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::DecreaseVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::DecreaseVolume()
+ {
+ __VTPRINTENTER( "AH.DecreaseVolume" )
+ TBool adjustOk( AdjustVolume( -1 ) );
+ if ( !adjustOk )
+ {
+ // only reason for AdjustVolume to fail is that volume is min already
+ CVtEngEventManager::NotifyEvent( KVtEngAudioVolumeMin );
+ }
+ __VTPRINTEXITR( "AH.DecreaseVolume %d", adjustOk )
+ return adjustOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AdjustVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::AdjustVolume( const TInt aDelta )
+ {
+ __VTPRINTENTER( "AH.AdjustVolume" )
+ __VTPRINT2( DEBUG_AUDIO, "AH.AdjustVolume aDelta = %d", aDelta )
+ TBool result( EFalse );
+ CVtEngSettings& settings( CVtEngUtility::Settings() );
+ TVtEngOutputVolume volume;
+ settings.GetVolume( volume.iHandsetVolume, EFalse, EFalse );
+ settings.GetVolume( volume.iHandsfreeVolume, ETrue, EFalse );
+ TAudioRoutingState routingState;
+ GetRoutingState( routingState );
+ TInt& value( ( routingState == EAudioLoudspeaker ) ?
+ volume.iHandsfreeVolume : volume.iHandsetVolume );
+ value += aDelta;
+ TInt validValue( settings.ValidVolume( value ) );
+ if ( validValue == value )
+ {
+ settings.SetVolume(
+ volume.iHandsetVolume,
+ volume.iHandsfreeVolume,
+ ETrue );
+ settings.SetVolume(
+ volume.iHandsetVolume,
+ volume.iHandsfreeVolume,
+ EFalse );
+ result = ETrue;
+ }
+ __VTPRINTEXITR( "AH.AdjustVolume %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetRoutingState
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetRoutingState(
+ TAudioRoutingState& aAudioRoutingState )
+ {
+ switch ( iCurrentAudioOutput )
+ {
+ // Wired headset has the highest priority.
+ case CTelephonyAudioRouting::EWiredAudioAccessory:
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.wired" )
+ aAudioRoutingState = EAudioWiredHeadset;
+ break;
+
+ // Then bluetooth handsfree.
+ case CTelephonyAudioRouting::EBTAudioAccessory:
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.bt" )
+ aAudioRoutingState = EAudioBT;
+ break;
+
+ // Loudspeaker.
+ case CTelephonyAudioRouting::ELoudspeaker:
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.IHF" )
+ aAudioRoutingState = EAudioLoudspeaker;
+ break;
+
+ // Handset as fallback.
+ default:
+ __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.Handset" )
+ aAudioRoutingState = EAudioHandset;
+ break;
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetRoutingAvailability
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetRoutingAvailability(
+ const TAudioRoutingState aAudioRoutingState,
+ TBool& aAvailable )
+ {
+ TAudioRoutingState currentRouting;
+ GetRoutingState( currentRouting ); // always succeeds
+
+ if ( currentRouting == aAudioRoutingState )
+ {
+ // It is possible to route to itself, although it does not make
+ // much sense.
+ aAvailable = ETrue;
+ }
+ else if ( currentRouting == EAudioWiredHeadset )
+ {
+ // For wired headset, audio routings are not possible.
+ aAvailable = EFalse;
+ }
+ else
+ {
+ switch ( aAudioRoutingState )
+ {
+ case EAudioHandset:
+ case EAudioLoudspeaker:
+ // Handset & loudspeaker are always available.
+ aAvailable = ETrue;
+ break;
+
+ case EAudioBT:
+ aAvailable = IsOutputAvailable( CTelephonyAudioRouting::EBTAudioAccessory );
+ break;
+
+ case EAudioWiredHeadset:
+ // Wired headset can not be routed to. When headset is
+ // attached, routing happens automatically.
+ aAvailable = EFalse;
+ break;
+ }
+ }
+
+ __VTPRINT3( DEBUG_AUDIO, "AH.GRA state %d availability=%d",
+ aAudioRoutingState, aAvailable )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetHeadsetType
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetHeadsetType(
+ TWiredHeadsetType& aHeadsetType )
+ {
+ switch ( iAccMode.iAccessoryMode )
+ {
+ case EAccModeWiredHeadset:
+ case EAccModeWiredCarKit:
+ case EAccModeMusicStand:
+ aHeadsetType = EWiredHeadset;
+ break;
+
+ case EAccModeLoopset:
+ aHeadsetType = EWiredLoopset;
+ break;
+
+ case EAccModeTextDevice:
+ aHeadsetType = EWiredTty;
+ break;
+
+ case EAccModeHandPortable:
+ case EAccModeWirelessHeadset:
+ case EAccModeWirelessCarKit:
+ default:
+ // Not wired headset.
+ aHeadsetType = EWiredNone;
+ break;
+ }
+
+ __VTPRINT2( DEBUG_AUDIO, "AH.HeadsetType=%d", aHeadsetType )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::OutputVolume
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::OutputVolume(
+ const TBool aHandsetVolume ) const
+ {
+ __VTPRINT2( DEBUG_AUDIO, "AH.OutputVolume isHandset=%d", aHandsetVolume )
+ TInt vol = 0;
+ CVtEngSettings& setting = CVtEngUtility::Settings();
+ TInt err( setting.GetVolume( vol, !aHandsetVolume, EFalse ) );
+ if ( err != KErrNone )
+ {
+ vol = err;
+ }
+ __VTPRINT2( DEBUG_AUDIO, "AH.OutputVolume vol=%d",vol )
+ return vol;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetLoudspeakerL( TBool aTurnOn, TBool /*aShowNote*/ )
+ {
+ __VTPRINTENTER( "AH.SetLoudspeakerL" )
+ __VTPRINT2( DEBUG_AUDIO, "AH.SetLoudspeakerL %d", aTurnOn )
+ TBool available( EFalse );
+ GetRoutingAvailability( EAudioLoudspeaker, available );
+ if ( !available )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ // Set shownote flag up in telephony audiorouting, before calling SetOutputL.
+ User::LeaveIfError( iTelephonyAudioRouting->SetShowNote( ETrue ) );
+
+ if( aTurnOn )
+ {
+ iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::ELoudspeaker );
+ }
+ else
+ {
+ iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset );
+ }
+ __VTPRINTEXIT( "AH.SetLoudspeakerL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetBluetoothL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetBluetoothL( TBool aTurnOn )
+ {
+ __VTPRINTENTER( "AH.SetBluetoothL" )
+ TBool available( EFalse );
+ GetRoutingAvailability( EAudioBT, available );
+ if ( !available )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ // Set shownote flag up in telephony audiorouting, before calling SetOutputL.
+ User::LeaveIfError( iTelephonyAudioRouting->SetShowNote( ETrue ) );
+
+ if( aTurnOn )
+ {
+ iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EBTAudioAccessory );
+ }
+ else
+ {
+ iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset );
+ }
+ __VTPRINTEXIT( "AH.SetBluetoothL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AvailableOutputsChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::AvailableOutputsChanged(
+ CTelephonyAudioRouting& /*aTelephonyAudioRouting*/ )
+ {
+ __VTPRINTENTER( "AH.AvailableOutputsChanged" )
+ CVtEngEventManager::NotifyEvent( KVtEngAudioRoutingAvailabilityChanged );
+ __VTPRINTEXIT( "AH.AvailableOutputsChanged" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::OutputChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::OutputChanged(
+ CTelephonyAudioRouting& aTelephonyAudioRouting )
+ {
+ __VTPRINTENTER( "AH.OutputChanged" )
+ CTelephonyAudioRouting::TAudioOutput
+ previousAudioOutput( iCurrentAudioOutput );
+ iCurrentAudioOutput = aTelephonyAudioRouting.Output();
+ CVtEngEventManager::NotifyEvent( KVtEngAudioRoutingChanged );
+ // HandSet -> IHF
+ if( ( previousAudioOutput == CTelephonyAudioRouting::EHandset ) &&
+ ( iCurrentAudioOutput == CTelephonyAudioRouting::ELoudspeaker ) )
+ {
+ __VTPRINT( DEBUG_AUDIO, "AH.OutputChanged signalling HandSet to IHF" )
+ }
+ // IHF -> HandSet
+ else if( ( previousAudioOutput == CTelephonyAudioRouting::ELoudspeaker ) &&
+ ( iCurrentAudioOutput == CTelephonyAudioRouting::EHandset ) )
+ {
+ __VTPRINT( DEBUG_AUDIO, "AH.OutputChanged signalling IHF to HandSet" )
+ }
+ UpdateCurrentVolume();
+ __VTPRINTEXITR( "AH.OutputChanged %d", iCurrentAudioOutput )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetOutputComplete
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetOutputComplete(
+ CTelephonyAudioRouting& aTelephonyAudioRouting,
+ TInt aError )
+ {
+ __VTPRINTENTER( "AH.SetOutputComplete" )
+ if ( aError == KErrNone )
+ {
+ OutputChanged( aTelephonyAudioRouting );
+ }
+ CompleteOperation( aError );
+ __VTPRINTEXIT( "AH.SetOutputComplete" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::CompleteOperation
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::CompleteOperation( TInt aResult )
+ {
+ __VTPRINT3( DEBUG_AUDIO, "AH.CompleteOperation op=%d,res=%d" ,
+ ( TInt )iOperation, aResult )
+ if ( iOperation )
+ {
+ iOperation->HandleOpComplete( aResult );
+ iOperation = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::UpdateCurrentVolume
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::UpdateCurrentVolume()
+ {
+ __VTPRINTENTER( "AH.UpdateCurrentVolume" )
+ TAudioRoutingState currentRouting = EAudioHandset;
+ GetRoutingState( currentRouting );
+
+ const TBool currentVolume = ( currentRouting == EAudioLoudspeaker );
+ CVtEngSettings& setting = CVtEngUtility::Settings();
+ setting.SetCurrentVolume( currentVolume );
+
+ __VTPRINTEXITR( "AH.UpdateCurrentVolume output is IHF=%d", currentVolume )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AccessoryModeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::AccessoryModeChanged(
+ const TAccMode& aMode, const TBool /* aActivated */ )
+ {
+ iAccMode.iAccessoryMode = aMode;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::IsOutputAvailable
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::IsOutputAvailable(
+ const CTelephonyAudioRouting::TAudioOutput aOutput )
+ {
+ const TArray< CTelephonyAudioRouting::TAudioOutput > outputs =
+ iTelephonyAudioRouting->AvailableOutputs();
+
+ for ( TInt i = 0; i < outputs.Count(); i++ )
+ {
+ if ( outputs[ i ] == aOutput )
+ {
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::NewL
+// -----------------------------------------------------------------------------
+//
+CRoutingEnabler* CRoutingEnabler::NewL()
+ {
+ CRoutingEnabler* enabler =
+ new ( ELeave ) CRoutingEnabler();
+ CleanupStack::PushL( enabler );
+ enabler->StartL();
+ CleanupStack::Pop( enabler );
+ return enabler;
+ }
+
+// Destructor
+CRoutingEnabler::~CRoutingEnabler()
+ {
+ if ( iDevSound )
+ {
+ // If initialization ahs been successfull, Devsound Play has started
+ // and need to be stopped.
+ if( !iDevsoundInitializeFailure )
+ {
+ __VTPRINT( DEBUG_MEDIA, "AHRout.~ Stopping audio" )
+ iDevSound->Stop();
+ }
+ delete iDevSound;
+ iDevSound = NULL;
+ }
+ }
+
+// c++ constructor
+CRoutingEnabler::CRoutingEnabler()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::StartL
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::StartL()
+ {
+ __VTPRINTENTER( "AHRout.StartL" )
+ iDevSound = CMMFDevSound::NewL();
+
+ iDevSound->InitializeL(
+ *( this ),
+ EMMFStatePlaying );
+ __VTPRINTEXIT( "AHRout.StartL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::InitializeComplete
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::InitializeComplete( TInt aError )
+ {
+ __VTPRINTENTER( "AHRout.InitializeComplete" )
+ if ( aError == KErrNone )
+ {
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = KAudioPriorityCSCallDownlink;
+ prioritySettings.iPref =
+ ( TMdaPriorityPreference ) KAudioPrefCSCallDownlink;
+ prioritySettings.iState = EMMFStatePlaying;
+ if ( iDevSound )
+ {
+ iDevSound->SetPrioritySettings( prioritySettings );
+
+ TRAPD( err, iDevSound->PlayInitL() );
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_AUDIO, "AHRout.InitializeComplete PlayInitL err=%d", err )
+
+ // Devsound PlayInitL leave error happened.
+ iDevsoundInitializeFailure = ETrue;
+ }
+ }
+ }
+ else
+ {
+ __VTPRINT2( DEBUG_AUDIO, "AHRout.InitializeComplete err=%d", aError )
+
+ // Devsound initialization failed
+ iDevsoundInitializeFailure = ETrue;
+ }
+ __VTPRINTEXIT( "AHRout.InitializeComplete" )
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::ToneFinished
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::ToneFinished( TInt /*aError*/)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::BufferToBeFilled
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::BufferToBeFilled(
+ CMMFBuffer* /*aBuffer*/)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::PlayError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::PlayError( TInt /*aError*/)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::BufferToBeEmptied
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::BufferToBeEmptied(
+ CMMFBuffer* /*aBuffer*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::RecordError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::RecordError(
+ TInt /*aError*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::ConvertError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::ConvertError( TInt /*aError*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::DeviceMessage
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::DeviceMessage(
+ TUid /*aMessageType*/, const TDesC8& /*aMsg*/ )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngAccessoryHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2004-2005 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: Accessory listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngAccessoryHandler.h"
+#include "MVtEngAccessoryObserver.h"
+#include <cvtlogger.h>
+
+// CONSTANTS
+const TInt KVtEngAccObserverGranularity = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::CVtEngAccessoryHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler::CVtEngAccessoryHandler() :
+ CActive( CActive::EPriorityStandard ),
+ iAccessoryObservers( KVtEngAccObserverGranularity )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::ConstructL()
+ {
+ User::LeaveIfError( iAccessoryServer.Connect() );
+ User::LeaveIfError( iAccessoryMode.CreateSubSession( iAccessoryServer ) );
+ StartListening();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler* CVtEngAccessoryHandler::NewL( )
+ {
+ __VTPRINTENTER( "AccHdr.NewL" )
+ CVtEngAccessoryHandler* self = new( ELeave ) CVtEngAccessoryHandler;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "AccHdr.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::~CVtEngAccessoryHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler::~CVtEngAccessoryHandler()
+ {
+ __VTPRINTENTER( "AccHdr.~" )
+ Cancel();
+ RemoveAllObservers();
+ iAccessoryMode.CloseSubSession();
+ iAccessoryServer.Disconnect();
+ __VTPRINTEXIT( "AccHdr.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RemoveObserver
+// Removes an accessory listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::RemoveObserver(
+ MVtEngAccessoryObserver* aObserver )
+ {
+ __VTPRINTENTER( "AccHdr.RemoveObserver" )
+ TInt pos = iAccessoryObservers.Find( aObserver );
+ if ( pos != KErrNotFound )
+ {
+ iAccessoryObservers.Remove( pos );
+ }
+ __VTPRINTEXIT( "AccHdr.RemoveObserver" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RegisterObserverL
+// New accessory listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::
+ RegisterObserverL( MVtEngAccessoryObserver* aObserver )
+ {
+ __VTPRINTENTER( "AccHdr.RegisterObserverL" )
+ TInt pos = iAccessoryObservers.Find( aObserver );
+ if ( pos == KErrNotFound )
+ {
+ User::LeaveIfError( iAccessoryObservers.Append( aObserver ) );
+ }
+ __VTPRINTEXIT( "AccHdr.RegisterObserverL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RemoveAllObservers
+// All observers off they go
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::RemoveAllObservers()
+ {
+ iAccessoryObservers.ResetAndDestroy();
+ iAccessoryObservers.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::StartListening
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::StartListening()
+ {
+ iAccessoryMode.NotifyAccessoryModeChanged( iStatus, iMode );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RunL
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::RunL()
+ {
+ __VTPRINTENTER( "AccHdr.RunL" )
+ StartListening();
+ NotifyObserversL();
+ __VTPRINTEXIT( "AccHdr.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::DoCancel
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::DoCancel()
+ {
+ __VTPRINTENTER( "AccHdr.DoCancel" )
+ iAccessoryMode.CancelNotifyAccessoryModeChanged();
+ __VTPRINTEXIT( "AccHdr.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RunError
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAccessoryHandler::RunError( TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "AccHdr.RunError" )
+ __VTPRINTEXIT( "AccHdr.RunError" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::NotifyObserversL.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::NotifyObserversL()
+ {
+ const TInt obsCount( iAccessoryObservers.Count() );
+ for ( TInt i = 0; i < obsCount; i++ )
+ {
+ MVtEngAccessoryObserver* obs = iAccessoryObservers[ i ];
+ if ( obs )
+ {
+ obs->AccessoryModeChanged(
+ iMode.iAccessoryMode, iMode.iAudioOutputStatus );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::CMonitor::AccessoryMode
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAccessoryHandler::
+ AccessoryMode( TAccPolAccessoryMode& aAccessoryMode) const
+ {
+ return iAccessoryMode.GetAccessoryMode( aAccessoryMode );
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngCRObserverItem.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2004-2006 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: Video call CR listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngCRObserverItem.h"
+#include <centralrepository.h>
+#include "MVtEngCRSettingObserver.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::CVtEngCRObserverItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem::CVtEngCRObserverItem(
+ MVtEngCRSettingObserver* aObserver,
+ TUid aUid, TUint32 aKey,
+ CCenRepNotifyHandler::TCenRepKeyType aType ) :
+ iObserver( aObserver ), iUid( aUid ), iKey( aKey ), iType( aType ),
+ iNotifier( NULL )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRObserverItem::NewL(
+ MVtEngCRSettingObserver* aObserver,
+ TUid aUid, TUint32 aKey,
+ CCenRepNotifyHandler::TCenRepKeyType aType )
+ {
+ __VTPRINTENTER( "CRListener.NewL" )
+ CVtEngCRObserverItem* self =
+ new( ELeave ) CVtEngCRObserverItem( aObserver, aUid, aKey, aType );
+ __VTPRINTEXIT( "CRListener.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::~CVtEngCRObserverItem
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem::~CVtEngCRObserverItem()
+ {
+ __VTPRINTENTER( "CRListener.~" )
+ if ( iNotifier )
+ {
+ iNotifier->StopListening();
+ }
+ delete iNotifier;
+ __VTPRINTEXIT( "CRListener.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if uid and id match this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUid aUid, const TUint32 aKey ) const
+ {
+ return aUid == iUid && iKey == aKey ? ETrue : EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if uid matches this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUid aUid ) const
+ {
+ return aUid == iUid ? ETrue : EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if id matches this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUint32 aKey ) const
+ {
+ return iKey == aKey ? ETrue : EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::SetCenRepNotifier
+// Sets the actual change handler to this object.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::SetCenRepNotifier( CCenRepNotifyHandler* aNotifier )
+ {
+ iNotifier = aNotifier;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyInt
+// Callback of changed int value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyInt( TUint32 aId, TInt aNewValue )
+ {
+ __VTPRINTENTER( "CRListener.Int" )
+ iObserver->HandleNotifyInt( iUid, aId, aNewValue );
+ __VTPRINTEXIT( "CRListener.Int" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyReal
+// Callback of changed real value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyReal( TUint32 aId, TReal aNewValue )
+ {
+ __VTPRINTENTER( "CRListener.Real" )
+ iObserver->HandleNotifyReal( iUid, aId, aNewValue );
+ __VTPRINTEXIT( "CRListener.Real" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyString
+// Callback of changed string value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyString( TUint32 aId,
+ const TDesC16& aNewValue )
+ {
+ __VTPRINTENTER( "CRListener.String" )
+ iObserver->HandleNotifyString( iUid, aId, aNewValue );
+ __VTPRINTEXIT( "CRListener.String" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyBinary
+// Callback of changed binary value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyBinary( TUint32 /* aId */,
+ const TDesC8& /* aNewValue */ )
+ {
+ __VTPRINTENTER( "CRListener.Binary" )
+ __VTPRINTEXIT( "CRListener.Binary" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyGeneric
+// Callback of a change in central repository.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyGeneric( TUint32 /* aId */ )
+ {
+ __VTPRINTENTER( "CRListener.Generic" )
+ __VTPRINTEXIT( "CRListener.Generic" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyError
+// Callback of an error occurred.
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+void CVtEngCRObserverItem::HandleNotifyError( TUint32 aId, TInt aError,
+ CCenRepNotifyHandler* /* aHandler */ )
+#else
+void CVtEngCRObserverItem::HandleNotifyError(
+ TUint32 /* aId */, TInt /* aError */, CCenRepNotifyHandler* /* aHandler */ )
+#endif // VTDEBUG
+ {
+ __VTPRINT3( DEBUG_GEN, "CRListener.error id=%d,err=%d ", aId, aError )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Uid
+// Returns Uid for this observer.
+// -----------------------------------------------------------------------------
+//
+TUid CVtEngCRObserverItem::Uid() const
+ {
+ return iUid;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Key
+// Returns Key for this observer.
+// -----------------------------------------------------------------------------
+//
+TUint32 CVtEngCRObserverItem::Key() const
+ {
+ return iKey;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Notifier
+// Returns Notifier for this observer.
+// -----------------------------------------------------------------------------
+//
+CCenRepNotifyHandler* CVtEngCRObserverItem::Notifier() const
+ {
+ return iNotifier;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Type
+// Returns Type for this observer.
+// -----------------------------------------------------------------------------
+//
+CCenRepNotifyHandler::TCenRepKeyType CVtEngCRObserverItem::Type() const
+ {
+ return iType;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Observer
+// Returns true observer for this observer.
+// -----------------------------------------------------------------------------
+//
+MVtEngCRSettingObserver* CVtEngCRObserverItem::Observer() const
+ {
+ return iObserver;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngCRProxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,441 @@
+/*
+* Copyright (c) 2004-2006 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: Central repository proxy.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngCRObserverItem.h"
+#include "CVtEngCRProxy.h"
+#include "MVtEngCRSettingObserver.h"
+#include <cvtlogger.h>
+
+// CONSTANTS
+
+const TInt KVtEngCRProxyObsGranularity = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::CVtEngCRProxy
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CVtEngCRProxy() : iObserverItems( KVtEngCRProxyObsGranularity )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy* CVtEngCRProxy::NewL( )
+ {
+ __VTPRINTENTER( "CRProxy.NewL" )
+ CVtEngCRProxy* self = new( ELeave ) CVtEngCRProxy;
+ __VTPRINTEXIT( "CRProxy.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::~CVtEngCRProxy
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::~CVtEngCRProxy()
+ {
+ __VTPRINTENTER( "CRProxy.~" )
+ RemoveAllObservers();
+ RemoveSessions();
+ __VTPRINTEXIT( "CRProxy.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRProxy::FindItem(
+ const TUid& aUid,
+ const TUint32 aKey,
+ TInt& aIndex ) const
+ {
+ TInt count( iObserverItems.Count() );
+ CVtEngCRObserverItem* item = NULL;
+ TBool found( EFalse );
+ while ( count-- && !found )
+ {
+ item = iObserverItems[ count ];
+ if ( item->Offer( aUid, aKey ) )
+ {
+ aIndex = count;
+ found = ETrue;
+ }
+ }
+
+ // Just NULL the item if not found
+ if ( !found )
+ {
+ item = NULL;
+ }
+ return item;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRProxy::FindItem(
+ const TUint32 aKey, TInt& aIndex ) const
+ {
+ TInt count( iObserverItems.Count() );
+ CVtEngCRObserverItem* item = NULL;
+ if ( aIndex < 0 )
+ {
+ return NULL;
+ }
+
+ for ( ; aIndex < count; aIndex++ )
+ {
+ item = iObserverItems[ aIndex ];
+ if ( item->Offer( aKey ) )
+ {
+ break;
+ }
+ }
+ return item;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveInterested
+// Removes a cent rep listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RemoveInterested( CVtEngCRObserverItem& aObserver )
+ {
+ __VTPRINTENTER( "CRProxy.RemoveInterested" )
+ TInt index ( 0 );
+ CVtEngCRObserverItem* item = FindItem( aObserver.Uid(),
+ aObserver.Key(), index );
+ if ( !item )
+ {
+ // Should not be possible.
+ __VTPRINTEXITR( "CRProxy.RemoveInterested %d", 0 )
+ return;
+ }
+
+ delete item;
+ iObserverItems.Remove( index );
+ __VTPRINTEXITR( "CRProxy.RemoveInterested %d", 1 )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::NewCRSessionL
+// New Central repository-uid pairing.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CCRSession* CVtEngCRProxy::NewCRSessionL( TUid aUid )
+ {
+ __VTPRINTENTER( "CRProxy.NewCRSessionL" )
+ CRepository* crSession = CRepository::NewL( aUid );
+ CleanupStack::PushL( crSession );
+ CCRSession* csSession = new ( ELeave ) CCRSession;
+ csSession->iSession = crSession;
+ csSession->iUid = aUid;
+ CleanupStack::Pop( crSession );
+ __VTPRINTEXIT( "CRProxy.NewCRSessionL" )
+ return csSession;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RegisterInterested
+// New Central repository listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RegisterInterestedL( CVtEngCRObserverItem* aObserver )
+ {
+ __VTPRINTENTER( "CRProxy.RegisterInterestedL" )
+ CRepository* crSession = MapUidToCR( aObserver->Uid() );
+ CCRSession* csSession = NULL;
+ if( !crSession )
+ {
+ csSession = NewCRSessionL( aObserver->Uid() );
+ CleanupStack::PushL( csSession );
+ crSession = csSession->iSession;
+ iCRSessions.AppendL( csSession );
+ CleanupStack::Pop( csSession );
+ }
+
+ CCenRepNotifyHandler* notifier =
+ CCenRepNotifyHandler::NewL( *aObserver, *crSession,
+ aObserver->Type(), aObserver->Key() );
+ //notifier ownership transfered
+ aObserver->SetCenRepNotifier( notifier );
+ notifier->StartListeningL();
+ iObserverItems.AppendL ( aObserver );
+ __VTPRINTEXIT( "CRProxy.RegisterInterestedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::MapUidToCR
+// Maps a given UID to a Central repository session.
+// -----------------------------------------------------------------------------
+//
+CRepository* CVtEngCRProxy::MapUidToCR( const TUid aUid )
+ {
+ __VTPRINTENTER( "CRProxy.Map" )
+ CCRSession* csSession = NULL;
+ TBool found( EFalse );
+ TInt count( iCRSessions.Count() );
+ for ( TInt i = 0 ; i < count; i++ )
+ {
+ csSession = iCRSessions[ i ];
+ if ( csSession->iUid == aUid )
+ {
+ i = count; // break loop
+ found = ETrue;
+ }
+ }
+ CRepository* session = NULL;
+ // Only return something when found.
+ if ( found )
+ {
+ session = csSession->iSession;
+ }
+ __VTPRINTEXITR( "CRProxy.Map %d", (TInt) session )
+ return session;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveAllObservers
+// All observers off they go.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RemoveAllObservers()
+ {
+ __VTPRINTENTER( "CRProxy.RemoveAll" )
+ iObserverItems.ResetAndDestroy();
+ iObserverItems.Close();
+ __VTPRINTEXIT( "CRProxy.RemoveAll" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveSessions
+// Removes all Central repository sessions.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RemoveSessions()
+ {
+ __VTPRINTENTER( "CRProxy.RemoveAllS" )
+ iCRSessions.ResetAndDestroy();
+ iCRSessions.Close();
+ __VTPRINTEXIT( "CRProxy.RemoveAllS" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::GetSession
+// Gets an existing or a new Central repository session for a UID.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::GetSessionL( const TUid aUid, CRepository*& crSession )
+ {
+ TInt err( KErrNone );
+ crSession = MapUidToCR( aUid );
+ if ( !crSession )
+ {
+ CCRSession* session = NULL;
+ session = NewCRSessionL( aUid );
+ if ( session )
+ {
+ CleanupStack::PushL( session );
+ iCRSessions.AppendL( session );
+ CleanupStack::Pop( session );
+ crSession = session->iSession;
+ }
+ else
+ {
+ err = KErrNotFound;
+ }
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TInt& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.GetInt" )
+ __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Get( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.GetInt %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets real value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TReal& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.GetReal" )
+ __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Get( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.GetR %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets binary value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TDes8& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.GetD8" )
+ __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Get( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.GetD8 %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets string value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TDes16& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.GetD16" )
+ __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Get( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.GetD16 %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets integer value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, TInt aVal )
+ {
+ __VTPRINTENTER( "CRProxy.SetInt" )
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Set( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.SetInt %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets real value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, const TReal& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.SetR" )
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Set( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.SetR %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets binary value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, const TDesC8& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.SetD8" )
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Set( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.SetD8 %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets string value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set(
+ const TUid aUid, const TUint32 aId, const TDesC16& aVal )
+ {
+ __VTPRINTENTER( "CRProxy.SetD16" )
+ CRepository* crSession = NULL;
+ TRAPD( err, GetSessionL( aUid, crSession ) );
+ if ( err == KErrNone )
+ {
+ err = crSession->Set( aId, aVal );
+ }
+ __VTPRINTEXITR( "CRProxy.SetD16 %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::CCRSession::~CCRSession
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CCRSession::~CCRSession()
+ {
+ __VTPRINTENTER( "CRProxy.~" )
+ delete iSession;
+ __VTPRINTEXIT( "CRProxy.~" )
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngDeviceLockMonitor.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 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: Monitors device lock state
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngDeviceLockMonitor.h"
+#include "CVTEngPubSubsListener.h"
+#include "CVtEngEventManager.h"
+#include "cvtlogger.h"
+
+#include <coreapplicationuisdomainpskeys.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngDeviceLockMonitor* CVtEngDeviceLockMonitor::NewL()
+ {
+ CVtEngDeviceLockMonitor* self = new ( ELeave ) CVtEngDeviceLockMonitor();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// Destructor
+CVtEngDeviceLockMonitor::~CVtEngDeviceLockMonitor()
+ {
+ delete iAutolockListener;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::NotifyState
+// Notifies UI about device lock state
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::NotifyState() const
+ {
+ __VTPRINTENTER( "LockMonitor.NotifyState" )
+
+ TInt state = EAutolockStatusUninitialized;
+
+ // Get autolock state
+ TInt err = iAutolockListener->Get( state );
+
+ __VTPRINT2( DEBUG_GEN, "LockMonitor Get err: %d", err );
+ __VTPRINT2( DEBUG_GEN, "LockMonitor state: %d", state );
+
+ if( err == KErrNone )
+ {
+ const TInt event =
+ ( state <= EAutolockOff ) ?
+ KVtEngDeviceLockOff : KVtEngDeviceLockOn;
+ CVtEngEventManager::NotifyEvent( event );
+ }
+
+ __VTPRINTEXIT( "LockMonitor.NotifyState" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::HandleNotifyPSL
+// Callback for autolock state change
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::HandleNotifyPSL(
+ const TUid aUid,
+ const TInt& aKey,
+ const TRequestStatus& aStatus )
+ {
+ if ( aStatus == KErrNone &&
+ aUid == KPSUidCoreApplicationUIs &&
+ aKey == KCoreAppUIsAutolockStatus )
+ {
+ NotifyState();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::CVtEngDeviceLockMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDeviceLockMonitor::CVtEngDeviceLockMonitor()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::ConstructL()
+ {
+ __VTPRINTENTER( "LockMonitor.ConstructL" )
+ // Listener for autolock state
+ iAutolockListener = CVtEngPubSubsListener::NewL(
+ KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, this );
+ __VTPRINTEXIT( "LockMonitor.ConstructL" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngEventManager.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2006 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: Event manager implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngEventManager.h"
+#include "MVtEngEventObserver.h"
+#include "VtEngUtils.h"
+#include "VtEngEvents.h"
+#include "VtEngPanic.h"
+#include <cvtlogger.h>
+
+// CONSTANTS
+const TInt KMaxEventsInQueue = 8;
+
+// max amount of simultanous event observers
+const TInt KMaxVtEventObservers = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::CVtEngEventManager
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager::CVtEngEventManager() : CActive( CActive::EPriorityHigh ),
+ iObservers( KMaxVtEventObservers )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager* CVtEngEventManager::NewL(
+ MVtEngEventObserver& aEventObserver )
+ {
+ CVtEngEventManager* self =
+ new ( ELeave ) CVtEngEventManager();
+ CleanupStack::PushL( self );
+ self->ConstructL( aEventObserver );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::ConstructL
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::ConstructL( MVtEngEventObserver& aEventObserver )
+ {
+ iEventQueue = new ( ELeave ) CArrayFixFlat< TInt >( KMaxEventsInQueue );
+ iEventQueue->SetReserveL( KMaxEventsInQueue );
+ User::LeaveIfError( iObservers.Append( &aEventObserver ) );
+ }
+
+// Destructor
+CVtEngEventManager::~CVtEngEventManager()
+ {
+ Cancel();
+ delete iEventQueue;
+ iObservers.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::SessionStateChangedL
+// Notifies session state change to UI.
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::SessionStateChanged()
+ {
+ __VTPRINTENTER( "EventManager.SessionStateChanged" )
+ NotifyEvent( KVtEngSessionStateChanged );
+ __VTPRINTEXIT( "EventManager.SessionStateChanged" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::NotifyEvent
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::NotifyEvent( const TInt aEvent )
+ {
+ __VTPRINTENTER( "EventManager.NotifyEvent" )
+ __VTPRINT2( DEBUG_GEN, "EventManager.NotifyEvent event=%d", aEvent );
+ CVtEngEventManager& eventManager =
+ CVtEngUtility::EventManager();
+ if ( !eventManager.QueueAsyncEvent( aEvent ) )
+ {
+ eventManager.DoNotifyEvent( aEvent );
+ }
+ __VTPRINTEXIT( "EventManager.NotifyEvent" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::AddObserverL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::AddObserverL( MVtEngEventObserver* aObserver )
+ {
+ TInt count( iObservers.Count() );
+ TBool duplicate = EFalse;
+ while ( count-- )
+ {
+ if ( aObserver == iObservers[ count ] )
+ {
+ count = 0; // break loop
+ duplicate = ETrue;
+ }
+ }
+ if ( !duplicate )
+ {
+ User::LeaveIfError( iObservers.Append( aObserver ) );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::RemoveObserver
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::RemoveObserver( const MVtEngEventObserver* aObserver )
+ {
+ TInt count( iObservers.Count() );
+ while ( count-- )
+ {
+ if ( aObserver == iObservers[ count ] )
+ {
+ iObservers.Remove( count );
+ count = 0; // break loop
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::RunL
+// Notify event
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::RunL()
+ {
+ __VTPRINTENTER( "EventManager.RunL" )
+ __VTPRINT2( DEBUG_GEN, "EventManager.RunL count=%d", iEventQueue->Count() );
+ // get oldest event in queue (event at index 0)
+ const TInt event = iEventQueue->At( 0 ) ;
+
+ // delete event before calling DoNotifyEvent(), because DoNotifyEvent() may
+ // hang if it causes ASynchronous call in handler
+ iEventQueue->Delete( 0 );
+
+ // if more events pending -> signal again
+ if( iEventQueue->Count() > 0 )
+ {
+ Signal();
+ }
+
+ // and finally notify event
+ DoNotifyEvent( event );
+ __VTPRINTEXIT( "EventManager.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::DoCancel
+// No op
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::DoCancel()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::DoNotifyEvent
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::DoNotifyEvent( const TInt aEvent )
+ {
+ __VTPRINTENTER( "EventManager.DoNotifyEvent" )
+ __VTPRINT2( DEBUG_GEN, "EventManager.DoNotifyEvent event=%d", aEvent );
+ TRAP_IGNORE( {
+ TInt count( iObservers.Count() );
+ while ( count-- )
+ {
+ iObservers[count]->HandleVtEventL( aEvent ) ;
+ }
+ } )
+ __VTPRINTEXIT( "EventManager.DoNotifyEvent" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::QueueAsyncEvent
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngEventManager::QueueAsyncEvent( const TInt aEvent )
+ {
+ __VTPRINTENTER( "EventManager.QueueAsyncEvent" )
+ __VTPRINT2( DEBUG_GEN, "EventManager.QueueAsyncEvent event=%d", aEvent );
+ TBool async( EFalse );
+ switch ( aEvent )
+ {
+ case KVtEngSessionStateChanged:
+ case KVtEngNegotiationProblem:
+ case KVtEngShareImageInitializeBegin:
+ case KVtEngShareImageInitializeEnd:
+ async = ETrue;
+ QueueAndSignal( aEvent );
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "EventManager.QueueAsyncEvent" )
+ return async;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::QueueAndSignal
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::QueueAndSignal( const TInt aEvent )
+ {
+ __VTPRINTENTER( "EventManager.QueueAndSignal" )
+ __VTPRINT2( DEBUG_GEN, "EventManager.QueueAndSignal event=%d", aEvent );
+ if( iEventQueue->Count() < KMaxEventsInQueue )
+ {
+ TRAP_IGNORE( iEventQueue->AppendL( aEvent ) ); // can't leave
+ Signal();
+ }
+ else
+ {
+ Panic( EVtEngPanicInvalidTooManyPendingEvents );
+ }
+ __VTPRINTEXIT( "EventManager.QueueAndSignal" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::Signal
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::Signal()
+ {
+ __VTPRINTENTER( "EventManager.Signal" )
+ if( !IsActive() )
+ {
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ __VTPRINT2( DEBUG_GEN, "EventManager.QueueAndSignal count=%d", iEventQueue->Count() );
+ }
+ __VTPRINTEXIT( "EventManager.Signal" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngHandlerContainer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2006 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: Container for functional handlers in the engine.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngHandlerContainer.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Uninitialize
+// Uninitialises handlers.
+// -----------------------------------------------------------------------------
+//
+void CVtEngHandlerContainer::Uninitialize()
+ {
+ iSession->Uninitialize();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::CVtEngHandlerContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngHandlerContainer::CVtEngHandlerContainer()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngHandlerContainer::ConstructL( )
+ {
+ iMedia = CVtEngMediaHandler::NewL( );
+ iSession = CVtEngSessionHandler::NewL( );
+ iAudio = CVtEngAudioHandler::NewL( );
+
+ }
+
+void CVtEngHandlerContainer::CreateDtmfHandlerL(
+ MVtH324ConfigCommand* aH324Config )
+ {
+ __VTPRINTENTER( "HlrCnr.CreateDtmfHandlerL" )
+ iDtmf = CVtEngDtmfHandler::NewL( *aH324Config );
+ __VTPRINTEXIT( "HlrCnr.CreateDtmfHandlerL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngHandlerContainer* CVtEngHandlerContainer::NewL( )
+ {
+ __VTPRINTENTER( "HlrCnr.NewL" )
+
+ CVtEngHandlerContainer* self = new( ELeave ) CVtEngHandlerContainer;
+
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "HlrCnr.NewL" )
+ return self;
+ }
+
+
+// Destructor
+CVtEngHandlerContainer::~CVtEngHandlerContainer()
+ {
+ __VTPRINTENTER( "HlrCnr.~" )
+
+ delete iMedia;
+ delete iSession;
+ delete iAudio;
+ delete iDtmf;
+
+ __VTPRINTEXIT( "HlrCnr.~" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngInitializer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,687 @@
+/*
+* Copyright (c) 2004 - 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: Implementation class for initializing the engine gradually.
+* Active object initializes one "subsystem" on each
+* round. In case of failure timer is started and
+* retrial is done after time-out. Uninitialization
+* is done is one shot.
+
+
+
+
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngInitializer.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngEventManager.h"
+#include "VtEngUtils.h"
+#include "CVtEngHandlerContainer.h"
+#include "CVtEngOperation.h"
+#include "VtEngPanic.h"
+#include "VtEngConstants.h"
+#include "VtEngDefs.hrh"
+#include <cvtlogger.h>
+#include <mvtprotocolhandler.h>
+#include <telcommsinfopskeys.h>
+#include <videotelephonyvariant.hrh>
+#include "VtEngUtils.h"
+#include "CVtEngSettings.h"
+
+// CONSTANTS
+const TInt KVtEngInitializerPriority = CActive::EPriorityStandard;
+const TInt KVtEngInitializerRetrials = 3;
+const TInt KVtEngInitializerRetrialTimeout = 500000; // 0.5 seconds
+const TInt KVtEngInitializerTimerPriority = CActive::EPriorityUserInput;
+
+_LIT( KVtEngCommDiagPortName, "PVDIAGPORT" );
+_LIT( KVtEngCommTestPortName, "COMM::0" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CVtEngInitializer* CVtEngInitializer::NewL( CVtEngHandlerContainer& aHandlers )
+ {
+ __VTPRINTENTER( "Intlzr.NewL" )
+ CVtEngInitializer* self = new ( ELeave ) CVtEngInitializer( aHandlers );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "Intlzr.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CVtEngInitializer
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngInitializer::CVtEngInitializer(
+ CVtEngHandlerContainer& aHandlers ) :
+ CActive( KVtEngInitializerPriority ),
+ iHandlers( aHandlers ),
+ iStep( EInitNone ),
+ iDataportHandled( 0 ),
+ iOwnershipInMH( EFalse )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::ConstructL
+// Second phase constructor.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::ConstructL()
+ {
+ iTimer = CPeriodic::NewL( KVtEngInitializerTimerPriority );
+
+ }
+
+// Destructor
+CVtEngInitializer::~CVtEngInitializer()
+ {
+ __VTPRINTENTER( "Intlzr.~" )
+ delete iTimer;
+ Cancel();
+
+ if ( iSessionCommand && !iOwnershipInMH )
+ {
+ VTProtocolFactory::DeleteSessionCommand( iSessionCommand );
+ iSessionCommand = NULL;
+ }
+ __VTPRINTEXIT( "Intlzr.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::InitializeL
+// Start initialization process.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::InitializeL( CVtEngOperation& aCallback )
+ {
+ __VTPRINTENTER( "Intlzr.InitializeL" )
+ __VTPRINT( DEBUG_GEN, "Intlzr.Init")
+ __ASSERT_ALWAYS( iStep != EInitComplete,
+ Panic( EVtEngPanicInvalidInitializationEntry ) );
+ iCallback = &aCallback;
+ if ( iStep == EInitComplete )
+ {
+ __VTPRINTEXIT( "Intlzr.InitializeL" )
+ return;
+ }
+ ContinueOrRetry( EContinue );
+ __VTPRINTEXIT( "Intlzr.InitializeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CancelInit
+// Cancels already started ini.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::CancelInit()
+ {
+ __VTPRINTENTER( "Intlzr.CancelInit" )
+ TBool cancelSignalled = EFalse;
+ __VTPRINT2( DEBUG_GEN, "Intlzr.CancelInit %d", iStep )
+ if ( IsActive() )
+ {
+ switch ( iStep )
+ {
+ case EInitMedia: // media->InitializeL pending
+ case EInitProto: // media->InitializeProviderL pending
+ {
+ if ( ! ( iDataportHandled & EDataportReceived ) )
+ {
+ __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete" )
+ if ( iStatus == KRequestPending )
+ {
+ // Actual protocol init is not done yet.
+ TRequestStatus* status = &iStatus;
+ __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete1" )
+ User::RequestComplete( status, KErrNone );
+ __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete2" )
+ }
+ iDataportHandled |= EDataportReceived;
+ __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete" )
+ }
+ __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit MH cancel" )
+ CVtEngMediaHandler* media =
+ static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+ media->CancelInitialize();
+ iStep = EResetMediaPhase2;
+ }
+ break;
+ case EResetMedia:
+ break;
+ default:
+ cancelSignalled = ETrue;
+ Cancel();
+ }
+ }
+ __VTPRINTEXITR( "Intlzr.CancelInit %d", cancelSignalled )
+ return cancelSignalled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Uninitialize
+// Start un-initialization process.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::Uninitialize( CVtEngOperation& aCallback )
+ {
+ __VTPRINTENTER( "Intlzr.Uninitialize" )
+ iCallback = &aCallback;
+ ContinueOrRetry( EReset );
+ __VTPRINTEXIT( "Intlzr.Uninitialize" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::GetSessionCommand
+// Transfer ownership of Protocol and continue initialization.
+//
+// -----------------------------------------------------------------------------
+//
+MVtSessionCommand* CVtEngInitializer::GetSessionCommand()
+ {
+ __VTPRINTENTER( "Intlzr.GetSessionCommand" )
+ __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.GetSessionCommand iSessionCommand: $%x", reinterpret_cast< TUint >( iSessionCommand ) )
+ MVtSessionCommand* sessionCommand = iSessionCommand;
+
+ // Set ownership to media handler since media handler is requesting so.
+ iOwnershipInMH = ETrue;
+ if( iStep >= EInitDataportCompleted )
+ {
+ // Ownership can be totally given to MH after dataport is loaned.
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.GetSessionCommand iSessionCommand ownership to MH GetSessionCommand")
+
+ iSessionCommand = NULL;
+ iStep = EInitComplete;
+ ContinueOrRetry( EContinue );
+ }
+ if ( iStep != EResetMedia )
+ {
+ __VTPRINT( DEBUG_GEN, "Intlzr.GetSessionCommand=>ContinueOrRetry( EContinue )")
+ ContinueOrRetry( EContinue );
+ }
+ else
+ {
+ // Reset requested. ContinueOrRetry with EReset was called
+ // while protocol Init was ongoing. Now continue
+ __VTPRINT( DEBUG_GEN, "Intlzr.GetSessionCommand=>ContinueOrRetry( EReset )")
+ ContinueOrRetry( EReset );
+ }
+ __VTPRINTEXIT( "Intlzr.GetSessionCommand" )
+ return sessionCommand;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Initialized
+// Returns if engine is initialized.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::Initialized() const
+ {
+ return ( iStep == EInitComplete );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::RunL
+// Perform initialization step
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::RunL()
+ {
+ __VTPRINTENTER( "Intlzr.RunL" )
+ __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run step=%d err=%d",
+ iStep, iStatus.Int() )
+ if ( iStatus != KErrNone )
+ {
+ Notify( iStatus.Int() );
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ }
+ CVtEngMediaHandler* media =
+ static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+
+ switch ( iStep )
+ {
+ case EInitNone:
+ return;
+ case EInitMedia:
+ // Initialize video source
+ iStatus = KRequestPending;
+ media->InitializeL( iStatus );
+ SetActive();
+ iStep++; // EInitProto
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ case EInitProto:
+ // Initialize Protocol => create terminal only once.
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run create Protocol")
+ if ( !iSessionCommand )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run DOCREATE Protocol" )
+ TVt3G324MSupported protocolSupported;
+ iSessionCommand = VTProtocolFactory::CreateSessionCommandL(
+ media, ETrue, protocolSupported );
+
+ if (protocolSupported == EVt3G324MMissing)
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run init 3G324M stack is missing")
+ Notify(KErrNotReady);
+ return;
+ }
+
+ // Initialize Protocol immediately after it is created.
+ if( iSessionCommand )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run InitL protocol")
+ iSessionCommand->InitProtocolL( media->SdkInitInfo() );
+ }
+ }
+ if ( iSessionCommand )
+ {
+ const TDesC* dataportName = NULL;
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run init protocol")
+ if(iCallback->Command() == KVtEngInitializeEngineTest )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.Run init with COMM::0")
+ CVtEngUtility::Settings().SetConnectReady();
+ iComms = VTProtocolFactory::CreateCommServerL(
+ KVtEngCommTestPortName );
+ }
+ else if( iCallback->Command() == KVtEngInitializeEngineDiag )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.Run init with PVDIAGPORT")
+ CVtEngUtility::Settings().SetConnectReady();
+ iComms = VTProtocolFactory::CreateCommServerL(
+ KVtEngCommDiagPortName );
+ }
+ else
+ { // [MediatorChange]:
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.Run init with DATAPORT" )
+ dataportName =
+ CVtEngUtility::Settings().DataportInfo();
+ if ( !dataportName )
+ {
+ // not available yet, start waiting,
+ // HandleSettingChangedL is called when dataport
+ // becomes available
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.Run DATAPORT is not ready yet" )
+
+ CVtEngUtility::Settings().NotifyChangeL(
+ CVtEngSettings::EDataportInfo, *this );
+ iStatus = KRequestPending;
+ SetActive();
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ }
+ else
+ {
+ //RDebug::Print( _L("DataportName is:%S"), dataportName );
+ TBool bitReversed( BitReversalUsed() );
+
+ iComms = VTProtocolFactory::CreateCommServerL(
+ *dataportName, bitReversed );
+ // not interested of DP info any more
+ CVtEngUtility::Settings().CancelNotifyChange(
+ CVtEngSettings::EDataportInfo, *this );
+ }
+ }
+
+ // Initialization is now completed
+ iStep = EInitDataportCompleted;
+
+ // Dataport is now loaned
+ CVtEngUtility::Settings().SetDataportLoaned( ETrue );
+
+ // Update states since dataport is now loaned
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update();
+
+ // No need for ownership anymore, media handler owns the pointer and is
+ // responsible of deletion.
+ if( iOwnershipInMH )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run iSessionCommand ownership to MH")
+ iSessionCommand = NULL;
+ iStep = EInitComplete;
+ ContinueOrRetry( EContinue );
+ }
+
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.Run init protocol port operation completed")
+ // Media handler calls GetSessionCommand when InitL
+ // is complete and initialization continues.
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ }
+ break;
+ case EInitSession:
+ {
+ CVtEngSessionHandler* session =
+ static_cast<CVtEngSessionHandler*>( &iHandlers.Session() );
+ session->InitializeL();
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.RunL StartMediatorListenerL" )
+ CVtEngUtility::EngineUtils()->StartMediatorListenerL();
+ }
+ break;
+ case EResetMedia:
+ iHandlers.Uninitialize();
+ iStatus = KRequestPending;
+ media->Uninitialize( iStatus );
+ SetActive();
+ iStep++; // EResetMediaPhase2
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.RunL step reset media started" )
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ case EResetMediaPhase2:
+ if ( iComms )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.RunL VTENgine deletes COMM server" )
+ CVtEngMediaHandler* media =
+ static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+ if ( media->ProtoInitialized() )
+ {
+ TRAPD( err, VTProtocolFactory::DeleteCommServerL( iComms ) );
+ __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL,
+ "Intlzr.RunL VTENgine deletes COMM server err=%d", err )
+ __ASSERT_ALWAYS( err == KErrNone,
+ Panic( EVtEngPanicCommsDestructOnInvalidState ) );
+ iComms = NULL;
+ }
+ else if ( !media->ProtoInitialized() && iSessionCommand )
+ {
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ return;
+ }
+ }
+ break;
+ case EInitComplete:
+ break;
+ default:
+ Panic( EVtEngPanicInvalidInitializationState );
+ break;
+ }
+ ContinueOrRetry( EContinue );
+ __VTPRINTEXIT( "Intlzr.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::DoCancel
+// Cancels initialization
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::DoCancel()
+ {
+ __VTPRINTENTER( "Intlzr.DoCancel" )
+ if ( iStatus == KRequestPending )
+ {
+ __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.DoCancel step=%d", iStep )
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrCancel );
+ }
+ iStep = EInitNone;
+ iCallback = NULL;
+ __VTPRINTEXIT( "Intlzr.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::RunError
+// Handler error on initialization.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngInitializer::RunError( TInt aError )
+ {
+ __VTPRINTENTER( "Intlzr.RunError" )
+ __VTPRINT2( DEBUG_GEN, "Intlzr.RunError %d", aError )
+ if ( iRetrials )
+ {
+ __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.retrials %d", iRetrials )
+ TCallBack callback( CVtEngInitializer::HandleTimer, this );
+ iTimer->Start(
+ KVtEngInitializerRetrialTimeout,
+ KVtEngInitializerRetrialTimeout,
+ callback );
+ }
+ else
+ {
+ Notify( aError );
+ }
+ __VTPRINTEXIT( "Intlzr.RunError" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleTimer
+// Handler for retrial timer.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngInitializer::HandleTimer( TAny* aAny )
+ {
+ CVtEngInitializer* handler =
+ reinterpret_cast<CVtEngInitializer*>( aAny );
+ handler->DoHandleTimer();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::DoHandleTimer
+// Handler for retrial timer.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::DoHandleTimer()
+ {
+ iTimer->Cancel();
+ ContinueOrRetry( ERetry );
+ }
+
+TBool CVtEngInitializer::ActivateAndSignal( TInt aSignalValue )
+ {
+ __VTPRINTENTER( "Intlzr.ActivateAndSignal" )
+ TRequestStatus* status = &iStatus;
+ TBool signaled = EFalse;
+ if ( iStatus.Int() != KRequestPending && !IsActive() )
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ User::RequestComplete( status, aSignalValue );
+ signaled = ETrue;
+ }
+ __VTPRINTEXITR( "Intlzr.ActivateAndSignal signaled=%d", signaled )
+ return signaled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CreateDtmfHandlerL
+// Creates handler for DTMF sending.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config )
+ {
+ iHandlers.CreateDtmfHandlerL( aH324Config );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::ContinueOrRetry
+// Proceed to next step, retry on failure or notify observer.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::ContinueOrRetry( const TProcess aOperation )
+ {
+ __VTPRINTENTER( "Intlzr.ContinueOrRetry" )
+ __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=%d", aOperation )
+ if ( aOperation == EContinue )
+ {
+ const TBool resetComplete( iStep == EResetMediaPhase2 );
+ // check if last step complete and notify observer
+ if ( iStep == EInitComplete || resetComplete )
+ {
+ if ( resetComplete &&
+ // resetComplete is true also when clearing state is entered
+ // while waiting for dataport. In that case Final Uninit must
+ // not be done because MediaHandler's state is not ready for
+ // it => need to wait for KVtEngResetEngine from UI
+ iCallback->Command() == KVtEngResetEngine )
+ {
+ CVtEngMediaHandler* media =
+ static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+ media->FinalizeUninitialization();
+ iStep = EInitNone;
+ }
+ Notify( KErrNone );
+ __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 1 )
+ return;
+ }
+ else if( iStep == EInitProto )
+ {
+ __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 2 )
+ return;
+ }
+ __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 3 )
+ iStep++;
+ iRetrials = KVtEngInitializerRetrials;
+ }
+ else if ( aOperation == EReset )
+ {
+ __VTPRINT( DEBUG_GEN, "Intlzr.CoR op=EReset")
+ iRetrials = KVtEngInitializerRetrials;
+ const TInt step( iStep );
+ if ( step != EInitComplete && IsActive() )
+ {
+ // Reset requested while init ongoing but
+ // Protocol InitL not yet issued
+ if ( CancelInit() == EFalse )
+ { // AO still active, must return here because end of this method
+ __VTPRINT( DEBUG_GEN, " Initializer CoR 2")
+ __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+ return;
+ }
+ }
+ iStep = EResetMedia;
+ if ( ( step == EInitProto ||
+ step == EInitSession ) && !IsActive() )
+ {
+ // Protocol InitL is pending. Wait until it completes.
+ // GetSessionCommand is called and there we this is
+ // again called.
+ __VTPRINT( DEBUG_GEN, " Initializer reset while InitL")
+ __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+ return;
+ }
+ }
+ else
+ {
+ iRetrials--;
+ }
+ ActivateAndSignal( KErrNone );
+ __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Notify
+// Notifies observer on completion or error.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::Notify( const TInt aResult )
+ {
+ __VTPRINTENTER( "Intlzr.Notify" )
+ if ( iStep == EInitComplete )
+ {
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update();
+ }
+
+ if ( iCallback )
+ {
+ if ( aResult != KErrCancel )
+ { // UI is not interested on cancel completion
+ iCallback->HandleOpComplete( aResult );
+ }
+ iCallback = NULL;
+ __VTPRINT2( DEBUG_GEN, "Intlzr.Notify res=%d", aResult )
+ }
+ __VTPRINTEXIT( "Intlzr.Notify" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::BitReversalUsed
+// Checks if bit reversal should be used from locally variated information.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::BitReversalUsed()
+ {
+ __VTPRINT( DEBUG_GEN, "Intlzr.BitReversalUsed" )
+ return CVtEngUtility::Settings().CheckBits(
+ KVTLVFlagEnableBitReversal );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleSettingChangedL
+// Notification of received dataport name.
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::HandleSettingChangedL(
+ CVtEngSettings::TSettingId aId,
+ const TDesC& /*aValue*/ )
+ {
+ __VTPRINTENTER( "Intlzr.HandleSettingChangedL" )
+ if ( !( iDataportHandled & EDataportReceived ) &&
+ aId == CVtEngSettings::EDataportInfo &&
+ iStatus == KRequestPending )
+
+ {
+ iDataportHandled |= EDataportReceived;
+ //dataport will be fetched in runl, otherwise, cancelinit can not work
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ }
+ __VTPRINTEXIT( "Intlzr.HandleSettingChangedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::GetVtComms
+// Return pointer to communication port.
+// -----------------------------------------------------------------------------
+//
+MCommServer* CVtEngInitializer::GetVtComms()
+ {
+ return iComms;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngModel.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2006 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: Video telephony engine class implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngModel.h"
+#include "CVtEngHandlerContainer.h"
+#include "CVtEngCommandHandler.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngStateManager.h"
+#include "VtEngUtils.h"
+#include "VtEngPanic.h"
+#include <cvtlogger.h>
+#include "CVtEngExtensions.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::CVtEngModel
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngModel::CVtEngModel()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngModel::ConstructL(
+ MVtEngEventObserver& aEventObserver,
+ MVtEngCommandObserver& aCommandObserver )
+ {
+ VTLOGINIT
+ __VTPRINTENTER( "Model.ConstructL" )
+
+ __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "Model.ConL" )
+ iUtils = CVtEngUtility::NewL( );
+ iHandlers = CVtEngHandlerContainer::NewL( );
+
+ // Create extensions
+ iExtensions = CVtEngExtensions::NewL();
+
+ iUtils->PrepareL(
+ *iHandlers,
+ iStateManager,
+ iEventManager,
+ iExtensions );
+ iCommandHandler = CVtEngCommandHandler::NewL( *iHandlers );
+ iCommandHandler->AddObserverL( aCommandObserver );
+ iEventManager = CVtEngEventManager::NewL( aEventObserver );
+ iStateManager = CVtEngStateManager::NewL( *iHandlers, *iEventManager );
+ __VTPRINTEXIT( "Model.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtEngModel* CVtEngModel::NewL(
+ MVtEngEventObserver& aEventObserver,
+ MVtEngCommandObserver& aCommandObserver)
+ {
+ CVtEngModel* self = new( ELeave ) CVtEngModel;
+
+ CleanupStack::PushL( self );
+ self->ConstructL( aEventObserver, aCommandObserver );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// Destructor
+CVtEngModel::~CVtEngModel()
+ {
+ __VTPRINTENTER( "Model.~" )
+ delete iStateManager;
+ delete iCommandHandler;
+ delete iHandlers;
+ delete iUtils;
+ delete iEventManager;
+ delete iExtensions;
+ __VTPRINTEXIT( "Model.~" )
+ VTLOGUNINIT
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::CommandHandler
+// Returns command handler reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngCommandHandler& CVtEngModel::CommandHandler() const
+ {
+ return *iCommandHandler;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Session
+// Returns session reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngSessionInfo& CVtEngModel::Session() const
+ {
+ return iHandlers->Session();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Media
+// Returns media reference.
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngMedia& CVtEngModel::Media() const
+ {
+ return iHandlers->Media();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Audio
+// Returns audio reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngAudio& CVtEngModel::Audio() const
+ {
+ return iHandlers->Audio();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Extension
+// Returns extension pointer (currently none)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TAny* CVtEngModel::Extension( const TUid& aExtensionUid )
+ {
+ __VTPRINTENTER( "Model.Extension" )
+
+ // init local variables
+ TInt error = KErrNone;
+ TAny* interfacePtr = NULL;
+
+ // get mediahandler handle
+ MVtEngMedia& msession = iHandlers->Media();
+ CVtEngMediaHandler& handler = static_cast<CVtEngMediaHandler&>( msession );
+
+ // get API IF from extension
+ error = iExtensions->GetClientInterface( &interfacePtr, aExtensionUid ,
+ handler );
+
+ // in case of error
+ if ( error != KErrNone )
+ {
+ __VTPRINTEXITR( "Model.Extension GetClientInterface failed %d", error)
+ return NULL;
+ }
+
+ __VTPRINTEXIT( "Model.Extension" )
+ return interfacePtr;
+ }
+
+// Engine's internal panic function
+void Panic( TVtEngPanic aPanic )
+ {
+ __VTPRINT2( DEBUG_GEN, "EnginePanic %d", aPanic)
+ User::Panic( KVtEngPanicCategory, aPanic );
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngPubSubsListener.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2004-2006 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: Publish and subscribe settings listener.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVTEngPubSubsListener.h"
+#include "MVtEngSettingPSObserver.h"
+#include <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::CVtEngPubSubsListener
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener::CVtEngPubSubsListener(
+ const TUid aUid, const TInt aKey, MVtEngSettingPSObserver* aObserver ) :
+ CActive( CActive::EPriorityStandard ),
+ iUid( aUid ), iId( aKey ), iCallback( aObserver )
+ {
+ __VTPRINT( DEBUG_CONSTRUCT, "CVtEngPubSubsListener C++" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::~CVtEngPubSubsListener
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener::~CVtEngPubSubsListener()
+ {
+ __VTPRINTENTER( "PSLis.~" )
+ Cancel();
+ iProperty.Close();
+ __VTPRINTEXIT( "PSLis.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::RunL
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::RunL()
+ {
+ __VTPRINTENTER( "PSLis.RunL" )
+ const TRequestStatus status( iStatus );
+ StartListening();
+ iCallback->HandleNotifyPSL( iUid, iId, status );
+ __VTPRINTEXIT( "PSLis.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::DoCancel
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::DoCancel()
+ {
+ __VTPRINTENTER( "PSLis.DoCancel" )
+ iProperty.Cancel();
+ __VTPRINTEXIT( "PSLis.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::RunError
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::RunError( TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "PSLis.RunError" )
+ __VTPRINTEXIT( "PSLis.RunError" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener* CVtEngPubSubsListener::NewL( const TUid aUid,
+ const TInt aKey, MVtEngSettingPSObserver* aObserver )
+ {
+ __VTPRINTENTER( "PSLis.NewL" )
+ CVtEngPubSubsListener* self = new( ELeave )
+ CVtEngPubSubsListener( aUid, aKey, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "PSLis.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::StartListening
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::StartListening()
+ {
+ iProperty.Subscribe( iStatus );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::ConstructL()
+ {
+ CActiveScheduler::Add( this );
+
+ User::LeaveIfError ( iProperty.Attach( iUid, iId, EOwnerThread ) );
+ StartListening();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::Get( TInt& aVal )
+ {
+ return iProperty.Get( iUid, iId, aVal );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read binary value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::Get( TDes8& aVal )
+ {
+ return iProperty.Get( iUid, iId, aVal );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read string value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::Get( TDes16& aVal )
+ {
+ return iProperty.Get( iUid, iId, aVal );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngSATClient.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005 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: SAT listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngStateManager.h"
+#include "CVtEngSATClient.h"
+#include "VtEngUtils.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::CVtEngSATClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient::CVtEngSATClient() :
+ iSatSession(),
+ iSatRefresh( *this )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "CSATClient.C++" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient* CVtEngSATClient::NewL( )
+ {
+ __VTPRINTENTER( "CSATClient.NewL" )
+ CVtEngSATClient* self = new( ELeave ) CVtEngSATClient;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ __VTPRINTEXIT( "CSATClient.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::~CVtEngSATClient
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient::~CVtEngSATClient()
+ {
+ __VTPRINTENTER( "CSATClient.~" )
+ iSatRefresh.Close();
+ iSatSession.Close();
+ __VTPRINTEXIT( "CSATClient.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::ConstructL
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSATClient::ConstructL()
+ {
+ iSatSession.ConnectL();
+ iSatRefresh.OpenL( iSatSession );
+ iSatRefresh.NotifyFileChangeL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::AllowRefresh
+// Callback from SAT.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSATClient::AllowRefresh(
+ TSatRefreshType aType,
+ const TSatRefreshFiles& /*aFiles*/ )
+ {
+ __VTPRINTENTER( "CSATClient.AllowRefresh" )
+ TBool ret( EFalse );
+ const MVtEngSessionInfo::TSessionState state(
+ CVtEngUtility::StateManager()->SessionState() );
+ if ( state == MVtEngSessionInfo::EIdle || aType == EFileChangeNotification )
+ {
+ __VTPRINT2( DEBUG_GEN, " TSatRefreshType aType=%d", aType )
+ ret = ETrue;
+ }
+ __VTPRINTEXITR( "CSATClient.AllowRefresh ret=%d", ret )
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::Refresh
+// Callback from SAT.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSATClient::Refresh(
+ TSatRefreshType /* aType */,
+ const TSatRefreshFiles& /* aFiles */ )
+ {
+ // Not needed.
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "CSATClient.Refresh" )
+ iSatRefresh.RefreshEFRead( EFalse );
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngSettings.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,948 @@
+/*
+* Copyright (c) 2004-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: Video call setting data
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngSettings.h"
+#include <cvtlogger.h>
+#include "MVtEngSettingObserver.h"
+#include "VtEngUtils.h"
+#include "VtEngPanic.h"
+#include <telincallvolcntrlcrkeys.h>
+#include <rphcltserver.h>
+#include <cphcltimagehandler.h>
+#include <videotelephonyinternalcrkeys.h>
+#include <LogsDomainCRKeys.h>
+#include <settingsinternalcrkeys.h>
+#include <videotelephonyvariant.hrh>
+
+// CONSTANTS
+// Granularity for observer array.
+const TInt KVtEngObserverArrayGranularity = 2;
+
+// Volume default level.
+const TInt KVtEngVolumeDefaultLevel = 4;
+
+// Video quality frame rate configuration buffer size
+const TInt KVtEngVQFRBufferSize = 32;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CVtEngSettings
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::CVtEngSettings() :
+ iVariantReadOnlyValues( KErrNotReady )
+ {
+ iCLI.iValid = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ConstructL()
+ {
+ __VTPRINTENTER( "Settings.ConstructL" )
+ iSelectVolumeIdle = CIdle::NewL( CActive::EPriorityHigh );
+ iObserverItems = new ( ELeave )
+ CArrayFixFlat<TObserverItem>( KVtEngObserverArrayGranularity );
+
+ // Ear volume CR listener.
+ iCRProxy = &CVtEngUtility::CRProxy();
+ CreateDataObserverL( this, KCRUidInCallVolume, KTelIncallEarVolume,
+ CCenRepNotifyHandler::EIntKey );
+
+ // IHF volume listener.
+ CreateDataObserverL(
+ this, KCRUidInCallVolume, KTelIncallLoudspeakerVolume,
+ CCenRepNotifyHandler::EIntKey );
+
+ // Call duration listener.
+ CreateDataObserverL( this, KCRUidLogs, KLogsShowCallDuration,
+ CCenRepNotifyHandler::EIntKey );
+
+ // Still image listener.
+ CreateDataObserverL( this, KCRUidTelephonySettings, KSettingsVTStillImage,
+ CCenRepNotifyHandler::EIntKey );
+
+ // Still image path listener.
+ CreateDataObserverL(
+ this, KCRUidTelephonySettings, KSettingsVTStillImagePath,
+ CCenRepNotifyHandler::EStringKey );
+
+ ReadVariationsL();
+ ResetAll();
+
+
+ TInt validImage( 0 );
+ TInt err = iCRProxy->Get( KCRUidTelephonySettings,
+ KSettingsVTStillImage, validImage );
+ __VTPRINT3( DEBUG_DETAIL, "Settings.ConL: use image", err, validImage )
+ if ( !err && validImage )
+ {
+ __VTPRINT( DEBUG_DETAIL, "Settings.ConL: VALID" )
+ iConfig.iVideo.iImageIsValid = ETrue;
+ }
+
+ TInt value( 0 ); // not shown
+ err = iCRProxy->Get( KCRUidLogs, KLogsShowCallDuration, value );
+ if ( err == KErrNone )
+ {
+ iConfig.iCallTimerOn = ( value == 1 ) ? ETrue : EFalse;
+ }
+
+ // Initialize the volume levels.
+ // If value retrieval fails, use defaults.
+ if ( iCRProxy->Get( KCRUidInCallVolume,
+ KTelIncallEarVolume, iConfig.iAudio.iVolume.iHandsetVolume )
+ != KErrNone )
+ {
+ iConfig.iAudio.iVolume.iHandsetVolume = KVtEngVolumeDefaultLevel;
+ }
+
+ if ( iCRProxy->Get( KCRUidInCallVolume, KTelIncallLoudspeakerVolume,
+ iConfig.iAudio.iVolume.iHandsfreeVolume ) != KErrNone )
+ {
+ iConfig.iAudio.iVolume.iHandsfreeVolume = KVtEngVolumeDefaultLevel;
+ }
+
+ // Open connection to phone server
+ RPhCltServer phoneClient;
+ User::LeaveIfError( phoneClient.Connect() );
+ CleanupClosePushL( phoneClient );
+
+ CPhCltImageHandler* stillH;
+ stillH = CPhCltImageHandler::NewL();
+ CleanupStack::PushL( stillH );
+
+ // Load images
+ RFile file;
+ TInt res = stillH->OpenDefaultVtImage( file );
+ file.Close();
+ iDefaultStillImageDefined = ( res == KErrNone ) ? ETrue : EFalse;
+ // Cleanup
+ CleanupStack::PopAndDestroy( 2 ); // phoneClient, stillH, imageParams
+
+ __VTPRINTEXIT( "Settings.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings* CVtEngSettings::NewL()
+ {
+ CVtEngSettings* self = new( ELeave ) CVtEngSettings;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::~CVtEngSettings
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::~CVtEngSettings()
+ {
+ __VTPRINTENTER( "Settings.~" )
+ delete iSelectVolumeIdle;
+ delete iObserverItems;
+ delete iDataportInfo;
+ __VTPRINTEXIT( "Settings.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::Config
+// Returns configuration.
+// -----------------------------------------------------------------------------
+//
+const CVtEngSettings::TVtEngVideoCallConfig& CVtEngSettings::Config() const
+ {
+ return iConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetCurrentVolume
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetCurrentVolume( TBool aVolume )
+ {
+ TBool old = iConfig.iAudio.iCurrentVolume;
+ iConfig.iAudio.iCurrentVolume = aVolume;
+
+ if ( iSelectVolumeObserver && ( !old && aVolume ) || ( old && !aVolume ) )
+ {
+ iSelectVolumeIdle->Cancel();
+ iSelectVolumeIdle->Start(
+ TCallBack( DoInformSelectVolumeObserver, this ) );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CurrentVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSettings::CurrentVolume() const
+ {
+ return iConfig.iAudio.iCurrentVolume;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetVolume
+// Sets output volue setting.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::SetVolume(
+ const TInt aHandsetVolume,
+ const TInt aHandsfreeVolume,
+ const TBool aInternal )
+ {
+ __VTPRINTENTER( "Settings.SetVolume" )
+ __VTPRINT3( DEBUG_DETAIL, "Settings:SetVolume hs=%d, ihf=%d",
+ aHandsetVolume, aHandsfreeVolume )
+ __VTPRINT2( DEBUG_DETAIL, "Settings:Internal=%d", aInternal )
+
+ TInt volume ( 0 );
+
+ TInt res( KErrNone );
+ if ( aInternal )
+ {
+ if ( iConfig.iAudio.iVolume.iHandsfreeVolume != aHandsfreeVolume )
+ {
+ iConfig.iAudio.iVolume.iHandsfreeVolume =
+ ValidVolume( aHandsfreeVolume );
+ }
+ if ( iConfig.iAudio.iVolume.iHandsetVolume != aHandsetVolume )
+ {
+ iConfig.iAudio.iVolume.iHandsetVolume =
+ ValidVolume( aHandsetVolume );
+ }
+ }
+ else
+ {
+ iCRProxy->Get( KCRUidInCallVolume,
+ KTelIncallEarVolume, volume );
+ if ( volume != aHandsetVolume )
+ {
+ iCRProxy->Set( KCRUidInCallVolume,
+ KTelIncallEarVolume, aHandsetVolume );
+ }
+
+ iCRProxy->Get( KCRUidInCallVolume,
+ KTelIncallLoudspeakerVolume, volume );
+ if ( volume != aHandsfreeVolume )
+ {
+ iCRProxy->Set( KCRUidInCallVolume,
+ KTelIncallLoudspeakerVolume, aHandsfreeVolume );
+ }
+ }
+ __VTPRINTEXITR( "Settings.SetVolume res=%d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetVolume
+// Gets audio volume.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::GetVolume(
+ TInt& aVolume,
+ const TBool aHandsfree,
+ const TBool aInternal ) const
+ {
+ __VTPRINTEXIT( "Settings.GetVolume" )
+ TInt res( KErrNone );
+ if ( aInternal )
+ {
+ if ( aHandsfree )
+ {
+ aVolume = iConfig.iAudio.iVolume.iHandsfreeVolume;
+ }
+ else
+ {
+ aVolume = iConfig.iAudio.iVolume.iHandsetVolume;
+ }
+ }
+ else
+ {
+ if ( aHandsfree )
+ {
+ res = iCRProxy->Get( KCRUidInCallVolume,
+ KTelIncallLoudspeakerVolume, aVolume );
+ }
+ else
+ {
+ res = iCRProxy->Get( KCRUidInCallVolume,
+ KTelIncallEarVolume, aVolume );
+ }
+ }
+ __VTPRINTEXITR( "Settings.GetVolume res=%d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetRouting
+// Sets audio routing setting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetRouting(
+ const MVtEngAudio::TVtEngRoutingSetting& aState )
+ {
+ iConfig.iAudio.iRouting = aState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetVideoEnabled
+// Sets video enabled setting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetVideoEnabled( const TBool aEnabled )
+ {
+ __VTPRINT2( DEBUG_GEN , "Settings.SVE",aEnabled )
+ iConfig.iVideo.iVideoEnabled = aEnabled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetConnectReady
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetConnectReady()
+ {
+ iConfig.iReadyForConnect = ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetDataportLoaned
+// Sets dataport loaning status
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetDataportLoaned( TBool aLoaned )
+ {
+ __VTPRINTENTER( "Settings.SetDataportLoaned" )
+ iConfig.iIsDataportLoaned = aLoaned;
+ __VTPRINTEXIT( "Settings.SetDataportLoaned" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ResetAll
+// Reset all settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ResetAll()
+ {
+ __VTPRINT( DEBUG_GEN , "Settings.RA" )
+ iConfig.iAudio.iRouting = KVtEngDefaultAudioRouting;
+ iConfig.iVideo.iVideoEnabled = ETrue;
+ iConfig.iReadyForConnect = EFalse;
+ iConfig.iIsDataportLoaned = EFalse;
+ // call duration setting not cleared
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::NotifyChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::NotifyChangeL(
+ TSettingId aId,
+ MVtEngSettingObserver& aObserver )
+ {
+ __VTPRINTENTER( "Settings.NotifyChangeL" )
+ __VTPRINT2( DEBUG_GEN, "Settings.NC id %d", aId )
+ switch ( aId )
+ {
+ case ESelectVolume:
+ iSelectVolumeObserver = &aObserver;
+ break;
+ case EDataportInfo:
+ iDataportObserver = &aObserver;
+ break;
+ // others are CenRep items
+ default:
+ {
+ const TInt count( iObserverItems->Count() );
+ for ( TInt index = 0; index < count; index++ )
+ {
+ TObserverItem& item = iObserverItems->At( index );
+ if ( item.iId == aId && item.iObserver == &aObserver )
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.NC.already" )
+ __VTPRINTEXIT( "Settings.NotifyChangeL" )
+ return;
+ }
+ }
+
+ TObserverItem item;
+ item.iId = aId;
+ switch ( aId )
+ {
+ case EStillImage:
+ item.iIntKey = KSettingsVTStillImage;
+ item.iUid = KCRUidTelephonySettings;
+ break;
+ case EStillImagePath:
+ item.iIntKey = KSettingsVTStillImagePath;
+ item.iUid = KCRUidTelephonySettings;
+ break;
+ case ECallTimer:
+ item.iIntKey = KLogsShowCallDuration;
+ item.iUid = KCRUidLogs;
+ break;
+ case EHandsetVolume:
+ item.iIntKey = KTelIncallEarVolume;
+ item.iUid = KCRUidInCallVolume;
+ break;
+ case EHandsfreeVolume:
+ item.iIntKey = KTelIncallLoudspeakerVolume;
+ item.iUid = KCRUidInCallVolume;
+ break;
+ default:
+ break;
+ }
+ item.iObserver = &aObserver;
+ iObserverItems->AppendL( item );
+ }
+ }
+ __VTPRINTEXIT( "Settings.NotifyChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CancelNotifyChange
+// Cancels receiving change events.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::CancelNotifyChange(
+ TSettingId aId, const MVtEngSettingObserver& aObserver )
+ {
+ __VTPRINTENTER( "Settings.CancelNotifyChange" )
+ if ( aId == ESelectVolume )
+ {
+ if ( &aObserver == iSelectVolumeObserver )
+ {
+ iSelectVolumeObserver = NULL;
+ }
+ }
+ else if ( &aObserver == iDataportObserver )
+ {
+ iDataportObserver = NULL;
+ // also free space used for dataport info
+ delete iDataportInfo;
+ iDataportInfo = NULL;
+ }
+ else
+ {
+ TInt count( iObserverItems->Count() );
+ while ( count-- )
+ {
+ const TObserverItem& item = iObserverItems->At( count );
+ if ( item.iId == aId &&
+ item.iObserver == &aObserver )
+ {
+ iObserverItems->Delete( count );
+ count = 0; // breaks loop
+ }
+ }
+ }
+ __VTPRINTEXIT( "Settings.CancelNotifyChange" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyInt
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyInt( const TUid aUid,
+ const TUint32 aId, TInt aNewValue )
+ {
+ TBool informObserver = ETrue;
+ if ( aUid == KCRUidInCallVolume )
+ {
+ switch ( aId )
+ {
+ case KTelIncallLoudspeakerVolume:
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HF volume" )
+ if ( iConfig.iAudio.iVolume.iHandsfreeVolume == aNewValue )
+ {
+ informObserver = EFalse;
+ }
+ else
+ {
+ iConfig.iAudio.iVolume.iHandsfreeVolume = aNewValue;
+ }
+ }
+ break;
+ case KTelIncallEarVolume:
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HandsetVolume" )
+ if ( iConfig.iAudio.iVolume.iHandsetVolume == aNewValue )
+ {
+ informObserver = EFalse;
+ }
+ else
+ {
+ iConfig.iAudio.iVolume.iHandsetVolume = aNewValue;
+ }
+ }
+ break;
+ default:
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+ break;
+ }
+ }
+ else if ( aUid == KCRUidLogs )
+ {
+ switch ( aId )
+ {
+ case KLogsShowCallDuration:
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: call duration" )
+ iConfig.iCallTimerOn = aNewValue > 0 ? ETrue : EFalse;
+ }
+ break;
+ default:
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+ break;
+ }
+ }
+ else if ( aUid == KCRUidTelephonySettings )
+ {
+ switch ( aId )
+ {
+ case KSettingsVTStillImage:
+ {
+ __VTPRINT( DEBUG_GEN, "HandleNotifyInt still" )
+ if ( aNewValue == 0 )
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt disabled")
+ // still image disabled in settings
+ iConfig.iVideo.iStillImageFile.Zero();
+ iConfig.iVideo.iImageIsValid = EFalse;
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt enabled")
+ iConfig.iVideo.iImageIsValid = ETrue;
+ }
+ }
+ break;
+ default:
+ __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+ break;
+ }
+ }
+
+ TObserverItem* item = FindItem( aUid, aId );
+ if ( informObserver && item && item->iObserver )
+ {
+ // The observer does not need the new value
+ // Plain notification is all.
+ TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, KNullDesC16 ) );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyReal
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyReal( const TUid /*aUid*/,
+ const TUint32 /*aId*/ , TReal /* aNewValue*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyString
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyString( const TUid aUid, const TUint32 aId,
+ const TDesC16& aNewValue )
+ {
+ __VTPRINTENTER( "Settings.HN" )
+ if ( aNewValue.Compare( iConfig.iVideo.iStillImageFile ) != 0 )
+ {
+ if( aId == KSettingsVTStillImagePath )
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.HN KGSVTStillImagePath" )
+ iConfig.iVideo.iStillImageFile.Copy( aNewValue );
+ }
+ }
+ TObserverItem* item = FindItem( aUid, aId );
+ if ( item && item->iObserver )
+ {
+ TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, aNewValue ) );
+ }
+ __VTPRINTEXIT( "Settings.HN" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::TObserverItem* CVtEngSettings::FindItem(
+ const TUid& aUid,
+ const TDesC& aKey ) const
+ {
+ TInt count( iObserverItems->Count() );
+ TObserverItem* item = NULL;
+ TBool found( EFalse );
+ while ( count-- && !found )
+ {
+ item = &iObserverItems->At( count );
+ if ( item->iUid == aUid &&
+ item->iKey.Compare( aKey ) == 0 )
+ {
+ found = ETrue;
+ }
+ }
+
+ // Just NULL the item if not found
+ if( !found )
+ {
+ item = NULL;
+ }
+ return item;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::TObserverItem* CVtEngSettings::FindItem(
+ const TUid& aUid,const TInt& aKey ) const
+ {
+ TInt count( iObserverItems->Count() );
+ TObserverItem* item = NULL;
+ TBool found( EFalse );
+ while ( count-- && !found )
+ {
+ item = &iObserverItems->At( count );
+ if ( item->iUid == aUid &&
+ item->iIntKey == aKey )
+ {
+ found = ETrue;
+ }
+ }
+
+ // Just NULL the item if not found
+ if( !found )
+ {
+ item = NULL;
+ }
+ return item;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SettingAsTInt
+// Returns setting as integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::SettingAsTInt( const TDesC& aValue )
+ {
+ TInt value( 0 );
+ const TInt err = TLex( aValue ).Val( value );
+ if ( err != KErrNone )
+ {
+ value = err;
+ }
+ return value;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::DoInformSelectVolumeObserver
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::DoInformSelectVolumeObserver( TAny* aAny )
+ {
+ CVtEngSettings* self = static_cast< CVtEngSettings* >( aAny );
+
+ if ( self->iSelectVolumeObserver )
+ {
+ TRAP_IGNORE( self->iSelectVolumeObserver->HandleSettingChangedL(
+ ESelectVolume,
+ KNullDesC ) );
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ReadVariationsL
+// Reads local variations.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ReadVariationsL()
+ {
+ __VTPRINTENTER( "Settings.ReadVariations" )
+ User::LeaveIfError( iCRProxy->Get( KCRUidVTVariation,
+ KVTLocalVariationFlags, iVariantReadOnlyValues ));
+ TBuf< KVtEngVQFRBufferSize > buffer;
+ User::LeaveIfError( iCRProxy->Get( KCRUidVTConfiguration,
+ KVTVideoFrameRates, buffer ));
+ ParseFrameRates( iVQFRConfig, buffer );
+ __VTPRINTEXIT( "Settings.ReadVariations" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetCameraOrientations
+// Reads camera orientations from CR
+// -----------------------------------------------------------------------------
+//
+
+void CVtEngSettings::GetCameraOrientations(
+ MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation,
+ MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const
+ {
+ /*
+ * Defines layout (screen orientation) used by
+ * Video Telephone application per active camera.
+ * Each camera has one of the following values:
+ * 1) "LS" = Landscape
+ * 2) "PR" = Portrait
+ * 3) "OL" = Obey layout in specific device mode (normal operation)
+ * Camera values are:
+ * 1) "C1" = VT primary camera (inwards)
+ * 2) "C2" = VT secondary camera (outwards)
+ * Example value (portrait for cam1, landscape for cam2):
+ * C1:PR C2:LS
+ */
+
+ __VTPRINTENTER( "Settings.GetCameraOrientations" )
+ const TInt KMaxKVTCameraLayoutValue = 11;
+ const TInt KAbbreviationLength = 2;
+ const TInt KSkipChars = 3;
+
+ _LIT( KCameraOrientationLS, "LS" ); // landscape
+ _LIT( KCameraOrientationPR, "PR" ); // portrait
+
+ TBuf< KMaxKVTCameraLayoutValue > cameraOrientations;
+ TInt err = iCRProxy->Get( KCRUidVTConfiguration,
+ KVTCameraLayout, cameraOrientations );
+
+ // parse cenrep value
+ if( cameraOrientations.Length() > 0 )
+ {
+ TBuf<KAbbreviationLength> abbreviation;
+ TLex lex( cameraOrientations );
+ lex.SkipAndMark(KSkipChars);
+ abbreviation.Append( lex.Get() );
+ abbreviation.Append( lex.Get() );
+
+ // primary camera value
+ if ( abbreviation.CompareF( KCameraOrientationLS ) == 0 )
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:LS" );
+ aPrimaryCameraOrientation = MVtEngMedia::EOrientationLandscape;
+ }
+ else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0 )
+ {
+ aPrimaryCameraOrientation = MVtEngMedia::EOrientationPortrait;
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:PR" );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:OL" );
+ aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+ }
+
+ abbreviation.Zero();
+ lex.SkipSpace();
+ lex.SkipAndMark(KSkipChars);
+ abbreviation.Append( lex.Get() );
+ abbreviation.Append( lex.Get() );
+
+ //secondary camera value
+ if ( abbreviation.CompareF( KCameraOrientationLS ) == 0)
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:LS" );
+ aSecondaryCameraOrientation = MVtEngMedia::EOrientationLandscape;
+ }
+ else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0)
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:PR" );
+ aSecondaryCameraOrientation = MVtEngMedia::EOrientationPortrait;
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:OL" );
+ aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+ }
+ }
+ else
+ {
+ // reading from cenrep failed
+ // set default values for camera orientation
+ aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+ aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+ }
+ __VTPRINTEXIT( "Settings.ReadVariations" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CheckBit
+// Checks if a certain bit is turned on in locally variated features.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSettings::CheckBits( const TInt aBits )
+ {
+ __VTPRINT2( DEBUG_GEN, "Settings.CheckBit: %d", aBits )
+ __VTPRINT2( DEBUG_GEN, "Settings.CheckBit=%d",
+ iVariantReadOnlyValues & aBits ? 1 : 0 )
+ return iVariantReadOnlyValues & aBits;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::VideoQualityFrameRateConfig
+// Returns video quality frame rate configuration.
+// -----------------------------------------------------------------------------
+//
+const CVtEngSettings::TVtEngVideoQualityFrameRateConfig&
+ CVtEngSettings::VideoQualityFrameRateConfig() const
+ {
+ __VTPRINTENTER( "Settings.VideoQualityFrameRateConfig" )
+ __VTPRINTEXIT( "Settings.VideoQualityFrameRateConfig" )
+ return iVQFRConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CreateDataObserverL
+// Creates a shared data observer. Ownership transferred.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::CreateDataObserverL( MVtEngCRSettingObserver* aObserver,
+ TUid aUid, TUint32 aKey, CCenRepNotifyHandler::TCenRepKeyType aType )
+ {
+ CVtEngCRObserverItem* item = CVtEngCRObserverItem::NewL(
+ aObserver, aUid, aKey, aType );
+ CleanupStack::PushL( item );
+ iCRProxy->RegisterInterestedL( item );
+ CleanupStack::Pop( item );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ParseFrameRates
+// Parses VQ frame rates read from cenrep.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR,
+ const TDesC& aBuffer )
+ {
+ __VTPRINTENTER( "Settings.ParseFrameRates" )
+ Mem::FillZ( &aVQFR, sizeof( aVQFR ) );
+ if( aBuffer.Length() > 0 )
+ {
+ TLex lex( aBuffer );
+ lex.Val( aVQFR.iDetail );
+ __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iDetail=%d", aVQFR.iDetail );
+ lex.SkipSpace();
+ lex.Val( aVQFR.iNormal );
+ __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iNormal=%d", aVQFR.iNormal );
+ lex.SkipSpace();
+ lex.Val( aVQFR.iMotion );
+ __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iMotion=%d", aVQFR.iMotion );
+ }
+ __VTPRINTEXIT( "Settings.ParseFrameRates" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::IsDefaultStillImageDefined
+// Checks if still image exists.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSettings::IsDefaultStillImageDefined()
+ {
+ __VTPRINTENTER( "Settings.IsDefaultStillImageDefined" )
+ __VTPRINTEXITR( "Settings.IsDefaultStillImageDefined%d",iDefaultStillImageDefined )
+ return iDefaultStillImageDefined;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetCLI
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetCLI( const MVtEngSessionInfo::TCLI& aCLI )
+ {
+ __VTPRINTENTER( "Settings.SetCLI" )
+ iCLI.iCallId = aCLI.iCallId;
+ iCLI.iName = aCLI.iName;
+ iCLI.iVoiceCallPossible = aCLI.iVoiceCallPossible;
+ iCLI.iValid = ETrue;
+ iCLI.iCallNumber = aCLI.iCallNumber;
+ __VTPRINT2( DEBUG_GEN, "iVoiceCallPossible=%d,", iCLI.iVoiceCallPossible )
+ __VTPRINTEXIT( "Settings.SetCLI" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetCLI
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSettings::GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const
+ {
+ aCLI.iCallId = iCLI.iCallId;
+ aCLI.iVoiceCallPossible = iCLI.iVoiceCallPossible;
+ aCLI.iName = iCLI.iName;
+ aCLI.iCallNumber = iCLI.iCallNumber;
+ return iCLI.iValid;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetDataportInfoL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetDataportInfoL( const TDesC& aPortInfo )
+ {
+ delete iDataportInfo;
+ iDataportInfo = NULL;
+ iDataportInfo = HBufC::NewL( aPortInfo.Length() );
+ *iDataportInfo = aPortInfo;
+ SetConnectReady();
+ if ( iDataportObserver )
+ {
+ iDataportObserver->HandleSettingChangedL( EDataportInfo,
+ *iDataportInfo );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::DataportInfo
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC* CVtEngSettings::DataportInfo() const
+ {
+ return iDataportInfo;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/VtEngUtils.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2004-2006 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: Video telephony engine TLS container.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngCRProxy.h"
+#include "CVtEngAccessoryHandler.h"
+#include "CVtEngSATClient.h"
+#include "VtEngUtils.h"
+#include "VtEngPanic.h"
+#include "CVtEngInitializer.h"
+#include "CVtEngSettings.h"
+#include "CVtEngDeviceLockMonitor.h"
+
+#include "CVtEngExtensions.h"
+#include "cvtengmdtrmessagelistener.h"
+#include "cvtengmdtrcommandsender.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::CVtEngUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility::CVtEngUtility()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::ConstructL( )
+ {
+ __ASSERT_DEBUG( Dll::Tls() == NULL, Panic( EVtEngPanicTlsPanic ));
+ Dll::SetTls( this );
+ iCRProxy = CVtEngCRProxy::NewL();
+ iAccessoryHandler = CVtEngAccessoryHandler::NewL();
+ iSettings = CVtEngSettings::NewL();
+
+ iLockMonitor = CVtEngDeviceLockMonitor::NewL();
+ iMdtrCommandSender = CVtEngMdtrCommandSender::NewL( *this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility* CVtEngUtility::NewL()
+ {
+ CVtEngUtility* self = new( ELeave ) CVtEngUtility;
+
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// Destructor
+CVtEngUtility::~CVtEngUtility()
+ {
+ delete iMdtrMessageListener;
+ delete iMdtrCommandSender;
+ delete iCRProxy;
+ delete iAccessoryHandler;
+ delete iEngineInit;
+ delete iSettings;
+ delete iSATClient;
+ delete iLockMonitor;
+ Dll::SetTls( NULL );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::EngineUtils
+// Return pointer to Engine Utility.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility* CVtEngUtility::EngineUtils()
+ {
+ return reinterpret_cast<CVtEngUtility*>( Dll::Tls() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StateManager
+// Returns state manager.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager* CVtEngUtility::StateManager()
+ {
+ return *(CVtEngUtility::EngineUtils()->iStateManager);
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::EventManager
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager& CVtEngUtility::EventManager()
+ {
+ return **CVtEngUtility::EngineUtils()->iEventManager;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::PrepareL
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::PrepareL(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngStateManager*& aStateManagerPtr,
+ CVtEngEventManager*& aEventManagerPtr,
+ CVtEngExtensions* aExtensionPtr )
+ {
+ iEngineInit = CVtEngInitializer::NewL( aHandlers );
+ iStateManager = &aStateManagerPtr;
+ iEventManager = &aEventManagerPtr;
+ iExtensions = aExtensionPtr;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StartMediatorListenerL
+// Creates mediator message (event/command) listener. Cannot be done in
+// constructor because session control may be unavailable when we would
+// receive first mediator event => session state is still uninitialized.
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::StartMediatorListenerL()
+ {
+ iMdtrMessageListener = CVtEngMdtrMessageListener::NewL( *this );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::Settings
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings& CVtEngUtility::Settings()
+ {
+ return *CVtEngUtility::EngineUtils()->iSettings;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::MediatorCommands
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender& CVtEngUtility::MediatorCommands()
+ {
+ return *CVtEngUtility::EngineUtils()->iMdtrCommandSender;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::CRProxy
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy& CVtEngUtility::CRProxy()
+ {
+ return *CVtEngUtility::EngineUtils()->iCRProxy;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::AccessoryHandler
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler& CVtEngUtility::AccessoryHandler()
+ {
+ return *CVtEngUtility::EngineUtils()->iAccessoryHandler;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StartSATListenL
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::StartSATListenL()
+ {
+ iSATClient = CVtEngSATClient::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::NotifyLockState
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::NotifyLockState()
+ {
+ iLockMonitor->NotifyState();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::Extensions
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions* CVtEngUtility::Extensions()
+ {
+ return CVtEngUtility::EngineUtils()->iExtensions;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengincomingcallmonitor.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2006 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: Monitors device incoming call state
+*
+*/
+
+
+// INCLUDE FILES
+#include "cvtengincomingcallmonitor.h"
+#include "CVTEngPubSubsListener.h"
+#include "CVtEngEventManager.h"
+#include "cvtlogger.h"
+
+#include <ctsydomainpskeys.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor* CVtEngIncomingCallMonitor::NewL()
+ {
+ CVtEngIncomingCallMonitor* self = new ( ELeave ) CVtEngIncomingCallMonitor();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::~
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor::~CVtEngIncomingCallMonitor()
+ {
+ delete iIncomingCallListener;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::NotifyState
+// Notifies UI about device incoming call state
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::NotifyState() const
+ {
+ __VTPRINTENTER( "IncomingCall.NotifyState" )
+
+ // Initialize state as first valuea of call state enum
+ TInt state = EPSCTsyCallStateUninitialized;
+
+ // Get incomig call state and send event to UI
+ if ( iIncomingCallListener->Get( state ) == KErrNone )
+ {
+ __VTPRINT2( DEBUG_SESSION, "IncomingCall.NotifyState=%d", state )
+ const TInt event = ( state == EPSCTsyCallStateRinging ) ?
+ KVtEngSessionWaitingCallActive : KVtEngSessionWaitingCallInactive;
+ CVtEngEventManager::NotifyEvent( event );
+ }
+ __VTPRINTEXIT( "IncomingCall.NotifyState" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitoronitor::HandleNotifyPSL
+// Callback for incoming call state change
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::HandleNotifyPSL(
+ const TUid aUid,
+ const TInt& aKey,
+ const TRequestStatus& aStatus )
+ {
+ if ( aStatus == KErrNone &&
+ aUid == KPSUidCtsyCallInformation &&
+ aKey == KCTsyCallState )
+ {
+ NotifyState();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::ConstructL()
+ {
+ __VTPRINTENTER( "IncomingCall.ConstructL" )
+ // Listener for incoming call state
+ iIncomingCallListener = CVtEngPubSubsListener::NewL(
+ KPSUidCtsyCallInformation, KCTsyCallState, this );
+ __VTPRINTEXIT( "IncomingCall.ConstructL" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmdtrcommandsender.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,460 @@
+/*
+* 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: Mediator command sender implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cvtengmdtrcommandsender.h"
+#include "CVtEngEventManager.h"
+#include "VtEngUtils.h"
+#include "CVtEngSettings.h"
+#include "CVtEngOperation.h"
+#include "vtengcommands.h"
+#include "CVtEngStateManager.h"
+#include "VtEngPanic.h"
+#include <MediatorCommandInitiator.h>
+#include <MediatorDomainUIDs.h>
+#include <mediatorcommandstotelephonyapi.h>
+#include <mediatoraudiocommandstotelephonyapi.h>
+#include <videoteltophonecommandsapi.h>
+#include <cvtlogger.h>
+
+
+/**
+* Three state classes for handling audio mute/unmute commands towards mediator when mute state
+* is changed locally faster than mediator gives response.
+
+
+ IDLE <-------------------------|
+ | |
+ NotifyOutgoingAudioState( x ) / mediator.Send( x ) |
+ | |
+ v |
+ |--------------------------------------> SENDING -- CommandResponseL ---|
+ | |
+ | NotifyOutgoingAudioState( y ) / saveCommand( y )
+ | |
+ | v
+ |- CommandResponseL( x ) / Send( y ) ---- BUFFERED
+
+
+
+
+*/
+NONSHARABLE_CLASS( TVtMdtrStateIdle ) : public CBase
+{
+ public:
+ TVtMdtrStateIdle( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+ virtual void SendL( TUid aDomain, TUid aCategory, TInt aCommand );
+ virtual void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );
+
+ TInt DoSend( TUid aDomain, TUid aCategory, TInt aCommand );
+
+ CVtEngMdtrCommandSender& iSender;
+ CMediatorCommandInitiator& iMediator;
+};
+
+NONSHARABLE_CLASS( TVtMdtrStateSending ) : public TVtMdtrStateIdle
+{
+ public:
+ TVtMdtrStateSending( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+ void SendL( TUid aDomain, TUid aCategory, TInt aCommand );
+ void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );
+};
+
+NONSHARABLE_CLASS( TVtMdtrStateBuffered ) : public TVtMdtrStateIdle
+{
+ public:
+ TVtMdtrStateBuffered( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+ void SendL( TUid aDomain, TUid aCategory, TInt aCommand );
+ void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );
+
+ TUid iDomain;
+ TUid iCategory;
+ TInt iCommand;
+};
+
+
+// CONSTANTS
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender* CVtEngMdtrCommandSender::NewL( CVtEngUtility& aUtils )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.NewL" )
+ CVtEngMdtrCommandSender* self = new ( ELeave )
+ CVtEngMdtrCommandSender( aUtils );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+
+ __VTPRINTEXIT( "CVtEngMdtrCommandSender.NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::~CVtEngMdtrCommandSender
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender::~CVtEngMdtrCommandSender()
+ {
+ iUtils.EventManager().RemoveObserver( this );
+ delete iMediatorInitiator;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::EndCall
+// Sends end call command via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::EndCall( )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.EndCall" )
+ const TVersion KTelephonyCmdVersion(
+ KTelephonyCommandsVersionMajor,
+ KTelephonyCommandsVersionMinor,
+ KTelephonyCommandsVersionBuild );
+ const TInt res =
+ iMediatorInitiator->IssueCommand(
+ KMediatorTelephonyDomain,
+ KCatCommandsToTelephony,
+ EPhoneCmdEndActiveCall,
+ KTelephonyCmdVersion,
+ KNullDesC8() );
+
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.EndCall res=%d", res )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::VoiceFallback
+// Sends voice fallback command to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::VoiceFallback()
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.VoiceFallback" )
+ const TVersion KVtToPhoneCmdVersion(
+ KVideoTelToPhoneCmdVersionMajor,
+ KVideoTelToPhoneCmdVersionMinor,
+ KVideoTelToPhoneCmdVersionBuild );
+#ifdef _DEBUG
+ TInt err =
+#endif
+ iMediatorInitiator->IssueCommand(
+ KMediatorTelephonyDomain,
+ KCatVideoTelToPhoneCommands,
+ EVtCmdFallback,
+ KVtToPhoneCmdVersion,
+ KNullDesC8() );
+ // response is not awaited
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.VoiceFallback %d>", err )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::SwitchToVoiceL
+// Sends switch to voice command to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::SwitchToVoiceL( CVtEngOperation& aOperation )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.SwitchToVoiceL" )
+ iOperation = &aOperation;
+ // add this as observer. Mediator command is sent when idle state
+ // is reached (i.e. Protocol has released dataport and it can be recovered
+ // by telephony)
+ iUtils.EventManager().AddObserverL( this );
+ // let current state handle actual request
+ iUtils.StateManager()->HandleOperationL( aOperation );
+ __VTPRINTEXIT( "CVtEngMdtrCommandSender.SwitchToVoiceL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::NotifyOutgoingAudioState
+// Sends microphone state to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::NotifyOutgoingAudioState(
+ const TBool aMicEnabled )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.NotifyOutgoingAudioState" )
+
+ const TInt command = ( aMicEnabled )
+ ? EAudioCmdUnmute : EAudioCmdMute;
+#ifdef _DEBUG
+ TRAPD( res, iSenderState->SendL(
+ KMediatorTelephonyDomain,
+ KCatAudioCommandsToTelephony,
+ command ) );
+#else
+ TRAP_IGNORE(iSenderState->SendL(
+ KMediatorTelephonyDomain,
+ KCatAudioCommandsToTelephony,
+ command ) );
+#endif
+
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.NotifyOutgoingAudioState %d", res )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::SetSenderState
+// sets new mediator sender state for audio command
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::SetSenderState( TVtMdtrStateIdle& aNewState )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.SetSenderState" )
+ __VTPRINT2( DEBUG_GEN, " delete old state %x", (TInt) iSenderState )
+ __ASSERT_DEBUG( iSenderState != &aNewState,
+ Panic( EVtEngPanicWrongMediatorSenderState ) );
+ delete iSenderState;
+ iSenderState = &aNewState;
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.SetSenderState %x", (TInt) iSenderState )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::CommandResponseL
+// Mediator framework callback
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::CommandResponseL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TInt aStatus,
+ const TDesC8& /*aData*/ )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.CommandResponseL" )
+ switch ( aCommandId )
+ {
+ case EAudioCmdUnmute:
+ case EAudioCmdMute:
+ iSenderState->CommandResponseL( aDomain, aCategory, aCommandId, aStatus );
+ break;
+ default:
+ // ignored for other commands (so far)
+ break;
+ }
+ __VTPRINT2( DEBUG_GEN, " mediator command id=%d", aCommandId )
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.CommandResponseL res=%d", aStatus )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::HandleVtEventL
+// Handles state change event associated with "switch to voice" and "TerminateSession" command
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::HandleVtEventL( TInt aEvent )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.HandleVtEventL" )
+#ifdef _DEBUG
+ TInt err = KErrNone;
+#endif
+ if ( aEvent == KVtEngSessionStateChanged &&
+ iOperation && iOperation->Command() == KVtEngSwitchToVoice )
+ {
+ const TVersion KVtToPhoneCmdVersion(
+ KVideoTelToPhoneCmdVersionMajor,
+ KVideoTelToPhoneCmdVersionMinor,
+ KVideoTelToPhoneCmdVersionBuild );
+
+ iUtils.EventManager().RemoveObserver( this );
+ // send command (ignore possible error - no way to recover from it)
+#ifdef _DEBUG
+ err =
+#endif
+ iMediatorInitiator->IssueCommand(
+ //KMediatorVideoTelephonyDomain,
+ KMediatorTelephonyDomain,
+ KCatVideoTelToPhoneCommands,
+ EVtCmdSwitchToVoice,
+ KVtToPhoneCmdVersion,
+ KNullDesC8() );
+ iOperation->HandleOpComplete( KErrNone );
+ iOperation = NULL;
+ }
+ __VTPRINTEXITR( "CVtEngMdtrCommandSender.HandleVtEventL %d", err )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender::CVtEngMdtrCommandSender( CVtEngUtility& aUtils ) :
+ iUtils( aUtils )
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.CVtEngMdtrCommandSender" )
+ __VTPRINTEXIT( "CVtEngMdtrCommandSender.CVtEngMdtrCommandSender" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::ConstructL()
+ {
+ __VTPRINTENTER( "CVtEngMdtrCommandSender.ConstructL" )
+ iMediatorInitiator = CMediatorCommandInitiator::NewL( this );
+
+ // set initial mediator command sender state
+ iSenderState = new ( ELeave ) TVtMdtrStateIdle( *this, *iMediatorInitiator );
+ __VTPRINTEXIT( "CVtEngMdtrCommandSender.ConstructL" )
+ }
+
+TVtMdtrStateIdle::TVtMdtrStateIdle( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator )
+: iSender( aSender), iMediator( aMediator )
+ {
+ __VTPRINTENTER( "TVtMdtrStateIdle.ctr" )
+ __VTPRINTEXITR( "TVtMdtrStateIdle.ctr %x", (TInt) this )
+ }
+
+void TVtMdtrStateIdle::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+ {
+ __VTPRINTENTER( "TVtMdtrStateIdle.SendL" )
+ TVtMdtrStateIdle* nextState = NULL;
+ const TInt res = DoSend( aDomain, aCategory, aCommand );
+ if ( res == KErrInUse )
+ {
+ nextState = new ( ELeave ) TVtMdtrStateBuffered( iSender, iMediator );
+ CleanupStack::PushL( nextState );
+ nextState->SendL( aDomain, aCategory, aCommand );
+ CleanupStack::Pop( nextState );
+ }
+ else
+ {
+ nextState = new ( ELeave ) TVtMdtrStateSending( iSender, iMediator );
+ }
+ iSender.SetSenderState( *nextState );
+ __VTPRINTEXIT( "TVtMdtrStateIdle.SendL" )
+ }
+
+TInt TVtMdtrStateIdle::DoSend( TUid aDomain, TUid aCategory, TInt aCommand )
+ {
+ __VTPRINTENTER( "TVtMdtrStateIdle.DoSend" )
+ const TVersion KVtToPhoneCmdVersion(
+ KVideoTelToPhoneCmdVersionMajor,
+ KVideoTelToPhoneCmdVersionMinor,
+ KVideoTelToPhoneCmdVersionBuild );
+
+ TInt res = iMediator.IssueCommand(
+ aDomain,
+ aCategory,
+ aCommand,
+ KVtToPhoneCmdVersion,
+ KNullDesC8() );
+ __VTPRINTEXITR( "TVtMdtrStateIdle.DoSend res=%d", res )
+ return res;
+ }
+
+void TVtMdtrStateIdle::CommandResponseL( TUid /*aDomain*/, TUid /*aCategory*/, TInt /*aCommand*/, TInt /*aStatus*/ )
+ {
+ __VTPRINTENTER( "TVtMdtrStateIdle.CommandResponseL" )
+ // base class method should never be possible to call
+ __VTPRINTEXIT( "TVtMdtrStateIdle.CommandResponseL" )
+ }
+
+TVtMdtrStateSending::TVtMdtrStateSending( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator )
+: TVtMdtrStateIdle( aSender, aMediator )
+ {
+ __VTPRINTENTER( "TVtMdtrStateSending.ctr" )
+ __VTPRINTEXITR( "TVtMdtrStateSending.ctr %x", (TInt) this )
+ }
+
+void TVtMdtrStateSending::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+ {
+ __VTPRINTENTER( "TVtMdtrStateSending.SendL" )
+ TVtMdtrStateIdle* buffered = new ( ELeave )TVtMdtrStateBuffered( iSender, iMediator );
+ CleanupStack::PushL( buffered );
+ buffered->SendL( aDomain, aCategory, aCommand );
+ CleanupStack::Pop( buffered );
+ iSender.SetSenderState( *buffered );
+ __VTPRINTEXIT( "TVtMdtrStateSending.SendL" )
+ }
+
+void TVtMdtrStateSending::CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus )
+ {
+ __VTPRINTENTER( "TVtMdtrStateSending.CommandResponseL" )
+ __VTPRINT2( DEBUG_GEN, " command=%d", aCommand )
+ __VTPRINT2( DEBUG_GEN, " response=%d", aStatus )
+ TVtMdtrStateIdle* idle = new ( ELeave ) TVtMdtrStateIdle( iSender, iMediator );
+ iSender.SetSenderState( *idle );
+ __VTPRINTEXIT( "TVtMdtrStateSending.CommandResponseL" )
+ }
+
+TVtMdtrStateBuffered::TVtMdtrStateBuffered( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator )
+: TVtMdtrStateIdle( aSender, aMediator )
+ {
+ __VTPRINTENTER( "TVtMdtrStateBuffered.ctr" )
+ __VTPRINTEXITR( "TVtMdtrStateBuffered.ctr %x", (TInt) this )
+ }
+
+void TVtMdtrStateBuffered::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+ {
+ __VTPRINTENTER( "TVtMdtrStateBuffered.SendL" )
+
+ iDomain = aDomain;
+ iCategory = aCategory;
+ iCommand = aCommand;
+ // iCommand is sent in CommandResponseL
+ __VTPRINTEXIT( "TVtMdtrStateBuffered.SendL" )
+ }
+
+void TVtMdtrStateBuffered::CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus )
+ {
+ __VTPRINTENTER( "TVtMdtrStateBuffered.CommandResponseL" )
+ const TVersion KVtToPhoneCmdVersion(
+ KVideoTelToPhoneCmdVersionMajor,
+ KVideoTelToPhoneCmdVersionMinor,
+ KVideoTelToPhoneCmdVersionBuild );
+ TBool nextStateIdle = ETrue;
+ TInt res = KErrNone;
+ if ( aCommand != iCommand )
+ {
+ res = iMediator.IssueCommand(
+ KMediatorTelephonyDomain,
+ KCatAudioCommandsToTelephony,
+ iCommand,
+ KVtToPhoneCmdVersion,
+ KNullDesC8() );
+ if ( res == KErrNone )
+ {
+ nextStateIdle = EFalse;
+ }
+ }
+ TVtMdtrStateIdle* nextState = NULL;
+ if ( nextStateIdle )
+ {
+ __VTPRINT2( DEBUG_GEN, " failed to send buffered command with error=%d", res )
+ nextState = new ( ELeave ) TVtMdtrStateIdle( iSender, iMediator );
+ }
+ else
+ {
+ nextState = new ( ELeave ) TVtMdtrStateSending( iSender, iMediator );
+ CleanupStack::PushL( nextState );
+ nextState->SendL( iDomain, iCategory, iCommand );
+ CleanupStack::Pop( nextState );
+ }
+ iSender.SetSenderState( *nextState );
+ __VTPRINTEXIT( "TVtMdtrStateBuffered.CommandResponseL" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmdtrmessagelistener.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,322 @@
+/*
+* 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: Mediator event listener implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cvtengmdtrmessagelistener.h"
+#include "VtEngUtils.h"
+#include "CVtEngSettings.h"
+#include "CVtEngEventManager.h"
+#include "cvtengmediatorservice.h"
+
+#include <cvtlogger.h>
+#include <videotelcontrolmediatorapi.h>
+#include <MediatorCommandResponder.h>
+#include <MediatorDomainUIDs.h>
+#include <mediatoreventsfromtelephonyapi.h>
+#include <vtinternalmediatorapi.h>
+
+// CONSTANTS
+
+// mediator command timeout
+static const TInt KVtEngMdtrCmdTimeout = 500000;
+
+// array granularity is 2 (enable mic, disable mic commands)
+static const TInt KVtEngMdtrCmdArrayGranularity = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrMessageListener* CVtEngMdtrMessageListener::NewL(
+ CVtEngUtility& aUtils )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.NewL" )
+ CVtEngMdtrMessageListener* self = new( ELeave )
+ CVtEngMdtrMessageListener( aUtils );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.NewL" )
+ return self;
+ }
+
+// Destructor
+CVtEngMdtrMessageListener::~CVtEngMdtrMessageListener()
+ {
+ // ignore error in unregistering
+ if ( iMediatorResponder )
+ {
+ iMediatorResponder->UnregisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ iCommandList );
+ iCommandList.Close();
+ iMediatorResponder->UnregisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalCommands,
+ EVtMediatorReleaseDataport );
+
+ delete iMediatorResponder;
+ }
+
+
+ // ignore error in unregistering
+ if ( iMediatorEvents )
+ {
+ iMediatorEvents->UnsubscribeEvent( KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalEvents,
+ EVtMediatorEventVideoCallInformation );
+ delete iMediatorEvents;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::MediatorCommandL
+// Receives mediator command and passes it to service object
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::MediatorCommandL(
+ TUid /*aDomain*/,
+ TUid aCategory,
+ TInt aCommandId,
+ TVersion /*aVersion*/,
+ const TDesC8& /*aData*/ )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.MediatorCommandL" )
+ // service object destroys itself after sending command response
+ CVtEngMediatorService::StartLD( *iMediatorResponder, iUtils, aCategory, aCommandId );
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.MediatorCommandL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::CancelMediatorCommand
+// Cancallation of mediator command. no-op, just returns response.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::CancelMediatorCommand(
+ TUid /*aDomain*/,
+ TUid /*aCategory*/,
+ TInt /*aCommandId*/ )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.CancelMediatorCommand" )
+ // No-op
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.CancelMediatorCommand" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrEventListener::MediatorEventL
+// Receives mediator event from VT Mediator Plugin. The event
+// contains CLI and/or Dataport name.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::MediatorEventL( TUid /*aDomain*/,
+ TUid aCategory,
+ TInt aEventId,
+ const TDesC8& aData )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.MediatorEventL" )
+ if ( aCategory == KCatVideotelInternalEvents &&
+ aEventId == EVtMediatorEventVideoCallInformation )
+ {
+ TVtMediatorInfoPackage package;
+ package.Copy( aData );
+ TVtVideoTelephonyCallInformation data = package();
+ __VTPRINT2( DEBUG_GEN, " VT call info data validity value=%d",
+ data.iEventDataValidity)
+ // if message contains dataport name save it
+ CVtEngSettings& settings = iUtils.Settings();
+ if ( data.iEventDataValidity &
+ TVtVideoTelephonyCallInformation::EDataportValid )
+ {
+ //__VTPRINT(DEBUG_GEN, " Dataport is ready")
+ settings.SetDataportInfoL( data.iDataport );
+ }
+ // if message contains CLI info handle it (save and notify if state
+ // allows)
+ if ( data.iEventDataValidity &
+ TVtVideoTelephonyCallInformation::EDisplayTextValid )
+ {
+ MVtEngSessionInfo::TCLI cli;
+ cli.iCallId = data.iCallId;
+ cli.iName = data.iDisplayText.Left( cli.iName.MaxLength() );
+ cli.iVoiceCallPossible = data.iVoiceCallPossible;
+ cli.iCallNumber = data.iPhoneNumText.Left( cli.iCallNumber.MaxLength() );
+ settings.SetCLI( cli );
+
+ // ready == call is answered (allows setting app to foreground)
+ if ( IsReadyForCLIEvent() )
+ {
+ // send event about CLI availability
+ CVtEngEventManager::NotifyEvent( KVtEngCLIAvailable );
+ }
+ else
+ {
+ // Wait until connected state is reached (see HandleVtEventL)
+ __VTPRINT( DEBUG_GEN,
+ "CVtEngMdtrMessageListener defer CLI event" )
+ iUtils.EventManager().AddObserverL( this );
+ }
+ }
+ }
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.MediatorEventL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::HandleVtEventL
+//
+// Handles defered CLI event dispatching (to UI). CLI event was defered because
+// engine state was not suitable in MediatorEventL which then started observing
+// state changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::HandleVtEventL( TInt aEvent )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.HandleVtEventL" )
+ if ( aEvent == KVtEngSessionStateChanged &&
+ IsReadyForCLIEvent() ) // <- ready == call is answered
+ {
+ iUtils.EventManager().RemoveObserver( this );
+ __VTPRINT( DEBUG_GEN,
+ "CVtEngMdtrMessageListener dispatch defered CLI event" )
+ CVtEngEventManager::NotifyEvent( KVtEngCLIAvailable );
+ }
+
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.HandleVtEventL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::ConstructL()
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.ConstructL" )
+
+ // for sending command responses
+ iMediatorResponder = CMediatorCommandResponder::NewL( this );
+
+ // for receiving events from VT Mediator Plugin (dataport/CLI info)
+ iMediatorEvents = CMediatorEventConsumer::NewL( this );
+
+ TCapabilitySet capSet;
+ capSet.SetEmpty();
+ // for audio control
+ capSet.AddCapability( ECapabilityWriteDeviceData );
+
+ // define common attributes for all commands that engine is responsible for
+ MediatorService::TCommand command;
+ command.iCaps = capSet;
+ command.iVersion = TVersion(
+ KPhoneToVideotelCmdVersionMajor,
+ KPhoneToVideotelCmdVersionMinor,
+ KPhoneToVideotelCmdVersionBuild );
+ command.iTimeout = KVtEngMdtrCmdTimeout;
+
+ // enable microphone command
+ command.iCommandId = EVtCmdUnmute;
+ iCommandList.Append( command );
+
+ // disable microphone command
+ command.iCommandId = EVtCmdMute;
+ iCommandList.Append( command );
+
+ // register VT events that are raised by VT Mediator Plugin.
+ // !!! Note !!!!
+ // event subscription must be done before command registration because
+ // command registration triggers raising the event in the plugin. Different
+ // order would cause the engine to miss the event.
+ const TVersion commandVersion(
+ KVideotelMdtrCommandsVersionMajor,
+ KVideotelMdtrCommandsVersionMinor,
+ KVideotelMdtrCommandsVersionBuild );
+ //capSet.SetEmpty();
+ //capSet.AddCapability( ECapabilityPowerMgmt );
+
+ iMediatorResponder->RegisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalCommands,
+ EVtMediatorReleaseDataport,
+ commandVersion,
+ capSet,
+ KVtEngMdtrCmdTimeout );
+
+ const TVersion eventVersion(
+ KTelephonyEventsVersionMajor,
+ KTelephonyEventsVersionMinor,
+ KTelephonyEventsVersionBuild );
+
+ TInt res = iMediatorEvents->SubscribeEvent( KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalEvents,
+ EVtMediatorEventVideoCallInformation,
+ eventVersion );
+
+ if ( res == KErrNone )
+ {
+ // register Mediator commands that we handle
+ res = iMediatorResponder->RegisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ iCommandList );
+
+ }
+ __VTPRINTEXITR( "CVtEngMdtrMessageListener.ConstructL res=%d",res )
+ // registering must not fail
+ User::LeaveIfError( res );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::CVtEngMdtrMessageListener
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrMessageListener::CVtEngMdtrMessageListener( CVtEngUtility& aUtils)
+ : iUtils( aUtils ), iCommandList( KVtEngMdtrCmdArrayGranularity )
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.CVtEngMdtrMessageListener" )
+ __VTPRINTEXIT( "CVtEngMdtrMessageListener.CVtEngMdtrMessageListener" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::IsReadyForCLIEvent
+// Checks if engine state is appropriate to send CLI event.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMdtrMessageListener::IsReadyForCLIEvent() const
+ {
+ __VTPRINTENTER( "CVtEngMdtrMessageListener.IsReadyForCLIEvent" )
+ const MVtEngSessionInfo::TSessionState state =
+ iUtils.StateManager()->SessionState();
+ const TBool isReady =
+ ( state == MVtEngSessionInfo::EConnected ||
+ state == MVtEngSessionInfo::ENegotiating ||
+ state == MVtEngSessionInfo::EOpen );
+ __VTPRINTEXITR( "CVtEngMdtrMessageListener.IsReadyForCLIEvent %d>",
+ isReady )
+ return isReady;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmediatorservice.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,301 @@
+/*
+* 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: Mediator service implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cvtengmediatorservice.h"
+#include "cvtenginternaloperation.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngEventManager.h"
+#include "VtEngUtils.h"
+#include "CVtEngSettings.h"
+#include <cvtlogger.h>
+#include <MediatorCommandResponder.h>
+#include <MediatorDomainUIDs.h>
+#include <videotelcontrolmediatorapi.h>
+#include <videoteltophonecommandsapi.h>
+#include <vtinternalmediatorapi.h>
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::StartLD
+// Mediator service starter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::StartLD(
+ CMediatorCommandResponder& aResponder,
+ CVtEngUtility& aUtils,
+ const TUid aCategory,
+ const TInt aCommand )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.StartLD" )
+ CVtEngMediatorService* self = new ( ELeave ) CVtEngMediatorService(
+ aResponder, aUtils, aCategory, aCommand );
+ CleanupStack::PushL( self );
+ self->ConstructAndDoServiceL();
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "CVtEngMediatorService.StartLD" )
+ }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMediatorService::~CVtEngMediatorService()
+ {
+ // ensure this is removed
+ __VTPRINTENTER( "CVtEngMediatorService::~CVtEngMediatorService" )
+ iUtils.EventManager().RemoveObserver( this );
+
+ // send response if destructed due to leave in ConstructAndDoServiceL
+ SendMediatorResponseD( EFalse );
+ __VTPRINTEXIT( "CVtEngMediatorService::~CVtEngMediatorService" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::SetOperation
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::SetOperation( CVtEngOperation* /*aActiveOp*/ )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.SetOperation" )
+ // no-op
+ __VTPRINTEXIT( "CVtEngMediatorService.SetOperation" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::CommandCompleteL
+// callback to internal operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::CommandCompleteL(
+ const TVtEngCommandId /*aCommand*/,
+ const TInt aResult )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.CommandCompleteL" )
+
+ iServiceStatus = aResult;
+
+ // Sends response to Telephony if not already sent by
+ // HandleVtEventL -> SendMediatorResponseD
+ SendMediatorResponseD( ETrue );
+ __VTPRINTEXITR( "CVtEngMediatorService.CommandCompleteL %d", aResult )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::HandleVtEventL( TInt aEvent )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.HandleVtEventL" )
+
+ // This is registered event observer when shutdown mediator command was
+ // received. Now send response if state precondition is met
+ if ( aEvent == KVtEngSessionStateChanged &&
+ IsShuttingDown() )
+ {
+ // no interest on events any more, task fulfilled
+ iUtils.EventManager().RemoveObserver( this );
+
+ // iServiceStatus used for mediator response
+ iServiceStatus = KErrNone;
+
+ SendMediatorResponseD( EFalse );
+ }
+ __VTPRINTEXIT( "CVtEngMediatorService.HandleVtEventL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::CVtEngMediatorService
+// -----------------------------------------------------------------------------
+//
+CVtEngMediatorService::CVtEngMediatorService(
+ CMediatorCommandResponder& aResponder,
+ CVtEngUtility& aUtils,
+ const TUid aCategory,
+ const TInt aCommandId ) :
+ iResponder( aResponder ),
+ iUtils( aUtils ),
+ iCategory( aCategory ),
+ iCommandId( aCommandId ),
+ iServiceStatus( KErrNotReady )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.CVtEngMediatorService" )
+ __VTPRINTEXIT( "CVtEngMediatorService.CVtEngMediatorService" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::ConstructAndDoServiceL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::ConstructAndDoServiceL()
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.ConstructAndDoServiceL" )
+ __VTPRINT2( DEBUG_GEN, " CVtEngMediatorService.ConstructAndDoServiceL command id=%d", iCommandId )
+ // if starting of any operation below fails (StartOperationL leaves),
+ // this object is deleted. Destructor sends mediator response.
+ // non-supported command leads to leave+destructor also (see default case)
+ if ( KCatVideotelInternalCommands == iCategory)
+ {
+ switch ( iCommandId )
+ {
+ case EVtMediatorReleaseDataport:
+ if ( !IsShuttingDown() )
+ {
+ // Mediator response is sent when state becomes appropriate,
+ // indicated by call to HandleVtEventL, or
+ // when operation callback CommandCompleteL is called,
+ // which ever comes first. However, this object is deleted
+ // only after operation callback is received.
+ iUtils.EventManager().AddObserverL( this );
+ StartOperationL( KVtEngTerminateSession );
+ }
+ // if already shutting down this is no op (and self destructed)
+ // if get this command because endactivecall from vt menu, do not do any op from here
+ else
+ {
+ SendMediatorResponseD(EFalse);
+ }
+ break;
+ default:
+ // requested command that is not supported, issue "failed" response
+ iServiceStatus = KErrNotSupported;
+ break;
+ }
+ }
+ else
+ {
+ switch ( iCommandId )
+ {
+ case EVtCmdUnmute:
+ case EVtCmdMute:
+ {
+ TVtEngCommandId engineCmd = ( iCommandId ==
+ EVtCmdUnmute ) ? KVtEngUnmuteOutgoingAudio :
+ KVtEngMuteOutgoingAudio;
+ if ( !IsShuttingDown() )
+ {
+ StartOperationL( engineCmd );
+ }
+ else
+ {
+ SendMediatorResponseD(EFalse);
+ }
+ }
+ break;
+ default:
+ // requested command that is not supported, issue "failed" response
+ iServiceStatus = KErrNotSupported;
+ break;
+ }
+ }
+ if ( iServiceStatus != KRequestPending && !IsShuttingDown() )
+ { // results in destruction of this object and sending of mediator
+ // response with error
+ //__VTPRINT2( DEBUG_GEN, "CVtEngMediatorService.ConstructAndDoServiceL leave by iServiceStatus: %d", iServiceStatus )
+ User::Leave( iServiceStatus );
+ }
+
+ __VTPRINTEXIT( "CVtEngMediatorService.ConstructAndDoServiceL" )
+ }
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::IsShuttingDown
+// Checks if shutdown is ongoing
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediatorService::IsShuttingDown() const
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.IsShuttingDown" )
+ const MVtEngSessionInfo::TSessionState state =
+ iUtils.StateManager()->SessionState();
+ TBool isShuttingDown = EFalse;
+
+ // consider shutdown true if clearing or idle
+ if ( state == MVtEngSessionInfo::EClearing ||
+ state == MVtEngSessionInfo::EIdle )
+ {
+ isShuttingDown = ETrue;
+ }
+ __VTPRINTEXITR( "CVtEngMediatorService.IsShuttingDown %d",
+ isShuttingDown )
+ return isShuttingDown;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::StartOperationL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::StartOperationL( const TVtEngCommandId aCommand )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.StartOperationL" )
+ iOperation = CVtEngInternalOperation::NewL(
+ aCommand,
+ iUtils.StateManager()->Handlers(),
+ *this );
+ iOperation->ExecuteL();
+ iServiceStatus = KRequestPending;
+ __VTPRINTEXIT( "CVtEngMediatorService.StartOperationL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::SendMediatorResponseD
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::SendMediatorResponseD( const TBool aDeleteThis )
+ {
+ __VTPRINTENTER( "CVtEngMediatorService.SendMediatorResponseD" )
+ __VTPRINT2( DEBUG_GEN, "CVtEngMediatorService.SendMediatorResponseD command: %d", iCommandId )
+ if ( iCommandId != KErrNotFound )
+ {
+ if ( iCategory == KCatVideotelInternalCommands && iCommandId == EVtMediatorReleaseDataport )
+ {
+ iResponder.IssueResponse(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalCommands,
+ iCommandId,
+ iServiceStatus,
+ KNullDesC8() );
+ }
+ else
+ {
+ iResponder.IssueResponse(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ iCommandId,
+ iServiceStatus,
+ KNullDesC8() );
+ }
+
+ // prevents further response because destructor also calls this method
+ iCommandId = KErrNotFound;
+ }
+ if ( aDeleteThis )
+ {
+ // note! check above is mandatory because this method is called
+ // also from destructor.
+ delete this;
+ }
+ __VTPRINTEXIT( "CVtEngMediatorService.SendMediatorResponseD" )
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/CVtEngCommandHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,560 @@
+/*
+* Copyright (c) 2006 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: Handles commands from user interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include "CVtEngCommandHandler.h"
+#include "CVtEngHandlerContainer.h"
+#include "MVtEngCommandObserver.h"
+#include "CVtEngOperation.h"
+#include <cvtlogger.h>
+#include "CVtEngStateManager.h"
+#include <videotelephonyvariant.hrh>
+#include "VtEngUtils.h"
+
+#include "CVtEngStateIdle.h"
+#include "CVtEngStateInitializing.h"
+#include "CVtEngStateConnected.h"
+#include "CVtEngStateRinging.h"
+#include "CVtEngStateOpen.h"
+#include "CVtEngStateNegotiating.h"
+#include "CVtEngStateClearing.h"
+#include "CVtEngStateAlerting.h"
+
+// CONSTANTS
+const TInt KVtEngCommandPoolCommands = 1;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCommandHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCommandHandler(
+ CVtEngHandlerContainer& aHandlers ) :
+ iObservers( 1 ),
+ iHandlers( aHandlers ),
+ iInvalidCommandId( KVtEngCommandNone )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ConstructL()
+ {
+ __VTPRINTENTER( "CmdHlr.ConstructL" )
+ iCommandPool = new ( ELeave ) CVtEngCmdPool( KVtEngCommandPoolCommands );
+
+ // session termination
+ AddToPoolL( KVtEngInitializeEngine );
+ AddToPoolL( KVtEngInitializeEngineDiag );
+ AddToPoolL( KVtEngInitializeEngineTest );
+ AddToPoolL( KVtEngPrepareViewFinder );
+ AddToPoolL( KVtEngPrepareRemoteRenderDSA );
+ AddToPoolL( KVtEngPrepareRemoteRenderDP );
+ AddToPoolL( KVtEngPrepareRemoteRenderNGA );
+ AddToPoolL( KVtEngResetEngine );
+ __VTPRINTEXIT( "CmdHlr.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler* CVtEngCommandHandler::NewL( CVtEngHandlerContainer& aHandlers )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "CmdHlr.New")
+ CVtEngCommandHandler* self = new( ELeave ) CVtEngCommandHandler( aHandlers );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// Destructor
+CVtEngCommandHandler::~CVtEngCommandHandler()
+ {
+ __VTPRINTENTER( "CmdHlr.~" )
+ iObservers.Close();
+ if ( iActiveOp )
+ {
+ if ( iCommandPool->Get( iActiveOp->Command() ) == NULL )
+ {
+ delete iActiveOp;
+ }
+ }
+ delete iCommandPool;
+ __VTPRINTEXIT( "CmdHlr.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ExecuteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ExecuteL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* aParams )
+ {
+ __VTPRINTENTER( "CmdHlr.ExecuteL" )
+
+ __VTPRINT2( DEBUG_GEN, "ComHlr:Exec cmdId=%d", aCommandId )
+ ValidateL( aCommandId, aParams );
+ CVtEngOperation* opFromPool = iCommandPool->Get( aCommandId );
+ CVtEngOperation* op = opFromPool;
+ if ( op == NULL )
+ {
+ op = CVtEngOperation::NewL( aCommandId, iHandlers, *this );
+ CleanupStack::PushL( op );
+ }
+
+ switch ( aCommandId )
+ {
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineTest:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngResetEngine:
+ case KVtEngTerminateSession:
+ case KVtEngStartViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngPauseRenderRemote:
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ case KVtEngStopDtmfTone:
+ case KVtEngRequestLastRemoteFrame:
+ // Handling of different UIIs
+ case KVtEngSetUIIDtmfSupport:
+ case KVtEngSetUIIBasicStringSupport:
+ case KVtEngSetUIIIA5StringSupport:
+ case KVtEngSetUIIGeneralStringSupport:
+ case KVtEngFreeze:
+ case KVtEngUnfreeze:
+ case KVtEngHandleLayoutChange:
+
+ // Media object sharing (no parameters )
+ case KVtEngStartShareImage:
+ case KVtEngStopShareImage:
+ op->ExecuteL( NULL );
+ break;
+ // Media
+ case KVtEngSetUIForeground:
+ case KVtEngPrepareCamera:
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareViewFinderDSA:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareViewFinderDP:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngSetSource:
+ case KVtEngSetZoomStep:
+ case KVtEngSetAudioRouting:
+ case KVtEngSetAudioVolume:
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+ case KVtEngSendDtmf:
+ case KVtEngStartDtmfTone:
+ case KVtEngSetVideoQuality:
+ case KVtEngSwitchToVoice:
+ // Extension commands
+ case KVtEngSetContrast:
+ case KVtEngSetBrightness:
+ case KVtEngSetWhiteBalance:
+ case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+ case KVtEngStartRecord:
+ case KVtEngStopRecord:
+#endif
+ // Media object sharing (with parameters )
+ case KVtEngInitializeShareImage:
+ // Flow through, ok to execute
+ op->ExecuteL( aParams );
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ if ( opFromPool == NULL )
+ {
+ CleanupStack::Pop( ); // op (deletes itself)
+ }
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update();
+ __VTPRINTEXIT( "CmdHlr.ExecuteL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CancelCommand
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCommandHandler::CancelCommand( const TVtEngCommandId aCommandId )
+ {
+ __VTPRINTENTER( "CmdHlr.CancelCommand" )
+
+ __VTPRINT2( DEBUG_GEN, "ComHlr.Cancel cmd=%d", aCommandId )
+ TInt err( KErrGeneral );
+ if ( iActiveOp &&
+ iActiveOp->Command() == aCommandId &&
+ aCommandId != KVtEngResetEngine &&
+ aCommandId != KVtEngInitializeEngineTest &&
+ aCommandId != KVtEngInitializeEngineDiag)
+ {
+ iActiveOp->Cancel();
+ err = KErrNone;
+ }
+ __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "ComHlr.Cancel res=%d",err )
+ __VTPRINTEXIT( "CmdHlr.CancelCommand" )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::GetCommandCaps
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCommandHandler::GetCommandCaps(
+ const TVtEngCommandId aCommand )
+ {
+ TInt caps( 0 );
+ CheckAsynchronity( aCommand, caps );
+ CheckSupport( aCommand, caps );
+ CheckState( aCommand, caps );
+ return caps;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::PendingCommand
+//
+// -----------------------------------------------------------------------------
+//
+TVtEngCommandId CVtEngCommandHandler::PendingCommand()
+ {
+ if ( iActiveOp )
+ {
+ return iActiveOp->Command();
+ }
+ return KVtEngCommandNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::InvalidCommand
+//
+// -----------------------------------------------------------------------------
+//
+TVtEngCommandId CVtEngCommandHandler::InvalidCommand()
+ {
+ return iInvalidCommandId;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::AddObserverL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::AddObserverL(
+ MVtEngCommandObserver& aObserver )
+ {
+ User::LeaveIfError( iObservers.Append( &aObserver ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::RemoveObserver
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::RemoveObserver(
+ MVtEngCommandObserver& aObserver )
+ {
+ const TInt pos( iObservers.Find( &aObserver ) );
+ if ( pos >= 0 )
+ {
+ iObservers.Remove( pos );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CommandCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CommandCompleteL(
+ const TVtEngCommandId aCommand,
+ const TInt aResult )
+ {
+ __VTPRINTENTER( "CmdHlr.CommandCompleteL" )
+ __VTPRINT3( DEBUG_GEN, " completed cmd=%d,res=%d", aCommand, aResult )
+ TInt count( iObservers.Count() );
+ while ( count-- )
+ {
+ MVtEngCommandObserver* observer = iObservers[ count ];
+ observer->HandleVTCommandPerformedL( aCommand, aResult );
+ }
+ __VTPRINTEXIT( "CmdHlr.CommandCompleteL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::SetOperation
+// Sets active operation
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::SetOperation( CVtEngOperation* aActiveOp )
+ {
+ iActiveOp = aActiveOp;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::AddToPoolL
+// Adds a command to command pool. Only commands without parameters and
+// that don't delete themselfs can currently be added.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::AddToPoolL( TVtEngCommandId aCommand )
+ {
+ CVtEngOperation* op = CVtEngOperation::NewL(
+ aCommand, iHandlers, *this, EFalse );
+ CleanupStack::PushL( op );
+ iCommandPool->AppendL( op );
+ CleanupStack::Pop(); // op
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ValidateL
+// Checks if command can be performed.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ValidateL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* /*aParams*/ )
+ {
+ // check if async command is already pending and new
+ // command is async
+ TInt caps( 0 );
+ CheckState( aCommandId, caps );
+ if ( !(caps & EAttribEnabled ) )
+ {
+ User::Leave( KErrNotReady );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckAsynchronity
+// Checks if command is async
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckAsynchronity(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps )
+ {
+ switch ( aCommandId )
+ {
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineTest:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngResetEngine:
+ case KVtEngTerminateSession:
+ case KVtEngSetSource:
+ case KVtEngPrepareCamera:
+ case KVtEngSetAudioRouting:
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ case KVtEngSetAudioVolume:
+ case KVtEngHandleLayoutChange:
+ case KVtEngUnfreeze:
+
+ // Media object sharing
+ case KVtEngInitializeShareImage:
+ case KVtEngStartShareImage:
+ case KVtEngStopShareImage:
+ case KVtEngSwitchToVoice:
+ aCaps |= EAttribAsync;
+ break;
+ default:
+ aCaps &= (~EAttribAsync);
+ break;
+ }
+ __VTPRINT3( DEBUG_GEN | DEBUG_RETURN, "ComHlr:capsA cmd=%d,caps=%d", aCommandId, aCaps )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckSupport
+// Checks if command is supported
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckSupport(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps )
+ {
+ switch ( aCommandId )
+ {
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineTest:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngResetEngine:
+ case KVtEngTerminateSession:
+ case KVtEngStartViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngSetAudioRouting:
+ case KVtEngSetAudioVolume:
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+ case KVtEngPauseRenderRemote:
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ case KVtEngSetSource:
+ case KVtEngPrepareCamera:
+ case KVtEngStartDtmfTone:
+ case KVtEngStopDtmfTone:
+ case KVtEngFreeze:
+ case KVtEngUnfreeze:
+ case KVtEngSetVideoQuality:
+ case KVtEngHandleLayoutChange:
+ // Handling of different UIIs, support is there
+ case KVtEngSetUIIDtmfSupport:
+ case KVtEngSetUIIBasicStringSupport:
+ case KVtEngSetUIIIA5StringSupport:
+ case KVtEngSetUIIGeneralStringSupport:
+ case KVtEngSetUIForeground:
+ case KVtEngRequestLastRemoteFrame:
+
+ // Media object sharing
+ case KVtEngInitializeShareImage:
+ case KVtEngStartShareImage:
+ case KVtEngStopShareImage:
+ case KVtEngSwitchToVoice:
+ aCaps |= EAttribSupported;
+ break;
+
+ // Extension commands
+ case KVtEngSetContrast:
+ case KVtEngSetBrightness:
+ case KVtEngSetWhiteBalance:
+ case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+ case KVtEngStartRecord:
+ case KVtEngStopRecord:
+#endif
+ aCaps |= EAttribSupported;
+ break;
+
+ default:
+ aCaps &= (~EAttribSupported);
+ __VTPRINT( DEBUG_GEN, "ComHlr.NOT SUPPORTED" )
+ break;
+ }
+ __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, " capsSupport cmd=%d,caps=%d", aCommandId, aCaps )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckState
+// Checks if command is possible in current state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckState(
+ const TVtEngCommandId aCommandId,
+ TInt& aCaps )
+ {
+ iInvalidCommandId = KVtEngCommandNone;
+ aCaps &= (~EAttribEnabled);
+ if ( !(iActiveOp && ( aCaps & EAttribAsync ) ) )
+ {
+ const CVtEngStateManager* states = CVtEngUtility::StateManager();
+ if ( states->IsCommandPossible( aCommandId ) )
+ {
+ aCaps |= EAttribEnabled;
+ }
+ else
+ {
+ iInvalidCommandId = aCommandId;
+ __VTPRINT( DEBUG_GEN, "ComHlr.ChkState INVALID" )
+ }
+ }
+ __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, " capsState cmd=%d,caps=%d", aCommandId, aCaps )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool
+// C++ constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool( TInt aGranularity ) :
+ CArrayPtrFlat<CVtEngOperation>( aGranularity )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool
+// Destructor - deletes operations in the pool.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCmdPool::~CVtEngCmdPool( )
+ {
+ ResetAndDestroy();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::Get
+// Returns pointer to an operation in the pool.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation* CVtEngCommandHandler::CVtEngCmdPool::Get(
+ const TVtEngCommandId aId )
+ {
+ TInt count( Count() );
+ CVtEngOperation* ret = NULL;
+ while ( count-- )
+ {
+ CVtEngOperation* op = At( count );
+ if ( op->Command() == aId )
+ {
+ ret = op;
+ count = 0; // break
+ }
+ }
+ return ret;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/CVtEngOperation.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2006 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: Operation base class implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngOperation.h"
+#include "CVtEngCommandHandler.h"
+#include "TVtEngOperationUtils.h"
+#include "VtEngUtils.h"
+#include "cvtengmdtrcommandsender.h"
+#include "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::NewL
+// Symbian two-phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation* CVtEngOperation::NewL(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete )
+ {
+ CVtEngOperation* self = new ( ELeave )
+ CVtEngOperation( aCommandId, aHandlers, aObserver, aDelete );
+
+ CleanupStack::PushL( self );
+ self->iAsyncCallback = new ( ELeave )
+ CAsyncCallBack( CActive::EPriorityStandard );
+ self->iAsyncCallback->Set( TCallBack( ASyncHandleOpComplete, self ) );
+
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::CVtEngOperation
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation::CVtEngOperation(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete ) :
+ iCommand( aCommandId ),
+ iHandlers( aHandlers ),
+ iObserver( aObserver ),
+ iDelete( aDelete )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::~CVtEngOperation
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation::~CVtEngOperation()
+ {
+ Cancel();
+ delete iAsyncCallback;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::HandleOpCompleteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngOperation::HandleOpComplete( const TInt aResult )
+ {
+ __VTPRINTENTER( "EngOp.HandleOpComplete" )
+ iObserver.SetOperation( NULL );
+ CVtEngMdtrCommandSender& mediatorSender =
+ CVtEngUtility::EngineUtils()->MediatorCommands();
+ switch( iCommand )
+ {
+ case KVtEngTerminateSession:
+ // send mediator command to telephony for call release
+ mediatorSender.EndCall();
+ break;
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ // notify telephony subsystems about new microphone state
+ mediatorSender.NotifyOutgoingAudioState(
+ iCommand == KVtEngUnmuteOutgoingAudio );
+ break;
+ default:
+ break;
+ }
+#ifdef VTDEBUG
+ TRAPD( err, iObserver.CommandCompleteL( iCommand, aResult ) );
+ __VTPRINT2( DEBUG_GEN, "EngOp.Complete err=", err )
+#else
+ TRAP_IGNORE( iObserver.CommandCompleteL( iCommand, aResult ) );
+#endif // VTDEBUG
+ if ( iDelete )
+ {
+ delete this;
+ }
+ __VTPRINTEXITR( "EngOp.HandleOpComplete %d", aResult )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::ASyncHandleOpComplete
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngOperation::ASyncHandleOpComplete( TAny* aPtr )
+ {
+ __VTPRINTENTER( "EngOp.ASyncHandleOpComplete" )
+ CVtEngOperation* self = reinterpret_cast< CVtEngOperation* >( aPtr );
+ TInt error( self->iAsyncErr );
+ self->iAsyncErr = KErrNone;
+ self->HandleOpComplete( error );
+ __VTPRINTEXIT( "EngOp.ASyncHandleOpComplete" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::ExecuteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::ExecuteL( TDesC8* aParams )
+ {
+ __VTPRINTENTER( "EngOp.ExecuteL" )
+ TBool complete( EFalse );
+
+ // Offer for synchronous handling.
+ TRAPD( err, complete = OfferExecuteSyncL( aParams ) );
+#ifdef VTDEBUG
+ if ( err < KErrNone )
+ {
+ __VTPRINT2( DEBUG_GEN, "EngOp.ExecuteL LEAVE = %d", err )
+ }
+#endif
+ User::LeaveIfError( err );
+ if ( !complete )
+ {
+ // async request
+ switch ( iCommand )
+ {
+ case KVtEngResetEngine:
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineTest:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngTerminateSession:
+ case KVtEngSwitchToVoice:
+ TVtEngEngineInitUtil::HandleL( *this, iHandlers );
+ break;
+
+ case KVtEngSetSource:
+ case KVtEngPrepareCamera:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngHandleLayoutChange:
+ case KVtEngUnfreeze:
+
+ // Media object sharing
+ case KVtEngStopShareImage:
+ TVtEngRenderUtil::HandleL( *this, iHandlers );
+ break;
+
+ // Media object sharing
+ // These two commands must be trapped and completed without leave
+ // because Application UI has to be able to act according to error.
+ case KVtEngInitializeShareImage:
+ case KVtEngStartShareImage:
+ TRAP( err, TVtEngRenderUtil::HandleL( *this, iHandlers ) );
+ break;
+
+ case KVtEngSetAudioRouting:
+ TVtEngAudioRoutingUtil::HandleL( *this );
+ break;
+
+ case KVtEngSetAudioVolume:
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+ break;
+ default:
+ __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled" )
+ break;
+ }
+
+ iObserver.SetOperation( this );
+
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_GEN, "EngOp.ExecuteL completing command %d", err )
+ iAsyncErr = err;
+ iAsyncCallback->CallBack();
+ }
+ }
+ else if ( iDelete )
+ {
+ delete this;
+ }
+ __VTPRINTEXITR( "EngOp.ExecuteL %d", complete )
+ return complete;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Cancel
+// Cancels operation.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::Cancel()
+ {
+ __VTPRINTENTER( "EngOp.Cancel")
+ __VTPRINT2( DEBUG_GEN, "Command id = %d", iCommand)
+ switch ( iCommand )
+ {
+ case KVtEngInitializeEngine:
+ //TVtEngEngineInitUtil::Cancel( *this );
+ break;
+ case KVtEngInitializeShareImage:
+ TVtEngRenderUtil::Cancel( *this ,iHandlers);
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "EngOp.Cancel" )
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::OfferExecuteSyncL
+//
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::OfferExecuteSyncL( TDesC8* aParams )
+ {
+ __VTPRINTENTER( "EngOp.OfferExecuteSyncL" )
+ TBool complete( EFalse );
+ iParams = aParams; // reset back to null in ExecuteL
+ // test
+
+ switch ( iCommand )
+ {
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+ TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+ complete = ETrue;
+ break;
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareViewFinderDSA:
+ case KVtEngPrepareViewFinderDP:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngPauseRenderRemote:
+ case KVtEngSetZoomStep:
+ case KVtEngFreeze:
+ TVtEngViewFinderConfigureUtil::HandleL( *this, iHandlers );
+ complete = ETrue;
+ break;
+ case KVtEngPrepareRemoteRender:
+ break;
+ case KVtEngStartDtmfTone:
+ case KVtEngStopDtmfTone:
+ // Handling of different UIIs, support is there
+ case KVtEngSetUIIDtmfSupport:
+ case KVtEngSetUIIBasicStringSupport:
+ case KVtEngSetUIIIA5StringSupport:
+ case KVtEngSetUIIGeneralStringSupport:
+
+ TVtEngMediaTransportUtil::HandleL( *this, iHandlers );
+ complete = ETrue;
+ break;
+
+ case KVtEngSetUIForeground:
+ case KVtEngSetVideoQuality:
+ case KVtEngRequestLastRemoteFrame:
+ TVtEngRenderUtil::HandleL( *this, iHandlers );
+ complete = ETrue;
+ break;
+
+ // Extension commands
+ case KVtEngSetContrast:
+ case KVtEngSetBrightness:
+ case KVtEngSetWhiteBalance:
+ case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+ case KVtEngStartRecord:
+ case KVtEngStopRecord:
+#endif
+ TVtEngExtensionUtil::HandleL( *this );
+ complete = ETrue;
+ break;
+
+ default:
+ __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled sync" )
+ break;
+ }
+ __VTPRINTEXITR( "EngOp.OfferExecuteSyncL %d", complete )
+ return complete;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/TVtEngOperationUtils.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2006 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: Handler utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "TVtEngOperationUtils.h"
+#include "VtEngPanic.h"
+#include "CVtEngInitializer.h"
+#include "VtEngUtils.h"
+#include "CVtEngOperation.h"
+#include "CVtEngHandlerContainer.h"
+#include "CVtEngMediaHandler.h"
+#include "CVtEngAudioHandler.h"
+#include "CVtEngSessionHandler.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngSettings.h"
+#include "cvtengmdtrcommandsender.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderUtil::HandleL
+// unpacks and handles a rendering command
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngRenderUtil::HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers )
+ {
+ CVtEngMediaHandler& media =
+ static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+
+ media.HandleL( aOperation );
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderUtil::Cancel
+// cancel the specify pending command
+//
+// -----------------------------------------------------------------------------
+//
+
+void TVtEngRenderUtil::Cancel(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers )
+ {
+ const TVtEngCommandId id = aOperation.Command();
+ __VTPRINTENTER( "TVtEngRenderUtil.Cancel")
+ __VTPRINT2( DEBUG_GEN, "Command id = %d", id)
+ if ( id == KVtEngInitializeShareImage )
+ {
+ CVtEngMediaHandler& media =
+ static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+
+ media.CancelInitializeShareImage();
+ }
+ __VTPRINTEXIT( "TVtEngRenderUtil.Cancel")
+ }
+// -----------------------------------------------------------------------------
+// TVtEngAudioRoutingUtil::HandleL
+// unpacks and handles audio routing command.
+//
+// -----------------------------------------------------------------------------
+//
+
+void TVtEngAudioRoutingUtil::HandleL(
+ CVtEngOperation& aOperation )
+ {
+ CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngAudioPlaybackUtil::HandleL
+// unpacks and handles audio playback command.
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngAudioPlaybackUtil::HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers )
+ {
+ __VTPRINTENTER( "AudioPlaybackUtil.HandleL" )
+ if ( aOperation.Command() == KVtEngSetAudioVolume )
+ {
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const TPckgC<MVtEngAudio::TVtEngOutputVolume>& pckg =
+ static_cast<const TPckgC<MVtEngAudio::TVtEngOutputVolume>&>
+ ( *aOperation.Parameters() );
+
+ settings.SetVolume( pckg().iHandsetVolume, pckg().iHandsfreeVolume,
+ ETrue );
+ }
+
+ // All the commands are though passed to handler
+ CVtEngMediaHandler& media =
+ static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+ __VTPRINT( DEBUG_DETAIL, "TVtEngAudioPlaybackUtil::HandleL:Handler fetched")
+
+ media.HandleL( aOperation );
+ __VTPRINTEXIT( "AudioPlaybackUtil.HandleL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngMediaTransportUtil::HandleL
+// unpacks and handles media transport command.
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngMediaTransportUtil::HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers )
+ {
+ __VTPRINTENTER( "MediaTransportUtil.HandleL" )
+ const TVtEngCommandId command( aOperation.Command() );
+ if ( command == KVtEngStopDtmfTone ||
+ command == KVtEngStartDtmfTone ||
+ // DTMF commands
+ command == KVtEngSetUIIDtmfSupport ||
+ command == KVtEngSetUIIBasicStringSupport ||
+ command == KVtEngSetUIIIA5StringSupport ||
+ command == KVtEngSetUIIGeneralStringSupport )
+ {
+ aHandlers.Dtmf().HandleL( aOperation );
+ }
+
+ __VTPRINTEXIT( "MediaTransportUtil.HandleL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngViewFinderConfigureUtil::HandleL
+// unpacks and handles
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngViewFinderConfigureUtil::HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& aHandlers )
+ {
+ CVtEngMediaHandler& media =
+ static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+
+ media.HandleL( aOperation );
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngCameraConfigUtil::HandleL
+// unpacks and handles
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngCameraConfigUtil::HandleL(
+ CVtEngOperation& /*aOperation*/,
+ CVtEngHandlerContainer& /*aHandlers*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngEngineInitUtil::HandleL
+// Handles engine initialization and uninitialization command.
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngEngineInitUtil::HandleL(
+ CVtEngOperation& aOperation,
+ CVtEngHandlerContainer& /* aHandlers */ )
+ {
+ __VTPRINTENTER( "EngineInitUtil.HandleL" )
+ const TVtEngCommandId id = aOperation.Command();
+
+ CVtEngInitializer& initializer =
+ CVtEngUtility::EngineUtils()->Initializer();
+
+ switch ( id )
+ {
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngInitializeEngineTest:
+ initializer.InitializeL( aOperation );
+ break;
+ case KVtEngResetEngine:
+ initializer.Uninitialize( aOperation );
+ break;
+ case KVtEngTerminateSession:
+ CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+ break;
+ case KVtEngSwitchToVoice:
+ CVtEngUtility::MediatorCommands().SwitchToVoiceL( aOperation );
+ break;
+ default:
+ Panic( EVtEngPanicIncorrectUtility );
+ break;
+ }
+ __VTPRINTEXIT( "EngineInitUtil.HandleL" )
+ }
+
+void TVtEngEngineInitUtil::Cancel( CVtEngOperation& aOperation )
+ {
+ const TVtEngCommandId id = aOperation.Command();
+ if ( id == KVtEngInitializeEngine )
+ {
+ CVtEngInitializer& initializer =
+ CVtEngUtility::EngineUtils()->Initializer();
+ initializer.CancelInit();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TVtEngExtensionUtil::HandleL
+// handles extension operations.
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngExtensionUtil::HandleL(
+ CVtEngOperation& aOperation )
+ {
+ CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/cvtenginternaloperation.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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: Internal operation class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cvtenginternaloperation.h"
+#include "mvtengoperationobserver.h"
+#include "CVtEngStateManager.h"
+#include "TVtEngOperationUtils.h"
+#include "VtEngUtils.h"
+#include "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::NewL
+// Symbian two-phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation* CVtEngInternalOperation::NewL(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete )
+ {
+ __VTPRINTENTER( "CVtEngInternalOperation.NewL<" )
+ CVtEngInternalOperation* self = new ( ELeave )
+ CVtEngInternalOperation( aCommandId, aHandlers, aObserver, aDelete );
+ __VTPRINTEXIT( "CVtEngInternalOperation.NewL>" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::CVtEngInternalOperation
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation::CVtEngInternalOperation(
+ TVtEngCommandId aCommandId,
+ CVtEngHandlerContainer& aHandlers,
+ MVtEngOperationObserver& aObserver,
+ TBool aDelete ) : CVtEngOperation( aCommandId, aHandlers, aObserver,
+ aDelete )
+ {
+ __VTPRINTENTER( "CVtEngInternalOperation.CVtEngInternalOperation" )
+ __VTPRINTEXIT( "CVtEngInternalOperation.CVtEngInternalOperation" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::~CVtEngInternalOperation
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation::~CVtEngInternalOperation()
+ {
+ __VTPRINTENTER( "CVtEngInternalOperation.~" )
+ __VTPRINTEXIT( "CVtEngInternalOperation.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::HandleOpCompleteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInternalOperation::HandleOpComplete( const TInt aResult )
+ {
+ __VTPRINTENTER( "CVtEngInternalOperation.HandleOpComplete" )
+ #ifdef VTDEBUG
+ TRAPD( err, iObserver.CommandCompleteL( iCommand, aResult ) );
+ __VTPRINT2( DEBUG_GEN, "EngOp.Complete err=", err )
+#else
+ TRAP_IGNORE( iObserver.CommandCompleteL( iCommand, aResult ) );
+#endif // VTDEBUG
+ if ( iDelete )
+ {
+ delete this;
+ }
+ __VTPRINTEXITR( "CVtEngInternalOperation.HandleOpComplete %d>", aResult )
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::ExecuteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInternalOperation::ExecuteL()
+ {
+ __VTPRINTENTER( "CVtEngInternalOperation.ExecuteL" )
+ const CVtEngStateManager* states = CVtEngUtility::StateManager();
+ TInt err( KErrNotReady );
+ if ( states->IsCommandPossible( iCommand ) )
+ {
+ err = KErrNone;
+ switch ( iCommand )
+ {
+ case KVtEngTerminateSession:
+ TVtEngEngineInitUtil::HandleL( *this, iHandlers );
+ break;
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+ break;
+ default:
+ __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled" )
+ err = KErrNotSupported;
+ break;
+ }
+ }
+ User::LeaveIfError( err );
+ __VTPRINTEXIT( "CVtEngInternalOperation.ExecuteL" )
+ return EFalse;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngCameraPreferences.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,437 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Camera Preferences extension
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngCameraPreferences.h"
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "mvtengcamerapreferencesobserver.h"
+
+#include <capivideosource.h>
+#include <cvtlogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::CVtEngCameraPreferences
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences::CVtEngCameraPreferences():
+ CVtEngExtensionBase(
+ KVtEngExtensionCameraPreferences )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::ConstructL()
+ {
+ __VTPRINTENTER( "CVtEngCameraPreferences.ConstructL" )
+ __VTPRINTEXIT( "CVtEngCameraPreferences.ConstructL" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences* CVtEngCameraPreferences::NewL()
+ {
+ CVtEngCameraPreferences* self = new( ELeave ) CVtEngCameraPreferences;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::~CVtEngCameraPreferences
+// Destructor. Cannot leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences::~CVtEngCameraPreferences()
+ {
+ __VTPRINTENTER( "CameraPreferences.~" )
+ if ( iObserver )
+ {
+ iObserver->Detach( *this );
+ }
+ __VTPRINTEXIT( "CameraPreferences.~" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetInterface
+//
+// ----------------------------------------------------------------------------
+//
+TAny* CVtEngCameraPreferences::GetInterface()
+ {
+ __VTPRINTENTER( "CameraPreferences.GetInterface")
+ // Cast first as API MVtEngCameraPreferences* class
+ // and after that to TAny*
+ __VTPRINTEXIT( "CameraPreferences.GetInterface" )
+ return reinterpret_cast< TAny* >( ( MVtEngCameraPreferences* ) this );
+
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::HandleL
+//
+// ----------------------------------------------------------------------------
+//
+TBool CVtEngCameraPreferences::HandleL( CVtEngOperation* aOp )
+ {
+ __VTPRINTENTER( "CameraPreferences.HandleL" )
+ const TVtEngCommandId id( aOp->Command() );
+ __VTPRINT2( DEBUG_GEN, "CVtEngCameraPreferences.HandleL CMD ID[%d] ", id )
+
+ // Check provider
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR( "CVtEngCameraPreferences.HandleL iProvider [%d]",
+ ( TInt )iProvider )
+ User::Leave( KErrNotReady );
+ }
+ // Check which command and call
+ // active provider with operation params
+ switch ( id )
+ {
+ case KVtEngSetContrast:
+ {
+ TInt contrast = 0;
+ TVtEngOpParamUtil< TInt >::Set( contrast, *aOp );
+ iProvider->SetContrastL( contrast );
+ if ( iObserver )
+ {
+ iObserver->ContrastUpdated( contrast );
+ }
+ break;
+ }
+ case KVtEngSetBrightness:
+ {
+ TInt brightness = 0;
+ TVtEngOpParamUtil< TInt >::Set( brightness, *aOp );
+ iProvider->SetBrightnessL( brightness );
+ if ( iObserver )
+ {
+ iObserver->BrightnessUpdated( brightness );
+ }
+ break;
+ }
+ case KVtEngSetWhiteBalance:
+ {
+ CCamera::TWhiteBalance whitebalance = CCamera::EWBAuto;
+ TVtEngOpParamUtil< CCamera::TWhiteBalance >::Set( whitebalance,
+ *aOp );
+ iProvider->SetWhiteBalanceL( whitebalance );
+ if ( iObserver )
+ {
+ iObserver->WhiteBalanceUpdated( TWhiteBalance( whitebalance ) );
+ }
+ break;
+ }
+ case KVtEngSetColorTone:
+ {
+ CCamera::CCameraImageProcessing::TEffect colortone =
+ CCamera::CCameraImageProcessing::EEffectNone;
+ TVtEngOpParamUtil< CCamera::CCameraImageProcessing::TEffect >::Set(
+ colortone, *aOp );
+ iProvider->SetColorToneL( colortone );
+ if ( iObserver )
+ {
+ iObserver->ColorToneUpdated( TColorTone( colortone ) );
+ }
+ break;
+ }
+ //Not supported command
+ default:
+ __VTPRINTEXITR(
+ "CVtEngCameraPreferences.HandleL NOT SUPPORTED CMD[%d]", id )
+ return EFalse;
+ }
+ __VTPRINTEXIT( "CameraPreferences.HandleL" )
+ return ETrue;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::ValidateCommand
+//
+// ----------------------------------------------------------------------------
+
+TBool CVtEngCameraPreferences::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINTENTER( "CameraPreferences.ValidateCommand" )
+ // Check provider
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR(
+ "CVtEngCameraPreferences.ValidateCommand iProvider [%d]",
+ ( TInt ) iProvider)
+ return EFalse;
+ }
+ // Take provider info is needed down below
+ TVSDataProviderInfo info;
+ iProvider->ProviderInfo( info );
+
+ // local or hw support
+ // set as False
+ TBool hworlocalsupport = EFalse;
+
+ // Check which command and check if
+ // if provider and local variation supports
+ __VTPRINT2( DEBUG_GEN,
+ "CVtEngCameraPreferences.ValidateCommand CMD ID[%d] ", aCommandId )
+ switch ( aCommandId )
+ {
+ case KVtEngSetContrast:
+ {
+ if ( info.iOptionsSupported & TCameraInfo::EContrastSupported )
+ {
+ hworlocalsupport = ETrue;
+ }
+ break;
+ }
+ case KVtEngSetBrightness:
+ {
+ if ( info.iOptionsSupported & TCameraInfo::EBrightnessSupported )
+ {
+ hworlocalsupport = ETrue;
+ }
+ break;
+ }
+ case KVtEngSetWhiteBalance:
+ {
+ if ( info.iWhiteBalanceModesSupported != CCamera::EWBAuto )
+ {
+ hworlocalsupport = ETrue;
+ }
+ break;
+ }
+ case KVtEngSetColorTone:
+ {
+ if ( info.iSupportedColorTones !=
+ CCamera::CCameraImageProcessing::EEffectNone )
+ {
+ hworlocalsupport = ETrue;
+ }
+ break;
+ }
+ // Not supported command
+ default:
+ {
+ __VTPRINT2( DEBUG_GEN,
+ "CVtEngCameraPreferences.ValidateCommand NOT SUPPORTED CMD[%d]",
+ aCommandId)
+ hworlocalsupport = EFalse;
+ }
+ }
+ __VTPRINTEXITR( "CVtEngCameraPreferences.ValidateCommand return value[%d]",
+ hworlocalsupport)
+ return hworlocalsupport;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetColorTone
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetColorTone(
+ MVtEngCameraPreferences::TColorTone& aColortone ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetColorTone" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR( "CVtEngCameraPreferences.GetColorTone iProvider[%d]",
+ ( TInt )iProvider)
+ return KErrNotReady;
+ }
+ TInt error;
+ CCamera::CCameraImageProcessing::TEffect colortone;
+ error = iProvider->GetColorTone( colortone );
+ aColortone = ( MVtEngCameraPreferences::TColorTone ) colortone;
+ __VTPRINTEXITR( "CameraPreferences.GetColorTone error [%d]",error )
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetSupportedColorTones
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetSupportedColorTones(
+ TUint32& aSupportedColorTones ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetSupportedColorTones" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR(
+ "CVtEngCameraPreferences.GetSupportedColorTones iProvider[%d]",
+ ( TInt )iProvider)
+ return KErrNotReady;
+ }
+
+ TVSDataProviderInfo info;
+ iProvider->ProviderInfo( info );
+ aSupportedColorTones = info.iSupportedColorTones;
+ __VTPRINTEXITR( "CameraPreferences.GetSupportedColorTones [%b]",
+ info.iSupportedColorTones)
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetWhiteBalance
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetWhiteBalance(
+ MVtEngCameraPreferences::TWhiteBalance& aWhiteBalance ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetWhiteBalance" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR(
+ "CVtEngCameraPreferences.GetWhiteBalance iProvider [%d]",
+ ( TInt )iProvider )
+ return KErrNotReady;
+ }
+ TInt error;
+ CCamera::TWhiteBalance whitebalance;
+ error = iProvider->GetWhiteBalance( whitebalance );
+ aWhiteBalance = (MVtEngCameraPreferences::TWhiteBalance) whitebalance;
+ __VTPRINTEXITR( "CameraPreferences.GetWhiteBalance error [%d]",error )
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetSupportedWhiteBalanceModes
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetSupportedWhiteBalanceModes(
+ TUint32& aWhiteBalance ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetSupportedWhiteBalanceModes" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR(
+ "CVtEngCameraPreferences.GetSupportedWhiteBalanceModes iProvider [%d]",
+ ( TInt )iProvider)
+ return KErrNotReady;
+ }
+
+ TVSDataProviderInfo info;
+ iProvider->ProviderInfo( info );
+ aWhiteBalance = info.iWhiteBalanceModesSupported;
+ __VTPRINTEXITR( "CameraPreferences.GetSupportedWhiteBalanceModes [%b]",
+ info.iWhiteBalanceModesSupported)
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetBrightness
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetBrightness( TInt& aBrightness ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetBrightness" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR( "CVtEngCameraPreferences.GetBrightness iProvider [%d]",
+ ( TInt )iProvider)
+
+ return KErrNotReady;
+ }
+ TInt error;
+ error = iProvider->GetBrightness( aBrightness );
+ __VTPRINTEXITR( "CameraPreferences.GetBrightness error [%d]",error )
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetContrast
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetContrast( TInt& aContrast ) const
+ {
+ __VTPRINTENTER( "CameraPreferences.GetContrast" )
+ if ( iProvider == NULL )
+ {
+ __VTPRINTEXITR( "CVtEngCameraPreferences.GetContrast iProvider [%d]",
+ ( TInt )iProvider)
+ return KErrNotReady;
+ }
+ TInt error;
+ error = iProvider->GetContrast( aContrast );
+ __VTPRINTEXITR( "CameraPreferences.GetContrast error [%d]",error )
+
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::SetProvider
+//
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::SetProvider( CVSDataProvider* aProvider,
+ MVtEngCameraPreferencesObserver& aObserver )
+ {
+ __VTPRINTENTER( "CameraPreferences.SetProvider" )
+ if ( iObserver )
+ {
+ iObserver->Detach( *this );
+ iObserver = NULL;
+ }
+ iProvider = aProvider;
+ iObserver = &aObserver;
+ if ( iObserver )
+ {
+ iObserver->Attach( *this );
+ }
+ __VTPRINTEXIT( "CameraPreferences.SetProvider" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::Detach
+//
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::Detach( MVtEngCameraPreferencesObserver&
+ aObserver )
+ {
+ __VTPRINTENTER( "CameraPreferences.Detach" )
+ if ( iObserver == &aObserver )
+ {
+ iObserver = NULL;
+ }
+ __VTPRINTEXITR( "CameraPreferences.Detach $%x", TInt( iObserver ) )
+ }
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngExtensionBase.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 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: Videoteleng extension base class
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngExtensionBase.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngExtensionBase::CVtEngExtensionBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngExtensionBase::CVtEngExtensionBase( TUid aExtensionUid ):
+ iExtensionUid( aExtensionUid )
+ {
+ }
+// ----------------------------------------------------------------------------
+// CVtEngExtensionBase::Uid
+//
+//
+// ----------------------------------------------------------------------------
+//
+const TUid& CVtEngExtensionBase::Uid() const
+ {
+ return iExtensionUid;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngExtensions.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2006 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: Videoteleng API extension configuration
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngExtensions.h"
+#include "VtEngPanic.h"
+#include "VtEngUtils.h"
+
+#include "CVtEngOperation.h"
+#include "CVtEngMediaHandler.h"
+#include "CVtEngCameraPreferences.h"
+#include "cvtengrecord2file.h"
+
+#include <cvtlogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::CVtEngExtensions
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions::CVtEngExtensions():
+ iExtensionArray( KExtensionGranularity )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngExtensions::ConstructL()
+ {
+ __VTPRINTENTER( "Extensions.ConstructL" )
+ __VTPRINTEXIT( "Extensions.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions* CVtEngExtensions::NewL()
+ {
+ CVtEngExtensions* self = new( ELeave ) CVtEngExtensions;
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::~CVtEngExtensions
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions::~CVtEngExtensions()
+ {
+ __VTPRINTENTER( "Extensions.~" )
+ // Clean and destroy pointer array
+ iExtensionArray.ResetAndDestroy();
+ __VTPRINTEXIT( "Extensions.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::CreateExtensions
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensionBase* CVtEngExtensions::CreateExtensionsL( const TUid& aUid,
+ CVtEngMediaHandler& aHandler)
+ {
+ __VTPRINTENTER( "Extensions.CreateExtensions" )
+
+ // init local variables
+ TInt error = KErrNotSupported;
+ CVtEngExtensionBase* extension = NULL;
+
+ // Check if supported UID
+ if ( aUid == KVtEngExtensionCameraPreferences ||
+ aUid == KVtEngExtensionRecord2File )
+ {
+ // Create extension
+ extension = aHandler.CreateExtensionsL( aUid );
+
+ // Push it to clean up stack because
+ // it needs to be append in to
+ // array and it can be failed
+ CleanupStack::PushL( extension );
+
+ // append extension in to array
+ error = iExtensionArray.Append(extension);
+ if ( error != KErrNone )
+ {
+ // if append fails
+ // clear clean up stack and leave
+ __VTPRINTEXITR(
+ "Extensions.CreateExtensions iExtension.Append failed %d",
+ error )
+ CleanupStack::PopAndDestroy();
+ User::Leave( error );
+ }
+ // append succesful
+ // pop extension from clena up stack and return
+ __VTPRINTEXITR(
+ "Extensions.CreateExtensions iExtension UID[%d] succesfully Appended",
+ aUid.iUid)
+ CleanupStack::Pop();
+ return extension;
+ }
+ // not supported UID
+ // leave with error
+ else
+ {
+ __VTPRINTEXITR(
+ "Extensions.CreateExtensions Extension NOTSUPPORTED UID%d",
+ aUid.iUid )
+ User::Leave( error );
+ return extension;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::GetClientInterface
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngExtensions::GetClientInterface( TAny** aInterfacePtr,
+ const TUid& aUid , CVtEngMediaHandler& aHandler)
+ {
+ __VTPRINTENTER( "Extensions.GetClientInterface" )
+ // if aInterfacePtr pointer is NULL -> panic
+ __ASSERT_ALWAYS( aInterfacePtr,Panic( EVtEngPanicInvalidPointer ) );
+
+ // init local variables
+ CVtEngExtensionBase* extension = NULL;
+ TInt error = KErrGeneral;
+
+ // initialize IF pointer to be NULL
+ // if correct extension API IF is found
+ // then changed to valid pointer
+ *aInterfacePtr = NULL;
+
+ // Check if extension is allready in pointer array
+ TInt index = LookupExtensions( aUid );
+ if ( index != KErrNotFound )
+ {
+ *aInterfacePtr = iExtensionArray[index]->GetInterface();
+ __VTPRINTEXITR( "Extensions.GetClientInterface error [%d]", KErrNone )
+ return KErrNone;
+ }
+ // Create extension
+ else
+ {
+ TRAP( error, extension = CreateExtensionsL( aUid, aHandler ) );
+ if ( extension && error == KErrNone )
+ {
+ *aInterfacePtr = extension->GetInterface();
+ error = KErrNone;
+ }
+ __VTPRINTEXITR( "Extensions.GetClientInterface error [%d]", error )
+ return error;
+ }
+ }
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::LookupExtensions
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngExtensions::LookupExtensions( const TUid& aUid) const
+ {
+ __VTPRINTENTER( "Extensions.LookupExtensions" )
+ TInt index( iExtensionArray.Count() );
+
+ // Loop whole extension array
+ while( index-- )
+ {
+ // If matches in one of arrays UIDs
+ if( aUid == iExtensionArray[index]->Uid() )
+ {
+ __VTPRINTEXITR( "Extensions.LookupExtensions index [%d]", index)
+ return index;
+ }
+ }
+ __VTPRINTEXITR("Extensions.LookupExtensions Not Found index [%d]",
+ KErrNotFound)
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::OfferOperationL
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngExtensions::OfferOperationL( CVtEngOperation* aOp )
+ {
+ __VTPRINTENTER( "Extensions.OfferOperationL" )
+
+ TInt index( iExtensionArray.Count() );
+
+ // Format cmdComleted as false
+ TBool cmdCompleted = EFalse;
+ // Offer operation to all extension in array
+ while( index-- )
+ {
+ // If valid extension found
+ if ( iExtensionArray[index]->HandleL( aOp ) )
+ {
+ cmdCompleted = ETrue;
+ break;
+ }
+ }
+ __VTPRINTEXITR( "Extensions.OfferOperationL cmdCompleted [%d]",
+ cmdCompleted)
+ return cmdCompleted;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::ValidateCommand
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngExtensions::ValidateCommand( const TVtEngCommandId aCommandId )
+ {
+ __VTPRINTENTER( "Extensions.ValidateCommand" )
+ TInt index( iExtensionArray.Count() );
+
+ // Format oKToPerform as false
+ TBool oKToPerform = EFalse;
+ // Try validate command in all extensions in array
+ while( index-- )
+ {
+ // If valid extension found
+ if ( iExtensionArray[index]->ValidateCommand( aCommandId ) )
+ {
+ oKToPerform = ETrue;
+ break;
+ }
+ }
+ __VTPRINTEXITR( "Extensions.ValidateCommand oKToPerform [%d]",
+ oKToPerform)
+ return oKToPerform;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/cvtengr2ftoneplayer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2003, 2004, 2006 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: Plays snap, self-timer and video start/stop sounds.
+*
+*/
+
+
+// INCLUDES
+#include <videotelui.rsg>
+
+#include <avkon.rsg>
+
+#include <AudioPreference.h>
+#include <StringLoader.h>
+
+#include <CVtLogger.h>
+
+#include "cvtengr2ftoneplayer.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------
+// CVtEngR2FTonePlayer::CVtEngR2FTonePlayer
+// C++ constructor
+// ----------------------------------------------------------
+//
+CVtEngR2FTonePlayer::CVtEngR2FTonePlayer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::NewL
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CVtEngR2FTonePlayer* CVtEngR2FTonePlayer::NewL()
+ {
+ CVtEngR2FTonePlayer* self = new ( ELeave ) CVtEngR2FTonePlayer();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// ----------------------------------------------------------
+// CVtEngR2FTonePlayer::ConstructL
+// Symbian OS 2nd phase constructor
+// ----------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::ConstructL()
+ {
+ __VTPRINTENTER( "CVtEngR2FTonePlayer.ConstructL" )
+ iAudioPlayer = CMdaAudioPlayerUtility::NewL( *this,
+ KAudioPriorityVideoRecording,
+ TMdaPriorityPreference( KAudioPrefCamera ) );
+
+ iVideoStartSound = StringLoader::LoadL( R_VIDEOTELUI_VIDEO_RECORD_START_SOUND_PATH );
+ iVideoStopSound = StringLoader::LoadL( R_VIDEOTELUI_VIDEO_RECORD_STOP_SOUND_PATH );
+ iSoundInProgress = EFalse;
+ iOpenFileInProgress = EFalse;
+ __VTPRINTEXIT( "CVtEngR2FTonePlayer.ConstructL" )
+ }
+
+
+// Destructor.
+CVtEngR2FTonePlayer::~CVtEngR2FTonePlayer()
+ {
+ if ( iAudioPlayer )
+ {
+ iAudioPlayer->Close();
+ delete iAudioPlayer;
+ }
+
+ delete iVideoStartSound;
+ delete iVideoStopSound;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::PlaySound
+// Play a sound with given id.
+// ---------------------------------------------------------------------------
+//
+TInt CVtEngR2FTonePlayer::PlaySound( TInt aSound )
+ {
+ __VTPRINTENTER( "CVtEngR2FTonePlayer.PlaySound" )
+ TInt err = KErrNone;
+ iAudioPlayer->Stop();
+ iAudioPlayer->Close();
+
+ switch ( aSound )
+ {
+ case EVtR2FVideoStartSoundId:
+ case EVtR2FVideoStopSoundId:
+ {
+ __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.PlaySound() user sound" )
+
+ // Set correct sound file
+ TPtrC soundFile = *iVideoStartSound;
+ if ( aSound == EVtR2FVideoStopSoundId )
+ {
+ soundFile.Set( *iVideoStopSound );
+ }
+
+ // Video recording start sound using MMF
+ if ( !iOpenFileInProgress && !iSoundInProgress )
+ {
+ TRAP( err, iAudioPlayer->OpenFileL( soundFile ) );
+ if ( !err )
+ {
+ __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.PlaySound() open now in progress" )
+ iOpenFileInProgress = ETrue;
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "CVtEngR2FTonePlayer.PlaySound() err, in use" )
+ // The last OpenFileL call still hasnt completed.
+ // Cannot start playing a new file.
+ err = KErrInUse;
+ }
+ break;
+ }
+
+ default:
+ {
+ // Other sounds are not supported
+ err = KErrArgument;
+ break;
+ }
+ }
+ __VTPRINTEXIT( "CVtEngR2FTonePlayer.PlaySound" )
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::Stop
+// Stop any ongoing sound.
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::StopSound()
+ {
+ __VTPRINTENTER( "CVtEngR2FTonePlayer.StopSound" )
+
+ iAudioPlayer->Stop();
+ iAudioPlayer->Close();
+
+ __VTPRINTEXIT( "CVtEngR2FTonePlayer.StopSound" )
+ }
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::MapcInitComplete
+// CMdaAudioPlayerUtility initialization complete
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::MapcInitComplete(
+ TInt aError, const TTimeIntervalMicroSeconds& aDuration )
+ {
+ __VTPRINTENTER( "CVtEngR2FTonePlayer.MapcInitComplete" )
+ __VTPRINT3( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcInitComplete(%d, %d) ",
+ aError, I64INT( aDuration.Int64()) )
+
+ (void) aDuration;
+
+ iOpenFileInProgress = EFalse;
+
+ // If tone can be played
+ if ( !aError )
+ {
+ __VTPRINT( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcInitComplete() play" )
+ iSoundInProgress = ETrue;
+ iAudioPlayer->Play();
+ }
+ // error occured during tone player init
+ else
+ {
+ __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.MapcInitComplete() error" )
+ }
+ __VTPRINTEXIT( "CVtEngR2FTonePlayer.MapcInitComplete" )
+ }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::MapcPlayComplete
+// Playback complete, notify observer
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::MapcPlayComplete( TInt aError )
+ {
+ __VTPRINTENTER( "CVtEngR2FTonePlayer.MapcPlayComplete" )
+ __VTPRINT2( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcPlayComplete(%d)", aError)
+
+ (void) aError;
+
+ iSoundInProgress = EFalse;
+ __VTPRINTEXIT( "CVtEngR2FTonePlayer.MapcPlayComplete" )
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/cvtengrecord2file.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 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: Videoteleng Record to file extension
+*
+*/
+
+
+// INCLUDE FILES
+#include "cvtengrecord2file.h"
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "cvtengr2ftoneplayer.h"
+
+#include <CVtLogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::CVtEngRecord2File
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File::CVtEngRecord2File():
+ CVtEngExtensionBase(
+ KVtEngExtensionRecord2File )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CVtEngRecord2File::ConstructL()
+ {
+ __VTPRINTENTER( "CVtEngRecord2File.ConstructL" )
+
+ iTonePlayer = CVtEngR2FTonePlayer::NewL();
+ __VTPRINTEXIT( "CVtEngRecord2File.ConstructL" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File* CVtEngRecord2File::NewL()
+ {
+ CVtEngRecord2File* self = new( ELeave ) CVtEngRecord2File;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::~CVtEngRecord2File
+// Destructor. Cannot leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File::~CVtEngRecord2File()
+ {
+
+ __VTPRINTENTER( "CVtEngRecord2File.~" )
+ if ( iTonePlayer )
+ {
+ iTonePlayer->StopSound();
+ delete iTonePlayer;
+ }
+ __VTPRINTEXIT( "CVtEngRecord2File.~" )
+ }
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::GetInterface
+//
+// ----------------------------------------------------------------------------
+//
+TAny* CVtEngRecord2File::GetInterface()
+ {
+ __VTPRINTENTER( "CVtEngRecord2File.GetInterface")
+ // Cast first as API MVtEngRecord2File* class
+ // and after that to TAny*
+ __VTPRINTEXIT( "CVtEngRecord2File.GetInterface" )
+ return reinterpret_cast< TAny* >( ( MVtEngRecord2File* ) this );
+
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::HandleL
+//
+// ----------------------------------------------------------------------------
+//
+TBool CVtEngRecord2File::HandleL( CVtEngOperation* aOp )
+ {
+ __VTPRINTENTER( "CVtEngRecord2File.HandleL" )
+ const TVtEngCommandId id( aOp->Command() );
+ __VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.HandleL CMD ID[%d] ", id )
+
+ // Check which command and call
+ // active provider with operation params
+ switch ( id )
+ {
+ case KVtEngStartRecord:
+ {
+
+ iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStartSoundId );
+ break;
+ }
+ case KVtEngStopRecord:
+ {
+
+ iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStopSoundId );
+ break;
+ }
+ //Not supported command
+ default:
+ __VTPRINTEXITR(
+ "CVtEngRecord2File.HandleL NOT SUPPORTED CMD[%d]", id )
+ return EFalse;
+ }
+ __VTPRINTEXIT( "CVtEngRecord2File.HandleL" )
+ return ETrue;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::ValidateCommand
+//
+// ----------------------------------------------------------------------------
+
+TBool CVtEngRecord2File::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINTENTER( "CVtEngRecord2File.ValidateCommand" )
+
+ // local or hw support
+ // set as False
+ TBool support = EFalse;
+
+ // Check which command and check if
+ // if provider and local variation supports
+ __VTPRINT2( DEBUG_GEN,
+ "CVtEngRecord2File.ValidateCommand CMD ID[%d] ", aCommandId )
+ switch ( aCommandId )
+ {
+ case KVtEngStartRecord:
+ {
+ support = ETrue;
+ break;
+ }
+
+ case KVtEngStopRecord:
+ {
+ support = ETrue;
+ break;
+ }
+ // Not supported command
+ default:
+ {
+ __VTPRINT2( DEBUG_GEN,
+ "CVtEngRecord2File.ValidateCommand NOT SUPPORTED CMD[%d]",
+ aCommandId)
+ support = EFalse;
+ }
+ }
+ __VTPRINTEXITR( "CVtEngRecord2File.ValidateCommand return value[%d]",
+ support)
+ return support;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::IsTonePlaySupported
+// FOR TESTING PURPOSES REMOVE!
+// ----------------------------------------------------------------------------
+
+TInt CVtEngRecord2File::IsTonePlaySupported( TBool& aSupported) const
+ {
+ if (iTonePlayer)
+ {
+ aSupported = ETrue;
+ }
+ else
+ {
+ aSupported = EFalse;
+ }
+ __VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.IsTonePlaySupported bool[%d] ", (TInt)aSupported )
+ return KErrNone;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawDP.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,2026 @@
+/*
+* Copyright (c) 2004-2006 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: Remote video handler.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CVtEngDrawDP.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "MVtEngFrameObserver.h"
+#include <videotelephonyvariant.hrh>
+#include <tdisplaysinkparamsdp.h>
+#include <cvtlogger.h>
+#include <Posting_Surface_Factory.h>
+
+#include <cvtimagebitmap.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// YCbCr conversion constants
+
+// Luma
+static const TUint32 KYLut[ 256 ] =
+ {
+ 0x00000000, 0x00400801, 0x00801002, 0x00C01803,
+ 0x01002004, 0x01402805, 0x01803006, 0x01C03807,
+ 0x02004008, 0x02404809, 0x0280500A, 0x02C0580B,
+ 0x0300600C, 0x0340680D, 0x0380700E, 0x03C0780F,
+ 0x04008010, 0x04408811, 0x04809012, 0x04C09813,
+ 0x0500A014, 0x0540A815, 0x0580B016, 0x05C0B817,
+ 0x0600C018, 0x0640C819, 0x0680D01A, 0x06C0D81B,
+ 0x0700E01C, 0x0740E81D, 0x0780F01E, 0x07C0F81F,
+ 0x08010020, 0x08410821, 0x08811022, 0x08C11823,
+ 0x09012024, 0x09412825, 0x09813026, 0x09C13827,
+ 0x0A014028, 0x0A414829, 0x0A81502A, 0x0AC1582B,
+ 0x0B01602C, 0x0B41682D, 0x0B81702E, 0x0BC1782F,
+ 0x0C018030, 0x0C418831, 0x0C819032, 0x0CC19833,
+ 0x0D01A034, 0x0D41A835, 0x0D81B036, 0x0DC1B837,
+ 0x0E01C038, 0x0E41C839, 0x0E81D03A, 0x0EC1D83B,
+ 0x0F01E03C, 0x0F41E83D, 0x0F81F03E, 0x0FC1F83F,
+ 0x10020040, 0x10420841, 0x10821042, 0x10C21843,
+ 0x11022044, 0x11422845, 0x11823046, 0x11C23847,
+ 0x12024048, 0x12424849, 0x1282504A, 0x12C2584B,
+ 0x1302604C, 0x1342684D, 0x1382704E, 0x13C2784F,
+ 0x14028050, 0x14428851, 0x14829052, 0x14C29853,
+ 0x1502A054, 0x1542A855, 0x1582B056, 0x15C2B857,
+ 0x1602C058, 0x1642C859, 0x1682D05A, 0x16C2D85B,
+ 0x1702E05C, 0x1742E85D, 0x1782F05E, 0x17C2F85F,
+ 0x18030060, 0x18430861, 0x18831062, 0x18C31863,
+ 0x19032064, 0x19432865, 0x19833066, 0x19C33867,
+ 0x1A034068, 0x1A434869, 0x1A83506A, 0x1AC3586B,
+ 0x1B03606C, 0x1B43686D, 0x1B83706E, 0x1BC3786F,
+ 0x1C038070, 0x1C438871, 0x1C839072, 0x1CC39873,
+ 0x1D03A074, 0x1D43A875, 0x1D83B076, 0x1DC3B877,
+ 0x1E03C078, 0x1E43C879, 0x1E83D07A, 0x1EC3D87B,
+ 0x1F03E07C, 0x1F43E87D, 0x1F83F07E, 0x1FC3F87F,
+ 0x20040080, 0x20440881, 0x20841082, 0x20C41883,
+ 0x21042084, 0x21442885, 0x21843086, 0x21C43887,
+ 0x22044088, 0x22444889, 0x2284508A, 0x22C4588B,
+ 0x2304608C, 0x2344688D, 0x2384708E, 0x23C4788F,
+ 0x24048090, 0x24448891, 0x24849092, 0x24C49893,
+ 0x2504A094, 0x2544A895, 0x2584B096, 0x25C4B897,
+ 0x2604C098, 0x2644C899, 0x2684D09A, 0x26C4D89B,
+ 0x2704E09C, 0x2744E89D, 0x2784F09E, 0x27C4F89F,
+ 0x280500A0, 0x284508A1, 0x288510A2, 0x28C518A3,
+ 0x290520A4, 0x294528A5, 0x298530A6, 0x29C538A7,
+ 0x2A0540A8, 0x2A4548A9, 0x2A8550AA, 0x2AC558AB,
+ 0x2B0560AC, 0x2B4568AD, 0x2B8570AE, 0x2BC578AF,
+ 0x2C0580B0, 0x2C4588B1, 0x2C8590B2, 0x2CC598B3,
+ 0x2D05A0B4, 0x2D45A8B5, 0x2D85B0B6, 0x2DC5B8B7,
+ 0x2E05C0B8, 0x2E45C8B9, 0x2E85D0BA, 0x2EC5D8BB,
+ 0x2F05E0BC, 0x2F45E8BD, 0x2F85F0BE, 0x2FC5F8BF,
+ 0x300600C0, 0x304608C1, 0x308610C2, 0x30C618C3,
+ 0x310620C4, 0x314628C5, 0x318630C6, 0x31C638C7,
+ 0x320640C8, 0x324648C9, 0x328650CA, 0x32C658CB,
+ 0x330660CC, 0x334668CD, 0x338670CE, 0x33C678CF,
+ 0x340680D0, 0x344688D1, 0x348690D2, 0x34C698D3,
+ 0x3506A0D4, 0x3546A8D5, 0x3586B0D6, 0x35C6B8D7,
+ 0x3606C0D8, 0x3646C8D9, 0x3686D0DA, 0x36C6D8DB,
+ 0x3706E0DC, 0x3746E8DD, 0x3786F0DE, 0x37C6F8DF,
+ 0x380700E0, 0x384708E1, 0x388710E2, 0x38C718E3,
+ 0x390720E4, 0x394728E5, 0x398730E6, 0x39C738E7,
+ 0x3A0740E8, 0x3A4748E9, 0x3A8750EA, 0x3AC758EB,
+ 0x3B0760EC, 0x3B4768ED, 0x3B8770EE, 0x3BC778EF,
+ 0x3C0780F0, 0x3C4788F1, 0x3C8790F2, 0x3CC798F3,
+ 0x3D07A0F4, 0x3D47A8F5, 0x3D87B0F6, 0x3DC7B8F7,
+ 0x3E07C0F8, 0x3E47C8F9, 0x3E87D0FA, 0x3EC7D8FB,
+ 0x3F07E0FC, 0x3F47E8FD, 0x3F87F0FE, 0x3FC7F8FF
+ };
+
+// Chroma1 (Cb)
+static const TUint32 KCbLut[ 256 ] =
+ {
+ 0x0001531C, 0x00014B1E, 0x00014B20, 0x00014B22,
+ 0x00014324, 0x00014325, 0x00014327, 0x00013B29,
+ 0x00013B2B, 0x00013B2D, 0x0001332E, 0x00013330,
+ 0x00013332, 0x00012B34, 0x00012B35, 0x00012B37,
+ 0x00012339, 0x0001233B, 0x0001233D, 0x00011B3E,
+ 0x00011B40, 0x00011B42, 0x00011344, 0x00011345,
+ 0x00011347, 0x00010B49, 0x00010B4B, 0x00010B4D,
+ 0x0001034E, 0x00010350, 0x00010352, 0x0000FB54,
+ 0x0000FB55, 0x0000FB57, 0x0000F359, 0x0000F35B,
+ 0x0000F35D, 0x0000EB5E, 0x0000EB60, 0x0000EB62,
+ 0x0000E364, 0x0000E366, 0x0000E367, 0x0000DB69,
+ 0x0000DB6B, 0x0000DB6D, 0x0000D36E, 0x0000D370,
+ 0x0000D372, 0x0000CB74, 0x0000CB76, 0x0000CB77,
+ 0x0000C379, 0x0000C37B, 0x0000C37D, 0x0000BB7E,
+ 0x0000BB80, 0x0000BB82, 0x0000B384, 0x0000B386,
+ 0x0000B387, 0x0000AB89, 0x0000AB8B, 0x0000AB8D,
+ 0x0000AB8E, 0x0000A390, 0x0000A392, 0x0000A394,
+ 0x00009B96, 0x00009B97, 0x00009B99, 0x0000939B,
+ 0x0000939D, 0x0000939F, 0x00008BA0, 0x00008BA2,
+ 0x00008BA4, 0x000083A6, 0x000083A7, 0x000083A9,
+ 0x00007BAB, 0x00007BAD, 0x00007BAF, 0x000073B0,
+ 0x000073B2, 0x000073B4, 0x00006BB6, 0x00006BB7,
+ 0x00006BB9, 0x000063BB, 0x000063BD, 0x000063BF,
+ 0x00005BC0, 0x00005BC2, 0x00005BC4, 0x000053C6,
+ 0x000053C7, 0x000053C9, 0x00004BCB, 0x00004BCD,
+ 0x00004BCF, 0x000043D0, 0x000043D2, 0x000043D4,
+ 0x00003BD6, 0x00003BD8, 0x00003BD9, 0x000033DB,
+ 0x000033DD, 0x000033DF, 0x00002BE0, 0x00002BE2,
+ 0x00002BE4, 0x000023E6, 0x000023E8, 0x000023E9,
+ 0x00001BEB, 0x00001BED, 0x00001BEF, 0x000013F0,
+ 0x000013F2, 0x000013F4, 0x00000BF6, 0x00000BF8,
+ 0x00000BF9, 0x000003FB, 0x000003FD, 0x000003FF,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000005,
+ 0x001FF807, 0x001FF808, 0x001FF80A, 0x001FF00C,
+ 0x001FF00E, 0x001FF010, 0x001FE811, 0x001FE813,
+ 0x001FE815, 0x001FE017, 0x001FE018, 0x001FE01A,
+ 0x001FD81C, 0x001FD81E, 0x001FD820, 0x001FD021,
+ 0x001FD023, 0x001FD025, 0x001FC827, 0x001FC828,
+ 0x001FC82A, 0x001FC02C, 0x001FC02E, 0x001FC030,
+ 0x001FB831, 0x001FB833, 0x001FB835, 0x001FB037,
+ 0x001FB039, 0x001FB03A, 0x001FA83C, 0x001FA83E,
+ 0x001FA840, 0x001FA041, 0x001FA043, 0x001FA045,
+ 0x001F9847, 0x001F9849, 0x001F984A, 0x001F904C,
+ 0x001F904E, 0x001F9050, 0x001F8851, 0x001F8853,
+ 0x001F8855, 0x001F8057, 0x001F8059, 0x001F805A,
+ 0x001F785C, 0x001F785E, 0x001F7860, 0x001F7061,
+ 0x001F7063, 0x001F7065, 0x001F6867, 0x001F6869,
+ 0x001F686A, 0x001F606C, 0x001F606E, 0x001F6070,
+ 0x001F5872, 0x001F5873, 0x001F5875, 0x001F5877,
+ 0x001F5079, 0x001F507A, 0x001F507C, 0x001F487E,
+ 0x001F4880, 0x001F4882, 0x001F4083, 0x001F4085,
+ 0x001F4087, 0x001F3889, 0x001F388A, 0x001F388C,
+ 0x001F308E, 0x001F3090, 0x001F3092, 0x001F2893,
+ 0x001F2895, 0x001F2897, 0x001F2099, 0x001F209A,
+ 0x001F209C, 0x001F189E, 0x001F18A0, 0x001F18A2,
+ 0x001F10A3, 0x001F10A5, 0x001F10A7, 0x001F08A9,
+ 0x001F08AB, 0x001F08AC, 0x001F00AE, 0x001F00B0,
+ 0x001F00B2, 0x001EF8B3, 0x001EF8B5, 0x001EF8B7,
+ 0x001EF0B9, 0x001EF0BB, 0x001EF0BC, 0x001EE8BE,
+ 0x001EE8C0, 0x001EE8C2, 0x001EE0C3, 0x001EE0C5,
+ 0x001EE0C7, 0x001ED8C9, 0x001ED8CB, 0x001ED8CC,
+ 0x001ED0CE, 0x001ED0D0, 0x001ED0D2, 0x001EC8D3,
+ 0x001EC8D5, 0x001EC8D7, 0x001EC0D9, 0x001EC0DB,
+ 0x001EC0DC, 0x001EB8DE, 0x001EB8E0, 0x001EB8E2
+ };
+
+// Chroma1 (Cr)
+static const TUint32 KCrLut[ 256 ] =
+ {
+ 0xD302D000, 0xD382C800, 0xD3C2C000, 0xD442B800,
+ 0xD482B800, 0xD502B000, 0xD542A800, 0xD582A800,
+ 0xD602A000, 0xD6429800, 0xD6C29000, 0xD7029000,
+ 0xD7428800, 0xD7C28000, 0xD8028000, 0xD8827800,
+ 0xD8C27000, 0xD9027000, 0xD9826800, 0xD9C26000,
+ 0xDA425800, 0xDA825800, 0xDAC25000, 0xDB424800,
+ 0xDB824800, 0xDC024000, 0xDC423800, 0xDC823800,
+ 0xDD023000, 0xDD422800, 0xDDC22000, 0xDE022000,
+ 0xDE421800, 0xDEC21000, 0xDF021000, 0xDF820800,
+ 0xDFC20000, 0xE041F800, 0xE081F800, 0xE0C1F000,
+ 0xE141E800, 0xE181E800, 0xE201E000, 0xE241D800,
+ 0xE281D800, 0xE301D000, 0xE341C800, 0xE3C1C000,
+ 0xE401C000, 0xE441B800, 0xE4C1B000, 0xE501B000,
+ 0xE581A800, 0xE5C1A000, 0xE601A000, 0xE6819800,
+ 0xE6C19000, 0xE7418800, 0xE7818800, 0xE7C18000,
+ 0xE8417800, 0xE8817800, 0xE9017000, 0xE9416800,
+ 0xE9816800, 0xEA016000, 0xEA415800, 0xEAC15000,
+ 0xEB015000, 0xEB814800, 0xEBC14000, 0xEC014000,
+ 0xEC813800, 0xECC13000, 0xED412800, 0xED812800,
+ 0xEDC12000, 0xEE411800, 0xEE811800, 0xEF011000,
+ 0xEF410800, 0xEF810800, 0xF0010000, 0xF040F800,
+ 0xF0C0F000, 0xF100F000, 0xF140E800, 0xF1C0E000,
+ 0xF200E000, 0xF280D800, 0xF2C0D000, 0xF300D000,
+ 0xF380C800, 0xF3C0C000, 0xF440B800, 0xF480B800,
+ 0xF4C0B000, 0xF540A800, 0xF580A800, 0xF600A000,
+ 0xF6409800, 0xF6C09000, 0xF7009000, 0xF7408800,
+ 0xF7C08000, 0xF8008000, 0xF8807800, 0xF8C07000,
+ 0xF9007000, 0xF9806800, 0xF9C06000, 0xFA405800,
+ 0xFA805800, 0xFAC05000, 0xFB404800, 0xFB804800,
+ 0xFC004000, 0xFC403800, 0xFC803800, 0xFD003000,
+ 0xFD402800, 0xFDC02000, 0xFE002000, 0xFE401800,
+ 0xFEC01000, 0xFF001000, 0xFF800800, 0xFFC00000,
+ 0x00000000, 0x00400000, 0x009FF800, 0x011FF000,
+ 0x015FF000, 0x01DFE800, 0x021FE000, 0x025FE000,
+ 0x02DFD800, 0x031FD000, 0x039FC800, 0x03DFC800,
+ 0x041FC000, 0x049FB800, 0x04DFB800, 0x055FB000,
+ 0x059FA800, 0x05DFA800, 0x065FA000, 0x069F9800,
+ 0x071F9000, 0x075F9000, 0x079F8800, 0x081F8000,
+ 0x085F8000, 0x08DF7800, 0x091F7000, 0x095F7000,
+ 0x09DF6800, 0x0A1F6000, 0x0A9F5800, 0x0ADF5800,
+ 0x0B5F5000, 0x0B9F4800, 0x0BDF4800, 0x0C5F4000,
+ 0x0C9F3800, 0x0D1F3000, 0x0D5F3000, 0x0D9F2800,
+ 0x0E1F2000, 0x0E5F2000, 0x0EDF1800, 0x0F1F1000,
+ 0x0F5F1000, 0x0FDF0800, 0x101F0000, 0x109EF800,
+ 0x10DEF800, 0x111EF000, 0x119EE800, 0x11DEE800,
+ 0x125EE000, 0x129ED800, 0x12DED800, 0x135ED000,
+ 0x139EC800, 0x141EC000, 0x145EC000, 0x149EB800,
+ 0x151EB000, 0x155EB000, 0x15DEA800, 0x161EA000,
+ 0x169E9800, 0x16DE9800, 0x171E9000, 0x179E8800,
+ 0x17DE8800, 0x185E8000, 0x189E7800, 0x18DE7800,
+ 0x195E7000, 0x199E6800, 0x1A1E6000, 0x1A5E6000,
+ 0x1A9E5800, 0x1B1E5000, 0x1B5E5000, 0x1BDE4800,
+ 0x1C1E4000, 0x1C5E4000, 0x1CDE3800, 0x1D1E3000,
+ 0x1D9E2800, 0x1DDE2800, 0x1E1E2000, 0x1E9E1800,
+ 0x1EDE1800, 0x1F5E1000, 0x1F9E0800, 0x1FDE0800,
+ 0x205E0000, 0x209DF800, 0x211DF000, 0x215DF000,
+ 0x21DDE800, 0x221DE000, 0x225DE000, 0x22DDD800,
+ 0x231DD000, 0x239DC800, 0x23DDC800, 0x241DC000,
+ 0x249DB800, 0x24DDB800, 0x255DB000, 0x259DA800,
+ 0x25DDA800, 0x265DA000, 0x269D9800, 0x271D9000,
+ 0x275D9000, 0x279D8800, 0x281D8000, 0x285D8000,
+ 0x28DD7800, 0x291D7000, 0x295D7000, 0x29DD6800,
+ 0x2A1D6000, 0x2A9D5800, 0x2ADD5800, 0x2B1D5000,
+ 0x2B9D4800, 0x2BDD4800, 0x2C5D4000, 0x2C9D3800
+ };
+
+
+// Posting surface factory DLL's name
+_LIT( KDPAPIDLLName, "PostingSurfaceFactory.dll" );
+
+// Reversed enumeration for the bitmaps.
+static const MDisplaySink::TBitmapNo KVtEngBitmapNoReversed[] =
+ {
+ MDisplaySink::ESecondBitmap,
+ MDisplaySink::EFirstBitmap
+ };
+
+// Default posting format (if this or KDefaultPostingFormat420 is not
+// supported, BaseConstructL() will leave with KErrNotSupported)
+const CPostingSurface::TPostingFormat KDefaultPostingFormat422 =
+ CPostingSurface::EYuv422LeBt601Range0;
+
+// Default posting format (if this or KDefaultPostingFormat422 is not
+// supported, BaseConstructL() will leave with KErrNotSupported)
+const CPostingSurface::TPostingFormat KDefaultPostingFormat420 =
+ CPostingSurface::EYuv420PlanarBt601Range0;
+
+// Default posting buffering flags.
+const TUint KDefaultPostingBufferingFlags =
+ // Double buffering
+ CPostingSurface::EDoubleBuffering |
+ // Progressive frames (no interlacing)
+ CPostingSurface::EProgressiveFrames |
+ // Do not allow frameskip
+ CPostingSurface::EDisAllowFrameSkip |
+ // Use internal buffers (allocated by DP)
+ CPostingSurface::EInternalBuffers;
+
+// Default pixel aspect ratio num. Aspect ratio = Num/Denom.
+const TUint16 KDefaultPixelAspectRatioNum = 1;
+
+// Default pixel aspect ratio denom. Aspect ratio = Num/Denom.
+const TUint16 KDefaultPixelAspectRatioDenom = 1;
+
+// LOCAL METHODS
+
+// -----------------------------------------------------------------------------
+// DoConvertYuv420toXRGB0888
+// -----------------------------------------------------------------------------
+//
+inline void DoConvertYuv420toXRGB0888(
+ TInt aWidth, // width in pixels
+ const TUint8*& aSourceDataPtrY1, // pointer to Y data row 1
+ const TUint8*& aSourceDataPtrY2, // pointer to Y data row 2
+ const TUint8*& aSourceDataPtrU, // pointer to U data row
+ const TUint8*& aSourceDataPtrV, // pointer to V data row
+ TUint8* aDestDataPtr1, // pointer to destination row 1
+ TUint8* aDestDataPtr2 // pointer to destination row 2
+ )
+ {
+ TUint32* destDataPtr1 = reinterpret_cast< TUint32* >( aDestDataPtr1 );
+ TUint32* destDataPtr2 = reinterpret_cast< TUint32* >( aDestDataPtr2 );
+ // width assumed to be even
+ TInt pixelsLeft = aWidth / 2;
+
+ TUint32 r, g, b;
+ TUint32 LutY0, LutY1, LutC;
+ TUint32 pixel;
+ TUint32 OverflowMask = 0xC0180300U;
+
+ // One scanline at the time
+ while ( pixelsLeft-- )
+ {
+
+ // row 1, 2 pixels
+
+ LutY0 = KYLut[*aSourceDataPtrY1++];
+ LutY1 = KYLut[*aSourceDataPtrY1++];
+ LutC = KCbLut[*aSourceDataPtrU++];
+ LutC += KCrLut[*aSourceDataPtrV++];
+
+ pixel = LutY0 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr1++ = 0xFF000000 | r | g | b;
+
+ pixel = LutY1 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr1++ = 0xFF000000 | r | g | b;
+
+ // row, 2 pixels
+
+ LutY0 = KYLut[*aSourceDataPtrY2++];
+ LutY1 = KYLut[*aSourceDataPtrY2++];
+
+ pixel = LutY0 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr2++ = 0xFF000000 | r | g | b;
+
+ pixel = LutY1 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr2++ = 0xFF000000 | r | g | b;
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// DoConvertYuv422toXRGB0888
+// -----------------------------------------------------------------------------
+//
+inline void DoConvertYuv422toXRGB0888(
+ TInt aWidth, // width in pixels
+ const TUint8*& aSourceDataPtr, // pointer to source row
+ TUint8* aDestDataPtr // pointer to destination row
+ )
+ {
+ TUint32* destDataPtr = reinterpret_cast< TUint32* >( aDestDataPtr );
+ // width assumed to be even
+ TInt pixelsLeft = aWidth / 2;
+
+ TUint32 r, g, b;
+ TUint32 LutY0, LutY1, LutC;
+ TUint32 pixel;
+ TUint32 OverflowMask = 0xC0180300U;
+
+ // One scanline at the time
+ while ( pixelsLeft-- )
+ {
+
+ LutC = KCbLut[*aSourceDataPtr++];
+ LutY0 = KYLut[*aSourceDataPtr++];
+ LutC += KCrLut[*aSourceDataPtr++];
+ LutY1 = KYLut[*aSourceDataPtr++];
+
+ pixel = LutY0 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr++ = 0xFF000000 | r | g | b;
+
+ pixel = LutY1 + LutC;
+
+ if (pixel & OverflowMask)
+ {
+ if (pixel & 0xC0000000U)
+ {
+ if (pixel & 0x80000000U)
+ {
+ pixel &= ~0x3FC00000U;
+ }
+ else
+ {
+ pixel |= 0x3FC00000U;
+ }
+ }
+ if (pixel & 0x00180000U)
+ {
+ if (pixel & 0x00100000U)
+ {
+ pixel &= ~0x0007F800U;
+ }
+ else
+ {
+ pixel |= 0x0007F800U;
+ }
+ }
+ if (pixel & 0x00000300U)
+ {
+ if (pixel & 0x00000200U)
+ {
+ pixel &= ~0x000000FFU;
+ }
+ else
+ {
+ pixel |= 0x000000FFU;
+ }
+ }
+ }
+
+ r = (pixel >> 6) & 0xFF0000;
+ g = (pixel >> 3) & 0x00FF00;
+ b = pixel & 0x0000FF;
+
+ *destDataPtr++ = 0xFF000000 | r | g | b;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP* CVtEngDrawDP::NewL(
+ MDisplaySinkObserver* aObserver )
+ {
+ __VTPRINTENTER( "RVD(DP).NewL" )
+ CVtEngDrawDP* self = new ( ELeave ) CVtEngDrawDP( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "RVD(DP).NewL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::~CVtEngDrawDP
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::~CVtEngDrawDP()
+ {
+ __VTPRINTENTER( "RVD(DP).~" )
+ Cancel();
+ delete iFrameBuffer;
+ delete iBufferWaiter;
+ delete iPostingSurface;
+ __VTPRINT( DEBUG_MEDIA , "RVD(DP).~ RRegion::Close()" )
+ iClipRegion.Close();
+ CloseDPLibrary();
+
+ delete iTarget;
+ delete iSource;
+ delete iImageScaler;
+ __VTPRINTEXIT( "RVD(DP).~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngDraw
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngDrawDP( MDisplaySinkObserver* aObserver ) :
+ CVtEngDraw( aObserver ), iClipRegion( 1 ),
+ iPostingFormat( KDefaultPostingFormat422 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseConstructL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseConstructL" )
+ if ( IsFlag( EFlagUIForeground ) )
+ {
+ DoBaseConstructL();
+ }
+ else
+ {
+ SetFlag( EBaseConstructCalled );
+ }
+ __VTPRINTEXIT( "RVD(DP).BaseConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawDP::CreateSinkL()
+ {
+ __VTPRINTENTER( "RVD(DP).CreateSinkL" )
+ TDisplaySinkParamsDP params;
+ GetSinkParams( params );
+ MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ sink->Pause();
+ SetFlag( ESinkParamUpdateRequired | ESinkResumeRequired );
+ }
+ __VTPRINTEXIT( "RVD(DP).CreateSinkL" )
+ return sink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::BaseRefreshL
+// Draw a frame.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRefreshL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseRefreshL" )
+ __VTPRINTEXIT( "RVD(DP).BaseRefreshL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRefreshBitmapsL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseRefreshBitmapsL" )
+ BaseConstructL();
+ InitializePostingSurfaceL();
+ // set the params for DS
+ UpdateSinkParamsL();
+ ClearFlag( EFirstFrameReceived );
+ __VTPRINTEXIT( "RVD(DP).BaseRefreshBitmapsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseDoCancel()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseDoCancel" )
+ __VTPRINTEXIT( "RVD(DP).BaseDoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseVerifyConfigL
+// Checks current configuration against DP implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseVerifyConfigL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseVerifyConfigL" )
+ // Check support for requested size
+ if ( !SupportsSize( iSourceSize ) )
+ {
+ __VTPRINT( DEBUG_MEDIA ,
+ "RVD(DP).BaseVerifyConfigL Size NOT supported" )
+ User::Leave( KErrNotSupported );
+ }
+ RecalculateClipRegionL();
+ __VTPRINTEXIT( "RVD(DP).BaseVerifyConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRestartL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseRestartL" )
+ if ( IsFlag( EFlagUIForeground ) )
+ {
+ RecalculateClipRegionL();
+ iBufferWaiter->FetchBuffer();
+ }
+ __VTPRINTEXIT( "RVD(DP).BaseRestartL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseAbortNow()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseAbortNow" )
+ UpdateVtFrame();
+ __VTPRINTEXIT( "RVD(DP).BaseAbortNow" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::StartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseStartDrawL()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseStartDrawL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EBaseBaseStartDrawCalled );
+ }
+ else
+ {
+ DoBaseStartDrawL();
+ }
+ __VTPRINTEXIT( "RVD(DP).BaseStartDrawL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseStopDraw()
+ {
+ // Cancel the timer in any case.
+ __VTPRINTENTER( "RVD(DP).BaseStopDraw" )
+ ClearFlag( EBaseBaseStartDrawCalled );
+ iWatcher->Cancel();
+ if ( iDSA )
+ {
+ ClearFlag( ERemoteVideoDrawing | EStarted );
+ iDSA->Cancel();
+ }
+ iBufferWaiter->Cancel();
+ Cancel();
+ __VTPRINTEXIT( "RVD(DP).BaseStopDraw" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+ {
+ __VTPRINTENTER( "RVD(DP).BaseSetConfigL" )
+ Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigDP ) );
+ iConfig = aConfig;
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EBaseSetConfigCalled );
+ }
+ else
+ {
+ ConfigUpdatedL();
+ }
+ __VTPRINTEXIT( "RVD(DP).BaseSetConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseSetUIForegroundL( TBool aForeground )
+ {
+ __VTPRINTENTER( "RVD(DP).BaseSetUIForegroundL" )
+ if( aForeground )
+ {
+ TBool wasSentToBackground( IsFlag( ESentToBackground ) );
+ SetFlag( EFlagUIForeground );
+ ClearFlag( ESentToBackground );
+ if( IsFlag( EDelayedCallsMask ) )
+ {
+ HandleDelayedCallsL();
+ }
+ if ( wasSentToBackground )
+ {
+ BaseRefreshBitmapsL();
+ Restart( RDirectScreenAccess::ETerminateCancel );
+ BaseStartDrawL();
+ }
+ }
+ else
+ {
+ if ( !IsFlag( EBaseConstructCalled ) )
+ {
+ BaseStopDraw();
+ delete iPostingSurface;
+ iPostingSurface = 0;
+ for ( TInt i = MDisplaySink::EFirstBitmap;
+ i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+ {
+ iBuffers[ i ].UnSet();
+ }
+ SetFlag( ESentToBackground );
+ }
+ ClearFlag( EFlagUIForeground );
+ }
+ __VTPRINTEXIT( "RVD(DP).BaseSetUIForegroundL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRequestLastFrame()
+ {
+ __VTPRINTENTER( "RVD(DP).BaseRequestLastFrame" )
+ UpdateVtFrame();
+ __VTPRINTEXIT( "RVD(DP).BaseRequestLastFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseVideoFrameSizeChangedL( const TSize& aTo )
+ {
+ __VTPRINTENTER( "RVD(DP).BaseVideoFrameSizeChangedL" )
+ CreateFrameBufferL( aTo );
+ __VTPRINTEXIT( "RVD(DP).BaseVideoFrameSizeChangedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawDP::Config()
+ {
+ return iConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::RunL()
+ {
+ __VTPRINTENTER( "RVD(DP).RunL" )
+
+ TInt bitmapNo( iStatus.Int() );
+
+ if ( bitmapNo < KErrNone )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL notify rvd problem" )
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ return;
+ }
+
+ TVtEngBuffer& buffer = iBuffers[ bitmapNo ];
+
+ if ( !iDSUpdated )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL !Updated" )
+ __VTPRINTEXIT( "RVD(DP).RunL" )
+ return;
+ }
+ else if ( !IsFlag( EFlagUIForeground ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL !Flag( EFlagUIForeground )" )
+ __VTPRINTEXIT( "RVD(DP).RunL" )
+ if ( iPostingSurface )
+ {
+ iPostingSurface->PostBuffer( buffer.Buffer() );
+ buffer.UnSet();
+ iBufferWaiter->FetchBuffer();
+ }
+ return;
+ }
+ else if ( buffer.Buffer() == NULL )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL signalled with NULL buffer" )
+ TInt result( iBufferWaiter->FetchBuffer() );
+ __VTPRINT2( DEBUG_MEDIA,
+ "RVD(DP).RunL FetchBuffer %d", result )
+ User::LeaveIfError( result );
+ __VTPRINTEXIT( "RVD(DP).RunL" )
+ return;
+ }
+
+ // Image received, reset counter.
+ iCheckpoint = KVtEngWatcherThreshold;
+
+ StoreFrameBuffer( buffer.Buffer() );
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL flags=%d", iFlags )
+ TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+ SetFlag( EFirstFrameReceived );
+ // Remote video is about to start?
+ if ( !IsFlag( EStarted ) && IsFlag( EReadyInternal ) )
+ {
+ if ( !iDSA->IsActive() )
+ {
+ iDSA->StartL();
+ }
+ SetFlag( EStarted );
+ if ( !iConfig.iClipRect.IsEmpty() )
+ {
+ SetFlag( EReadyForeground );
+ iDSA->Gc()->SetClippingRect( iConfig.iClipRect );
+ RecalculateClipRegionL();
+ }
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL notify rvd start" )
+ //CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+ }
+ if ( firstFrame )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+ }
+ TRAPD( setClipRegResult, SetClipRegionL() );
+ if ( setClipRegResult )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL SetClipRegionL failed %d",
+ setClipRegResult );
+ }
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RunL received buffer %d $%x",
+ bitmapNo,
+ reinterpret_cast< TUint >( buffer.Buffer() ) )
+ TInt result
+ ( iPostingSurface->PostBuffer( buffer.Buffer() ) );
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL PostBuffer %d", result )
+ buffer.UnSet();
+ if ( iBuffers[ KVtEngBitmapNoReversed[ bitmapNo ] ].IsSet() )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL reactivating for buffer %d",
+ KVtEngBitmapNoReversed[ bitmapNo ] )
+ Activate();
+ DisplaySink().NextFrame();
+ }
+
+ if ( result == KErrNotReady )
+ {
+ BaseRefreshBitmapsL();
+ result = KErrNone;
+ }
+
+ User::LeaveIfError( result );
+ result = iBufferWaiter->FetchBuffer();
+ __VTPRINT2( DEBUG_MEDIA,
+ "RVD(DP).RunL FetchBuffer %d", result )
+ User::LeaveIfError( result );
+
+ __VTPRINTEXIT( "RVD(DP).RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BufferReady
+// BufferReady
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BufferReady( CPostingSurface::TPostingBuff* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(DP).BufferReady" )
+ SetAvailableToSink( aBuffer );
+ __VTPRINTEXIT( "RVD(DP).BufferReady" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::FetchError
+// Buffer fetching error
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::FetchError( TInt )
+ {
+ __VTPRINTENTER( "RVD(DP).FetchError" )
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ __VTPRINTEXIT( "RVD(DP).FetchError" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::HandleDelayedCallsL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::HandleDelayedCallsL()
+ {
+ __VTPRINTENTER( "RVD(DP).HandleDelayedCallsL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ DoBaseConstructL();
+ }
+ if ( IsFlag( EBaseSetConfigCalled ) )
+ {
+ ConfigUpdatedL();
+ ClearFlag( EBaseSetConfigCalled );
+ }
+ if ( IsFlag( EInitializePostingSurfaceCalled ) )
+ {
+ DoInitializePostingSurfaceL();
+ }
+ if ( IsFlag( ESinkParamUpdateRequired ) )
+ {
+ DoUpdateSinkParamsL();
+ }
+ if ( IsFlag( EBaseBaseStartDrawCalled ) )
+ {
+ DoBaseStartDrawL();
+ }
+ __VTPRINTEXIT( "RVD(DP).HandleDelayedCallsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoBaseConstructL
+// Base construction implementation
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoBaseConstructL()
+ {
+ __VTPRINTENTER( "RVD(DP).DoBaseConstructL" )
+
+ if ( !iImageScaler )
+ {
+ iImageScaler =
+ CVtImageScaler::NewL( *this, CVtImageScaler::EBilinear );
+ }
+ delete iBufferWaiter;
+ iBufferWaiter = NULL;
+ delete iPostingSurface;
+ iPostingSurface = NULL;
+
+ // Load DP API library
+ LoadDPLibraryL();
+
+ // Create posting surface instance
+ iPostingSurface = CreatePostingSurfaceL();
+
+ CPostingSurface::TPostingFormat previousPostingFormat( iPostingFormat );
+
+ // Check support for format
+ if ( !SupportsFormat( KDefaultPostingFormat420 ) )
+ {
+ if ( !SupportsFormat( KDefaultPostingFormat422 ) )
+ {
+ __VTPRINT( DEBUG_MEDIA ,
+ "RVD(DP).BaseConstructL Format NOT supported" )
+ User::Leave( KErrNotSupported );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA , "RVD(DP).BaseConstructL using 422" )
+ iPostingFormat = KDefaultPostingFormat422;
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA , "RVD(DP).BaseConstructL using 420" )
+ iPostingFormat = KDefaultPostingFormat420;
+ }
+ iPostingSurface->GetCapabilities( iPostingCaps );
+ iBufferWaiter =
+ new ( ELeave ) CVtEngBufferWaiter( *iPostingSurface, *this );
+ for ( TInt i = MDisplaySink::EFirstBitmap;
+ i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+ {
+ iBuffers[ i ].UnSet();
+ }
+
+ // If posting for is different from previous, then free frame buffer
+ if ( ( previousPostingFormat != iPostingFormat ) || !iFrameBuffer )
+ {
+ CreateFrameBufferL( iSourceSize );
+ }
+ ClearFlag( EBaseConstructCalled );
+ __VTPRINTEXIT( "RVD(DP).DoBaseConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::UpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::UpdateSinkParamsL()
+ {
+ __VTPRINTENTER( "RVD(DP).UpdateSinkParamsL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( ESinkParamUpdateRequired );
+ }
+ else
+ {
+ DoUpdateSinkParamsL();
+ }
+ __VTPRINTEXIT( "RVD(DP).UpdateSinkParamsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoBaseStartDrawL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoBaseStartDrawL()
+ {
+ __VTPRINTENTER( "RVD(DP).DoBaseStartDrawL" )
+ UpdateVtFrame();
+ if ( iDSA )
+ {
+ SetFlag( EReadyInternal );
+ if ( !iWatcher->IsActive() )
+ {
+ iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+ iCallback );
+ }
+ User::LeaveIfError( iBufferWaiter->FetchBuffer() );
+ SetFlag( ERemoteVideoDrawing );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+ ClearFlag( EBaseBaseStartDrawCalled );
+ __VTPRINTEXIT( "RVD(DP).DoBaseStartDrawL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoInitializePostingSurfaceL
+// Initializes posting surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoInitializePostingSurfaceL()
+ {
+ __VTPRINTENTER( "RVD(DP).DoInitializePostingSurfaceL" )
+ CPostingSurface::TPostingSourceParams postingSourceParams;
+ GetPostingSourceParams( postingSourceParams );
+ CPostingSurface::TPostingParams postingParams;
+ GetPostingParams( postingParams );
+ // Create and start DSA for getting access to DP
+ CreateAndStartDSAL();
+
+ /*S60 Display Posting API has a limitation that only one surface instance can be
+ created at a time. Unfortunately there's no way to check when posting is really
+ free. PostingSurface initialization maybe returns KErrInUse.
+ Please refer to TSW error EAKC-7R3TME.
+ The transition effect between landscape and portrait uses ATID to achieve smooth
+ transition. ATID and PostingSurface share the same buffers and cannot be used
+ simultaneously. PostingSurface initialization maybe returns KErrNotReady.
+ Please refer to TSW error EWXO-7P4DV3.
+ So it probably requires some kind of timer based retry to bypass these cases.*/
+ TInt err;
+ while (1)
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DP).DoInitializePostingSurfaceL Initialize PostingSurface" );
+ TRAP( err, iPostingSurface->InitializeL(postingSourceParams, postingParams) );
+ if ( err == KErrNone)
+ {
+ break;
+ }
+ else
+ {
+ //time interval for each PostingSurface initialization is 0.2 second.
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).DoInitializePostingSurfaceL InitPS error = %d", err )
+ User::After(200000);
+ }
+ }
+
+ delete iTarget; iTarget = NULL;
+ iTarget = CVtImageBitmap::NewL(
+ postingParams.iDisplayedRect.Size(), EColor16MU );
+ if ( iSource )
+ {
+ if ( IsFlag( EFrameBufferFilled ) &&
+ !IsFlag( EFrameBufferNeedsConvertAndScale ) )
+ {
+ iImageScaler->ScaleNowL( *iSource, *iTarget );
+ Config().iObserver->vtSetFrame(
+ MVtEngFrameObserver::ERemoteVideoFrame,
+ &iTarget->Bitmap() );
+ }
+ else
+ {
+ Config().iObserver->vtSetFrame(
+ MVtEngFrameObserver::ERemoteVideoFrame, NULL );
+ }
+ }
+ else
+ {
+ //delete iSource; iSource = NULL;
+ iSource = CVtImageBitmap::NewL( iSourceSize, EColor16MU );
+ Config().iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+ NULL );
+ }
+ RecalculateClipRegionL();
+ ClearFlag( EInitializePostingSurfaceCalled );
+ __VTPRINTEXIT( "RVD(DP).DoInitializePostingSurfaceL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoUpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoUpdateSinkParamsL()
+ {
+ __VTPRINTENTER( "RVD(DP).DoUpdateSinkParamsL" )
+ TDisplaySinkParamsDP params;
+ GetSinkParams( params );
+ DisplaySink().UpdateSinkParamsL( params, iDSUpdated );
+ ClearFlag( ESinkParamUpdateRequired );
+ if ( IsFlag( ESinkResumeRequired ) )
+ {
+ DisplaySink().Resume();
+ ClearFlag( ESinkResumeRequired );
+ }
+ __VTPRINTEXIT( "RVD(DP).DoUpdateSinkParamsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::IsAlphaTrashed
+// Checks if the alpha has been trashed on screen buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::IsAlphaTrashed() const
+ {
+ __VTPRINTENTER( "RVD(DP).IsAlphaTrashed" )
+ TBool isTrashed( EFalse );
+ const CFbsScreenDevice& sdev( *iDSA->ScreenDevice() );
+ if ( sdev.DisplayMode() == EColor16MA )
+ {
+ TRgb color;
+ TPoint point( iClipRegion.BoundingRect().Center() );
+ sdev.GetPixel( color, point );
+ isTrashed = ( color.Alpha() != 0 );
+ }
+ __VTPRINTEXITR( "RVD(DP).IsAlphaTrashed %d", isTrashed )
+ return isTrashed;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetClipRegionL
+// Sets clipping region for DP.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::SetClipRegionL()
+ {
+ __VTPRINTENTER( "RVD(DP).SetClipRegionL" )
+ if ( iClipRegionUpdated || IsAlphaTrashed() )
+ {
+ iClipRegionUpdated = EFalse;
+ CFbsBitGc* gc = iDSA->Gc();
+ gc->SetClippingRegion( iDSA->DrawingRegion() );
+ gc->SetDrawMode( CGraphicsContext::EDrawModeAND );
+ gc->SetBrushColor( TRgb( 255, 255, 255, 0 ) );
+ gc->Clear();
+ iDSA->ScreenDevice()->Update();
+ User::LeaveIfError(
+ iPostingSurface->SetClipRegion( iClipRegion ) );
+ }
+ __VTPRINTEXIT( "RVD(DP).SetClipRegionL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::InitializePostingSurfaceL
+// Initializes posting surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::InitializePostingSurfaceL()
+ {
+ __VTPRINTENTER( "RVD(DP).InitializePostingSurfaceL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EInitializePostingSurfaceCalled );
+ }
+ else
+ {
+ DoInitializePostingSurfaceL();
+ }
+ __VTPRINTEXIT( "RVD(DP).InitializePostingSurfaceL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetPostingSourceParams
+// Fills posting source params structure.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetPostingSourceParams(
+ CPostingSurface::TPostingSourceParams& aParams ) const
+ {
+ __VTPRINTENTER( "RVD(DP).GetPostingSourceParams" )
+ Mem::FillZ( &aParams, sizeof( CPostingSurface::TPostingSourceParams ) );
+ aParams.iPostingBuffering = KDefaultPostingBufferingFlags;
+ aParams.iBufferType = CPostingSurface::EStandardBuffer;
+ aParams.iPostingUsage = CPostingSurface::EVideoCapture;
+ aParams.iSourceImageSize = iSourceSize;
+ aParams.iPostingFormat = iPostingFormat;
+ aParams.iPixelAspectRatioNum = KDefaultPixelAspectRatioNum;
+ aParams.iPixelAspectRatioDenom = KDefaultPixelAspectRatioDenom;
+ aParams.iContentCopyRestricted = EFalse;
+ __VTPRINTEXIT( "RVD(DP).GetPostingSourceParams" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetPostingParams
+// Fills posting params structure.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetPostingParams(
+ CPostingSurface::TPostingParams& aParams ) const
+ {
+ __VTPRINTENTER( "RVD(DP).GetPostingParams" )
+ Mem::FillZ( &aParams, sizeof( CPostingSurface::TPostingParams ) );
+
+ aParams.iDisplayedRect = iConfig.iClipRect;
+
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams DRect.iTl (%d, %d)",
+ aParams.iDisplayedRect.iTl.iX, aParams.iDisplayedRect.iTl.iY );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams DRect.iBr (%d, %d)",
+ aParams.iDisplayedRect.iBr.iX, aParams.iDisplayedRect.iBr.iY );
+
+ TRect& dispRect( aParams.iDisplayedRect );
+ dispRect.Move( iConfig.iOffset );
+ FixRectForDP( dispRect );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams OffsDRect.iTl (%d, %d)",
+ dispRect.iTl.iX, dispRect.iTl.iY );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams OffsDRect.iBr (%d, %d)",
+ dispRect.iBr.iX, dispRect.iBr.iY );
+
+ aParams.iScaleToRect = TRect( aParams.iDisplayedRect.Size() );
+
+ aParams.iInputCrop = iSourceSize;
+
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams InputCrop.iTl (%d, %d)",
+ aParams.iInputCrop.iTl.iX, aParams.iInputCrop.iTl.iY );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams InputCrop.iBr (%d, %d)",
+ aParams.iInputCrop.iBr.iX, aParams.iInputCrop.iBr.iY );
+
+ aParams.iBackGround = iConfig.iBackGround;
+ __VTPRINTEXIT( "RVD(DP).GetPostingParams" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsFormat
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsFormat(
+ const CPostingSurface::TPostingFormat& aFormat ) const
+ {
+ return iPostingSurface->FormatSupported( aFormat );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsSize
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsSize( const TSize& aSize ) const
+ {
+ return ( iPostingCaps.iMaxPixelSize.iWidth >= aSize.iWidth ) &&
+ ( iPostingCaps.iMaxPixelSize.iHeight >= aSize.iHeight );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsRotation
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsRotation(
+ CPostingSurface::TRotationType aRotation ) const
+ {
+ return ( ( aRotation & iPostingCaps.iSupportedRotations ) == aRotation );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsMirroring
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsMirroring() const
+ {
+ return iPostingCaps.iSupportsMirroring;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsScaling
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsScaling() const
+ {
+ return iPostingCaps.iSupportsScaling;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsBrightness
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsBrightness() const
+ {
+ return iPostingCaps.iSupportsBrightnessControl;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsContrast
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsContrast() const
+ {
+ return iPostingCaps.iSupportsContrastControl;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetFrameBufferSize
+// Returns size of frame buffer in bytes for given pixel size and current
+// posting format.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawDP::GetFrameBufferSize( const TSize& aSize ) const
+ {
+ TInt size( -1 );
+ __VTPRINTENTER( "RVD(DP).GetFrameBufferSize" )
+ switch( iPostingFormat )
+ {
+ case KDefaultPostingFormat420:
+ size = ( aSize.iWidth * aSize.iHeight * 3 ) >> 1;
+ break;
+
+ case KDefaultPostingFormat422:
+ size = ( aSize.iWidth * aSize.iHeight ) * 2;
+ break;
+
+ default:
+ break;
+ }
+ __VTPRINTEXITR( "RVD(DP).GetFrameBufferSize %d", size )
+ return size;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RecalculateClipRegionL
+// Updates clipregion.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::RecalculateClipRegionL()
+ {
+ __VTPRINTENTER( "RVD(DP).RecalculateClipRegionL" )
+ // Clip region needs to be updated
+ iClipRegionUpdated = ETrue;
+ iClipRegion.Clear();
+ TRect clippingRect( iConfig.iClipRect );
+ clippingRect.Move( iConfig.iOffset );
+ FixRectForDP( clippingRect );
+ iClipRegion.AddRect( clippingRect );
+ if ( iClipRegion.CheckError() )
+ {
+ __VTPRINT( DEBUG_MEDIA ,
+ "RVD(DP).RecalculateClipRegionL failed to add cliprect" )
+ User::Leave( KErrNoMemory );
+ }
+
+ if ( IsFlag( EStarted ) && iDSA && iDSA->DrawingRegion() )
+ {
+ iClipRegion.Intersect( *iDSA->DrawingRegion() );
+ if ( iClipRegion.CheckError() )
+ {
+ __VTPRINT( DEBUG_MEDIA ,
+ "RVD(DP).RecalculateClipRegionL failed to intersect" )
+ User::Leave( KErrNoMemory );
+ }
+
+#ifdef VTDEBUG
+
+ TRect bRect( iClipRegion.BoundingRect() );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RecalculateClipRegionL BRect.iTl (%d, %d)",
+ bRect.iTl.iX, bRect.iTl.iY );
+ __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RecalculateClipRegionL BRect.iBr (%d, %d)",
+ bRect.iBr.iX, bRect.iBr.iY );
+#endif // VTDEBUG
+ }
+ __VTPRINTEXIT( "RVD(DP).RecalculateClipRegionL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::FixRectForDP
+// Fixes rect for DP (i.e. width is made even and starting X coordinate is made
+// even as well)
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::FixRectForDP( TRect& aRect ) const
+ {
+ __VTPRINTENTER( "RVD(DP).FixRectForDP" )
+ if ( aRect.iTl.iX & 1 )
+ {
+ aRect.Move( 1, 0 );
+ aRect.SetWidth( Max( 0, aRect.Width() - 1 ) );
+ }
+ if ( aRect.Width() & 1 )
+ {
+ aRect.SetWidth( aRect.Width() - 1 );
+ }
+ __VTPRINTEXIT( "RVD(DP).FixRectForDP" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RecalculateClipRegionL
+// Fills sink params.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetSinkParams( TDisplaySinkParamsDP& aSinkParams )
+ {
+ __VTPRINTENTER( "RVD(DP).GetSinkParams" )
+ Mem::FillZ( &aSinkParams, sizeof( TDisplaySinkParamsDP ) );
+ aSinkParams.iThreadId = RThread().Id();
+ aSinkParams.iRequestStatusPtr = &iStatus;
+ aSinkParams.iObserver = iObserver;
+ aSinkParams.iPostingBuffer1 = &iBuffers[ 0 ].Buffer();
+ aSinkParams.iPostingBuffer2 = &iBuffers[ 1 ].Buffer();
+ aSinkParams.iFrameSize = iSourceSize;
+ aSinkParams.iPostingFormat = iPostingFormat;
+ aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkDP;
+ __VTPRINTEXITR( "RVD(DP).GetSinkParams flags=%d",
+ (TInt) aSinkParams.iFlags )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DisplaySink
+// Returns reference to sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink& CVtEngDrawDP::DisplaySink()
+ {
+ return *iDisplaySink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::StoreFrameBuffer
+// Stores given frame buffer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::StoreFrameBuffer(
+ CPostingSurface::TPostingBuff* aPostingBuffer )
+ {
+ __VTPRINTENTER( "RVD(DP).StoreFrameBuffer" )
+ if ( iPostingFormat == KDefaultPostingFormat422 )
+ {
+ const TInt height( iSourceSize.iHeight );
+ const TInt srcStride( aPostingBuffer->GetStride() );
+ const TInt dstStride( iSourceSize.iWidth * 2 );
+ TUint8* dst =
+ const_cast< TUint8* >( iFrameBuffer->Des().Ptr() );
+ const TUint8* src =
+ reinterpret_cast< const TUint8* >( aPostingBuffer->GetBuffer() );
+ for ( TInt y = height - 1; y >= 0; y-- )
+ {
+ dst = Mem::Copy( dst, src, dstStride );
+ src += srcStride;
+ }
+ }
+ else
+ {
+ TInt frameBufferSizeInBytes( GetFrameBufferSize( iSourceSize ) );
+ TPtrC8 postingBufferDesC(
+ reinterpret_cast< const TUint8* >( aPostingBuffer->GetBuffer() ),
+ frameBufferSizeInBytes );
+ *iFrameBuffer = postingBufferDesC;
+ }
+ SetFlag( EFrameBufferFilled | EFrameBufferNeedsConvertAndScale );
+ __VTPRINTEXIT( "RVD(DP).StoreFrameBuffer" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CreateFrameBufferL
+// Creates frame buffer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CreateFrameBufferL( const TSize& aSize )
+ {
+ __VTPRINTENTER( "RVD(DP).CreateFrameBufferL" )
+ delete iFrameBuffer; iFrameBuffer = NULL;
+ iFrameBuffer = HBufC8::NewL( GetFrameBufferSize( aSize ) );
+ ClearFlag( EFrameBufferFilled | EFrameBufferNeedsConvertAndScale );
+ __VTPRINTEXIT( "RVD(DP).CreateFrameBufferL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetAvailableToSink
+// Sets posting buffer available to sink.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::SetAvailableToSink( CPostingSurface::TPostingBuff* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(DP).SetAvailableToSink" )
+ for ( TInt i = MDisplaySink::EFirstBitmap;
+ i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+ {
+ if ( !iBuffers[ i ].IsSet() )
+ {
+ __VTPRINT3( DEBUG_MEDIA,
+ "RVD(DP).SetAvailableToSink buffer %d: $%x",
+ i, reinterpret_cast< TUint >( aBuffer->GetBuffer() ) );
+ iBuffers[ i ].Set( aBuffer );
+ Activate();
+ DisplaySink().SetBitmapAvailable(
+ static_cast< MDisplaySink::TBitmapNo >( i ) );
+ break;
+ }
+ }
+ __VTPRINTEXIT( "RVD(DP).SetAvailableToSink" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetAvailableToSink
+// Sets posting buffer available to sink.
+// -----------------------------------------------------------------------------
+//
+CPostingSurface* CVtEngDrawDP::CreatePostingSurfaceL()
+ {
+ __VTPRINTENTER( "RVD(DP).CreatePostingSurfaceL" )
+ CPostingSurface* postingSurface = NULL;
+ CPostingSurfaceFactory* ( *createFactoryL )() =
+ reinterpret_cast< CPostingSurfaceFactory*(*)() >( iDPLib->Lookup( 1 ) );
+ if ( createFactoryL )
+ {
+ CPostingSurfaceFactory* factory = createFactoryL();
+ CleanupStack::PushL( factory );
+ postingSurface = factory->NewPostingSurfaceL( EMainDisplay );
+ CleanupStack::PopAndDestroy(); // factory
+ }
+ __VTPRINTEXIT( "RVD(DP).CreatePostingSurfaceL" )
+ return postingSurface;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CloseDPLibrary
+// Close the DP API library and free the allocated instance.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CloseDPLibrary()
+ {
+ if ( iDPLib )
+ {
+ iDPLib->Close();
+ delete iDPLib;
+ iDPLib = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::LoadDPLibraryL
+// Loads DP API library.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::LoadDPLibraryL()
+ {
+ CloseDPLibrary();
+ iDPLib = new ( ELeave ) RLibrary();
+ TInt error( iDPLib->Load( KDPAPIDLLName() ) );
+ if ( error )
+ {
+ delete iDPLib;
+ iDPLib = NULL;
+ User::Leave( error );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Convert420ToVtImg
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::Convert420ToVtImg( HBufC8* aSource,
+ CVtImageBitmap& aTarget )
+ {
+ __VTPRINTENTER( "RVD(DP).Convert420ToVtImg" )
+
+ CFbsBitmap& bitmap( aTarget.Bitmap() );
+ TSize size( bitmap.SizeInPixels() );
+ TInt height( size.iHeight );
+ TInt width( size.iWidth );
+ TInt bytes( bitmap.ScanLineLength( width, bitmap.DisplayMode() ) );
+
+ const TUint8* y1ptr = aSource->Ptr();
+ const TUint8* y2ptr = y1ptr + width;
+ const TUint8* uptr = y1ptr + ( width * height );
+ const TUint8* vptr = uptr + ( width * height ) / 4;
+
+ bitmap.LockHeap();
+
+ TUint8* d1ptr = reinterpret_cast< TUint8* >( bitmap.DataAddress() );
+ TUint8* d2ptr = d1ptr + bytes;
+
+ height /= 2; // divide by 2 because we process to rows at time
+ bytes *= 2; // multiply by 2 so we don't need to do it in loop
+
+ while ( height-- )
+ {
+ DoConvertYuv420toXRGB0888( width, y1ptr, y2ptr, uptr, vptr, d1ptr,
+ d2ptr );
+ y1ptr = y2ptr;
+ y2ptr += width;
+ d1ptr += bytes;
+ d2ptr += bytes;
+ }
+
+ bitmap.UnlockHeap();
+
+ __VTPRINTEXIT( "RVD(DP).Convert420ToVtImg" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Convert422ToVtImg
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::Convert422ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget )
+ {
+ __VTPRINTENTER( "RVD(DP).Convert422ToVtImg" )
+ CFbsBitmap& bitmap( aTarget.Bitmap() );
+ TSize size( bitmap.SizeInPixels() );
+ TInt height( size.iHeight );
+ TInt width( size.iWidth );
+ TInt bytes( bitmap.ScanLineLength( width, bitmap.DisplayMode() ) );
+
+ const TUint8* sptr = aSource->Ptr();
+
+ bitmap.LockHeap();
+
+ TUint8* dptr = reinterpret_cast< TUint8* >( bitmap.DataAddress() );
+ while ( height-- )
+ {
+ DoConvertYuv422toXRGB0888( width, sptr, dptr );
+ dptr += bytes;
+ }
+
+ bitmap.UnlockHeap();
+
+ __VTPRINTEXIT( "RVD(DP).Convert422ToVtImg" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::UpdateVtFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::UpdateVtFrame()
+ {
+ __VTPRINTENTER( "RVD(DP).UpdateVtFrame" )
+ if ( IsFlag( EFrameBufferFilled ) )
+ {
+ CFbsBitmap* bitmap = NULL;
+ if ( IsFlag( EFrameBufferNeedsConvertAndScale ) )
+ {
+ if ( iPostingFormat == KDefaultPostingFormat422 )
+ {
+ Convert422ToVtImg( iFrameBuffer, *iSource );
+ }
+ else
+ {
+ Convert420ToVtImg( iFrameBuffer, *iSource );
+ }
+ TRAPD( error, iImageScaler->ScaleNowL( *iSource, *iTarget ) );
+ if ( !error )
+ {
+ bitmap = &iTarget->Bitmap();
+ }
+ ClearFlag( EFrameBufferNeedsConvertAndScale );
+ }
+ else
+ {
+ bitmap = &iTarget->Bitmap();
+ }
+ Config().iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+ bitmap );
+ }
+ __VTPRINTEXIT( "RVD(DP).UpdateVtFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::ScalingFinished
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::ScalingFinished( TInt )
+ {
+ }
+
+// Implementation for CVtEngDrawDP::TVtEngBuffer
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::TVtEngBuffer
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::TVtEngBuffer::TVtEngBuffer()
+ : iBuffer( 0 )
+ {
+ __VTPRINTENTER( "RVD(DP).Buffer.Ctor" )
+ __VTPRINTEXIT( "RVD(DP).Buffer.Ctor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::Set
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::TVtEngBuffer::Set( CPostingSurface::TPostingBuff* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(DP).Buffer.Set" )
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).Buffer.Set $%x",
+ reinterpret_cast< TUint >( aBuffer->GetBuffer() ) )
+ iBuffer = aBuffer;
+ __VTPRINTEXIT( "RVD(DP).Buffer.Set" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::UnSet
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::TVtEngBuffer::UnSet()
+ {
+ __VTPRINTENTER( "RVD(DP).Buffer.UnSet" )
+ iBuffer = 0;
+ __VTPRINTEXIT( "RVD(DP).Buffer.UnSet" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::IsSet
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::TVtEngBuffer::IsSet() const
+ {
+ return ( iBuffer != 0 );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+CPostingSurface::TPostingBuff*& CVtEngDrawDP::TVtEngBuffer::Buffer()
+ {
+ return iBuffer;
+ }
+
+// Implementation for CVtEngDrawDP::CVtEngBufferWaiter
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngBufferWaiter::CVtEngBufferWaiter
+ ( CPostingSurface& aPostingSurface, MVtEngBufferWaiterObserver& aObserver )
+ : CActive( CActive::EPriorityStandard ),
+ iPostingSurface( &aPostingSurface ), iObserver( &aObserver )
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.Ctor" )
+ CActiveScheduler::Add( this );
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.Ctor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::~CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngBufferWaiter::~CVtEngBufferWaiter()
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.~" )
+ Cancel();
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::Activate()
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.Activate" )
+ iStatus = KRequestPending;
+ SetActive();
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.Activate" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::FetchBuffer
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawDP::CVtEngBufferWaiter::FetchBuffer()
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.FetchBuffer" )
+ // do nothing if we're already active
+ if ( IsActive() )
+ {
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.FetchBuffer" )
+ return KErrNone;
+ }
+ // else start fetching
+ Activate();
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.FetchBuffer" )
+ return iPostingSurface->WaitForNextBuffer( iStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::RunL()
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.RunL" )
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DP).BufferWaiter.RunL %d", iStatus.Int() );
+ TInt result( iStatus.Int() );
+ if ( result == KErrNone )
+ {
+ iObserver->BufferReady( iPostingSurface->NextBuffer() );
+ }
+ else
+ {
+ iObserver->FetchError( result );
+ }
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::DoCancel()
+ {
+ __VTPRINTENTER( "RVD(DP).BufferWaiter.DoCancel" )
+ iPostingSurface->CancelBuffer();
+ __VTPRINTEXIT( "RVD(DP).BufferWaiter.DoCancel" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawDSA.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,586 @@
+/*
+* Copyright (c) 2006 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: Remote video handler.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CVtEngDrawDSA.h"
+#include "CVtEngEventManager.h"
+#include "VtEngPanic.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include <videotelephonyvariant.hrh>
+#include <tdisplaysinkparamsdsa.h>
+#include <cvtlogger.h>
+
+// LOCAL CONSTANTS
+
+// Default display mode.
+const TDisplayMode KVtEngDefaultDisplayMode( EColor64K );
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA* CVtEngDrawDSA::NewL(
+ MDisplaySinkObserver* aObserver )
+ {
+ CVtEngDrawDSA* self = new ( ELeave ) CVtEngDrawDSA( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::~CVtEngDrawDSA
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA::~CVtEngDrawDSA()
+ {
+ __VTPRINTENTER( "RVD(DSA).~" )
+ Cancel();
+ delete iBitmap1;
+ delete iBitmap2;
+ if ( iImageScaler )
+ {
+ iImageScaler->Release();
+ }
+ __VTPRINTEXIT( "RVD(DSA).~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::CVtEngDrawDSA
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA::CVtEngDrawDSA( MDisplaySinkObserver* aObserver ) :
+ CVtEngDraw( aObserver ), iBitmapSetAvail( ETrue )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseConstructL( )
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseConstructL" )
+ TSize vtEngRemoteVideoDefaultSize( KVtEngRemoteVideoDefaultWidth,
+ KVtEngRemoteVideoDefaultHeight );
+
+ iBitmap1 = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap1->Create(
+ vtEngRemoteVideoDefaultSize, KVtEngDefaultDisplayMode ) );
+ iBitmap2 = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap2->Create(
+ vtEngRemoteVideoDefaultSize, KVtEngDefaultDisplayMode ) );
+ iImageScaler = VtEngScalerFactory::CreateScalerL( *this );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT,
+ "RVD.ConL scaler ok %d", iImageScaler != NULL )
+ __VTPRINTEXIT( "RVD(DSA).BaseConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawDSA::CreateSinkL()
+ {
+ __VTPRINTENTER( "RVD(DSA).CreateSinkL" )
+ TDisplaySinkParamsDSA params;
+ GetSinkParams( params );
+ MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+ __VTPRINTEXITR( "RVD(DSA).CreateSinkL flags=%d", params.iFlags )
+ return sink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseDoCancel()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseDoCancel" )
+ __VTPRINTEXIT( "RVD(DSA).BaseDoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseVerifyConfigL
+// Checks current configuration against DSA implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseVerifyConfigL()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseVerifyConfigL" )
+ __VTPRINTEXIT( "RVD(DSA).BaseVerifyConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRestartL()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseRestartL" )
+ __VTPRINTEXIT( "RVD(DSA).BaseRestartL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseAbortNow()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseAbortNow" )
+ __VTPRINTEXIT( "RVD(DSA).BaseAbortNow" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseStartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseStartDrawL()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseStartDrawL" )
+ if ( iDSA )
+ {
+ SetFlag( EReadyInternal );
+ if ( !IsActive() )
+ {
+ Activate();
+ iDisplaySink->SetBitmapAvailable( MDisplaySink::EFirstBitmap );
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseStartDrawL bmp avail done" )
+ iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+ iCallback );
+ }
+ SetFlag( ERemoteVideoDrawing );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+ __VTPRINTEXIT( "RVD(DSA).BaseStartDrawL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseStopDraw()
+ {
+ // Cancel the timer in any case.
+ __VTPRINTENTER( "RVD(DSA).BaseStopDraw" )
+ iWatcher->Cancel();
+ if ( iDSA )
+ {
+ ClearFlag( ERemoteVideoDrawing | EStarted );
+ iDSA->Cancel();
+ }
+
+ // Stop also scaling
+ if ( iImageScaler )
+ {
+ iImageScaler->Cancel();
+ }
+
+ Cancel();
+ __VTPRINTEXIT( "RVD(DSA).BaseStopDraw" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseSetConfigL" )
+ Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigDSA ) );
+ iConfig = aConfig;
+ ConfigUpdatedL();
+ __VTPRINTEXIT( "RVD(DSA).BaseSetConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseSetUIForegroundL( TBool aForeground )
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseSetUIForegroundL" )
+ if ( aForeground )
+ {
+ TBool wasSentToBackground( IsFlag( ESentToBackground ) );
+ SetFlag( EFlagUIForeground );
+ ClearFlag( ESentToBackground );
+ if ( wasSentToBackground )
+ {
+ BaseRefreshBitmapsL();
+ Restart( RDirectScreenAccess::ETerminateCancel );
+ BaseStartDrawL();
+ }
+ }
+ else
+ {
+ BaseStopDraw();
+ ClearFlag( EFlagUIForeground );
+ SetFlag( ESentToBackground );
+ }
+ __VTPRINTEXIT( "RVD(DSA).BaseSetUIForegroundL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseVideoFrameSizeChangedL( const TSize& /*aTo*/ )
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseVideoFrameSizeChangedL" )
+ __VTPRINTEXIT( "RVD(DSA).BaseVideoFrameSizeChangedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRequestLastFrame()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseRequestLastFrame" )
+ __VTPRINTEXIT( "RVD(DSA).BaseRequestLastFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawDSA::Config()
+ {
+ return iConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::RunL()
+ {
+ __VTPRINTENTER( "RVD(DSA).RunL" )
+ __VTPRINT2( DEBUG_MEDIA, " bmpNo=%d", iBitmapNo )
+ iBitmapNo = iStatus.Int() == 0 ?
+ MDisplaySink::ESecondBitmap :
+ MDisplaySink::EFirstBitmap ;
+
+ iBitmapSetAvail = EFalse;
+
+ TBool dropFrame( EFalse );
+
+ if ( !iDSUpdated )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL !Updated" )
+ dropFrame = ETrue;
+ }
+ else if ( !IsFlag( EFlagUIForeground ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL !Flag( EFlagUIForeground )" )
+ dropFrame = ETrue;
+ }
+
+ if ( dropFrame )
+ {
+ iBitmapSetAvail = ETrue;
+ Activate();
+ iDisplaySink->SetBitmapAvailable( iBitmapNo );
+ __VTPRINTEXIT( "RVD(DSA).RunL" )
+ return;
+ }
+
+ // Image received, reset counter.
+ iCheckpoint = KVtEngWatcherThreshold;
+
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).RunL iStatus=%d", iStatus.Int() )
+ if ( iStatus >= KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).RunL flags=%d", iFlags )
+ TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+ SetFlag( EFirstFrameReceived );
+
+ // Remote video is about to start?
+ if ( !IsFlag( EStarted ) && IsFlag( EReadyInternal ) )
+ {
+ SetFlag( EStarted );
+ iDSA->StartL();
+ if ( !iConfig.iClipRect.IsEmpty() )
+ {
+ SetFlag( EReadyForeground );
+ iDSA->Gc()->SetClippingRect( iConfig.iClipRect );
+ }
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL notify rvd start" )
+ //CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+ }
+ if ( firstFrame )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+ }
+ if ( IsFlag( EStarted ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL refresh" )
+ BaseRefreshL();
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD.RunL notify rvd problem" )
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ __VTPRINTEXIT( "RVD(DSA).RunL" )
+ return;
+ }
+
+ __VTPRINT( DEBUG_MEDIA, "RVD.RunL setting active" )
+ Activate();
+
+ // Set bitmap only if not to be scaled
+ if( !iImageScaler )
+ {
+ if ( !iBitmapSetAvail )
+ {
+ iDisplaySink->SetBitmapAvailable( iBitmapNo );
+ iBitmapSetAvail = ETrue;
+ }
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted set bmp available" )
+ }
+
+ __VTPRINTEXIT( "RVD(DSA).RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::ScalingCompleted
+// Callback to receive scaled images.
+// Draws received image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::ScalingCompleted(
+ CFbsBitmap* aBitmap,
+ TInt aError )
+ {
+ __VTPRINTENTER( "RVD(DSA).ScalingCompleted" )
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).ScalingReady %d", aError )
+ __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).ScalingReady image %d", aBitmap ? 1 : 0 )
+ if ( aError == KErrNone &&
+ aBitmap != NULL )
+ {
+ DrawBitmap( *aBitmap );
+ if ( !iBitmapSetAvail )
+ {
+ // Set bitmap available if not already set
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted set bmp available" )
+ Activate();
+ iDisplaySink->SetBitmapAvailable( iBitmapNo );
+ iBitmapSetAvail = ETrue;
+ }
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted available?" )
+ }
+ else if ( aError != KErrCancel )
+ {
+ // Notification of failed scaling.
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingReady problems" )
+ }
+ __VTPRINTEXITR( "RVD(DSA).ScalingCompleted err=%d", aError )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRefreshL
+// If using scaler, start the scaling otherwise draw a bitmap.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRefreshL()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseRefreshL" )
+ if ( iConfig.iWindow )
+ {
+ if ( IsFlag( EReady ) && IsFlag( EFirstFrameReceived ) &&
+ IsFlag( EFlagUIForeground ) )
+ {
+ CFbsBitmap* current = iBitmapNo != 0 ? iBitmap1 : iBitmap2;
+ if ( current )
+ {
+ if ( iImageScaler )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseRefreshL scaling" )
+ TInt index = 0;
+ if ( current == iBitmap2 )
+ {
+ index = 1;
+ }
+ iImageScaler->Cancel();
+ iImageScaler->ScaleL( index );
+ }
+ else
+ {
+ DrawBitmap( *current );
+ }
+ }
+ }
+ }
+ __VTPRINTEXIT( "RVD(DSA).BaseRefreshL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRefreshBitmapsL()
+ {
+ __VTPRINTENTER( "RVD(DSA).BaseRefreshBitmapsL" )
+ const TDisplayMode currentMode( iConfig.iWsSreenDevice->DisplayMode() );
+ TBool refreshDisplayMode = EFalse;
+ TSize newSize( KVtEngRemoteVideoDefaultWidth,
+ KVtEngRemoteVideoDefaultHeight );
+
+ // Use new size if supplied
+ if ( iSourceSize.iHeight > 0 && iSourceSize.iWidth > 0 )
+ {
+ newSize = iSourceSize;
+ iSourceSize.iHeight = 0;
+ iSourceSize.iWidth = 0;
+ }
+
+ __VTPRINT( DEBUG_MEDIA , "================== RVD.RFBM ==================" )
+ __VTPRINT2( DEBUG_MEDIA , " newSize.iWidth: %d", newSize.iWidth)
+ __VTPRINT2( DEBUG_MEDIA , " newSize.iHeight: %d ", newSize.iHeight )
+ __VTPRINT( DEBUG_MEDIA , "================== RVD.RFBM ==================" )
+
+ TBool refreshSize = EFalse;
+ if ( iBitmap1 )
+ {
+ refreshDisplayMode = ( iBitmap1->DisplayMode() != currentMode );
+ refreshSize = ( newSize != iBitmap1->SizeInPixels() );
+ }
+
+ // Delete and create the bitmaps
+ if ( refreshDisplayMode || refreshSize || !iBitmap1 || !iBitmap2 )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseRefreshBitmapsL bmp create" )
+ if ( iImageScaler )
+ {
+ iImageScaler->Cancel();
+ }
+
+ iConfig.iObserver->vtSetFrame(
+ MVtEngFrameObserver::ERemoteVideoFrame, 0 );
+ delete iBitmap1;
+ iBitmap1 = NULL;
+ delete iBitmap2;
+ iBitmap2 = NULL;
+
+ iBitmap1 = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap1->Create(
+ newSize, currentMode ) );
+ iBitmap2 = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap2->Create(
+ newSize, currentMode ) );
+ ClearFlag( EFirstFrameReceived );
+ }
+
+ // set the params for DS
+ TDisplaySinkParamsDSA params;
+ GetSinkParams( params );
+
+ // Update the scaler
+ if ( iImageScaler )
+ {
+ // Try to configure first, if returns true
+ // configure again
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseRefreshBitmapsL cnfg" )
+
+ iImageScaler->ConfigureL( currentMode,
+ iConfig.iRect.Size(), params.iBitmap1Handle,
+ params.iBitmap2Handle );
+
+ if ( IsFlag( EFirstFrameReceived ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "CVtEngDrawDSA::RefreshBitmapsL RFR" )
+ BaseRefreshL();
+ }
+
+ }
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseRefreshBitmapsL USP" )
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "RVD(DSA).BaseRefreshBitmapsL USP flag" )
+ iDisplaySink->UpdateSinkParamsL( params, iDSUpdated );
+ Activate();
+ iDisplaySink->SetBitmapAvailable( MDisplaySink::EFirstBitmap );
+ __VTPRINTEXIT( "RVD(DSA).BaseRefreshBitmapsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::DrawBitmap
+// Draws bitmap
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::DrawBitmap( CFbsBitmap& aBitmap )
+ {
+ __VTPRINTENTER( "RVD(DSA).DrawBitmap" )
+ __ASSERT_ALWAYS( aBitmap.Handle(),
+ Panic( EVtEngPanicInvalidBitmapHandle ) );
+ __ASSERT_ALWAYS( iDSA, Panic( EVtEngPanicInvalidPointer ) );
+ iDSA->Gc()->SetFaded( iConfig.iWindow->IsFaded() );
+ iDSA->Gc()->BitBlt( iConfig.iRect.iTl, &aBitmap );
+ iDSA->ScreenDevice()->Update();
+ iConfig.iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+ &aBitmap );
+ __VTPRINTEXITR( "RVD(DSA).DrawBitmap h=%d", aBitmap.Handle() )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::GetSinkParams
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::GetSinkParams( TDisplaySinkParamsDSA& aSinkParams )
+ {
+ __VTPRINTENTER( "RVD(DSA).GetSinkParams" )
+ aSinkParams.iThreadId = RThread().Id();
+ aSinkParams.iRequestStatusPtr = &iStatus;
+ aSinkParams.iObserver = iObserver;
+ aSinkParams.iBitmap1Handle = iBitmap1->Handle();
+ aSinkParams.iBitmap2Handle = iBitmap2->Handle();
+ aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkDSA;
+ __VTPRINTEXIT( "RVD(DSA).GetSinkParams" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1221 @@
+/*
+* Copyright (c) 2004-2006 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: Class for NGA Drawer.
+*
+*/
+
+// INCLUDE FILES
+
+#include "CVtEngDrawNGA.h"
+#include "CVtEngEventManager.h"
+#include "VtEngPanic.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include <videotelephonyvariant.hrh>
+#include <tdisplaysinkparamsnga.h>
+#include <cvtlogger.h>
+#include <graphics/surfaceconfiguration.h>
+#include <graphics/suerror.h>
+
+// Reversed enumeration for the bitmaps.
+static const MDisplaySink::TBitmapNo KVtEngBitmapNoReversed[] =
+ {
+ MDisplaySink::ESecondBitmap,
+ MDisplaySink::EFirstBitmap
+ };
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::TVTSurfaceBuffer
+//
+// -----------------------------------------------------------------------------
+//
+TVTSurfaceBuffer::TVTSurfaceBuffer( TUint8* aBuffer, TInt aSurfaceNo )
+ : iBuffer( aBuffer ), iSurfaceBufferNo(aSurfaceNo)
+ {
+ __VTPRINTENTER( "RVD(NGA).TVTSurfaceBuffer.Ctor" )
+ __VTPRINTEXIT( "RVD(NGA).TVTSurfaceBuffer.Ctor" )
+ }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TUint8*& TVTSurfaceBuffer::Buffer()
+ {
+ return iBuffer;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::SurfaceNo
+//
+// -----------------------------------------------------------------------------
+//
+TInt TVTSurfaceBuffer::SurfaceNo()
+ {
+ return iSurfaceBufferNo;
+ }
+
+void TVTSurfaceBuffer::Set( TUint8* aBuffer, TInt aSurfaceNo )
+ {
+ iBuffer = aBuffer;
+ iSurfaceBufferNo = aSurfaceNo;
+ }
+
+void TVTSurfaceBuffer::UnSet()
+ {
+ iBuffer = NULL;
+ iSurfaceBufferNo = KErrNotFound;
+ }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA* CVtEngDrawNGA::NewL(
+ MDisplaySinkObserver* aObserver )
+ {
+ CVtEngDrawNGA* self = new ( ELeave ) CVtEngDrawNGA( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::~CVtEngDrawNGA
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::~CVtEngDrawNGA()
+ {
+ __VTPRINTENTER( "RVD(NGA).~" )
+ Cancel();
+
+ if(iSurfaceCreated)
+ {
+
+ if (iSurfaceManager)
+ {
+ iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue);
+ iConfig.iWsSession->UnregisterSurface(0, iSurfaceId);
+ if ( iSurfaceChunk != NULL )
+ {
+ iSurfaceChunk->Close();
+ }
+ delete iSurfaceChunk;
+ iSurfaceChunk = NULL;
+ iSurfaceManager->CloseSurface(iSurfaceId);
+ iSurfaceUpdateSession.CancelAllUpdateNotifications();
+ iSurfaceUpdateSession.Close();
+
+ /* Close the surface manager handle */
+ if ( iSurfaceManager != NULL )
+ {
+ iSurfaceManager->Close();
+ }
+
+ delete iSurfaceManager;
+ iSurfaceManager = NULL;
+ }
+
+ for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+ {
+ if (iCallBackTable[i])
+ {
+ iCallBackTable[i]->Cancel();
+ delete iCallBackTable[i];
+ iCallBackTable[i] = NULL;
+ }
+ }
+
+ iSurfaceBuffers[ 0 ].UnSet();
+ iSurfaceBuffers[ 1 ].UnSet();
+ iSurfaceBuffer0.UnSet();
+ iSurfaceBuffer1.UnSet();
+ }
+ delete iBufferWaiter;
+ iBufferWaiter = NULL;
+ iWaitingBuffers.Reset();
+
+ __VTPRINTEXIT( "RVD(NGA).~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngDrawNGA
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngDrawNGA( MDisplaySinkObserver* aObserver ) :
+ CVtEngDraw( aObserver ),
+ iSurfaceFormat( EUidPixelFormatYUV_420Planar )
+
+ {
+ iConfig.iRemoteWindow = NULL;
+ iConfig.iWsSession = NULL;
+ iSurfaceCreated = EFalse;
+ iWaitingBuffers.Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseConstructL( )
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseConstructL" )
+ DoBaseConstructL();
+ __VTPRINTEXIT( "RVD(NGA).BaseConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawNGA::CreateSinkL()
+ {
+ __VTPRINTENTER( "RVD(NGA).CreateSinkL" )
+ TDisplaySinkParamsNGA params;
+ GetSinkParams( params );
+ MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ sink->Pause();
+ SetFlag( ESinkParamUpdateRequired | ESinkResumeRequired );
+ }
+ __VTPRINTEXITR( "RVD(NGA).CreateSinkL flags=%d", params.iFlags )
+ return sink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRefreshL
+// If using scaler, start the scaling otherwise draw a bitmap.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRefreshL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseRefreshL" )
+ __VTPRINTEXIT( "RVD(NGA).BaseRefreshL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRefreshBitmapsL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseRefreshBitmapsL" )
+ BaseConstructL();
+ CreateSurfaceL();
+ // set the params for DS
+ UpdateSinkParamsL();
+ ClearFlag( EFirstFrameReceived );
+ __VTPRINTEXIT( "RVD(NGA).BaseRefreshBitmapsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseDoCancel()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseDoCancel" )
+ __VTPRINTEXIT( "RVD(NGA).BaseDoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseVerifyConfigL
+// Checks current configuration against DSA implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseVerifyConfigL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseVerifyConfigL" )
+ __VTPRINTEXIT( "RVD(NGA).BaseVerifyConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRestartL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseRestartL" )
+ __VTPRINTEXIT( "RVD(NGA).BaseRestartL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseAbortNow()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseAbortNow" )
+ __VTPRINTEXIT( "RVD(NGA).BaseAbortNow" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseStartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseStartDrawL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseStartDrawL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EBaseBaseStartDrawCalled );
+ }
+ else
+ {
+ DoBaseStartDrawL();
+ }
+ __VTPRINTEXIT( "RVD(NGA).BaseStartDrawL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseStopDraw()
+ {
+ // Cancel the timer in any case.
+ __VTPRINTENTER( "RVD(NGA).BaseStopDraw" )
+ ClearFlag( EBaseBaseStartDrawCalled );
+ iWatcher->Cancel();
+ iBufferWaiter->Cancel();
+ ClearFlag( ERemoteVideoDrawing | EStarted );
+ for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+ {
+ if (iCallBackTable[i])
+ {
+ iCallBackTable[i]->Cancel();
+ }
+ }
+ Cancel();
+
+ __VTPRINTEXIT( "RVD(NGA).BaseStopDraw" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseSetConfigL" )
+ Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigNGA ) );
+ iConfig = aConfig;
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EBaseSetConfigCalled );
+ }
+ else
+ {
+ ConfigUpdatedL();
+ }
+ __VTPRINTEXIT( "RVD(NGA).BaseSetConfigL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseSetUIForegroundL( TBool aForeground )
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseSetUIForegroundL" )
+ __VTPRINTEXIT( "RVD(NGA).BaseSetUIForegroundL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRequestLastFrame()
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseRequestLastFrame" )
+ __VTPRINTEXIT( "RVD(NGA).BaseRequestLastFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseVideoFrameSizeChangedL( const TSize& /*aTo*/ )
+ {
+ __VTPRINTENTER( "RVD(NGA).BaseVideoFrameSizeChangedL" )
+ BaseConstructL();
+
+ TInt err;
+
+ iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue);
+ iConfig.iWsSession->UnregisterSurface(0, iSurfaceId);
+
+ iSurfaceChunk->Close();
+ delete iSurfaceChunk;
+ iSurfaceChunk = NULL;
+ iSurfaceManager->CloseSurface(iSurfaceId);
+ iSurfaceUpdateSession.CancelAllUpdateNotifications();
+ iSurfaceUpdateSession.Close();
+
+ /* Close the surface manager handle */
+ iSurfaceManager->Close();
+ delete iSurfaceManager;
+ iSurfaceManager = 0;
+
+ for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+ {
+ if (iCallBackTable[i])
+ {
+ iCallBackTable[i]->Cancel();
+ delete iCallBackTable[i];
+ iCallBackTable[i] = NULL;
+ }
+ }
+ iSurfaceBuffers[ 0 ].UnSet();
+ iSurfaceBuffers[ 1 ].UnSet();
+ iSurfaceBuffer0.UnSet();
+ iSurfaceBuffer1.UnSet();
+ iWaitingBuffers.Reset();
+
+ err = iSurfaceUpdateSession.Connect();
+ User::LeaveIfError(err);
+
+ iSurfaceManager = new RSurfaceManager();
+
+ User::LeaveIfNull(iSurfaceManager);
+ err = iSurfaceManager->Open();
+ User::LeaveIfError(err);
+
+ RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
+ attributes().iPixelFormat = iSurfaceFormat;
+ attributes().iSize = iSourceSize;
+ attributes().iBuffers = KVtEngMaxSurfaceBuffers;
+
+ //attributes().iStride = iSourceSize.iWidth*2;
+ attributes().iStride = iSourceSize.iWidth*3/2;
+
+ attributes().iOffsetToFirstBuffer = 0;
+ attributes().iAlignment = 4;
+ attributes().iContiguous = EFalse;
+ attributes().iMappable = ETrue;
+
+ err = iSurfaceManager->CreateSurface(attributes, iSurfaceId);
+ User::LeaveIfError(err);
+
+ // Map to chunk
+ iSurfaceChunk = new RChunk();
+ User::LeaveIfNull(iSurfaceChunk);
+ err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk);
+ User::LeaveIfError(err);
+
+ // Get the info from the surfaceManager
+ RSurfaceManager::TInfoBuf info;
+ err = iSurfaceManager->SurfaceInfo(iSurfaceId, info);
+ User::LeaveIfError(err);
+
+ TInt offset;
+ iSurfaceManager->GetBufferOffset(iSurfaceId, 0, offset);
+ iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 );
+ iSurfaceManager->GetBufferOffset(iSurfaceId, 1, offset);
+ iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 );
+
+ iConfig.iWsSession->RegisterSurface(0, iSurfaceId);
+ TSurfaceConfiguration surfaceConfig;
+ surfaceConfig.SetSurfaceId( iSurfaceId );
+ surfaceConfig.SetOrientation( CFbsBitGc::EGraphicsOrientationRotated270);
+ iConfig.iRemoteWindow->SetBackgroundSurface( surfaceConfig, ETrue );
+ //iConfig.iRemoteWindow->SetBackgroundSurface(iSurfaceId);
+
+ iCallBackTable[0] = new(ELeave) CActiveCallBack(
+ TCallBack(SurfaceBuffer0Ready, this),
+ CActive::EPriorityStandard-1);
+ CActiveScheduler::Add(iCallBackTable[0]);
+
+ iCallBackTable[1] = new(ELeave) CActiveCallBack(
+ TCallBack(SurfaceBuffer1Ready, this),
+ CActive::EPriorityStandard-1);
+ CActiveScheduler::Add(iCallBackTable[1]);
+
+ iSurfaceCreated = ETrue;
+
+ ClearFlag( EInitializePostingSurfaceCalled );
+
+ // set the params for DS
+ UpdateSinkParamsL();
+ ClearFlag( EFirstFrameReceived );
+
+ __VTPRINTEXIT( "RVD(NGA).BaseVideoFrameSizeChangedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawNGA::Config()
+ {
+ return iConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::RunL()
+ {
+ __VTPRINTENTER( "RVD(NGA).RunL" )
+
+ TInt bitmapNo( iStatus.Int() );
+
+ if ( bitmapNo < KErrNone )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL notify rvd problem" )
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ return;
+ }
+
+ TVtEngBuffer& buffer = iSurfaceBuffers[ bitmapNo ];
+
+ if ( !iDSUpdated )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL !Updated" )
+ __VTPRINTEXIT( "RVD(NGA).RunL" )
+ return;
+ }
+ else if ( buffer.SurfaceBuffer() == NULL )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL signalled with NULL buffer" )
+ TInt result( iBufferWaiter->FetchBuffer() );
+ User::LeaveIfError( result );
+ __VTPRINTEXIT( "RVD(NGA).RunL" )
+ return;
+ }
+
+ // Image received, reset counter.
+ iCheckpoint = KVtEngWatcherThreshold;
+
+ __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL flags=%d", iFlags )
+ TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+ SetFlag( EFirstFrameReceived );
+ if ( firstFrame )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+ }
+
+ TInt surfaceno = buffer.SurfaceBuffer()->SurfaceNo();
+ __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL received buffer surface id %d", surfaceno )
+ if ( iSubmitPending )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL submit pending")
+ iWaitingBuffers.AddLast(buffer);
+ }
+ else
+ {
+ iCallBackTable[surfaceno]->iStatus = KRequestPending;
+ iCallBackTable[surfaceno]->SetActive();
+ iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, iTimeStamp);
+ iSubmitPending = ETrue;
+ iSurfaceUpdateSession.SubmitUpdate( KAllScreens, iSurfaceId, surfaceno, NULL );
+ buffer.UnSet();
+ }
+ if ( iSurfaceBuffers[ KVtEngBitmapNoReversed[ bitmapNo ] ].IsSet() )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL reactivating for buffer %d",
+ KVtEngBitmapNoReversed[ bitmapNo ] )
+ Activate();
+ DisplaySink().NextFrame();
+ }
+ TInt result = iBufferWaiter->FetchBuffer();
+ User::LeaveIfError( result );
+
+ __VTPRINTEXIT( "RVD(NGA).RunL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BufferReadyL
+// BufferReadyL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BufferReadyL( TVTSurfaceBuffer* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferReadyL" )
+ SetAvailableToSink( aBuffer );
+ __VTPRINTEXIT( "RVD(NGA).BufferReadyL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::FetchError
+// Buffer fetching error
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::FetchError( TInt )
+ {
+ __VTPRINTENTER( "RVD(NGA).FetchError" )
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+ __VTPRINTEXIT( "RVD(NGA).FetchError" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoBaseConstructL
+// Base construction implementation
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoBaseConstructL()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoBaseConstructL" )
+ delete iBufferWaiter;
+ iBufferWaiter = NULL;
+
+ iBufferWaiter =
+ new ( ELeave ) CVtEngBufferWaiter( *this );
+
+ for ( TInt i = MDisplaySink::EFirstBitmap;
+ i < MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers; i++ )
+ {
+ iSurfaceBuffers[ i ].UnSet();
+ }
+ ClearFlag( EBaseConstructCalled );
+ __VTPRINTEXIT( "RVD(NGA).DoBaseConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::UpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::UpdateSinkParamsL()
+ {
+ __VTPRINTENTER( "RVD(NGA).UpdateSinkParamsL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( ESinkParamUpdateRequired );
+ }
+ else
+ {
+ DoUpdateSinkParamsL();
+ }
+ __VTPRINTEXIT( "RVD(NGA).UpdateSinkParamsL" )
+ }
+
+
+ // -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoBaseStartDrawL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoBaseStartDrawL()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoBaseStartDrawL" )
+ SetFlag( EReadyInternal );
+ if ( !iWatcher->IsActive() )
+ {
+ iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+ iCallback );
+ }
+
+ DoSurfaceBuffer0Ready();
+ DoSurfaceBuffer1Ready();
+
+ User::LeaveIfError( iBufferWaiter->FetchBuffer() );
+
+
+ SetFlag( ERemoteVideoDrawing );
+ ClearFlag( EBaseBaseStartDrawCalled );
+ __VTPRINTEXIT( "RVD(NGA).DoBaseStartDrawL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoCreateSurfaceL
+// Create surface implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoCreateSurfaceL()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoCreateSurfaceL" )
+ TInt err;
+
+ if(iSurfaceCreated)
+ {
+
+ if (iSurfaceManager)
+ {
+ /* Change log for recreate surface objects
+ * Surface staffs should NOT be recreated once created,
+ * but unregister and register needs to be done since the
+ * bounding window change its position and size. At this
+ * moment, reset the iWaitingBuffers and reset the callbacks
+ * are recommended.
+ */
+ iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue);
+ iConfig.iWsSession->UnregisterSurface(0, iSurfaceId);
+
+ /* Comment out below code to prevent delete the surface objects
+ * at this current stage, code below should NOT be removed due to
+ * potential future uses.
+ */
+ /*
+ iSurfaceChunk->Close();
+ delete iSurfaceChunk;
+ iSurfaceChunk = NULL;
+ iSurfaceManager->CloseSurface(iSurfaceId);
+ iSurfaceUpdateSession.CancelAllUpdateNotifications();
+ iSurfaceUpdateSession.Close();
+ */
+
+ /* Close the surface manager handle */
+ /*
+ iSurfaceManager->Close();
+ delete iSurfaceManager;
+ iSurfaceManager = 0;
+ */
+ }
+ for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+ {
+ if (iCallBackTable[i])
+ {
+ iCallBackTable[i]->Cancel();
+ delete iCallBackTable[i];
+ iCallBackTable[i] = NULL;
+ }
+ }
+ /* Comment out below code to prevent delete the surface buffers,
+ * otherwise the last buffer would not store the last frame.
+ * Code below should NOT be removed due to potential future uses.
+ */
+ /*
+ iSurfaceBuffers[ 0 ].UnSet();
+ iSurfaceBuffers[ 1 ].UnSet();
+ iSurfaceBuffer0.UnSet();
+ iSurfaceBuffer1.UnSet();
+ */
+ iWaitingBuffers.Reset();
+ }
+ /* Add else branch to escape the recreate of the surface objects,
+ * it could be changed in future.
+ */
+ else
+ {
+ err = iSurfaceUpdateSession.Connect();
+ User::LeaveIfError(err);
+
+ iSurfaceManager = new RSurfaceManager();
+
+ User::LeaveIfNull(iSurfaceManager);
+ err = iSurfaceManager->Open();
+ User::LeaveIfError(err);
+
+ RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
+ attributes().iPixelFormat = iSurfaceFormat;
+ attributes().iSize = iSourceSize;
+ attributes().iBuffers = KVtEngMaxSurfaceBuffers;
+
+ //attributes().iStride = iSourceSize.iWidth*2;
+ attributes().iStride = iSourceSize.iWidth*3/2;
+
+ attributes().iOffsetToFirstBuffer = 0;
+ attributes().iAlignment = 4;
+ attributes().iContiguous = EFalse;
+ attributes().iMappable = ETrue;
+
+ err = iSurfaceManager->CreateSurface(attributes, iSurfaceId);
+ User::LeaveIfError(err);
+
+ // Map to chunk
+ iSurfaceChunk = new RChunk();
+ User::LeaveIfNull(iSurfaceChunk);
+ err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk);
+ User::LeaveIfError(err);
+
+ // Get the info from the surfaceManager
+ RSurfaceManager::TInfoBuf infoBuf;
+ err = iSurfaceManager->SurfaceInfo( iSurfaceId, infoBuf );
+ User::LeaveIfError(err);
+ RSurfaceManager::TSurfaceInfoV01 info = infoBuf();
+
+ __VTPRINT2( DEBUG_MEDIA, "chunk size=%d", iSurfaceChunk->Size() )
+
+ TRgb color( 0, 0, 0 );
+
+ TInt offset;
+
+ iSurfaceManager->GetBufferOffset( iSurfaceId, 0, offset );
+ __VTPRINT2( DEBUG_MEDIA, "offset0=%d", offset )
+ ClearSurfacebuffer( iSurfaceChunk->Base(), offset, info, color );
+ iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 );
+
+ iSurfaceManager->GetBufferOffset( iSurfaceId, 1, offset );
+ __VTPRINT2( DEBUG_MEDIA, "offset1=%d", offset )
+ ClearSurfacebuffer( iSurfaceChunk->Base(), offset, info, color );
+ iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 );
+ }
+
+ iConfig.iWsSession->RegisterSurface(0, iSurfaceId);
+ TSurfaceConfiguration surfaceConfig;
+ surfaceConfig.SetSurfaceId( iSurfaceId );
+ surfaceConfig.SetOrientation( CFbsBitGc::EGraphicsOrientationRotated270);
+ iConfig.iRemoteWindow->SetBackgroundSurface( surfaceConfig, ETrue );
+ //iConfig.iRemoteWindow->SetBackgroundSurface(iSurfaceId);
+
+ iConfig.iRemoteWindow->BeginRedraw();
+ iConfig.iRemoteWindow->EndRedraw();
+
+ iCallBackTable[0] = new(ELeave) CActiveCallBack(
+ TCallBack(SurfaceBuffer0Ready, this),
+ CActive::EPriorityStandard-1);
+ CActiveScheduler::Add(iCallBackTable[0]);
+
+ iCallBackTable[1] = new(ELeave) CActiveCallBack(
+ TCallBack(SurfaceBuffer1Ready, this),
+ CActive::EPriorityStandard-1);
+ CActiveScheduler::Add(iCallBackTable[1]);
+
+ iSurfaceCreated = ETrue;
+
+ ClearFlag( EInitializePostingSurfaceCalled );
+ __VTPRINTEXIT( "RVD(NGA).DoCreateSurfaceL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::ClearSurface
+// clearing a surface buffer to given colour
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::ClearSurfacebuffer(
+ TUint8* aStartAddr,
+ TInt aOffset,
+ const RSurfaceManager::TSurfaceInfoV01 aInfo,
+ TRgb &aColor )
+{
+ TUint8 red = aColor.Red();
+ TUint8 green = aColor.Green();
+ TUint8 blue = aColor.Blue();
+
+ // formulae borrowed from http://msdn.microsoft.com/en-us/library/ms893078.aspx
+ TUint8 yval = ( ( 66 * (TInt32)red + 129 * (TInt32)green + 25 * (TInt32)blue + 128) >> 8) + 16;
+ TUint8 uval = ( ( -38 * (TInt32)red - 74 * (TInt32)green + 112 * (TInt32)blue + 128) >> 8) + 128;
+ TUint8 vval = ( ( 112 * (TInt32)red - 94 * (TInt32)green - 18 * (TInt32)blue + 128) >> 8) + 128;
+
+ TInt i = 0;
+
+ aStartAddr += aOffset;
+
+ while ( i < (aInfo.iSize.iHeight*aInfo.iSize.iWidth) )
+ {
+ *aStartAddr = yval;
+ aStartAddr++;
+ i++;
+ }
+ i=0;
+
+ while ( i < ((aInfo.iSize.iHeight*aInfo.iSize.iWidth)>>2) )
+ {
+ *aStartAddr = uval;
+ aStartAddr++;
+ i++;
+ }
+ i=0;
+
+ while ( i < ((aInfo.iSize.iHeight*aInfo.iSize.iWidth)>>2) )
+ {
+ *aStartAddr = vval;
+ aStartAddr++;
+ i++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoUpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoUpdateSinkParamsL()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoUpdateSinkParamsL" )
+ TDisplaySinkParamsNGA params;
+ GetSinkParams( params );
+ DisplaySink().UpdateSinkParamsL( params, iDSUpdated );
+ ClearFlag( ESinkParamUpdateRequired );
+ if ( IsFlag( ESinkResumeRequired ) )
+ {
+ DisplaySink().Resume();
+ ClearFlag( ESinkResumeRequired );
+ }
+ __VTPRINTEXIT( "RVD(DP).DoUpdateSinkParamsL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CreateSurfaceL
+// Create surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CreateSurfaceL()
+ {
+ __VTPRINTENTER( "RVD(NGA).CreateSurfaceL" )
+ if ( IsFlag( EBaseConstructCalled ) )
+ {
+ SetFlag( EInitializePostingSurfaceCalled );
+ }
+ else
+ {
+ DoCreateSurfaceL();
+ }
+ __VTPRINTEXIT( "RVD(NGA).CreateSurfaceL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::GetSinkParams
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::GetSinkParams( TDisplaySinkParamsNGA& aSinkParams )
+ {
+ __VTPRINTENTER( "RVD(NGA).GetSinkParams" )
+ Mem::FillZ( &aSinkParams, sizeof( TDisplaySinkParamsNGA ) );
+ aSinkParams.iThreadId = RThread().Id();
+ aSinkParams.iRequestStatusPtr = &iStatus;
+ aSinkParams.iObserver = iObserver;
+ aSinkParams.iSurfaceBuffer1 = &iSurfaceBuffers[ 0 ].Buffer();
+ aSinkParams.iSurfaceBuffer2 = &iSurfaceBuffers[ 1 ].Buffer();
+ aSinkParams.iFrameSize = iSourceSize;
+ aSinkParams.iSurfaceFormat = iSurfaceFormat;
+ aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkNGA;
+ __VTPRINTEXITR( "RVD(NGA).GetSinkParams flags=%d",
+ (TInt) aSinkParams.iFlags )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DisplaySink
+// Returns reference to sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink& CVtEngDrawNGA::DisplaySink()
+ {
+ return *iDisplaySink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::SetToSink
+// Sets posting buffer to sink.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::SetAvailableToSink( TVTSurfaceBuffer* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(NGA).SetAvailableToSink" )
+ for ( TInt i = MDisplaySink::EFirstBitmap;
+ i < MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers; i++ )
+ {
+ if ( !iSurfaceBuffers[ i ].IsSet() )
+ {
+ iSurfaceBuffers[ i ].Set( aBuffer );
+ Activate();
+ DisplaySink().SetBitmapAvailable(
+ static_cast< MDisplaySink::TBitmapNo >( i ) );
+ break;
+ }
+ }
+ __VTPRINTEXIT( "RVD(NGA).SetAvailableToSink" )
+ }
+
+TInt CVtEngDrawNGA::SurfaceBuffer0Ready( TAny* aAny )
+ {
+ __VTPRINTENTER( "RVD(NGA).SurfaceBuffer0Ready" )
+ __VTPRINTEXIT( "RVD(NGA).SurfaceBuffer0Ready" )
+ return ((CVtEngDrawNGA*)aAny)->DoSurfaceBuffer0Ready();
+ }
+
+TBool CVtEngDrawNGA::DoSurfaceBuffer0Ready()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoSurfaceBuffer0Ready" )
+ if ( iSubmitPending )
+ {
+ iSubmitPending = EFalse;
+ }
+ if (!iWaitingBuffers.IsEmpty())
+ {
+ TVtEngBuffer* buffer = iWaitingBuffers.First();
+ TInt surfaceno = buffer->SurfaceBuffer()->SurfaceNo();
+ __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).DoSurfaceBuffer0Ready, surface buffer %d is in waitingqueue", surfaceno )
+ iCallBackTable[surfaceno]->iStatus = KRequestPending;
+ iCallBackTable[surfaceno]->SetActive();
+ iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, iTimeStamp);
+ iSubmitPending = ETrue;
+ iSurfaceUpdateSession.SubmitUpdate( KAllScreens, iSurfaceId, surfaceno, NULL );
+ iWaitingBuffers.Remove(*buffer);
+ buffer->UnSet();
+ }
+ iBufferWaiter->BufferAvailable(iSurfaceBuffer0);
+ __VTPRINTEXIT( "RVD(NGA).DoSurfaceBuffer0Ready" )
+ return ETrue;
+ }
+
+TInt CVtEngDrawNGA::SurfaceBuffer1Ready( TAny* aAny )
+ {
+ __VTPRINTENTER( "RVD(NGA).SurfaceBuffer1Ready" )
+ __VTPRINTEXIT( "RVD(NGA).SurfaceBuffer1Ready" )
+ return ((CVtEngDrawNGA*)aAny)->DoSurfaceBuffer1Ready();
+ }
+
+TBool CVtEngDrawNGA::DoSurfaceBuffer1Ready()
+ {
+ __VTPRINTENTER( "RVD(NGA).DoSurfaceBuffer1Ready" )
+ if ( iSubmitPending )
+ {
+ iSubmitPending = EFalse;
+ }
+
+ if (!iWaitingBuffers.IsEmpty())
+ {
+ TVtEngBuffer* buffer = iWaitingBuffers.First();
+ TInt surfaceno = buffer->SurfaceBuffer()->SurfaceNo();
+ __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).DoSurfaceBuffer0Ready, surface buffer %d is in waitingqueue", surfaceno )
+ iCallBackTable[surfaceno]->iStatus = KRequestPending;
+ iCallBackTable[surfaceno]->SetActive();
+ iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, iTimeStamp);
+ iSubmitPending = ETrue;
+ iSurfaceUpdateSession.SubmitUpdate( KAllScreens, iSurfaceId, surfaceno, NULL );
+ iWaitingBuffers.Remove(*buffer);
+ buffer->UnSet();
+ }
+ iBufferWaiter->BufferAvailable(iSurfaceBuffer1);
+ __VTPRINTEXIT( "RVD(NGA).DoSurfaceBuffer1Ready" )
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::TVtEngBuffer
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::TVtEngBuffer::TVtEngBuffer()
+ : iBuffer( 0 ), iSurfaceBuffer(0)
+ {
+ __VTPRINTENTER( "RVD(NGA).Buffer.Ctor" )
+ __VTPRINTEXIT( "RVD(NGA).Buffer.Ctor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Set
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::TVtEngBuffer::Set( TVTSurfaceBuffer* aBuffer )
+ {
+ __VTPRINTENTER( "RVD(NGA).Buffer.Set" )
+ iSurfaceBuffer = aBuffer;
+ iBuffer = aBuffer->Buffer();
+ __VTPRINTEXIT( "RVD(NGA).Buffer.Set" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::UnSet
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::TVtEngBuffer::UnSet()
+ {
+ __VTPRINTENTER( "RVD(NGA).Buffer.UnSet" )
+ iSurfaceBuffer = 0;
+ iBuffer = 0;
+ __VTPRINTEXIT( "RVD(NGA).Buffer.UnSet" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::IsSet
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawNGA::TVtEngBuffer::IsSet() const
+ {
+ return ( iSurfaceBuffer != NULL );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TVTSurfaceBuffer* &CVtEngDrawNGA::TVtEngBuffer::SurfaceBuffer()
+ {
+ return iSurfaceBuffer;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TUint8* &CVtEngDrawNGA::TVtEngBuffer::Buffer()
+ {
+ return iBuffer;
+ }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngBufferWaiter::CVtEngBufferWaiter
+ //( CVideoRenderer& aVideoRenderer, MVtEngNGABufferWaiterObserver& aObserver )
+ ( MVtEngNGABufferWaiterObserver& aObserver )
+ : CActive( CActive::EPriorityStandard ),
+ iObserver( &aObserver )
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.Ctor" )
+ for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+ {
+ this->iBuffers[ i ] = NULL;
+ }
+ CActiveScheduler::Add( this );
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.Ctor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::~CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngBufferWaiter::~CVtEngBufferWaiter()
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.~" )
+ Cancel();
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::Activate()
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.Activate" )
+ iStatus = KRequestPending;
+ SetActive();
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.Activate" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::FetchBuffer
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawNGA::CVtEngBufferWaiter::FetchBuffer()
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.FetchBuffer" )
+ if ( IsActive() )
+ {
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.FetchBuffer 1" )
+ return KErrNone;
+ }
+
+ Activate();
+ if (iStatus == KRequestPending)
+ {
+ for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+ {
+ if(this->iBuffers[ i ] != NULL)
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ break;
+ }
+ }
+ }
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.FetchBuffer 2" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::BufferAvailable
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::BufferAvailable(TVTSurfaceBuffer& aBuffer)
+{
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.BufferAvailable" )
+ for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+ {
+ if(this->iBuffers[ i ] == NULL )
+ {
+ this->iBuffers[ i ]= &aBuffer;
+ break;
+ }
+ }
+
+ if(iStatus == KRequestPending )
+ {
+ for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+ {
+ if(this->iBuffers[ i ] != NULL)
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ break;
+ }
+ }
+ }
+
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.BufferAvailable" )
+}
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::RunL()
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.RunL" )
+ TInt result( iStatus.Int() );
+ if ( result == KErrNone )
+ {
+ for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+ {
+ if(this->iBuffers[ i ] != NULL)
+ {
+ TRAP_IGNORE( iObserver->BufferReadyL( this->iBuffers[ i ] ) );
+ this->iBuffers[ i ] = NULL;
+ break;
+ }
+ }
+ }
+ else
+ {
+ iObserver->FetchError( result );
+ }
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::DoCancel()
+ {
+ __VTPRINTENTER( "RVD(NGA).BufferWaiter.DoCancel" )
+
+ if ( iStatus == KRequestPending )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status, KErrCancel);
+ }
+
+ __VTPRINTEXIT( "RVD(NGA).BufferWaiter.DoCancel" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDtmfHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,363 @@
+/*
+* Copyright (c) 2004 - 2006 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: Handler for DTMF sending.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngDtmfHandler.h"
+#include "CVtEngMediaHandler.h"
+#include "VtEngPanic.h"
+#include "cvtlogger.h"
+
+// LOCAL MACROS
+#define DTMF_STATES_COUNT 3
+const TInt KProtoDtmfCommandId = -1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler* CVtEngDtmfHandler::NewL( MVtH324ConfigCommand& aH324Config )
+ {
+ __VTPRINTENTER( "DTMF.New" )
+ CVtEngDtmfHandler* self = new ( ELeave ) CVtEngDtmfHandler( aH324Config );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ __VTPRINTEXIT( "DTMF.New" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::~CVtEngDtmfHandler
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::~CVtEngDtmfHandler()
+ {
+ __VTPRINTENTER( "DTMF.~" )
+ if ( iDtmfStates )
+ {
+ iDtmfStates->ResetAndDestroy();
+ }
+ delete iDtmfStates;
+ if( iProtoDtmf )
+ {
+ VTProtocolFactory::DeleteUserInputIndication(iProtoDtmf);
+ }
+ iProtoDtmf = NULL;
+ __VTPRINTEXIT( "DTMF.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::HandleL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::HandleL( CVtEngOperation& aOp )
+ {
+ __VTPRINTENTER( "DTMF.HandleL" )
+
+ const TVtEngCommandId cmdId( aOp.Command() );
+ switch ( cmdId )
+ {
+ case KVtEngStartDtmfTone:
+ {
+ __VTPRINT( DEBUG_MEDIA , "DTMF. start tone" )
+ TChar tone;
+ TVtEngOpParamUtil<TChar>::Set( tone, aOp );
+ CVtEngDtmfState* state = (*iDtmfStates)[iCurrentState];
+ if ( state )
+ {
+ TVtEngDtmfTone dtmfTone( tone );
+ state->SendDtmfL( dtmfTone );
+ }
+ }
+ break;
+ case KVtEngStopDtmfTone:
+ __VTPRINT( DEBUG_MEDIA , "DTMF. stop tone (no op)" )
+ break;
+ // Handling of different UIIs
+ case KVtEngSetUIIDtmfSupport:
+ SetUIISupport( EDTMFString );
+ __VTPRINT( DEBUG_MEDIA , "DTMF Support enabled" )
+ break;
+ case KVtEngSetUIIBasicStringSupport:
+ SetUIISupport( EBasicString );
+ __VTPRINT( DEBUG_MEDIA , "Basic string Support enabled" )
+ break;
+ case KVtEngSetUIIIA5StringSupport:
+ SetUIISupport( EIA5String );
+ __VTPRINT( DEBUG_MEDIA , "IA5 String Support enabled" )
+ break;
+ case KVtEngSetUIIGeneralStringSupport:
+ SetUIISupport( EGeneralString );
+ __VTPRINT( DEBUG_MEDIA , "General String Support enabled" )
+ break;
+ default:
+ __VTPRINT( DEBUG_MEDIA , "DTMF.Handle cmd not supported" )
+ User::Leave( KErrNotSupported );
+ }
+ __VTPRINTEXIT( "DTMF.HandleL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ActivateState
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState& CVtEngDtmfHandler::ActivateState( TVtEngDtmfState aNewState )
+ {
+ __VTPRINTENTER( "DTMF.ActivateState" )
+ __VTPRINT2( DEBUG_MEDIA , " new state=%d", aNewState )
+ __ASSERT_ALWAYS( aNewState >= EVtDtmfStateIdle &&
+ aNewState <= EVtDtmfStateBuffered,
+ Panic( EVtEngPanicInvalidDtmfState) );
+ iCurrentState = aNewState;
+ __VTPRINTEXIT( "DTMF.ActivateState" )
+ return *(*iDtmfStates)[iCurrentState];
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::SendComplete
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::SendComplete( TInt aError )
+ {
+ __VTPRINTENTER( "DTMF.SendComplete" )
+#ifdef VTDEBUG
+ TRAPD( ignore, HandleSendCompleteL( aError ) );
+ __VTPRINT2( DEBUG_MEDIA , "DTMF.SendComplete err=%d", ignore )
+#else
+ TRAP_IGNORE( HandleSendCompleteL( aError ) );
+#endif // VTDEBUG
+ __VTPRINTEXIT( "DTMF.SendComplete" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ProtoDtmf
+//
+// -----------------------------------------------------------------------------
+//
+MVTUserInput& CVtEngDtmfHandler::ReserveProtoDtmfL(
+ const TVtEngDtmfTone& aTone )
+ {
+ __VTPRINTENTER( "DTMF.ReserveProtoDtmfL" )
+ if ( iProtoDtmf != NULL )
+ {
+ __VTPRINT( DEBUG_MEDIA , "DTMF.ReserveProtoDtmfL IN USE" )
+ User::Leave( KErrInUse );
+ }
+ TUint8 val = (TUint8) aTone.iTone;
+
+#ifdef VTDEBUG
+ if ( CVtLogger::Flags() & CVtLogger::ELogMedia )
+ {
+ const TChar ch( val );
+ _LIT( KVtDtmfBufferTrace, "VT: DTMF. tone value=" );
+ TBuf<25> buffer( KVtDtmfBufferTrace() );
+ buffer.Append( ch );
+ RDebug::Print( buffer );
+ }
+#endif
+
+
+
+ // NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // IT MUST BE CHECKED IS GIVEN LETTER SUPPORTED BY
+ // USED ENCODING SCHEME. NOW WE PASS ONLY NUMBERS AND * AND #
+ // AND THEY ARE SAFE TO USE BUT USING POWERFULL UIIs GIVE POSSIBILITY
+ // TO SEND ALL DIGITS AND NUMBERS. IN THAT CASE SET OF CHARS MUST BE CHECKED
+ // IN VTENGINE. (THAT IS THE REASON WHY THERE IS SEPARATE IF ELSEs)
+ // NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ __VTPRINT2( DEBUG_MEDIA , "DTMF. Proto USERINPUT %d", iUIISupport )
+ switch ( iUIISupport )
+ {
+ case EBasicString:
+ case EIA5String:
+ case EGeneralString:
+ __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT alphanumeric" )
+ iProtoDtmf = VTProtocolFactory::CreateUserInputIndication( EVtUiiAlphaNumeric, val );
+ break;
+ case EDTMFString:
+ __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT iDTMFString" )
+ iProtoDtmf = VTProtocolFactory::CreateUserInputIndication( EVtUiiDTMF, val);
+ break;
+ default:
+ __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT unsupported" )
+ break;
+ }
+ __VTPRINTEXIT( "DTMF.ReserveProtoDtmfL" )
+ return *iProtoDtmf;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ReleaseProtoDtmf
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::ReleaseProtoDtmf()
+ {
+ __VTPRINTENTER( "DTMF.ReleaseProtoDtmf" )
+ if( iProtoDtmf )
+ {
+ VTProtocolFactory::DeleteUserInputIndication(iProtoDtmf);
+ }
+ iProtoDtmf = NULL;
+ __VTPRINTEXIT( "DTMF.ReleaseProtoDtmf" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CVtEngDtmfHandler
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::CVtEngDtmfHandler( MVtH324ConfigCommand& aH324Config ) :
+ iCurrentState( EVtDtmfStateIdle ), iH324Config( aH324Config ),
+ iUIISupport( EIA5String ), iIssuedDtmfCommandId(KProtoDtmfCommandId)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::ConstructL()
+ {
+ __VTPRINTENTER( "DTMF.ConstructL" )
+ iDtmfStates = new ( ELeave )
+ CArrayPtrFlat<CVtEngDtmfState>( DTMF_STATES_COUNT );
+
+ for ( TInt state = EVtDtmfStateIdle;
+ state <= EVtDtmfStateBuffered;
+ state++ )
+ {
+ CreateStateL( state );
+ }
+ __VTPRINTEXIT( "DTMF.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::HandleSendCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::HandleSendCompleteL( TInt aError )
+ {
+ __VTPRINTENTER( "DTMF.HandleSendCompleteL" )
+
+ __VTPRINT2( DEBUG_MEDIA , " HandleSendCompleteL err=%d", aError )
+ if ( iDtmfStates )
+ {
+ CVtEngDtmfState* state = (*iDtmfStates)[iCurrentState];
+ if ( state )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "DTMF. complete on state %d", iCurrentState )
+ state->DtmfSendCompleteL( aError );
+ }
+ }
+ __VTPRINTEXIT( "DTMF.HandleSendCompleteL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CreateState
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::CreateStateL( TInt aState )
+ {
+ __VTPRINTENTER( "DTMF.CreateStateL" )
+ CVtEngDtmfState* dtmfState = NULL;
+ switch ( aState )
+ {
+ case EVtDtmfStateIdle:
+ dtmfState = CVtEngDtmfIdle::NewL( *this, iH324Config );
+ break;
+ case EVtDtmfStateSending:
+ dtmfState = CVtEngDtmfSending::NewL( *this, iH324Config );
+ break;
+ case EVtDtmfStateBuffered:
+ dtmfState = CVtEngDtmfBuffered::NewL( *this, iH324Config );
+ break;
+ default:
+ Panic( EVtEngPanicInvalidDtmfState );
+ break;
+ }
+ CleanupStack::PushL( dtmfState );
+ iDtmfStates->AppendL( dtmfState );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "DTMF.CreateStateL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::GetUIISupport
+// returns the current UII support
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::TUIISupport CVtEngDtmfHandler::GetUIISupport() const
+ {
+ __VTPRINT2( DEBUG_MEDIA , "DTMF. GETUSERINPUT support=%d", iUIISupport )
+ return iUIISupport;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::SetUIISupport
+// Sets the UII support mode
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::SetUIISupport( CVtEngDtmfHandler::TUIISupport aValue )
+ {
+ __VTPRINT2( DEBUG_MEDIA , "DTMF. SETUSERINPUT support=%d", aValue )
+ iUIISupport = aValue;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CheckCommandId
+// Compares last issued DTMF command ID to parameter given command ID
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDtmfHandler::CheckCommandId( TInt aCheckCommandId ) const
+ {
+ __VTPRINT3( DEBUG_MEDIA , "DTMF. CHKCMID aCheckCommandId=%d iIssuedDtmfCommandId=%d",\
+ aCheckCommandId, iIssuedDtmfCommandId )
+
+ if( iIssuedDtmfCommandId == aCheckCommandId )
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::StoreCommandId
+// Stores given command ID
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::StoreCommandId( TInt aStoreCommandId )
+ {
+ __VTPRINT2( DEBUG_MEDIA , "DTMF. STORECOMMANDID aStoreCommandId=%d", aStoreCommandId )
+
+ iIssuedDtmfCommandId = aStoreCommandId;
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngImageScaler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2004 - 2006 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: Image scaler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngImageScaler.h"
+#include <cvtimagebitmap.h>
+#include <fbs.h>
+#include <videotelephonyvariant.hrh>
+#include <cvtlogger.h>
+
+// CONSTANTS
+// The number of used bitmaps as scaling targets.
+const TInt KVtEngTargetBitmapCount = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+MVtEngImageScaler* CVtEngImageScaler::NewL(
+ MVtEngScalerObserver& aObserver )
+ {
+ __VTPRINTENTER( "Scaler.NewL" )
+ CVtEngImageScaler* scaler = new ( ELeave ) CVtEngImageScaler( aObserver );
+ CleanupStack::PushL( scaler );
+ scaler->ConstructL();
+ CleanupStack::Pop( scaler );
+ __VTPRINTEXIT( "Scaler.NewL" )
+ return scaler;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ConstructL()
+ {
+ iVtScaler = CVtImageScaler::NewL( *this );
+ GetScalingMethodL();
+ iVtScaler->SetQualityL( iScalingMethod );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ScaleL
+// Scaling method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ScaleL(
+ TInt aSourceIndex )
+ {
+ __VTPRINTENTER( "Scaler.ScaleL" )
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL index=%d",
+ aSourceIndex )
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL target index=%d",
+ iTargetBitmapInUse )
+ if ( iVtScaler->IsActive() )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL NActive" )
+ User::Leave( KErrInUse );
+ }
+
+ // If there is no bitmaps done, do leave.
+ // The caller should call ConfigureL.
+ if ( iSources.Count() <= 0 || iTargets.Count() <= 0 )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL: not conf" )
+ User::Leave( KErrNotReady );
+ }
+ iVtScaler->ScaleL( *iSources[ aSourceIndex ] ,
+ *iTargets[iTargetBitmapInUse] );
+ __VTPRINTEXIT( "Scaler.ScaleL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Configure
+// Configure scaling.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngImageScaler::ConfigureL(
+ TDisplayMode aDisplayMode,
+ TSize aSize,
+ TInt aSourceHandle1,
+ TInt aSourceHandle2 )
+ {
+ __VTPRINTENTER( "Scaler.ConfigureL" )
+ __VTPRINT( DEBUG_MEDIA , "================== Scaler.Config ==================" )
+ __VTPRINT2( DEBUG_MEDIA, " aSize.iWidth:%d ", aSize.iWidth)
+ __VTPRINT2( DEBUG_MEDIA, " aSize.iHeight:%d ", aSize.iHeight )
+ __VTPRINT2( DEBUG_MEDIA, " aDisplayMode:%d", aDisplayMode )
+ __VTPRINT( DEBUG_MEDIA , "================== Scaler.Config ==================" )
+
+ TInt sourceHandle1( 0 );
+ if ( iSources.Count() > 0 )
+ {
+ CVtImageBitmap* bmp = iSources[ EFirstBitmap ];
+ if ( bmp )
+ {
+ sourceHandle1 = bmp->Bitmap().Handle();
+ }
+ }
+ TInt sourceHandle2( 0 );
+ if ( iSources.Count() > 1 )
+ {
+ CVtImageBitmap* bmp = iSources[ ESecondBitmap ];
+ if ( bmp )
+ {
+ sourceHandle2 = bmp->Bitmap().Handle();
+ }
+ }
+
+ // Do we have to cancel scaling first?
+ TBool cancelled( iVtScaler->IsActive() );
+
+ if ( aSourceHandle1 != sourceHandle1 || aSourceHandle2 != sourceHandle2
+ || aSize != iSize || iMode != aDisplayMode )
+ {
+ if ( cancelled )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:Config cancel" )
+ Cancel();
+ }
+ }
+ else
+ {
+ // Do we need the update => NO
+ __VTPRINTEXITR( "Scaler.ConfigureL %d", EFalse )
+ return EFalse;
+ }
+
+ // Store new mode and size.
+ iMode = aDisplayMode;
+ iSize = aSize;
+
+ // The RVD source images have changed.
+ if ( aSourceHandle1 != sourceHandle1 || aSourceHandle2 != sourceHandle2 )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "Scaler:ConfigureL create bitmaps" )
+ CVtImageBitmap* vtBitmap = CVtImageBitmap::NewL( aSourceHandle1 );
+ CleanupStack::PushL( vtBitmap );
+ CVtImageBitmap* vtBitmap2 = CVtImageBitmap::NewL( aSourceHandle2 );
+ CleanupStack::PushL( vtBitmap2 );
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL source reset" )
+ iSources.ResetAndDestroy();
+ iSources.AppendL( vtBitmap );
+ iSources.AppendL( vtBitmap2 );
+ CleanupStack::Pop( KVtEngTargetBitmapCount ); // vtBitMaps
+ }
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL create targets" )
+ CVtImageBitmap* vtBitmapT = CVtImageBitmap::NewL( aSize, aDisplayMode );
+ CleanupStack::PushL( vtBitmapT );
+ CVtImageBitmap* vtBitmapT2 = CVtImageBitmap::NewL( aSize, aDisplayMode );
+ CleanupStack::PushL( vtBitmapT2 );
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL target reset" )
+ iTargets.ResetAndDestroy();
+ iTargets.AppendL( vtBitmapT );
+ iTargets.AppendL( vtBitmapT2 );
+ CleanupStack::Pop( KVtEngTargetBitmapCount ); // vtBitMapTs
+
+ __VTPRINTEXITR( "Scaler.ConfigureL %d", cancelled )
+ return cancelled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ScalingFinished
+// Callback telling that scaling is done.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ScalingFinished( TInt aError )
+ {
+ __VTPRINTENTER( "Scaler.ScalingFinished" )
+
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleFin ", aError )
+
+ if ( aError == KErrNone )
+ {
+ CFbsBitmap& bitmap = iTargets [ iTargetBitmapInUse ]->Bitmap();
+ __VTPRINT2( DEBUG_MEDIA, "Scaler.ScalingFin index", iTargetBitmapInUse )
+
+ if ( iTargetBitmapInUse == EFirstBitmap )
+ {
+ iTargetBitmapInUse = ESecondBitmap;
+ }
+ else
+ {
+ iTargetBitmapInUse = EFirstBitmap;
+ }
+ // Notify client of done scaling
+ iObserver.ScalingCompleted( &bitmap, aError );
+ }
+ else
+ {
+ iObserver.ScalingCompleted( NULL, aError );
+ }
+ __VTPRINTEXIT( "Scaler.ScalingFinished" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::~CVtEngImageScaler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngImageScaler::~CVtEngImageScaler()
+ {
+ __VTPRINTENTER( "Scaler.~" )
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:Dtor" )
+ iTargets.ResetAndDestroy();
+ iTargets.Close();
+ iSources.ResetAndDestroy();
+ iSources.Close();
+ delete iVtScaler;
+ __VTPRINTEXIT( "Scaler.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::CVtEngImageScaler
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngImageScaler::CVtEngImageScaler(
+ MVtEngScalerObserver& aObserver ) :
+ iObserver( aObserver ), iTargetBitmapInUse ( EFirstBitmap ),
+ iScalingMethod( CVtImageScaler::EWeightedAverage )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Release
+// Interface function implementation to delete the implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::Release()
+ {
+ // Delete myself
+ __VTPRINTENTER( "Scaler.Release" )
+ delete this;
+ __VTPRINTEXIT( "Scaler.Release" )
+ }
+
+// -----------------------------------------------------------------------------
+// VtEngScalerFactory::CreateScalerL
+// Creates the image scaler.
+// -----------------------------------------------------------------------------
+//
+MVtEngImageScaler* VtEngScalerFactory::CreateScalerL(
+ MVtEngScalerObserver& aObserver )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "VtEngScalerFactory::CreateScalerL" )
+ return CVtEngImageScaler::NewL( aObserver );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Cancel
+// Cancels the conversion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngImageScaler::Cancel()
+ {
+ __VTPRINTENTER( "Scaler.Cancel" )
+ iVtScaler->Cancel();
+ __VTPRINTEXIT( "Scaler.Cancel" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::GetScalingMethodL
+// Gets the used scaling method from local variation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::GetScalingMethodL()
+ {
+ __VTPRINTENTER( "Scaler.GetScalingMethodL" )
+ // Check if the scaling method is non-default
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ if( settings.CheckBits(
+ KVTLVFlagScalingMethodENearest ) )
+ {
+ iScalingMethod = CVtImageScaler::ENearest;
+ }
+ else if ( settings.CheckBits(
+ KVTLVFlagScalingMethodEBilinear ) )
+ {
+ iScalingMethod = CVtImageScaler::EBilinear;
+ }
+ __VTPRINTEXITR( "Scaler.GetScalingMethodL %d", (TInt) iScalingMethod )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngLocalVideo.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,4796 @@
+/*
+* Copyright (c) 2004-2007 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: Local video configuration
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngLocalVideo.h"
+#include "CVtEngMediaHandler.h"
+#include "VtEngPanic.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngEventManager.h"
+#include "MVtEngMedia.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "VtEngEvents.h"
+#include <videotelephonydomainpskeys.h>
+#include <videotelephonyvariant.hrh>
+#include <capivideosource.h>
+#include <cvtlogger.h>
+#include <mvtprotocolhandler.h>
+#include <fbs.h>
+#include <w32std.h>
+#include <graphics/suerror.h>
+#include <graphics/surfaceconfiguration.h>
+
+#include "CVtEngCameraPreferences.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// Maximum count of providers stored (cameras, still, blank)
+const TInt KVtEngProviderCountMax = 4;
+
+// Max zoom step count.
+const TInt KVtMaxZoomStep = 10;
+
+// If prepare camera is called when provider is ready signal
+// immediately back with positive value.
+const TInt KVtEngAlreadySelected = 1;
+
+// If source is already active signal with this.
+const TInt KVtEngAlreadyActive = 2;
+
+// Number of providers buffered in image sharer
+const TInt KVtEngNumProvidersBuffered = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngLocalVideo
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngLocalVideo(
+ CVtEngMediaHandler& aObserver )
+
+ /** priority is high to ensure that this AO gets scheduled as soon as
+ * possible after signaling. If local video is requested a service, e.g.
+ * source switch while its signaled but not yet scheduled, local video's
+ * internal state may be compromised (signal AO => start selecting new source
+ * => RunL [this would break ongoing source selection]
+ */
+ : CActive( EPriorityHigh ),
+ iRenderingMethod( EUnspecified ),
+ iObserver( aObserver ),
+ iCurrentCamera( MVtEngMedia::ESecondaryCamera ),
+ iLayoutChangeHandler( *this )
+ {
+ ResetIndices();
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.c++")
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ConstructL()
+ {
+ __VTPRINTENTER( "LocVideo.ConstructL" )
+
+ iAsyncCallBack = new ( ELeave ) CAsyncCallBack(
+ TCallBack( CallBackFunc, this ), EPriorityStandard );
+
+ iNGARender = CVtEngVFBitmapNGARender::NewL();
+
+ TInt indexMobile( KErrNotFound );
+ iShareImage = CVtEngShareImage::NewL( *this );
+ iSourceController = CVSController::NewL( this );
+ iVideoProviders =
+ new ( ELeave ) CArrayFixFlat<TProviderItem>( KVtEngProviderCountMax );
+ iSource = iSourceController->CreateDataSourceL( this );
+ PauseVideoSending();
+ TInt providers( iSourceController->ProvidersAvailable() );
+ iNumSupportedCameras = providers - 1;
+ ResetIndices();
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.providers=%d",providers)
+ // Get the device specified default camera.
+ TInt cameraId( iCurrentCamera );
+ TInt err( SetCameraTrackingL( cameraId ) );
+ if ( err == KErrNone && cameraId != EPSPreferredCameraUnknown )
+ {
+ // Only if valid camera.
+ iCurrentCamera = MapCameraInternally( cameraId );
+ err = KErrAlreadyExists;
+ }
+
+ while ( providers-- )
+ {
+ CVSDataProvider* provider = NULL;
+ TRAP_IGNORE( provider =
+ iSourceController->CreateDataProviderL( providers, this, iSource ) );
+ if ( provider )
+ {
+ CleanupStack::PushL( provider );
+ TProviderItem item;
+ TVSDataProviderInfo info;
+ provider->ProviderInfo( info );
+ TBool destroy( ETrue );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Orient=%d",
+ info.iOrientation )
+ switch ( info.iOrientation )
+ {
+ case TCameraInfo::EOrientationInwards:
+ SetFlag( EFlagCamera1Available );
+ item.iType = KVtEngProviderCam1;
+ if ( err != KErrAlreadyExists )
+ {
+ // Set only if value not obtained from PubSub
+ iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+ }
+ iProviderInfoIndexCam1 = providers;
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL ID C1=%d",
+ iProviderInfoIndexCam1 )
+ break;
+ case TCameraInfo::EOrientationOutwards:
+ // Configures outwards camera, it is treated as camera 1
+ // if there is only one camera in the device.
+ ConfigureOutwardsCameraItem( item, providers );
+ break;
+ case TCameraInfo::EOrientationMobile:
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Mobile")
+ item.iType = KVtEngProviderTempImage;
+ indexMobile = providers;
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Mobile ID=%d",
+ indexMobile )
+ break;
+ case TCameraInfo::EOrientationUnknown:
+ {
+ item.iType = KVtEngProviderImage;
+ item.iProvider = provider;
+ item.iProviderState = EPermanent;
+ destroy = EFalse; // don't delete still provider
+ CreateBlankProviderL( providers );
+
+ if ( CVtEngUtility::Settings().
+ IsDefaultStillImageDefined() )
+ {
+ CreateDefaultStillImageProviderL( providers );
+ }
+
+ iProviderInfoIndexStill = providers;
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT,
+ "LocVideo.ConL ID Still=%d",iProviderInfoIndexStill )
+ }
+ break;
+ default:
+ break;
+ }
+ iVideoProviders->AppendL( item );
+ CleanupStack::Pop();
+ if ( destroy )
+ {
+ delete provider;
+ provider = NULL;
+ }
+ }
+ }
+ iObserver.SetSelectedCameraId( iCurrentCamera );
+ // Check if mobile is there, and either 1 or 2 is not.
+
+ if ( indexMobile != KErrNotFound )
+ {
+ TProviderItem* item = NULL;
+ const TInt err = GetProviderByType( KVtEngProviderTempImage, item );
+ __ASSERT_ALWAYS( err != KErrNotFound,
+ Panic( EVtEngPanicInvalidInitializationState ) );
+ if ( iProviderInfoIndexCam1 == KErrNotFound )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL Switch 1" )
+ item->iType = KVtEngProviderCam1;
+ iProviderInfoIndexCam1 = indexMobile;
+ SetFlag( EFlagCamera1Available );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL Switch 2" )
+ DeleteProvider( KVtEngProviderCam2 );
+ item->iType = KVtEngProviderCam2;
+ iProviderInfoIndexCam2 = indexMobile;
+ SetFlag( EFlagCamera2Available );
+ }
+ }
+ __VTPRINTEXIT( "LocVideo.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ConfigureOutwardsCameraItem
+// Creates providers item for outwards camera type. It is treated as
+// a) primary camera in single camera configurations
+// b) secondary camera in two camera configurations
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ConfigureOutwardsCameraItem(
+ TProviderItem& aItem,
+ const TInt aCurrentIndex )
+ {
+ __VTPRINTENTER( "LocVideo.ConfigureOutwardsCameraItem" )
+ if ( iNumSupportedCameras == 1 )
+ {
+ SetFlag( EFlagCamera1Available );
+ aItem.iType = KVtEngProviderCam1;
+ iProviderInfoIndexCam1 = aCurrentIndex;
+ iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.ConL ID C1=%d", iProviderInfoIndexCam1 )
+ }
+ else
+ {
+ SetFlag( EFlagCamera2Available );
+ aItem.iType = KVtEngProviderCam2;
+ iProviderInfoIndexCam2 = aCurrentIndex;
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.ConL ID C2=%d", iProviderInfoIndexCam2 )
+ }
+ __VTPRINTEXITR( "LocVideo.ConfigureOutwardsCameraItem iCurrentCamera=%d",
+ iCurrentCamera )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CallBackFunc
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CompleteOperation( const TInt aResult )
+ {
+ __VTPRINTENTER( "LocVideo.CompleteOperation" )
+ SetResult( aResult );
+ iAsyncCallBack->CallBack();
+ __VTPRINTEXITR( "LocVideo.CompleteOperation %d", aResult )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::VideoChannelOpenedL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::VideoChannelOpenedL()
+ {
+ __VTPRINTENTER( "LocVideo.VideoChannelOpenedL" )
+ if ( iDelayedSelect.IsDelayedSelectPending() )
+ {
+ SelectSourceL( iDelayedSelect.DelayedSelectTarget() );
+ }
+ __VTPRINTEXIT( "LocVideo.VideoChannelOpenedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CallBackFunc
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CallBackFunc( TAny* aPtr )
+ {
+ __VTPRINTENTER( "LocVideo.CallBackFunc" )
+ CVtEngLocalVideo* self = reinterpret_cast< CVtEngLocalVideo* >( aPtr );
+ TInt result( KErrNone );
+ TRAP( result,
+ self->iObserver.HandleLocalVideoOperationCompleteL(
+ self->Result() ) );
+ __VTPRINTEXITR( "LocVideo.CallBackFunc %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Result
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::Result() const
+ {
+ __VTPRINTENTER( "LocVideo.Result" )
+ __VTPRINTEXITR( "LocVideo.Result %d", iResult )
+ return iResult;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetResult
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetResult( const TInt aResult )
+ {
+ __VTPRINTENTER( "LocVideo.SetResult" )
+ iResult = aResult;
+ __VTPRINTEXITR( "LocVideo.SetResult %d", iResult )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo* CVtEngLocalVideo::NewL(
+ CVtEngMediaHandler& aObserver )
+ {
+ __VTPRINTENTER( "LocVid.NewL" )
+ CVtEngLocalVideo* self = new( ELeave )
+ CVtEngLocalVideo( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "LocVid.NewL" )
+ return self;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::~CVtEngLocalVideo
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::~CVtEngLocalVideo()
+ {
+ __VTPRINTENTER( "LocVid.~" )
+ // Cancel the object
+ if ( iActiveProvider )
+ {
+ iActiveProvider->DetachFromCameraPreferences();
+ }
+ if ( iAsyncCallBack )
+ {
+ iAsyncCallBack->Cancel();
+ delete iAsyncCallBack;
+ }
+ Cancel();
+ if ( iVideoProviders )
+ {
+ while ( iVideoProviders->Count() )
+ {
+ TProviderItem& item = (*iVideoProviders)[0];
+ CVSDataProvider* provider = item.iProvider;
+ delete provider;
+ iVideoProviders->Delete( 0 );
+ }
+ delete iVideoProviders;
+ }
+
+ delete iCameraListener;
+ iCameraListener = NULL;
+
+ delete iSource;
+ delete iSourceController;
+ DeleteAudioSource();
+ delete iShareImage;
+
+ delete iNGARender;
+
+ __VTPRINTEXIT( "LocVid.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderError
+// Handles error in provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderError( TInt aError )
+ {
+ if( aError == KErrCancel )
+ {
+ vsProviderReady();
+ return;
+ }
+ __VTPRINTENTER( "LocVid.vsProviderError" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.ProviderError=%d", aError )
+ iInitializingProvider = NULL;
+ if ( aError != KErrNone )
+ {
+ iShareImage->Error( aError );
+ if ( !iLayoutChangeHandler.ProviderError( aError ) )
+ {
+ const TState previousState = iState;
+ iState = ELocNone;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO NONE" )
+
+ // If the error indicates that camera is in use
+ if ( aError == KErrInUse && previousState == ELocInitializing )
+ {
+ // Store the error to be used later
+ if( iSelectedProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError in use")
+ iSelectedProvider->iErrorCode = aError;
+ if ( iSelectedProvider->iType == KVtEngProviderCam1 )
+ {
+ ClearFlag( EFlagCamera1Available );
+ }
+ else if ( iSelectedProvider->iType == KVtEngProviderCam2 )
+ {
+ ClearFlag( EFlagCamera2Available );
+ }
+ }
+ }
+ // Camera has been lost
+ if ( aError == KVsErrCameraNoLongerReserved )
+ {
+ if ( !IsActive() )
+ {
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aError );
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError AO start" )
+ __VTPRINTEXITR(
+ "LocVid.vsProviderError err=%d", aError )
+
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError iSelectedProvider NULL" )
+ if ( iSelectedProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError iSelectedProvider NULL" )
+ iSelectedProvider->iInitialized = EFalse;
+ iSelectedProvider->iProviderState =
+ (CVtEngLocalVideo::TProviderState) aError;
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError iSelectedProvider NULL" )
+ }
+ return;
+ }
+ }
+ if ( iSelectedProvider )
+ {
+ // Try to select the last known to function camera
+ if ( iSelectedProvider->iType == KVtEngProviderCam1 ||
+ iSelectedProvider->iType == KVtEngProviderCam2 )
+ {
+ if ( !IsActive() )
+ {
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aError );
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.ProviderError AO start" )
+ __VTPRINTEXITR(
+ "LocVid.vsProviderError err=%d", aError )
+ return;
+ }
+ }
+ //Error code needed later
+ iSelectedProvider->iInitialized = EFalse;
+ iSelectedProvider->iProviderState =
+ (CVtEngLocalVideo::TProviderState) aError;
+ iSelectedProvider = NULL;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ " selected provider nulled" )
+ }
+ else if ( iActiveProvider &&
+ !IsFlag( EFlagInitializeOnly ) &&
+ previousState == ELocSwichingProvider )
+ {
+ iActiveProvider = iFadingProvider;
+ iFadingProvider = NULL;
+ }
+ if ( IsFlag( EFlagSignalSourceSelection ) )
+ {
+ ClearFlag( EFlagSignalSourceSelection );
+ TRAP_IGNORE(
+ iObserver.HandleLocalVideoOperationCompleteL( aError ) );
+ }
+ }
+ }
+ __VTPRINTEXIT( "LocVid.vsProviderError" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderReady
+// Provider is ready to be taken into use.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderReady()
+ {
+ __VTPRINTENTER( "LocVid.vsProviderReady" )
+
+ __VTPRINT3( DEBUG_MEDIA, "LocVideo.ProviderReady state=%d, initOnly=%d",
+ iState, IsFlag( EFlagInitializeOnly ) )
+ const TState prevState( iState );
+
+ if ( iInitializingProvider )
+ {
+ iInitializingProvider->iInitialized = ETrue;
+
+ // Set camera flags in order to recover
+ // error situation (error occured during init)
+ if ( iInitializingProvider->iType == KVtEngProviderCam1 )
+ {
+ __VTPRINT( DEBUG_MEDIA, " LocVid.vsProviderReady KVtEngProviderCam1" )
+ SetFlag( EFlagCamera1Available );
+ }
+ else if ( iInitializingProvider->iType == KVtEngProviderCam2 )
+ {
+ __VTPRINT( DEBUG_MEDIA, " LocVid.vsProviderReady KVtEngProviderCam2" )
+ SetFlag( EFlagCamera2Available );
+ }
+
+ iInitializingProvider = NULL;
+ }
+
+ iState = ELocReady;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+
+ if ( iLayoutChangeHandler.ProviderReady() )
+ {
+ __VTPRINTEXIT( "LocVid.vsProviderReady" )
+ return;
+ }
+
+ if ( prevState == ELocInitializing && !IsFlag( EFlagInitializeOnly ) )
+ {
+ TProviderItem* switchTo = iActiveProvider;
+ if ( iSelectedProvider )
+ {
+ iSelectedProvider->iErrorCode = KErrNone;
+ switchTo = iSelectedProvider;
+ iSelectedProvider = NULL;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider nulled" )
+ }
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.ProviderReady switching")
+ SwitchProvider( switchTo );
+ __VTPRINTEXIT( "LocVid.vsProviderReady" )
+ return;
+ }
+ else
+ {
+ iSelectedProvider = NULL;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Selected provider nulled, UDS" )
+ UpdateState();
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.vsProviderReady KVtEngSourceCapsChanged")
+ CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+ }
+
+ if ( IsFlag( EFlagSignalSourceSelection ) )
+ {
+ ClearFlag( EFlagSignalSourceSelection );
+ TRAP_IGNORE( iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+ }
+ __VTPRINTEXIT( "LocVid.vsProviderReady" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderSwitchDone
+// Provider switched.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderSwitchDone( CVSDataProvider* aOldProvider )
+ {
+ __VTPRINTENTER( "LocVid.vsProviderSwitchDone" )
+ iState = ELocReady;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+
+ iFadingProvider = NULL;
+
+ if ( iActiveProvider && iActiveProvider->iProvider )
+ {
+ iActiveProvider->iProvider->ProviderInfo( iProviderInfo );
+ TInt error( iActiveProvider->RestoreZoomFactor() );
+ if ( error )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVid.vsProviderSwitchDone restoring stored zoom FAILED %d",
+ error )
+ }
+ }
+
+ iShareImage->ProviderSwitchDone( aOldProvider );
+
+ if ( iActiveProvider && iActiveProvider->iType == KVtEngProviderCam1 )
+ {
+ iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+ iObserver.SetSelectedCameraId( iCurrentCamera );
+ }
+ else if ( iActiveProvider && iActiveProvider->iType == KVtEngProviderCam2 )
+ {
+ iCurrentCamera = MVtEngMedia::ESecondaryCamera;
+ iObserver.SetSelectedCameraId( iCurrentCamera );
+ }
+
+ // Let layout change handler handle providerswitch
+ if ( iLayoutChangeHandler.ProviderSwitchDone( aOldProvider ) )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngLCHProviderSwitchDone );
+ __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+ return;
+ }
+
+ ClearFlag( EFlagFrozen );
+
+ // If initilization of the waiting provider fails fall back to the last one.
+ TVtEngProviderType backupProviderType( KVtEngProviderNone );
+
+ // Delete non-permanent old provider
+ const TInt indexI( ProviderIndexByInstance( aOldProvider ) );
+
+ // delete provider that became unavailable
+ if ( indexI != KErrNotFound )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.providerSwitchDone indexInstance=%d", indexI )
+ TProviderItem& item( ( *iVideoProviders )[ indexI ] );
+ if ( item.iProviderState != EPermanent &&
+ item.iProviderState != ERefreshing )
+ {
+ DeleteProvider( item );
+ }
+ }
+
+ // Uninitialize fading provider
+ const TInt indexF = ProviderIndexByState( EFading );
+ if ( indexF != KErrNotFound )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.providerSwitchDone fading indexFading=%d", indexF )
+ TProviderItem& item = (*iVideoProviders)[indexF];
+
+ // Mark up type of the last provider.
+ backupProviderType = item.iType;
+
+ DeleteProvider( item );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.providerSwitchDone fading=%d", item.iType )
+ TRAP_IGNORE( item.iProvider = CreateDataProviderL( item.iType ) );
+ }
+
+ // Initialize waiting provider
+ TInt err( KErrNone );
+ const TInt indexW( ProviderIndexByState( EWaiting ) );
+ if ( indexW != KErrNotFound )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.providerSwitchDone waiting=%d", indexW )
+ TProviderItem& item = (*iVideoProviders)[indexW];
+ item.iProviderState = EUndefined;
+ TRAP( err, InitializeProviderL( item ) );
+ if ( err == KErrNone)
+ {
+ iSelectedProvider = &item;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+ backupProviderType = KVtEngProviderNone;
+ }
+ else
+ {
+ iState = ELocNone;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO NONE" )
+ __VTPRINT2( DEBUG_MEDIA, "failed initializing provider=%d", err )
+ // If initialization failed indicate that provider is not available
+ if ( item.iType == KVtEngProviderCam1 )
+ {
+ ClearFlag( EFlagCamera1Available );
+ }
+ else if ( item.iType == KVtEngProviderCam2 )
+ {
+ ClearFlag( EFlagCamera2Available );
+ }
+ else if( item.iType == KVtEngProviderShareImage )
+ {
+ iShareImage->Error( err );
+ }
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ }
+
+ // Reconstruct refreshing (new still image) provider.
+ const TInt indexR( ProviderIndexByState( ERefreshing ) );
+ if ( indexR != KErrNotFound )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.providerSwitchDone refreshing")
+ TProviderItem& item = (*iVideoProviders)[indexR];
+ DeleteProvider( item );
+
+ // If still image disabled in settings.
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ const TBool stillImageValid( config.iVideo.iImageIsValid );
+ TRAP( err,
+ {
+ item.iProvider = CreateDataProviderL( item.iType );
+ if ( stillImageValid )
+ {
+ InitializeProviderL( item );
+ }
+ else
+ {
+ item.iProviderState = EPermanent; // change back to original
+ }
+ } );
+ if ( err == KErrNone && stillImageValid )
+ {
+ iSelectedProvider = &item;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+ }
+ else
+ {
+ iState = ELocNone;
+ __VTPRINT2( DEBUG_MEDIA, " STATE TO NONE initerr=%d", err )
+ }
+ }
+
+ // If we have delayed select pending -> initiate new switch and return
+ if ( iDelayedSelect.IsDelayedSelectPending() )
+ {
+ ClearFlag( EFlagCheckRevertToPrevious );
+ TVtEngProviderType pending = iDelayedSelect.DelayedSelectTarget();
+ __VTPRINT2( DEBUG_MEDIA, " delayed select pending type = %d", pending )
+ if( iActiveProvider && iActiveProvider->iType == pending )
+ {
+ // clear the iDelayedSelect to KVtEngProviderUndefined
+ // and no need to select again,continue complete this vsProviderSwitchDone
+ iDelayedSelect.DelayedSelectTarget();
+ }
+ else
+ {
+ TRAP_IGNORE( SelectSourceL( pending ) );
+ __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+ return;
+ }
+ }
+
+ if ( IsFlag( EFlagSignalSourceSelection ) &&
+ iState != ELocInitializing && // Set in InitializeProviderL if called
+ err == KErrNone && // but not if init (or create provider in
+ // there) failed.
+ !IsFlag( EFlagCheckRevertToPrevious ) )
+ {
+ // Signal only if we're in final state (i.e. not if blank provider
+ // was switched and just started initializing a camera).
+ ClearFlag( EFlagSignalSourceSelection );
+ TRAP_IGNORE( iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+ }
+ else if ( IsFlag( EFlagCheckRevertToPrevious ) &&
+ ( iState == ELocReady || iState == ELocNone ) )
+ {
+ ClearFlag( EFlagCheckRevertToPrevious );
+ MVtEngMedia::TCameraId currentCam( MVtEngMedia::EPrimaryCamera );
+ iObserver.GetCurrentCameraId( currentCam );
+ backupProviderType =
+ ( currentCam==MVtEngMedia::EPrimaryCamera ) ?
+ KVtEngProviderCam1 : KVtEngProviderCam2;
+ }
+
+ __VTPRINT2( DEBUG_MEDIA, " switch done iState=%d", iState )
+
+ //Inform camera preferences that valid provider is set
+ // Check that valid provider exist
+ // and set it as provider to camera
+ // preferences
+ if ( iActiveProvider )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "switch done prov.state=%d",
+ iActiveProvider->iProviderState )
+ // Set provider to camera preferences
+ // only if camera preferences exist
+ if ( iCameraPref)
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.providerSwitchDone iCameraPref->SetProvider type=%d",
+ iActiveProvider->iType )
+ iCameraPref->SetProvider( iActiveProvider->iProvider,
+ *iActiveProvider );
+
+ TInt error( iActiveProvider->RestorePreferences() );
+ if ( error )
+ {
+ __VTPRINT2( DEBUG_MEDIA, " restoring preferences FAILED %d",
+ error )
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.providerSwitchDone camera pref not created" )
+ }
+ }
+
+ if ( IsFlag( EFlagInitialized ) && iState != ELocInitializing )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.providerSwitchDone KVtEngSourceCapsChanged" )
+ CVtEngEventManager::NotifyEvent( KVtEngSourceChanged );
+ }
+
+ TRAP( err, StartViewFinderIfWasStartedL() ); // err is ignored
+
+ if ( backupProviderType != KVtEngProviderNone )
+ {
+ // Initialization of new provider failed,
+ // try reverting back to last one.
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.providerSwitchDone revert to %d", backupProviderType )
+ TRAP( err, SelectSourceL( backupProviderType ) );
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ }
+
+ __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsViewFinderFrameReady
+// View finder image can be set.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsViewFinderFrameReady( CFbsBitmap& aFrame )
+ {
+ __VTPRINTENTER( "LocVid.vsViewFinderFrameReady" )
+ if ( iActiveProvider &&
+ iActiveProvider->iType != KVtEngProviderNone )
+ {
+#if 0
+ TRAP_IGNORE( iOptions.iObserver->vtHandleFrameL(
+ MVtEngFrameObserver::ELocalVideoFrame, &aFrame ) );
+#endif
+ iNGARender->UpdateBitmapL( aFrame );
+ }
+ __VTPRINTEXIT( "LocVid.vsViewFinderFrameReady" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProvidersChanged
+// Provider state has changed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProvidersChanged( TBool aAttached )
+ {
+ __VTPRINTENTER( "LocVid.vsProvidersChanged" )
+
+ __VTPRINT2( DEBUG_MEDIA, " vsProvidersChanged attached=%d", aAttached )
+ __VTPRINT2( DEBUG_MEDIA, " vsProvidersChanged state=%d",iState )
+ if ( iAudioSource == NULL )
+ {
+ // If this is called from ConstructL (indirectly) return immediately
+ if ( aAttached || iCurrentCamera == MVtEngMedia::EPrimaryCamera )
+ {
+ SetFlag( EFlagCamera1Available );
+ iObserver.SetSelectedCameraId( MVtEngMedia::EPrimaryCamera, ETrue );
+ }
+ else
+ {
+ ClearFlag( EFlagCamera1Available );
+ iObserver.SetSelectedCameraId(
+ MVtEngMedia::ESecondaryCamera, ETrue );
+ }
+ __VTPRINTEXIT( "LocVid.vsProvidersChanged" )
+ return;
+ }
+
+ // If primary camera was not available and state is not "open"
+ // UI should be requested for answer. Precondition is also that
+ // primary camera is now available.
+ TBool notifyAnswer( EFalse );
+ TInt activeMedia( 0 );
+
+ const MVtEngSessionInfo::TSessionState state(
+ CVtEngUtility::StateManager()->SessionState() );
+
+ __VTPRINT2( DEBUG_MEDIA, " vsProvidersChanged, call state=%d", state )
+ if ( state == MVtEngSessionInfo::EReceiving )
+ {
+ __VTPRINT2( DEBUG_MEDIA, " vsProvidersChanged attached=%d", aAttached )
+ if ( !IsFlag( EFlagCamera1Available ) && aAttached )
+ {
+ notifyAnswer = ETrue;
+ }
+ }
+
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged answer=%d", notifyAnswer )
+ CVtEngLocalVideo::TVtEngProviderType providerToSelect( KVtEngProviderNone );
+ TRAPD( err, providerToSelect = UpdateAvailableProvidersL() );
+ if ( err == KErrNone )
+ {
+ // Now get the state to check if video has been disabled
+ GetMediaState( activeMedia );
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged mediastate=%d", activeMedia )
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged iState=%d", iState )
+
+ // values for checking if switch is allowed
+ TBool activeIsStillOrBlank ( EFalse );
+ TBool activeIsBlankAndNewCam1( EFalse );
+ if ( iActiveProvider )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged iActivePType=%d", iActiveProvider->iType )
+ if ( iActiveProvider->iType == KVtEngProviderImage ||
+ iActiveProvider->iType == KVtEngProviderNone )
+ {
+ activeIsStillOrBlank = ETrue;
+ if ( providerToSelect == KVtEngProviderCam1 &&
+ iActiveProvider->iType == KVtEngProviderNone )
+ {
+ activeIsBlankAndNewCam1 = ETrue;
+ }
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged blank active new cam1=%d",
+ activeIsBlankAndNewCam1 )
+
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged provider=%d", providerToSelect )
+
+ if ( providerToSelect == KVtEngProviderCam1 )
+ {
+ iObserver.SetSelectedCameraId( MVtEngMedia::EPrimaryCamera );
+ }
+ else if ( providerToSelect == KVtEngProviderCam2 )
+ {
+ // delete provider that became unavailable
+ iObserver.SetSelectedCameraId( MVtEngMedia::ESecondaryCamera );
+ }
+
+ // Check if SelectSource should be called
+ if ( !notifyAnswer && // for incoming calls automatic switch not allowed
+ ( iState == ELocNone || iState == ELocReady ) &&
+ IsFlag( EFlagInitialized ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, " vsProvidersChanged ok to select" )
+ // Allow switch if video disabled (still/blank active)
+ // and cam1 available.
+ ClearFlag( EFlagInitializeOnly );
+ ClearFlag( EFlagCheckRevertToPrevious );
+ if ( activeIsStillOrBlank &&
+ providerToSelect == KVtEngProviderCam2 )
+ {
+ SetFlag( EFlagInitializeOnly );
+ }
+ else if ( activeIsBlankAndNewCam1 )
+ {
+ iObserver.AutoEnableVideo();
+ }
+ else if ( providerToSelect == KVtEngProviderNone )
+ {
+ iObserver.AutoEnableVideo( EFalse );
+ }
+ SetFlag( EFlagAutomaticSwitchCallback );
+ TRAP( err, SelectSourceL( providerToSelect ) );
+ ClearFlag( EFlagAutomaticSwitchCallback );
+
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ " vsProvidersChanged,select failed=%d", err )
+ if ( providerToSelect == KVtEngProviderCam1 &&
+ iNumSupportedCameras > 1 )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.vsProvidersChanged 2 2" )
+ SetFlag( EFlagCamera2Available );
+ ClearFlag( EFlagCamera1Available );
+ TRAP( err, SelectSourceL( KVtEngProviderCam2 ) );
+ }
+ else if ( providerToSelect == KVtEngProviderCam2 )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.vsProvidersChanged 2 still")
+ ClearFlag( EFlagCamera2Available );
+ TRAP( err, SelectSourceL( KVtEngProviderImage ) );
+ }
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, " vsProvidersChanged Not Changed" )
+ if ( iState == ELocInitializing &&
+ iSelectedProvider &&
+ iSelectedProvider->iType != providerToSelect )
+ {
+ SetFlag( EFlagCheckRevertToPrevious );
+ }
+ }
+
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update();
+
+ if ( IsFlag( EFlagCamera1Available ) ||
+ IsFlag( EFlagCamera2Available ) )
+ {
+ if ( notifyAnswer )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.vsProvidersChanged KVtEngSessionAnswerPossible")
+ CVtEngEventManager::NotifyEvent( KVtEngSessionAnswerPossible );
+ }
+ else if ( !notifyAnswer &&
+ // Don't notify before selection is done.
+ ( iState == ELocReady ||
+ iState == ELocNone ) )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.vsProvidersChanged KVtEngSourceCapsChanged" )
+ CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+ }
+ }
+ else if ( !IsFlag( EFlagCamera1Available ) &&
+ !IsFlag( EFlagCamera2Available ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.vsProvidersChanged NO CAMS" )
+ CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.vsProvidersChanged KVtEngResourceMemAllocFailure" )
+ CVtEngEventManager::NotifyEvent( KVtEngResourceMemAllocFailure );
+ }
+ __VTPRINTEXITR( "LocVid.vsProvidersChanged err=%d", err )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering via window server.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+ const TVtEngRenderingOptions& aParams )
+ {
+ __VTPRINTENTER( "LocVid.SetViewFinderParameters" )
+
+ // Before setting the params, stop VF
+ if( ViewFinderStarted() )
+ {
+ StopViewFinder();
+ }
+
+ iOptions.iSize = aParams.iSize;
+ __VTPRINT2( DEBUG_MEDIA,
+ " width = %d", iOptions.iSize.iWidth );
+ __VTPRINT2( DEBUG_MEDIA,
+ " height = %d", iOptions.iSize.iHeight );
+
+ iOptions.iObserver = aParams.iObserver;
+ iRenderingMethod = EWindowServer;
+ __VTPRINTEXIT( "LocVid.SetViewFinderParameters" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering with direct screen access.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+ const TVtEngRenderingOptionsDSA& aDSA )
+ {
+ __VTPRINTENTER( "LocVid.SetVFParamsDSA" )
+
+ // Before setting the params, stop VF
+ if( ViewFinderStarted() )
+ {
+ StopViewFinder();
+ }
+
+ iRenderingMethod = EDSA;
+ iDsaOptions.iClipRect = aDSA.iClipRect;
+ iDsaOptions.iRect = aDSA.iRect;
+ iDsaOptions.iWindow = &aDSA.iWindow;
+ iDsaOptions.iWs = &aDSA.iWs;
+ iDsaOptions.iWsSD = &aDSA.iWsSD;
+ __VTPRINTEXIT( "LocVid.SetVFParamsDSA" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering with display posting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+ const TVtEngRenderingOptionsDP& aDP )
+ {
+ __VTPRINTENTER( "LocVid.SetVFParamsDP" )
+
+ // Before setting the params, stop VF
+ if( ViewFinderStarted() )
+ {
+ StopViewFinder();
+ }
+
+ iRenderingMethod = EDP;
+ iDsaOptions.iClipRect = aDP.iClipRect;
+ iDsaOptions.iRect = aDP.iRect;
+ iDsaOptions.iWindow = &aDP.iWindow;
+ iDsaOptions.iWs = &aDP.iWs;
+ iDsaOptions.iWsSD = &aDP.iWsSD;
+ __VTPRINTEXIT( "LocVid.SetVFParamsDP" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering with NGA.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+ const TVtEngRenderingOptionsNGA &aNGA )
+ {
+ __VTPRINTENTER( "LocVid.SetVFParamsNGA" )
+
+ // Before setting the params, stop VF
+ if( ViewFinderStarted() )
+ {
+ StopViewFinder();
+ }
+
+ iOptions.iSize.SetSize( KVtEngLocalVideoDefaultWidth,
+ KVtEngLocalVideoDefaultHeight );
+
+ iWindow = &aNGA.iWindow;
+ iWs = &aNGA.iWs;
+
+ iRenderingMethod = EWindowServer;
+
+ iNGARender->AttachSurfaceL( iWs, iWindow );
+ __VTPRINTEXIT( "LocVid.SetVFParamsNGA" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetDefaultStillImageL
+// Sets default still image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetDefaultStillImageL()
+ {
+ __VTPRINTENTER( "LocVid.SetDefaultStillImageL" )
+
+ TProviderItem* item = NULL;
+ GetProviderByType( KVtEngProviderDefaultStillImage, item );
+ if ( item )
+ {
+ CVSDataProvider* provider = item->iProvider;
+
+ if ( provider && item->iType == KVtEngProviderDefaultStillImage )
+ {
+ if ( item->iInitialized )
+ {
+ StopViewFinder();
+
+ TInt providerIndex =
+ ProviderIndex( KVtEngProviderDefaultStillImage );
+
+ TProviderItem* defaultStillProviderItem =
+ &( *iVideoProviders )[providerIndex];
+ SwitchProvider( defaultStillProviderItem );
+ }
+ else
+ {
+ InitializeProviderL( *item );
+ iSelectedProvider = item;
+ }
+ }
+ }
+ __VTPRINTEXIT( "LocVid.SetDefaultStillImageL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetStillImageL
+// Sets still image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetStillImageL( TBool aSetAsActive )
+ {
+ __VTPRINTENTER( "LocVid.SetStillImageL" )
+
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ const TBool stillImageValid( config.iVideo.iImageIsValid );
+ if ( iState == ELocInitializing && stillImageValid )
+ {
+ __VTPRINT( DEBUG_MEDIA, " setStill failed" )
+ User::Leave( KErrNotReady );
+ }
+
+ TInt count( iVideoProviders->Count() );
+ TBool done( EFalse );
+ while ( count-- )
+ {
+ TProviderItem& item = ( *iVideoProviders )[count];
+ CVSDataProvider* provider = item.iProvider;
+
+ if ( item.iType == KVtEngProviderImage )
+ {
+ if ( provider && item.iInitialized )
+ {
+ // If still image provider is active change to temp provider
+ if ( iActiveProvider &&
+ ( iActiveProvider->iType == KVtEngProviderImage ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "Act.prov. must be deleted" )
+ StopViewFinder();
+ iActiveProvider->iProviderState = ERefreshing;
+ TInt providerIndex = ProviderIndex( KVtEngProviderNone );
+ TProviderItem* blankProviderItem =
+ &( *iVideoProviders )[providerIndex];
+ SwitchProvider( blankProviderItem );
+ __VTPRINTEXIT( "LocVideo.SetStillImageL" )
+ return;
+ }
+
+ //Only way to change image is first delete the provider
+ delete provider;
+ item.iProvider = NULL;
+
+ // Create it again.
+ // If there is a provider info for still.
+ if ( iProviderInfoIndexStill != KErrNotFound )
+ {
+ item.iProvider = iSourceController->CreateDataProviderL(
+ iProviderInfoIndexStill,
+ this, iSource );
+ item.iType = KVtEngProviderImage;
+ item.iInitialized = EFalse;
+ }
+ }
+ // Do initialization only if valid image (still not
+ // cleared in settings).
+ if ( stillImageValid )
+ {
+ InitializeProviderL( item );
+ if ( aSetAsActive )
+ {
+ iSelectedProvider = &item;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ " selected provider set" )
+ }
+ }
+ done = ETrue;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.SetStillImageL ok" )
+ }
+ }
+ if ( !done )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SetStillImageL fail")
+ User::Leave( KErrGeneral );
+ }
+ __VTPRINTEXIT( "LocVid.SetStillImageL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeL
+// Initializes default blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeL()
+ {
+ __VTPRINTENTER( "LocVid.InitializeL" )
+ const TInt index( ProviderIndex( KVtEngProviderNone ) );
+ TProviderItem* item = &(*iVideoProviders)[index];
+ if ( iActiveProvider &&
+ iActiveProvider->iType == KVtEngProviderImage )
+ {
+ // Blank provider is set to active only
+ // if there is not valid still image.
+ SetFlag( EFlagInitializeOnly );
+ iSelectedProvider = item;
+ }
+ else
+ {
+ iActiveProvider = item;
+ }
+ InitializeProviderL( *item );
+ SetFlag( EFlagSignalSourceSelection );
+ SetFlag( EFlagInitialized );
+ __VTPRINTEXIT( "LocVid.InitializeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SelectSourceL
+// Selects source.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::SelectSourceL( TVtEngProviderType aSource )
+ {
+ __VTPRINTENTER( "LocVid.SelectSourceL" )
+
+ __VTPRINT2( DEBUG_MEDIA, " source=%d", aSource )
+
+ if ( iDelayedSelect.IsDelayedSelectPending() &&
+ ( aSource != KVtEngProviderShareImage ) &&
+ ( aSource == KVtEngProviderCam1 ||
+ aSource == KVtEngProviderCam2 ||
+ aSource == KVtEngProviderImage ) )
+ {
+ TVtEngProviderType delayedSelect( iDelayedSelect.DelayedSelectTarget() );
+ if ( delayedSelect != KVtEngProviderNone &&
+ delayedSelect != KVtEngProviderImage )
+ {
+ aSource = delayedSelect;
+ }
+ }
+
+ if( IsProviderWaiting( aSource ) )
+ {
+ // If waiting for provide switch and a provider initialization
+ // don't allow selection.
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSourceL already waiting" )
+ User::Leave( KErrNotReady );
+ }
+
+ // To be selected source is already active
+ if ( IsActiveProvider( aSource ) )
+ {
+ Cancel();
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete( status, KVtEngAlreadyActive );
+ SetFlag( EFlagSignalSourceSelection );
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSourceL start AO=%d",
+ KVtEngAlreadyActive )
+ if ( iActiveProvider )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo. activeProv type=%d",
+ iActiveProvider->iType )
+ }
+ // In case there were errors, NULL the selected provider
+ // to be able to initialize it when needed
+ if( iSelectedProvider )
+ {
+ if( iSelectedProvider->iErrorCode )
+ {
+ iSelectedProvider->iInitialized = EFalse;
+ iSelectedProvider->iProviderState =
+ (CVtEngLocalVideo::TProviderState)
+ iSelectedProvider->iErrorCode;
+ iSelectedProvider = NULL;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selprovider nulled" )
+ }
+ }
+ // Not actually switching but virtually doing it because
+ // async callback will be made.
+ __VTPRINTEXITR( "LocVid.SelectSourceL %d", ETrue )
+ return ETrue;
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.Selectsource iState=%d", iState )
+ if ( iState == ELocInitializing &&
+ aSource == KVtEngProviderImage &&
+ iActiveProvider &&
+ iActiveProvider->iType != KVtEngProviderNone )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.SelectSource initialization pending" )
+ User::Leave( KErrNotReady );
+ }
+ // We have switch pending
+ else if ( iState == ELocSwichingProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.SelectSource switching -> set delayed select" )
+ iDelayedSelect.NotifyDelayedSelect( aSource );
+ __VTPRINTEXITR( "LocVid.SelectSourceL %d", ETrue )
+ return ETrue;
+ }
+
+ TBool initialized( EFalse );
+ TProviderItem item;
+ TInt providerIndex( GetProviderByType( aSource, item ) );
+
+ if ( providerIndex != KErrNotFound )
+ {
+ // requested provider found, set initialization status
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSource index=%d", providerIndex )
+ initialized = item.iInitialized;
+ }
+ else
+ { // requested provider not found
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource create provider" )
+ // Try to create provider
+ TInt index = KErrNotFound;
+ switch ( aSource )
+ {
+ case KVtEngProviderCam2:
+ index = iProviderInfoIndexCam2;
+ break;
+ case KVtEngProviderNone:
+ case KVtEngProviderImage:
+ case KVtEngProviderDefaultStillImage:
+ // Image sharing
+ case KVtEngProviderShareImage:
+ index = iProviderInfoIndexStill;
+ break;
+ case KVtEngProviderCam1:
+ index = iProviderInfoIndexCam1;
+ default:
+ break;
+ }
+
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.SelectSource create provider ID=%d", index )
+ if ( index != KErrNotFound )
+ {
+ TProviderItem newItem;
+ newItem.iProvider =
+ iSourceController->CreateDataProviderL(
+ index, this, iSource );
+ newItem.iType = aSource;
+ CleanupStack::PushL( newItem.iProvider );
+ iVideoProviders->AppendL( newItem );
+ CleanupStack::Pop();
+ providerIndex = iVideoProviders->Count() - 1;
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.SelectSource create provider ok=%d",
+ newItem.iProvider != NULL )
+ }
+ }
+
+ TBool initOrSwitch = EFalse;
+
+ // Initialize provider
+ if ( providerIndex != KErrNotFound && !initialized )
+ {
+ if ( iActiveProvider->iProviderState != EPermanent )
+ {
+ // Active provider must be destroyed and new one initialized
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource del Act.prov" )
+ (*iVideoProviders)[providerIndex].iProviderState = EWaiting;
+ iActiveProvider->iProviderState = EFading;
+ StopViewFinder();
+ providerIndex = ProviderIndex( KVtEngProviderNone );
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSource index for none=%d",
+ providerIndex )
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource do init" )
+ UninitializeProviderL();
+ TProviderItem& initItem = ( *iVideoProviders )[providerIndex];
+ InitializeProviderL( initItem );
+ // This item is stored, make it initialized only when callback
+ // received.
+ iSelectedProvider = &initItem;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+ initOrSwitch = InitializingOrSwitching();
+ __VTPRINTEXITR( "LocVid.SelectSourceL %d", initOrSwitch )
+ return initOrSwitch;
+ }
+ }
+
+ // Switch provider
+ if ( providerIndex != KErrNotFound )
+ {
+ if ( !IsFlag( EFlagInitializeOnly ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource ready for switch")
+ StopViewFinder();
+ TProviderItem* switchItem = &(*iVideoProviders)[providerIndex];
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.SelectSource switchItem %d", switchItem->iType )
+ SwitchProvider( switchItem );
+ }
+ else if ( initialized && IsFlag( EFlagInitializeOnly ) )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.SelectSource already initialized start AO %d",
+ KVtEngAlreadySelected )
+ TProviderItem* switchItem = &( *iVideoProviders )[providerIndex];
+ iActiveProvider = switchItem;
+ Cancel();
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete( status, KVtEngAlreadySelected );
+ }
+ else
+ {
+ __VTPRINT3( DEBUG_MEDIA, " initialized=%d,flags=%d",
+ initialized, iFlags )
+ }
+ }
+
+ // Error
+ if ( iActiveProvider == NULL )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource leave" )
+ User::Leave( KErrNotFound );
+ }
+
+ initOrSwitch = InitializingOrSwitching();
+ __VTPRINTEXITR( "LocVid.SelectSourceL %d", initOrSwitch )
+ return initOrSwitch;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeProviderL
+// Initializes a provider.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeProviderL(
+ TProviderItem& aProviderItem )
+ {
+ __VTPRINTENTER( "LocVid.InitializeProviderL" )
+
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d", aProviderItem.iType )
+
+ if ( iInitializingProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.InitProv ERROR, already initializing" )
+ User::Leave( KErrNotReady );
+ }
+
+ iInitializingProvider = &aProviderItem;
+
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ TPckgBuf< TVSStillImageDataProviderParams > pckg;
+
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d", aProviderItem.iType )
+ CVSDataProvider* provider = aProviderItem.iProvider;
+ if ( provider == NULL )
+ {
+ aProviderItem.iInitialized = EFalse;
+ aProviderItem.iProvider = CreateDataProviderL( aProviderItem.iType );
+ provider = aProviderItem.iProvider;
+ }
+ else if ( aProviderItem.iInitialized )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv AO start %d", KErrNone )
+ Cancel();
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete( status, KErrNone );
+ __VTPRINTEXIT( "LocVid.InitializeProviderL" )
+ return;
+ }
+ User::LeaveIfNull( provider );
+ switch ( aProviderItem.iType )
+ {
+ case KVtEngProviderCam1:
+ case KVtEngProviderCam2:
+ provider->InitializeL( KNullDesC8 );
+ iState = ELocInitializing;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+ aProviderItem.iType )
+ break;
+ case KVtEngProviderNone:
+ // Blank provider.
+ pckg().iInitialize =
+ TVSStillImageDataProviderParams::EInitializeAsBlankImage;
+ provider->InitializeL( pckg );
+ iState = ELocInitializing;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+ aProviderItem.iType )
+ break;
+ case KVtEngProviderImage:
+ {
+ if ( config.iVideo.iImageIsValid )
+ {
+ pckg().iInitialize =
+ TVSStillImageDataProviderParams::EInitializeFromGeneralSettings;
+ provider->InitializeL( pckg );
+ iState = ELocInitializing;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.InitProv Still image")
+ }
+ else
+ {
+ User::Leave( KErrPathNotFound );
+ }
+ }
+ break;
+ case KVtEngProviderDefaultStillImage:
+ pckg().iInitialize =
+ TVSStillImageDataProviderParams::EInitializeAsDefaultStillImage;
+
+ provider->InitializeL( pckg );
+ iState = ELocInitializing;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+ aProviderItem.iType )
+ break;
+ default:
+ Panic( EVtEngPanicNoVideoProvider );
+ break;
+ }
+ //aProviderItem.iInitialized = ETrue;
+ __VTPRINTEXIT( "LocVid.InitializeProviderL" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeShareProviderL
+// Initializes a provider that is used for sharing.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeShareProviderL(
+ TProviderItem& aProviderItem, const TDesC8& aParams )
+ {
+ __VTPRINTENTER( "LocVid.InitializeShareProviderL" )
+ aProviderItem.iProvider->InitializeL( aParams );
+ aProviderItem.iInitialized = ETrue;
+ iState = ELocInitializing;
+ SetFlag( EFlagSignalSourceSelection | EFlagInitializeOnly );
+ __VTPRINTEXIT( "LocVid.InitializeShareProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ReCreateProviderL
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::ReCreateProviderL(
+ TProviderItem& aProviderItem, const TVtEngProviderType aType )
+ {
+ __VTPRINTENTER( "LocVid.ReCreateProviderL" )
+
+ TInt index( KErrNotFound );
+
+ switch ( aType )
+ {
+ case KVtEngProviderShareImage:
+ index = iProviderInfoIndexStill;
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ }
+
+ // Delete old instance
+ DeleteProvider( aProviderItem );
+
+ // Create new instance
+ aProviderItem.iProvider = iSourceController->CreateDataProviderL(
+ index, this, iSource );
+ aProviderItem.iType = aType;
+
+ __VTPRINTEXIT( "LocVid.ReCreateProviderL" )
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::CameraIdToType
+// Camera ID to type mapping.
+// ----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::CameraIdToType(
+ MVtEngMedia::TCameraId aId )
+ {
+ TVtEngProviderType type( KVtEngProviderCam2 );
+ switch ( aId )
+ {
+ case MVtEngMedia::EPrimaryCamera:
+ type = KVtEngProviderCam1;
+ break;
+ case MVtEngMedia::ESecondaryCamera:
+ type = KVtEngProviderCam2;
+ break;
+ default:
+ type = KVtEngProviderNone;
+ break;
+ }
+ return type;
+ }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::RunL
+// CActive heir, acts according to status.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::RunL()
+ {
+ __VTPRINTENTER( "LocVid.RunL" )
+
+ const TInt status( iStatus.Int() );
+ TVtEngProviderType providerType = KVtEngProviderNone;
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.RunL %d", status )
+ switch ( status )
+ {
+ case KVtEngAlreadySelected:
+ SetFlag( EFlagSignalSourceSelection );
+ vsProviderReady();
+ break;
+ case KVtEngAlreadyActive:
+ TRAP_IGNORE(
+ iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+ break;
+ case KErrNone:
+ vsProviderSwitchDone( NULL );
+ UpdateState();
+ break;
+ // Camera has been lost during VT
+ case KVsErrCameraNoLongerReserved:
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.status =%d",
+ status )
+ //delete provider here and null pointer
+ if ( iSelectedProvider )
+ {
+ DeleteProvider( *iSelectedProvider );
+ iSelectedProvider = NULL;
+ }
+
+ // Check if still is in use
+ providerType = KVtEngProviderImage;
+ GetHighestSelectableProvider( providerType );
+
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.providerType=%d",
+ providerType )
+
+ iObserver.AutoEnableVideo( EFalse );
+ SetFlag( EFlagAutomaticSwitchCallback );
+ TRAPD( err, SelectSourceL( providerType ) );
+ ClearFlag( EFlagAutomaticSwitchCallback );
+
+ if ( err != KErrNone )
+ {
+ TRAP( err, iObserver.HandleLocalVideoOperationCompleteL( err) );
+ }
+ break;
+ default:
+ // error
+ {
+ switch( iSelectedProvider->iType )
+ {
+ case KVtEngProviderCam1:
+ ClearFlag( EFlagCamera1Available );
+ break;
+ case KVtEngProviderCam2:
+ ClearFlag( EFlagCamera2Available );
+ break;
+ default:
+ break;
+ }
+ DeleteProvider( *iSelectedProvider );
+ iSelectedProvider = NULL;
+ MVtEngMedia::TCameraId currentCam( MVtEngMedia::EPrimaryCamera );
+ iObserver.GetCurrentCameraId( currentCam );
+ TVtEngProviderType providerType( CameraIdToType( currentCam ) );
+ GetHighestSelectableProvider( providerType );
+ TRAPD( err, SelectSourceL( providerType ) );
+ if ( err != KErrNone )
+ {
+ TRAP( err, iObserver.HandleLocalVideoOperationCompleteL( err) );
+ }
+ }
+ }
+ __VTPRINTEXIT( "LocVid.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsActiveProvider
+// Returns ETrue if given provider is already active.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsActiveProvider( TVtEngProviderType aType ) const
+ {
+ __VTPRINTENTER( "LocVid.IsActiveProvider" )
+ const TBool active(
+ ( iActiveProvider && iActiveProvider->iType == aType ) ||
+ ( iSelectedProvider && iSelectedProvider->iType == aType ) );
+ __VTPRINTEXITR( "LocVid.IsActiveProvider %d", active )
+ return active;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DoCancel
+// Does nothing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DoCancel()
+ {
+ __VTPRINTENTER( "LocVid.DoCancel" )
+ __VTPRINTEXIT( "LocVid.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ActiveProvider
+// Returns active provider.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::ActiveProvider() const
+ {
+ if ( iActiveProvider )
+ {
+ return iActiveProvider->iType;
+ }
+ return KVtEngProviderNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartViewFinderIfWasStartedL
+// View finder image can be set.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartViewFinderIfWasStartedL()
+ {
+ __VTPRINTENTER( "LocVid.StartViewFinderIfWasStartedL" )
+ if ( IsFlag( EFlagUIForeground ) && IsFlag( EFlagVFEnabled ) &&
+ iState == ELocReady )
+ {
+ StartViewFinderL();
+ }
+ __VTPRINTEXIT( "LocVid.StartViewFinderIfWasStartedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartViewFinderL
+// Starts view finder.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartViewFinderL( TBool aClientRequest )
+ {
+ __VTPRINTENTER( "LocVid.StartViewFinderL" )
+ __ASSERT_ALWAYS( iVideoProviders->Count(),
+ Panic ( EVtEngPanicNoVideoProvider ) );
+
+ if ( aClientRequest )
+ {
+ SetFlag( EFlagVFEnabled );
+ }
+ if ( iRenderingMethod == EUnspecified || !iActiveProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF error")
+ User::Leave( KErrNotReady );
+ }
+ CVSDataProvider* provider = iActiveProvider->iProvider;
+ if ( !provider )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF error no provider")
+ User::Leave( KErrNotReady );
+ }
+ else if ( provider->ViewFinderActive() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF already started")
+ iViewFinderState = ( iRenderingMethod == EWindowServer ) ?
+ EVFReceivingBitmaps : EVFRenderingDsa;
+ __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+ return;
+ }
+ else if ( !IsFlag( EFlagInitialized ) )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.startVF not initialized")
+ __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+ return;
+ }
+ else if ( iState != ELocReady )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+ "LocVideo.startVF incorrect iState=%d", iState )
+ }
+ else
+ {
+ // Lint requires this one
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.startVF unsupported clause" )
+ }
+
+ CheckOthersStopped( *provider );
+ if ( iRenderingMethod == EWindowServer )
+ {
+ TSize size( iOptions.iSize );
+ provider->StartViewFinderBitmapsL( size );
+ iViewFinderState = EVFReceivingBitmaps;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, " started" )
+ }
+ else
+ {
+ provider->StartViewFinderDirectL(
+ *(iDsaOptions.iWs),
+ *(iDsaOptions.iWsSD),
+ *(iDsaOptions.iWindow),
+ iDsaOptions.iRect,
+ iDsaOptions.iClipRect );
+ iViewFinderState = EVFRenderingDsa;
+ }
+
+ if( iActiveProvider->iType == CVtEngLocalVideo::KVtEngProviderCam1 &&
+ !provider->ViewFinderMirror() )
+ {
+ provider->SetViewFinderMirrorL( ETrue );
+ }
+
+ __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StopViewFinder
+// Stops view finder.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StopViewFinder( TBool aClientRequest )
+ {
+ __VTPRINTENTER( "LocVid.StopViewFinder" )
+ if ( aClientRequest )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF clearing EFlagVFEnabled" )
+ ClearFlag( EFlagVFEnabled );
+ }
+ if ( iActiveProvider &&
+ iViewFinderState != EVFNone &&
+ iActiveProvider->iProvider &&
+ iActiveProvider->iProvider->ViewFinderActive() )
+ {
+#if 0
+ TRAP_IGNORE( iOptions.iObserver->vtHandleFrameL(
+ MVtEngFrameObserver::ELocalVideoFrame, NULL ) );
+#endif
+ iActiveProvider->iProvider->StopViewFinder();
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF Stopped" )
+ if ( IsFlag( EFlagAutomaticSwitchCallback ) ||
+ IsFlag( EFlagUIBackground ) )
+ {
+ // UI needs to be notified if stop done due to automatic
+ // source switch (from vsProvidersChanged).
+ ClearFlag( EFlagAutomaticSwitchCallback );
+ CVtEngEventManager::NotifyEvent( KVtEngViewFinderStopped );
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF Notified" )
+ }
+ }
+ iViewFinderState = EVFNone;
+ __VTPRINTEXIT( "LocVid.StopViewFinder" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::FreezeL
+// Freezes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::FreezeL()
+ {
+ __VTPRINTENTER( "LocVid.FreezeL" )
+ if( OkToFreeze() )
+ {
+ iActiveProvider->iProvider->FreezeL();
+ SetFlag( EFlagFrozen );
+ }
+ __VTPRINTEXIT( "LocVid.FreezeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UnfreezeL
+// Unfreezes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UnfreezeL()
+ {
+ __VTPRINTENTER( "LocVid.UnfreezeL" )
+ if( OkToUnfreeze() )
+ {
+ if ( !iLayoutChangeHandler.UnfreezeL() )
+ {
+ iActiveProvider->iProvider->UnfreezeL();
+ if ( iDelayedSelect.IsDelayedSelectPending() )
+ {
+ TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.UnfreezeL delayed switch to %d", type )
+ SelectSourceL( type );
+ }
+ else
+ {
+ CompleteOperation( KErrNone );
+ }
+ }
+ ClearFlag( EFlagFrozen );
+ }
+ __VTPRINTEXIT( "LocVid.UnfreezeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CheckOthersStopped
+// Stops view finder of other providers than the one given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CheckOthersStopped( const CVSDataProvider& aProvider )
+ {
+ __VTPRINTENTER( "LocVid.CheckOthersStopped" )
+ TInt count( iVideoProviders->Count() );
+ while ( count-- )
+ {
+ TProviderItem& item = ( *iVideoProviders )[count];
+ if ( item.iProvider &&
+ item.iProvider != &aProvider &&
+ item.iProvider->ViewFinderActive() )
+ {
+ item.iProvider->StopViewFinder();
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "LocVideo.OtherStop" )
+ }
+ }
+ __VTPRINTEXIT( "LocVid.CheckOthersStopped" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Source
+// Returns video source.
+// -----------------------------------------------------------------------------
+//
+MVTVideoSource* CVtEngLocalVideo::Source() const
+ {
+ return iSource;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::AudioSource
+// Returns audio source.
+// -----------------------------------------------------------------------------
+//
+MVTAudioSource* CVtEngLocalVideo::AudioSource() const
+ {
+ return iAudioSource;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMediaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetMediaState( TInt& aActiveMedia )
+ {
+ aActiveMedia = 0;
+ if ( !IsFlag( EFlagAudioMuted ) )
+ {
+ aActiveMedia |= MVtEngMedia::EMediaAudio;
+ // Check if the thing is muted
+ }
+
+ if ( iActiveProvider )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetMediaState provider type=%d",
+ iActiveProvider->iType )
+ switch ( iActiveProvider->iType )
+ {
+ case KVtEngProviderCam1:
+ case KVtEngProviderCam2:
+ case KVtEngProviderImage:
+ case KVtEngProviderShareImage:
+ aActiveMedia |= MVtEngMedia::EMediaVideo;
+ break;
+ default:
+ break;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+ "LocVideo.GetMediaState media state=%d", aActiveMedia )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMediaSource
+// Returns media source.
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TMediaSource CVtEngLocalVideo::GetMediaSource()
+ {
+ MVtEngMedia::TMediaSource source( MVtEngMedia::EMediaNone );
+ if ( iActiveProvider )
+ {
+ switch ( iActiveProvider->iType )
+ {
+ case KVtEngProviderCam1:
+ case KVtEngProviderCam2:
+ source = MVtEngMedia::EMediaCamera;
+ break;
+ case KVtEngProviderShareImage:
+ source = MVtEngMedia::EMediaShare;
+ break;
+ case KVtEngProviderImage:
+ case KVtEngProviderDefaultStillImage:
+ source = MVtEngMedia::EMediaStillImage;
+ break;
+ default:
+ source = MVtEngMedia::EMediaNone;
+ break;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetMediaSource src=%d", (TInt) source )
+ return source;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetSourceCaps
+// Returns capability of providers .
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetSourceCaps( TInt& aCaps )
+ {
+ aCaps = 0;
+ TInt count( iVideoProviders->Count() );
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetSourceCaps count=%d", count )
+ while ( count-- )
+ {
+ switch ( iVideoProviders->At(count).iType )
+ {
+ case KVtEngProviderCam1:
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.GetSourceCaps cam1" )
+ if ( IsFlag( EFlagCamera1Available ) )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.GetSourceCaps cam1 flagged" )
+ aCaps |= MVtEngMedia::ESourceCapsPrimaryCamera;
+ }
+ break;
+ case KVtEngProviderCam2:
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.GetSourceCaps cam2" )
+ if ( IsFlag( EFlagCamera2Available ) )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.GetSourceCaps cam2 flagged" )
+ aCaps |= MVtEngMedia::ESourceCapsSecondaryCamera;
+ }
+ break;
+ case KVtEngProviderImage:
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.GetSourceCaps image" )
+ // Make sure that image is valid
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ if( config.iVideo.iImageIsValid )
+ {
+ aCaps |= MVtEngMedia::ESourceCapsStillImage;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetSourceCaps caps=%d", aCaps )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeOnly
+// Sets boolean to indicate if the provider is to be initialized only.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeOnly( TBool aInitOnly )
+ {
+ InitializeOnlyEx( GetMediaSource() != MVtEngMedia::EMediaCamera &&
+ aInitOnly );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeOnlyEx
+// Sets boolean to indicate if the provider is to be initialized only. Does
+// not check current media source.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeOnlyEx( TBool aInitOnly )
+ {
+ SetFlag( EFlagSignalSourceSelection );
+ ClearFlag( EFlagInitializeOnly );
+ if ( aInitOnly )
+ {
+ SetFlag( EFlagInitializeOnly );
+ }
+#ifdef VTDEBUG
+ if ( IsFlag( EFlagInitializeOnly ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " initOnly SET" )
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " initOnly CLEARED" )
+ }
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByType
+// Return provider of particular type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByType(
+ TVtEngProviderType aType,
+ TProviderItem& aItem )
+ {
+ TInt ret( KErrNotFound );
+ TInt count( iVideoProviders->Count() );
+ while ( count-- )
+ {
+ if ( ( *iVideoProviders )[count].iType == aType )
+ {
+ aItem = ( *iVideoProviders )[count];
+ ret = count;
+ count = 0;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType idx=%d", ret )
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByType
+// Return provider of particular type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByType(
+ TVtEngProviderType aType,
+ TProviderItem*& aItem )
+ {
+ TInt ret( KErrNotFound );
+ TInt count( iVideoProviders->Count() );
+ while ( count-- )
+ {
+ if ( ( *iVideoProviders )[count].iType == aType )
+ {
+ aItem = &( *iVideoProviders )[count];
+ ret = count;
+ count = 0;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType* idx=%d", ret )
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByInstance
+// Return provider with particular provider instance.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByInstance(
+ const CVSDataProvider* aInstance,
+ TProviderItem*& aItem ) const
+ {
+ TInt indexI( ProviderIndexByInstance( aInstance ) );
+ if ( indexI != KErrNotFound )
+ {
+ aItem = &( *iVideoProviders )[ indexI ];
+ }
+ else
+ {
+ aItem = NULL;
+ }
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType* idx=%d", indexI )
+ return indexI;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndex
+// Returns provider index by type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndex( TVtEngProviderType aType ) const
+ {
+ for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+ {
+ if ( ( *iVideoProviders )[ count ].iType == aType )
+ {
+ return count;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndexByState
+// Gets a provider index by state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndexByState( TProviderState aState ) const
+ {
+ for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+ {
+ if ( ( *iVideoProviders )[ count ].iProviderState == aState )
+ {
+ return count;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndexByInstance
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndexByInstance(
+ const CVSDataProvider* aInstance) const
+ {
+ for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+ {
+ if ( ( *iVideoProviders )[ count ].iProvider == aInstance )
+ {
+ return count;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateDataProviderL
+// Creates VideoSource provider by type.
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVtEngLocalVideo::CreateDataProviderL(
+ TVtEngProviderType aType )
+ {
+ __VTPRINTENTER( "LocVid.CreateDataProviderL" )
+ __VTPRINT2( DEBUG_MEDIA, " provider type=%d", aType )
+ TInt index = KErrNotFound;
+ switch ( aType )
+ {
+ case KVtEngProviderNone:
+ case KVtEngProviderImage:
+ case KVtEngProviderShareImage:
+ case KVtEngProviderDefaultStillImage:
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Still" )
+ index = iProviderInfoIndexStill;
+ break;
+ case KVtEngProviderCam1:
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Cam1" )
+ index = iProviderInfoIndexCam1;
+ break;
+ case KVtEngProviderCam2:
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Cam2" )
+ index = iProviderInfoIndexCam2;
+ break;
+ default:
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Mobile" )
+ break;
+ }
+
+ CVSDataProvider* provider = NULL;
+ if ( index != KErrNotFound )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL provider is" )
+ provider =
+ iSourceController->CreateDataProviderL(
+ index, this, iSource );
+ }
+
+ __VTPRINT2( DEBUG_MEDIA, " provider created=%d",
+ ( TInt ) ( provider != NULL ) )
+ __VTPRINTEXIT( "LocVid.CreateDataProviderL" )
+ return provider;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateBlankProvider
+// Creates blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CreateBlankProviderL( const TInt aIndex )
+ {
+ __VTPRINTENTER( "LocVid.CreateBlankProviderL" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.CreateBlankProviderL idx=%d", aIndex )
+ CVSDataProvider* provider = NULL;
+ TRAP_IGNORE( provider = iSourceController->CreateDataProviderL(
+ aIndex, this, iSource ) );
+ CleanupStack::PushL( provider );
+ TProviderItem item;
+ item.iProvider = provider;
+ item.iType = KVtEngProviderNone;
+ item.iInitialized = EFalse;
+ item.iProviderState = EPermanent;
+ iVideoProviders->AppendL( item );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "LocVid.CreateBlankProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateDefaultStillImageProviderL
+// Creates default still image provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CreateDefaultStillImageProviderL( const TInt aIndex )
+ {
+ __VTPRINTENTER( "LocVid.CreateDefaultStillImageProviderL" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.CreateDefaultStillImageProviderL idx=%d", aIndex )
+ CVSDataProvider* provider = NULL;
+ TRAP_IGNORE( provider = iSourceController->CreateDataProviderL(
+ aIndex, this, iSource ) );
+ CleanupStack::PushL( provider );
+ TProviderItem item;
+ item.iProvider = provider;
+ item.iType = KVtEngProviderDefaultStillImage;
+ item.iInitialized = EFalse;
+ item.iProviderState = EPermanent;
+ iVideoProviders->AppendL( item );
+ CleanupStack::Pop();
+ __VTPRINTEXIT( "LocVid.CreateDefaultStillImageProviderL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UpdateAvailableProvidersL
+// Updates current providers and their information.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+ CVtEngLocalVideo::UpdateAvailableProvidersL()
+ {
+ __VTPRINTENTER( "LocVid.UpdateAvailableProvidersL" )
+ TVtEngProviderType type( KVtEngProviderNone );
+ TInt count( iSourceController->ProvidersAvailable() );
+ iNumSupportedCameras = count - 1;
+ TVSDataProviderInfo providerInfo;
+ TBool primaryAvailable( EFalse );
+ TBool secondaryAvailable( EFalse );
+ TBool mobileAvailable( EFalse );
+ TInt indexMobile( KErrNotFound );
+ ClearFlag( EFlagCamera1Available );
+ ClearFlag( EFlagCamera2Available );
+ ResetIndices();
+ while ( count-- )
+ {
+ iSourceController->ProviderInfoL( count, providerInfo );
+ if ( providerInfo.iOrientation == TCameraInfo::EOrientationInwards ||
+ // treat outwards camera as primary when only 1 cam in the system
+ ( providerInfo.iOrientation == TCameraInfo::EOrientationOutwards &&
+ iNumSupportedCameras == 1 ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP inw" )
+ type = KVtEngProviderCam1;
+ primaryAvailable = ETrue;
+ SetFlag( EFlagCamera1Available );
+ iProviderInfoIndexCam1 = count;
+ }
+ else if (
+ providerInfo.iOrientation == TCameraInfo::EOrientationOutwards )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP outw" )
+ secondaryAvailable = ETrue;
+ SetFlag( EFlagCamera2Available );
+ iProviderInfoIndexCam2 = count;
+ }
+ else if ( providerInfo.iOrientation == TCameraInfo::EOrientationMobile )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP mobile" )
+ mobileAvailable = ETrue;
+ indexMobile = count;
+ }
+ else if ( providerInfo.iOrientation == TCameraInfo::EOrientationUnknown )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP still" )
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ if ( config.iVideo.iImageIsValid )
+ {
+ iProviderInfoIndexStill = count;
+ }
+ }
+ }
+ if ( !primaryAvailable && mobileAvailable )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP 1 upd" )
+ type = KVtEngProviderCam1;
+ iProviderInfoIndexCam1 = indexMobile;
+ primaryAvailable = ETrue;
+ SetFlag( EFlagCamera1Available );
+ }
+ else if ( primaryAvailable && mobileAvailable )
+ {
+ // No 1, 2 and mobile.
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP 2 upd" )
+ DeleteProvider( KVtEngProviderCam2 );
+ secondaryAvailable = ETrue;
+ iProviderInfoIndexCam2 = indexMobile;
+ SetFlag( EFlagCamera2Available );
+ }
+ else if ( !primaryAvailable && secondaryAvailable )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP !1 & 2" )
+ type = KVtEngProviderCam2;
+ }
+ else if ( type == KVtEngProviderNone )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP none" )
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+ if ( config.iVideo.iImageIsValid )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP valid image" )
+ type = KVtEngProviderImage;
+ }
+ }
+
+ __VTPRINTEXITR( "LocVid.UpdateAvailableProvidersL %d", type )
+ return type;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SwitchProvider
+// Switches to active provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SwitchProvider( TProviderItem* aSwitchToItem )
+ {
+ __VTPRINTENTER( "LocVid.SwitchProvider" )
+
+ iState = ELocSwichingProvider;
+ __VTPRINT( DEBUG_MEDIA, " STATE TO SWITCHING" )
+ iFadingProvider = iActiveProvider;
+ iActiveProvider = aSwitchToItem;
+ TRAPD( err, iSource->SwitchDataProviderL( iActiveProvider->iProvider ) );
+ if ( err != KErrNone )
+ {
+ iState = ELocReady; // go to AO
+ __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+ }
+ switch ( iState )
+ {
+ case ELocReady: // Switch done. Sync.
+ {
+ // Entered here if SwitchDataProviderL causes direct call to
+ // vsProviderSwitchDone. Since provider switch should be async
+ // from client point of view now start AO and signal in RunL.
+ Cancel();
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete( status, err );
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.SwitchProvider AO start %d", err )
+ }
+ // fall through
+ case ELocSwichingProvider: // Async.
+ case ELocNone:
+ SetFlag( EFlagSignalSourceSelection );
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "LocVid.SwitchProvider" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SwitchProvider
+// Overloaded method that takes new active provider as a parameter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SwitchProvider( TProviderItem& aProviderItem )
+ {
+ __VTPRINTENTER( "LocVid.SwitchProvider by aProviderItem" )
+ StopViewFinder( EFalse );
+ SwitchProvider( &aProviderItem );
+ __VTPRINTEXIT( "LocVid.SwitchProvider by aProviderItem" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsInitialized
+// Checks if a provider with given id is initialized.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::IsInitialized(
+ MVtEngMedia::TCameraId aId,
+ TBool& aInitialized )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.IsInitialized ID:%d", aId )
+ TInt count( iVideoProviders->Count() );
+ TVtEngProviderType type = CameraIdToType( aId );
+ aInitialized = EFalse;
+ TInt err( KErrNotFound );
+ while ( count-- )
+ {
+ TProviderItem& item = ( *iVideoProviders )[count];
+ if ( item.iType == type )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.IsInitialized found" )
+ aInitialized = item.iInitialized;
+ if ( ( !aInitialized && item.iProviderState < KErrNone ) ||
+ item.iErrorCode < KErrNone )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.IsInitialized problems" )
+ err = item.iErrorCode;
+ }
+ else
+ {
+ err = KErrNone;
+ }
+ count = 0; // break
+ }
+ }
+ __VTPRINT3( DEBUG_MEDIA | DEBUG_RETURN,
+ "LocVideo.IsInitialized isInitialized=%d,err=%d", aInitialized, err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UpdateState
+// Updates view finder state.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UpdateState()
+ {
+ __VTPRINTENTER( "LocVid.UpdateState" )
+
+ if ( iActiveProvider )
+ {
+ CVSDataProvider* provider = iActiveProvider->iProvider;
+ __VTPRINT2 ( DEBUG_MEDIA, "LocVideo.UpdateState, provider active",
+ provider->ViewFinderActive() )
+ if ( provider && provider->ViewFinderActive())
+ {
+ iViewFinderState = ( iRenderingMethod == EWindowServer ) ?
+ EVFReceivingBitmaps : EVFRenderingDsa;
+ }
+ }
+ ClearFlag( EFlagInitializeOnly );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+ "LocVideo.UpdateState iViewFinderState %d", iViewFinderState )
+ __VTPRINTEXIT( "LocVid.UpdateState" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializingOrSwitching
+// Is either initializing or doing a provider switch.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::InitializingOrSwitching() const
+ {
+ return ( iState == ELocInitializing ||
+ iState == ELocSwichingProvider );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UninitializeProviderL
+// Uninitializes initialized non-permanent provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UninitializeProviderL()
+ {
+ __VTPRINTENTER( "LocVid.UninitializeProviderL" )
+ TInt count( iVideoProviders->Count() );
+ while ( count-- )
+ {
+ TProviderItem& item = ( *iVideoProviders )[count];
+ if ( item.iProviderState == EUndefined && item.iInitialized )
+ {
+ DeleteProvider( item );
+ item.iProvider = CreateDataProviderL( item.iType );
+ }
+ }
+ __VTPRINTEXIT( "LocVid.UninitializeProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetCameraInfo
+// Gets camera info.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetCameraInfo( MVtEngMedia::TCameraId aId,
+ MVtEngMedia::TCameraInfo& aInfo )
+ {
+ TBool initialized( EFalse );
+ TInt err( IsInitialized( aId, initialized ) );
+ TVSDataProviderInfo info;
+ if ( initialized && err == KErrNone )
+ {
+ TVtEngProviderType type = CameraIdToType( aId );
+ TProviderItem item;
+ GetProviderByType( type, item );
+ item.iProvider->ProviderInfo( info );
+ aInfo.iMaxDigitalZoom = info.iMaxDigitalZoom;
+ aInfo.iMaxZoom = info.iMaxZoom;
+ aInfo.iMinZoom = info.iMinZoom;
+ aInfo.iMajorZoomStepCount =
+ CalculateMajorDigitalZoomStepCount( item.iProvider );
+ }
+ return initialized ? err : KErrNotReady;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetDigitalZoomFactor
+// Gets current zoom step.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetDigitalZoomFactor( TInt& aCurrentStep )
+ {
+ if ( !iActiveProvider ||
+ !iActiveProvider->iProvider )
+ {
+ return KErrNotReady;
+ }
+ aCurrentStep = iActiveProvider->iProvider->DigitalZoomFactor();
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetZ %d", aCurrentStep )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMaxDigitalZoomStep
+// Gets max. digital zoom step.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetMaxDigitalZoomStep( TInt& aMaxZoomStep )
+ {
+ if ( !iActiveProvider ||
+ !iActiveProvider->iProvider )
+ {
+ return KErrNotReady;
+ }
+ aMaxZoomStep = iProviderInfo.iMaxDigitalZoom;
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.MaxZStep %d", aMaxZoomStep )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMajorDigitalZoomStepCount
+// Gets number of major zoom level leaps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::
+ GetMajorDigitalZoomStepCount( TInt& aCount, TBool /*aProviderSupplied*/ )
+ {
+ /*__VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.GetMajZStepCount %d", aProviderSupplied )*/
+ if ( !iActiveProvider || !iActiveProvider->iProvider )
+ {
+ return KErrNotReady;
+ }
+ aCount = CalculateMajorDigitalZoomStepCount( iProviderInfo );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.GetMajZStepCount %d", aCount )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMajorDigitalZoomStep
+// Maps major step to zoom step. Note: aIndex is given in range
+// [0 .. CalculateMajorDigitalZoomStepCount() - 1]
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::GetMajorDigitalZoomStep( const TInt aIndex, TInt& aStep )
+ {
+ if ( !iActiveProvider || !iActiveProvider->iProvider )
+ {
+ // No active provider.
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.GetMajZStep NO active")
+ return;
+ }
+ if ( iProviderInfo.iMaxDigitalZoom > KVtMaxZoomStep )
+ {
+ aStep = iProviderInfo.iMaxDigitalZoom *
+ Min( KVtMaxZoomStep, Max( 0, aIndex ) ) / KVtMaxZoomStep;
+ }
+ else
+ {
+ aStep = Min( iProviderInfo.iMaxDigitalZoom, Max( 0, aIndex ) );
+ }
+ __VTPRINT3( DEBUG_MEDIA | DEBUG_DETAIL,
+ "LocVideo.GetMajZStep idx=%d,step=%d", aIndex, aStep )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetFreezeSupported
+// Gets freeze supported value from provider.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetFreezeSupported( TBool& aFreezeSupported ) const
+ {
+ __VTPRINTENTER( "LocVideo.GetFreezeSupported" )
+ if ( !iActiveProvider ||
+ !iActiveProvider->iProvider )
+ {
+ __VTPRINTEXIT( "LocVideo.GetFreezeSupported KErrNotReady")
+ return KErrNotReady;
+ }
+ aFreezeSupported = iProviderInfo.iFreezeSupported;
+ __VTPRINTEXITR( "LocVideo.GetFreezeSupported %d", aFreezeSupported )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::OkToFreeze
+// Returns ETrue if it is ok to freeze provider (i.e. freeze is supported AND
+// provider is not currently frozen)
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::OkToFreeze() const
+ {
+ __VTPRINTENTER( "LocVideo.OkToFreeze" )
+ TBool isOk( EFalse );
+ if ( iActiveProvider &&
+ iActiveProvider->iProvider )
+ {
+ isOk = ( iProviderInfo.iFreezeSupported && !IsFlag( EFlagFrozen ) );
+ }
+ __VTPRINTEXITR( "LocVideo.OkToFreeze %d", isOk )
+ return isOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::OkToUnfreeze
+// Returns ETrue if it is ok to unfreeze provider (i.e. freeze is supported AND
+// provider is currently frozen)
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::OkToUnfreeze() const
+ {
+ __VTPRINTENTER( "LocVideo.OkToUnfreeze" )
+ TBool isOk( EFalse );
+ if ( iActiveProvider &&
+ iActiveProvider->iProvider )
+ {
+ isOk = ( iProviderInfo.iFreezeSupported && IsFlag( EFlagFrozen ) );
+ }
+ __VTPRINTEXITR( "LocVideo.OkToUnfreeze %d", isOk )
+ return isOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Mute
+// Sets the audio state as muted.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::Mute()
+ {
+ SetFlag( EFlagAudioMuted );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UnMute
+// Sets the audio state on again.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::UnMute()
+ {
+ ClearFlag( EFlagAudioMuted );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetUIForeground
+// Sets UI foreground state.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::SetUIForeground( TBool aForeground )
+ {
+ __VTPRINTENTER( "LocVideo.SetUIForeground" )
+ __VTPRINT2( DEBUG_GEN, " foreground=%d", aForeground )
+
+ //Error indicator
+ TInt err = KErrNone;
+ if ( aForeground )
+ {
+ if ( iDelayedSelect.IsDelayedSelectPending() )
+ {
+ TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVideo.SetUIForeground delayed switch to %d", type )
+ SelectSourceL( type );
+ }
+
+ SetFlag( EFlagUIForeground );
+ ClearFlag( EFlagUIBackground );
+ if ( IsFlag( EFlagVFEnabled ) )
+ {
+ //Ignore error
+ TRAP (err, StartViewFinderL( EFalse ));
+ }
+ else
+ {
+ MVtEngMedia::TShareObjectState sharingState;
+ GetObjectSharingState( sharingState );
+ if ( sharingState == MVtEngMedia::ESharingImage )
+ {
+ //Ignore error
+ TRAP (err, StartViewFinderL( ETrue ));
+ }
+ }
+ }
+ else
+ {
+ ClearFlag( EFlagUIForeground );
+ SetFlag( EFlagUIBackground );
+ StopViewFinder( EFalse );
+ ClearFlag( EFlagUIBackground );
+ }
+ __VTPRINTEXIT( "LocVideo.SetUIForeground" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetObjectSharingState
+// Get current media object sharing state.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::GetObjectSharingState(
+ MVtEngMedia::TShareObjectState& aObjectSharingState ) const
+ {
+ __VTPRINTENTER( "LocVid.GetObjectSharingState" )
+ if( iActiveProvider && iActiveProvider->iProvider )
+ {
+ iShareImage->GetObjectSharingState( aObjectSharingState );
+ }
+ else
+ {
+ aObjectSharingState = MVtEngMedia::ENotAbleToShare;
+ }
+ __VTPRINTEXITR( "LocVid.GetObjectSharingState %d", aObjectSharingState )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeShareImageL
+// Start Image sharing initialization.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeShareImageL(
+ const MVtEngMedia::TShareObjectImageParameters& aParameters,
+ TBool& aFirstTime )
+ {
+ __VTPRINTENTER( "LocVid.InitializeShareImageL" )
+
+ iShareImage->InitializeL( aParameters,
+ iActiveProvider->iType, aFirstTime );
+
+ __VTPRINTEXIT( "LocVid.InitializeShareImageL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartShareImageL
+// Stop sharing Image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartShareImageL()
+ {
+ __VTPRINTENTER( "LocVid.StartShareImageL" )
+ const TBool delayed( iDelayedSelect.IsDelayedSelectPending() );
+ const TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+ iShareImage->ShareL();
+ if ( delayed )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVid.StartShareImageL IsDelayedSelectPending type = %d",
+ type )
+ iShareImage->NotifyCameraChanged( type );
+ }
+ __VTPRINTEXIT( "LocVid.StartShareImageL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StopShareImageL
+// Stop sharing Image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StopShareImageL()
+ {
+ __VTPRINTENTER( "LocVid.StopShareImageL" )
+ iShareImage->StopL();
+ __VTPRINTEXIT( "LocVid.StopShareImageL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ShareError
+// Report error to image sharer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ShareError( TInt aError )
+ {
+ __VTPRINTENTER( "LocVid.ShareError" )
+ iShareImage->Error( aError );
+ __VTPRINTEXIT( "LocVid.ShareError" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ShareStoredSource
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::ShareStoredSource() const
+ {
+ __VTPRINTENTER( "LocVid.ShareStoredSource" )
+ const TVtEngProviderType stored( iShareImage->StoredSource() );
+ __VTPRINTEXITR( "LocVid.ShareStoredSource = %d", stored )
+ return stored;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SettingsChanged
+// Called when GS settings changed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SettingsChanged()
+ {
+ __VTPRINTENTER( "LocVid.SettingsChanged" )
+ iShareImage->SettingsChanged();
+ __VTPRINTEXIT( "LocVid.SettingsChanged" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetIsPrepareCameraCalled
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetIsPrepareCameraCalled( TBool aCalled )
+ {
+ __VTPRINTENTER( "LocVid.SetIsPrepareCameraCalled" )
+ iPrepareCameraCalled = aCalled;
+ __VTPRINTEXITR( "LocVid.SetIsPrepareCameraCalled %d", iPrepareCameraCalled )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsPrepareCameraCalled
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsPrepareCameraCalled() const
+ {
+ __VTPRINTENTER( "LocVid.IsPrepareCameraCalled" )
+ __VTPRINTEXITR( "LocVid.IsPrepareCameraCalled %d", iPrepareCameraCalled )
+ return iPrepareCameraCalled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::HandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::HandleLayoutChangeL()
+ {
+ __VTPRINTENTER( "LocVid.HandleLayoutChangeL" )
+ iLayoutChangeHandler.HandleLayoutChangeL();
+ __VTPRINTEXIT( "LocVid.HandleLayoutChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsDelayedSelectPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsDelayedSelectPending() const
+ {
+ return iDelayedSelect.IsDelayedSelectPending();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteProvider
+// Deletes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteProvider(
+ TProviderItem& aItem )
+ {
+ __VTPRINTENTER( "LocVid.DeleteProvider" )
+ aItem.iProviderState = EUndefined;
+ if ( aItem.iProvider &&
+ aItem.iInitialized &&
+ aItem.iProvider->ViewFinderActive() )
+ {
+ aItem.iProvider->StopViewFinder();
+ }
+ delete aItem.iProvider;
+ aItem.iInitialized = EFalse;
+ aItem.iProvider = NULL;
+ __VTPRINTEXIT( "LocVid.DeleteProvider" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteProvider
+// Deletes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteProvider( const TVtEngProviderType aType )
+ {
+ TProviderItem dummy;
+ const TInt pos( GetProviderByType( aType, dummy ) );
+ if ( pos >= 0 ) // valid index
+ {
+ TProviderItem& item = ( *iVideoProviders )[pos];
+ DeleteProvider( item );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Reset
+// Resets local video handler.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::Reset()
+ {
+ __VTPRINTENTER( "LocVid.Reset" )
+
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.Reset" )
+ DeleteProvider( KVtEngProviderCam1 );
+ DeleteProvider( KVtEngProviderCam2 );
+ DeleteAudioSource();
+
+ ClearFlag( EFlagAudioMuted |
+ EFlagSignalSourceSelection |
+ EFlagInitialized |
+ EFlagVFEnabled |
+ EFlagFrozen );
+
+ __VTPRINT( DEBUG_MEDIA, "LocVideo.Reset clearing EFlagVFEnabled and other" )
+
+ StopViewFinder();
+ __VTPRINTEXIT( "LocVid.Reset" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetDigitalZoomFactorL
+// Sets video provider's digital zoom step.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetDigitalZoomFactorL( TInt aDigitalZoomFactor )
+ {
+ __VTPRINTENTER( "LocVid.SetDigitalZoomFactorL" )
+ __VTPRINT2( DEBUG_MEDIA, "LocVideo.SetZoom %d", aDigitalZoomFactor )
+ if ( !iActiveProvider ||
+ !iActiveProvider->iProvider )
+ {
+ User::Leave( KErrNotReady );
+ }
+ CVSDataProvider* provider( iActiveProvider->iProvider );
+ provider->SetDigitalZoomFactorL( aDigitalZoomFactor );
+ iActiveProvider->iStoredZoomFactor = provider->DigitalZoomFactor();
+ __VTPRINTEXIT( "LocVid.SetDigitalZoomFactorL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetFlag
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetFlag( const TInt aFlag )
+ {
+ iFlags |= aFlag;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ClearFlag
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ClearFlag( const TInt aFlag )
+ {
+ iFlags &= ~aFlag;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsFlag
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsFlag( const TInt aFlag ) const
+ {
+ return ( ( iFlags & aFlag ) != 0 );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount
+// Utility function to calculate amount of major zoom steps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount(
+ CVSDataProvider* aProvider )
+ {
+ TVSDataProviderInfo info;
+ aProvider->ProviderInfo( info );
+ return CalculateMajorDigitalZoomStepCount( info );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount
+// Utility function to calculate amount of major zoom steps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount(
+ const TVSDataProviderInfo& aInfo ) const
+ {
+ TInt zStepCount( aInfo.iMaxDigitalZoom ?
+ aInfo.iMaxDigitalZoom + 1 : 0 );
+ TInt maxZStepCount( KVtMaxZoomStep + 1 );
+ return zStepCount > maxZStepCount ? maxZStepCount : zStepCount;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::TProviderItem
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem::TProviderItem() :
+ iProvider( NULL ),
+ iType( KVtEngProviderUndefined ),
+ iInitialized( EFalse ),
+ iErrorCode( 0 ),
+ iProviderState( EUndefined ),
+ iStoredZoomFactor( 0 ),
+ iZFErr( KErrNone ),
+ iCamPrefs( NULL ),
+ iFirstTime( ETrue )
+ {
+ __VTPRINTENTER( "LocVid.TProviderItem.ctor" )
+ ResetStoredValues();
+ __VTPRINTEXITR( "LocVid.TProviderItem.ctor $%x", TInt( this ) )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::~TProviderItem
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem::~TProviderItem()
+ {
+ __VTPRINTENTER( "LocVid.TProviderItem.~" )
+ DetachFromCameraPreferences();
+ __VTPRINTEXITR( "LocVid.TProviderItem.~ $%x", TInt( this ) )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ResetStoredValues
+// Resets stored values.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ResetStoredValues()
+ {
+ __VTPRINTENTER( "LocVid.ResetStoredValues" )
+ DetachFromCameraPreferences();
+ __VTPRINTEXIT( "LocVid.ResetStoredValues" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::RestoreZoomFactor
+// Tries to restore zoom factor.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TProviderItem::RestoreZoomFactor()
+ {
+ __VTPRINTENTER( "LocVid.RestoreZoomFactor" )
+ TRAP( iZFErr,
+ {
+ if ( iProvider && !iZFErr )
+ {
+ iProvider->SetDigitalZoomFactorL( iStoredZoomFactor );
+ iStoredZoomFactor = iProvider->DigitalZoomFactor();
+ __VTPRINT2( DEBUG_GEN, "LocVideo.RestoreZoomFactor ZF now = %d",
+ iStoredZoomFactor )
+ }
+ } );
+ __VTPRINTEXITR( "LocVid.RestoreZoomFactor %d", iZFErr )
+ return iZFErr;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::RestorePreferences
+// Tries to restore preferences.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TProviderItem::RestorePreferences()
+ {
+ __VTPRINTENTER( "LocVid.RestorePreferences" )
+ TRAPD( error,
+ {
+ if ( iCamPrefs && iProvider && !iFirstTime )
+ {
+ if ( !iCtErr )
+ {
+ iProvider->SetColorToneL(
+ CCamera::CCameraImageProcessing::TEffect( iColorTone ) );
+ }
+ if ( !iWbErr )
+ {
+ iProvider->SetWhiteBalanceL(
+ CCamera::TWhiteBalance( iWhiteBalance ) );
+ }
+ if ( !iBrErr )
+ {
+ iProvider->SetBrightnessL( iBrightness );
+ }
+ if ( !iCrErr )
+ {
+ iProvider->SetContrastL( iContrast );
+ }
+ }
+ } );
+ __VTPRINTEXITR( "LocVid.RestorePreferences %d", error )
+ return error;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::Attach
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::Attach( MVtEngCameraPreferences&
+ aCamPrefs )
+ {
+ __VTPRINTENTER( "LocVid.Attach" )
+ iCamPrefs = &aCamPrefs;
+ if ( iFirstTime )
+ {
+ iCtErr = iCamPrefs->GetColorTone( iColorTone );
+ iWbErr = iCamPrefs->GetWhiteBalance( iWhiteBalance );
+ iBrErr = iCamPrefs->GetBrightness( iBrightness );
+ iCrErr = iCamPrefs->GetContrast( iContrast );
+ iFirstTime = EFalse;
+ }
+ __VTPRINTEXITR( "LocVid.Attach $%x", TInt( iCamPrefs ) )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ColorToneUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ColorToneUpdated(
+ MVtEngCameraPreferences::TColorTone aColorTone )
+ {
+ __VTPRINTENTER( "LocVid.ColorToneUpdated" )
+ iCtErr = KErrNone;
+ iColorTone = aColorTone;
+ __VTPRINTEXITR( "LocVid.ColorToneUpdated %d", aColorTone )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::WhiteBalanceUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::WhiteBalanceUpdated(
+ MVtEngCameraPreferences::TWhiteBalance aWhiteBalance )
+ {
+ __VTPRINTENTER( "LocVid.WhiteBalanceUpdated" )
+ iWbErr = KErrNone;
+ iWhiteBalance = aWhiteBalance;
+ __VTPRINTEXITR( "LocVid.WhiteBalanceUpdated %d", aWhiteBalance )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::BrightnessUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::BrightnessUpdated( TInt aBrightness )
+ {
+ __VTPRINTENTER( "LocVid.BrightnessUpdated" )
+ iBrErr = KErrNone;
+ iBrightness = aBrightness;
+ __VTPRINTEXITR( "LocVid.BrightnessUpdated %d", aBrightness )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ContrastUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ContrastUpdated( TInt aContrast )
+ {
+ __VTPRINTENTER( "LocVid.ContrastUpdated" )
+ iCrErr = KErrNone;
+ iContrast = aContrast;
+ __VTPRINTEXITR( "LocVid.ContrastUpdated %d", aContrast )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::Detach
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::Detach( MVtEngCameraPreferences& )
+ {
+ __VTPRINTENTER( "LocVid.Detach" )
+ iCamPrefs = NULL;
+ __VTPRINTEXIT( "LocVid.Detach" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::DetachFromCameraPreferences
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::DetachFromCameraPreferences()
+ {
+ __VTPRINTENTER( "LocVid.DetachFromCameraPreferences" )
+ if ( iCamPrefs )
+ {
+ static_cast< CVtEngCameraPreferences* >( iCamPrefs )->Detach( *this );
+ iCamPrefs = NULL;
+ }
+ __VTPRINTEXIT( "LocVid.DetachFromCameraPreferences" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateAudioSource
+// Creates audio source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CreateAudioSource()
+ {
+ __VTPRINTENTER( "LocVid.CreateAudioSource" )
+ TInt err = KErrNone;
+ // Check if this really a target compilation
+#if !defined( __WINS__ )
+ iAudioSource = VTProtocolFactory::CreateAudioSource();
+ if ( !iAudioSource )
+ {
+ err = KErrNoMemory;
+ }
+#endif // !(__WINS__)
+ __VTPRINTEXITR( "LocVid.CreateAudioSource %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteAudioSource
+// Deletes audio source.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteAudioSource()
+ {
+ __VTPRINTENTER( "LocVid.DeleteAudioSource" )
+ if( iAudioSource )
+ {
+ VTProtocolFactory::DeletAudioSource(iAudioSource);
+ iAudioSource = NULL;
+ }
+ __VTPRINTEXIT( "LocVid.DeleteAudioSource" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::PauseVideoSending
+// Pause video sending.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::PauseVideoSending()
+ {
+ __VTPRINTENTER( "LocVid.PauseVideoSending" )
+ if ( iSource )
+ {
+ iSource->PauseSending();
+ }
+ __VTPRINTEXIT( "LocVid.PauseVideoSending" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ResumeVideoSending
+// Resume video sending.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ResumeVideoSending()
+ {
+ __VTPRINTENTER( "LocVid.ResumeVideoSending" )
+ if ( iSource )
+ {
+ iSource->ResumeSending();
+ }
+ __VTPRINTEXIT( "LocVid.ResumeVideoSending" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ViewFinderStarted
+// Is view finder started.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::ViewFinderStarted() const
+ {
+ CVSDataProvider* provider = NULL;
+ if( iActiveProvider )
+ {
+ provider = iActiveProvider->iProvider;
+ }
+ if ( !provider )
+ {
+ return EFalse;
+ }
+ return provider->ViewFinderActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ViewFinderStarted
+// Is view finder started.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsFrozen() const
+ {
+ TBool result = IsFlag( EFlagFrozen );
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ResetIndices
+// Resets the provider info indices.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ResetIndices()
+ {
+ iProviderInfoIndexCam1 = KErrNotFound;
+ iProviderInfoIndexCam2 = KErrNotFound;
+ iProviderInfoIndexStill = KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetCameraTracking
+// Sets a listener for camera P & S data.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::SetCameraTrackingL( TInt& aProviderIndex )
+ {
+ __VTPRINTENTER( "LocVideo.SetCameraTracking" )
+ iCameraListener = CVtEngPubSubsListener::NewL( KPSUidVTMediaConfiguration,
+ KPSPreferredCamera, this );
+
+ __VTPRINTEXIT( "LocVideo.SetCameraTracking" )
+ return iCameraListener->Get( aProviderIndex );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleNotifyPSL
+// Notification of changed port value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::HandleNotifyPSL(
+ const TUid /*aUid */, const TInt& /* aKey */,
+ const TRequestStatus& aStatus )
+ {
+ __VTPRINTENTER( "LocVideo.handleNotifyPSL " )
+ if ( aStatus.Int() == KErrNone )
+ {
+ // Get the new camera value.
+ TInt cameraId( EPSPreferredCameraUnknown );
+ iCameraListener->Get( cameraId );
+ // No need to check error, since MapCameraInternally will return
+ // current camera, and no actions will be taken.
+ MVtEngMedia::TCameraId camId( MapCameraInternally( cameraId ) );
+
+ TVtEngProviderType providerType( KVtEngProviderUndefined );
+ TInt result( KErrNone );
+ switch( camId )
+ {
+ case MVtEngMedia::EPrimaryCamera:
+ if( IsFlag( EFlagCamera1Available ) )
+ {
+ providerType = KVtEngProviderCam1;
+ }
+ else
+ {
+ result = KErrNotFound;
+ }
+ break;
+
+ case MVtEngMedia::ESecondaryCamera:
+ if( IsFlag( EFlagCamera2Available ) )
+ {
+ providerType = KVtEngProviderCam2;
+ }
+ else
+ {
+ result = KErrNotFound;
+ }
+ break;
+
+ default:
+ result = KErrNotSupported;
+ break;
+ }
+
+ User::LeaveIfError( result );
+
+ // If we're sharing, then notify camera change to image sharer
+ if ( GetMediaSource() == MVtEngMedia::EMediaShare ||
+ iShareImage->IsInitializingShare() )
+ {
+ iShareImage->NotifyCameraChanged( providerType );
+ }
+ // If current provider is camera
+ else if ( GetMediaSource() == MVtEngMedia::EMediaCamera )
+ {
+ // If current camera is different than new
+ if ( iCurrentCamera != camId )
+ {
+ // If VT is in the foreground and Provider is unfrozen
+ if ( IsFlag( EFlagUIForeground ) && !IsFrozen() && !iObserver.IsVideoChannelClosed() )
+ {
+ // select camera..
+ SelectSourceL( providerType );
+ }
+ else
+ {
+ iObserver.SetSelectedCameraId( camId );
+ // ..else notify delayed select
+ iLayoutChangeHandler.CancelHandleLayoutChange();
+ iDelayedSelect.NotifyDelayedSelect( providerType );
+ }
+ }
+ else
+ {
+ // else ignore
+ }
+ }
+ // Else store camera type and on next SelectSourceL() use this instead
+ else
+ {
+ iObserver.SetSelectedCameraId( camId );
+ // If prepare camera has not been called, then just
+ // update preferred camera
+ if ( GetMediaSource()!= MVtEngMedia::EMediaNone &&
+ ( IsPrepareCameraCalled() || iObserver.IsVideoChannelClosed() ) )
+ {
+ iLayoutChangeHandler.CancelHandleLayoutChange();
+ iDelayedSelect.NotifyDelayedSelect( providerType );
+ }
+ else
+ {
+ iCurrentCamera = camId;
+ }
+ }
+ }
+ __VTPRINTEXIT( "LocVideo.HandleNotifyPSL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetCurrentCameraId
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetCurrentCameraId( MVtEngMedia::TCameraId aCamId )
+ {
+ __VTPRINTENTER( "LocVideo.SetCurrentCameraId" )
+ iCurrentCamera = aCamId;
+ iObserver.SetSelectedCameraId( aCamId );
+ __VTPRINTEXITR( "LocVideo.SetCurrentCameraId camId = %d", aCamId )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::MapCameraInternally
+// Maps camera id to internal data structures.
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TCameraId CVtEngLocalVideo::MapCameraInternally( TInt aCameraId )
+ {
+ __VTPRINT2( DEBUG_GEN, "LocVideo.MapCameraInternally cameraId=%d",
+ aCameraId )
+ if ( aCameraId == EPSPreferredCameraInwards ||
+ iNumSupportedCameras == 1 )
+ {
+ return MVtEngMedia::EPrimaryCamera;
+ }
+ else if ( aCameraId == EPSPreferredCameraOutwards )
+ {
+ return MVtEngMedia::ESecondaryCamera;
+ }
+ __VTPRINT2( DEBUG_GEN, "LocVideo.MapCameraInternally curCam=%d", iCurrentCamera )
+ return iCurrentCamera;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CameraAvailable
+// Checks camera availabitility.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::
+ CameraAvailable( CVtEngLocalVideo::TVtEngProviderType &aType )
+ {
+ __VTPRINT2( DEBUG_GEN, "LocVideo.CameraAvailable In.type=%d ", aType )
+ if ( iCurrentCamera == MVtEngMedia::EPrimaryCamera )
+ {
+ if ( IsFlag( EFlagCamera1Available ) )
+ {
+ aType = KVtEngProviderCam1;
+ }
+ }
+ else if ( iCurrentCamera == MVtEngMedia::ESecondaryCamera )
+ {
+ if ( IsFlag( EFlagCamera2Available ) )
+ {
+ aType = KVtEngProviderCam2;
+ }
+ }
+ __VTPRINT2( DEBUG_GEN, "LocVideo.CameraAvailable Out.type=%d", aType )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsProviderWaiting
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsProviderWaiting( TVtEngProviderType aType ) const
+ {
+ __VTPRINTENTER( "LocVid.IsProviderWaiting" )
+ TBool isWaiting( EFalse );
+ TInt indexWaiting( ProviderIndexByState( EWaiting ) );
+ if ( indexWaiting != KErrNotFound )
+ {
+ TProviderItem& item = ( *iVideoProviders )[ indexWaiting ];
+ isWaiting = ( item.iType == aType );
+ }
+ __VTPRINTEXITR( "LocVid.IsProviderWaiting %d", isWaiting )
+ return isWaiting;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetHighestSelectableProvider
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::GetHighestSelectableProvider(
+ CVtEngLocalVideo::TVtEngProviderType& aPreferred ) const
+ {
+ __VTPRINTENTER( "LocVid.GetHighestSelectableProvider" )
+ const TVtEngProviderType preferred = aPreferred;
+ switch ( preferred )
+ {
+ case KVtEngProviderCam1:
+ if ( IsFlag( EFlagCamera1Available ) )
+ {
+ // cam1 is selectable, jump out
+ break;
+ }
+ // othwerwise fall through to next in priority order
+ case KVtEngProviderCam2:
+ if ( IsFlag( EFlagCamera2Available ) &&
+ // Do not allow change to another camera without user permission,
+ // i.e. test preferred was cam1 but it wasn't available.
+ preferred != KVtEngProviderCam1 )
+ {
+ // cam2 is selectable
+ aPreferred = KVtEngProviderCam2;
+ break;
+ }
+ // othwerwise fall through to next in priority order
+ case KVtEngProviderImage:
+ if ( CVtEngUtility::Settings().Config().iVideo.iImageIsValid )
+ {
+ aPreferred = KVtEngProviderImage;
+ break;
+ }
+ // othwerwise fall through to next in priority order
+ case KVtEngProviderNone:
+ default:
+ // always available
+ aPreferred = KVtEngProviderNone;
+ break;
+ }
+ __VTPRINTEXITR( "LocVid.GetHighestSelectableProvider %d", aPreferred )
+ return ( preferred == aPreferred );
+ }
+
+// Implementation of CVtEngLocalVideo::CVtEngShareImage
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage* CVtEngLocalVideo::CVtEngShareImage::NewL(
+ CVtEngLocalVideo& aLocalVideo )
+ {
+ CVtEngShareImage* self = new ( ELeave ) CVtEngShareImage( aLocalVideo );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::~CVtEngShareImage
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage::~CVtEngShareImage()
+ {
+ DeleteProviders();
+ iBuffered.ResetAndDestroy();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::InitializeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::InitializeL(
+ const MVtEngMedia::TShareObjectImageParameters& aParameters,
+ TVtEngProviderType aCurrent,
+ TBool& aFirstTime )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.InitializeL" )
+ if ( IsInitializing() )
+ {
+ // Already initializing.
+ User::Leave( KErrNotReady );
+ }
+
+
+ CVtEngLocalVideo::TProviderItem* freeProviderItem = FetchProviderItem();
+ if ( !freeProviderItem )
+ {
+ User::Leave( KErrInUse );
+ }
+
+ iParameters = aParameters;
+ CreateProviderL( *freeProviderItem );
+ InitializeProviderL( *freeProviderItem );
+
+ // Only set stored type when sharing is started, if resharing (i.e. sharing
+ // new image when already sharing other image), then don't change stored
+ // type.
+ if ( iStoredType == KVtEngProviderUndefined )
+ {
+ iSettingsChanged = EFalse;
+ iOriginalStoredType = iStoredType = aCurrent;
+ aFirstTime = ETrue;
+ }
+ else
+ {
+ aFirstTime = EFalse;
+ }
+ iInitializingProvider = freeProviderItem;
+ SetState( EInitializing );
+ __VTPRINTEXIT( "LocVid.ShareImage.InitializeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ShareL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ShareL()
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.ShareL" )
+ if ( !IsInitializing() && iInitializingProvider )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iActiveProvider = iInitializingProvider;
+ iInitializingProvider = NULL;
+ iLocalVideo->SwitchProvider( *iActiveProvider );
+ SetState( ESharing );
+ __VTPRINTEXIT( "LocVid.ShareImage.ShareL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::StopL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::StopL()
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.StopL" )
+ iLocalVideo->InitializeOnly( EFalse );
+
+ CVtEngLocalVideo::TVtEngProviderType target( StoredSource() );
+ if ( iOriginalStoredType != target )
+ {
+ TProviderItem* item = NULL;
+ if ( iLocalVideo->GetProviderByType( iOriginalStoredType, item )
+ != KErrNotFound )
+ {
+ if ( item->iProviderState != EPermanent )
+ {
+ iLocalVideo->DeleteProvider( *item );
+ }
+ }
+ }
+
+ if ( iSettingsChanged )
+ {
+ if ( target == KVtEngProviderDefaultStillImage )
+ {
+ DeleteProvider( target );
+ }
+ DeleteProvider( KVtEngProviderImage );
+ }
+
+ __VTPRINT2( DEBUG_MEDIA, "LocVid.ShareImage.StopL select %d",
+ target )
+ iLocalVideo->SelectSourceL( target );
+
+ if ( iStoredType == KVtEngProviderCam1 ||
+ iStoredType == KVtEngProviderCam2 )
+ {
+ MVtEngMedia::TCameraId camId(
+ iStoredType == KVtEngProviderCam1 ?
+ MVtEngMedia::EPrimaryCamera :
+ MVtEngMedia::ESecondaryCamera );
+ iLocalVideo->SetCurrentCameraId( camId );
+ __VTPRINT2( DEBUG_MEDIA, "LocVid.ShareImage.StopL set camId %d",
+ camId )
+ }
+ SetState( EStopped );
+ __VTPRINTEXIT( "LocVid.ShareImage.StopL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::Error
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::Error( TInt
+#ifdef _DEBUG
+ aError
+#endif // _DEBUG
+ )
+ {
+ TState stateAfter( EStopped );
+ __VTPRINTENTER( "LocVid.ShareImage.Error" )
+ if ( IsInitializing() )
+ {
+ iInitializingProvider = NULL;
+ stateAfter = iPreviousState;
+ }
+ else if ( iState == ESharing )
+ {
+ if ( iLocalVideo->iObserver.GetPendingCommand() != KVtEngInitializeShareImage )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngShareImageDecodingError );
+ }
+ stateAfter = ESharing;
+ //iActiveProvider = NULL;
+ }
+ SetState( stateAfter );
+#ifdef _DEBUG
+ __VTPRINTEXITR( "LocVid.ShareImage.Error %d", aError )
+#endif // _DEBUG
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::StoredSource
+//
+// Returns stored source for this share session. Stored source may have changed
+// during share (e.g. when GS still image is being sent but during share
+// GS still image is disabled => still image cannot be used anymore and thus
+// None provider must be activated). All these conditions are checked by this
+// method.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+ CVtEngLocalVideo::CVtEngShareImage::StoredSource() const
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.StoredSource" )
+ CVtEngLocalVideo::TVtEngProviderType stored( iStoredType );
+
+ if ( iOriginalStoredType == KVtEngProviderNone ||
+ iOriginalStoredType == KVtEngProviderImage ||
+ iOriginalStoredType == KVtEngProviderDefaultStillImage )
+ {
+ if ( CVtEngUtility::Settings().Config().iVideo.iImageIsValid )
+ {
+ stored = KVtEngProviderImage;
+ }
+ else if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+ {
+ stored = KVtEngProviderDefaultStillImage;
+ }
+ else
+ {
+ stored = KVtEngProviderNone;
+ }
+ }
+ __VTPRINTEXITR( "LocVid.ShareImage.StoredSource = %d", stored )
+ return stored;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CVtEngShareImage
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage::CVtEngShareImage(
+ CVtEngLocalVideo& aLocalVideo )
+ : iLocalVideo( &aLocalVideo ), iState( EStopped ),
+ iStoredType( KVtEngProviderUndefined ),
+ iOriginalStoredType( KVtEngProviderUndefined ),
+ iBuffered( 2 ), iSettingsChanged( EFalse )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ConstructL()
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.ConstructL" )
+ for ( TInt i = 0; i < KVtEngNumProvidersBuffered; i++ )
+ {
+ TProviderItem* item = new (ELeave) TProviderItem();
+ CleanupStack::PushL( item );
+ User::LeaveIfError( iBuffered.Append( item ) );
+ CleanupStack::Pop(); // item
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::Parameters
+// -----------------------------------------------------------------------------
+//
+const MVtEngMedia::TShareObjectImageParameters&
+ CVtEngLocalVideo::CVtEngShareImage::Parameters() const
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.Parameters" )
+ __VTPRINTEXIT( "LocVid.ShareImage.Parameters" )
+ return iParameters;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::IsInitializing
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::CVtEngShareImage::IsInitializing() const
+ {
+ TBool isInitializing( iState == EInitializing );
+ __VTPRINTENTER( "LocVid.ShareImage.IsInitializing" )
+ __VTPRINTEXITR( "LocVid.ShareImage.IsInitializing %d", isInitializing )
+ return isInitializing;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::SetState
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::SetState( const TState aNewState )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.SetState" )
+ // Signal UI when entering or leaving initializing state
+ if ( aNewState == EInitializing )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngShareImageInitializeBegin );
+ }
+ else if ( iState == EInitializing )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngShareImageInitializeEnd );
+ }
+ // Reset stored type when stopping
+ if( aNewState == EStopped )
+ {
+ iOriginalStoredType = iStoredType = KVtEngProviderUndefined;
+ iSettingsChanged = EFalse;
+ }
+ iPreviousState = iState;
+ iState = aNewState;
+ __VTPRINTEXITR( "LocVid.ShareImage.SetState iState = %d", iState )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::GetProviderItemL
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem*
+ CVtEngLocalVideo::CVtEngShareImage::FetchProviderItem() const
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.FetchProviderItem" )
+ for( TInt i = 0; i < iBuffered.Count(); i++ )
+ {
+ if( ( iBuffered[ i ] != iActiveProvider ) &&
+ ( iBuffered[ i ] != iInitializingProvider ) )
+ {
+ __VTPRINTEXIT( "LocVid.ShareImage.FetchProviderItem" )
+ return iBuffered[ i ];
+ }
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.FetchProviderItem" )
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CreateProviderL
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::CVtEngShareImage::CreateProviderL(
+ TProviderItem& aProviderItem )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.CreateProviderL" )
+ iLocalVideo->ReCreateProviderL( aProviderItem, KVtEngProviderShareImage );
+ __VTPRINTEXIT( "LocVid.ShareImage.CreateProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::InitializeProviderL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::InitializeProviderL(
+ TProviderItem& aProviderItem )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.InitializeProviderL" )
+ if( IsInitializing() )
+ {
+ User::Leave( KErrNotReady );
+ }
+ TPckgBuf< TVSStillImageDataProviderParams > pckg( Parameters() );
+#ifdef _DEBUG
+ RDebug::Print( _L( "LocVid.ShareImage.InitializeProviderL: %S" ),
+ &( pckg().iFileName ) );
+#endif // _DEBUG
+ iLocalVideo->InitializeShareProviderL( aProviderItem, pckg );
+ __VTPRINTEXIT( "LocVid.ShareImage.InitializeProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::DeleteProvider
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::DeleteProvider(
+ TVtEngProviderType aProviderType )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.DeleteProvider" )
+ TProviderItem* pItem;
+ if ( iLocalVideo->GetProviderByType( aProviderType, pItem )
+ != KErrNotFound )
+ {
+ iLocalVideo->DeleteProvider( *pItem );
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.DeleteProvider" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::GetObjectSharingState(
+ MVtEngMedia::TShareObjectState& aObjectSharingState ) const
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.GetObjectSharingState" )
+ switch ( iState )
+ {
+ case EStopped:
+ aObjectSharingState = MVtEngMedia::ENotSharing;
+ break;
+
+ case EInitializing:
+ aObjectSharingState = MVtEngMedia::EInitializingShareImage;
+ break;
+
+ case ESharing:
+ aObjectSharingState = MVtEngMedia::ESharingImage;
+ break;
+
+ default:
+ aObjectSharingState = MVtEngMedia::ENotAbleToShare;
+ break;
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.GetObjectSharingState" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::IsInitializingShare
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::CVtEngShareImage::IsInitializingShare() const
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.IsInitializingShare" )
+ const TBool result( iState == EInitializing );
+ __VTPRINTEXITR( "LocVid.ShareImage.IsInitializingShare %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::SettingsChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::SettingsChanged()
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.SettingsChanged" )
+ iSettingsChanged = ETrue;
+ __VTPRINTEXIT( "LocVid.ShareImage.SettingsChanged" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ProviderSwitchDone(
+ CVSDataProvider* aOldProvider )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.ProviderSwitchDone" )
+ //if ( iState == EStopped )
+ {
+ for ( TInt i = iBuffered.Count() - 1; i >= 0; i-- )
+ {
+ if ( iBuffered[ i ]->iProvider == aOldProvider )
+ {
+ iLocalVideo->DeleteProvider( *iBuffered[ i ] );
+ break;
+ }
+ }
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.ProviderSwitchDone" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::NotifyCameraChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::NotifyCameraChanged(
+ const TVtEngProviderType& aProviderType )
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.NotifyCameraChanged" )
+ if ( ( iState == EInitializing ) || ( iState == ESharing ) )
+ {
+ iStoredType = aProviderType;
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.NotifyCameraChanged" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::DeleteProviders
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::DeleteProviders()
+ {
+ __VTPRINTENTER( "LocVid.ShareImage.DeleteProviders" )
+ for ( TInt i = 0; i < iBuffered.Count(); i++ )
+ {
+ iLocalVideo->DeleteProvider( *iBuffered[ i ] );
+ }
+ __VTPRINTEXIT( "LocVid.ShareImage.DeleteProviders" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CancelInitialize
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::CancelInitialize()
+ {
+ __VTPRINTENTER( "CVtEngLocalVideo.CVtEngShareImage.CancelInitialize");
+ if( iInitializingProvider )
+ {
+ if(iInitializingProvider->iProvider)
+ {
+ __VTPRINT( DEBUG_MEDIA,"iInitializingProvider->iProvider->CancelInitializing()");
+ iInitializingProvider->iProvider->CancelInitializing();
+ }
+ }
+ __VTPRINTEXIT( "CVtEngLocalVideo.CVtEngShareImage.CancelInitialize");
+ }
+// Implementation of CVtEngLocalVideo::TVtEngDelayedSelect
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::TVtEngDelayedSelect
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngDelayedSelect::TVtEngDelayedSelect()
+ : iDelayedProviderType( KVtEngProviderUndefined )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::NotifyDelayedSelect
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngDelayedSelect::NotifyDelayedSelect(
+ const TVtEngProviderType& aProviderType )
+ {
+ __VTPRINTENTER( "LocVid.DelSel.NotifyDelayedSelect" )
+ iDelayedProviderType = aProviderType;
+ __VTPRINTEXIT( "LocVid.DelSel.NotifyDelayedSelect" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::IsDelayedSelectPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngDelayedSelect::IsDelayedSelectPending() const
+ {
+ __VTPRINTENTER( "LocVid.DelSel.IsDelayedSelectPending" )
+ const TBool result( iDelayedProviderType != KVtEngProviderUndefined );
+ __VTPRINTEXITR( "LocVid.DelSel.IsDelayedSelectPending %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::DelayedSelectTarget
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+CVtEngLocalVideo::TVtEngDelayedSelect::DelayedSelectTarget()
+ {
+ __VTPRINTENTER( "LocVid.DelSel.DelayedSelectTarget" )
+ TVtEngProviderType current( iDelayedProviderType );
+ iDelayedProviderType = KVtEngProviderUndefined;
+ __VTPRINTEXITR( "LocVid.DelSel.DelayedSelectTarget %d", current )
+ return current;
+ }
+
+// Implementation of CVtEngLocalVideo::TVtEngLayoutChangeHandler
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::TVtEngLayoutChangeHandler
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngLayoutChangeHandler::TVtEngLayoutChangeHandler(
+ CVtEngLocalVideo& aLocalVideo )
+ : iLocalVideo( &aLocalVideo ), iState( EIdle ),
+ iStored( KVtEngProviderUndefined )
+ {
+ __VTPRINTEXIT( "LocVid.LayoutCH.Ctor" )
+ __VTPRINTEXIT( "LocVid.LayoutCH.Ctor" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::UnfreezeL()
+ {
+ TBool result( EFalse );
+ __VTPRINTENTER( "LocVid.LayoutCH.UnfreezeL" )
+ if ( iState == ELayoutChangePending )
+ {
+ result = ETrue;
+ DoHandleLayoutChangeL();
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.UnfreezeL %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::HandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::HandleLayoutChangeL()
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.HandleLayoutChangeL" )
+ TInt error( KErrNone );
+ if ( iState != EIdle )
+ {
+ if ( iState == ELayoutChangePending )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.HandleLayoutChangeL PENDING" )
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.HandleLayoutChangeL NOT ready" )
+ error = KErrNotReady;
+ }
+ CompleteOperation( error );
+ }
+ else
+ {
+ // Only do reinitialize if camera is active source
+ if ( iLocalVideo->GetMediaSource() == MVtEngMedia::EMediaCamera &&
+ !iLocalVideo->IsDelayedSelectPending() )
+ {
+ if ( !iLocalVideo->IsFrozen() )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.HandleLayoutChangeL camera active, reinitialize" )
+ DoHandleLayoutChangeL();
+ }
+ else
+ {
+ iState = ELayoutChangePending;
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.HandleLayoutChangeL flag set, frozen" )
+ CompleteOperation( error );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.HandleLayoutChangeL no op, camera is not active" )
+ CompleteL( error );
+ }
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.HandleLayoutChangeL %d", error )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CancelHandleLayoutChange
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CancelHandleLayoutChange()
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.CancelHandleLayoutChange" )
+ if ( iState == ELayoutChangePending )
+ {
+ iState = EIdle;
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.CancelHandleLayoutChange iState = %d",
+ iState )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::DoHandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::DoHandleLayoutChangeL()
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.DoHandleLayoutChangeL" )
+ iStored = iLocalVideo->ActiveProvider();
+ iState = ESwitchingBlank;
+ TVtEngProviderType providerType( KVtEngProviderNone );
+ // Use user defined image, if available
+ if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+ {
+ providerType = KVtEngProviderDefaultStillImage;
+ }
+ iLocalVideo->SelectSourceL( providerType );
+ __VTPRINTEXIT( "LocVid.LayoutCH.DoHandleLayoutChangeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::Complete
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TVtEngLayoutChangeHandler::Complete( const TInt aError )
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.Complete" )
+ TRAPD( error, CompleteL( aError ) );
+ __VTPRINTEXITR( "LocVid.LayoutCH.Complete %d", error )
+ return error;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteL
+// Resets internal state and completes asynchronous operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteL( const TInt aError )
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.CompleteL" )
+ iStored = KVtEngProviderUndefined;
+ iState = EIdle;
+ CompleteOperation( aError );
+ __VTPRINTEXIT( "LocVid.LayoutCH.CompleteL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteOperation
+// Completes asynchronous operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteOperation(
+ const TInt aError )
+ {
+ __VTPRINTENTER( "LocVid.LayoutCH.CompleteOperation" )
+ iLocalVideo->CompleteOperation( aError );
+ __VTPRINTEXIT( "LocVid.LayoutCH.CompleteOperation" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderError
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderError( TInt aError )
+ {
+ TBool handled( EFalse );
+ __VTPRINTENTER( "LocVid.LayoutCH.ProviderError" )
+ if ( iState != EIdle && iState != ELayoutChangePending )
+ {
+ handled = ETrue;
+ Complete( aError );
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.ProviderError %d", handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderReady
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderReady()
+ {
+ TBool handled( EFalse );
+ __VTPRINTENTER( "LocVid.LayoutCH.ProviderReady" )
+ switch ( iState )
+ {
+ case ESwitchingCamera:
+ case EIdle:
+ break;
+
+ case EInitializingCamera:
+ handled = ETrue;
+ iState = ESwitchingCamera;
+ TRAPD( error, iLocalVideo->SelectSourceL( iStored ) );
+ if ( error )
+ {
+ Complete( error );
+ }
+ break;
+
+ case ESwitchingBlank:
+ handled = ETrue;
+ break;
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.ProviderReady %d", handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderSwitchDone(
+ CVSDataProvider* aOldProvider )
+ {
+ TBool handled( EFalse );
+ __VTPRINTENTER( "LocVid.LayoutCH.ProviderSwitchDone" )
+ switch ( iState )
+ {
+ case EIdle:
+ // nothing to do
+ break;
+
+ case ESwitchingBlank:
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone ESwitchingBlank" )
+ handled = ETrue;
+ iState = EInitializingCamera;
+ TProviderItem* providerItem;
+ const TInt result(
+ iLocalVideo->GetProviderByInstance( aOldProvider, providerItem ) );
+ if ( result != KErrNotFound )
+ {
+ iLocalVideo->DeleteProvider( *providerItem );
+ iLocalVideo->iCameraPref->SetProvider( NULL,
+ *iLocalVideo->iActiveProvider );
+
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone initializing provider" )
+
+ TRAPD( error, iLocalVideo->InitializeProviderL( *providerItem ) );
+
+ if ( error )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone ERROR %d in initialize",
+ error )
+ Complete( error );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone provider NOT found" )
+ Complete( result );
+ }
+ }
+ break;
+
+ case EInitializingCamera:
+ handled = ETrue;
+ break;
+
+ case ESwitchingCamera:
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone ESwitchingCamera" )
+ TRAP_IGNORE( iLocalVideo->StartViewFinderIfWasStartedL() );
+ //Re-Set provider to camera preference. Otherwise, after layout change, the provider in camera preference will be invalid
+ iLocalVideo->iCameraPref->SetProvider( iLocalVideo->iActiveProvider->iProvider,
+ *iLocalVideo->iActiveProvider );
+ handled = ETrue;
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVid.LayoutCH.ProviderSwitchDone reinit done" )
+ Complete( KErrNone );
+ break;
+ }
+ __VTPRINTEXITR( "LocVid.LayoutCH.ProviderSwitchDone %d", handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngVFBitmapNGARender *
+CVtEngLocalVideo::CVtEngVFBitmapNGARender::NewL()
+ {
+ CVtEngVFBitmapNGARender* self
+ = new ( ELeave ) CVtEngVFBitmapNGARender();
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender()
+ {
+ __VTPRINTENTER( "LocVid.NGARender.~" )
+ Cancel();
+
+ if ( iSurfaceCreated )
+ {
+ iWindow->RemoveBackgroundSurface(ETrue);
+ iWs->UnregisterSurface(0, iSurfaceId);
+
+ iSurfaceManager.CloseSurface(iSurfaceId);
+ iSurfaceChunk->Close();
+ delete iSurfaceChunk;
+ iSurfaceChunk = NULL;
+
+ iSurfaceManager.Close();
+
+ iSurfaceUpdateSession.CancelAllUpdateNotifications();
+ iSurfaceUpdateSession.Close();
+ }
+
+ __VTPRINTEXIT( "LocVid.NGARender.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::UpdateBitmap
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CVtEngVFBitmapNGARender::UpdateBitmapL( CFbsBitmap& aFrame )
+ {
+ __VTPRINTENTER( "LocVid.NGARender.UpdateBitmapL" )
+ // do nothing if we're already active, the newer bitmap will be ignored.
+ if ( IsActive() )
+ {
+ __VTPRINTEXIT( "LocVid.NGARender.UpdateBitmapL 0" )
+ return KErrNone;
+ }
+ else
+ {
+ if ( !iSurfaceCreated )
+ {
+ User::Leave( KErrNotReady );
+ }
+ aFrame.BeginDataAccess();
+ __VTPRINT2( DEBUG_MEDIA, "LocVid.NGARender.bitmap size = %d", aFrame.DataSize() );
+#if 0
+ memcpy( iBuffer, aFrame.DataAddress(), aFrame.DataSize() );
+#else
+ TInt size = aFrame.DataSize();
+ TPtr8 ptrBuffer( iBuffer, size );
+ ptrBuffer.Copy( reinterpret_cast<TUint8*>(aFrame.DataAddress()), size );
+#endif
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 1" );
+ aFrame.EndDataAccess();
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 2" );
+ iStatus = KRequestPending;
+ SetActive();
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 3" );
+ iSurfaceUpdateSession.NotifyWhenDisplayed( iStatus, iTimeStamp );
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 4" );
+ iSurfaceUpdateSession.SubmitUpdate( KAllScreens, iSurfaceId, 0, NULL );
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.bitmap step 5" );
+
+ __VTPRINTEXIT( "LocVid.NGARender.UpdateBitmapL 1" )
+
+ return KErrNone;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::CreateSurfaceL
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CVtEngVFBitmapNGARender::AttachSurfaceL(
+ RWsSession *aWs,
+ RWindow *aWindow )
+ {
+ __VTPRINTENTER( "LocVid.NGARender.AttachSurfaceL" )
+
+ if ( aWs == NULL || aWindow == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ if(iSurfaceCreated)
+ return KErrNone;
+
+ if ( !iSurfaceCreated )
+ {
+ TInt err;
+
+ err = iSurfaceUpdateSession.Connect();
+ User::LeaveIfError(err);
+
+ err = iSurfaceManager.Open();
+ User::LeaveIfError(err);
+
+ RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
+ attributes().iPixelFormat = iSurfaceFormat;
+ attributes().iSize.SetSize( KVtEngLocalVideoDefaultWidth,
+ KVtEngLocalVideoDefaultHeight );
+ attributes().iBuffers = EVtEngVFMaxBuffers;
+ attributes().iStride = attributes().iSize.iWidth*4;
+ attributes().iOffsetToFirstBuffer = 0;
+ attributes().iAlignment = 4;
+ attributes().iContiguous = EFalse;
+ attributes().iMappable = ETrue;
+
+ err = iSurfaceManager.CreateSurface( attributes, iSurfaceId );
+ User::LeaveIfError( err );
+
+ // Map to chunk
+ iSurfaceChunk = new RChunk();
+ User::LeaveIfNull( iSurfaceChunk );
+ err = iSurfaceManager.MapSurface( iSurfaceId, *iSurfaceChunk );
+ User::LeaveIfError( err );
+
+ // Get the info from the surfaceManager
+ RSurfaceManager::TInfoBuf info;
+ err = iSurfaceManager.SurfaceInfo( iSurfaceId, info );
+ User::LeaveIfError( err );
+
+ TInt offset;
+ iSurfaceManager.GetBufferOffset( iSurfaceId, 0, offset );
+ iBuffer = iSurfaceChunk->Base() + offset;
+
+ iSurfaceCreated = ETrue;
+ }
+ else
+ {
+ if ( iWs == NULL || iWindow == NULL )
+ {
+ User::Leave( KErrGeneral );
+ }
+
+ iWindow->RemoveBackgroundSurface(ETrue);
+ iWs->UnregisterSurface(0, iSurfaceId);
+
+ __VTPRINT( DEBUG_MEDIA, "LocVid.NGARender.Surface exists, detach first!" )
+ }
+
+ iWs = aWs;
+ iWindow = aWindow;
+ iWs->RegisterSurface( 0, iSurfaceId );
+
+ TSurfaceConfiguration surfaceConfig;
+ surfaceConfig.SetSurfaceId( iSurfaceId );
+ surfaceConfig.SetOrientation( CFbsBitGc::EGraphicsOrientationRotated270);
+ iWindow->SetBackgroundSurface( surfaceConfig, ETrue );
+ //iWindow->SetBackgroundSurface( iSurfaceId );
+
+ __VTPRINTEXIT( "LocVid.NGARender.AttachSurfaceL" )
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::~CVtEngVFBitmapNGARender
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngVFBitmapNGARender::CVtEngVFBitmapNGARender()
+ : CActive( CActive::EPriorityStandard ),
+ iSurfaceFormat( EUidPixelFormatXRGB_8888 )
+ {
+ iSurfaceCreated = EFalse;
+
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngVFBitmapNGARender::ConstructL( )
+ {
+ __VTPRINTENTER( "LocVid.NGARender.ConstructL" )
+ __VTPRINTEXIT( "LocVid.NGARender.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngVFBitmapNGARender::RunL()
+ {
+ __VTPRINTENTER( "LocVid.NGARender.RunL" )
+ __VTPRINTEXIT( "LocVid.NGARender.RunL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngVFBitmapNGARender::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngVFBitmapNGARender::DoCancel()
+ {
+ __VTPRINTENTER( "LocVid.NGARender.DoCancel" )
+ __VTPRINTEXIT( "LocVid.NGARender.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateCameraPreferencesL
+// -----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences* CVtEngLocalVideo::CreateCameraPreferencesL()
+ {
+ __VTPRINTENTER( "LocVid.CreateCameraPreferencesL" )
+ iCameraPref = CVtEngCameraPreferences::NewL();
+
+ // Check if provider exist and set it
+ // as provider to camera preferences
+ if ( iActiveProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "LocVideo.CreateCameraPreferencesL SetProvider" )
+ iCameraPref->SetProvider( iActiveProvider->iProvider,
+ *iActiveProvider );
+ }
+
+ __VTPRINTEXIT( "LocVid.CreateCameraPreferencesL" )
+ return iCameraPref;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CancelInitializeShareImage
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CancelInitializeShareImage()
+ {
+ __VTPRINTENTER( "CVtEngLocalVideo.CancelInitializeShareImage");
+ iShareImage->CancelInitialize();
+ __VTPRINTEXIT( "CVtEngLocalVideo.CancelInitializeShareImage");
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngMediaHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,4583 @@
+/*
+* Copyright (c) 2004-2007 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: Implementation of video session interface.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngMediaHandler.h"
+#include "CVtEngLocalVideo.h"
+#include "CVtEngRemoteVideo.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngOperation.h"
+#include "TVtEngRendering.h"
+#include "TVtEngRenderingDSA.h"
+#include "TVtEngRenderingDP.h"
+#include "TVtEngRenderingNGA.h"
+#include "VtEngUtils.h"
+#include "CVtEngInitializer.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngSettings.h"
+#include "CVtEngHandlerContainer.h"
+#include "MVtEngDtmfHandler.h"
+#include "cvtengmdtrcommandsender.h"
+#include "VtEngPanic.h"
+#include <sysutil.h>
+#include <cvtlogger.h>
+#include <mvtprotocolhandler.h>
+#include <e32des8.h>
+#include <videotelephonyvariant.hrh>
+#include <es_sock.h> // BigEndian
+
+#include <mvtengcamerapreferences.h>
+#include "cvtengrecord2file.h"
+
+// MACROS
+#ifdef VTDEBUG
+// In debug mode sinks and sources are not necessarily added.
+#define ADD_VIDEO_SINK { \
+ if ( DEBUG_CFG_NO_VIDEO_SINK == 0 ) { AddVideoSink(); } }
+#define ADD_VIDEO_SOURCE { \
+ if ( DEBUG_CFG_NO_VIDEO_SOURCE == 0 ) { AddVideoSource(); } }
+#define ADD_AUDIO_SOURCE \
+ { if ( DEBUG_CFG_NO_AUDIO_SOURCE == 0 ) { AddAudioSource(); } }
+#define ADD_AUDIO_SINK \
+ { if ( DEBUG_CFG_NO_AUDIO_SINK == 0 ) { AddAudioSink(); } }
+#else
+// In release mode they are added.
+#define ADD_VIDEO_SINK AddVideoSink();
+#define ADD_VIDEO_SOURCE AddVideoSource();
+#define ADD_AUDIO_SOURCE AddAudioSource();
+#define ADD_AUDIO_SINK AddAudioSink();
+#endif // VTDEBUG
+
+// CONSTANTS
+const TInt KVtEngOperationArraySize = 2;
+// System version string buffer length.
+const TInt KVtEngSwVersionTextLength = KSysUtilVersionTextLength;
+// Country code for version information.
+const TUint8 KVtEngCountryCodeForProto = 60;
+// Extension code for version information (unknown).
+const TUint8 KVtEngExtensionForProto = 0;
+// Manufacturer code for version information (unknown).
+const TUint32 KVtEngManufacturerForProto = 0;
+// Timer to detect too long disconnect.
+const TInt KVtEngDisconnectionTimer = 20000000;
+// Space character constant.
+const TText KVtEngCharacterSpace( ' ' );
+// New line (\n) character constant.
+const TInt KVtEngCharacterEndLine( 10 );
+
+// Multiplex delay in milliseconds
+//const TInt KVtEngMultiplexingDelay = 150;
+
+// TradeOff values
+const TInt KVtEngTradeOffDetailMax = 9;
+const TInt KVtEngTradeOffNormalMax = 19;
+const TInt KVtEngTradeOffMotionMax = 31;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CVtEngMediaHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::CVtEngMediaHandler() :
+ iProtoState( MVtProtocolCommand::EIdle ),
+ iAudioCtrl(0),
+ iProtoMaxVolume(0),
+ iTempProviderInfo( CVtEngLocalVideo::KVtEngProviderNone ),
+ iH324Config( 0 ),
+ iH263Encoder( 0 )
+ {
+ if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+ {
+ iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderDefaultStillImage;
+ }
+
+ // Check is AMR-WB supported or not in platform. Adjusted using local
+ // variation.
+ if ( CVtEngUtility::Settings().CheckBits( KVTLVFlagEnableAMR_WB ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ AMR-WB set ON" )
+ iSdkInitInfo.iAMRWBOn = ETrue;
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ AMR-WB set OFF" )
+ iSdkInitInfo.iAMRWBOn = EFalse;
+ }
+
+ if ( CVtEngUtility::Settings().CheckBits( KVTLVFlagDisableMpeg4 ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ Mpeg4 set OFF" )
+ iSdkInitInfo.iDisableMpeg4 = ETrue;
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ Mpeg4 set ON" )
+ iSdkInitInfo.iDisableMpeg4 = EFalse;
+ }
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ConstructL()
+ {
+ __VTPRINTENTER( "MH.ConstructL" )
+
+ iAsyncCallback = CIdle::NewL( CActive::EPriorityHigh );
+ iPendingOps = new ( ELeave)
+ CArrayFixFlat<TCmdOpPair>( KVtEngOperationArraySize );
+ iPendingOps->SetReserveL( KVtEngOperationArraySize );
+
+ __VTPRINT2( DEBUG_MEDIA, "DebugFlags used are %d", CVtLogger::Flags() )
+
+ iLocalVideo = CVtEngLocalVideo::NewL( *this );
+ __VTPRINTEXIT( "MH.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler* CVtEngMediaHandler::NewL()
+ {
+ CVtEngMediaHandler* self = new( ELeave )CVtEngMediaHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::~CVtEngMediaHandler
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::~CVtEngMediaHandler()
+ {
+ __VTPRINTENTER( "MH.~" )
+ if ( iPendingOps )
+ {
+ iPendingOps->Reset(); // Make sure this is empty
+ delete iPendingOps;
+ }
+ delete iPendingOp;
+ delete iTimer;
+ delete iAsyncCallback;
+ delete iLocalVideo;
+ delete iRemoteVideo;
+ __VTPRINTEXIT( "MH.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMediaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMediaState(
+ const TMediaDirection aMediaDirection,
+ TInt& aActiveMedia ) const
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.GetMediaState direction=%d", aMediaDirection )
+ aActiveMedia = 0;
+ switch ( aMediaDirection )
+ {
+ case EMediaOutgoing:
+ {
+ const TInt result( iLocalVideo->GetMediaState( aActiveMedia ) );
+ if ( !IsFlag( EOutVideoChannelClosed ) )
+ {
+ aActiveMedia |= EMediaVideoChannelOpen;
+ }
+ if ( !IsFlag( EOutAudioChannelClosed ) )
+ {
+ aActiveMedia |= EMediaAudioChannelOpen;
+ }
+ return result;
+ }
+
+ case EMediaIncoming:
+ aActiveMedia = iRemoteMediaState;
+ if ( ( iRemoteVideo && !iRemoteVideo->GetDsaState() ) )
+ {
+ aActiveMedia &= (~EMediaVideo);
+ }
+ __VTPRINT2( DEBUG_MEDIA, "MH.remoteState=%d", aActiveMedia )
+ return KErrNone;
+
+ default:
+ break;
+ }
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RenderingStarted
+// Returns the state of video.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::RenderingStarted(
+ const TMediaDirection aDirection ) const
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.RS %d", aDirection )
+ TBool started( EFalse );
+ if( aDirection == EMediaOutgoing )
+ {
+ started = iLocalVideo->ViewFinderStarted();
+ }
+ else // EMediaIncoming
+ {
+ started = iRemoteVideo->GetDsaState();
+ }
+
+ __VTPRINT2( DEBUG_MEDIA, "MH.RS started %d", started )
+ return started;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetSource
+// Returns active source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetSource( TMediaSource& aSource ) const
+ {
+ TInt err( KErrNotReady );
+ if ( iLocalVideo )
+ {
+ aSource = iLocalVideo->GetMediaSource();
+ err = KErrNone;
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetSourcesCaps
+// Returns source selection capabilities.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetSourcesCaps( TInt& aCaps ) const
+ {
+ TInt err( KErrNotReady );
+ if ( iLocalVideo )
+ {
+ err = iLocalVideo->GetSourceCaps( aCaps );
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCurrentCameraId
+// Returns current camera.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCurrentCameraId( TCameraId& aId ) const
+ {
+ __VTPRINT( DEBUG_GEN, "MH.GetCurrentCameraId")
+ aId = iSelectedCameraId;
+ TInt err( KErrNotReady );
+
+ TBool initialized( EFalse );
+ err = iLocalVideo->IsInitialized( aId, initialized );
+ if ( !initialized && ( err != KErrInUse ) )
+ {
+ __VTPRINT2( DEBUG_GEN, "MH.GetCurrentCameraId err=%d", KErrNotReady )
+ return KErrNotReady;
+ }
+ __VTPRINT2( DEBUG_GEN, "MH.GetCurrentCameraId initialized err=%d", err )
+ return err;//Not initialized
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCameraInfo
+// Returns camera information.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCameraInfo(
+ const TCameraId aId, TCameraInfo& aInfo ) const
+ {
+ return iLocalVideo->GetCameraInfo( aId, aInfo );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCurrentZoomStep
+// Returns current zooming.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCurrentZoomStep( TInt& aCurrentStep )
+ {
+ return iLocalVideo->GetDigitalZoomFactor( aCurrentStep );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMaxZoomStep
+// Returns maximum zooming.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMaxZoomStep( TInt& aMaxZoomStep )
+ {
+ return iLocalVideo->GetMaxDigitalZoomStep( aMaxZoomStep );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMajorZoomStepCount
+// Gets number of major zoom level leaps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMajorZoomStepCount( TInt& aCount )
+ {
+ return iLocalVideo->GetMajorDigitalZoomStepCount( aCount );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMajorZoomStep
+// Maps major zoom leap step to corresponding step index.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetMajorZoomStep( TInt aIndex, TInt& aStep )
+ {
+ if ( iLocalVideo )
+ {
+ iLocalVideo->GetMajorDigitalZoomStep( aIndex, aStep );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetFreezeSupported
+// Maps major zoom leap step to corresponding step index.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetFreezeSupported( TBool& aFreezeSupported) const
+ {
+ if ( iLocalVideo )
+ {
+ return iLocalVideo->GetFreezeSupported( aFreezeSupported );
+ }
+ return KErrNotReady;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetFreezeState
+// Returns KErrNotReady if provider is not ready yet. If KErrNone is returned
+// then aFrozen will be ETrue if the provider is frozen, EFalse otherwise.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetFreezeState( TBool& aFrozen ) const
+ {
+ if ( iLocalVideo )
+ {
+ aFrozen = iLocalVideo->IsFrozen();
+ return KErrNone;
+ }
+ return KErrNotReady;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetDsaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetDsaState(
+ const TMediaDirection aMediaDirection,
+ TBool& aActive ) const
+ {
+ if ( !iRemoteVideo )
+ {
+ return KErrNotReady;
+ }
+ switch ( aMediaDirection )
+ {
+ case EMediaOutgoing:
+ break;
+ case EMediaIncoming:
+ aActive = iRemoteVideo->GetDsaState();
+ return KErrNone;
+ default:
+ break;
+ }
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::VideoCallConnected
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::VideoCallConnected () const
+ {
+ TBool connected = EFalse;
+ if ( MVtProtocolCommand::EConnected == iProtoState )
+ {
+ connected = ETrue;
+ }
+ return connected;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetVideoQuality( TVideoQuality& aVideoQuality ) const
+ {
+ __VTPRINTENTER( "MH.GetVideoQuality" )
+ aVideoQuality = iVideoQuality.VideoQuality();
+ __VTPRINTEXIT( "MH.GetVideoQuality" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetObjectSharingState(
+ TShareObjectState& aObjectSharingState ) const
+ {
+ __VTPRINTENTER( "MH.GetObjectSharingState" )
+ if( iProtoState == MVtProtocolCommand::EConnected )
+ {
+ iLocalVideo->GetObjectSharingState( aObjectSharingState );
+ }
+ else
+ {
+ aObjectSharingState = ENotAbleToShare;
+ }
+ __VTPRINTEXIT( "MH.GetObjectSharingState" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCameraOrientations
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetCameraOrientations(
+ TCameraOrientation& aPrimaryCameraOrientation,
+ TCameraOrientation& aSecondaryCameraOrientation ) const
+ {
+ __VTPRINTENTER( "MH.GetCameraOrientations" )
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.GetCameraOrientations( aPrimaryCameraOrientation,
+ aSecondaryCameraOrientation );
+ __VTPRINTEXIT( "MH.GetCameraOrientations" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestLastRemoteFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::RequestLastRemoteFrame( )
+ {
+ __VTPRINTENTER( "MH.RequestLastRemoteFrame" )
+ if( iRemoteVideo )
+ iRemoteVideo->RequestLastFrame();
+ __VTPRINTEXIT( "MH.RequestLastRemoteFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ValidateCommand
+// Checks if command is valid in current proto state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::ValidateCommand( const TVtEngCommandId aCommand ) const
+ {
+ __VTPRINTENTER( "MH.ValidateCommand" )
+ __VTPRINT2( DEBUG_MEDIA, "MH.ValidateCommand cmd=%d", aCommand )
+ TInt okToPerform( KErrNotReady );
+ if ( iInitialized )
+ {
+ switch ( aCommand )
+ {
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ // mute/unmute not possible if audio channel closed.
+ if ( IsFlag( EOutAudioChannelClosed ) ) {
+ break;
+ }
+ case KVtEngSetAudioRouting:
+ if ( ( iProtoState == MVtProtocolCommand::EConnected ) &&
+ ( ( iPendingOp && iPendingOp->Command() == KVtEngHandleLayoutChange )
+ || !iPendingOp ) )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+ case KVtEngSetAudioVolume:
+ if ( ( iProtoState == MVtProtocolCommand::EConnected ) && !iPendingOp )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+
+ if ( iProtoState == MVtProtocolCommand::EConnected )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+ case KVtEngRequestLastRemoteFrame:
+ if ( iProtoState == MVtProtocolCommand::EConnected )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareViewFinderDSA:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareViewFinderDP:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ okToPerform = KErrNone; // can be done any time
+ break;
+
+ case KVtEngHandleLayoutChange:
+ if ( iLocalVideo && iLocalVideo->ActiveProvider() !=
+ CVtEngLocalVideo::KVtEngProviderNone &&
+ !iPendingOp && iLocalVideo->ActiveProvider() !=
+ CVtEngLocalVideo::KVtEngProviderImage )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+
+ case KVtEngSetZoomStep:
+ {
+ const CVtEngLocalVideo::TVtEngProviderType
+ activeProvider( iLocalVideo->ActiveProvider() );
+ if ( iRequestStatus == NULL &&
+ iVSInitState == EInitStateNone &&
+ ( activeProvider == CVtEngLocalVideo::KVtEngProviderCam1 ||
+ activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 ) )
+ {
+ okToPerform = KErrNone;
+ }
+ }
+ break;
+ case KVtEngSetSource:
+ if ( !IsFlag( EOutVideoChannelClosed ) )
+ {
+ okToPerform = KErrNone;
+ }
+ // when EOutVideoChannelClosed is active
+ // don't allow source switch because it may require
+ // pause or resume on Protocol which would fail when video
+ // channel is closed.
+ // Note1: this is especially for the case when channel is
+ // closed after being already open.
+ // Note2: it must be possible to set source already before Protocol
+ // is connected (in MONA calls) so Proto state check is not done.
+ break;
+ case KVtEngPrepareCamera:
+ case KVtEngStartViewFinder:
+ case KVtEngFreeze:
+ case KVtEngUnfreeze:
+ if ( iRequestStatus == NULL &&
+ // If initialising or change provider during reset then
+ // not allowed
+ iVSInitState == EInitStateNone &&
+ // If terminate ongoing then not allowed
+ iProtoState != MVtProtocolCommand::EIdle )
+ {
+ okToPerform = KErrNone;
+ if( aCommand == KVtEngFreeze )
+ {
+ if( !iLocalVideo->OkToFreeze() )
+ {
+ okToPerform = KErrNotReady;
+ }
+ }
+ else if( aCommand == KVtEngUnfreeze )
+ {
+ if( !iLocalVideo->OkToUnfreeze() )
+ {
+ okToPerform = KErrNotReady;
+ }
+ }
+ }
+ break;
+ case KVtEngSetVideoQuality:
+ if( IsPending( ESetVideoQuality ) != KErrNotFound )
+ {
+ okToPerform = KErrNotReady;
+ }
+ else
+ {
+ if ( iRequestStatus == NULL && iProtoState != MVtProtocolCommand::EIdle )
+ {
+ okToPerform = KErrNone;
+ }
+ }
+ break;
+
+ case KVtEngInitializeShareImage:
+ {
+ TShareObjectState objectSharingState;
+ GetObjectSharingState( objectSharingState );
+ if ( ( objectSharingState != ENotAbleToShare ) &&
+ ( objectSharingState != EInitializingShareImage ) &&
+ !IsFlag( EOutVideoChannelClosed ) )
+ {
+ okToPerform = KErrNone;
+ }
+ }
+ break;
+
+ case KVtEngStartShareImage:
+ {
+ TShareObjectState objectSharingState;
+ GetObjectSharingState( objectSharingState );
+ if( objectSharingState != ENotAbleToShare )
+ {
+ okToPerform = KErrNone;
+ }
+ }
+ break;
+
+ case KVtEngStopShareImage:
+ {
+ TShareObjectState objectSharingState;
+ GetObjectSharingState( objectSharingState );
+ if ( ( objectSharingState == ESharingImage ) &&
+ !IsFlag( EOutVideoChannelClosed ) )
+ {
+ okToPerform = KErrNone;
+ }
+ }
+ break;
+
+ case KVtEngTerminateSession:
+ if ( iProtoState == MVtProtocolCommand::EConnected ||
+ iProtoState == MVtProtocolCommand::EConnecting )
+ {
+ okToPerform = KErrNone;
+ }
+ break;
+
+ default:
+ okToPerform= KErrNotSupported;
+ break;
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "MH.ValidateCommand okToPerform=%d", okToPerform )
+ __VTPRINTEXIT( "MH.ValidateCommand" )
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsVideoChannelClosed
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::IsVideoChannelClosed() const
+ {
+ __VTPRINTENTER( "MH.IsVideoChannelClosed" )
+ const TBool result( IsFlag( EOutVideoChannelClosed ) );
+ __VTPRINTEXITR( "MH.IsVideoChannelClosed %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleL
+// Handles a request.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleL( CVtEngOperation& aOperation )
+ {
+ __VTPRINTENTER( "MH.HandleL" )
+
+ const TVtEngCommandId id( aOperation.Command() );
+ if ( !iInitialized )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.Handle not ready" )
+ User::Leave( KErrNotReady );
+ }
+ __VTPRINT2( DEBUG_MEDIA, "MH.Handle cmdId=%d", id )
+ switch ( id )
+ {
+ case KVtEngSetUIForeground:
+ TBool foregroundValue;
+ TVtEngOpParamUtil<TBool>::Set( foregroundValue, aOperation );
+ if( iLocalVideo )
+ {
+ iLocalVideo->SetUIForeground( foregroundValue );
+ }
+ if( iRemoteVideo )
+ {
+ iRemoteVideo->SetUIForegroundL( foregroundValue );
+ }
+ break;
+
+ case KVtEngSetAudioVolume:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.Handle.Vol" )
+ MVtEngAudio::TVtEngOutputVolume volSetting;
+ TVtEngOpParamUtil<MVtEngAudio::TVtEngOutputVolume>::Set(
+ volSetting, aOperation );
+
+ // Store volume.
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.SetVolume(
+ volSetting.iHandsetVolume,
+ volSetting.iHandsfreeVolume,
+ ETrue );
+ settings.SetVolume(
+ volSetting.iHandsetVolume,
+ volSetting.iHandsfreeVolume,
+ EFalse );
+
+ // Update volume.
+ iPendingVolumeOp = &aOperation;
+ AssignPendingOp( aOperation );
+ UpdateVolume();
+
+ if ( IsPending( ESetAudioVolume ) == KErrNotFound )
+ {
+ // No volume operation ongoing. Need to complete operation by itself.
+ AsyncCompleteOp();
+ }
+ }
+ break;
+
+ case KVtEngIncreaseAudioVolume:
+ {
+ CVtEngAudioHandler& audioHandler(
+ static_cast< CVtEngAudioHandler& >(
+ CVtEngUtility::StateManager()->Handlers().Audio() ) );
+ if ( audioHandler.IncreaseVolume() )
+ {
+ UpdateVolume();
+ }
+ }
+ break;
+
+ case KVtEngDecreaseAudioVolume:
+ {
+ CVtEngAudioHandler& audioHandler(
+ static_cast< CVtEngAudioHandler& >(
+ CVtEngUtility::StateManager()->Handlers().Audio() ) );
+ if ( audioHandler.DecreaseVolume() )
+ {
+ UpdateVolume();
+ }
+ }
+ break;
+
+ case KVtEngMuteOutgoingAudio:
+ {
+ // No Local video if not on target
+#if !defined( __WINS__ )
+ AddOperation( EMuteAudio,
+ iSessionCommand->PauseAudioL( *iLocalVideo->AudioSource()) );
+#endif // !WINS
+ AssignPendingOp( aOperation );
+ }
+ break;
+ case KVtEngUnmuteOutgoingAudio:
+ {
+ // No Local video if not on target
+#if !defined( __WINS__ )
+ AddOperation ( EUnmuteAudio,
+ iSessionCommand->ResumeAudioL( *iLocalVideo->AudioSource() ) );
+#endif // !WINS
+ AssignPendingOp( aOperation );
+ }
+ break;
+ case KVtEngPrepareViewFinder:
+ {
+ const TPckgC<TVtEngRenderingOptionsNGA>& pckg =
+ static_cast< const TPckgC<TVtEngRenderingOptionsNGA>& >
+ ( *aOperation.Parameters() );
+ const TVtEngRenderingOptionsNGA &options = pckg();
+ iLocalVideo->SetViewFinderParameters( options );
+ }
+ break;
+ case KVtEngPrepareRemoteRenderNGA:
+ {
+ const TPckgC<TVtEngRenderingOptionsNGA>& pckg =
+ static_cast< const TPckgC<TVtEngRenderingOptionsNGA>& >
+ ( *aOperation.Parameters() );
+ const TVtEngRenderingOptionsNGA& options = pckg();
+ iRemoteVideo->SetRenderingParametersL( options );
+ }
+ break;
+ case KVtEngPrepareViewFinderDSA:
+ case KVtEngPrepareRemoteRenderDSA:
+ {
+ const TPckgC<TVtEngRenderingOptionsDSA>& pckg =
+ static_cast< const TPckgC<TVtEngRenderingOptionsDSA>& >
+ ( *aOperation.Parameters() );
+ const TVtEngRenderingOptionsDSA& options = pckg();
+ if ( id == KVtEngPrepareViewFinderDSA )
+ {
+ iLocalVideo->SetViewFinderParameters( options );
+ }
+ else if ( iRemoteVideo )
+ {
+ iRemoteVideo->SetRenderingParametersL( options );
+ }
+ }
+ break;
+
+ case KVtEngPrepareViewFinderDP:
+ case KVtEngPrepareRemoteRenderDP:
+ {
+ const TPckgC<TVtEngRenderingOptionsDP>& pckg =
+ static_cast< const TPckgC<TVtEngRenderingOptionsDP>& >
+ ( *aOperation.Parameters() );
+ const TVtEngRenderingOptionsDP& options = pckg();
+ if ( id == KVtEngPrepareViewFinderDP )
+ {
+ iLocalVideo->SetViewFinderParameters( options );
+ }
+ else if ( iRemoteVideo )
+ {
+ iRemoteVideo->SetRenderingParametersL( options );
+ }
+ }
+ break;
+
+ case KVtEngHandleLayoutChange:
+ iLocalVideo->HandleLayoutChangeL();
+ AssignPendingOp( aOperation );
+ break;
+
+ case KVtEngSetSource:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.set source" )
+ MVtEngMedia::TMediaSource source;
+ TVtEngOpParamUtil<MVtEngMedia::TMediaSource>::Set( source,
+ aOperation );
+
+ iLocalVideo->InitializeOnly( EFalse );
+ TOperation startedOp( ENone );
+ switch ( source )
+ {
+ case EMediaCamera:
+ __VTPRINT( DEBUG_MEDIA, "EMediaCamera" )
+ iTempProviderInfo =
+ ( iSelectedCameraId == ESecondaryCamera ) ?
+ CVtEngLocalVideo::KVtEngProviderCam2 :
+ CVtEngLocalVideo::KVtEngProviderCam1;
+
+ SetFlag( EProtoContVideoBlankProv );
+ startedOp = EnableVideoL( ETrue );
+ if ( startedOp == ENone )
+ {
+ // Did nothing
+ ClearFlag( EProtoContVideoBlankProv );
+ }
+ iLocalVideo->ResumeVideoSending();
+ break;
+ case EMediaCameraPri:
+ __VTPRINT( DEBUG_MEDIA, "EMediaCameraPri" )
+ iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderCam1;
+ iSelectedCameraId = EPrimaryCamera;
+ ClearFlag( EProtoContVideoBlankProv );
+ break;
+ case EMediaCameraSec:
+ __VTPRINT( DEBUG_MEDIA, "EMediaCameraSec" )
+ iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderCam2;
+ iSelectedCameraId = ESecondaryCamera;
+ ClearFlag( EProtoContVideoBlankProv );
+ break;
+ case EMediaStillImage:
+ __VTPRINT( DEBUG_MEDIA, "EMediaStillImage" )
+ iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderImage;
+ SetFlag( EProtoContVideoBlankProv );
+ startedOp = EnableVideoL( ETrue );
+ if ( startedOp == ENone )
+ {
+ // Did nothing
+ ClearFlag( EProtoContVideoBlankProv );
+ }
+ break;
+ case EMediaNone:
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "EMediaNone" )
+ if ( CVtEngUtility::Settings().
+ IsDefaultStillImageDefined() )
+ {
+ iTempProviderInfo =
+ CVtEngLocalVideo::KVtEngProviderDefaultStillImage;
+
+ SetFlag( EProtoContVideoBlankProv );
+ startedOp = EnableVideoL( ETrue );
+ if ( startedOp == ENone )
+ {
+ // Did nothing
+ ClearFlag( EProtoContVideoBlankProv );
+ }
+ }
+ else
+ {
+ iTempProviderInfo =
+ CVtEngLocalVideo::KVtEngProviderNone;
+
+ ClearFlag( EProtoContVideoBlankProv );
+ SetFlag( EProtoPauseVideoBlankProv );
+ if ( !IsFlag(
+ EProtoVideoSourceAdded ) && iProtoState != MVtProtocolCommand::EConnected )
+ {
+ // Set as not enabled video when no sources
+ __VTPRINT( DEBUG_MEDIA, "MH.set blanked - not ready" )
+ EnableVideoL( EFalse );
+ }
+ else
+ {
+ // we have "done" something
+ startedOp = EDisableVideo;
+ iLocalVideo->PauseVideoSending();
+ }
+ }
+ break;
+ default:
+ __VTPRINT( DEBUG_MEDIA, "invalid source" )
+ User::Leave( KErrArgument );
+ }
+ TBool selectOngoing( EFalse );
+ ClearFlag( ESourceUpdateNeeded );
+ TInt err( KErrNone );
+
+ // Either pausing or switching between still and camera
+ if ( !IsFlag( EProtoContVideoBlankProv ) )
+ {
+ TRAP( err, selectOngoing =
+ iLocalVideo->SelectSourceL( iTempProviderInfo ) );
+ __VTPRINT3( DEBUG_MEDIA, " ongoing=%d, op=%d",selectOngoing,
+ startedOp )
+ }
+
+ if ( ( selectOngoing || IsFlag( EProtoContVideoBlankProv ) ||
+ IsFlag( EProtoContVideoBlankInit ) ) &&
+ startedOp != ENone && err == KErrNone )
+ {
+ // Enabling/disabling video started. Set flag that operation
+ // should be completed only when both callback from Protocol and
+ // local video (switch done) are complete.
+ __VTPRINT( DEBUG_MEDIA, "MH.set source 2stage" )
+ SetFlag( ETwoStageOperation );
+ }
+ else
+ {
+ User::LeaveIfError( err );
+ }
+ AssignPendingOp( aOperation );
+ }
+ break;
+ case KVtEngPrepareCamera:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.prepare cam" )
+ MVtEngMedia::TPrepareCameraParams params;
+ if ( aOperation.Parameters() )
+ {
+ TVtEngOpParamUtil< MVtEngMedia::TPrepareCameraParams >
+ ::Set( params, aOperation );
+ }
+ else
+ {
+ params.iMediaSource = EMediaCamera;
+ params.iInitialize = ETrue;
+ }
+ CVtEngLocalVideo::TVtEngProviderType
+ type( CVtEngLocalVideo::KVtEngProviderCam1 );
+ switch ( params.iMediaSource )
+ {
+ case EMediaCamera:
+ type = ( iSelectedCameraId == ESecondaryCamera ) ?
+ CVtEngLocalVideo::KVtEngProviderCam2 :
+ CVtEngLocalVideo::KVtEngProviderCam1;
+ break;
+ case EMediaCameraPri:
+ iSelectedCameraId = EPrimaryCamera;
+ type = CVtEngLocalVideo::KVtEngProviderCam1;
+ break;
+ case EMediaCameraSec:
+ iSelectedCameraId = ESecondaryCamera;
+ type = CVtEngLocalVideo::KVtEngProviderCam2;
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+ iLocalVideo->SetIsPrepareCameraCalled( ETrue );
+ AssignPendingOp( aOperation );
+ if ( params.iInitialize )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.prepare cam iInitialize TRUE" )
+ iLocalVideo->InitializeOnly();
+ ClearFlag( ESourceUpdateNeeded );
+ iLocalVideo->SelectSourceL( type );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.prepare cam iInitialize FALSE, complete with KErrNone" )
+ AsyncCompleteOp( KErrNone );
+ }
+ }
+ break;
+
+ case KVtEngSetZoomStep:
+ {
+ TInt zoom( 0 );
+ TVtEngOpParamUtil<TInt>::Set( zoom, aOperation );
+ iLocalVideo->SetDigitalZoomFactorL( zoom );
+ }
+ break;
+
+ case KVtEngFreeze:
+ iLocalVideo->FreezeL();
+ break;
+
+ case KVtEngUnfreeze:
+ iLocalVideo->UnfreezeL();
+ AssignPendingOp( aOperation );
+ break;
+
+ case KVtEngStartViewFinder:
+ iLocalVideo->StartViewFinderL( ETrue );
+ break;
+ case KVtEngStopViewFinder:
+ iLocalVideo->StopViewFinder( ETrue );
+ break;
+ case KVtEngStartRenderRemote:
+ iRemoteVideo->StartVideoL();
+ break;
+ case KVtEngStopRenderRemote:
+ iRemoteVideo->StopVideoRendering();
+ break;
+ case KVtEngPauseRenderRemote:
+ iRemoteVideo->PauseVideoL();
+ break;
+ case KVtEngRequestLastRemoteFrame:
+ RequestLastRemoteFrame();
+ break;
+ case KVtEngTerminateSession:
+ AssignPendingOp( aOperation );
+ break;
+
+ // Set video quality
+ case KVtEngSetVideoQuality:
+ {
+ TVideoQuality videoQuality( EVideoQualityUndefined );
+ TVtEngOpParamUtil< TVideoQuality >::Set( videoQuality, aOperation );
+ SetPeerVideoQuality( videoQuality );
+ }
+ break;
+
+ // Initialize share
+ case KVtEngInitializeShareImage:
+ {
+ TShareObjectImageParameters parameters;
+ TVtEngOpParamUtil< TShareObjectImageParameters >::Set(
+ parameters, aOperation );
+ TBool firstTime = EFalse;
+ iLocalVideo->InitializeShareImageL( parameters, firstTime );
+ AssignPendingOp( aOperation );
+ if ( firstTime )
+ {
+ iVideoAction = IsFlag( EProtoVideoTrackPaused ) ?
+ EVideoActionEnable : EVideoActionNone;
+ }
+ }
+ break;
+
+ // Start share
+ case KVtEngStartShareImage:
+ iLocalVideo->StartShareImageL();
+ AssignPendingOp( aOperation );
+ break;
+
+ // Stop Image sharing
+ case KVtEngStopShareImage:
+ {
+ // If video sending needs to be paused when sharing is stopped
+ // then do it before doing the actual provider switch. It is
+ // done before hand to prevent dummy frame sending to receiving
+ // end (ie. black frame).
+ const TBool needsPause( iLocalVideo->ShareStoredSource() ==
+ CVtEngLocalVideo::KVtEngProviderNone );
+ if ( needsPause )
+ {
+ // With this flag we prevent premature operation
+ // complete after the pause command has been executed.
+ iPauseNoCompleteOp = ETrue;
+ EnableVideoL( EFalse );
+ }
+ // reset the action flag.
+ iVideoAction = EVideoActionNone;
+ iLocalVideo->StopShareImageL();
+ AssignPendingOp( aOperation );
+ }
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ __VTPRINTEXIT( "MH.HandleL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionCommandEventL
+// Handles command completion in protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSessionCommandEventL(
+ const TVtCommandResponse& aResponse )
+ {
+ __VTPRINTENTER( "MH.HandleSessionCommandEventL" )
+ const TVtCommandType type( aResponse.iCmdType );
+ if ( type == EVtCommandGetSDKInfo )
+ {
+ // ignore completely
+ __VTPRINTEXIT( "MH.HandleSessionCommandEventL" )
+ return;
+ }
+ const TInt protoCmdId( aResponse.iCmdId );
+ const TInt protoResponse( aResponse.iCmdStatus );
+ TInt event( KVtEngEventNone );
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoComC type=%d", type )
+ __VTPRINT3( DEBUG_MEDIA, "MH.protoComC cmdId=%d,response=%d", protoCmdId, protoResponse )
+
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ switch ( type )
+ {
+ case EVtCommandGetProtocolState:
+ break;
+ case EVtCommandInit://PVT_COMMAND_INIT -> ESetup
+ {
+ CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+ iSessionCommand = utils->Initializer().GetSessionCommand();
+ iRemoteVideo = CVtEngRemoteVideo::NewL( *iSessionCommand, *states );
+ iInitialized = ETrue;
+ iProtoState = MVtProtocolCommand::ESetup;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup" )
+ states->Update();
+
+ // Get interfaces towards H324 and video encoder
+ QueryProtoInterfacesL();
+ }
+ break;
+ case EVtCommandGetProtocolInterface:
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoComC:IF response=%d", protoCmdId )
+ if ( protoResponse == KErrNone &&
+ ( iProtoState == MVtProtocolCommand::ESetup ||
+ iProtoState == MVtProtocolCommand::EInitializing || // Allowed to query when initializing also
+ iProtoState == MVtProtocolCommand::EConnecting ||
+ iProtoState == MVtProtocolCommand::EConnected ) )
+ {
+ __ASSERT_DEBUG(
+ IsPending( EGet324CtrlInterface ) != KErrNotFound
+ || IsPending( EGetH263EncInterface ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+ //Check which interface.
+ if ( MatchResponseToPendingOps(
+ protoCmdId, EGet324CtrlInterface ) && iH324Config )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:324 IF" )
+ iH324Config->SetObserverL ( this );
+
+ // Create DTMF handler with H324 interface.
+ CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+ TRAP_IGNORE( utils->Initializer().CreateDtmfHandlerL( iH324Config ) );
+
+ // Set version to protocol -- cannot cause problem
+#ifdef VTDEBUG
+ TRAPD( err, SetVersionInfoL() );
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA,
+ "MH.protoComC:324 IF VersionInfo failed=%d", err )
+ }
+#else
+ TRAP_IGNORE( SetVersionInfoL() );
+#endif
+ // Set resolutions to Proto.
+ SetSupportedResolutions();
+
+ // Set Fast options
+ SetFastCsupOptions();
+
+ SetFlag( EProto324IFAcquired );
+ RemoveOperation( protoCmdId );
+ states->Update();
+ }
+ else if ( MatchResponseToPendingOps(
+ protoCmdId, EGetH263EncInterface ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:IF 263 created" )
+ iH263Encoder->SetObserverL( this );
+ RemoveOperation( protoCmdId );
+ }
+ else
+ {
+ // Not supported interface.
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:NOT requested" )
+ }
+ }
+ else
+ {
+ // failed or not in appropriate state
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:query IF fail/incorrect state" )
+ RemoveOperation( protoCmdId );
+ }
+ }
+ break;
+
+ case EVtCommandResume:
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC Resume" )
+
+ __ASSERT_DEBUG(
+ IsPending( EUnmuteAudio ) != KErrNotFound ||
+ IsPending( EEnableVideo ) != KErrNotFound ||
+ IsPending( EEnableVideoInternal ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+ // Was command unmute audio?
+ const TBool audioEnabled(
+ MatchResponseToPendingOps( protoCmdId, EUnmuteAudio ) );
+
+ if ( protoResponse == KErrNone )
+ {
+ if ( audioEnabled )
+ {
+ iLocalVideo->UnMute();
+ event = KVtEngAudioUnmuted;
+ }
+ else
+ {
+ iLocalVideo->ResumeVideoSending();
+ }
+ }
+
+ // Was command enable video?
+ const TBool videoEnabledByUser(
+ MatchResponseToPendingOps( protoCmdId, EEnableVideo ) );
+
+ RemoveOperation( protoCmdId );
+
+ if ( videoEnabledByUser && IsFlag( ETwoStageOperation ) )
+ {
+ // Two-phase operation (resume + switch, resume completed)
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.video Resume 1st stage" )
+ ClearFlag( ETwoStageOperation );
+ ClearFlag( ESourceUpdateNeeded );
+ iLocalVideo->SelectSourceL( iTempProviderInfo );
+ iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderNone;
+ }
+ else if ( videoEnabledByUser || audioEnabled )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.video Resume " )
+ CompleteOp( protoResponse );
+ }
+
+ // Do send an intra message
+ if ( videoEnabledByUser && IsFlag( EProtoVideoTrackPaused ) )
+ {
+ ClearFlag( EProtoVideoTrackPaused );
+ if ( IsFlag( EProtoSendIntraFrame ) )
+ {
+ RequestFrame();
+ }
+ }
+ }
+ break;
+ case EVtCommandPause: // Audio or video disable
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC Pause" )
+ __ASSERT_DEBUG( iRequestStatus ||
+ // uninit ongoing, still possible
+ // to receive callback from protocol
+ ( IsPending( EMuteAudio ) != KErrNotFound ||
+ IsPending( EDisableVideo ) != KErrNotFound ),
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+ TBool videoDisabled( EFalse );
+
+ // was command disable audio?
+ if ( MatchResponseToPendingOps( protoCmdId, EMuteAudio ) )
+ {
+ iLocalVideo->Mute();
+ event = KVtEngAudioMuted;
+ }
+ else
+ {
+ // was command disable video?
+ videoDisabled = MatchResponseToPendingOps(
+ protoCmdId, EDisableVideo );
+ if ( videoDisabled )
+ {
+ SetFlag( EProtoVideoTrackPaused );
+ }
+ }
+ RemoveOperation( protoCmdId );
+ if ( IsFlag( ETwoStageOperation ) && videoDisabled )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.video pause 1st stage" )
+ // First event out of two that DisableVideo video
+ // is complete (waiting for event from local video).
+
+ if ( !IsPending( EEnableVideo ) )
+ {
+ ClearFlag( ETwoStageOperation );
+ }
+ else
+ {
+ // Except if pause was not user originated, i.e
+ // pause done in the beginning because there is no
+ // still image to be sent in MT call and video is paused
+ // (user has not yet allowed video sending).
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.video paused, 2stage NOT CLEARED" )
+ }
+ }
+ else
+ {
+ if ( !iPauseNoCompleteOp )
+ {
+ CompleteOp( protoResponse );
+ }
+ else
+ {
+ iPauseNoCompleteOp = EFalse;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.video paused due to share stop, clearing flag" )
+ }
+ }
+ }
+ break;
+ case EVtCommandAddDataSink:
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink");
+ if ( protoResponse == KErrNone )
+ {
+ __ASSERT_DEBUG( iRequestStatus ||
+ // uninit ongoing, still possible
+ // to receive callback from pv2way
+ ( IsPending( EAddVideoSink ) != KErrNotFound ||
+ IsPending( EAddAudioSink ) != KErrNotFound ),
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.data sink added" )
+
+ if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSink )
+ && ( iRemoteMediaState & EMediaVideoPreparing ) )
+ {
+ // Video sink added
+ SetFlag( EProtoVideoSinkAdded );
+ iRemoteMediaState &= ~EMediaVideoPreparing;
+ iRemoteMediaState |= EMediaVideo;
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink for VIDEO OK.");
+ }
+ else if ( MatchResponseToPendingOps( protoCmdId, EAddAudioSink )
+ && ( iRemoteMediaState & EMediaAudioPreparing ) )
+ {
+ // Audio sink added
+ SetFlag( EProtoAudioSinkAdded );
+ iRemoteMediaState &= ~EMediaAudioPreparing;
+ iRemoteMediaState |= EMediaAudio;
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink for AUDIO OK.");
+ // DevSound created in Proto => temporary devSound needed
+ // for making audio routing work can be released now.
+ CVtEngStateManager* stateManager =
+ CVtEngUtility::StateManager();
+ CVtEngAudioHandler& audioHandler =
+ static_cast< CVtEngAudioHandler& >(
+ stateManager->Handlers().Audio() );
+ audioHandler.SetRoutingEnablerL( EFalse );
+ RequestAudioControllerL();
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC invalid" )
+ Panic( EVtEngPanicMediaHandlerOpStateFailure );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED");
+
+ if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSink ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED, INCOMING VIDEO");
+
+ iVideoIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+ if( iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SINK" )
+ AddVideoSink( iVideoIncomingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED, INCOMING AUDIO");
+
+ iAudioIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+ if( iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SINK" )
+ AddAudioSink( iAudioIncomingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ }
+ RemoveOperation( protoCmdId );
+ }
+ break;
+ case EVtCommandAddDataSource:
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.data source added" )
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource");
+ if ( protoResponse == KErrNone &&
+ ( iProtoState == MVtProtocolCommand::EConnected || iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::ESetup ) )
+ {
+ if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSource ) )
+ {
+ SetFlag( EProtoVideoSourceAdded );
+
+ // This flag was set if channel closed indication
+ // EVtIndicationClosingTrack was received from Proto.
+ ClearFlag( EOutVideoChannelClosed );
+
+ iLocalVideo->VideoChannelOpenedL();
+
+ CVtEngEventManager::NotifyEvent(
+ KVtEngMediaOutgoingVideoChannelStatusChanged );
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource for VIDEO OK.");
+
+ // Adjust to normal value after Connect has completed
+ // so MONA is over.
+ if( iProtoState == MVtProtocolCommand::EConnected )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I Frame Interval in " )
+ __VTPRINT( DEBUG_MEDIA, "LCN: ADD_DATA_SOURCE for Video, Connect has completed earlier." )
+ __VTPRINT( DEBUG_MEDIA, "LCN: Normal I-frame rate." )
+
+
+ // Setting I-Frame interval to normal since MONA connections are over.
+ AddOperation( ESetIFrameInterval,
+ // I-Frame every 10 second.
+ iH263Encoder->SetIntraFrameInterval( 100 ) );
+ }
+ else if( iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::ESetup )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I Frame Interval in " )
+ __VTPRINT( DEBUG_MEDIA, "LCN: ADD_DATA_SOURCE for Video, Proto state Connecting." )
+ __VTPRINT( DEBUG_MEDIA, "LCN: High I-frame rate" )
+
+ // MONA negotiations ongoing, I-Frame invertal must be small
+ AddOperation( ESetIFrameInterval,
+ // 10 I-Frames every 1 second.
+ iH263Encoder->SetIntraFrameInterval( 10000 ) );
+ }
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.data setting default videoquality" )
+
+ // Set default frame rate and send indication to peer
+ if ( !IsFlag( EVideoQualitySetByPeer ) )
+ {
+ SetVideoQualityL( EVideoQualityNormal, ETrue );
+ }
+
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.data source added check flag" )
+ if ( IsFlag( EProtoPauseVideoRequested ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.data source added pausing video" )
+ EnableVideoL( EFalse );
+ }
+ }
+ else if ( MatchResponseToPendingOps(
+ protoCmdId, EAddAudioSource ) )
+ {
+ SetFlag( EProtoAudioSourceAdded );
+
+ // This flag was set if channel closed indication
+ // EVtIndicationClosingTrack was received from PV.
+ ClearFlag( EOutAudioChannelClosed );
+
+ CVtEngEventManager::NotifyEvent(
+ KVtEngMediaOutgoingAudioChannelStatusChanged );
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource for AUDIO OK.");
+ }
+ }
+
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource FAILED");
+
+ if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSource ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "EVtCommandAddDataSource FAILED, OUTGOING VIDEO");
+
+ iVideoOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+ if( iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SOURCE" )
+ AddVideoSource( iVideoOutgoingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource FAILED, OUTGOING AUDIO");
+
+ iAudioOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+ if( iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SOURCE" )
+ AddAudioSource( iAudioOutgoingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ }
+
+ if ( !RemoveOperation( protoCmdId ) )
+ {
+ __ASSERT_DEBUG( iRequestStatus != NULL,
+ // uninit ongoing, still possible to receive
+ // callback from protocol
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+ }
+ states->Update();
+ break;
+ }
+
+ case EVtCommandConnect:
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.Connect complete" )
+ if ( protoResponse == KErrNone )
+ {
+ __ASSERT_DEBUG( IsPending( EConnectProto ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+ RemoveOperation( EConnectProto );
+ iProtoState = MVtProtocolCommand::EConnected;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EConnected" )
+ states->Update();
+
+ // Adjust only if VideoSource adding has compled
+ if( IsPending( EAddVideoSource ) == KErrNotFound )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I FrameInterval " )
+ __VTPRINT( DEBUG_MEDIA, "LCN: after Connect has completed" )
+ __VTPRINT( DEBUG_MEDIA, "LCN: Normal I-frame interval." )
+
+
+ // Setting I-Frame interval to normal since MONA connections are over.
+ AddOperation( ESetIFrameInterval,
+ // I-Frame every 10 second.
+ iH263Encoder->SetIntraFrameInterval( 100 ) );
+ }
+ }
+ else
+ {
+ if ( iProtoState == MVtProtocolCommand::EConnecting ) {
+ // it is possible that we're here because call was hanged up
+ iProtoState = MVtProtocolCommand::ESetup;
+ }
+ RemoveOperation( EConnectProto );
+ // connect may have failed due to disconnect request (possible only in debug env?)
+ if ( iPendingOp &&
+ ( iPendingOp->Command() == KVtEngTerminateSession ) )
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "complete KVtEngTerminateSession on connect failure" )
+ CompleteOp( KErrNone );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "request fallback on connect failure" )
+ // request fallback from telephony
+ CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+ utils->MediatorCommands().VoiceFallback();
+ }
+ states->Update();
+ }
+ }
+ break;
+ case EVtCommandRemoveDataSource:
+ case EVtCommandRemoveDataSink:
+ break;
+ case EVtCommandReset:
+ {
+ __ASSERT_DEBUG( IsPending( EDestructProtoPhaseReset ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:RESET complete" )
+ RemoveOperation( protoCmdId );
+ if ( protoResponse == KErrNone )
+ {
+ iProtoState = MVtProtocolCommand::EIdle;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EIdle" )
+ }
+ if ( iRequestStatus )
+ {
+ // we're in uninitialization process
+ // do this even if reset failed!
+ iLocalVideo->StopViewFinder();
+ UninitializeNextStep();
+ }
+ states->Update();
+ }
+ break;
+ case EVtCommandDeleteProtocolInterface:
+ {
+
+ // Remove pending operation from list
+ RemoveOperation( protoCmdId );
+
+ // Proceed to disconnecting if inetrfaces are free'd
+ UninitializeNextStep();
+ states->Update();
+
+ break;
+ }
+ case EVtCommandDisconnect:
+ {
+ __ASSERT_DEBUG(
+ IsPending( EDestructProtoPhaseDisconnect ) != KErrNotFound ||
+ IsPending( ETerminateSession ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC:DISCONNECT complete" )
+ if ( protoResponse == KErrNone )
+ {
+ iProtoState = MVtProtocolCommand::ESetup;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup_disconnect" )
+ }
+
+ delete iTimer;
+ iTimer = NULL;
+
+ RemoveOperation( protoCmdId );
+
+ // If disconnect was requested while connecting we
+ // have connect operation added.
+ RemoveOperation( EConnectProto );
+
+ if ( iRequestStatus )
+ {
+ // continue uninitialization
+ UninitializeNextStep();
+ }
+ else
+ {
+ // complete plain disconnect request from UI
+ CompleteOp( protoResponse );
+ }
+ states->Update();
+ }
+ break;
+ case EVtCommandCancelAllCommands:
+ {
+ __ASSERT_DEBUG(
+ IsPending( EUninitializeCancelAllProto ) != KErrNotFound,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+ RemoveOperation( protoCmdId );
+
+ UninitializeNextStep();
+ }
+ break;
+ default:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC Unknown Proto reply" )
+ }
+ break;
+ }
+ if ( event != KVtEngEventNone )
+ {
+ CVtEngEventManager::NotifyEvent( event );
+ }
+ __VTPRINTEXIT( "MH.HandleSessionCommandEventL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionInformationalEventL
+// Handles event from protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSessionInformationalEventL(
+ const TVtIndicationEvent& aEvent)
+ {
+ __VTPRINTENTER( "MH.InfoEvent" )
+ const TInt type( aEvent.iEventType );
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE type=%d", type )
+
+ TVtIndicationEvent& event =
+ const_cast<TVtIndicationEvent&>(aEvent);
+ const TUint8* buffer = event.iLocalBuffer;
+
+ if ( buffer || type == EVtIndicationDisconnect )
+ {
+ TBool video( EFalse );
+ TBool audio( EFalse );
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE inbound")
+ if ( type != EVtIndicationDisconnect &&
+ type != EVtIndicationUserInputCapability )
+ {
+ switch ( buffer[0] )
+ {
+ case EVtAudio:
+ audio = ETrue;
+ break;
+ case EVtVideo:
+ video = ETrue;
+ break;
+ case EVtControl:
+ case EVtData:
+ case EVtMediaNone:
+ __VTPRINTEXIT( "MH.InfoEvent" )
+ return;
+
+ default:
+ break;
+
+ }
+ }
+
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE acting according" )
+ TInt event( KVtEngEventNone );
+ switch ( type )
+ {
+ case EVtIndicationIncomingTrack:
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationIncomingTrack" )
+ if ( video )
+ {
+ TInt tempID = *((TInt*)(buffer+4));
+ __VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE INCOMING VIDEO:%d", tempID )
+
+ if( !iVideoIncomingLogicalChannel.iSameTypeClosingPending )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE InTrack VIDEO, ADDing SINK" )
+ AddVideoSink( tempID );
+ }
+ else
+ {
+ // Store old value since ID will change when we get outgoing track indication
+ iVideoIncomingLogicalChannel.iLogicalChannelIdClosing = iVideoIncomingLogicalChannel.iLogicalChannelId;
+ iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+ }
+
+ // Store new LCN ID.
+ iVideoIncomingLogicalChannel.iLogicalChannelId = tempID;
+ }
+ else if ( audio )
+ {
+ TInt tempID = *((TInt*)(buffer+4));
+ __VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE INCOMING AUDIO:%d", tempID )
+
+ if( !iAudioIncomingLogicalChannel.iSameTypeClosingPending )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE InTrack AUDIO, ADDing SINK" )
+ AddAudioSink( tempID );
+ }
+ else
+ {
+ // Store old value since ID will change when we get outgoing track indication
+ iAudioIncomingLogicalChannel.iLogicalChannelIdClosing = iAudioIncomingLogicalChannel.iLogicalChannelId;
+ iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+ }
+
+ // Store new LCN ID.
+ iAudioIncomingLogicalChannel.iLogicalChannelId = tempID;
+ }
+ }
+ break;
+
+ case EVtIndicationOutgoingTrack:
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationOutgoingTrack" )
+ if ( video )
+ {
+ TInt tempID = *((TInt*)(buffer+4));
+ __VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE OUTGOING VIDEO ID:%d", tempID )
+
+ if( !iVideoOutgoingLogicalChannel.iSameTypeClosingPending )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE OutTrack VIDEO, ADDing SOURCE" )
+ AddVideoSource( tempID );
+ }
+ else
+ {
+ // Store old value since ID will change when we get outgoing track indication
+ iVideoOutgoingLogicalChannel.iLogicalChannelIdClosing = iVideoOutgoingLogicalChannel.iLogicalChannelId;
+ iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+ }
+
+ // Store new LCN ID.
+ iVideoOutgoingLogicalChannel.iLogicalChannelId = tempID;
+ }
+ else if ( audio )
+ {
+
+ TInt tempID = *((TInt*)(buffer+4));
+ __VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE OUTGOING AUDIO:%d", tempID )
+
+ if( !iAudioOutgoingLogicalChannel.iSameTypeClosingPending )
+ {
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE OutTrack AUDIO, ADDing SOURCE" )
+ AddAudioSource( tempID );
+ }
+ else
+ {
+ // Store old value since ID will change when we get outgoing track indication
+ iAudioOutgoingLogicalChannel.iLogicalChannelIdClosing = iAudioOutgoingLogicalChannel.iLogicalChannelId;
+ iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+ }
+
+ // Store new LCN ID.
+ iAudioOutgoingLogicalChannel.iLogicalChannelId = tempID;
+ }
+ }
+ break;
+
+ case EVtIndicationClosingTrack:
+ {
+
+ TUint8 direction = buffer[0];
+ TInt tempID = *((TInt*)(buffer+4));
+
+ __VTPRINT3( DEBUG_MEDIA, "LCN: MH.protoHIE PEVtIndicationClosingTrack ID:%d, dir:%d", tempID, direction )
+
+ if( direction == EVtIncoming )
+ {
+ if( tempID == iVideoIncomingLogicalChannel.iLogicalChannelId )
+ {
+ iVideoIncomingLogicalChannel.iSameTypeClosingPending = ETrue;
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING INCOMING VIDEO" )
+ }
+ else
+ {
+ iAudioIncomingLogicalChannel.iSameTypeClosingPending = ETrue;
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING INCOMING AUDIO" )
+ }
+ }
+ else
+ {
+ TInt uiEvent;
+ if( tempID == iVideoOutgoingLogicalChannel.iLogicalChannelId )
+ {
+ SetFlag( EOutVideoChannelClosed );
+ iVideoOutgoingLogicalChannel.iSameTypeClosingPending = ETrue;
+ uiEvent = KVtEngMediaOutgoingVideoChannelStatusChanged;
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING OUTGOING VIDEO" )
+ }
+ else
+ {
+ SetFlag( EOutAudioChannelClosed );
+ iAudioOutgoingLogicalChannel.iSameTypeClosingPending = ETrue;
+ uiEvent = KVtEngMediaOutgoingAudioChannelStatusChanged;
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING OUTGOING AUDIO" )
+ }
+ CVtEngEventManager::NotifyEvent( uiEvent );
+ }
+ }
+ break;
+
+ case EVtIndicationCloseTrack:
+ {
+
+ TInt tempID = *((TInt*)(buffer+4));
+
+ TUint8 direction = buffer[0];
+
+ __VTPRINT3( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationCloseTrack ID:%d, dir:%d", tempID, direction )
+
+ if( direction == EVtIncoming )
+ {
+ if( iVideoIncomingLogicalChannel.iLogicalChannelId == tempID ||
+ ( iVideoIncomingLogicalChannel.iSameTypeClosingPending &&
+ tempID == iVideoIncomingLogicalChannel.iLogicalChannelIdClosing )
+ )
+ {
+ iVideoIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+ iRemoteMediaState &= ~EMediaVideo;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE INCOMING VIDEO" )
+
+ if( iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SINK" )
+ AddVideoSink( iVideoIncomingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ else
+ {
+ iAudioIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE INCOMING AUDIO" )
+
+ if( iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SINK" )
+ AddAudioSink( iAudioIncomingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ }
+ else
+ {
+ if( iVideoOutgoingLogicalChannel.iLogicalChannelId == tempID ||
+ ( iVideoOutgoingLogicalChannel.iSameTypeClosingPending &&
+ tempID == iVideoOutgoingLogicalChannel.iLogicalChannelIdClosing )
+ )
+ {
+ iVideoOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE OUTGOING VIDEO" )
+
+ if( iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SOURCE" )
+ AddVideoSource( iVideoOutgoingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ else
+ {
+ iAudioOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE OUTGOING AUDIO" )
+
+ if( iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+ {
+ iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SOURCE" )
+ AddAudioSource( iAudioOutgoingLogicalChannel.iLogicalChannelId );
+ }
+ }
+ }
+ }
+ break;
+ case EVtIndicationResumeTrack:
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE X is resumed %d", buffer[1] )
+ if ( buffer[1] == EVtIncoming ) // Only for remote
+ {
+ if ( video )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE video resumed" )
+ event = KVtEngRemoteVideoResumed;
+ ClearFlag( EProtoVideoTrackPaused );
+ }
+ else if ( audio )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE audio resumed" )
+ event = KVtEngRemoteAudioResumed;
+ ClearFlag( EProtoAudioTrackPaused );
+ }
+ }
+ break;
+ case EVtIndicationPauseTrack:
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE X is paused %d", buffer[1] )
+ if ( buffer[1] == EVtIncoming ) // Only for remote
+ {
+ if ( audio )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE audio paused" )
+ SetFlag( EProtoAudioTrackPaused );
+ event = KVtEngRemoteAudioPaused;
+ }
+ else if ( video )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoHIE video paused" )
+ SetFlag( EProtoVideoTrackPaused );
+ event = KVtEngRemoteVideoPaused;
+ }
+ }
+ break;
+ case EVtIndicationDisconnect:
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "MH.protoHIE PID" )
+
+ // Fix for disconnecting remote (bearer). Engine
+ // needs to send KVtEngRemoteDisconnect event to UI to notify
+ // UI that call can not be hangup!
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteDisconnect );
+
+ delete iTimer;
+ iTimer = NULL;
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ iProtoState = MVtProtocolCommand::ESetup;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup_indi_disconnect" )
+ states->Update();
+ if ( iPendingOp &&
+ ( iPendingOp->Command() == KVtEngTerminateSession ||
+ iPendingOp->Command() == KVtEngResetEngine ) )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE PID PO", iPendingOp->Command() )
+ // Complete only KVtEngTerminateSession, if KVtEngResetEngine
+ // is pending complete it after uninitialisation is finalised.
+ if ( iPendingOp->Command() == KVtEngTerminateSession )
+ {
+ CompleteOp( KErrNone );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "MH.protoHIE PID RO")
+ UninitializeNextStep();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if ( KVtEngEventNone != event )
+ {
+ CVtEngEventManager::NotifyEvent( event );
+ }
+ }
+ __VTPRINTEXIT( "MH.InfoEvent" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionErrorEventL
+// Handles error event from protocol engine.
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+void CVtEngMediaHandler::HandleSessionErrorEventL( const TVtErrorEvent& aEvent )
+#else
+void CVtEngMediaHandler::
+ HandleSessionErrorEventL( const TVtErrorEvent& /* aEvent */ )
+#endif // VTDEBUG
+ {
+ // Must have an implementation.
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoHEE,%d", aEvent.iEventType )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSettingChangedL
+// Handles still image setting change.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSettingChangedL(
+ CVtEngSettings::TSettingId aId,
+ const TDesC& /*aValue*/ )
+ {
+ __VTPRINTENTER( "MH.HandleSettingChangedL" )
+ if ( aId == CVtEngSettings::ESelectVolume ||
+ aId == CVtEngSettings::EHandsetVolume ||
+ aId == CVtEngSettings::EHandsfreeVolume )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.volChgd %d", aId )
+ UpdateVolume();
+
+ if ( aId == CVtEngSettings::EHandsetVolume ||
+ aId == CVtEngSettings::EHandsfreeVolume )
+ {
+ CVtEngEventManager::NotifyEvent(
+ KVtEngAudioOutputVolumeChanged );
+ }
+ }
+ else if ( aId == CVtEngSettings::EStillImage ||
+ aId == CVtEngSettings::EStillImagePath )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.stillChgd" )
+
+ TShareObjectState shareState;
+ GetObjectSharingState( shareState );
+ if ( shareState == EInitializingShareImage ||
+ shareState == ESharingImage )
+ {
+ iLocalVideo->SettingsChanged();
+ return;
+ }
+
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config =
+ settings.Config();
+
+ const CVtEngLocalVideo::TVtEngProviderType
+ activeProvider( iLocalVideo->ActiveProvider() );
+ if ( config.iVideo.iImageIsValid )
+ {
+ __VTPRINT( DEBUG_GEN, "MH.HSC valid" )
+ EnableVideoL( ETrue );
+ // if still image is not active we should only
+ // initialize it, not start after initialization.
+ const TBool initOnly( activeProvider ==
+ CVtEngLocalVideo::KVtEngProviderCam1 ||
+ activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 ||
+ activeProvider ==
+ CVtEngLocalVideo::KVtEngProviderShareImage );
+ iLocalVideo->InitializeOnlyEx( initOnly );
+ TRAPD( err,iLocalVideo->SetStillImageL( !initOnly ) );
+ if ( err == KErrNotReady )
+ {
+ __VTPRINT( DEBUG_GEN, "MH.HSC waiting...")
+ // Another switch ongoing, wait until it is done.
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "MH.HSC invalid" )
+ __VTPRINT2( DEBUG_MEDIA, "MH.HSC provider=", activeProvider )
+ if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.SetDefaultStillImageL" )
+ if ( activeProvider == CVtEngLocalVideo::KVtEngProviderImage )
+ {
+ iLocalVideo->SetDefaultStillImageL();
+ }
+ }
+ else
+ {
+ if( activeProvider !=
+ CVtEngLocalVideo::KVtEngProviderCam1 &&
+ activeProvider != CVtEngLocalVideo::KVtEngProviderCam2 )
+ {
+ EnableVideoL( EFalse );
+ }
+ __VTPRINT( DEBUG_MEDIA, "MH.tStillImageL" )
+ iLocalVideo->SetStillImageL( ETrue );
+ }
+
+ }
+ }
+ else
+ {
+ // Do nothing, but satisfy lint.
+ __VTPRINT2( DEBUG_MEDIA, "MH.HSC not handled=%d", aId )
+ }
+ __VTPRINTEXIT( "MH.HSC" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeL
+// Initializes settings listeners.
+// Sets still image and initializes default provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeL( TRequestStatus& aStatus )
+ {
+ __VTPRINTENTER( "MH.InitializeL" )
+ // configure still image
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.NotifyChangeL( CVtEngSettings::EStillImage, *this );
+ settings.NotifyChangeL( CVtEngSettings::EStillImagePath, *this );
+ settings.NotifyChangeL( CVtEngSettings::ESelectVolume, *this );
+ settings.NotifyChangeL( CVtEngSettings::EHandsetVolume, *this );
+ settings.NotifyChangeL( CVtEngSettings::EHandsfreeVolume, *this );
+
+ const CVtEngSettings::TVtEngVideoCallConfig& config = settings.Config();
+ TInt err( KErrNotFound );
+ if ( config.iVideo.iImageIsValid )
+ {
+ // first step initialize still, when that is complete, initialize blank
+ TRAP( err, iLocalVideo->SetStillImageL( ETrue ) );
+ if ( err == KErrNone )
+ {
+ iVSInitState = EStateInitStillImage;
+ iRequestStatus = &aStatus;
+ }
+ }
+ if ( err != KErrNone )
+ {
+ // Still provider init failed -> initialize blank
+ InitializeProviderL( aStatus );
+ }
+ __VTPRINTEXIT( "MH.InitializeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelInitialize
+// Sets initialization state as cancelled.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::CancelInitialize()
+ {
+ __VTPRINTENTER( "MH.CancelInitialize" )
+ iVSInitState = EStateInitCanceled;
+ __VTPRINTEXIT( "MH.CancelInitialize" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeProviderL
+// Initializes default blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeProviderL( TRequestStatus& aStatus )
+ {
+ __VTPRINTENTER( "MH.InitializeProviderL" )
+ iLocalVideo->InitializeL();
+ iVSInitState = EStateInitProvider;
+ iRequestStatus = &aStatus;
+ __VTPRINTEXIT( "MH.InitializeProviderL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Uninitialize
+// Frees all resources.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::Uninitialize( TRequestStatus& aStatus )
+ {
+ __VTPRINTENTER( "MH.Uninitialize" )
+ ClearFlag( ETwoStageOperation );
+ ClearFlag( ESourceUpdateNeeded );
+ iRequestStatus = &aStatus;
+ if ( iProtoState == MVtProtocolCommand::EDisconnecting )
+ {
+ // Protocol is disconnecting if
+ // 1) bearer was lost (and videoteleng issued disconnect on protocol), or
+ // 2) protocol issued disconnect due unrecoverable error or disconnect
+ // request from remote terminal.
+ // And now UI requested 'reset engine' while performing disconnect.
+ // When disconnecting is complete check if iRequestStatus
+ // is not null AND iInitialized is ETrue.
+ // If so, Uninitialize has been called (UI requested reset).
+
+ StopRendering();
+ __VTPRINT( DEBUG_MEDIA, "MH.UnInit wait for disconnect to complete" )
+ __VTPRINTEXIT( "MH.Uninitialize" )
+ return;
+ }
+ iInitialized = EFalse;
+ UninitializeNextStep();
+ __VTPRINTEXIT( "MH.Uninitialize" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UninitializeNextStep
+// Goes to next step in uninitialization
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::UninitializeNextStep( )
+ {
+ __VTPRINTENTER( "MH.UninitializeNextStep" )
+ StopRendering();
+
+ TOperation op( ENone );
+
+ // CancelAllProtoCommands is no op if nothing to cancel or already pending.
+ // However, then op is still assigned with EUninitializeCancelAllProto to
+ // indicate it is pending and we must wait for it to complete.
+ CancelAllProtoCommands( op );
+
+ if ( op == ENone ) // Cancellation is not pending
+ {
+ __VTPRINT2( DEBUG_MEDIA, "next step protostate=%d", iProtoState )
+ switch ( iProtoState )
+ {
+ case MVtProtocolCommand::EConnected:
+ case MVtProtocolCommand::EConnecting:
+ op = EDestructProtoPhaseDisconnect;
+ break;
+ case MVtProtocolCommand::ESetup:
+ // In EInitializing state operation is waited to complete. See
+ // CVtEngInitializer::ContinueOrRetry op==EReset and iStep==EInitProto
+
+ if( iH324Config || iH263Encoder )
+ {
+ // First remove interfaces, after completion perform reset
+ op = ERemove324CtrlInterface;
+ break;
+ }
+
+ // If interfaces are already released or not even reserved, go to Reset.
+ op = EDestructProtoPhaseReset;
+ break;
+ case MVtProtocolCommand::EResetting:
+ // Reset ongoing, wait for it to complete
+ __VTPRINT( DEBUG_MEDIA, "MH.UnInit resetting" )
+ break;
+ case MVtProtocolCommand::EIdle:
+ op = ERemove324CtrlInterface;
+ __VTPRINT( DEBUG_MEDIA, "MH.UnInit idling" )
+ break;
+ default:
+ __VTPRINT( DEBUG_MEDIA, "MH.UnInit invalid state" )
+ break;
+ }
+ if ( op != ENone )
+ {
+ TRAPD( err, ContinueUninitializeL( op ) );
+ if ( err != KErrNone )
+ {
+ if ( iRequestStatus )
+ {
+ User::RequestComplete( iRequestStatus, err );
+ iRequestStatus = NULL;
+ }
+ else
+ {
+ // Infinite waiting for end state!
+ __VTPRINT( DEBUG_MEDIA, "MH. dead end!" )
+ Panic( EVtEngPanicDisconnectTimerExpired );
+ }
+ __VTPRINT2( DEBUG_MEDIA, "next step err=%d", err )
+ }
+ }
+ }
+ __VTPRINTEXIT( "MH.UninitializeNextStep" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ContinueUninitializeL
+// Completes uninitialization:
+// does disconnecting, deletes members.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ContinueUninitializeL(
+ const TOperation aOp )
+ {
+ __VTPRINTENTER( "MH.ContinueUninitializeL" )
+ __VTPRINT2( DEBUG_MEDIA, "MH.ContUn op=%d", aOp)
+ switch ( aOp )
+ {
+ case EDestructProtoPhaseDisconnect: // causes DisconnectL on protocol
+ __VTPRINT2( DEBUG_MEDIA, "MH.ContUn EDestructProtoPhaseDisconnect iProtoState=%d", iProtoState )
+
+ // Disconnecting only allowed in Connecting and Connected state.
+ if( iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::EConnected )
+ {
+ DisconnectProtoL();
+ if ( iProtoState == MVtProtocolCommand::EDisconnecting ) {
+ // started succefully disconnecting
+ break;
+ }
+ }
+ // fall through if state was not proper was disconnect
+ case EDestructProtoPhaseReset: // causes ResetL on protocol
+
+ ResetProto2WayL();
+ if ( iProtoState == MVtProtocolCommand::EResetting )
+ {
+ break;
+ }
+ // fall through if state was not proper for reset
+ case ERemove324CtrlInterface:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.ContUn ERemove324CtrlInterface" )
+ const TBool extCmdPending( ExtensionCommandsPending() );
+ if ( !extCmdPending && ( iH324Config || iH263Encoder ) )
+ { // no pending extension commands, interfaces can be released
+ // this is no-op if already released
+ ReleaseProtoInterfacesL();
+ break;
+ }
+ if( extCmdPending ||
+ IsPending( ERemove324CtrlInterface ) != KErrNotFound ||
+ IsPending( ERemoveH263EncInterface ) != KErrNotFound )
+ {
+ // Interface releasing has not completed yet, need to wait
+ // until proceeding ahead.
+ break;
+ }
+ }
+ // fall through if interfaces are released
+ case EDestructSwitchBlank:
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.ContUn EDestructSwitchBlank" )
+ // provider must be selected to something else that
+ // is not deleted
+ const CVtEngLocalVideo::TVtEngProviderType
+ activeProvider( iLocalVideo->ActiveProvider() );
+ if ( activeProvider != CVtEngLocalVideo::KVtEngProviderNone )
+ {
+ iLocalVideo->SelectSourceL( CVtEngLocalVideo::KVtEngProviderNone );
+ iVSInitState = EStateWaitingProviderChangeForUninit;
+ break;
+ }
+ // blank provider already active so continue
+ iVSInitState = EInitStateNone;
+ }
+ // fall thru
+ case EDestructInternals:
+ __VTPRINT( DEBUG_MEDIA, "MH.ContUn EDestructInternals" )
+ iLocalVideo->Reset();
+ delete iRemoteVideo;
+ iRemoteVideo = NULL;
+ if ( iRequestStatus )
+ {
+ User::RequestComplete( iRequestStatus, KErrNone );
+ iRequestStatus = NULL;
+ }
+ break;
+ default:
+ // Should not happen
+ Panic( EVtEngPanicUnInitIncorrectOperation );
+ break;
+ }
+
+ __VTPRINTEXIT( "MH.ContinueUninitializeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::StopRendering
+// Stops all rendering.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::StopRendering()
+ {
+ __VTPRINTENTER( "MH.StopRendering" )
+ if ( iLocalVideo )
+ {
+ iLocalVideo->StopViewFinder();
+ }
+ if ( iRemoteVideo )
+ {
+ iRemoteVideo->StopVideoRendering();
+ }
+ __VTPRINTEXIT( "MH.StopRendering" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UpdateVolume
+// Updates volume values.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::UpdateVolume()
+ {
+ __VTPRINTENTER( "MH.UpdateVolume" )
+ if ( iUpdateVolumeAllowed && IsPending( ESetAudioVolume ) == KErrNotFound )
+ {
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+
+ TInt volume( 0 );
+ TInt err( settings.GetVolume( volume,
+ settings.CurrentVolume(), ETrue ) );
+ if ( err != KErrNone )
+ {
+ volume = settings.MinVolume();
+ }
+
+ SetVolume( volume );
+ }
+ else
+ {
+ iUpdateVolumeRequired = ETrue;
+ }
+ __VTPRINTEXIT( "MH.UpdateVolume" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AutoEnableVideo
+// Enables video when primary camera becomes available while blank provider
+// is active (i.e. video is disabled). This should not be called in other
+// occations. Difference to EnableVideoL is that callback doesn't try to
+// complete pending request to UI (that usually is different request than this).
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AutoEnableVideo( TBool aEnable )
+ {
+ __VTPRINTENTER( "MH.AutoEnableVideo" )
+ __VTPRINT( DEBUG_MEDIA, "MH.AutoEnableVideo" )
+ TOperation op( EDisableVideoInternal );
+ if ( aEnable )
+ {
+ op = EEnableVideoInternal;
+ }
+ TRAPD( err, EnableVideoL( aEnable, op ) );
+ __VTPRINTEXITR( "MH.AutoEnableVideo %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::FinalizeUninitialization
+// Deletes protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::FinalizeUninitialization()
+ {
+ __VTPRINTENTER( "MH.FinalUninit" )
+ if ( iSessionCommand )
+ {
+ iAudioCtrl = NULL;
+ TInt err( KErrNone );
+
+ // Delete the config interface
+ TRAP( err,
+ {
+ if ( iSessionCommand )
+ {
+ VTProtocolFactory::DeleteSessionCommand( iSessionCommand );
+ iSessionCommand = NULL;
+ }
+
+ // Trapped to log the possible error
+ __VTPRINT( DEBUG_MEDIA, "MH.Deleted Terminal" )
+ } );
+ __VTPRINT2( DEBUG_MEDIA, "MH.Deletion complete=%d", err )
+ iSessionCommand = NULL;
+ iProtoStateFlags = 0;
+ iProtoState = MVtProtocolCommand::EIdle;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EIdle uninit" )
+ if ( iPendingOp &&
+ iPendingOp->Command() == KVtEngTerminateSession )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.FinalUninit comp TerminateSession=%d",
+ iPendingOp->Command())
+ CompleteOp( KErrNone );
+ }
+ else if ( iPendingOp ) {
+ __VTPRINT2( DEBUG_MEDIA, "MH.FinalUninit comp =%d",
+ iPendingOp->Command() )
+ delete iPendingOp;
+ }
+ iPendingOp = NULL;
+ }
+ iPendingOps->Reset();
+ __VTPRINTEXIT( "MH.FinalUninit" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ResetProto2WayL
+// Resets protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ResetProto2WayL()
+ {
+ __VTPRINTENTER( "MH.ResetProto2WayL" )
+ __ASSERT_ALWAYS( iProtoState == MVtProtocolCommand::ESetup,
+ Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+ __VTPRINT( DEBUG_MEDIA, "MH. Calling ResetL on Proto" )
+ iUpdateVolumeAllowed = EFalse;
+ TInt cmdId = iSessionCommand->ResetProtocolL();
+ if ( cmdId > 0 )
+ {
+ // Add the operation if ok
+ AddOperation( EDestructProtoPhaseReset, cmdId, EFalse );
+ iProtoState = MVtProtocolCommand::EResetting;
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.ResetProto2WayL waiting for cancel to complete" )
+ }
+ __VTPRINTEXIT( "MH.ResetProto2WayL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetSelectedCameraId
+// Called from Local video when camera has been selected.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetSelectedCameraId(
+ const TCameraId aId,
+ TBool aUpdateRequired )
+ {
+ __VTPRINTENTER( "MH.SetSelectedCameraId" )
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.SetSelectedCameraId id=%d", aId )
+ iSelectedCameraId = aId;
+ // Set flag that switch should be done later if
+ // engine has not reached proper state
+ // - but only if active provider is a camera.
+ if ( aUpdateRequired && iLocalVideo )
+ // NULL if called inside CVtEngLocalVideo::ConstructL
+ {
+ const CVtEngLocalVideo::TVtEngProviderType
+ activeProvider( iLocalVideo->ActiveProvider() );
+
+ if ( activeProvider == CVtEngLocalVideo::KVtEngProviderCam1 ||
+ activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH. ESourceUpdateNeeded flag set" )
+ SetFlag( ESourceUpdateNeeded );
+ }
+ }
+ __VTPRINTEXIT( "MH.SetSelectedCameraId" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleLocalVideoOperationCompleteL
+// Asynchronous local video operation is completed in here.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleLocalVideoOperationCompleteL(
+ const TInt aResult )
+ {
+ __VTPRINTENTER( "MH.LocVidOpComp" )
+ __VTPRINT3( DEBUG_MEDIA, "MH.LocVidOpComp res=%d,intOps=%d",
+ aResult, iPendingOps->Count() )
+ __VTPRINT2( DEBUG_MEDIA, "MH.LocVidOpComp state flags=%d", iProtoStateFlags )
+
+ // Check if video should be paused
+ if ( IsFlag( EProtoPauseVideoBlankProv ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp pause flagged" )
+ if ( aResult == KErrNone )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp pausing" )
+ EnableVideoL( EFalse );
+ // Not ready yet, clear the two stages and complete in the end
+ if ( IsFlag( ETwoStageOperation ) &&
+ IsFlag( EProtoContVideoBlankInit ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp 1 stage complete" )
+ ClearFlag( ETwoStageOperation );
+ ClearFlag( EProtoContVideoBlankInit );
+ }
+ ClearFlag( EProtoPauseVideoBlankProv );
+ }
+ }
+
+ if ( iRequestStatus )
+ {
+ if ( iVSInitState == EStateInitStillImage )
+
+ { // still image initialized, proceed to initializing blank provider
+ InitializeProviderL( *iRequestStatus );
+ __VTPRINTEXIT( "MH.LocVidOpComp" )
+ return;
+ }
+ else if ( iVSInitState == EStateInitProvider )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp reqComplete" )
+ // Part of media handler initialization
+ User::RequestComplete( iRequestStatus, aResult );
+ iRequestStatus = NULL;
+ iVSInitState = EInitStateNone;
+ __VTPRINTEXIT( "MH.LocVidOpComp" )
+ return;
+ }
+ else if ( iVSInitState == EStateWaitingProviderChangeForUninit )
+ {
+ iVSInitState = EInitStateNone;
+ iLocalVideo->StopViewFinder(); // ensure view finder is stopped
+ ContinueUninitializeL( EDestructInternals );
+ __VTPRINTEXIT( "MH.LocVidOpComp" )
+ return;
+ }
+ else if ( iVSInitState == EStateInitCanceled )
+ {
+ // If the request status has been cancelled
+ // uninitialize VT
+ ContinueUninitializeL( EDestructSwitchBlank );
+ }
+ }
+
+ // Either complete the operation or remove 2 stage flag.
+ // If flag removed, the operation will be completed when
+ // the second stage finalizes.
+ if ( IsFlag( ETwoStageOperation ) )
+ {
+ SetFlag( EProtoSendIntraFrame );
+ ClearFlag( ETwoStageOperation );
+ }
+ else
+ {
+ // Send a sync message, if video enabled.
+ if ( !IsFlag( EProtoVideoTrackPaused ) &&
+ // and
+ iInitialized &&
+ iProtoState == MVtProtocolCommand::EConnected &&
+ iPendingOp &&
+ iPendingOp->Command() == KVtEngSetSource )
+ {
+ RequestFrame();
+ }
+ // Complete operation only if it is related. We may have received
+ // KVtEngTerminateSession while prepare/set source is pending and
+ // cannot complete it!
+ if ( iPendingOp )
+ {
+ switch( iPendingOp->Command() )
+ {
+ case KVtEngHandleLayoutChange:
+ case KVtEngPrepareCamera:
+ case KVtEngSetSource:
+ case KVtEngUnfreeze:
+ CompleteOp( aResult );
+ break;
+
+ // Image sharing
+ case KVtEngInitializeShareImage:
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.LocVidOpComp KVtEngInitializeShareImage" )
+ if ( aResult != KErrNone )
+ {
+ iLocalVideo->ShareError( aResult );
+ }
+ CompleteOp( aResult );
+ break;
+
+ case KVtEngStartShareImage:
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.LocVidOpComp KVtEngStartShareImage" )
+ if ( aResult != KErrNone )
+ {
+ iLocalVideo->ShareError( aResult );
+ }
+ CompleteOp( aResult );
+ if ( iVideoAction == EVideoActionEnable )
+ {
+ if ( aResult == KErrNone )
+ {
+ EnableVideoL( ETrue );
+ iVideoAction = EVideoActionDisable;
+ }
+ else
+ {
+ iVideoAction = EVideoActionNone;
+ }
+ }
+
+ break;
+
+ case KVtEngStopShareImage:
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.LocVidOpComp KVtEngStopShareImage" )
+ if ( aResult != KErrNone )
+ {
+ iLocalVideo->ShareError( aResult );
+ }
+ CompleteOp( aResult );
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ __VTPRINTEXIT( "MH.LocVidOpComp" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Disconnect
+// Starts Protocol disconnecting procedure.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::Disconnect()
+ {
+ UninitializeNextStep();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SdkInitInfo
+// Returns Protocol sdk initialization information.
+// -----------------------------------------------------------------------------
+//
+TVtInitInfo& CVtEngMediaHandler::SdkInitInfo()
+ {
+ return iSdkInitInfo;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ProtoState
+// Returns protocol state, maintained by VTEngine.
+// Might be out of sync with actual Proto state.
+// -----------------------------------------------------------------------------
+//
+MVtProtocolCommand::TVtProtocolState CVtEngMediaHandler::ProtoState()
+ {
+ return iProtoState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Connect
+// Sets up connection with remote end.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::Connect()
+ {
+ __VTPRINTENTER( "MH.Connect" )
+ __VTPRINT( DEBUG_MEDIA, "MH.Connect" )
+ TInt err( KErrNotReady );
+ if ( ProtoState() == MVtProtocolCommand::ESetup && IsFlag( EProto324IFAcquired ) )
+ {
+ TInt cmdId( 0 );
+ __VTPRINT( DEBUG_MEDIA, "MH. Calling ConnectToProtocolL on Proto" )
+ TRAP( err, cmdId = iSessionCommand->ConnectToProtocolL( ( ( CVtEngUtility::EngineUtils() )->Initializer() ).GetVtComms() ) );
+ if ( err == KErrNone )
+ {
+ const TInt res( AddOperation( EConnectProto, cmdId) );
+ if ( res < KErrNone )
+ {
+ err = res;
+ }
+ iProtoState = MVtProtocolCommand::EConnecting;
+ __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EConnecting Connecting" )
+ }
+ }
+ __VTPRINTEXITR( "MH.Connect err=%d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddVideoSource
+// Adds video source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddVideoSource( TUint aChannelId )
+ {
+ __VTPRINTENTER( "MH.AddVideoSource" )
+
+ if( !MediaAddingValidity() )
+ return KErrCancel;
+
+ TInt cmdId( 0 );
+ TRAPD( err, cmdId = iSessionCommand->AddVideoSourceL(
+ aChannelId, *iLocalVideo->Source() ) );
+ if ( err == KErrNone )
+ {
+ const TInt res( AddOperation( EAddVideoSource, cmdId ) );
+ if ( res >= KErrNone )
+ {
+ iRemoteMediaState |= EMediaVideoPreparing;
+ }
+ else
+ {
+ err = res;
+ }
+ }
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ __VTPRINTEXITR( "MH.AddVideoSource %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddAudioSource
+// Adds audio source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddAudioSource( TUint aChannelId )
+ {
+ __VTPRINTENTER( "MH.AddAudioSource" )
+
+ if( !MediaAddingValidity() )
+ return KErrCancel;
+
+ TInt cmdId( 0 );
+ TInt err( KErrNone );
+ // Only for target compilations.
+#if !defined( __WINS__ )
+ err = iLocalVideo->CreateAudioSource();
+ if ( err == KErrNone )
+ {
+ TRAP( err, cmdId = iSessionCommand->AddAudioSourceL(
+ aChannelId, *iLocalVideo->AudioSource() ) );
+ }
+#endif // !__WINS__
+#if defined (__WINS__)
+ aChannelId = aChannelId; // Remove compilation warnings with CW.
+#endif // __WINS__
+
+ if ( err == KErrNone )
+ {
+ const TInt res( AddOperation( EAddAudioSource, cmdId ) );
+ if ( res < KErrNone )
+ {
+ err = res;
+ }
+ }
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ if ( IsFlag( ESourceUpdateNeeded ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.AddASource updateProvider" )
+ ClearFlag( ESourceUpdateNeeded );
+ // Generate event
+ iLocalVideo->vsProvidersChanged(
+ iSelectedCameraId == MVtEngMedia::EPrimaryCamera );
+ }
+ __VTPRINTEXITR( "MH.AddAudioSource %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddVideoSinkL
+// Adds video sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddVideoSink( TUint aChannelId )
+ {
+ __VTPRINTENTER( "MH.AddVideoSink" )
+
+ if( !MediaAddingValidity() )
+ return KErrCancel;
+
+ TInt cmdId( 0 );
+ TRAPD( err, cmdId = iRemoteVideo->AddVideoSinkL( aChannelId ) );
+ if ( err == KErrNone )
+ {
+ const TInt res( AddOperation( EAddVideoSink, cmdId ) );
+ if ( res >= KErrNone )
+ {
+ iRemoteMediaState |= EMediaVideoPreparing;
+ }
+ else
+ {
+ err = res;
+ }
+ }
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ __VTPRINTEXITR( "MH.AddVideoSink %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddAudioSink
+// Adds audio sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddAudioSink( TUint aChannelId )
+ {
+ __VTPRINTENTER( "MH.AddAudioSink" )
+
+ if( !MediaAddingValidity() )
+ return KErrCancel;
+
+ TInt cmdId( 0 );
+ TRAPD( err, cmdId = iRemoteVideo->AddAudioSinkL( aChannelId ) );
+ if ( err == KErrNone )
+ {
+ const TInt res( AddOperation( EAddAudioSink, cmdId ) );
+ if ( res >= KErrNone )
+ {
+ iRemoteMediaState |= EMediaAudioPreparing;
+ }
+ else
+ {
+ err = res;
+ }
+ }
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ __VTPRINTEXITR( "MH.AddAudioSink %d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RemoveOperation
+// Removes an operation from stored operations.
+// -----------------------------------------------------------------------------
+//
+template<class T>
+TBool CVtEngMediaHandler::RemoveOperation( const T& aOp )
+ {
+ TBool removed( EFalse );
+ const TInt pos( IsPending( aOp ) );
+ if ( pos != KErrNotFound )
+ {
+ __VTPRINT3( DEBUG_MEDIA, "MH.RemoveOp removed index=%d TOperation=%d",
+ pos, ( *iPendingOps )[ pos ].iOp )
+ iPendingOps->Delete( pos );
+ removed = ETrue;
+ }
+ return removed;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddOperation
+// Adds operation to operations pending completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddOperation(
+ const TOperation aOp,
+ TInt aCmdId,
+ const TBool aResetExisting )
+ {
+ if ( aResetExisting )
+ {
+ iPendingOps->Reset();
+ }
+ TCmdOpPair opPair;
+ opPair.iOp = aOp;
+ opPair.iProtoCmdId = aCmdId;
+ // this should never leave because SetReserveL called in ConstructL
+ TRAPD( err, iPendingOps->AppendL( opPair ) );
+ if ( err != KErrNone )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngResourceMemAllocFailure );
+ return err;
+ }
+ const TInt count( iPendingOps->Count() );
+ __VTPRINT3( DEBUG_MEDIA, " MH.op added. op=%d,cmdId=%d", aOp, aCmdId )
+ __VTPRINT2( DEBUG_MEDIA, " count=%d", count )
+ return ( count - 1 );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsPending
+// Checks if a command is set to be completed.
+// Checking is done based on operation.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::IsPending( const TOperation aOp ) const
+ {
+ const TInt count( iPendingOps->Count() );
+ for ( TInt i = 0; i < count ; i++ )
+ {
+ if ( aOp == ( *iPendingOps )[ i ].iOp )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.IsPending VT Op index=%d", i )
+ return i;
+ }
+ }
+ __VTPRINT( DEBUG_MEDIA, "MH.IsPending VT Op NOT FOUND" )
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsPending
+// Checks if a command is set to be completed.
+// Checking is done based on command id.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::IsPending( const TInt aCmdId ) const
+ {
+ const TInt count( iPendingOps->Count() );
+ for ( TInt i = 0; i < count ; i++ )
+ {
+ if ( aCmdId == ( *iPendingOps )[ i ].iProtoCmdId )
+ {
+ __VTPRINT3( DEBUG_MEDIA, "MH.IsPending ProtoCmdId=%d index=%d",
+ aCmdId, i )
+ return i;
+ }
+ }
+ __VTPRINT( DEBUG_MEDIA, "MH.IsPending ProtoCmdId NOT FOUND" )
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CompleteOp
+// Asynchronous command completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::CompleteOp( const TInt aResult )
+ {
+ CVtEngOperation* opToComplete = iPendingOp;
+ TInt err( KErrNotFound );
+ if ( opToComplete )
+ {
+ iPendingOp = NULL;
+ opToComplete->HandleOpComplete( aResult );
+ err = KErrNone;
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AsyncCompleteOp
+// Asynchronous command completion.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::AsyncCompleteOp( const TInt aResult )
+ {
+ iAsyncCallback->Cancel();
+ iAsyncCompleteOpResult = aResult;
+ iAsyncCallback->Start( TCallBack( DoCompleteOp, this ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::MatchResponseToPendingOps
+// Checks if a response matches corresponding operation.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::MatchResponseToPendingOps(
+ const TInt aProtoCmdId,
+ const TOperation aOperation,
+ TInt* aIndex )
+ {
+ const TInt index( IsPending( aOperation ) );
+ TBool entryFound( EFalse );
+ if ( index != KErrNotFound )
+ {
+ const TCmdOpPair opPair = ( *iPendingOps )[index];
+ if ( opPair.iProtoCmdId == aProtoCmdId )
+ {
+ entryFound = ETrue;
+ if ( aIndex )
+ {
+ *aIndex = index;
+ }
+ }
+ }
+ __VTPRINT2( DEBUG_MEDIA, "MH.MatchRespToOp was found=%d", entryFound )
+ return entryFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::StartDisconnectTimerL
+// Starts the disconnect timer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::StartDisconnectTimerL()
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH. start disc.timer" )
+ if ( iTimer == NULL )
+ {
+ TCallBack cb( CVtEngMediaHandler::TimerCallback, NULL );
+ iTimer = CPeriodic::NewL( 0 );
+ iTimer->Start( KVtEngDisconnectionTimer,
+ KVtEngDisconnectionTimer,
+ cb );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::NextUninitStepCallbackL
+// Proceeds to next uninitializatioin step asynchronously.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::NextUninitStepCallbackL()
+ {
+ __VTPRINTENTER( "MH.NextUninitStepCallbackL" )
+ if ( !iNextStepCallback )
+ {
+ // perform asap => high priority
+ TCallBack cb( CVtEngMediaHandler::UninitCallback, this );
+ iNextStepCallback = new ( ELeave ) CAsyncCallBack(
+ cb, CActive::EPriorityHigh );
+ iNextStepCallback->CallBack();
+ }
+ __VTPRINTEXIT( "MH.NextUninitStepCallbackL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UninitCallback
+// Asynch callback method for uninitialization.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::UninitCallback( TAny* aAny )
+ {
+ __VTPRINTENTER( "MH.UninitCallback" )
+ CVtEngMediaHandler* handler = static_cast<CVtEngMediaHandler*>( aAny );
+ delete handler->iNextStepCallback;
+ handler->iNextStepCallback = NULL;
+ handler->UninitializeNextStep();
+ __VTPRINTEXIT( "MH.UninitCallback" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AssignPendingOp
+// Assigns operation and completes pending if necessary.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AssignPendingOp(
+ CVtEngOperation& aOperation,
+ TInt aReplaceError )
+ {
+ TInt result = KErrNone;
+ if ( iPendingOp )
+ {
+ if ( aReplaceError != KErrNone &&
+ // if terminating don't allow other commands
+ iPendingOp->Command() != KVtEngTerminateSession )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.Assign op replace err=", aReplaceError )
+ CompleteOp( aReplaceError );
+ // indicate previous operation was "cancelled" (even though it is
+ // not really cancelled, we still get callback!)
+ result = KErrCancel;
+ }
+ else
+ {
+ // not allowed to assign new operation
+ result = KErrGeneral;
+ }
+ }
+ if ( result != KErrGeneral )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.AssignPendingOp=%d", aOperation.Command() )
+ iPendingOp = &aOperation;
+ }
+ __VTPRINT2( DEBUG_MEDIA, "MH.AssignPendingOp.res=%d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DoCompleteOp
+// Implementation of command completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::DoCompleteOp( TAny* aAny )
+ {
+ CVtEngMediaHandler* self = static_cast< CVtEngMediaHandler* >( aAny );
+ self->CompleteOp( self->iAsyncCompleteOpResult );
+ self->iAsyncCompleteOpResult = KErrNone;
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetPendingCommand
+//
+// -----------------------------------------------------------------------------
+//
+TVtEngCommandId CVtEngMediaHandler::GetPendingCommand()
+ {
+ if ( iPendingOp )
+ {
+ return iPendingOp->Command();
+ }
+ return KVtEngCommandNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AssertFlag
+// Checks flag's validity.
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CVtEngMediaHandler::AssertFlag( const TInt aFlag ) const
+#else
+void CVtEngMediaHandler::AssertFlag( const TInt /* aFlag */ ) const
+#endif // _DEBUG
+ {
+ __ASSERT_DEBUG(
+ aFlag == EProtoAudioSourceAdded ||
+ aFlag == EProtoVideoSourceAdded ||
+ aFlag == EProtoAudioSinkAdded ||
+ aFlag == EProtoVideoSinkAdded ||
+ aFlag == EProtoAudioTrackPaused ||
+ aFlag == EProtoVideoTrackPaused ||
+ aFlag == ETwoStageOperation ||
+ aFlag == EProtoPauseVideoRequested ||
+ aFlag == EProtoPauseVideoBlankProv ||
+ aFlag == EProtoContVideoBlankProv ||
+ aFlag == EProtoContVideoBlankInit ||
+ aFlag == ESourceUpdateNeeded ||
+ aFlag == EProtoSendIntraFrame ||
+ aFlag == EProto324IFAcquired ||
+ aFlag == EProtoCancelProtoCmdsOk ||
+ aFlag == EVideoQualitySetByPeer ||
+ aFlag == EOutVideoChannelClosed ||
+ aFlag == EOutAudioChannelClosed,
+ Panic( EVtEngPanicInvalidFlag ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsFlag
+// Checks if a certain flag is set.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::IsFlag( const TInt aFlag ) const
+ {
+ AssertFlag( aFlag );
+ if ( iProtoStateFlags & aFlag )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetFlag
+// Sets flag on.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetFlag( const TInt aFlag )
+ {
+ AssertFlag( aFlag );
+ iProtoStateFlags |= aFlag;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ClearFlag
+// Removes a flag.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ClearFlag( const TInt aFlag )
+ {
+ AssertFlag( aFlag );
+ iProtoStateFlags &= ~aFlag;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVolume
+// Sets volume values to Protocol.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::SetVolume(
+ const TInt aVolume,
+ CVtEngOperation* aOperation )
+ {
+ __VTPRINTENTER( "MH.SetVolume" )
+ TInt res( KErrNotFound );
+ __VTPRINT2( DEBUG_MEDIA, " vol=%d", aVolume )
+ if ( iAudioCtrl )
+ {
+ TInt id( 0 );
+ // Max volume cannot be zero.
+ TInt vol( ( CVtEngUtility::Settings().ValidVolume( aVolume ) ) *
+ ( iProtoMaxVolume / CVtEngUtility::Settings().MaxVolume() ) );
+ __VTPRINT2( DEBUG_MEDIA, "CVtEngMediaHandler::SetVolumeL, vol=%d", vol )
+ TRAP( res, id = iAudioCtrl->SetAudioVolumeL( vol ) );
+ if ( res == KErrNone )
+ {
+ AddOperation( ESetAudioVolume, id );
+ if( aOperation )
+ {
+ AssignPendingOp( *aOperation );
+ }
+ }
+ }
+ __VTPRINTEXITR( "MH.SetVolume %d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestAudioControllerL
+// Requests controllers for audio output and input
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::RequestAudioControllerL()
+ {
+ __VTPRINTENTER( "MH.RequestAudioControllerL" )
+ __VTPRINT( DEBUG_MEDIA, "MH.RequestAudioControllerL" )
+ __ASSERT_ALWAYS(iSessionCommand, Panic( EVtEngPanicInvalidAudioPointer ) );
+
+ TInt id( 0 );
+ iAudioCtrl = VTProtocolFactory::GetAudioConfigCommandL(iRemoteVideo->AudioSink());
+
+ if ( !iAudioCtrl )
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ __VTPRINTEXIT( "MH.RequestAudioControllerL Failed" )
+ return EFalse;
+ }
+ iAudioCtrl->SetObserverL( this );
+
+ // Get the max value for Protocol volume
+ TRAPD ( res, id = iAudioCtrl->GetMaxAudioVolumeL( iProtoMaxVolume ) ) ;
+ __VTPRINT2( DEBUG_MEDIA, "MH.RequestAudioControllerL: err=%d",res )
+ if ( res != KErrNone)
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ __VTPRINTEXIT( "MH.RequestAudioControllerL" )
+ return EFalse;
+ }
+
+ res = AddOperation( EGetAudioGetMaxVolume, id );
+ if ( res < KErrNone ) // res is index
+ {
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ __VTPRINT2( DEBUG_MEDIA, "MH.RequestAudioControllerL::res=%d", res )
+ }
+ __VTPRINTEXIT( "MH.RequestAudioControllerL" )
+ return ETrue;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSpatialTradeoffIndication
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSpatialTradeoffIndication(
+ const TUint16 aLogicalChannelId, const TUint8 aTradeOff )
+ {
+ __VTPRINTENTER( "MH.HandleSpatialTradeoffIndication" )
+ __VTPRINT3( DEBUG_MEDIA,
+ "MH.HandleSpatialTradeoffIndication id=%d tradeOff=%d",
+ aLogicalChannelId, aTradeOff )
+ ( void ) aLogicalChannelId;
+ iVideoQuality.UpdateVideoQuality( iVideoQuality.FromTradeOff( aTradeOff ) );
+ __VTPRINTEXIT( "MH.HandleSpatialTradeoffIndication" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSpatialTradeoffCommandL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSpatialTradeoffCommandL(
+ const TUint16, const TUint8 aTradeOff )
+ {
+ __VTPRINTENTER( "MH.HandleSpatialTradeoffCommandL" )
+ SetVideoQualityL( iVideoQuality.FromTradeOff( aTradeOff ), EFalse );
+ __VTPRINTEXIT( "MH.HandleSpatialTradeoffCommandL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::EnableVideoL
+// Enables/Disables video sending.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TOperation CVtEngMediaHandler::EnableVideoL(
+ const TBool aEnable, const TOperation aOp )
+ {
+ __VTPRINTENTER( "MH.EnableVideoL" )
+ __VTPRINT3( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV en=%d state=%d",
+ aEnable, iProtoState )
+ TInt cmdId( 0 );
+ TInt err( KErrNone );
+ TOperation op( ENone );
+ MVtEngMedia::TMediaSource currentSource;
+ GetSource( currentSource );
+
+ // Videosource is added and Protocol is in connected state.
+ if ( IsFlag( EProtoVideoSourceAdded ) && iSessionCommand )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV source=%d",
+ currentSource )
+ // Has an actual source been selected.
+ if ( ( currentSource == EMediaNone ) || ( currentSource == EMediaShare ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnaLocVideo blank" )
+ if ( aEnable && IsPending( EEnableVideo) == KErrNotFound )
+ {
+ ClearFlag( EProtoPauseVideoRequested );
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH. Calling ResumeL on Protocol" )
+ TRAP( err, cmdId = iSessionCommand->ResumeVideoL( *iLocalVideo->Source() ) );
+ if ( err != KErrNone )
+ {
+ // Log the error and leave, UI handles the rest
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.EnaLocVideo PauseL left=%d", err )
+ __VTPRINTEXIT( "MH.EnableVideoL" )
+ User::Leave( err );
+ }
+ else
+ {
+ op = aOp;
+ AddOperation( aOp, cmdId );
+ }
+ }
+ // Video to be paused.
+ else if( !aEnable && IsPending( EDisableVideo ) )
+ {
+ op = DoPauseVideo();
+ }
+ }
+ else // camera or still image
+ {
+ if ( !aEnable && IsPending( EDisableVideo ) )
+ {
+ // Pause video
+ op = DoPauseVideo();
+ }
+ }
+ }
+ else // Not connected and sources not added yet
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.enavideo not conn" )
+ // If we are initializing, then this has to be executed
+ if ( IsFlag( EProtoContVideoBlankProv ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.enavideo blank cont" )
+ ClearFlag( EProtoContVideoBlankProv );
+ SetFlag( EProtoContVideoBlankInit );
+ }
+
+ if ( aEnable )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV clear pending" )
+ // Ensure that video sending is enabled in data source.
+ iLocalVideo->ResumeVideoSending();
+ ClearFlag( EProtoPauseVideoRequested );
+ }
+ else
+ {
+ iLocalVideo->PauseVideoSending();
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV set pending" )
+ SetFlag( EProtoPauseVideoRequested );
+ }
+ }
+
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV=%d", err )
+ __VTPRINTEXITR( "MH.EnableVideoL %d", op )
+ return op;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DoPauseVideo
+// Does video pausing.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TOperation CVtEngMediaHandler::DoPauseVideo()
+ {
+ __VTPRINTENTER( "MH.DoPauseVideo" )
+ TInt cmdId( 0 );
+ TOperation op( ENone );
+ __VTPRINT( DEBUG_MEDIA, "MH. Calling PauseL on Protocol" )
+ TRAPD( err, cmdId = iSessionCommand->PauseVideoL( *iLocalVideo->Source() ) );
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.DoPauseVideo PauseL left=%d", err )
+ // Remove the 2 stage flag, since PauseL failed.
+ // Command should be completed.
+ if( IsFlag( ETwoStageOperation ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ " Disable 2 stage clearance" )
+ ClearFlag( ETwoStageOperation );
+ }
+ }
+ else
+ {
+ AddOperation( EDisableVideo, cmdId );
+ op = EDisableVideo;
+ __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.DisaLocVideo PauseL issued" )
+ }
+ ClearFlag( EProtoPauseVideoRequested );
+ __VTPRINTEXITR( "MH.DoPauseVideo %d", op )
+ return op;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleAudioOutputControlCommandComplete
+// Callback function for audio controller commands.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleAudioOutputControlCommandComplete(TInt aId,
+ TVtAudioOutputControlCommand aCmd,
+ TAny* /*aContextData*/,
+ TInt aStatus)
+ {
+ __VTPRINTENTER( "MH.HandleAudioOutputControlCommandComplete" )
+ __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC CMD=%d", aCmd )
+ __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC cmdId=%d", aId )
+ __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC stat=%d", aStatus )
+
+ switch ( aCmd )
+ {
+ case EVtAudioOutputControlGetMaxVolume:
+ RemoveOperation( aId );
+ InitializeVolume();
+ break;
+ case EVtAudioOutputControlSetVolume:
+ __VTPRINT2( DEBUG_MEDIA, "MH.protoComC SetVolume=%d",
+ iUpdateVolumeRequired )
+
+ RemoveOperation( aId );
+
+ if ( iUpdateVolumeRequired )
+ {
+ iUpdateVolumeRequired = EFalse;
+ UpdateVolume();
+ }
+
+ if ( IsPending( ESetAudioVolume ) == KErrNotFound &&
+ iPendingOp == iPendingVolumeOp )
+ {
+ iPendingVolumeOp = NULL;
+ CompleteOp( aStatus );
+ }
+ break;
+ case EVtAudioOutputControlGetBalance:
+ case EVtAudioOutputControlSetBalance:
+ case EVtAudioOutputControlGetVolume:
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "MH.HandleAudioOutputControlCommandComplete" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeVolume
+// Sets the 'beginning' values for volume.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeVolume()
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.InitializeVolume: max vol=%d", iProtoMaxVolume )
+ iUpdateVolumeAllowed = ETrue;
+ UpdateVolume();
+ if ( iLocalVideo )
+ {
+ iLocalVideo->UnMute();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DisconnectProtoL
+// Does the disconnecting of Protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::DisconnectProtoL()
+ {
+ __VTPRINTENTER( "MH.DisconnectProtoL" )
+ __VTPRINT2( DEBUG_MEDIA, "MH.DisconnectProto with Protocol state=%d",
+ iProtoState )
+ TInt cmdId( 0 );
+ // The two states that require disconnecting
+ if ( iProtoState == MVtProtocolCommand::EConnected ||
+ iProtoState == MVtProtocolCommand::EConnecting )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH. Calling DisconnectFromProtocolL on Protocol" )
+ TRAPD( err, cmdId = iSessionCommand->DisconnectFromProtocolL() );
+ if ( err == KErrNone )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.protoCom: Disconnecting" )
+ AddOperation( EDestructProtoPhaseDisconnect, cmdId );
+ iProtoState = MVtProtocolCommand::EDisconnecting;
+ StartDisconnectTimerL();
+ }
+ else
+ {
+ // Canceling the disconnect to notify that it has failed
+ __VTPRINT2( DEBUG_MEDIA, "MH.DisconnectProto erronous=%d", err )
+ cmdId = err;
+ }
+ }
+ else {
+ cmdId = KErrNotSupported;
+ }
+ __VTPRINTEXITR( "MH.DisconnectProtoL cmdId=%d", cmdId )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelAllProtoCommands
+// Cancels all commands pending for execution in Proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::CancelAllProtoCommands( TOperation &aOp )
+ {
+ __VTPRINTENTER( "MH.CancelAllProtoCommands" )
+ TInt err( KErrNotReady );
+ aOp = ENone;
+ if ( IsPending( EUninitializeCancelAllProto ) != KErrNotFound )
+ {
+ aOp = EUninitializeCancelAllProto;
+ // Indicate difference from started cancellation with error code.
+ err = KErrAlreadyExists;
+ }
+ else if ( iSessionCommand && iPendingOps && !IsFlag( EProtoCancelProtoCmdsOk ) )
+ {
+ if ( iPendingOps->Count() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH. Calling CancelAllCommandsL on Proto" )
+ TInt cmdId( 0 );
+ TRAP( err, ( cmdId = iSessionCommand->CancelAllCommandsL() ) );
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+ "MH.CancelAllProtoCommands cmdId=%d", cmdId )
+ if ( cmdId && err == KErrNone )
+ {
+ aOp = EUninitializeCancelAllProto;
+ SetFlag( EProtoCancelProtoCmdsOk );
+ AddOperation( aOp, cmdId );
+ }
+ // completes in CommandCompletedL
+ }
+ else {
+ // mark there's nothing to cancel
+ SetFlag( EProtoCancelProtoCmdsOk );
+ }
+ }
+ __VTPRINTEXITR( "MH.CancelAllProtoCommands err=%d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ProtoInitialized
+// Proto init completed.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::ProtoInitialized() const
+ {
+ return iSessionCommand ? ETrue : EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TimerCallback
+// Callback method for timer expiration.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TimerCallback( TAny* /*aAny*/ )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.TimerCallback -> PANIC " )
+ Panic( EVtEngPanicDisconnectTimerExpired );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVersionInfoL
+// Sets version information to Proto.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetVersionInfoL( )
+ {
+ __VTPRINTENTER( "MH.SetVersionInfoL" )
+
+ if ( !iH324Config )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.SetVersion not ready" )
+ User::Leave( KErrNotReady );
+ }
+
+ // Current new line character index
+ TInt index( 0 );
+
+ // Version information from SysUtil
+ HBufC* versionInfo16 = HBufC::NewLC( KVtEngSwVersionTextLength );
+
+ // Pointer to SysUtil versionInfo descriptor. Temporary pointer to
+ // handle data.
+ TPtr versionInfoptr16( versionInfo16->Des() );
+
+ // SW Version and product information buffers to be send to peer.
+ HBufC8* version = HBufC8::NewLC( KVtEngSwVersionTextLength );
+ HBufC8* product = HBufC8::NewLC( KVtEngSwVersionTextLength );
+ TPtr8 versionPtr8( version->Des() );
+ TPtr8 productPtr8( product->Des() );
+
+ // Marker for line ending '\n'
+ const TChar endLine( KVtEngCharacterEndLine );
+
+ TInt err = ( SysUtil::GetSWVersion( versionInfoptr16 ) );
+ if ( err != KErrNone || !versionInfoptr16.Length() )
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.SetVersion SU: %d", err )
+ __VTPRINTEXIT( "MH.SetVersionInfoL" )
+ return;
+ }
+#ifdef VTDEBUG
+ RDebug::Print( _L("SysUtil::GetSWVersion: %s"), versionInfoptr16.Ptr() );
+#endif
+ // Construct similar buffer than for version information and get po
+ HBufC* productInfo16 = versionInfo16->AllocLC();
+ TPtr productInfoptr16( productInfo16->Des() );
+
+ // We assume that format from file is:
+ // SW version\ndate\nproduct\nmanufacturer
+ // \n is new line character
+
+ // Find first new line character
+ index = versionInfo16->Locate( endLine );
+ if ( index >= 0 )
+ {
+ // Replace new line character using space.
+ versionInfoptr16[ index ] = KVtEngCharacterSpace ;
+
+ // Find second new line character, this ends the version information
+ index = versionInfo16->Locate( endLine );
+ if ( index >= 0 )
+ {
+ // Take version information and ignore product info.
+ versionInfoptr16 = versionInfo16->Left( index );
+
+ // Take product information and ignore version information.
+ productInfoptr16 = productInfo16->Mid( index + 1 );
+
+ // Find the only remaining new line character.
+ index = productInfoptr16.Locate( endLine );
+
+ // Replace new line character using space.
+ productInfoptr16[ index ] = KVtEngCharacterSpace;
+
+ // Copy 16 bit descriptors to 8 bit descriptors and append
+ // zero terminators.
+ versionPtr8.Copy( versionInfoptr16 );
+ versionPtr8.ZeroTerminate();
+ productPtr8.Copy( productInfoptr16 );
+ productPtr8.ZeroTerminate();
+
+ // Set the info to Protocol
+#ifdef VTDEBUG
+ RDebug::Print(_L("MH.Product: %s" ), productPtr8.Ptr() );
+ RDebug::Print(_L("MH.Version: %s" ), versionPtr8.Ptr() );
+#endif //VTDEBUG
+
+ AddOperation( ESetVendorId,
+ iH324Config->SetVendorId( KVtEngCountryCodeForProto,
+ KVtEngExtensionForProto,
+ KVtEngManufacturerForProto, &productPtr8, &versionPtr8 ) );
+ }
+ }
+ CleanupStack::PopAndDestroy( 4 ); // HBufC's
+ __VTPRINTEXIT( "MH.SetVersionInfoL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::RequestFrame( )
+ {
+ __VTPRINTENTER( "MH.RequestFrame" )
+ if ( !iH263Encoder )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.RequestFrame FAILED")
+ return;
+ }
+ AddOperation( ESendIntraframe,iH263Encoder->RequestNextIntraFrame() );
+ ClearFlag( EProtoSendIntraFrame );
+
+ __VTPRINTEXIT( "MH.RequestFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVideoQualityL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetVideoQualityL(
+ const TVideoQuality aVideoQuality, const TBool aSetPeerVideoQuality )
+ {
+ __VTPRINTENTER( "MH.SetVideoQualityL" )
+ if ( !iH263Encoder )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.SetVideoQualityL FAILED")
+ return;
+ }
+ SetFlag( EVideoQualitySetByPeer );
+ TInt protoOperId( iH263Encoder->SetVideoFrameRate(
+ iVideoQuality.ToFrameRate( aVideoQuality ) ) );
+ AddOperation( ESetVideoQuality, protoOperId );
+ iVideoQuality.SettingVideoQuality( protoOperId,
+ aVideoQuality, aSetPeerVideoQuality );
+ __VTPRINTEXIT( "MH.SetVideoQualityL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetPeerVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetPeerVideoQuality( const TVideoQuality aVideoQuality )
+ {
+ __VTPRINTENTER( "MH.SetPeerVideoQuality" )
+ AddOperation( ESendVTSTO, iH324Config->SendVideoTemporalSpatialTradeoffCommand(
+ iVideoIncomingLogicalChannel.iLogicalChannelId,
+ iVideoQuality.ToTradeOff( aVideoQuality ) ) );
+ __VTPRINTEXIT( "MH.SetPeerVideoQuality" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleVideoEncoderCommandCompletedL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleVideoEncoderCommandCompletedL(
+ const TVtCommandResponse& aResponse )
+ {
+ __VTPRINTENTER( "MH.EncExtCommandCompleted" )
+
+ __VTPRINT2( DEBUG_MEDIA, "MH.263 ComC type=%d", aResponse.iCmdType )
+ __VTPRINT3( DEBUG_MEDIA, "MH.263 ComC cmdId=%d,response=%d",
+ aResponse.iCmdId, aResponse.iCmdStatus )
+
+ // Find correct entry in iPendingOps based on TOperation because there can
+ // be several entries with same Protocol cmd id since each Protocol interface has their
+ // own id allocation and ids may overlap.
+ TInt index( KErrNotFound );
+ TOperation completedOp = ENone;
+ if ( MatchResponseToPendingOps( aResponse.iCmdId, ESendIntraframe, &index ) ||
+ MatchResponseToPendingOps( aResponse.iCmdId, ESetIFrameInterval, &index ) ||
+ MatchResponseToPendingOps( aResponse.iCmdId, ESetVideoQuality, &index ) )
+ {
+ // TOperation entries in are unique in the array...
+ const TCmdOpPair pair = (*iPendingOps)[ index ];
+ completedOp = pair.iOp;
+ // ...so remove based on that instead of protoCmdId
+ RemoveOperation( completedOp );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.EECC ERROR (response to unknown command)" )
+ }
+ if ( completedOp == ESetVideoQuality )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.EECC ESetVideoQuality" )
+ if( iPendingOp && ( iPendingOp->Command() == KVtEngSetVideoQuality ) )
+ {
+ CompleteOp( aResponse.iCmdStatus );
+ }
+ if( aResponse.iCmdStatus == KErrNone )
+ {
+ TVtEngVideoQuality::TVQSParams vqp;
+
+ if ( iVideoQuality.SettingSucceeded( aResponse.iCmdId, vqp ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.EECC sending vq indication" )
+ AddOperation( ESendVTSTO,
+ iH324Config->SendVideoTemporalSpatialTradeoffIndication(
+ iVideoOutgoingLogicalChannel.iLogicalChannelId,
+ iVideoQuality.ToTradeOff( vqp.iValue ) ) );
+ if ( vqp.iSetPeer )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.EECC setting peer vq" )
+ SetPeerVideoQuality( vqp.iValue );
+ }
+ }
+ }
+ else
+ {
+ iVideoQuality.SettingFailed( aResponse.iCmdId );
+ }
+ }
+ if ( iProtoState == MVtProtocolCommand::EIdle )
+ { // Command was complete during uninitialization.
+ NextUninitStepCallbackL();
+ }
+ __VTPRINTEXIT( "MH.EncExtCommandCompleted" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleVideoEncoderInformationalEventL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleVideoEncoderInformationalEventL(
+ const TVtIndicationEvent& aEvent)
+ {
+ __VTPRINT2( DEBUG_MEDIA, "MH.263 infoevent=%d", aEvent.iEventType )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleH324MConfigCommandCompletedL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleH324MConfigCommandCompletedL(
+ const TVtCommandResponse& aResponse )
+ {
+ __VTPRINTENTER( "MH.HandleH324MConfigCommandCompletedL" )
+
+ __VTPRINT2( DEBUG_MEDIA, "MH.HandleH324MConfigCommandCompletedL type=%d", aResponse.iCmdType )
+ __VTPRINT3( DEBUG_MEDIA, "MH.HandleH324MConfigCommandCompletedL cmdId=%d,response=%d", aResponse.iCmdId, aResponse.iCmdStatus )
+ TInt index( KErrNotFound );
+ // Find correct entry in iPendingOps based on TOperation because there can
+ // be several entries with same Protocol cmd id since each Protocol interface has their
+ // own id allocation and ids may overlap.
+ if ( MatchResponseToPendingOps( aResponse.iCmdId, ESetVendorId, &index ) ||
+ MatchResponseToPendingOps( aResponse.iCmdId, ESendVTSTO, &index ) ||
+ MatchResponseToPendingOps( aResponse.iCmdId, ESetSupportedResolutions, &index ) ||
+ MatchResponseToPendingOps( aResponse.iCmdId, ESetFastCsupOptions, &index ) )
+ {
+ // TOperation entries in are unique in the array...
+ const TCmdOpPair pair = (*iPendingOps)[ index ];
+ // ...so remove based on that instead of protoCmdId
+ RemoveOperation( pair.iOp );
+ }
+ switch( iProtoState )
+ {
+ case MVtProtocolCommand::EConnected:
+ {
+ CVtEngStateManager* stateManager = CVtEngUtility::StateManager();
+
+ // Check does the received command ID match to command ID that was received
+ // from Protocol when DTMF was send.
+ if( stateManager->Handlers().Dtmf().CheckCommandId( aResponse.iCmdId ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.Complete DTMF" )
+ stateManager->Handlers().Dtmf().SendComplete( aResponse.iCmdStatus );
+ }
+ }
+ break;
+ case MVtProtocolCommand::EIdle: // extension command complete
+ NextUninitStepCallbackL();
+ default:
+ break;
+ }
+
+ __VTPRINTEXITR( "MH.HandleH324MConfigCommandCompletedL.CommandID %d", aResponse.iCmdId )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleH324MConfigInformationalEventL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleH324MConfigInformationalEventL(
+ const TVtIndicationEvent& aEvent )
+ {
+ __VTPRINTENTER( "MH.HandleH324MConfigInformationalEventL" )
+
+ const TInt type( aEvent.iEventType );
+ const TUint8* buffer = (const_cast<TVtIndicationEvent&>(aEvent)).iLocalBuffer;
+
+ switch(type)
+ {
+ case EVtIndicationVideoSpatialTamporalTradeOffIndication:
+ case EVtIndicationVideoSpatialTamporalTradeOffCommand:
+ {
+ TUint16 logicalChannelId = BigEndian::Get16( buffer );
+ TUint8 tradeOffValue = buffer[ 2 ];
+ __VTPRINT3( DEBUG_MEDIA, "MH.protoHIE.H324 channelId=%d, tradeOff=%d",
+ logicalChannelId, tradeOffValue )
+ if( type ==
+ EVtIndicationVideoSpatialTamporalTradeOffIndication )
+ {
+ HandleSpatialTradeoffIndication( logicalChannelId,
+ tradeOffValue );
+ }
+ else
+ {
+ HandleSpatialTradeoffCommandL( logicalChannelId,
+ tradeOffValue );
+ }
+ }
+ break;
+
+ // When remote terminal sends its UII capabilities in TCS we get
+ // indication from Protocol. If remote does not send UII capas in TCS
+ // we are obliged to use alphanumeric UIIs as specified by 245
+ // spec. Default is IA5String.We get bit pattern from Protocol but
+ // they are listed below in preferred order of usage.
+ // The order can be freely chosen.
+ case EVtIndicationUserInputCapability:
+ {
+#ifdef VTDEBUG
+ RDebug::Print(_L("Buffer[0]:%d"), buffer[0] );
+#endif // VTDEBUG
+ __VTPRINT( DEBUG_MEDIA,
+ "MH.protoHIE UserInput Capability Indication" )
+
+ CVtEngStateManager* stateManager =
+ CVtEngUtility::StateManager();
+
+ // IA5String preferred, it's the simplest and most used in TCSs.
+ if ( buffer[0] & CVtEngDtmfHandler::EIA5String )
+ {
+ stateManager->Handlers().Dtmf().SetUIISupport(
+ CVtEngDtmfHandler::EIA5String );
+ CVtEngEventManager::NotifyEvent(
+ KVtEngRemoteUIIIA5StringSupport );
+ __VTPRINT( DEBUG_MEDIA,
+ "KVtEngRemoteUIIIA5StringSupport Support signalled" )
+ }
+ // Basic string is also simple and easy to use, second position.
+ else if ( buffer[0] & CVtEngDtmfHandler::EBasicString )
+ {
+ stateManager->Handlers().Dtmf().SetUIISupport(
+ CVtEngDtmfHandler::EBasicString );
+ CVtEngEventManager::NotifyEvent(
+ KVtEngRemoteUIIBasicStringSupport );
+ __VTPRINT( DEBUG_MEDIA,
+ "KVtEngRemoteUIIBasicStringSupport Support signalled" )
+ }
+ // DTMFs are more limited but more interoperable than
+ // General string.
+ else if ( buffer[0] & CVtEngDtmfHandler::EDTMFString )
+ {
+ stateManager->Handlers().Dtmf().SetUIISupport(
+ CVtEngDtmfHandler::EDTMFString );
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteUIIDtmfSupport );
+ __VTPRINT( DEBUG_MEDIA,
+ "KVtEngRemoteUIIDtmfSupport Support signalled" )
+ }
+ // General string is the complicated one, priority is
+ // lowest because of possible diffuculties in remote
+ // end decoding of string (various number of letter
+ // combinations).
+ else if ( buffer[0] & CVtEngDtmfHandler::EGeneralString )
+ {
+ stateManager->Handlers().Dtmf().SetUIISupport(
+ CVtEngDtmfHandler::EGeneralString );
+ CVtEngEventManager::NotifyEvent(
+ KVtEngRemoteUIIGeneralStringSupport );
+ __VTPRINT( DEBUG_MEDIA,
+ "KVtEngRemoteUIIGeneralStringSupport Support signalled" )
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.HIE invalid DTMF" )
+ Panic( EVtEngPanicInvalidDtmfState );
+ }
+ }
+ break;
+ }
+ __VTPRINTEXIT( "MH.HandleH324MConfigInformationalEventL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetSupportedResolutionsL
+// Sets supported resolutions to protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetSupportedResolutions()
+ {
+ __VTPRINTENTER( "MH.SetSupportedResolutions" )
+ __ASSERT_ALWAYS( iH324Config != NULL, Panic( EVtEngPanicInvalidPointer ) );
+
+ AddOperation( ESetSupportedResolutions,
+ iH324Config->SetSupportedResolutions( ) );
+ __VTPRINTEXIT( "MH.SetSupportedResolutions " )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetFastCsupOptions
+// Sets supported resolutions to Protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetFastCsupOptions()
+ {
+ __VTPRINTENTER( "MH.SetFastCsupOptions" )
+
+ AddOperation(
+ ESetFastCsupOptions,
+ iH324Config->SetFastCsupOptions( ) );
+ __VTPRINTEXIT( "MH.SetFastCsupOptions" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CreateExtensionsL
+// Creates extension according to API Uid.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensionBase* CVtEngMediaHandler::CreateExtensionsL( const TUid& aUid )
+ {
+ __VTPRINTENTER( "MH.CreateExtensionsL" )
+
+ // if UID is supported camera pref
+ if ( aUid == KVtEngExtensionCameraPreferences )
+ {
+ __VTPRINT2( DEBUG_GEN, "MH.CreateExtensionsL extension UID=%d",
+ aUid.iUid )
+
+ CVtEngExtensionBase* base = reinterpret_cast< CVtEngExtensionBase* >
+ ( iLocalVideo->CreateCameraPreferencesL() );
+ __VTPRINTEXITR( "MH.CreateExtensionsL base [%d]", ( TInt )base )
+ return base;
+ }
+
+#if defined ( RD_VT_RTF )
+
+ // if UID is supported R2F
+ else if ( aUid == KVtEngExtensionRecord2File )
+ {
+ CVtEngExtensionBase* base = reinterpret_cast< CVtEngExtensionBase* >
+ ( CVtEngRecord2File::NewL() );
+ __VTPRINTEXITR( "MH.CreateExtensionsL base [%d]", ( TInt )base )
+ return base;
+ }
+ // not supported UID
+
+#endif //RD_VT_RTF
+
+ else
+ {
+ __VTPRINTEXITR( "MH.CreateExtensionsL error [%d]", KErrNotSupported )
+ User::Leave( KErrNotSupported);
+ return NULL;
+ }
+ }
+
+// Implementation for TVtEngVideoQuality
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVtEngVideoQuality
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVtEngVideoQuality()
+ : iCurrent( EVideoQualityNormal ), iParamList( 1 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::~TVtEngVideoQuality
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::~TVtEngVideoQuality()
+ {
+ iParamList.Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::SettingVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::SettingVideoQuality(
+ TInt aId, const TVideoQuality aValue, TBool aSetPeer )
+ {
+ __VTPRINTENTER( "MH.VQ.SettingVideoQuality" )
+ User::LeaveIfError( iParamList.Append( TVQSParams( aId, aValue, aSetPeer ) ) );
+ __VTPRINTEXIT( "MH.VQ.SettingVideoQuality" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::VideoQuality
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TVideoQuality
+ CVtEngMediaHandler::TVtEngVideoQuality::VideoQuality() const
+ {
+ __VTPRINTENTER( "MH.VQ.VideoQuality" )
+ __VTPRINTEXITR( "MH.VQ.VideoQuality %d", iCurrent )
+ return iCurrent;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::IsSetPeer
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::TVtEngVideoQuality::SettingSucceeded( TInt aId,
+ TVQSParams& aParams )
+ {
+ __VTPRINTENTER( "MH.VQ.SettingSucceeded" )
+ TInt index( FindVQSParam( aId ) );
+ TBool foundRecord( index != KErrNotFound );
+ if ( foundRecord )
+ {
+ aParams = iParamList[ index ];
+ iParamList.Remove( index );
+ iParamList.Compress();
+ }
+ __VTPRINTEXITR( "MH.VQ.SettingSucceeded %d", foundRecord )
+ return foundRecord;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::IsSetPeer
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::UpdateVideoQuality(
+ const TVideoQuality aVideoQuality )
+ {
+ __VTPRINTENTER( "MH.VQ.UpdateVideoQuality" )
+ iCurrent = aVideoQuality;
+ __VTPRINTEXIT( "MH.VQ.UpdateVideoQuality" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::SettingFailed
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::SettingFailed( TInt aId )
+ {
+ __VTPRINTENTER( "MH.VQ.SettingFailed" )
+ TInt index( FindVQSParam( aId ) );
+ if ( index != KErrNotFound )
+ {
+ iParamList.Remove( index );
+ iParamList.Compress();
+ }
+ __VTPRINTEXITR( "MH.VQ.SettingFailed %d", index )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::FromTradeOff
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TVideoQuality
+ CVtEngMediaHandler::TVtEngVideoQuality::FromTradeOff(
+ const TInt aTradeOff ) const
+ {
+ __VTPRINTENTER( "MH.VQ.FromTradeOff" )
+ TVideoQuality videoQuality;
+
+ // [0 .. KVtEngTradeOffDetailMax]
+ if( aTradeOff <= KVtEngTradeOffDetailMax )
+ {
+ videoQuality = EVideoQualityDetail;
+ }
+ // ]KVtEngTradeOffDetailMax .. KVtEngTradeOffNormalMax]
+ else if( aTradeOff <= KVtEngTradeOffNormalMax )
+ {
+ videoQuality = EVideoQualityNormal;
+ }
+ // ]KVtEngTradeOffNormalMax .. 31]
+ else
+ {
+ videoQuality = EVideoQualityMotion;
+ }
+ __VTPRINTEXITR( "MH.VQ.FromTradeOff %d", videoQuality )
+ return videoQuality;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::ToFrameRate
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TVtEngVideoQuality::ToFrameRate(
+ const TVideoQuality aVideoQuality ) const
+ {
+ __VTPRINTENTER( "MH.VQ.ToFrameRate" )
+ TInt frameRate( 0 );
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ switch( aVideoQuality )
+ {
+ case EVideoQualityDetail:
+ frameRate = settings.VideoQualityFrameRateConfig().iDetail;
+ break;
+
+ case EVideoQualityNormal:
+ frameRate = settings.VideoQualityFrameRateConfig().iNormal;
+ break;
+
+ case EVideoQualityMotion:
+ frameRate = settings.VideoQualityFrameRateConfig().iMotion;
+ break;
+
+ default:
+ Panic( EVtEngPanicInvalidVideoQualityValue );
+ break;
+ }
+ __VTPRINTEXITR( "MH.VQ.ToFrameRate %d", frameRate )
+ return frameRate;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::ToTradeOff
+// -----------------------------------------------------------------------------
+//
+TUint8 CVtEngMediaHandler::TVtEngVideoQuality::ToTradeOff(
+ const TVideoQuality aVideoQuality ) const
+ {
+ __VTPRINTENTER( "MH.VQ.ToTradeOff" )
+ TUint8 tradeOff( 0 );
+ switch( aVideoQuality )
+ {
+ case EVideoQualityDetail:
+ tradeOff = KVtEngTradeOffDetailMax;
+ break;
+
+ case EVideoQualityNormal:
+ tradeOff = KVtEngTradeOffNormalMax;
+ break;
+
+ case EVideoQualityMotion:
+ tradeOff = KVtEngTradeOffMotionMax;
+ break;
+
+ default:
+ Panic( EVtEngPanicInvalidVideoQualityValue );
+ break;
+ }
+ __VTPRINTEXITR( "MH.VQ.ToTradeOff %d", tradeOff )
+ return tradeOff;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::FindVQSParam
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TVtEngVideoQuality::FindVQSParam( TInt aId ) const
+ {
+ __VTPRINTENTER( "MH.VQ.FindVQSParam" )
+ TInt result( KErrNotFound );
+ for ( TInt i = iParamList.Count() - 1; i >= 0; i-- )
+ {
+ if ( iParamList[ i ].iId == aId )
+ {
+ result = i;
+ break;
+ }
+ }
+ __VTPRINTEXITR( "MH.VQ.FindVQSParam %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams()
+ {
+ Mem::FillZ( this, sizeof( TVQSParams ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams(
+ TInt aId, const TVideoQuality aValue, TBool aSetPeer )
+ : iId( aId ), iValue( aValue ), iSetPeer( aSetPeer )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::QueryProtoInterfacesL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::QueryProtoInterfacesL()
+ {
+ __VTPRINTENTER( "MH.QueryProtoInterfacesL" )
+ // Ensure call is still connected to prevent unnecessary Protocol
+ // interface acquisition
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ const MVtEngSessionInfo::TSessionState sessionState =
+ states->SessionState();
+ if ( sessionState != MVtEngSessionInfo::EIdle &&
+ sessionState != MVtEngSessionInfo::EClearing )
+
+ {
+ // Request the 324M Stack interface
+ if ( !IsFlag( EProto324IFAcquired ) )
+ {
+ /*
+ AddOperation( EGet324CtrlInterface,
+ iSessionCommand->GetProtocolInterfaceL(
+ EVtH324Config,
+ ( MVtProtocolCommand*& ) iH324Config ));
+ */
+ MVtProtocolCommand *pCommand = NULL;
+ AddOperation( EGet324CtrlInterface,
+ iSessionCommand->GetProtocolInterfaceL(
+ EVtH324Config,
+ ( MVtProtocolCommand*& ) pCommand ));
+ iH324Config = static_cast<MVtH324ConfigCommand *>(pCommand);
+ }
+ // Get encoder interface.
+ /*
+ AddOperation( EGetH263EncInterface,
+ iSessionCommand->GetProtocolInterfaceL(
+ EVtVideoEncoderConfig,
+ ( MVtProtocolCommand*& ) iH263Encoder ));
+ */
+ MVtProtocolCommand *pCommand = NULL;
+ AddOperation( EGetH263EncInterface,
+ iSessionCommand->GetProtocolInterfaceL(
+ EVtVideoEncoderConfig,
+ ( MVtProtocolCommand*& ) pCommand ));
+ iH263Encoder = static_cast<MVtVideoConfigCommand *>(pCommand);
+ }
+ __VTPRINTEXIT( "MH.QueryProtoInterfacesL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ReleaseProtoInterfacesL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ReleaseProtoInterfacesL()
+ {
+ __VTPRINTENTER( "MH.ReleaseProtoInterfacesL" )
+
+ // Release interfaces
+ __VTPRINT( DEBUG_MEDIA, "LCN: MH.324 started to release interfaces" )
+ if( iH324Config )
+ {
+ /*
+ AddOperation( ERemove324CtrlInterface,
+ iSessionCommand->DeleteProtocolInterfaceL( EVtH324Config, iH324Config ) );*/
+ MVtProtocolCommand *pCommand = NULL;
+ pCommand = static_cast<MVtProtocolCommand *>(iH324Config);
+ AddOperation( ERemove324CtrlInterface,
+ iSessionCommand->DeleteProtocolInterfaceL( EVtH324Config, pCommand ) );
+ iH324Config = 0;
+ __VTPRINT( DEBUG_MEDIA, "MH.324 started to release" )
+ }
+
+ if ( iH263Encoder )
+ {
+ /*
+ AddOperation( ERemoveH263EncInterface,
+ iSessionCommand->DeleteProtocolInterfaceL( EVtVideoEncoderConfig, iH263Encoder ) );*/
+ MVtProtocolCommand *pCommand = NULL;
+ pCommand = static_cast<MVtProtocolCommand *>(iH263Encoder);
+ AddOperation( ERemoveH263EncInterface,
+ iSessionCommand->DeleteProtocolInterfaceL( EVtVideoEncoderConfig, pCommand ) );
+ iH263Encoder = 0;
+ iH263Encoder = 0;
+ __VTPRINT( DEBUG_MEDIA, "MH.263 started to release" )
+ }
+ __VTPRINTEXIT( "MH.ReleaseProtoInterfacesL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ExtensionCommandsPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::ExtensionCommandsPending() const
+ {
+ __VTPRINTENTER( "MH.ExtensionCommandsPending" )
+ TBool isPending = EFalse;
+ TInt count( iPendingOps->Count() );
+ while ( count-- )
+ {
+ const TOperation op = ( *iPendingOps )[ count ].iOp;
+ switch ( op )
+ {
+ // extension commands
+ case ESendIntraframe:
+ case ESetSupportedResolutions:
+ case ESetVideoQuality:
+ case ESendVTSTO:
+ case ESetFastCsupOptions:
+ case ESetVendorId:
+ case ESetIFrameInterval:
+ isPending = ETrue;
+#ifdef _DEBUG
+ RDebug::Print( _L(" (ext) op=%d,protoCmdId=%d"),
+ op, ( *iPendingOps )[ count ].iProtoCmdId );
+#else
+// in debug mode allow printing all pending ops to log
+ count = 0; // break loop
+#endif
+ break;
+ default:
+ break;
+ }
+ }
+ __VTPRINTEXITR( "MH.ExtensionCommandsPending %d", isPending )
+ return isPending;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::MediaAddingValidity
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::MediaAddingValidity() const
+ {
+ __VTPRINTENTER( "MH.MediaAddingValidity" )
+
+ TBool addingOK( ETrue );
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ MVtEngSessionInfo::TSessionState sessionState ( states->SessionState() );
+ if( sessionState == MVtEngSessionInfo::EClearing ||
+ sessionState == MVtEngSessionInfo::EIdle )
+ {
+ __VTPRINT( DEBUG_MEDIA, "MH.MediaAddingValidity NOT ALLOWED" )
+ // State is wrong, adding not allowed.
+ addingOK = EFalse;
+ }
+
+ __VTPRINTEXITR( "MH.MediaAddingValidity %d", addingOK )
+
+ return addingOK;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelInitializeShareImage
+// -----------------------------------------------------------------------------
+void CVtEngMediaHandler::CancelInitializeShareImage()
+ {
+ __VTPRINTENTER( "CVtEngMediaHandler.CancelInitializeShareImage");
+ if(iLocalVideo)
+ {
+ iLocalVideo->CancelInitializeShareImage();
+ }
+ __VTPRINTEXIT( "CVtEngMediaHandler.CancelInitializeShareImage");
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngRemoteVideo.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,737 @@
+/*
+* Copyright (c) 2004-2006 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: Remote video handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngRemoteVideo.h"
+#include "CVtEngStateManager.h"
+#include "MVtEngFrameObserver.h"
+#include <videotelephonyvariant.hrh>
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngEventManager.h"
+#include "VtEngConstants.h"
+#include "VtEngPanic.h"
+#include "TVtEngRenderingDSA.h"
+#include "TVtEngRenderingDP.h"
+#include "TVtEngRenderingNGA.h"
+#include "TVtEngRenderConfigDSA.h"
+#include "TVtEngRenderConfigDP.h"
+#include "TVtEngRenderConfigNGA.h"
+#include "CVtEngDrawDP.h"
+#include "CVtEngDrawDSA.h"
+#include "CVtEngDrawNGA.h"
+#include <fbs.h>
+#include <w32std.h>
+#include <cvtlogger.h>
+#include <mvtprotocolhandler.h>
+#include <featmgr.h>
+
+// LOCAL CONSTANTS AND MACROS
+// This active object priority.
+const TInt KVtEngRemoteDrawPriority = CActive::EPriorityStandard;
+
+// Timer priority when not frame watching.
+const TInt KVtEngStoppedRenderPriority = CActive::EPriorityLow;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngRemoteVideo
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngRemoteVideo(
+ MVtSessionCommand& aSessionCommand,
+ CVtEngStateManager& aStateManager ) :
+ iSessionCommand( aSessionCommand),
+ iStateManager( aStateManager ),
+ iEnableNGA(ETrue)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::ConstructL()
+ {
+ __VTPRINTENTER( "RV.ConstructL" )
+ //We are in the Proto ESetup state
+ iDrawer =
+ static_cast< CVtEngDraw* >( VtEngDrawFactory::CreateDrawerL( this , iEnableNGA) );
+ //Add protocol Data Sink;
+ iDisplaySink = iDrawer->DisplaySink();
+ iAudioSink = VTProtocolFactory::CreateAudioSink();
+ __VTPRINTEXIT( "RV.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo* CVtEngRemoteVideo::NewL(
+ MVtSessionCommand& aSessionCommand,
+ CVtEngStateManager& aStateManager )
+ {
+ CVtEngRemoteVideo* self = new( ELeave )
+ CVtEngRemoteVideo( aSessionCommand, aStateManager );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngRemoteVideo
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::~CVtEngRemoteVideo()
+ {
+ __VTPRINTENTER( "RV.~" )
+ VTProtocolFactory::DeleteAudioSink( iAudioSink );
+ delete iDrawer;
+ __VTPRINTEXIT( "RV.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+ const TVtEngRenderingOptionsNGA& aParams )
+ {
+ __VTPRINTENTER( "RV.SetRenderingParametersL NGA" )
+
+ // If rendering is ongoing, stop it
+ StopVideoRendering();
+ // Set new values
+ TVtEngRenderConfigNGA config( aParams );
+ iDrawer->BaseSetConfigL( config );
+ __VTPRINTEXIT( "RV.SetRenderingParametersL NGA" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+ const TVtEngRenderingOptionsDSA& aParams )
+ {
+ __VTPRINTENTER( "RV.SetRenderingParametersL DSA" )
+
+ __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iTl.iX %d", aParams.iRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iTl.iY %d", aParams.iRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iBr.iX %d", aParams.iRect.iBr.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iBr.iY %d", aParams.iRect.iBr.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iTl.iX %d",
+ aParams.iClipRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iTl.iY %d",
+ aParams.iClipRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iBr.iX %d",
+ aParams.iClipRect.iBr.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iBr.iY %d",
+ aParams.iClipRect.iBr.iY )
+ __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+ // If rendering is ongoing, stop it
+ StopVideoRendering();
+ // Set new values
+ TVtEngRenderConfigDSA config( aParams );
+ iDrawer->BaseSetConfigL( config );
+ __VTPRINTEXIT( "RV.SetRenderingParametersL DSA" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+ const TVtEngRenderingOptionsDP& aParams )
+ {
+ __VTPRINTENTER( "RV.SetRenderingParametersL DP" )
+
+ __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iTl.iX %d", aParams.iRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iTl.iY %d", aParams.iRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iBr.iX %d", aParams.iRect.iBr.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iRect.iBr.iY %d", aParams.iRect.iBr.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iTl.iX %d",
+ aParams.iClipRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iTl.iY %d",
+ aParams.iClipRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iBr.iX %d",
+ aParams.iClipRect.iBr.iX )
+ __VTPRINT2( DEBUG_MEDIA , " aParams.iClipRect.iBr.iY %d",
+ aParams.iClipRect.iBr.iY )
+ __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+ // If rendering is ongoing, stop it
+ StopVideoRendering();
+ // Set new values
+ TVtEngRenderConfigDP config( aParams );
+ iDrawer->BaseSetConfigL( config );
+ __VTPRINTEXIT( "RV.SetRenderingParametersL DP" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::StartVideoL
+//
+// For incoming, this function starts/resumes playing out the media to the
+// appropriate sink based on the current settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::StartVideoL()
+ {
+ __VTPRINTENTER( "RV.StartVideoL" )
+ if ( iDisplaySink && iDrawer &&
+ ( iDrawer->IsFlag( CVtEngDraw::EFlagInitialized ) ||
+ iDrawer->IsFlag( CVtEngDraw::EBaseConstructCalled ) ) )
+ {
+ iDrawer->BaseStartDrawL();
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+ __VTPRINTEXIT( "RV.StartVideoL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::StopVideoRendering
+// Stops rendering of remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::StopVideoRendering()
+ {
+ __VTPRINTENTER( "RV.StopVideoRendering" )
+ // Stop only if active
+ if( iDrawer->GetDsaState() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RV.Stopping" )
+ iDrawer->BaseStopDraw();
+ }
+ __VTPRINTEXIT( "RV.StopVideoRendering" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AddVideoSinkL
+// Adds a sink for video to proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::AddVideoSinkL( TInt aChannelId )
+ {
+ __VTPRINTENTER( "RV.AddVideoSinkL" )
+ if ( iDisplaySink == NULL )
+ {
+ User::Leave( KErrNotReady );
+ }
+ TInt id = iSessionCommand.AddVideoSinkL(
+ aChannelId, *iDisplaySink );
+ iDrawer->VideoSinkAdded();
+ __VTPRINTEXITR( "RV.AddVideoSinkL id=%d", id )
+ return id;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AddAudioSinkL
+// Adds a sink for audio to proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::AddAudioSinkL( TInt aChannelId )
+ {
+ __VTPRINTENTER( "RV.AddAudioSinkL" )
+ if ( iAudioSink == NULL )
+ {
+ User::Leave( KErrNotReady );
+ }
+ TInt id = iSessionCommand.AddAudioSinkL( aChannelId, *iAudioSink );
+ __VTPRINTEXITR( "RV.AddAudioSinkL id=%d", id )
+ return id;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::GetDsaState
+// Returns state of Direct Screen Access.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::GetDsaState() const
+ {
+ return iDrawer->GetDsaState();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::PauseVideoL
+//
+// For an incoming track this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::PauseVideoL()
+ {
+ __VTPRINTENTER( "RV.PauseVideoL" )
+ if ( iDisplaySink == NULL )
+ {
+ User::Leave( KErrNotReady );
+ }
+ TInt cmdId = iSessionCommand.PauseVideoL( *iDisplaySink );
+ __VTPRINTEXITR( "RV.PauseVideoL id=%d", cmdId )
+ return cmdId;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AudioSink
+// Returns audio sink.
+// -----------------------------------------------------------------------------
+//
+MVTAudioSink* CVtEngRemoteVideo::AudioSink()
+ {
+ return iAudioSink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetUIForegroundL
+// Sets UI foreground state.
+// -----------------------------------------------------------------------------
+void CVtEngRemoteVideo::SetUIForegroundL( TBool aForeground )
+ {
+ __VTPRINTENTER( "RV.SetUIForegroundL" )
+ if( !iDisplaySink )
+ {
+ User::Leave( KErrNotReady );
+ }
+ if( aForeground )
+ {
+ __VTPRINT( DEBUG_MEDIA, " RV.Resuming" )
+ iDisplaySink->Resume();
+ }
+ else
+ {
+ __VTPRINT( DEBUG_MEDIA, " RV.Pausing" )
+ iDisplaySink->Pause();
+ }
+ iDrawer->BaseSetUIForegroundL( aForeground );
+ __VTPRINTEXIT( "RV.SetUIForegroundL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::RequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+void CVtEngRemoteVideo::RequestLastFrame()
+ {
+ __VTPRINTENTER( "RV.RequestLastFrame" )
+ if(iDrawer)
+ iDrawer->BaseRequestLastFrame();
+__VTPRINTEXIT( "RV.RequestLastFrame" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::~CVtEngDraw
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngDraw::~CVtEngDraw()
+ {
+ __VTPRINTENTER( "RVD.~" )
+ Cancel();
+ delete iWatcher;
+ delete iDSA;
+ if ( iDisplaySink )
+ {
+ iDisplaySink->Destroy();
+ }
+ __VTPRINTEXIT( "RVD.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::CVtEngDraw
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngDraw::CVtEngDraw( MDisplaySinkObserver* aObserver ) :
+ CActive( KVtEngRemoteDrawPriority ), iCheckpoint( KVtEngWatcherThreshold ),
+ iObserver( aObserver ), iCallback( WatcherExpired, this ),
+ iDSUpdated( ETrue )
+ {
+ iSourceSize = TSize( KVtEngRemoteVideoDefaultWidth,
+ KVtEngRemoteVideoDefaultHeight );
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ConstructL( )
+ {
+ __VTPRINTENTER( "RVD.ConstructL" )
+ BaseConstructL();
+ // Create sink
+ iDisplaySink = CreateSinkL();
+ iWatcher = CPeriodic::NewL( KVtEngStoppedRenderPriority );
+ __VTPRINTEXIT( "RVD.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::AbortNow
+// Aborts DSA when requested by Window Server.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::AbortNow(
+ RDirectScreenAccess::TTerminationReasons /*aReason*/ )
+ {
+ __VTPRINTENTER( "RVD.AbortNow" )
+ ClearFlag( EReadyForeground | EStarted );
+ BaseAbortNow();
+ __VTPRINTEXIT( "RVD.AbortNow" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::Restart
+// Restarts DSA.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::Restart(
+ RDirectScreenAccess::TTerminationReasons /*aReason*/ )
+ {
+ __VTPRINTENTER( "RVD.Restart" )
+ TRAPD( err,
+ {
+ if ( !IsFlag( EStarted ) )
+ {
+ if ( !iDSA->IsActive() )
+ {
+ iDSA->StartL();
+ }
+ SetFlag( EStarted );
+ }
+ if ( !Config().iClipRect.IsEmpty() )
+ {
+ __VTPRINT3( DEBUG_MEDIA, "RVD.Restart iClipRect.iTl (%d, %d)",
+ Config().iClipRect.iTl.iX, Config().iClipRect.iTl.iY );
+ __VTPRINT3( DEBUG_MEDIA, "RVD.Restart iClipRect.iBr (%d, %d)",
+ Config().iClipRect.iBr.iX, Config().iClipRect.iBr.iY );
+ iDSA->Gc()->SetClippingRect( Config().iClipRect );
+ }
+ BaseRestartL();
+ } );
+ if ( err != KErrNone )
+ {
+ ClearFlag( EReadyForeground );
+ }
+ else
+ {
+ SetFlag( EReadyForeground );
+ }
+
+ __VTPRINT2( DEBUG_MEDIA, "RVD.Restart flags %d", iFlags )
+ if ( iCheckpoint == KVtEngWatcherThreshold )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "RVD.Restart RFs" )
+ TRAP( err, BaseRefreshL() );
+ }
+ __VTPRINTEXITR( "RVD.Restart %d", err )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::GetDsaState
+// Returns the state of DSA: is drawing ongoing.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::CVtEngDraw::GetDsaState() const
+ {
+ __VTPRINTENTER( "RVD.GetDsaState" )
+ TBool active( EFalse );
+ active = IsFlag( ERemoteVideoDrawing );
+ __VTPRINTEXITR( "RVD.GetDsaState is active=%d", active )
+ return active;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::WatcherExpired
+// Checks if frame watcher has expired, ie. no frames are received.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::CVtEngDraw::WatcherExpired( TAny* aAny )
+ {
+ CVtEngRemoteVideo::CVtEngDraw* drawer =
+ reinterpret_cast<CVtEngRemoteVideo::CVtEngDraw*>( aAny );
+ drawer->HandleWatcherExpired();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::HandleWatcherExpired
+// Does the checking for frame reception.
+// If not receiving, notify using client (VT UI).
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::HandleWatcherExpired()
+ {
+ __VTPRINTENTER( "RVD.WatcherExpired" )
+ if ( IsFlag( EStarted ) )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN, "RVD.WatcherExpired RF:%d",
+ iCheckpoint )
+ if ( iCheckpoint != KVtEngWatcherThreshold &&
+ IsFlag( EFirstFrameReceived ) )
+ {
+ __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "RVD.WatcherExpired RF" )
+ TRAP_IGNORE( BaseRefreshL() );
+ }
+ iCheckpoint--;
+ // Not under zero though.
+ if ( iCheckpoint < 0 )
+ {
+ iCheckpoint = 0;
+ }
+ }
+ __VTPRINTEXIT( "RVD.WatcherExpired" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::SetFlag
+// Sets flags.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::SetFlag( TUint aFlags )
+ {
+ iFlags |= aFlags;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ClearFlag
+// Clears (unsets) flags.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ClearFlag( TUint aFlags )
+ {
+ iFlags &= ~aFlags;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::IsFlag
+// Tests a flag.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::CVtEngDraw::IsFlag( TUint aFlag ) const
+ {
+ return ( iFlags & aFlag ) != 0 ;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::VideoSinkAdded
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::VideoSinkAdded()
+ {
+ // By clearing this flag every time when sink is added, we assure that
+ // blind icon is correctly faded in UI.
+ ClearFlag( EFirstFrameReceived );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::Activate()
+ {
+ __VTPRINTENTER( "RVD.Activate" )
+ if ( !IsActive() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD.Activate setting active" )
+ iStatus = KRequestPending;
+ SetActive();
+ }
+ __VTPRINTEXIT( "RVD.Activate" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ConfigUpdatedL
+// Set drawing configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ConfigUpdatedL()
+ {
+ __VTPRINTENTER( "RVD.ConfigUpdatedL" )
+ ClearFlag( EFlagInitialized );
+ TRAPD( err, {
+ BaseVerifyConfigL();
+
+ if ( IsFlag( EReadyInternal ) )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD.SetC started" )
+ SetFlag( EStarted );
+ __VTPRINT( DEBUG_MEDIA, "RVD.SetC notify rvd start" )
+ }
+ BaseRefreshBitmapsL();
+ } );
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN, "RVD.SetC FAILED %d", err )
+ CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+ }
+ User::LeaveIfError( err );
+ SetFlag( EFlagInitialized );
+ __VTPRINTEXIT( "RVD.ConfigUpdatedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::DisplaySink
+// Returns used display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngRemoteVideo::CVtEngDraw::DisplaySink()
+ {
+ return iDisplaySink;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::DoCancel()
+ {
+ __VTPRINTENTER( "RVD.DoCancel" )
+ BaseDoCancel();
+ iDisplaySink->Release();
+ ClearFlag( EStarted | EFrameWatcherExpired );
+ __VTPRINTEXIT( "RVD.DoCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::RunError
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+TInt CVtEngRemoteVideo::CVtEngDraw::RunError( TInt aError )
+#else
+TInt CVtEngRemoteVideo::CVtEngDraw::RunError( TInt /* aError */ )
+#endif // VTDEBUG
+ {
+ __VTPRINTENTER( "RVD.RunError" )
+ ClearFlag( EStarted );
+ BaseStopDraw();
+ CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStopped );
+ __VTPRINTEXITR( "RVD.RunError %d", aError )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::CreateAndStartDSAL
+// Create DSA instance.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::CreateAndStartDSAL()
+ {
+ __VTPRINTENTER( "RVD.CreateAndStartDSAL" )
+ delete iDSA;
+ iDSA = NULL;
+ iDSA = CDirectScreenAccess::NewL(
+ *Config().iWsSession,
+ *Config().iWsSreenDevice,
+ *Config().iWindow,
+ *this );
+ iDSA->StartL();
+ if ( !Config().iClipRect.IsEmpty() )
+ {
+ __VTPRINT( DEBUG_MEDIA, "RVD.CreateAndStartDSAL setting cliprect" )
+ iDSA->Gc()->SetClippingRect( Config().iClipRect );
+ }
+ __VTPRINTEXIT( "RVD.CreateAndStartDSAL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::VideoFrameSizeChanged
+// Callback from DisplaySink to inform the size change
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::
+ VideoFrameSizeChangedL( const TSize& /* aFrom */, const TSize& aTo )
+ {
+ __VTPRINTENTER( "RVD.VideoFrameSizeChangedL" )
+ __VTPRINT( DEBUG_MEDIA , " ======= RV.RVD.VideoFrameSizeChangedL ========" )
+ __VTPRINT2( DEBUG_MEDIA , " aTo.iWidth: %d", aTo.iWidth)
+ __VTPRINT2( DEBUG_MEDIA , " aTo.iHeight: %d", aTo.iHeight )
+ __VTPRINT( DEBUG_MEDIA , " ======= RV.RVD.VideoFrameSizeChangedL ========" )
+
+ // Notification of changed layout.
+ if ( aTo.iHeight == KVtEngResolutionQCIFHeight &&
+ aTo.iWidth == KVtEngResolutionQCIFWidth )
+ {
+ // Store the new size.
+ iDrawer->iSourceSize = aTo;
+ CVtEngEventManager::NotifyEvent( KVtEngResolutionToQCIF );
+ }
+ else if ( aTo.iHeight == KVtEngResolutionSQCIFHeight &&
+ aTo.iWidth == KVtEngResolutionSQCIFWidth )
+ {
+ // Store the new size.
+ iDrawer->iSourceSize = aTo;
+ CVtEngEventManager::NotifyEvent( KVtEngResolutionToSQCIF );
+ }
+ else
+ {
+ // Unlisted resolution.
+ __VTPRINTEXITR( "RVD.VideoFrameSizeChangedL %d", 0 )
+ return;
+ }
+
+ iDrawer->BaseVideoFrameSizeChangedL( aTo );
+
+ __VTPRINTEXITR( "RVD.VideoFrameSizeChangedL %d", 1 )
+ }
+
+// VtEngDrawFactory
+
+// -----------------------------------------------------------------------------
+// VtEngDrawFactory::CreateDrawerL
+// -----------------------------------------------------------------------------
+//
+MVtEngDraw* VtEngDrawFactory::CreateDrawerL( MDisplaySinkObserver* aObserver, TBool aSupportNGA )
+ {
+ __VTPRINTENTER( "VtEngDrawFactory.CreateDrawerL" )
+ MVtEngDraw* drawer = NULL;
+ if(aSupportNGA)
+ {
+ drawer = CVtEngDrawNGA::NewL( aObserver );
+ }
+ else
+ {
+ if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+ {
+ drawer = CVtEngDrawDP::NewL( aObserver );
+ }
+ else
+ {
+ drawer = CVtEngDrawDSA::NewL( aObserver );
+ }
+ }
+ __VTPRINTEXIT( "VtEngDrawFactory.CreateDrawerL" )
+ return drawer;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Session/CVtEngSessionHandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2006 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: Session handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngSessionHandler.h"
+#include "CVtEngOperation.h"
+#include "CVtEngStateManager.h"
+#include "cvtengincomingcallmonitor.h"
+#include "vtengcommands.h"
+#include "CVtEngOperation.h"
+#include "CVtCtlFactory.h"
+#include "MVtCtlCallControl.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "VtCtlTypes.h" // for TVtCtlCSSessionInfoV1
+#include "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::CVtEngSessionHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler::CVtEngSessionHandler()
+ : CActive( CActive::EPriorityStandard ), iIncomingCallMonitor(NULL)
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::ConstructL()
+ {
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ StartIncomingCallMonitorL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler* CVtEngSessionHandler::NewL( )
+ {
+ CVtEngSessionHandler* self = new( ELeave )
+ CVtEngSessionHandler( );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::~CVtEngSessionHandler
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler::~CVtEngSessionHandler()
+ {
+ __VTPRINTENTER( "SH.~" )
+ Cancel();
+ Uninitialize();
+ delete iIncomingCallMonitor;
+ __VTPRINTEXIT( "SH.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::HandleL
+// Performs session request.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::HandleL(
+ CVtEngOperation& /*aOperation*/ )
+ {
+ __VTPRINT( DEBUG_SESSION, "SH.HandleL leave not supported" )
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::State
+// Returns session state
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngSessionHandler::State(
+ TBool aForcedRefresh ) const
+ {
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ if ( aForcedRefresh )
+ {
+ states->Update();
+ }
+ return states->SessionState();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetDirection
+// Returns direction.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetDirection(
+ TDirection& aDirection ) const
+ {
+ __VTPRINTENTER( "SH.GetDirection" )
+ if ( !iSessionControl )
+ {
+ __VTPRINTEXITR( "SH.GetDirection err=%d", KErrNotFound )
+ return KErrNotFound;
+ }
+
+ TVtCtlCSSessionInfoV1 info;
+ TPckg<TVtCtlCSSessionInfoV1> pckg( info );
+ TRAPD( err, iSessionControl->GetSessionInfoL( KActiveSessionId, pckg ) );
+ if ( err == KErrNone )
+ {
+ switch ( info.iDirection )
+ {
+ case MVtCtlCallControl::EDirectionMobileOriginated:
+ aDirection = EDirectionMO;
+ break;
+ case MVtCtlCallControl::DirectionMobileTerminated:
+ aDirection = EDirectionMT;
+ break;
+ default:
+ aDirection = EDirectionNone;
+ break;
+ }
+ }
+ __VTPRINT2( DEBUG_SESSION, "SH.direction dir=%d", aDirection )
+ __VTPRINTEXITR( "SH.GetDirection err=%d", err )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetDuration
+// Returns session duration.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetDuration(
+ TDuration& aDuration,
+ TBool& aEnabled ) const
+ {
+ if ( !iSessionControl )
+ {
+ return KErrNotFound;
+ }
+
+ TVtCtlDuration duration;
+ TInt err ( iSessionControl->GetDuration( KActiveSessionId, duration ) );
+ if ( err == KErrNone )
+ {
+ aDuration = duration;
+ const CVtEngSettings& settings = CVtEngUtility::Settings();
+ aEnabled = settings.Config().iCallTimerOn;
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetCLI
+//
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetCLI( TCLI& aCLI ) const
+ {
+ const CVtEngSettings& settings = CVtEngUtility::Settings();
+ const TBool isValid = settings.GetCLI( aCLI);
+ TInt res = KErrNone;
+ if ( !isValid )
+ {
+ res = KErrNotReady;
+ }
+ return res;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::HandleVtSessionEventL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::HandleVtSessionEventL(
+ TVtCtlEvent aEvent,
+ TAny* /*aParams*/ )
+ {
+ if ( aEvent == KVtCtlEventSessionStatusChanged )
+ {
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update( );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::InitializeL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::InitializeL()
+ {
+ __VTPRINTENTER( "SH.Initilialize" )
+ if ( iSessionControl )
+ {
+ // already initialized
+ __VTPRINTEXIT( "SH.Initilialize" )
+ return;
+ }
+ TInt err = iLib.Load( KVtCtlLibraryName() );
+ CleanupClosePushL( iLib );
+ if ( err == KErrNone )
+ {
+ TLibraryFunction func = iLib.Lookup( 1 );
+ iFactory = reinterpret_cast<CVtCtlFactory*>( func() );
+ iSessionControl = iFactory->CreateCallControlL( *this );
+
+ // Update state
+ CVtEngStateManager* states = CVtEngUtility::StateManager();
+ states->Update();
+ }
+ CleanupStack::Pop(); // lib
+ __VTPRINTEXIT( "SH.Initilialize" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::Uninitialize
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::Uninitialize()
+ {
+ if ( iFactory )
+ {
+ iFactory->Delete( iSessionControl );
+ delete iFactory;
+ iFactory = NULL;
+ iSessionControl = NULL;
+ }
+ iLib.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::RealState
+//
+//
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtEngSessionHandler::RealState() const
+ {
+ MVtCtlCallControl::TVtCtlState state( MVtCtlCallControl::EUnknown );
+ if ( iSessionControl )
+ {
+ state = iSessionControl->GetSessionState( KActiveSessionId );
+ __VTPRINT2( DEBUG_SESSION, "SH.realState=%d", state )
+ }
+ return state;
+ }
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::RunL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::RunL()
+ {
+ InitializeL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::DoCancel
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::DoCancel()
+ {
+ // nothing here
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::StartIncomingCallMonitorL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::StartIncomingCallMonitorL()
+ {
+ iIncomingCallMonitor = CVtEngIncomingCallMonitor::NewL();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfBuffered.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006 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: Buffered state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngDtmfState.h"
+#include "VtEngPanic.h"
+#include <cvtlogger.h>
+
+// CONSTANTS
+const TInt KVtEngDtmfToneBufferSize = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfBuffered::NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ {
+ CVtEngDtmfBuffered* self = new ( ELeave )
+ CVtEngDtmfBuffered( aDtmfHandler, aH324Config );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::~CVtEngDtmfBuffered
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfBuffered::~CVtEngDtmfBuffered()
+ {
+ delete iTones;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::SendDtmfL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::SendDtmfL( const TVtEngDtmfTone& aTone )
+ {
+ // just add to buffer and wait for completion of pending send operation.
+ iTones->AppendL( aTone );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::DtmfSendCompleteL
+//
+// PSEUDO CODE:
+// deallocate Protocol dtmf instance
+// if ( previous_sending_OK )
+// if ( tones_in_buffer > 1 )
+// next_state = buffered
+// else
+// next_state = sending
+// endif
+// send tone from buffer and change state
+// endif
+// if ( previous_sending_FAIL or new_sending_FAIL )
+// reset buffer
+// next_state = idle
+// endif
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::DtmfSendCompleteL( TInt aError )
+ {
+ __VTPRINTENTER( "DtmfStateBuffered.DtmfSendCompleteL" )
+ CVtEngDtmfState::DtmfSendCompleteL( aError );
+ const TInt count( iTones->Count() );
+ __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered.Send bufSize=%d", count )
+
+ TInt index( KErrNone );
+ if ( count && aError == KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered cnt=%d", count )
+ const TVtEngDtmfTone& tone = iTones->At( index );
+ MVtEngDtmfHandler::TVtEngDtmfState nextState = ( count > 1 ) ?
+ MVtEngDtmfHandler::EVtDtmfStateBuffered :
+ MVtEngDtmfHandler::EVtDtmfStateSending;
+ TRAP( aError, DoSendAndActivateStateL( tone, nextState ) );
+ iTones->Delete( index );
+ }
+
+ if ( aError != KErrNone )
+ {
+ __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered.failed=%d", aError )
+ // if failed clear DTMF buffer and go to dtmf idle state
+ iTones->Reset();
+ iDtmfHandler.ActivateState( MVtEngDtmfHandler::EVtDtmfStateIdle );
+ }
+ __VTPRINTEXIT( "DtmfStateBuffered.DtmfSendCompleteL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::CVtEngDtmfBuffered
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfBuffered::CVtEngDtmfBuffered(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ : CVtEngDtmfState( aDtmfHandler, aH324Config)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::ConstructL()
+ {
+ iTones = new ( ELeave )
+ CArrayFixFlat<TVtEngDtmfTone>( KVtEngDtmfToneBufferSize );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfIdle.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006 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: Idle state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngDtmfState.h"
+#include "VtEngPanic.h"
+#include "MVtEngDtmfHandler.h"
+#include <cvtlogger.h>
+#include <mvtprotocolhandler.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfIdle::NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ {
+ CVtEngDtmfIdle* self = new ( ELeave )
+ CVtEngDtmfIdle( aDtmfHandler, aH324Config );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::~CVtEngDtmfIdle
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfIdle::~CVtEngDtmfIdle()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::SendDtmfL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfIdle::SendDtmfL( const TVtEngDtmfTone& aTone )
+ {
+ __VTPRINTENTER( "DtmfStateIdle.Send" )
+ DoSendAndActivateStateL( aTone, MVtEngDtmfHandler::EVtDtmfStateSending );
+ __VTPRINTEXIT( "DtmfStateIdle.Send" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::DtmfSendCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfIdle::DtmfSendCompleteL( TInt /*aError*/ )
+ {
+ __VTPRINT( DEBUG_MEDIA , "DtmfStateIdle.SendComplete" )
+ // Do nothing (should be never called since state is always
+ // "sending" or "buffered" when sending is completed).
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::CVtEngDtmfIdle
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfIdle::CVtEngDtmfIdle(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ : CVtEngDtmfState( aDtmfHandler, aH324Config )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfSending.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 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: Sending state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngDtmfState.h"
+#include "VtEngPanic.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfSending::NewL(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ {
+ CVtEngDtmfState* self = new ( ELeave )
+ CVtEngDtmfSending( aDtmfHandler, aH324Config );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::~CVtEngDtmfSending
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfSending::~CVtEngDtmfSending()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::SendDtmfL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfSending::SendDtmfL( const TVtEngDtmfTone& aTone )
+ {
+ __VTPRINTENTER( "DtmfStateSending.Send" )
+ CVtEngDtmfState& state = iDtmfHandler.ActivateState(
+ MVtEngDtmfHandler::EVtDtmfStateBuffered );
+ // let buffered state handle this
+ state.SendDtmfL( aTone );
+ __VTPRINTEXIT( "DtmfStateSending.Send" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::DtmfSendCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfSending::DtmfSendCompleteL( TInt aError )
+ {
+ __VTPRINTENTER( "DtmfStateSending.SendComplete" )
+ CVtEngDtmfState::DtmfSendCompleteL( aError );
+ // sending complete, change state
+ iDtmfHandler.ActivateState( MVtEngDtmfHandler::EVtDtmfStateIdle );
+ __VTPRINTEXIT( "DtmfStateSending.SendComplete" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::CVtEngDtmfSending
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfSending::CVtEngDtmfSending(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config )
+ : CVtEngDtmfState( aDtmfHandler, aH324Config )
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfState.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 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: Base state class of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngDtmfState.h"
+#include "MVtEngDtmfHandler.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::CVtEngDtmfState
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState::CVtEngDtmfState(
+ MVtEngDtmfHandler& aDtmfHandler,
+ MVtH324ConfigCommand& aH324Config ) :
+ iDtmfHandler( aDtmfHandler ),
+ iH324Config( aH324Config )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::DtmfSendCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfState::DtmfSendCompleteL( TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "DtmfState.DtmfSendCompleteL" )
+ iDtmfHandler.ReleaseProtoDtmf();
+ __VTPRINTEXIT( "DtmfState.DtmfSendCompleteL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::DoSendAndActivateStateL
+//
+// Requests new Protocol dtmf tone instance from the DTMF handler, sends it and
+// changes state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfState::DoSendAndActivateStateL(
+ const TVtEngDtmfTone& aDtmf,
+ MVtEngDtmfHandler::TVtEngDtmfState aNewState )
+ {
+ __VTPRINTENTER( "DtmfState.DoSendAndActivateStateL" )
+ MVTUserInput& protoDtmf = iDtmfHandler.ReserveProtoDtmfL( aDtmf );
+ iDtmfHandler.StoreCommandId( iH324Config.SendUserInputMessageL( protoDtmf ));
+ iDtmfHandler.ActivateState( aNewState );
+ __VTPRINTEXIT( "DtmfState.DoSendAndActivateStateL" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateAlerting.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2004-2006 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: Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateAlerting.h"
+#include <cvtlogger.h>
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngAudioHandler.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::CVtEngStateAlerting
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateAlerting::CVtEngStateAlerting(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateAlerting::~CVtEngStateAlerting()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~StateAlrt")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::UpdateL
+// Updates state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateAlerting::UpdateL()
+ {
+ __VTPRINTENTER( "StateAlert.Update" )
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ CVtEngStateBase* newState = NULL;
+ if ( bearerstate == MVtCtlCallControl::EIdle ||
+ bearerstate == MVtCtlCallControl::EDisconnecting )
+ {
+ newState = NewStateL( MVtEngSessionInfo::EIdle );
+ }
+ else
+ {
+ newState = NegotiatingOrConnectedStateL(); // or null
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateAlert.Update")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::OpenL
+// State transition to alerting state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateAlerting::DoOpenL()
+ {
+ __VTPRINTENTER( "StateAlert.Open" )
+ NotifyStateChange( MVtEngSessionInfo::ERemoteAlerting );
+
+ // Instantiate temporary devsound for audio routing
+ AudioHandler().SetRoutingEnablerL( ETrue );
+ __VTPRINTEXIT( "StateAlert.Open" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::ValidateCommand
+// Returns if a command is valid in idle state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateAlerting::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL |DEBUG_GEN, "StateAlert.Validate" )
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngInitializeEngineTest:
+ case KVtEngSetSource:
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareViewFinderDSA:
+ case KVtEngPrepareViewFinderDP:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateAlerting::State() const
+ {
+ return MVtEngSessionInfo::ERemoteAlerting;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateAlerting::HandleL(
+ CVtEngOperation& aOp )
+ {
+ TBool handled( CVtEngStateBase::HandleL( aOp ));
+ return handled;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateBase.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 2004-2006 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: Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateBase.h"
+#include "CVtEngOperation.h"
+#include "CVtEngHandlerContainer.h"
+#include "TVtEngOperationUtils.h"
+#include "CVtEngStateInitializing.h"
+#include "CVtEngStateAlerting.h"
+#include "CVtEngStateRinging.h"
+#include "CVtEngStateConnected.h"
+#include "CVtEngStateClearing.h"
+#include "CVtEngStateOpen.h"
+#include "CVtEngStateNegotiating.h"
+#include "CVtEngStateIdle.h"
+#include "CVtEngSettings.h"
+#include "MVtEngSessionInfo.h"
+#include "VtEngUtils.h"
+#include "VtEngPanic.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::CVtEngStateBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase::CVtEngStateBase(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : iStateManager( aStateManager ),
+ iEventManager( aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateBase::~CVtEngStateBase()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::OpenL
+// Changes state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::OpenL( CVtEngStateBase* aOldState )
+ {
+ __VTPRINTENTER( "StateBase.Open" )
+ __VTPRINT( DEBUG_GEN, "StateBase. **** State Change ****" )
+ iStateManager.SetState( *this );
+ if ( aOldState )
+ {
+ aOldState->Close();
+ }
+ // call derived class open.
+ DoOpenL();
+ __VTPRINTEXIT( "StateBase.Open" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::Close
+// Closes state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::Close()
+ {
+ delete this;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SaveToSettingsL
+//
+// Saves configuration to settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::SaveToSettingsL( CVtEngOperation& aOp )
+ {
+ const TVtEngCommandId command( aOp.Command() );
+
+ if ( command == KVtEngSetAudioVolume )
+ {
+ MVtEngAudio::TVtEngOutputVolume volume;
+ TVtEngOpParamUtil<MVtEngAudio::TVtEngOutputVolume>::Set( volume, aOp );
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.SetVolume( volume.iHandsetVolume, volume.iHandsfreeVolume, ETrue );
+ settings.SetVolume( volume.iHandsetVolume, volume.iHandsfreeVolume, EFalse );
+ }
+ }
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::NotifyStateChangeL
+// Notifies state change to event manager.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::NotifyStateChange(
+ MVtEngSessionInfo::TSessionState /*aNewState*/ )
+ {
+ iEventManager.SessionStateChanged( );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SetVideoEnabled
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::SetVideoEnabled( TBool aEnabled )
+ {
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.SetVideoEnabled( aEnabled );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateBase::HandleL( CVtEngOperation& aOp )
+ {
+ __VTPRINTENTER( "StateBase.Handle" )
+ __VTPRINT2( DEBUG_GEN, "StateBase.Handle cmd=%d", aOp.Command() )
+ TBool handled( EFalse );
+ switch ( aOp.Command() )
+ {
+ case KVtEngSetAudioRouting:
+ // Change audio routing
+ AudioHandler().HandleL( aOp );
+ break;
+
+ case KVtEngSetAudioVolume:
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+ // Change audio volume
+ MediaHandler().HandleL( aOp );
+ break;
+ case KVtEngTerminateSession:
+ default:
+ break;
+ }
+ __VTPRINTEXITR( "StateBase.Handle handled=%d", handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SessionHandler
+// Returns session handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler& CVtEngStateBase::SessionHandler()
+ {
+ MVtEngSessionInfo& msession = iStateManager.Handlers().Session();
+ CVtEngSessionHandler& handler =
+ static_cast<CVtEngSessionHandler&>( msession );
+ return handler;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::MediaHandler
+// Returns media handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler& CVtEngStateBase::MediaHandler()
+ {
+ MVtEngMedia& msession = iStateManager.Handlers().Media();
+ CVtEngMediaHandler& handler =
+ static_cast<CVtEngMediaHandler&>( msession );
+ return handler;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::AudioHandler
+// Returns audio handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler& CVtEngStateBase::AudioHandler()
+ {
+ MVtEngAudio& maudio = iStateManager.Handlers().Audio();
+ CVtEngAudioHandler& handler =
+ static_cast<CVtEngAudioHandler&>( maudio );
+ return handler;
+ }
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SessionHandler
+// Returns session handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase* CVtEngStateBase::NewStateL(
+ const MVtEngSessionInfo::TSessionState aState )
+ {
+ CVtEngStateBase* newState = NULL;
+ switch ( aState )
+ {
+ case MVtEngSessionInfo::EIdle:
+ newState = new ( ELeave )
+ CVtEngStateIdle( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::EInitializing:
+ newState = new ( ELeave )
+ CVtEngStateInitializing( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::ERemoteAlerting:
+ newState = new ( ELeave )
+ CVtEngStateAlerting( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::EReceiving:
+ newState = new ( ELeave )
+ CVtEngStateRinging( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::EConnected:
+ newState = new ( ELeave )
+ CVtEngStateConnected( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::ENegotiating:
+ newState = new ( ELeave )
+ CVtEngStateNegotiating( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::EOpen:
+ newState = new ( ELeave )
+ CVtEngStateOpen( iStateManager, iEventManager );
+ break;
+ case MVtEngSessionInfo::EClearing:
+ newState = new ( ELeave )
+ CVtEngStateClearing( iStateManager, iEventManager );
+ break;
+ default:
+ Panic( EVtEngPanicInvalidSessionState );
+ break;
+ }
+ return newState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::NegotiatingOrConnectedStateL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase* CVtEngStateBase::NegotiatingOrConnectedStateL(
+ TBool aAcceptOnlyNegotiating )
+ {
+ __VTPRINTENTER( "StateBase.NegOrCon" )
+ __VTPRINT2( DEBUG_GEN, "StateBase.NegOrCon %d", aAcceptOnlyNegotiating)
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ CVtEngStateBase* newState = NULL;
+ if ( bearerstate == MVtCtlCallControl::EConnected )
+ {
+ const MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+ const CVtEngSettings& settings = CVtEngUtility::Settings();
+ const TBool readyForConnect = settings.Config().iReadyForConnect;
+
+ __VTPRINT3( DEBUG_GEN, "StateBase.NegOrCon readyForConnect:%d, state:%d", readyForConnect, state)
+ __VTPRINT2( DEBUG_GEN, "StateBase.NegOrCon iIsDataportLoaned:%d", settings.Config().iIsDataportLoaned)
+
+ if ( readyForConnect && state == MVtProtocolCommand::ESetup && settings.Config().iIsDataportLoaned )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "StateBase.NegOrCon ready & ESetup")
+ const TInt res( MediaHandler().Connect() );
+ if ( res == KErrNotReady )
+ {
+ // Cannot be done yet, need to wait for an operation
+ // to complete.
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "StateBase.NegOrCon not ready" )
+ }
+ else if ( res != KErrNone )
+ {
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "StateBase.NegOrCon fail")
+ iEventManager.NotifyEvent( KVtEngNegotiationProblem );
+ }
+ else
+ {
+ // change to negotiating state
+ newState = NewStateL( MVtEngSessionInfo::ENegotiating );
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "StateBase.NegOrCon-->negotiating")
+ }
+ }
+ else if ( !aAcceptOnlyNegotiating )
+ {
+ newState = NewStateL( MVtEngSessionInfo::EConnected );
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+ "StateBase.NegOrCon-->connected")
+ }
+ }
+ __VTPRINTEXIT( "StateBase.NegOrCon" )
+ return newState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::TerminateSessionL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::TerminateSessionL( CVtEngOperation& aOp )
+ {
+ // State transition to "clearing state" initiates disconnect on protocol.
+ CVtEngStateBase* newState = NewStateL( MVtEngSessionInfo::EClearing );
+ // just store aOp for callback to UI
+ CVtEngMediaHandler& mHandler = MediaHandler();
+ CleanupStack::PushL( newState );
+ newState->OpenL( this );
+ CleanupStack::Pop(); // newState
+ mHandler.HandleL( aOp );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::ValidateCommand
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateBase::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateBase.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ // Flow through, ok to execute ==> check the state possibilities
+ case KVtEngInitializeEngine:
+ case KVtEngInitializeEngineDiag:
+ case KVtEngInitializeEngineTest:
+ case KVtEngResetEngine:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngPrepareRemoteRender:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngPrepareViewFinder:
+ // Media
+ case KVtEngSetUIForeground:
+ okToPerform = ETrue;
+ break;
+ case KVtEngPrepareCamera:
+ case KVtEngSetSource:
+ case KVtEngSetZoomStep:
+ case KVtEngStartViewFinder:
+ case KVtEngFreeze:
+ case KVtEngUnfreeze:
+ case KVtEngSetVideoQuality:
+ case KVtEngHandleLayoutChange:
+
+ // Media object sharing
+ case KVtEngInitializeShareImage:
+ case KVtEngStartShareImage:
+ case KVtEngStopShareImage:
+
+ case KVtEngMuteOutgoingAudio:
+ case KVtEngUnmuteOutgoingAudio:
+ case KVtEngSetAudioRouting:
+ case KVtEngSetAudioVolume:
+ case KVtEngIncreaseAudioVolume:
+ case KVtEngDecreaseAudioVolume:
+ case KVtEngRequestLastRemoteFrame:
+
+ okToPerform =
+ ( MediaHandler().ValidateCommand( aCommandId ) == KErrNone );
+ break;
+ default:
+ case KVtEngTerminateSession: // valid only in open state
+ break;
+ }
+ return okToPerform;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateClearing.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2006 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: Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateClearing.h"
+#include <cvtlogger.h>
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::CVtEngStateClearing
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateClearing::CVtEngStateClearing(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateClearing::~CVtEngStateClearing()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~StateClr")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::UpdateL
+// Updates state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateClearing::UpdateL()
+ {
+ __VTPRINTENTER( "StateClr.Update" )
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ const MVtProtocolCommand::TVtProtocolState protostate( MediaHandler().ProtoState() );
+
+ __VTPRINT2( DEBUG_GEN, "StateClr.bearerState=%d", bearerstate )
+ __VTPRINT2( DEBUG_GEN, "StateClr.protoState=%d", protostate )
+
+ if ( bearerstate == MVtCtlCallControl::EIdle ||
+ bearerstate == MVtCtlCallControl::EDisconnecting ||
+ bearerstate == MVtCtlCallControl::EUnknown ||
+ protostate == MVtProtocolCommand::EIdle ||
+ protostate == MVtProtocolCommand::ESetup )
+ {
+ CVtEngStateBase* idleState = NewStateL( MVtEngSessionInfo::EIdle );
+ idleState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateClr.Update" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::OpenL
+// State transition to clearing state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateClearing::DoOpenL()
+ {
+ __VTPRINTENTER( "StateClr.Open")
+
+ // Do disconnect on Protocol, it is possible that disconnect is already
+ // ongoing and we get error and that's fine.
+ TInt err( MediaHandler().Disconnect() );
+ if ( err != KErrNone && err != KErrAlreadyExists )
+ {
+ __VTPRINT2( DEBUG_GEN, "StateClr.OpenL disconnect fail=%d", err)
+ }
+ // Reset settings
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.ResetAll();
+ NotifyStateChange( MVtEngSessionInfo::EClearing );
+ __VTPRINTEXIT( "StateClr.Open")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::ValidateCommand
+// Returns if a command is valid in idle state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateClearing::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngTerminateSession:
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateClearing::State() const
+ {
+ return MVtEngSessionInfo::EClearing;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateClearing::HandleL( CVtEngOperation& aOp )
+ {
+ TBool handled( CVtEngStateBase::HandleL( aOp ));
+ return handled;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateConnected.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2004-2006 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: Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateConnected.h"
+#include <cvtlogger.h>
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::CVtEngStateConnected
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateConnected::CVtEngStateConnected(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateConnected::~CVtEngStateConnected()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~StateConnected")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::UpdateL
+// Updates state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateConnected::UpdateL()
+ {
+ __VTPRINTENTER( "StateConnected.Update")
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+
+
+ CVtEngStateBase* newState = NULL;
+ if ( bearerstate != MVtCtlCallControl::EConnected )
+ {
+ // we've lost bearer connection, go to idle
+ newState = NewStateL( MVtEngSessionInfo::EIdle );
+ }
+ else if ( state == MVtProtocolCommand::EConnected )
+ {
+ // protocol is open (should always go through neg.state but just in case)
+ // change to open state
+ newState = NewStateL( MVtEngSessionInfo::EOpen );
+ }
+ else if ( state == MVtProtocolCommand::EDisconnecting ||
+ state == MVtProtocolCommand::EResetting )
+ {
+ // change to clearing state
+ newState = NewStateL( MVtEngSessionInfo::EClearing );
+ }
+ else
+ {
+ // protocol is set up so connect now if ready
+ newState = NegotiatingOrConnectedStateL( ETrue );
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateConnected.Update")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::DoOpenL
+// State transition to connected state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateConnected::DoOpenL()
+ {
+ __VTPRINTENTER( "StateConnected.Open")
+ NotifyStateChange( MVtEngSessionInfo::EConnected );
+ //start monitor incoming call
+ __VTPRINTEXIT( "StateConnected.Open")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::ValidateCommand
+// Returns if a command is valid in idle state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateConnected::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL |DEBUG_GEN, "StateConnected.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngSetSource:
+ case KVtEngPrepareViewFinder:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateConnected::State() const
+ {
+ return MVtEngSessionInfo::EConnected;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateConnected::HandleL( CVtEngOperation& aOp )
+ {
+ TBool handled( CVtEngStateBase::HandleL( aOp ));
+ return handled;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateIdle.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2004-2006 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: Idle state
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateIdle.h"
+#include <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::CVtEngStateIdle
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateIdle::CVtEngStateIdle(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateIdle::~CVtEngStateIdle()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~Stateidl")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateIdle::UpdateL()
+ {
+ __VTPRINTENTER( "StateIdle.Update")
+
+ const MVtCtlCallControl::TVtCtlState state = SessionHandler().RealState();
+ CVtEngStateBase* newState = NULL;
+
+ if( iStateManager.PreviousSessionState() == MVtEngSessionInfo::EUnknown )
+ {
+ switch ( state )
+ {
+ case MVtCtlCallControl::EInitializing:
+ newState = NewStateL( MVtEngSessionInfo::EInitializing );
+ break;
+ case MVtCtlCallControl::EAlerting:
+ newState = NewStateL( MVtEngSessionInfo::ERemoteAlerting );
+ break;
+ case MVtCtlCallControl::ERinging:
+ newState = NewStateL( MVtEngSessionInfo::EReceiving );
+ break;
+ case MVtCtlCallControl::EConnected:
+ newState = NegotiatingOrConnectedStateL();
+ break;
+ default:
+ break;
+ }
+ if ( newState )
+ {
+ CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+
+ // Notify UI about initial autolock state. UI must have this
+ // information early enough to deduce if it is allowed to
+ // go to foreground.
+ utils->NotifyLockState();
+ utils->StartSATListenL();
+ newState->OpenL( this );
+ }
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN, "StateIdle.Update wrong previous state, ignoring")
+ }
+ __VTPRINTEXIT( "StateIdle.Update")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::OpenL
+// State transition to idle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateIdle::DoOpenL()
+ {
+ __VTPRINTENTER( "StateIdle.Open")
+ // Reset settings
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ settings.ResetAll();
+
+ NotifyStateChange( MVtEngSessionInfo::EIdle );
+ __VTPRINTEXIT( "StateIdle.Open")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::ValidateCommand
+// Returns if a command is valid in idle state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateIdle::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateIdle.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRender:
+ case KVtEngPrepareRemoteRenderNGA:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateIdle::State() const
+ {
+ return MVtEngSessionInfo::EIdle;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateInitializing.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2006 - 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: Initializing state
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateInitializing.h"
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngAudioHandler.h"
+#include "CVtEngInitializer.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::CVtEngStateInitializing
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateInitializing::CVtEngStateInitializing(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateInitializing::~CVtEngStateInitializing()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~Stateini")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateInitializing::UpdateL()
+ {
+ __VTPRINTENTER( "StateInit.Update")
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+
+ CVtEngStateBase* newState = NULL;
+ if ( bearerstate == MVtCtlCallControl::EIdle ||
+ bearerstate == MVtCtlCallControl::EDisconnecting )
+ {
+ newState = NewStateL( MVtEngSessionInfo::EClearing );
+ // Initializer may be waiting for dataport. In that case MediaHandler
+ // has already signaled reqStatus of CVtEngInitializer which must
+ // complete KVtEngInitializeEngine command in order uninitialisation to
+ // finish properly. This scenario may happen in 1st call since phone
+ // boot, i.e. when dataport name is not already published.
+ CVtEngUtility::EngineUtils()->Initializer().CancelInit();
+ }
+ else if ( bearerstate == MVtCtlCallControl::EAlerting )
+ {
+ newState = NewStateL( MVtEngSessionInfo::ERemoteAlerting );
+ }
+ else
+ {
+ newState = NegotiatingOrConnectedStateL(); // or null
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateInit.Update")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::OpenL
+// State transition to initializing.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateInitializing::DoOpenL()
+ {
+ __VTPRINTENTER( "StateInit.Open" )
+ NotifyStateChange( MVtEngSessionInfo::EInitializing );
+
+ // Instantiate temporary devsound for audio routing
+ AudioHandler().SetRoutingEnablerL( ETrue );
+ __VTPRINTEXIT( "StateInit.Open" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::ValidateCommand
+// Returns if a command is valid in initializing state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateInitializing::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateInit.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngSetSource:
+ case KVtEngStartViewFinder:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateInitializing::State() const
+ {
+ return MVtEngSessionInfo::EInitializing;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateInitializing::HandleL( CVtEngOperation& aOp )
+ {
+ TBool handled( CVtEngStateBase::HandleL( aOp ));
+ if ( !handled )
+ {
+ switch ( aOp.Command() )
+ {
+ case KVtEngStartRenderRemote:
+ SetVideoEnabled( ETrue );
+ handled = ETrue;
+ break;
+ }
+ }
+ return handled;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateManager.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2006 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: Implementation of state manager for session and audio routing states.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CVtEngStateManager.h"
+#include "CVtEngHandlerContainer.h"
+#include "CVtEngStateBase.h"
+#include "CVtEngStateIdle.h"
+#include "CVtEngStateOpen.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngStateConnected.h"
+#include "CVtEngOperation.h"
+#include "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::CVtEngStateManager
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager::CVtEngStateManager(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngEventManager& aEventManager ) :
+ iPreviousSessionState( MVtEngSessionInfo::EUnknown ),
+ iHandlers( aHandlers ),
+ iEventManager( aEventManager )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::ConstructL()
+ {
+ iSessionState = new ( ELeave )
+ CVtEngStateIdle( *this, iEventManager );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager* CVtEngStateManager::NewL(
+ CVtEngHandlerContainer& aHandlers,
+ CVtEngEventManager& aEventManager )
+ {
+ __VTPRINT( DEBUG_GEN , "CVtEngStateManager::NewL" )
+ CVtEngStateManager* self = new ( ELeave )
+ CVtEngStateManager( aHandlers, aEventManager );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// Destructor
+CVtEngStateManager::~CVtEngStateManager()
+ {
+ __VTPRINT( DEBUG_GEN , "CVtEngStateManager::~" )
+ delete iSessionState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::UpdateL
+// Updates current state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::Update( )
+ {
+ if ( iSessionState )
+ {
+ TRAPD(err,iSessionState->UpdateL());
+ if ( err != KErrNone )
+ {
+ __VTPRINT2( DEBUG_GEN, "SM.update fail=%d", err )
+ iEventManager.NotifyEvent( err );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::IsCommandPossible
+// Checks if a command is possible in current state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateManager::IsCommandPossible(
+ const TVtEngCommandId aCommandId ) const
+ {
+ if ( iSessionState )
+ {
+ return iSessionState->ValidateCommand( aCommandId );
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::SetState
+// Sets new session state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::SetState( CVtEngStateBase& aNewState )
+ {
+ if( iSessionState )
+ {
+ iPreviousSessionState = iSessionState->State();
+ }
+ iSessionState = &aNewState;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::HandleOperationL
+//
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateManager::HandleOperationL( CVtEngOperation& aOp )
+ {
+ __VTPRINT2( DEBUG_GEN, "StateMgr.HandleOp=%d", aOp.Command() )
+ TInt handled( EFalse );
+ if ( iSessionState )
+ {
+ handled = iSessionState->HandleL( aOp );
+ }
+ __VTPRINT2( DEBUG_GEN | DEBUG_RETURN, "StateMgr.HandleOp handled=%d",
+ handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::SessionState
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateManager::SessionState() const
+ {
+ if ( iSessionState )
+ {
+ return iSessionState->State();
+ }
+ return MVtEngSessionInfo::EUnknown;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::PreviousSessionState
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateManager::PreviousSessionState() const
+ {
+ return iPreviousSessionState;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateNegotiating.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2004-2006 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: Negotiating state
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateNegotiating.h"
+#include <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::CVtEngStateNegotiating
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateNegotiating::CVtEngStateNegotiating(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateNegotiating::~CVtEngStateNegotiating()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~Stateneg")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateNegotiating::UpdateL()
+ {
+ __VTPRINTENTER( "StateNegotiate.Update" )
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ const MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+ CVtEngStateBase* newState = NULL;
+
+ if ( bearerstate != MVtCtlCallControl::EConnected ||
+ state == MVtProtocolCommand::ESetup ) // <- connect failed
+ {
+ newState = NewStateL( MVtEngSessionInfo::EClearing );
+ }
+ else if ( state == MVtProtocolCommand::EConnected )
+ {
+ // change to open state
+ newState = NewStateL( MVtEngSessionInfo::EOpen );
+ }
+ else if ( state == MVtProtocolCommand::ESetup )
+ {
+ // should not usually happen unless connect fails
+ newState = NewStateL( MVtEngSessionInfo::EConnected );
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateNegotiate.Update" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::OpenL
+// State transition to negotiating.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateNegotiating::DoOpenL( )
+ {
+ __VTPRINTENTER( "StateNegotiate.Open" )
+ NotifyStateChange( MVtEngSessionInfo::ENegotiating);
+ __VTPRINTEXIT( "StateNegotiate.Open" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::ValidateCommand
+// Returns if a command is valid in negotiating state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateNegotiating::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateNegotiate.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngPrepareViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRender:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngStartRenderRemote: // cached to settings
+ case KVtEngSetSource:
+ case KVtEngPrepareCamera:
+ case KVtEngSetZoomStep:
+ case KVtEngStartViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngTerminateSession:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateNegotiating::State() const
+ {
+ return MVtEngSessionInfo::ENegotiating;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateNegotiating::HandleL( CVtEngOperation& aOp )
+ {
+ __VTPRINTENTER( "StateNegotiate.HandleL" )
+ TBool handled( CVtEngStateBase::HandleL( aOp ) );
+ if ( !handled )
+ {
+ switch ( aOp.Command() )
+ {
+ case KVtEngStartRenderRemote:
+ SetVideoEnabled( ETrue );
+ handled = ETrue;
+ break;
+ case KVtEngTerminateSession:
+ TerminateSessionL( aOp );
+ break;
+ }
+ }
+ __VTPRINTEXITR( "StateNegotiate.HandleL %d", handled )
+ return handled;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateOpen.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2006 - 2007 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: Open state handle interfaces implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateOpen.h"
+#include "CVtEngOperation.h"
+#include "CVtEngAudioHandler.h"
+#include <cvtlogger.h>
+
+#include "CVtEngExtensions.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::CVtEngStateOpen
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateOpen::CVtEngStateOpen(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateOpen::~CVtEngStateOpen()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~StateOpen")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::UpdateL()
+ {
+ __VTPRINTENTER( "StateOpen.Update" )
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+
+ const MVtProtocolCommand::TVtProtocolState protoState( MediaHandler().ProtoState() );
+ const TBool bearerIdle = ( bearerstate == MVtCtlCallControl::EIdle ||
+ bearerstate == MVtCtlCallControl::EUnknown );
+ const TBool bearerDisconnecting =
+ ( bearerstate == MVtCtlCallControl::EDisconnecting );
+
+ CVtEngStateBase* newState = NULL;
+
+ if ( protoState == MVtProtocolCommand::ESetup ||
+ protoState == MVtProtocolCommand::EIdle ||
+ bearerIdle )
+ {
+ newState = NewStateL( MVtEngSessionInfo::EIdle );
+ }
+ else if ( bearerDisconnecting || protoState == MVtProtocolCommand::EDisconnecting )
+ {
+ newState = NewStateL( MVtEngSessionInfo::EClearing );
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateOpen.Update" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::OpenL
+// State transition to open.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::DoOpenL()
+ {
+ __VTPRINTENTER( "StateOpen.Open" )
+
+ // set audio routing (and ouput volume)
+ RouteAudioL( NULL );
+
+ NotifyStateChange( MVtEngSessionInfo::EOpen );
+ __VTPRINTEXIT( "StateOpen.Open" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::ValidateCommand
+// Returns if a command is valid in open state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateOpen::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateOpen.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngInitializeEngine: // temporary
+ case KVtEngPrepareCamera:
+ case KVtEngSetZoomStep:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngStopViewFinder:
+ case KVtEngStartRenderRemote:
+ case KVtEngStopRenderRemote:
+ case KVtEngPauseRenderRemote:
+ case KVtEngTerminateSession:
+ case KVtEngStartDtmfTone:
+ case KVtEngStopDtmfTone:
+ // Handling of different UIIs, support is there
+ case KVtEngSetUIIDtmfSupport:
+ case KVtEngSetUIIBasicStringSupport:
+ case KVtEngSetUIIIA5StringSupport:
+ case KVtEngSetUIIGeneralStringSupport:
+ case KVtEngSwitchToVoice:
+ okToPerform = ETrue;
+ break;
+
+ // Extension commands
+ case KVtEngSetContrast:
+ case KVtEngSetBrightness:
+ case KVtEngSetWhiteBalance:
+ case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+ case KVtEngStartRecord:
+ case KVtEngStopRecord:
+#endif // RD_VT_RTF
+ {
+ // Get extension handle from Utils
+ __VTPRINT(DEBUG_GEN, "StateOpen extension->ValidateCommand")
+ okToPerform = CVtEngUtility::Extensions()->ValidateCommand(
+ aCommandId );
+ break;
+ }
+
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateOpen::State() const
+ {
+ return MVtEngSessionInfo::EOpen;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateOpen::HandleL( CVtEngOperation& aOp )
+ {
+ __VTPRINTENTER( "StateOpen.HandleL" )
+ TBool handled( CVtEngStateBase::HandleL( aOp ) );
+ switch ( aOp.Command() )
+ {
+ case KVtEngTerminateSession:
+ TerminateSessionL( aOp );
+ handled = ETrue;
+ break;
+
+ case KVtEngSwitchToVoice:
+ {
+ CVtEngStateBase* newState =
+ NewStateL( MVtEngSessionInfo::EClearing );
+ CleanupStack::PushL( newState );
+ newState->OpenL( this );
+ CleanupStack::Pop();
+ // aOp is not passed to media handler because mediator command
+ // sender signals completion, see
+ // CVtEngMdtrCommandSender::HandleVtEventL
+ }
+ break;
+
+ // Extension commands
+ case KVtEngSetContrast:
+ case KVtEngSetBrightness:
+ case KVtEngSetWhiteBalance:
+ case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+ case KVtEngStartRecord:
+ case KVtEngStopRecord:
+#endif // RD_VT_RTF
+ CallExtensionL( &aOp);
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXITR( "StateOpen.HandleL %d", handled )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::RouteAudioL
+// Handles audio routing operation.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::RouteAudioL(
+ CVtEngOperation* aOp )
+ {
+ __VTPRINTENTER( "StateOpen.RouteAudioL" )
+ CVtEngSettings& settings = CVtEngUtility::Settings();
+ const CVtEngSettings::TVtEngVideoCallConfig& config = settings.Config();
+
+ CVtEngAudioHandler& audioHandler = AudioHandler();
+ MVtEngAudio::TAudioRoutingState routingState( MVtEngAudio::EAudioWiredHeadset );
+ audioHandler.GetRoutingState( routingState );
+
+ TBool routeAudio( ETrue );
+ TInt volume( config.iAudio.iVolume.iHandsfreeVolume );
+ switch ( routingState )
+ {
+ case MVtEngAudio::EAudioWiredHeadset:
+ routeAudio = EFalse;
+ // fall thru
+ case MVtEngAudio::EAudioHandset:
+ case MVtEngAudio::EAudioBT:
+ volume = config.iAudio.iVolume.iHandsetVolume;
+ break;
+ // use default values
+ case MVtEngAudio::EAudioLoudspeaker:
+ default:
+ break;
+ }
+ __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL,
+ "StateOpen.RouteAudioL route=%d,vol=%d", routeAudio,volume )
+ if ( aOp == NULL || ( aOp && routeAudio ) )
+ {
+ // set volume if state was changed (called from DoOpenL) or
+ // audio routing will be changed
+ __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "StateOpen.RouteAudioL SetVol" )
+ MediaHandler().SetVolume( volume );
+ }
+
+ // *** AUDIO && ( aOp != NULL ) ***
+ if ( routeAudio && ( aOp != NULL ) )
+ {
+ if ( aOp )
+ {
+ audioHandler.HandleL( *aOp );
+ }
+ }
+ __VTPRINTEXIT( "StateOpen.RouteAudioL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::CallExtensionL
+// Handles extension operations.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::CallExtensionL(
+ CVtEngOperation* aOp)
+ {
+ __VTPRINTENTER( "StateOpen.CallExtensionL" )
+ CVtEngUtility::Extensions()->OfferOperationL( aOp );
+ __VTPRINTEXIT( "StateOpen.CallExtensionL" )
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateRinging.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2004-2006 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: Ringing state handle interfaces implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "CVtEngStateRinging.h"
+#include "CVtEngInitializer.h"
+#include "VtEngUtils.h"
+#include <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::CVtEngStateRinging
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateRinging::CVtEngStateRinging(
+ CVtEngStateManager& aStateManager,
+ CVtEngEventManager& aEventManager )
+ : CVtEngStateBase( aStateManager, aEventManager )
+ {
+ }
+
+// Destructor
+CVtEngStateRinging::~CVtEngStateRinging()
+ {
+ __VTPRINT( DEBUG_DESTRUCT, "~StateRing")
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateRinging::UpdateL()
+ {
+ __VTPRINTENTER( "StateRing.Update" )
+ const MVtCtlCallControl::TVtCtlState bearerstate =
+ SessionHandler().RealState();
+ CVtEngStateBase* newState = NULL;
+ switch ( bearerstate )
+ {
+ case MVtCtlCallControl::EConnected:
+ newState = NegotiatingOrConnectedStateL();
+ break;
+ case MVtCtlCallControl::EDisconnecting:
+ case MVtCtlCallControl::EIdle:
+ newState = NewStateL( MVtEngSessionInfo::EIdle );
+ // Initializer may be waiting for dataport. In that case MediaHandler
+ // has already signaled reqStatus of CVtEngInitializer which must
+ // complete KVtEngInitializeEngine command in order uninitialisation to
+ // finish properly. This scenario may happen in 1st call since phone
+ // boot, i.e. when dataport name is not already published.
+ CVtEngUtility::EngineUtils()->Initializer().CancelInit();
+ break;
+ default:
+ break;
+ }
+ if ( newState )
+ {
+ newState->OpenL( this );
+ }
+ __VTPRINTEXIT( "StateRing.Update")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::OpenL
+// State transition to Ring.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateRinging::DoOpenL()
+ {
+ __VTPRINTENTER( "StateRing.Open")
+ NotifyStateChange( MVtEngSessionInfo::EReceiving );
+ __VTPRINTEXIT( "StateRing.Open")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::ValidateCommand
+// Returns if a command is valid in ringing state.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateRinging::ValidateCommand(
+ const TVtEngCommandId aCommandId )
+ {
+ __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "Statering.Validate")
+ TBool okToPerform( EFalse );
+ switch ( aCommandId )
+ {
+ case KVtEngSetSource:
+ case KVtEngPrepareViewFinder:
+ case KVtEngStartViewFinder:
+ case KVtEngPauseViewFinder:
+ case KVtEngPrepareRemoteRenderDSA:
+ case KVtEngPrepareRemoteRenderDP:
+ case KVtEngPrepareRemoteRender:
+ case KVtEngPrepareRemoteRenderNGA:
+ case KVtEngStartRenderRemote:
+ okToPerform = ETrue;
+ break;
+ default:
+ okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+ break;
+ }
+ return okToPerform;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::State
+// Returns session state.
+//
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateRinging::State() const
+ {
+ return MVtEngSessionInfo::EReceiving;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/bwins/VIDEOTELENGU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+ ??1CVtEngModel@@UAE@XZ @ 1 NONAME ; CVtEngModel::~CVtEngModel(void)
+ ?Audio@CVtEngModel@@QBEAAVMVtEngAudio@@XZ @ 2 NONAME ; class MVtEngAudio & CVtEngModel::Audio(void) const
+ ?CommandHandler@CVtEngModel@@QBEAAVMVtEngCommandHandler@@XZ @ 3 NONAME ; class MVtEngCommandHandler & CVtEngModel::CommandHandler(void) const
+ ?Extension@CVtEngModel@@QAEPAXABVTUid@@@Z @ 4 NONAME ; void * CVtEngModel::Extension(class TUid const &)
+ ?Media@CVtEngModel@@QBEAAVMVtEngMedia@@XZ @ 5 NONAME ; class MVtEngMedia & CVtEngModel::Media(void) const
+ ?NewL@CVtEngModel@@SAPAV1@AAVMVtEngEventObserver@@AAVMVtEngCommandObserver@@@Z @ 6 NONAME ; class CVtEngModel * CVtEngModel::NewL(class MVtEngEventObserver &, class MVtEngCommandObserver &)
+ ?Session@CVtEngModel@@QBEAAVMVtEngSessionInfo@@XZ @ 7 NONAME ; class MVtEngSessionInfo & CVtEngModel::Session(void) const
+
Binary file vtengines/videoteleng/data/videoteleng_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/data/videoteleng_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videoteleng"}, (0x101F867F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videoteleng.dll"
+""-"z:\sys\bin\cscallctrl.dll"
+""-"z:\sys\bin\vtlogger.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,35 @@
+;
+; Copyright (c) 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:
+;
+
+; vtmediatorplugin.pkg
+;
+; Languages
+&EN
+
+;Header
+#{"vtmediatorplugin patch"},(0x2001599F),10,1,0,TYPE=PU
+
+; localized vendor name
+%{"Nokia"}
+
+; unique vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\udeb\vtmediatorplugin.dll"-"!:\sys\bin\vtmediatorplugin.dll"
+"\epoc32\data\z\resource\plugins\vtmediatorplugin.rsc"-"!:\sys\bin\vtmediatorplugin.rsc"
+
+
+; End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin.rss Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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: Resource file for VT Mediator plugin.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+// n/a
+
+// INCLUDES
+#include <registryinfov2.rh>
+#include <MediatorUids.hrh>
+
+
+// -----------------------------------------------------------------------------
+// theInfo
+// ECom interface definition for the VT Mediator plugin.
+// -----------------------------------------------------------------------------
+RESOURCE REGISTRY_INFO theInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ dll_uid = 0x2001599F;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KMediatorPluginInterfaceUid;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x200159A0;
+ version_no = 1;
+ display_name = "VT Mediator Plugin";
+ default_data = "Mediator";
+ opaque_data = "";
+ rom_only = 1;
+ }
+ };
+ }
+ };
+ }
+
Binary file vtengines/vtmediatorplugin/data/vtmediatorplugin.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,30 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"vtmediatorplugin"}, (0x2001599F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\vtmediatorplugin.dll"
+""-"z:\resource\plugins\vtmediatorplugin.r*"
Binary file vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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: Video Telephony Mediator Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/vtinternalmediatorapi.h |../../../inc/vtinternalmediatorapi.h
+
+../data/vtmediatorplugin_stub.sis /epoc32/data/z/system/install/vtmediatorplugin_stub.sis
+
+// Export IBY file
+../rom/vtmediatorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(vtmediatorplugin.iby)
+
+PRJ_MMPFILES
+vtmediatorplugin.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/group/vtmediatorplugin.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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: Video telephony mediator plugin
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh> // for APP_LAYER_SYSTEMINCLUDE macro
+
+// Build target
+
+CAPABILITY CAP_ECOM_PLUGIN
+TARGET vtmediatorplugin.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x2001599F
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../data
+START RESOURCE vtmediatorplugin.rss
+TARGET vtmediatorplugin.rsc
+END
+
+SOURCEPATH ../src
+SOURCE cvtmediatorplugin.cpp
+SOURCE vtmediatorpluginproxy.cpp
+
+USERINCLUDE ../inc
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/ecom
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+LIBRARY euser.lib
+LIBRARY ws32.lib
+LIBRARY ecom.lib
+LIBRARY mediatorclient.lib
+LIBRARY mediatorpluginbase.lib
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/inc/cvtmediatorplugin.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,347 @@
+/*
+* 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: Video Telephony mediator plugin header
+*
+*/
+
+
+#ifndef C_VTMEDIATORPLUGIN_H
+#define C_VTMEDIATORPLUGIN_H
+
+// INCLUDES
+#include <MediatorPluginBase.h>
+#include <MediatorNotifications.h>
+#include <MediatorEventConsumer.h>
+#include <MediatorEventProvider.h>
+#include <MediatorCommandResponder.h>
+#include <vtinternalmediatorapi.h>
+#include <mediatoreventsfromtelephonyapi.h>
+#include <MediatorCommandInitiator.h>
+#include <w32std.h>
+
+
+
+using namespace TelephonyMediator;
+using namespace MediatorService;
+
+class TelephonyMediator::TTelephonyCallDataParam;
+class CMediatorCommandInitiator;
+/**
+* Mediator plugin for CS video telephony. Fullfills responsibilities:
+* - launches Video Telephone application
+* - caches CLI and Dataport information for VT app for time between
+* the data is broadcasted to time VT is ready to receive it.
+* @since S60 5.0
+*/
+
+class CVtMediatorPlugin : public CMediatorPluginBase,
+ public MMediatorNotifications,
+ public MMediatorEventObserver,
+ public MMediatorCommandObserver,
+ public MMediatorCommandResponseObserver
+ {
+public:
+
+ static CMediatorPluginBase* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVtMediatorPlugin();
+
+public: // From Base class
+
+ virtual void StartL();
+
+public: // From MMediatorNotifications
+
+ /**
+ * Raises VT specific CLI/dataport event when event is registered by VT app,
+ * or when the information is available
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @param aEvents The list of events that have been registered.
+ * @return None.
+ */
+ virtual void MediatorEventsAddedL( TUid aDomain,
+ TUid aCategory,
+ const REventList& aEvents );
+
+ /**
+ * New commands have been registered. The commands can now be subscribed.
+ * The list can contain 1-n new commands into the category.
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @param aCommands List of commands that have been registered.
+ * @return None.
+ */
+ virtual void MediatorCommandsAddedL( TUid aDomain,
+ TUid aCategory,
+ const RCommandList& aCommands );
+
+ /**
+ * A category has been removed. All subscriptions are cancelled.
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @return None.
+ */
+ virtual void MediatorCategoryRemovedL( TUid aDomain, TUid aCategory );
+
+ /**
+ * List of events has been removed. All subscriptions are cancelled.
+ * List can contain 1-n events from the specified category.
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @param aEvents The list of events removed.
+ * @return None.
+ */
+ virtual void MediatorEventsRemovedL( TUid aDomain,
+ TUid aCategory,
+ const REventList& aEvents );
+
+ /**
+ * List of commands have been removed. All subscriptions are cancelled.
+ * List can contain 1-n commands from the specified category.
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @param aCommands The list of commands removed
+ * @return None.
+ */
+ virtual void MediatorCommandsRemovedL( TUid aDomain,
+ TUid aCategory,
+ const MediatorService::RCommandList& aCommands );
+
+public: // from MMediatorCommandObserver
+
+ /**
+ * @see MMediatorCommandObserver::MediatorCommandL
+ */
+ virtual void MediatorCommandL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TVersion aVersion,
+ const TDesC8& aData );
+
+ /**
+ * @see MMediatorCommandObserver::CancelMediatorCommand
+ */
+ virtual void CancelMediatorCommand( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId );
+
+public:// from MMediatorCommandResponseObserver
+ /**
+ * @see MMediatorCommandResponseObserver::CommandResponseL
+ */
+ virtual void CommandResponseL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TInt aStatus,
+ const TDesC8& aData );
+
+public: // from MMediatorEventObserver
+
+ /**
+ * A Mediator Service event.
+ *
+ * @since Series 60 3.1
+ * @param aDomain The identifier of the domain.
+ * @param aCategory The identifier of the category.
+ * @param aEventId The identifier of the event.
+ * @param aData The parameters of the event.
+ * @return None.
+ */
+ virtual void MediatorEventL( TUid aDomain,
+ TUid aCategory,
+ TInt aEventId,
+ const TDesC8& aData );
+
+public: // new
+ static TInt EventRaiserCallback( TAny* aAny );
+
+private: // constructors
+
+ CVtMediatorPlugin(); void ConstructL();
+
+ enum TInternalState {
+ /**
+ * Waiting for video call state to reach value that is suitable
+ * for launching Video Telephone application. In this state
+ * video call is not ongoing.
+ */
+ EWaitingAppLaunch,
+
+ /**
+ * Waiting for VT application's readiness to receive video call info
+ * events. In this state video call is ongoing and VT application
+ * is starting up.
+ */
+ EWaitingEventRegistration,
+
+ /**
+ * VT application is ready to receive video call info events.
+ */
+ EReady
+ };
+
+private: // new functions
+ void ChangeCallDataEventSubscriptionL(
+ const REventList& aEvents,
+ const TBool aEventRegistered );
+
+ void HandleVtCommandUnregistrationL();
+
+ void HandleVtCommandRegistrationL();
+
+ void LaunchVtAppL();
+
+ void SaveCallData( const TelephonyMediator::TTelephonyCallDataParam& aData, TVtVideoTelephonyCallInformation& iVtCallInfo);
+
+ void HandleDataportCommandL( const TDesC8& aData );
+
+ void ClearData(TVtVideoTelephonyCallInformation& aVtCallInfo, TCallState& aCallState);
+
+ void RegisterVtInternalEventL();
+ //test
+ void RegisterVtInternalEvent_2L();
+
+ void RegisterDataportCommandL();
+
+ void RaiseVtEventL();
+
+ /**
+ * Starts VT application if video call state transition is suitable.
+ */
+ void HandleCallStateChangeL( const TelephonyMediator::TTelephonyCallDataParam& aData );
+
+ TBool IsEnoughMemory();
+
+ void FreeRam();
+
+ void StopDeathActiveL();
+
+private:
+ // for detecting subscription to video call information from VT app.
+ CMediatorNotifications* iMediatorNotifications;
+
+ // for sending video call information events
+ CMediatorEventProvider* iEventProvider;
+
+ // for receiving CLI from Telephony
+ CMediatorEventConsumer* iEventConsumer;
+
+ // for responding to dataport/releasedataport command from Telephony
+ CMediatorCommandResponder* iCommandResponder;
+
+ // for issue command to vt app
+ CMediatorCommandInitiator* iCommandInitiator;
+
+ // supported mediator commands
+ MediatorService::RCommandList iCommandList;
+
+ // plugin's internal state
+ TInternalState iState;
+
+ // cached active video call state (from last call data event from Telephony)
+ TCallState iActiveVideoCallState;
+
+ TVtVideoTelephonyCallInformation iActiveVideoCallInfo;
+
+ // cached waiting video call state (from last call data event from Telephony)
+ TCallState iWaitingVideoCallState;
+
+ TVtVideoTelephonyCallInformation iWaitingVideoCallInfo;
+
+ // for raising event to VT asynchronously when it starts up
+ CAsyncCallBack* iCallBack;
+
+ class CAppDeathActive;
+ // Owned application death waiter.
+ CAppDeathActive* iAppDeathActive;
+
+ // Owned application thread.
+ RThread iAppThread;
+
+ // Application thread id.
+ TThreadId iAppThreadId;
+
+ /**
+ * Active object for waiting thread death.
+ *
+ * @since 2.6
+ * @lib videotelcomms.lib
+ */
+ NONSHARABLE_CLASS( CAppDeathActive ) : public CActive
+ {
+ public: // Constructors
+
+ /**
+ * Constructor.
+ */
+ CAppDeathActive( CVtMediatorPlugin& aMediatorPlugin,
+ RThread& aAppThread );
+
+ /**
+ * Destructor.
+ */
+ ~CAppDeathActive();
+
+ public: // New functions
+
+ /**
+ * Starts active object.
+ */
+ void Start();
+
+ public: // From base classes
+
+ /**
+ * @see CActive::RunL.
+ */
+ virtual void RunL();
+
+ /**
+ * @see CActive::DoCancel.
+ */
+ virtual void DoCancel();
+
+ /**
+ * @see CActive::RunError.
+ */
+ virtual TInt RunError( TInt aError );
+
+ private:
+
+ // Reference to starter.
+ CVtMediatorPlugin& iMediatorPlugin;
+
+ // Reference to thread.
+ RThread& iAppThread;
+
+ };
+
+ };
+
+#endif // C_VTMEDIATORPLUGIN_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/inc/vtinternalmediatorapi.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,100 @@
+/*
+* 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: Message Interface between VT mediator plugin and VT application
+*
+*/
+
+
+#ifndef VTINTERNALMEDIATORAPI_H
+#define VTINTERNALMEDIATORAPI_H
+
+// INCLUDES
+#include <e32base.h>
+
+/** The category UID for the messages in this header file.
+ * UID for category is not real UID, it just need to unique in Domain
+ */
+const TUid KCatVideotelInternalEvents = { 0x101F8690 };
+const TUid KCatVideotelInternalCommands = { 0x101F8691 };
+
+/** Version number of this API */
+const TInt KVideotelMdtrEventVersionMajor( 1 );
+const TInt KVideotelMdtrEventVersionMinor( 0 );
+const TInt KVideotelMdtrEventVersionBuild( 0 );
+
+/** Version number of this API */
+const TInt KVideotelMdtrCommandsVersionMajor( 1 );
+const TInt KVideotelMdtrCommandsVersionMinor( 0 );
+const TInt KVideotelMdtrCommandsVersionBuild( 0 );
+
+struct TVtVideoTelephonyCallInformation
+{
+ /** Max length of display text */
+ enum { TDisplayTextMaxLength = 100 };
+ enum { TPhoneNumMaxLength = 100 };
+
+ /** Display text type definition */
+ typedef TBuf<TDisplayTextMaxLength> TDisplayText;
+
+ /** Remote end CLI identifier (name/number/call id) */
+ TDisplayText iDisplayText;
+
+ /** Call id of the video call */
+ TInt iCallId;
+
+ /** Indicates voice call creation possibility to remote end (number is
+ * available)
+ */
+ TBool iVoiceCallPossible;
+
+ /** Dataport name or empty buffer if not specified in the event */
+ TName iDataport;
+
+ /**
+ * Defines which parts of the event date is valid
+ */
+ enum TMessageDataValidity {
+ EDisplayTextValid = 0x01,
+ EDataportValid = 0x02
+ };
+
+ /** Display text type definition */
+ typedef TBuf<TPhoneNumMaxLength> TPhoneNumText;
+
+ /** Remote end CLI identifier (name/number/call id) */
+ TPhoneNumText iPhoneNumText;
+
+ /** Event data validity */
+ TUint iEventDataValidity;
+
+};
+
+typedef TPckgBuf<TVtVideoTelephonyCallInformation> TVtMediatorInfoPackage;
+
+/** Events bwtween Video Telephony Mediator plugin and VT application. */
+enum TVideotelMdtrEvents
+ {
+ /**
+ * Event with TVtVideoTelephonyCallInformation as content
+ * Consuming event requires capability ECapabilityReadDeviceData
+ */
+ EVtMediatorEventVideoCallInformation = 0
+ };
+
+enum TVideotelMdtrCommands
+ {
+ EVtMediatorReleaseDataport = 0
+ };
+
+#endif // VTINTERNALMEDIATORAPI_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/rom/vtmediatorplugin.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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: IBY file
+ *
+*/
+
+#ifndef __VTMEDIATORPLUGIN_IBY__
+#define __VTMEDIATORPLUGIN_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+ECOM_PLUGIN( vtmediatorplugin.dll, vtmediatorplugin.rsc)
+#endif
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/src/cvtmediatorplugin.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1025 @@
+/*
+* 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: Video Telephony mediator plugin header
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <w32std.h>
+#include <apacmdln.h>
+#include <apaflrec.h>
+#include <apgcli.h>
+#include <MediatorDomainUIDs.h>
+#include <eikdll.h>
+#include <apgcli.h>
+#include <apgwgnam.h>
+#include <apgtask.h>
+#include <mediatorcommandstotelephonyapi.h>
+#include <videotelcontrolmediatorapi.h>
+#include <videoteltophonecommandsapi.h>
+#include "cvtmediatorplugin.h"
+
+
+// CONSTANTS
+#ifdef _DEBUG
+#define TRACE(x) RDebug::Print( _L(x) );
+#define TRACE2(x,y) RDebug::Print( _L(x),y );
+#else
+#define TRACE(x)
+#define TRACE2(x,y)
+#endif
+
+// This array's values are used in algorithm defining if video telephone
+// application should be started. Previous state value is substracted from new
+// state value and if result is greater than zero, app is started.
+// This tackles transitions where a state is for some reason skipped,
+// e.g. idle -> connected (dialling/ringing/answering states were not detected).
+// Negative value indicates call clearing.
+static const TInt KVtCallStateActionArray[] = {
+ 0, //ECallStateUnknown
+ 0, //ECallStateIdle
+ 1, // ECallStateDialling
+ 0, // ECallStateEmergencyDialling (not valid video call state)
+ 1, // ECallStateRinging
+ 1, // ECallStateConnecting
+ 1, // ECallStateConnected
+ 0, // ECallStateHangingUp
+ 0, // ECallStateHeld (not valid video call state)
+ 1, // ECallStateAnswering
+ 0, // ECallStateRejecting
+ 0 // ECallStateDisconnecting
+ };
+
+static const TInt KVtAppNotReady = 5000;
+
+static const TInt KVtEngMdtrCmdTimeout = 500000;
+
+static const TInt KVtInitCallId = -1000;
+
+// array granularity is 2 (use dataport, release dataport commands)
+static const TInt KVtMdtrCmdArrayGranularity = 2;
+
+const TUid KVtCmVideoTelUiUid = { 0x101F8681 };
+
+static const TInt KRamNeededForVideoCalls = 4000000;
+
+// VT application path
+_LIT( KVtCmVideoTelUiPath, "\\sys\\bin\\videotelui.exe" );
+
+
+// -----------------------------------------------------------------------------
+// CMediatorTestPlugin::CMediatorTestPlugin
+// First phase construction.
+// -----------------------------------------------------------------------------
+CVtMediatorPlugin::CVtMediatorPlugin() : CMediatorPluginBase(),
+ iCommandList( KVtMdtrCmdArrayGranularity ),
+ iState( EWaitingAppLaunch ),
+ iActiveVideoCallState( ECallStateUnknown ),
+ iWaitingVideoCallState( ECallStateUnknown )
+
+ {
+ ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+ ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+ }
+
+CMediatorPluginBase* CVtMediatorPlugin::NewL()
+ {
+ TRACE("CVtMediatorPlugin::NewL<")
+ CVtMediatorPlugin* self = new (ELeave) CVtMediatorPlugin;
+ TRACE("CVtMediatorPlugin::NewL>")
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+CVtMediatorPlugin::~CVtMediatorPlugin()
+ {
+ TRACE("CVtMediatorPlugin::~CVtMediatorPlugin<")
+
+ if ( iMediatorNotifications )
+ {
+ iMediatorNotifications->UnregisterNotificationObserver();
+ delete iMediatorNotifications;
+ }
+
+ // ignore error
+ if ( iEventConsumer )
+ {
+ iEventConsumer->UnsubscribeEvent(
+ KMediatorTelephonyDomain,
+ KCatEventsFromTelephony,
+ EPhoneEventCallData );
+ delete iEventConsumer;
+ }
+
+ // ignore error
+ if ( iEventProvider )
+ {
+ iEventProvider->UnregisterEvent(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalEvents,
+ EVtMediatorEventVideoCallInformation );
+ delete iEventProvider;
+ }
+
+ // ignore error
+ if ( iCommandResponder )
+ {
+ iCommandResponder->UnregisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ iCommandList );
+ iCommandList.Close();
+ delete iCommandResponder;
+ }
+
+ delete iCommandInitiator;
+
+
+ if( iAppDeathActive )
+ {
+ delete iAppDeathActive;
+ iAppThread.Close();
+ }
+
+ TRACE("CVtMediatorPlugin::~CVtMediatorPlugin>")
+ }
+
+// -----------------------------------------------------------------------------
+// StartL.
+// -----------------------------------------------------------------------------
+void CVtMediatorPlugin::StartL()
+ {
+ TRACE("CVtMediatorPlugin.StartL<")
+
+ // for monitoring VT app starting
+ iMediatorNotifications = CMediatorNotifications::NewL();
+ iMediatorNotifications->RegisterNotificationObserver( this );
+
+ // consumer for call data events
+ iEventConsumer = CMediatorEventConsumer::NewL( this );
+
+ iCommandInitiator = CMediatorCommandInitiator::NewL( this );
+
+
+ RegisterVtInternalEventL();
+
+ RegisterDataportCommandL();
+
+ TRACE("CVtMediatorPlugin.StartL>")
+ }
+
+// -----------------------------------------------------------------------------
+// MediatorEventL.
+// -----------------------------------------------------------------------------
+void CVtMediatorPlugin::MediatorEventL( TUid /*aDomain*/,
+ TUid aCategory,
+ TInt aEventId,
+ const TDesC8& aData )
+ {
+ TRACE("CVtMediatorPlugin.MediatorEventL<")
+ if ( aCategory == KCatEventsFromTelephony &&
+ aEventId == EPhoneEventCallData )
+ {
+ TTelephonyCallDataParamPackage pckg;
+ pckg.Copy( aData );
+ const TTelephonyCallDataParam telCallData = pckg();
+ HandleCallStateChangeL( telCallData );
+ }
+ TRACE("CVtMediatorPlugin.MediatorEventL>")
+ }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::MediatorEventsAddedL
+//
+// subscribes to CLI event when it is registered
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorEventsAddedL( TUid aDomain/*aDomain*/,
+ TUid aCategory,
+ const REventList& aEvents )
+ {
+ TRACE("CVtMediatorPlugin.MediatorEventsAddedL<")
+
+ if ( aCategory == KCatEventsFromTelephony )
+ {
+ ChangeCallDataEventSubscriptionL( aEvents, ETrue );
+ }
+ TRACE("CVtMediatorPlugin.MediatorEventsAddedL>")
+ }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandsAddedL( TUid /*aDomain*/,
+ TUid aCategory,
+ const RCommandList& /*aCommands*/ )
+ {
+ TRACE("CVtMediatorPlugin.MediatorCommandsAddedL<")
+ if ( aCategory == KCatPhoneToVideotelCommands )
+ {
+ HandleVtCommandRegistrationL();
+ }
+ TRACE("CVtMediatorPlugin.MediatorCommandsAddedL>")
+ }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCategoryRemovedL( TUid /*aDomain*/,
+ TUid /*aCategory*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorEventsRemovedL( TUid /*aDomain*/,
+ TUid aCategory,
+ const REventList& aEvents )
+ {
+ TRACE("CVtMediatorPlugin.MediatorEventsRemovedL<")
+ if ( aCategory == KCatEventsFromTelephony )
+ {
+ ChangeCallDataEventSubscriptionL( aEvents, EFalse );
+ }
+ TRACE("CVtMediatorPlugin.MediatorEventsRemovedL>")
+ }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandsRemovedL( TUid /*aDomain*/,
+ TUid aCategory,
+ const RCommandList& /*aCommands*/ )
+ {
+ TRACE("CVtMediatorPlugin.MediatorCommandsRemovedL<")
+ if ( aCategory == KCatPhoneToVideotelCommands )
+ {
+ // VT has unregistered commands, meaning it is shutting down
+ HandleVtCommandUnregistrationL();
+ }
+ TRACE("CVtMediatorPlugin.MediatorCommandsRemovedL>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::MediatorCommandL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandL( TUid aDomain,
+ TUid aCategory,
+ TInt aCommandId,
+ TVersion /*aVersion*/,
+ const TDesC8& aData )
+ {
+ TRACE("CVtMediatorPlugin.MediatorCommandL<")
+ if ( aCategory == KCatPhoneToVideotelCommands )
+ {
+ if ( aCommandId == EVtCmdUseDataport )
+ {
+#ifdef _DEBUG
+ // error in responding is ignored but printed on debug build
+ const TInt err =
+#endif
+ iCommandResponder->IssueResponse(
+ aDomain, aCategory, aCommandId, KErrNone, KNullDesC8() );
+ TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdUseDataport err=%d", err )
+ HandleDataportCommandL( aData );
+ }
+ else if ( aCommandId == EVtCmdReleaseDataport )
+ {
+ if ( EReady == iState )
+ {
+ const TVersion version(
+ KVideotelMdtrCommandsVersionMajor,
+ KVideotelMdtrCommandsVersionMinor,
+ KVideotelMdtrCommandsVersionBuild );
+
+#ifdef _DEBUG
+ // error in responding is ignored but printed on debug build
+ const TInt err =
+#endif
+ iCommandInitiator->IssueCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalCommands,
+ EVtMediatorReleaseDataport,
+ version,
+ KNullDesC8() );
+ TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdReleaseDataport, send to VT err=%d", err )
+
+ }
+ else
+ {
+#ifdef _DEBUG
+ // error in responding is ignored but printed on debug build
+ const TInt err =
+#endif
+ iCommandResponder->IssueResponse(
+ aDomain,
+ aCategory,
+ aCommandId,
+ KErrNone,
+ KNullDesC8() );
+ TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdReleaseDataport, just Resp err=%d", err )
+ }
+
+ }
+ }
+ TRACE("CVtMediatorPlugin.MediatorCommandL>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CommandResponseL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CommandResponseL( TUid aDomain, TUid aCategory,
+ TInt aCommandId, TInt /*aStatus*/, const TDesC8& /*aData*/ )
+ {
+ TRACE("CVtMediatorPlugin.CommandResponseL<")
+ if( ( aDomain == KMediatorVideoTelephonyDomain ) &&
+ ( aCategory == KCatVideotelInternalCommands ) )
+ {
+ TInt res =
+ iCommandResponder->IssueResponse(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ EVtCmdReleaseDataport,
+ KErrNone,
+ KNullDesC8() );
+ TRACE2("CVtMediatorPlugin.CommandResponseL, IssueResponse res: %d", res )
+ User::LeaveIfError( res );
+ }
+ TRACE("CVtMediatorPlugin.CommandResponseL>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CancelMediatorCommand
+//
+// no-op
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CancelMediatorCommand( TUid /*aDomain*/,
+ TUid /*aCategory*/,
+ TInt /*aCommandId*/ )
+ {
+ }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::ChangeCallDataEventSubscriptionL
+//
+// Takes care of 'call data' event subscription.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::ChangeCallDataEventSubscriptionL(
+ const REventList& aEvents,
+ const TBool aEventRegistered )
+ {
+ TRACE("CVtMediatorPlugin.ChangeCLIEventSubscription<")
+
+ TInt res( KErrNone );
+ TInt eventCount = aEvents.Count();
+ while ( eventCount-- )
+ {
+ const TEvent& aEvent = aEvents[ eventCount ];
+ if ( aEvent.iEventId == EPhoneEventCallData )
+ {
+ if ( aEventRegistered )
+ {
+ // Phone has registered Call data event => subscribe it
+ const TVersion version(
+ KTelephonyEventsVersionMajor,
+ KTelephonyEventsVersionMinor,
+ KTelephonyEventsVersionBuild );
+ res = iEventConsumer->SubscribeEvent(
+ KMediatorTelephonyDomain,
+ KCatEventsFromTelephony,
+ EPhoneEventCallData, version );
+ }
+ else
+ {
+ // Phone has unregistered Call data event => unsubscribe it
+ res = iEventConsumer->UnsubscribeEvent(
+ KMediatorTelephonyDomain,
+ KCatEventsFromTelephony,
+ EPhoneEventCallData );
+ }
+ TRACE2(" (un)subscribe result=%d", res )
+ eventCount = 0; // break loop
+ }
+ }
+
+ TRACE2("CVtMediatorPlugin.ChangeCLIEventSubscription result=%d>", res )
+ User::LeaveIfError( res );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::HandleVtCommandRegistrationL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleVtCommandRegistrationL()
+ {
+ TRACE("CVtMediatorPlugin.HandleVtCommandRegistrationL<" )
+ if ( iState == EWaitingEventRegistration )
+ {
+ // VT app registered commands => it can also receive events
+ // NOTE: it is expected that VT application first subscribes
+ // to internal events and only after that registers commands to
+ // avoid timing problems.
+ iState = EReady;
+ delete iCallBack;
+ iCallBack = NULL;
+ TCallBack cb( &EventRaiserCallback, this );
+ iCallBack = new ( ELeave ) CAsyncCallBack( cb,
+ CActive::EPriorityStandard );
+ TRACE("CVtMediatorPlugin enque async callback" )
+ iCallBack->CallBack();
+ }
+ TRACE("CVtMediatorPlugin.HandleVtCommandRegistrationL>" )
+ }
+
+TInt CVtMediatorPlugin::EventRaiserCallback( TAny* aAny )
+ {
+ TRACE("CVtMediatorPlugin.EventRaiserCallback<" )
+ CVtMediatorPlugin* plugin = reinterpret_cast<CVtMediatorPlugin*>( aAny );
+ delete plugin->iCallBack;
+ plugin->iCallBack = NULL;
+ TRAP_IGNORE( plugin->RaiseVtEventL() );
+ TRACE("CVtMediatorPlugin.EventRaiserCallback>" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleVtCommandUnregistrationL()
+ {
+ // unregistration means that VT app is shutting down.
+ TRACE("CVtMediatorPlugin.HandleVtCommandUnregistrationL<" )
+ ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+ //ClearData(iWaitingVideoCallInfo);
+ TRACE("CVtMediatorPlugin.HandleVtCommandUnregistrationL>" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::LaunchVtAppL()
+ {
+
+ TRACE("CVtMediatorPlugin.LaunchVtAppL<" )
+
+ if ( !IsEnoughMemory() )
+ {
+ const TVersion KTelephonyCmdVersion(
+ KTelephonyCommandsVersionMajor,
+ KTelephonyCommandsVersionMinor,
+ KTelephonyCommandsVersionBuild );
+ const TInt res =
+ iCommandInitiator->IssueCommand(
+ KMediatorTelephonyDomain,
+ KCatVideoTelToPhoneCommands,
+ EVtCmdLowMemory,
+ KTelephonyCmdVersion,
+ KNullDesC8() );
+ ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+ ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+ TRACE("CVtMediatorPlugin.LaunchVtAppL, Insufficient Memory" )
+ return;
+ }
+
+ iAppDeathActive = new ( ELeave ) CAppDeathActive( *this, iAppThread );
+
+ RWsSession wsSession;
+ User::LeaveIfError( wsSession.Connect() );
+ CleanupClosePushL( wsSession );
+
+ TInt wgId = 0;
+ TBool found = EFalse;
+
+ // Check if there is already application running. Then we do not
+ // start new one - rather we just monitor the existing one.
+ while ( ( wgId != KErrNotFound ) && !found )
+ {
+ CApaWindowGroupName::FindByAppUid(
+ KVtCmVideoTelUiUid,
+ wsSession,
+ wgId );
+
+ TApaTask task( wsSession );
+ task.SetWgId( wgId );
+ if ( task.Exists() )
+ {
+ if ( iAppThread.Open( task.ThreadId() ) == KErrNone )
+ {
+ TExitType exitType = iAppThread.ExitType();
+ found = ( exitType == EExitPending );
+
+ if ( found )
+ {
+ iAppThreadId = task.ThreadId();
+ }
+ }
+ }
+
+ if ( !found )
+ {
+ iAppThread.Close();
+ }
+ }
+ CleanupStack::PopAndDestroy(); // CleanupClosePushL
+
+ // If application was not found, then launch new application.
+ if ( !found )
+ {
+ TThreadId threadId;
+#ifndef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+ CApaCommandLine* cmd = CApaCommandLine::NewLC();
+ cmd->SetExecutableNameL( KVtCmVideoTelUiPath );
+#else // !SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+ CApaCommandLine* cmd = CApaCommandLine::NewLC( KVtCmVideoTelUiPath );
+#endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+ cmd->SetCommandL( EApaCommandBackground );
+
+ RApaLsSession session;
+ User::LeaveIfError( session.Connect() );
+ CleanupClosePushL( session );
+
+ TInt err = session.StartApp( *cmd, threadId );
+ if ( err > KErrNone )
+ {
+ err = KErrGeneral;
+ }
+ User::LeaveIfError( err );
+ CleanupStack::PopAndDestroy( 2, cmd ); // CleanupClosePushL, cmd
+ User::LeaveIfError( iAppThread.Open( threadId ) );
+ iAppThreadId = threadId;
+ }
+
+ // Start active objects.
+ iState = EWaitingEventRegistration;
+ iAppDeathActive->Start();
+ TRACE("CVtMediatorPlugin.LaunchVtAppL>" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::SaveCallData( const TTelephonyCallDataParam& aData, TVtVideoTelephonyCallInformation& iVtCallInfo )
+ {
+ TRACE("CVtMediatorPlugin.SaveCallData<" )
+ iVtCallInfo.iDisplayText = aData.iCLIText.Left(
+ TVtVideoTelephonyCallInformation::TDisplayTextMaxLength );
+
+ TRACE2("CVtMediatorPlugin.SaveCallData iDisplayText=%S",
+ &iVtCallInfo.iDisplayText );
+
+ iVtCallInfo.iCallId = aData.iCallId;
+
+ if ( KNullDesC() != aData.iRemotePhoneNumber )
+ {
+ iVtCallInfo.iVoiceCallPossible = ETrue;
+ }
+ iVtCallInfo.iPhoneNumText = aData.iRemotePhoneNumber;
+ iVtCallInfo.iEventDataValidity |=
+ TVtVideoTelephonyCallInformation::EDisplayTextValid;
+ TRACE2("CVtMediatorPlugin.SaveCallData data saved=%d>",
+ aData.iCallType == ECallTypeVideo )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleDataportCommandL( const TDesC8& aData )
+ {
+ TRACE("CVtMediatorPlugin.HandleDataportCommandL<" )
+ TDataPortPackage pckg;
+ pckg.Copy( aData );
+ iActiveVideoCallInfo.iDataport = pckg();
+ iActiveVideoCallInfo.iEventDataValidity |=
+ TVtVideoTelephonyCallInformation::EDataportValid;
+ RaiseVtEventL();
+ TRACE("CVtMediatorPlugin.HandleDataportCommandL>" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::ClearData
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::ClearData(TVtVideoTelephonyCallInformation& aVtCallInfo, TCallState& aCallState)
+ {
+ TRACE("CVtMediatorPlugin.ClearData<" )
+ if ( aVtCallInfo.iCallId == iActiveVideoCallInfo.iCallId )
+ {
+ iState = EWaitingAppLaunch;
+ }
+ aVtCallInfo.iEventDataValidity = 0;
+ aVtCallInfo.iDataport.Zero();
+ aVtCallInfo.iVoiceCallPossible = EFalse;
+ //for video call, it should be 9/10
+ //for other call, it will be from -1 to 8
+ aVtCallInfo.iCallId = KVtInitCallId;
+ aVtCallInfo.iDisplayText.Zero();
+ aCallState = ECallStateIdle;
+ TRACE("CVtMediatorPlugin.ClearData>" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RegisterVtInternalEventL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RegisterVtInternalEventL()
+ {
+ TRACE("CVtMediatorPlugin.RegisterVtInternalEventL<" )
+ iEventProvider = CMediatorEventProvider::NewL();
+
+ TVersion version(
+ KVideotelMdtrEventVersionMajor,
+ KVideotelMdtrEventVersionMinor,
+ KVideotelMdtrEventVersionBuild );
+
+ TCapabilitySet capSet;
+ capSet.SetEmpty();
+ capSet.AddCapability( ECapabilityReadDeviceData );
+
+ const TInt err = iEventProvider->RegisterEvent(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalEvents,
+ EVtMediatorEventVideoCallInformation,
+ version,
+ capSet );
+
+
+ TRACE2("CVtMediatorPlugin.RegisterVtInternalEventL err=%d>", err )
+ User::LeaveIfError( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RegisterDataportCommandL
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RegisterDataportCommandL()
+ {
+ TRACE("CVtMediatorPlugin.RegisterDataportCommandL<" )
+ iCommandResponder = CMediatorCommandResponder::NewL( this );
+
+ TCapabilitySet capSet;
+ capSet.SetEmpty();
+ capSet.AddCapability( ECapabilityWriteDeviceData );
+ MediatorService::TCommand command;
+
+ command.iCaps = capSet;
+ command.iVersion = TVersion(
+ KPhoneToVideotelCmdVersionMajor,
+ KPhoneToVideotelCmdVersionMinor,
+ KPhoneToVideotelCmdVersionBuild );
+ command.iTimeout = KVtEngMdtrCmdTimeout;
+
+ // enable microphone command
+ command.iCommandId = EVtCmdUseDataport;
+ iCommandList.Append( command );
+
+ // Releasedataport command
+ capSet.SetEmpty();
+ capSet.AddCapability( ECapabilityPowerMgmt );
+ command.iCommandId = EVtCmdReleaseDataport;
+ iCommandList.Append( command );
+
+ const TInt err = iCommandResponder->RegisterCommand(
+ KMediatorVideoTelephonyDomain,
+ KCatPhoneToVideotelCommands,
+ iCommandList );
+
+ TRACE2("CVtMediatorPlugin.RegisterDataportCommandL err=%d>", err )
+ User::LeaveIfError( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RaiseVtEventL
+//
+// Raises VT call info event if in suitable state, i.e. VT app has subscribed
+// the event.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RaiseVtEventL()
+ {
+ TRACE("CVtMediatorPlugin.RaiseVtEventL<" )
+ TInt result = KVtAppNotReady; // does not cause leave
+ TRACE2("CVtMediatorPlugin.RaiseVtEventL iState=%d>",
+ iState )
+ TRACE2("CVtMediatorPlugin.RaiseVtEventL iActiveVideoCallState=%d>",
+ iActiveVideoCallState )
+ if ( iState == EReady && // application subscribed to the event
+
+ // don't send event if video call is not starting/ongoing
+ ( iActiveVideoCallState >= ECallStateDialling &&
+ iActiveVideoCallState <= ECallStateConnected ) )
+ {
+ const TVersion version(
+ KVideotelMdtrEventVersionMajor,
+ KVideotelMdtrEventVersionMinor,
+ KVideotelMdtrEventVersionBuild );
+
+ const TVtMediatorInfoPackage pckg( iActiveVideoCallInfo );
+ result = iEventProvider->RaiseEvent(
+ KMediatorVideoTelephonyDomain,
+ KCatVideotelInternalEvents,
+ EVtMediatorEventVideoCallInformation,
+ version,
+ pckg
+ );
+ }
+ TRACE2("CVtMediatorPlugin.RaiseVtEventL result=%d>", result )
+ User::LeaveIfError( result );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::HandleCallStateChangeL
+//
+// Compares previous and new video call states and resolves based on result
+// if Video telephone applicaton should be launched.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleCallStateChangeL(
+ const TTelephonyCallDataParam& aData )
+ {
+ TRACE("CVtMediatorPlugin.HandleCallStateChangeL<" )
+
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL calltype=%d>",
+ aData.iCallType )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL saved Activecallid=%d>",
+ iActiveVideoCallInfo.iCallId )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL saved Waitingcallid=%d>",
+ iWaitingVideoCallInfo.iCallId )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL callid=%d>",
+ aData.iCallId )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL ActiveCallOldState=%d>",
+ iActiveVideoCallState )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL WaitingCallOldState=%d>",
+ iWaitingVideoCallState )
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL NewState=%d>",
+ aData.iCallState )
+
+ //if the call is waitingcall, just save/clear
+ if ( aData.iCallType == ECallTypeVideo ||
+ // check also call id because in call clearing states call type may
+ // be unspecified but call id is saved in call setup and we can
+ // compare to it.
+ iActiveVideoCallInfo.iCallId == aData.iCallId ||
+ iWaitingVideoCallInfo.iCallId == aData.iCallId )
+ {
+ TBool isWaitingCall = ETrue;
+
+ /**
+ * firstly we should check the callid to identify if it is a waitingcal/activecall
+ * imagine the usecase that long press endkey to shutdown both calls.
+ * after that checking iState
+ */
+ if ( iWaitingVideoCallInfo.iCallId == aData.iCallId )
+ {
+ isWaitingCall = ETrue;
+ }
+ else if ( iActiveVideoCallInfo.iCallId == aData.iCallId )
+ {
+ isWaitingCall = EFalse;
+ }
+ //no vt app launched, this happens while vt first launching or end key to shutdown both calls
+ else if ( iState == EWaitingAppLaunch )
+ {
+ isWaitingCall = EFalse;
+ }
+
+ TRACE2("CVtMediatorPlugin.HandleCallStateChangeL isWaitingCall=%d>",
+ isWaitingCall)
+
+ TCallState& callState = isWaitingCall?iWaitingVideoCallState:iActiveVideoCallState;
+ TVtVideoTelephonyCallInformation& vtCallInfo = isWaitingCall?iWaitingVideoCallInfo:iActiveVideoCallInfo;
+
+ TBool launchNeeded = KVtCallStateActionArray[ aData.iCallState ] -
+ KVtCallStateActionArray[callState] > 0;
+ if ( isWaitingCall )
+ {
+ launchNeeded = EFalse;
+ }
+ callState = aData.iCallState;
+
+ switch ( callState )
+ {
+ case ECallStateDialling:
+ case ECallStateRinging:
+ case ECallStateConnecting:
+ case ECallStateConnected:
+ SaveCallData( aData, vtCallInfo);
+ break;
+ default:
+ // data becomes invalid in other states (=call clearing/idle)
+ ClearData(vtCallInfo, callState);
+ break;
+ }
+ if ( launchNeeded )
+ {
+ LaunchVtAppL();
+ }
+ if ( !isWaitingCall )
+ {
+ RaiseVtEventL();
+ }
+ }
+
+ TRACE("CVtMediatorPlugin.HandleCallStateChangeL>" )
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::IsEnoughMemory
+//
+// Check if there is enough memory to launch
+// -----------------------------------------------------------------------------
+//
+TBool CVtMediatorPlugin::IsEnoughMemory()
+ {
+ TRACE("CVtMediatorPlugin::IsEnoughMemory<" )
+ // Fetch amount of free memory.
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt freeRam = (TInt)( memory().iFreeRamInBytes );
+ TRACE2("CVtMediatorPlugin::IsEnoughMemory: freeRam = %d", freeRam )
+
+ TBool enoughRam = ETrue;
+
+ if ( freeRam < KRamNeededForVideoCalls )
+ {
+ FreeRam();
+ freeRam = (TInt)( memory().iFreeRamInBytes );
+ TRACE2("CVtMediatorPlugin::IsEnoughMemory: after free, freeRam = %d", freeRam )
+ if ( freeRam < KRamNeededForVideoCalls )
+ {
+ enoughRam = EFalse;
+ TRACE ("CVtMediatorPlugin::IsEnoughMemory : Not enough RAM")
+
+ }
+ }
+ TRACE("CVtMediatorPlugin::IsEnoughMemory>" )
+ return enoughRam;
+ }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::FreeRam
+// Try to free memory to match the memory usage of VT
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::FreeRam()
+ {
+ TRACE("CVtMediatorPlugin.FreeRam()<")
+ User::CompressAllHeaps();
+ TRACE("CVtMediatorPlugin.FreeRam()>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::StopDeathActiveL
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::StopDeathActiveL()
+ {
+ TRACE("CVtMediatorPlugin.StopDeathActive<")
+ delete iAppDeathActive;
+ iAppThread.Close();
+ //if there is a waiting call, check if we need to launch it
+ TRACE2("CVtMediatorPlugin.StopDeathActive WaitintCallID=%d>",
+ iWaitingVideoCallInfo.iCallId)
+ if ( iWaitingVideoCallInfo.iCallId != KVtInitCallId )
+ {
+ iActiveVideoCallInfo = iWaitingVideoCallInfo;
+ iActiveVideoCallState = iWaitingVideoCallState;
+ ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+
+ if ( iActiveVideoCallState == ECallStateDialling ||
+ iActiveVideoCallState == ECallStateRinging ||
+ iActiveVideoCallState == ECallStateConnecting ||
+ iActiveVideoCallState == ECallStateConnected ||
+ iActiveVideoCallState == ECallStateAnswering )
+ {
+ LaunchVtAppL();
+ RaiseVtEventL();
+ }
+ }
+ TRACE("CVtMediatorPlugin.StopDeathActive>")
+ }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::CAppDeathActive
+// -----------------------------------------------------------------------------
+//
+CVtMediatorPlugin::CAppDeathActive::CAppDeathActive(
+ CVtMediatorPlugin& aMediatorPlugin,
+ RThread& aAppThread
+ )
+ : CActive( CActive::EPriorityStandard ),
+ iMediatorPlugin( aMediatorPlugin ),
+ iAppThread( aAppThread )
+
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::~CAppDeathActive
+// -----------------------------------------------------------------------------
+//
+CVtMediatorPlugin::CAppDeathActive::~CAppDeathActive()
+ {
+ TRACE("CVtMediatorPlugin.~CAppDeathActive")
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::Start
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::Start()
+ {
+ TRACE("CVtMediatorPlugin.Start<")
+ Cancel();
+ iAppThread.Logon( iStatus );
+ SetActive();
+ TRACE("CVtMediatorPlugin.Start>")
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::RunL()
+ {
+ //do something here
+ TRACE("CVtMediatorPlugin.RunL<")
+ iMediatorPlugin.StopDeathActiveL();
+ TRACE("CVtMediatorPlugin.RunL>")
+
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::DoCancel()
+ {
+ iAppThread.LogonCancel( iStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CVtMediatorPlugin::CAppDeathActive::RunError( TInt /*aError*/ )
+ {
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/src/vtmediatorpluginproxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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: Source file for MediatorTest Plugin Proxy
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+#include <implementationproxy.h>
+#include "cvtmediatorplugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x200159A0, CVtMediatorPlugin::NewL )
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/DisplaySinkU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z11CreateSinkLR18TDisplaySinkParamsRK6TDesC8 @ 1 NONAME
+ _ZN18TDisplaySinkParamsC1Ev @ 2 NONAME
+ _ZN18TDisplaySinkParamsC2Ev @ 3 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/VtImageConverterU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,32 @@
+EXPORTS
+ _ZN24CVTYUVFbsBitmapConverter15SetDestinationLERK10CFbsBitmap @ 1 NONAME
+ _ZN24CVTYUVFbsBitmapConverter15SetDestinationLEi @ 2 NONAME
+ _ZN24CVTYUVFbsBitmapConverter8ProcessLEv @ 3 NONAME
+ _ZN24CVTYUVFbsBitmapConverterD0Ev @ 4 NONAME
+ _ZN24CVTYUVFbsBitmapConverterD1Ev @ 5 NONAME
+ _ZN24CVTYUVFbsBitmapConverterD2Ev @ 6 NONAME
+ _ZN25CVSFbsBitmapIYUVConverter10SetSourceLERK10CFbsBitmap @ 7 NONAME
+ _ZN25CVSFbsBitmapIYUVConverter4NewLERK10CFbsBitmap @ 8 NONAME
+ _ZN25CVSFbsBitmapIYUVConverter8ProcessLEv @ 9 NONAME
+ _ZN25CVSFbsBitmapIYUVConverterD0Ev @ 10 NONAME
+ _ZN25CVSFbsBitmapIYUVConverterD1Ev @ 11 NONAME
+ _ZN25CVSFbsBitmapIYUVConverterD2Ev @ 12 NONAME
+ _ZN25CVTIYUVFbsBitmapConverter4NewLERK5TSizeRK10CFbsBitmap @ 13 NONAME
+ _ZN25CVTIYUVFbsBitmapConverter4NewLERK5TSizei @ 14 NONAME
+ _ZN25CVTYV12FbsBitmapConverter4NewLERK5TSizeRK10CFbsBitmap @ 15 NONAME
+ _ZN25CVTYV12FbsBitmapConverter4NewLERK5TSizei @ 16 NONAME
+ _ZN30CVTYUVPlanarFbsBitmapConverter10SetSourceLERK5TSizeRK6TDesC8 @ 17 NONAME
+ _ZN30CVTYUVPlanarFbsBitmapConverter10SetSourceLERK6TDesC8 @ 18 NONAME
+ _ZN30CVTYUVPlanarFbsBitmapConverter14SetSourceSizeLERK5TSize @ 19 NONAME
+ _ZNK25CVSFbsBitmapIYUVConverter7YUVDataEv @ 20 NONAME
+ _ZTI24CVTYUVFbsBitmapConverter @ 21 NONAME ; #<TI>#
+ _ZTI25CVSFbsBitmapIYUVConverter @ 22 NONAME ; #<TI>#
+ _ZTI25CVTIYUVFbsBitmapConverter @ 23 NONAME ; #<TI>#
+ _ZTI25CVTYV12FbsBitmapConverter @ 24 NONAME ; #<TI>#
+ _ZTI30CVTYUVPlanarFbsBitmapConverter @ 25 NONAME ; #<TI>#
+ _ZTV24CVTYUVFbsBitmapConverter @ 26 NONAME ; #<VT>#
+ _ZTV25CVSFbsBitmapIYUVConverter @ 27 NONAME ; #<VT>#
+ _ZTV25CVTIYUVFbsBitmapConverter @ 28 NONAME ; #<VT>#
+ _ZTV25CVTYV12FbsBitmapConverter @ 29 NONAME ; #<VT>#
+ _ZTV30CVTYUVPlanarFbsBitmapConverter @ 30 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/VtImageTransformsU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,59 @@
+EXPORTS
+ _ZN12CVtImageIYUV4NewLERK5TSize @ 1 NONAME
+ _ZN12CVtImageIYUV4NewLERK5TSizeR5TPtr8 @ 2 NONAME
+ _ZN12CVtImageIYUV4NewLERK5TSizeRK6TDesC8 @ 3 NONAME
+ _ZN12CVtImageIYUV9SetImageLER5TPtr8 @ 4 NONAME
+ _ZN12CVtImageIYUV9SetImageLERK6TDesC8 @ 5 NONAME
+ _ZN12CVtImageIYUVD0Ev @ 6 NONAME
+ _ZN12CVtImageIYUVD1Ev @ 7 NONAME
+ _ZN12CVtImageIYUVD2Ev @ 8 NONAME
+ _ZN14CVtImageBitmap10SetBitmapLEi @ 9 NONAME
+ _ZN14CVtImageBitmap4NewLERK5TSize12TDisplayMode @ 10 NONAME
+ _ZN14CVtImageBitmap4NewLEi @ 11 NONAME
+ _ZN14CVtImageBitmap7ResizeLERK5TSize @ 12 NONAME
+ _ZN14CVtImageBitmapD0Ev @ 13 NONAME
+ _ZN14CVtImageBitmapD1Ev @ 14 NONAME
+ _ZN14CVtImageBitmapD2Ev @ 15 NONAME
+ _ZN14CVtImageScaler11SetQualityLENS_8TQualityE @ 16 NONAME
+ _ZN14CVtImageScaler4NewLER22MVtImageScalerObserverNS_8TQualityEN7CActive9TPriorityE @ 17 NONAME
+ _ZN14CVtImageScaler6ScaleLERK8CVtImageRS0_ @ 18 NONAME
+ _ZN14CVtImageScalerD0Ev @ 19 NONAME
+ _ZN14CVtImageScalerD1Ev @ 20 NONAME
+ _ZN14CVtImageScalerD2Ev @ 21 NONAME
+ _ZN15CVtImageRotator4NewLER23MVtImageRotatorObserverN7CActive9TPriorityE @ 22 NONAME
+ _ZN15CVtImageRotator7RotateLERK8CVtImageRS0_RKNS_14TRotationAngleE @ 23 NONAME
+ _ZN15CVtImageRotatorD0Ev @ 24 NONAME
+ _ZN15CVtImageRotatorD1Ev @ 25 NONAME
+ _ZN15CVtImageRotatorD2Ev @ 26 NONAME
+ _ZNK12CVtImageIYUV12UVPlaneWidthEv @ 27 NONAME
+ _ZNK12CVtImageIYUV13UVPlaneHeightEv @ 28 NONAME
+ _ZNK12CVtImageIYUV1UEv @ 29 NONAME
+ _ZNK12CVtImageIYUV1VEv @ 30 NONAME
+ _ZNK12CVtImageIYUV1YEv @ 31 NONAME
+ _ZNK12CVtImageIYUV5ImageEv @ 32 NONAME
+ _ZNK14CVtImageBitmap6BitmapEv @ 33 NONAME
+ _ZNK8CVtImage4TypeEv @ 34 NONAME
+ _ZTI12CVtImageIYUV @ 35 NONAME ; #<TI>#
+ _ZTI14CVtImageBitmap @ 36 NONAME ; #<TI>#
+ _ZTI14CVtImageScaler @ 37 NONAME ; #<TI>#
+ _ZTI15CVtImageRotator @ 38 NONAME ; #<TI>#
+ _ZTI25CVtImageScalerImplNearest @ 39 NONAME ; #<TI>#
+ _ZTI26CVtImageScalerImplBilinear @ 40 NONAME ; #<TI>#
+ _ZTI28CVtImageRotatorImplClockwise @ 41 NONAME ; #<TI>#
+ _ZTI29CVtImageRotatorImplMirrorFlip @ 42 NONAME ; #<TI>#
+ _ZTI33CVtImageScalerImplWeightedAverage @ 43 NONAME ; #<TI>#
+ _ZTV12CVtImageIYUV @ 44 NONAME ; #<VT>#
+ _ZTV14CVtImageBitmap @ 45 NONAME ; #<VT>#
+ _ZTV14CVtImageScaler @ 46 NONAME ; #<VT>#
+ _ZTV15CVtImageRotator @ 47 NONAME ; #<VT>#
+ _ZTV25CVtImageScalerImplNearest @ 48 NONAME ; #<VT>#
+ _ZTV26CVtImageScalerImplBilinear @ 49 NONAME ; #<VT>#
+ _ZTV28CVtImageRotatorImplClockwise @ 50 NONAME ; #<VT>#
+ _ZTV29CVtImageRotatorImplMirrorFlip @ 51 NONAME ; #<VT>#
+ _ZTV33CVtImageScalerImplWeightedAverage @ 52 NONAME ; #<VT>#
+ _ZN14CVtImageScaler5ScaleERK8CVtImageRS0_ @ 53 NONAME
+ _ZN15CVtImageRotator6RotateERK8CVtImageRS0_RKNS_14TRotationAngleE @ 54 NONAME
+ _ZN14CVtImageScaler9ScaleNowLERK8CVtImageRS0_ @ 55 NONAME
+ _ZTI18CVtImageScalerImpl @ 56 NONAME ; #<TI>#
+ _ZTV18CVtImageScalerImpl @ 57 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/DISPLAYSINKU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+ SetBitmapAvailable__12CDisplaySinkQ212CDisplaySink9TBitmapNo @ 1 NONAME R3UNUSED ; CDisplaySink::SetBitmapAvailable(CDisplaySink::TBitmapNo)
+ Release__12CDisplaySink @ 2 NONAME R3UNUSED ; CDisplaySink::Release(void)
+ ResumeSink__12CDisplaySink @ 3 NONAME R3UNUSED ; CDisplaySink::ResumeSink(void)
+ NewSinkL__12CDisplaySinkG18TDisplaySinkParamsRC6TDesC8 @ 4 NONAME ; CDisplaySink::NewSinkL(TDisplaySinkParams, TDesC8 const &)
+ UpdateSinkParamsL__12CDisplaySinkRC18TDisplaySinkParamsRi @ 5 NONAME R3UNUSED ; CDisplaySink::UpdateSinkParamsL(TDisplaySinkParams const &, int &)
+ "_._12CDisplaySink" @ 6 NONAME R3UNUSED ; CDisplaySink::~CDisplaySink(void)
+ __18TDisplaySinkParams @ 7 NONAME R3UNUSED ; TDisplaySinkParams::TDisplaySinkParams(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/VTIMAGECONVERTERU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+ "_._25CVSFbsBitmapIYUVConverter" @ 1 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter(void)
+ NewL__25CVTIYUVFbsBitmapConverterRC5TSizeRC10CFbsBitmap @ 2 NONAME R3UNUSED ; CVTIYUVFbsBitmapConverter::NewL(TSize const &, CFbsBitmap const &)
+ NewL__25CVTIYUVFbsBitmapConverterRC5TSizei @ 3 NONAME R3UNUSED ; CVTIYUVFbsBitmapConverter::NewL(TSize const &, int)
+ NewL__25CVTYV12FbsBitmapConverterRC5TSizeRC10CFbsBitmap @ 4 NONAME R3UNUSED ; CVTYV12FbsBitmapConverter::NewL(TSize const &, CFbsBitmap const &)
+ NewL__25CVTYV12FbsBitmapConverterRC5TSizei @ 5 NONAME R3UNUSED ; CVTYV12FbsBitmapConverter::NewL(TSize const &, int)
+ ProcessL__24CVTYUVFbsBitmapConverter @ 6 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::ProcessL(void)
+ ProcessL__25CVSFbsBitmapIYUVConverter @ 7 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::ProcessL(void)
+ SetDestinationL__24CVTYUVFbsBitmapConverterRC10CFbsBitmap @ 8 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::SetDestinationL(CFbsBitmap const &)
+ SetDestinationL__24CVTYUVFbsBitmapConverteri @ 9 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::SetDestinationL(int)
+ SetSourceL__25CVSFbsBitmapIYUVConverterRC10CFbsBitmap @ 10 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::SetSourceL(CFbsBitmap const &)
+ SetSourceL__30CVTYUVPlanarFbsBitmapConverterRC5TSizeRC6TDesC8 @ 11 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceL(TSize const &, TDesC8 const &)
+ SetSourceL__30CVTYUVPlanarFbsBitmapConverterRC6TDesC8 @ 12 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceL(TDesC8 const &)
+ SetSourceSizeL__30CVTYUVPlanarFbsBitmapConverterRC5TSize @ 13 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(TSize const &)
+ YUVData__C25CVSFbsBitmapIYUVConverter @ 14 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::YUVData(void) const
+ "_._24CVTYUVFbsBitmapConverter" @ 15 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter(void)
+ NewL__25CVSFbsBitmapIYUVConverterRC10CFbsBitmap @ 16 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::NewL(CFbsBitmap const &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/VTIMAGETRANSFORMSU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,28 @@
+EXPORTS
+ "_._15CVtImageRotator" @ 1 NONAME R3UNUSED ; CVtImageRotator::~CVtImageRotator(void)
+ Image__C12CVtImageIYUV @ 2 NONAME R3UNUSED ; CVtImageIYUV::Image(void) const
+ NewL__12CVtImageIYUVRC5TSize @ 3 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &)
+ NewL__12CVtImageIYUVRC5TSizeR5TPtr8 @ 4 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &, TPtr8 &)
+ NewL__12CVtImageIYUVRC5TSizeRC6TDesC8 @ 5 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &, TDesC8 const &)
+ NewL__14CVtImageBitmapRC5TSize12TDisplayMode @ 6 NONAME R3UNUSED ; CVtImageBitmap::NewL(TSize const &, TDisplayMode)
+ NewL__14CVtImageBitmapi @ 7 NONAME R3UNUSED ; CVtImageBitmap::NewL(int)
+ NewL__14CVtImageScalerR22MVtImageScalerObserverQ214CVtImageScaler8TQualityQ27CActive9TPriority @ 8 NONAME R3UNUSED ; CVtImageScaler::NewL(MVtImageScalerObserver &, CVtImageScaler::TQuality, CActive::TPriority)
+ NewL__15CVtImageRotatorR23MVtImageRotatorObserverQ27CActive9TPriority @ 9 NONAME R3UNUSED ; CVtImageRotator::NewL(MVtImageRotatorObserver &, CActive::TPriority)
+ ResizeL__14CVtImageBitmapRC5TSize @ 10 NONAME R3UNUSED ; CVtImageBitmap::ResizeL(TSize const &)
+ RotateL__15CVtImageRotatorRC8CVtImageR8CVtImageRCQ215CVtImageRotator14TRotationAngle @ 11 NONAME ; CVtImageRotator::RotateL(CVtImage const &, CVtImage &, CVtImageRotator::TRotationAngle const &)
+ ScaleL__14CVtImageScalerRC8CVtImageR8CVtImage @ 12 NONAME R3UNUSED ; CVtImageScaler::ScaleL(CVtImage const &, CVtImage &)
+ SetBitmapL__14CVtImageBitmapi @ 13 NONAME R3UNUSED ; CVtImageBitmap::SetBitmapL(int)
+ SetImageL__12CVtImageIYUVR5TPtr8 @ 14 NONAME R3UNUSED ; CVtImageIYUV::SetImageL(TPtr8 &)
+ SetImageL__12CVtImageIYUVRC6TDesC8 @ 15 NONAME R3UNUSED ; CVtImageIYUV::SetImageL(TDesC8 const &)
+ SetQualityL__14CVtImageScalerQ214CVtImageScaler8TQuality @ 16 NONAME R3UNUSED ; CVtImageScaler::SetQualityL(CVtImageScaler::TQuality)
+ Type__C8CVtImage @ 17 NONAME R3UNUSED ; CVtImage::Type(void) const
+ UVPlaneHeight__C12CVtImageIYUV @ 18 NONAME R3UNUSED ; CVtImageIYUV::UVPlaneHeight(void) const
+ UVPlaneWidth__C12CVtImageIYUV @ 19 NONAME R3UNUSED ; CVtImageIYUV::UVPlaneWidth(void) const
+ U__C12CVtImageIYUV @ 20 NONAME R3UNUSED ; CVtImageIYUV::U(void) const
+ V__C12CVtImageIYUV @ 21 NONAME R3UNUSED ; CVtImageIYUV::V(void) const
+ Y__C12CVtImageIYUV @ 22 NONAME R3UNUSED ; CVtImageIYUV::Y(void) const
+ "_._12CVtImageIYUV" @ 23 NONAME R3UNUSED ; CVtImageIYUV::~CVtImageIYUV(void)
+ "_._14CVtImageBitmap" @ 24 NONAME R3UNUSED ; CVtImageBitmap::~CVtImageBitmap(void)
+ "_._14CVtImageScaler" @ 25 NONAME R3UNUSED ; CVtImageScaler::~CVtImageScaler(void)
+ Bitmap__C14CVtImageBitmap @ 26 NONAME R3UNUSED ; CVtImageBitmap::Bitmap(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/DISPLAYSINKU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,4 @@
+EXPORTS
+ ??0TDisplaySinkParams@@QAE@XZ @ 1 NONAME ; TDisplaySinkParams::TDisplaySinkParams(void)
+ ?CreateSinkL@@YAPAVMDisplaySink@@AAVTDisplaySinkParams@@ABVTDesC8@@@Z @ 2 NONAME ; class MDisplaySink * CreateSinkL(class TDisplaySinkParams &, class TDesC8 const &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/VTIMAGECONVERTERU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+ ??1CVSFbsBitmapIYUVConverter@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter(void)
+ ??1CVTYUVFbsBitmapConverter@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter(void)
+ ?NewL@CVSFbsBitmapIYUVConverter@@SAPAV1@ABVCFbsBitmap@@@Z @ 3 NONAME ; public: static class CVSFbsBitmapIYUVConverter * __cdecl CVSFbsBitmapIYUVConverter::NewL(class CFbsBitmap const &)
+ ?NewL@CVTIYUVFbsBitmapConverter@@SAPAV1@ABVTSize@@ABVCFbsBitmap@@@Z @ 4 NONAME ; public: static class CVTIYUVFbsBitmapConverter * __cdecl CVTIYUVFbsBitmapConverter::NewL(class TSize const &,class CFbsBitmap const &)
+ ?NewL@CVTIYUVFbsBitmapConverter@@SAPAV1@ABVTSize@@H@Z @ 5 NONAME ; public: static class CVTIYUVFbsBitmapConverter * __cdecl CVTIYUVFbsBitmapConverter::NewL(class TSize const &,int)
+ ?NewL@CVTYV12FbsBitmapConverter@@SAPAV1@ABVTSize@@ABVCFbsBitmap@@@Z @ 6 NONAME ; public: static class CVTYV12FbsBitmapConverter * __cdecl CVTYV12FbsBitmapConverter::NewL(class TSize const &,class CFbsBitmap const &)
+ ?NewL@CVTYV12FbsBitmapConverter@@SAPAV1@ABVTSize@@H@Z @ 7 NONAME ; public: static class CVTYV12FbsBitmapConverter * __cdecl CVTYV12FbsBitmapConverter::NewL(class TSize const &,int)
+ ?ProcessL@CVSFbsBitmapIYUVConverter@@QAEXXZ @ 8 NONAME ; public: void __thiscall CVSFbsBitmapIYUVConverter::ProcessL(void)
+ ?ProcessL@CVTYUVFbsBitmapConverter@@UAEXXZ @ 9 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::ProcessL(void)
+ ?SetDestinationL@CVTYUVFbsBitmapConverter@@UAEXABVCFbsBitmap@@@Z @ 10 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::SetDestinationL(class CFbsBitmap const &)
+ ?SetDestinationL@CVTYUVFbsBitmapConverter@@UAEXH@Z @ 11 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::SetDestinationL(int)
+ ?SetSourceL@CVSFbsBitmapIYUVConverter@@QAEXABVCFbsBitmap@@@Z @ 12 NONAME ; public: void __thiscall CVSFbsBitmapIYUVConverter::SetSourceL(class CFbsBitmap const &)
+ ?SetSourceL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTDesC8@@@Z @ 13 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceL(class TDesC8 const &)
+ ?SetSourceL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTSize@@ABVTDesC8@@@Z @ 14 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceL(class TSize const &,class TDesC8 const &)
+ ?SetSourceSizeL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTSize@@@Z @ 15 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(class TSize const &)
+ ?YUVData@CVSFbsBitmapIYUVConverter@@QBE?AVTPtrC8@@XZ @ 16 NONAME ; public: class TPtrC8 __thiscall CVSFbsBitmapIYUVConverter::YUVData(void)const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/VTIMAGETRANSFORMSU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+EXPORTS
+ ??1CVtImageBitmap@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CVtImageBitmap::~CVtImageBitmap(void)
+ ??1CVtImageIYUV@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CVtImageIYUV::~CVtImageIYUV(void)
+ ??1CVtImageRotator@@UAE@XZ @ 3 NONAME ; public: virtual __thiscall CVtImageRotator::~CVtImageRotator(void)
+ ??1CVtImageScaler@@UAE@XZ @ 4 NONAME ; public: virtual __thiscall CVtImageScaler::~CVtImageScaler(void)
+ ?Bitmap@CVtImageBitmap@@QBEAAVCFbsBitmap@@XZ @ 5 NONAME ; public: class CFbsBitmap & __thiscall CVtImageBitmap::Bitmap(void)const
+ ?Image@CVtImageIYUV@@QBE?AVTPtrC8@@XZ @ 6 NONAME ; public: class TPtrC8 __thiscall CVtImageIYUV::Image(void)const
+ ?NewL@CVtImageBitmap@@SAPAV1@ABVTSize@@W4TDisplayMode@@@Z @ 7 NONAME ; public: static class CVtImageBitmap * __cdecl CVtImageBitmap::NewL(class TSize const &,enum TDisplayMode)
+ ?NewL@CVtImageBitmap@@SAPAV1@H@Z @ 8 NONAME ; public: static class CVtImageBitmap * __cdecl CVtImageBitmap::NewL(int)
+ ?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@@Z @ 9 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &)
+ ?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@AAVTPtr8@@@Z @ 10 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &,class TPtr8 &)
+ ?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@ABVTDesC8@@@Z @ 11 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &,class TDesC8 const &)
+ ?NewL@CVtImageRotator@@SAPAV1@AAVMVtImageRotatorObserver@@W4TPriority@CActive@@@Z @ 12 NONAME ; public: static class CVtImageRotator * __cdecl CVtImageRotator::NewL(class MVtImageRotatorObserver &,enum CActive::TPriority)
+ ?NewL@CVtImageScaler@@SAPAV1@AAVMVtImageScalerObserver@@W4TQuality@1@W4TPriority@CActive@@@Z @ 13 NONAME ; public: static class CVtImageScaler * __cdecl CVtImageScaler::NewL(class MVtImageScalerObserver &,enum CVtImageScaler::TQuality,enum CActive::TPriority)
+ ?ResizeL@CVtImageBitmap@@QAEXABVTSize@@@Z @ 14 NONAME ; public: void __thiscall CVtImageBitmap::ResizeL(class TSize const &)
+ ?RotateL@CVtImageRotator@@QAEXABVCVtImage@@AAV2@ABW4TRotationAngle@1@@Z @ 15 NONAME ; public: void __thiscall CVtImageRotator::RotateL(class CVtImage const &,class CVtImage &,enum CVtImageRotator::TRotationAngle const &)
+ ?ScaleL@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 16 NONAME ; public: void __thiscall CVtImageScaler::ScaleL(class CVtImage const &,class CVtImage &)
+ ?SetBitmapL@CVtImageBitmap@@QAEXH@Z @ 17 NONAME ; public: void __thiscall CVtImageBitmap::SetBitmapL(int)
+ ?SetImageL@CVtImageIYUV@@QAEXAAVTPtr8@@@Z @ 18 NONAME ; public: void __thiscall CVtImageIYUV::SetImageL(class TPtr8 &)
+ ?SetImageL@CVtImageIYUV@@QAEXABVTDesC8@@@Z @ 19 NONAME ; public: void __thiscall CVtImageIYUV::SetImageL(class TDesC8 const &)
+ ?SetQualityL@CVtImageScaler@@QAEXW4TQuality@1@@Z @ 20 NONAME ; public: void __thiscall CVtImageScaler::SetQualityL(enum CVtImageScaler::TQuality)
+ ?Type@CVtImage@@QBE?AW4TVtImageType@1@XZ @ 21 NONAME ; public: enum CVtImage::TVtImageType __thiscall CVtImage::Type(void)const
+ ?U@CVtImageIYUV@@QBEPAEXZ @ 22 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::U(void)const
+ ?UVPlaneHeight@CVtImageIYUV@@QBEHXZ @ 23 NONAME ; public: int __thiscall CVtImageIYUV::UVPlaneHeight(void)const
+ ?UVPlaneWidth@CVtImageIYUV@@QBEHXZ @ 24 NONAME ; public: int __thiscall CVtImageIYUV::UVPlaneWidth(void)const
+ ?V@CVtImageIYUV@@QBEPAEXZ @ 25 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::V(void)const
+ ?Y@CVtImageIYUV@@QBEPAEXZ @ 26 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::Y(void)const
+ ?Scale@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 27 NONAME ; void CVtImageScaler::Scale(class CVtImage const &, class CVtImage &)
+ ?Rotate@CVtImageRotator@@QAEXABVCVtImage@@AAV2@ABW4TRotationAngle@1@@Z @ 28 NONAME ; void CVtImageRotator::Rotate(class CVtImage const &, class CVtImage &, enum CVtImageRotator::TRotationAngle const &)
+ ?ScaleNowL@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 29 NONAME ; void CVtImageScaler::ScaleNowL(class CVtImage const &, class CVtImage &)
+
Binary file vtprotocolplugins/DisplaySink/data/displaysink_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/data/displaysink_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 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:
+;
+
+; Languages
+&EN
+; Header
+#{"displaysink"}, (0x101F8693), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\displaysink.dll"
+""-"z:\sys\bin\VtImageConverter.dll"
+""-"z:\sys\bin\VtImageTransforms.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/DisplaySink.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004 - 2006 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: Project definition file for Display Sink subsystem
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/DisplaySinkUids.hrh"
+
+TARGET displaysink.dll
+TARGETTYPE dll
+VENDORID VID_DEFAULT
+
+UID KSharedLibraryUidDefine KUidDisplaySinkLibrary
+
+SOURCEPATH ../src
+SOURCE CDisplaySink.cpp
+
+SOURCE CDisplaySinkNGA.cpp
+SOURCE CDisplaySinkDP.cpp
+SOURCE vtyuvconverter.cpp
+SOURCE CDisplaySinkDSA.cpp
+
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/mmf/common
+SYSTEMINCLUDE /epoc32/include/mmf/server
+
+LIBRARY featmgr.lib
+LIBRARY euser.lib
+LIBRARY mmfcontrollerframework.lib
+LIBRARY fbscli.lib
+LIBRARY vtimageconverter.lib
+LIBRARY vtimagetransforms.lib
+
+CAPABILITY CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/VtImageConverter.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2004 - 2006 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: Project definition file for Display Sink subsystem
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/VtImageConverterUids.hrh"
+
+TARGET vtimageconverter.dll
+TARGETTYPE dll
+VENDORID VID_DEFAULT
+
+UID KSharedLibraryUidDefine KUidVtImageConverterLibrary
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/libc
+
+SOURCEPATH ../src
+SOURCE CVtImageConverter.cpp
+
+LIBRARY gdi.lib
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+
+CAPABILITY CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/VtImageTransforms.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2004 - 2006 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: Project definition file for Video Source image transforms
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/CVtImageTransformsUids.hrh"
+
+TARGET vtimagetransforms.dll
+TARGETTYPE dll
+VENDORID VID_DEFAULT
+
+UID KSharedLibraryUidDefine KUidVtImageTransformsLibrary
+
+SOURCEPATH ../src
+SOURCE CVtImage.cpp
+SOURCE CVtImageBitmap.cpp
+SOURCE CVtImageIYUV.cpp
+SOURCE CVtImageScaler.cpp
+SOURCE CVtImageScalerImpl.cpp
+SOURCE CVtImageScalerImplNearest.cpp
+SOURCE CVtImageScalerImplWeightedAverage.cpp
+SOURCE CVtImageScalerImplBilinear.cpp
+SOURCE CVtImageRotator.cpp
+SOURCE CVtImageRotatorImpl.cpp
+SOURCE CVtImageRotatorImplMirrorFlip.cpp
+SOURCE CVtImageRotatorImplClockwise.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/mmf/server
+SYSTEMINCLUDE /epoc32/include/mmf/common
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY bitmaptransforms.lib
+
+CAPABILITY CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2004 - 2007 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 definition file for Display Sink subsystem.
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cvtimageconverter.h |../../../inc/cvtimageconverter.h
+../inc/cvtimageconverter.inl |../../../inc/cvtimageconverter.inl
+../inc/mdisplaysink.h |../../../inc/mdisplaysink.h
+../inc/TDisplaySinkParamsDSA.h |../../../inc/tdisplaysinkparamsdsa.h
+../inc/tdisplaysinkparamsdsa.inl |../../../inc/tdisplaysinkparamsdsa.inl
+../inc/TDisplaySinkParamsDP.h |../../../inc/tdisplaysinkparamsdp.h
+../inc/TDisplaySinkParamsNGA.h |../../../inc/tdisplaysinkparamsnga.h
+../inc/cvtimage.h |../../../inc/cvtimage.h
+../inc/CVtImageBitmap.h |../../../inc/cvtimagebitmap.h
+../inc/CVtImageIYUV.h |../../../inc/cvtimageiyuv.h
+../inc/CVtImageScaler.h |../../../inc/cvtimagescaler.h
+../inc/cvtimagerotator.h |../../../inc/cvtimagerotator.h
+
+// Export SIS stub file
+../data/displaysink_stub.SIS /epoc32/data/z/system/install/displaysink_stub.sis
+
+// Export IBY file
+../rom/DisplaySink.iby CORE_APP_LAYER_IBY_EXPORT_PATH(displaysink.iby)
+
+PRJ_MMPFILES
+VtImageTransforms.mmp
+VtImageConverter.mmp
+DisplaySink.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySink.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,671 @@
+/*
+* Copyright (c) 2004 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: DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINK_H
+#define CDISPLAYSINK_H
+
+// INCLUDE FILES
+
+#include <bldvariant.hrh>
+#include <e32base.h>
+#include <mmfutilities.h>
+#include <mmfdatasource.h>
+#include <mmfdatasink.h>
+#include <fbs.h>
+#include <mvtprotocolhandler.h>
+
+#include "mdisplaysink.h"
+
+// CONSTANTS
+
+// QCIF size
+#define QCIF TSize( 176, 144 )
+
+// Number of bitmap sets (big/small) in array
+const TInt KBitmapTableCount = 2;
+
+// FORWARD DECLARATIONS
+
+class CDisplaySink;
+class CVTYUVFbsBitmapConverter;
+class CVtCallback;
+class CVtImageIYUV;
+class CMMFDataBuffer;
+class CVtFrameQueue;
+
+// CLASS DECLARATION
+
+/**
+* CVtFrameQueue
+*
+* Storage class for DisplaySink. Used in situations where EmptyBufferL() is
+* called and there's no available bitmaps (or buffers). This class will
+* hold one buffer until next SetBitmapAvailable() is called. Instance operates
+* in protocol thread's active scheduler.
+*
+* @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CVtFrameQueue ) : public CActive
+ {
+
+public: // new methods
+ /**
+ * C++ constructor.
+ */
+ CVtFrameQueue();
+
+ /**
+ * Adds this to protocol thread's active scheduler.
+ */
+ TInt ThreadLogon();
+
+ /**
+ * Releases stored buffer, when sink is stopped.
+ */
+ void SinkStoppedL();
+
+ /**
+ * Deques from protocol thread's active scheduler.
+ */
+ void ThreadLogoff();
+
+ /**
+ * Stores buffer & supplier.
+ */
+ void Store( MVTVideoSource& aSupplier, CMMFDataBuffer* aBuffer, TSize aFrameSize, TPtr8& aPtr );
+
+ /**
+ * Returns ETrue if buffer is being stored, EFalse otherwise.
+ */
+ TBool IsStored() const;
+
+ /**
+ * Returns stored buffer.
+ */
+ TVtMMFDataBuffer Buffer();
+
+ /**
+ * Releases stored buffer. Supplier's BufferEmptiedL() is called. Call
+ * is executed in protocol thread's context.
+ */
+ void Release();
+
+private:
+
+ /**
+ * Calls BufferEmptiedL() for supplier. This call always happens in protocol
+ * thread context.
+ * @param aBuffer Pointer reference to a buffer to be released.
+ */
+ void DoReleaseBufferL( CMMFDataBuffer*& aBuffer );
+
+private: // from CActive
+ /**
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ /**
+ * @see CActive::DoCancel
+ */
+ void DoCancel();
+
+private:
+ // Stored supplier
+ MVTVideoSource* iSupplier;
+ // Stored buffer
+ CMMFDataBuffer* iBuffer;
+
+ TSize iFrameSize;
+ TPtr8* iPtr;
+ // Pre-opened thread object that is used for signalling the delayed
+ // BufferEmptiedL() call
+ RThread iThread;
+ // Buffer to be released on next RunL()
+ CMMFDataBuffer* iReleaseBuffer;
+ };
+
+/**
+* CVtCallback
+*
+*
+* @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CVtCallback ) : public CActive
+ {
+
+private:
+
+ /**
+ * Callback type. Currently only size changes are supported. If new callback
+ * types are needed, add them here.
+ */
+ enum TCallBackType
+ {
+ EVideoFrameSizeChanged
+ };
+
+public:
+
+ /**
+ * C++ constructor.
+ */
+ CVtCallback( MDisplaySinkObserver& aObserver );
+
+ /**
+ * C++ destructor.
+ */
+ ~CVtCallback();
+
+ /**
+ * Video frame size has been changed. Old and new size are given as
+ * parameter.
+ */
+ void VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo );
+
+ /**
+ * Returns callback result.
+ */
+ TInt Result() const;
+
+ /**
+ * Boolean variable that tells wether or not call back has been served.
+ */
+ TBool Completed() const;
+
+private:
+
+ /**
+ * Issues callback. Because callback receiver can be in same or different
+ * thread this is made as own function that checks whether or not other
+ * thread needs to be signalled.
+ */
+ void IssueCallbackL();
+
+private: // from CActive
+
+ /**
+ * See CActive documentation.
+ */
+ void RunL();
+
+ /**
+ * See CActive documentation.
+ */
+ void DoCancel();
+
+ /**
+ * See CActive documentation.
+ */
+ TInt RunError( TInt aError );
+
+private:
+
+ // Owner thread's id
+ TThreadId iOwnThreadId;
+
+ // Pointer to observer
+ MDisplaySinkObserver* iObserver;
+
+ // Callback type
+ TCallBackType iCallBackType;
+
+ // Old size
+ TSize iFrom;
+
+ // New size
+ TSize iTo;
+
+ // Callback result
+ TInt iResult;
+
+ // Has callback been completed?
+ TBool iCompleted;
+ };
+
+
+/**
+* MVTVideoSink interface implementation
+*
+* @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CDisplaySink ) : public CBase, public MDisplaySink,
+ public MVTVideoSink
+{
+protected: // inner classes
+
+ // Structure containing bitmap related data
+ class TBitmapEntry
+ {
+ public: // data
+
+ // ETrue if this bitmap entry is free
+ TBool iIsFree;
+ };
+
+private: // from MDisplaySink
+
+ /**
+ * @see MDisplaySink::Destroy
+ */
+ void Destroy();
+
+ /**
+ * @see MDisplaySink::SetBitmapAvailable
+ */
+ void SetBitmapAvailable( TBitmapNo aBitmapNo );
+
+ /**
+ * @see MDisplaySink::Release
+ */
+ void Release();
+
+ /**
+ * @see MDisplaySink::UpdateSinkParamsL
+ */
+ void UpdateSinkParamsL( const TDisplaySinkParams& aParams, TBool& aUpdated );
+
+ /**
+ * @see MDisplaySink::Pause
+ */
+ void Pause();
+
+ /**
+ * @see MDisplaySink::Resume
+ */
+ void Resume();
+
+ /**
+ * @see MDisplaySink::operator MVTVideoSink&
+ */
+ operator MVTVideoSink&();
+
+ /**
+ * @see MDisplaySink::NextFrame
+ */
+ void NextFrame();
+
+private: // from MVTVideoSink
+ /**
+ * From MVTVideoOutput. See MVTVideoOutput for description.
+ */
+ virtual void SetFormatL( const TDesC8& aFormat );
+
+ /**
+ * From MVTVideoOutput. See MVTVideoOutput for description.
+ */
+ virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * From MVTVideoOutput. See MVTVideoOutput for description.
+ */
+ virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual void EmptyBufferL(
+ TVtMMFDataBuffer aDataBuffer,
+ MVTVideoSource* aSupplier,
+ TMediaId aMediaId );
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual void BufferFilledL( CMMFBuffer* aBuffer );
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TBool CanCreateSinkBuffer();
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual CMMFBuffer* CreateSinkBufferL(
+ TMediaId aMediaId,
+ TBool &aReference );
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual void SinkThreadLogoff();
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TInt SinkPrimeL();
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TInt SinkPlayL();
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TInt SinkPauseL();
+
+ /**
+ * From MVTVideoSink. See MVTVideoSink for description.
+ */
+ virtual TInt SinkStopL();
+
+private:
+ const RArray<TDesC8* >& GetMultimediaTypesL() const;
+
+
+protected: // Constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CDisplaySink();
+
+ /**
+ * Destructor.
+ */
+ ~CDisplaySink();
+
+protected: // New functions
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ * @param "aParams" Initialization parameters.
+ * @param "aInitData" Initialization parameters. Not used.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL( TDisplaySinkParams& aParams, const TDesC8& aInitData );
+
+ /**
+ * Thread logon that may leave. This will be trapped and possible
+ * error code is returned to the caller of SinkThreadLogon().
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void SinkThreadLogonL();
+
+ /**
+ * Sets limit for displaysink frame rate.
+ */
+ void SetFrameRateLimit(
+ TDisplaySinkParams::TFrameRateLimit aFrameRateLimit );
+
+ /**
+ * Resets frame rate limitter.
+ */
+ void ResetFrameRateLimitter();
+
+ /**
+ * Does frame rate limitter validation and also checks if sink is paused.
+ */
+ TBool IsOkToSendFrame();
+
+ /**
+ * Opens fbs session and sets flag, if open succeeds.
+ */
+ void FbsConnectL();
+
+ /**
+ * Opens VT engine thread.
+ */
+ void ThreadOpenL();
+
+ /**
+ * Closes fbs session (if open succeeded earlier).
+ */
+ void FbsDisconnect();
+
+ /**
+ * Closes VT thread (if open succeeded earlier).
+ */
+ void ThreadClose();
+
+ /**
+ * Cleanup operation for SinkThradLogon.
+ */
+ static void SinkThreadLogonCleanup( TAny* aPtr );
+
+private: // new methods implemented in derived classes
+
+ /**
+ * Called from ConstructL() to allow inherited classes to do their own
+ * construction.
+ */
+ virtual void BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData ) = 0;
+
+ /**
+ * Converts image. Calls DoConvertL() to do the task.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ virtual TBool BaseConvert( const TVtMMFDataBuffer& aBuffer ) = 0;
+
+ /**
+ * Called from SinkThreadLogonL().
+ */
+ virtual void BaseSinkThreadLogonL() = 0;
+
+ /**
+ * Called from SinkThreadLogogg().
+ */
+ virtual void BaseSinkThreadLogoff() = 0;
+
+ /**
+ * Called from UpdateSinkParamsL().
+ */
+ virtual void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams ) = 0;
+
+ /**
+ * Updates sink params.
+ * @exception May leave with one of the system wide error codes (e.g. in
+ * out of memory situaton).
+ */
+ virtual void BaseDoUpdateParamsL() = 0;
+
+ /**
+ * Called when video frame size is set.
+ * @exception May leave with one of the system wide error codes (e.g. in
+ * out of memory situaton).
+ */
+ virtual void BaseSetVideoFrameSizeL( const TSize& aSize ) = 0;
+
+ /**
+ * Returns ETrue if given frame size matches with expected frame size.
+ * Implemented in derived classes because in some cases (e.g. when rotation
+ * is enabled), size calculation is more complicated.
+ */
+ virtual TBool BaseSizesMatch( const TSize& aSize ) = 0;
+
+ /**
+ * Returns reference to TBitmapEntry.
+ */
+ virtual TBitmapEntry& BitmapEntry( TInt aIndex ) = 0;
+
+ /**
+ * EmptyBuffer handling.
+ */
+ virtual void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer ) = 0;
+
+ /**
+ * Bitmap availability handling.
+ */
+ virtual void BaseSetBitmapAvailable( TBitmapNo aBitmapNo ) = 0;
+
+ /**
+ * Called when source frame size changes.
+ */
+ virtual void BaseVideoFrameSizeChangedL( const TSize& aNewSize ) = 0;
+
+protected: // Data
+
+ // Video source that provides buffer filled with video frame(s)
+ MVTVideoSource* iSupplier;
+
+ // Event handler to notify events
+ MAsyncEventHandler* iEventHandler;
+
+ // Buffer containing video frame(s) and to be converted
+ CMMFBuffer* iBuffer;
+
+ // Sink data type code as fourCC code
+ TFourCC iSinkFourCC;
+
+ // Sink state enumeration
+ enum TState
+ {
+ EStopped,
+ EPrimed,
+ EPlaying
+ };
+
+ // Sink state
+ TState iState;
+
+ // Array of MIME types supported by sink
+ RArray<TDesC8* > iVTMimeTypes;
+
+ // Video frame size
+ TSize iFrameSize;
+
+ // Thread ID of thread to notify after video frame is converted
+ TThreadId iThreadId;
+
+ // Handle to thread to notify after video frame is converted
+ RThread iThread;
+
+ // Pointer to iStatus member of the Active Object to notify
+ // after video frame is converted
+ TRequestStatus* iRequestStatusPtr;
+
+ // Critical section to serialize access to iBitmapTable
+ RCriticalSection iBitmapCS;
+
+ // Semaphore to force thread context switch after video frame
+ // is converted
+ RSemaphore iSync;
+
+
+ // This is set to ETrue when new params are set, this pointer
+ // is also used as flag when parameter update is requested.
+ TBool* iParamsUpdated;
+
+ // This flag variable will be set to ETrue when sink parameters
+ // need to be updated (e.g. when frame size changes from QCIF
+ // to Sub QCIF or vice versa)
+ TBool iWaitingForUpdate;
+
+ // Contains expected frame size (this is taken from given bitmaps).
+ TSize iExpectedFrameSize;
+
+ // Active object that will call callbacks to VT engine in VT
+ // engine's thread context.
+ CVtCallback* iVTSignaller;
+
+ // If ETrue, sink does not convert data that is given to it
+ TBool iReleased;
+
+ // Output MIME type holder
+ TBuf8< 128 > iYuv420PlanarDesc;
+
+ // Frame rate interval in milliseconds
+ TInt iFrameRateInterval;
+
+ // Time since last frame was sent (in milliseconds)
+ TInt iMilliSecondsSinceLastFrame;
+
+ // Time stamp for last frame sent
+ TTime iLastFrameTime;
+
+ // When paused remote video will no be sent to VT engine
+ TBool iPaused;
+
+ // DisplaySink params flags
+ TUint32 iDSFlags;
+
+ // Is set to ETrue when SinkThreadLogon() is called.
+ TUint32 iInitFlags;
+
+ // Initialization flags
+ enum TInitFlags
+ {
+ // This flag is set, when SinkThreadLogon() is called
+ ESinkThreadLogonCalled = ( 1 << 0 ),
+
+ // This flag is set, when FbsSession has been connected
+ EFbsSessionConnected = ( 1 << 1 ),
+
+ // This flag is set, when handle to Sink Thread has been opened
+ EThreadOpened = ( 1 << 2 )
+ };
+
+ // Frame queue for holding for holding frames until target conversion
+ // buffer is ready.
+ CVtFrameQueue* iVideoFrameQueue;
+
+ // friend classes
+
+
+ };
+
+/**
+* Safe cleanup for synchronization primitives.
+*
+* @lib DisplaySink.lib
+*/
+template < class T >
+class CleanupSignal
+ {
+public:
+ static void PushL( T& aPtr );
+private:
+ static void Signal( TAny *aPtr );
+ };
+
+template < class T >
+void CleanupSignal< T >::PushL( T& aRef )
+ {
+ CleanupStack::PushL( TCleanupItem( &Signal, &aRef ) );
+ }
+
+template < class T >
+void CleanupSignal< T >::Signal( TAny *aPtr )
+ {
+ static_cast< T* >( aPtr )->Signal();
+ }
+
+/**
+* Pushes signalable object into cleanup stack.
+*/
+template < class T >
+void CleanupSignalPushL( T& aRef )
+ {
+ CleanupSignal< T >::PushL( aRef );
+ }
+
+#endif // CDISPLAYSINK_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkDP.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2004 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: DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINKDP_H
+#define CDISPLAYSINKDP_H
+
+// INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsDP.h"
+
+// CLASS DECLARATION
+
+/**
+* Displaysink implementation for Display Posting.
+*
+* @lib displaysink.lib
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkDP ) : public CDisplaySink
+ {
+public: // static constructor
+
+ /**
+ * Static constructor that may leave.
+ */
+ static CDisplaySinkDP* NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CDisplaySinkDP();
+
+ /**
+ * destructor
+ */
+ ~CDisplaySinkDP();
+
+private: // from CDisplaySink
+
+ /**
+ * @see CDisplaySink::BaseConstructL
+ */
+ void BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+ /**
+ * @see CDisplaySink::BaseConvert
+ */
+ TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogonL
+ */
+ void BaseSinkThreadLogonL();
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogoff
+ */
+ void BaseSinkThreadLogoff();
+
+ /**
+ * @see CDisplaySink::BaseUpdateSinkParamsL
+ */
+ void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseDoUpdateParamsL();
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BaseSizesMatch
+ */
+ TBool BaseSizesMatch( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BitmapEntry
+ */
+ TBitmapEntry& BitmapEntry( TInt aIndex );
+
+ /**
+ * @see CDisplaySink::BaseEmptyBufferL
+ */
+ void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSetBitmapAvailable
+ */
+ void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+ /**
+ * @see CDisplaySink::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // MDisplaySink
+
+ /**
+ * @see MDisplaySink::NextFrame
+ */
+ void NextFrame();
+
+private: // new methods
+
+ /**
+ * Updates expected frame size.
+ * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+ */
+ void UpdateExpectedFrameSizeL();
+
+private: // new classes
+
+ // Class posting buffer related data
+ class TBitmapEntryDP : public TBitmapEntry
+ {
+ public: // data
+
+ // Pointer to Posting Buffer pointer
+ CPostingSurface::TPostingBuff** iBuffer;
+ };
+
+private: // data
+
+ // Array of bitmap related structures
+ TBitmapEntryDP iBitmapTable[ KBitmapTableCount ];
+
+ // Store for saving new parameters in UpdateSinkParamsL() call
+ TDisplaySinkParamsDP iNewParams;
+ };
+
+#endif // CDISPLAYSINKDP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkDSA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2004 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: DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINKDSA_H
+#define CDISPLAYSINKDSA_H
+
+// INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsDSA.h"
+
+// CLASS DECLARATION
+
+/**
+* Displaysink implementation for Direct Screen access.
+*
+* @lib displaysink.lib
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkDSA ) : public CDisplaySink,
+ public MVtImageRotatorObserver
+ {
+public: // static constructor
+
+ /**
+ * Static constructor that may leave.
+ */
+ static CDisplaySinkDSA* NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CDisplaySinkDSA();
+
+ /**
+ * destructor
+ */
+ ~CDisplaySinkDSA();
+
+private: // from CDisplaySink
+
+ /**
+ * @see CDisplaySink::BaseConstructL
+ */
+ void BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+ /**
+ * @see CDisplaySink::BaseConvert
+ */
+ TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogonL
+ */
+ void BaseSinkThreadLogonL();
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogoff
+ */
+ void BaseSinkThreadLogoff();
+
+ /**
+ * @see CDisplaySink::BaseUpdateSinkParamsL
+ */
+ void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseDoUpdateParamsL();
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BaseSizesMatch
+ */
+ TBool BaseSizesMatch( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BitmapEntry
+ */
+ TBitmapEntry& BitmapEntry( TInt aIndex );
+
+ /**
+ * @see CDisplaySink::BaseEmptyBufferL
+ */
+ void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSetBitmapAvailable
+ */
+ void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+ /**
+ * @see CDisplaySink::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // from MVtImageRotatorObserver
+
+ /**
+ * @see MVtImageRotatorObserver::RotationFinished
+ */
+ void RotationFinished( TInt aError );
+
+private: // new methods
+
+ /**
+ * Updates expected frame size.
+ * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+ */
+ void UpdateExpectedFrameSizeL();
+
+ /**
+ * Converts image. Calls DoConvertL() to do the task.
+ * @param "aBitmapNo" CFbsBitmap number to use for converted image.
+ * @param "aConverted" Reference to boolean that will be ETrue if buffer
+ * was converted, EFalse otherwise.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ void ConvertL( const TPtrC8& aBuffer, TBool& aConverted );
+
+ /**
+ * Convert YUV420Planar image to a CFbsBitmap.
+ * @param "aBitmapNo" CFbsBitmap number to use for converted image.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ void DoConvertL( const TPtrC8& aBuffer, TBitmapNo aBitmapNo );
+
+private: // new classes
+
+ // Class containing bitmap related data
+ class TBitmapEntryDSA : public TBitmapEntry
+ {
+ public: // data
+
+ // Handle to target bitmap
+ TInt iHandle; // QCIF
+ };
+
+private: // data
+
+ // Array of bitmap related structures
+ TBitmapEntryDSA iBitmapTable[ KBitmapTableCount ];
+
+ // Converter for bitmap 1, created into Protocol thread's heap
+ CVTYUVFbsBitmapConverter* iYUVBitmapConverter1; // owned
+
+ // Converter for bitmap 2, created into Protocol thread's heap
+ CVTYUVFbsBitmapConverter* iYUVBitmapConverter2; // owned
+
+ // Converter for bitmap, created into VT thread's heap
+ CVTYUVFbsBitmapConverter* iYUVBitmapConverterVT;
+
+ // Pointer to image rotator instance.
+ CVtImageRotator* iRotator; // owned
+
+ // Source YUV image for image transforms
+ CVtImageIYUV* iSourceImg;
+
+ // Target YUV image for image transforms
+ CVtImageIYUV* iTargetImg;
+
+ // Rotation angle
+ CVtImageRotator::TRotationAngle iRotationAngle;
+
+ // Store for saving new parameters in UpdateSinkParamsL() call
+ TDisplaySinkParamsDSA iNewParams;
+ };
+
+#endif // CDISPLAYSINKDSA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkNGA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2004-2006 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: Displaysink implementation for NGA.
+*
+*/
+
+#ifndef CDISPLAYSINKNGA_H
+#define CDISPLAYSINKNGA_H
+
+// INCLUDE FILES
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsNGA.h"
+
+// CLASS DECLARATION
+
+/**
+* Displaysink implementation for NGA.
+*
+* @lib displaysink.lib
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkNGA ) : public CDisplaySink
+ {
+public: // static constructor
+
+ /**
+ * Static constructor that may leave.
+ */
+ static CDisplaySinkNGA* NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CDisplaySinkNGA();
+
+ /**
+ * destructor
+ */
+ ~CDisplaySinkNGA();
+
+private: // from CDisplaySink
+
+
+ /**
+ * @see CDisplaySink::BaseConstructL
+ */
+ void BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+ /**
+ * @see CDisplaySink::BaseConvert
+ */
+ TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogonL
+ */
+ void BaseSinkThreadLogonL();
+
+ /**
+ * @see CDisplaySink::BaseSinkThreadLogoff
+ */
+ void BaseSinkThreadLogoff();
+
+ /**
+ * @see CDisplaySink::BaseUpdateSinkParamsL
+ */
+ void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseDoUpdateParamsL();
+
+ /**
+ * @see CDisplaySink::BaseDoUpdateParamsL
+ */
+ void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BaseSizesMatch
+ */
+ TBool BaseSizesMatch( const TSize& aSize );
+
+ /**
+ * @see CDisplaySink::BitmapEntry
+ */
+ TBitmapEntry& BitmapEntry( TInt aIndex );
+
+ /**
+ * @see CDisplaySink::BaseEmptyBufferL
+ */
+ void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+ /**
+ * @see CDisplaySink::BaseSetBitmapAvailable
+ */
+ void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+ /**
+ * @see CDisplaySink::BaseVideoFrameSizeChangedL
+ */
+ void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // MDisplaySink
+
+ /**
+ * @see MDisplaySink::NextFrame
+ */
+ void NextFrame();
+
+private: // new methods
+
+ /**
+ * Updates expected frame size.
+ * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+ */
+ void UpdateExpectedFrameSizeL();
+
+private: // new classes
+
+ // Class submit buffer related data
+ class TBitmapEntryNGA : public TBitmapEntry
+ {
+ public: // data
+
+ // Pointer to Surface Buffer pointer
+ //TVideoFrameBuffer** iBuffer;
+ TUint8** iBuffer;
+ };
+
+private: // data
+
+ // Array of bitmap related structures
+ TBitmapEntryNGA iBitmapTable[ KBitmapTableCount ];
+
+ // Store for saving new parameters in UpdateSinkParamsL() call
+ TDisplaySinkParamsNGA iNewParams;
+ };
+
+#endif // CDISPLAYSINKNGA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageBitmap.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEBITMAP_H
+#define CVTIMAGEBITMAP_H
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// FORWARD DECLARATIONS
+
+class CFbsBitmap;
+
+// CLASS DECLARATIONS
+
+/**
+* CFbsBitmap image implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageBitmap : public CVtImage
+ {
+ public:
+
+ /**
+ * Creates new instance of CVtImageBitmap.
+ * @param "aBitmapHandle" Handle of bitmap to "bind" this instance to.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageBitmap* NewL( TInt aBitmapHandle );
+
+ /**
+ * Creates new instance of CVtImageBitmap.
+ * @param "aSize" Size of the image in pixels.
+ * @param "aDisplayMode" Display mode of the image.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageBitmap* NewL(
+ const TSize& aSize,
+ TDisplayMode aDisplayMode );
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVtImageBitmap();
+
+ /**
+ * Resizes the image to new dimension.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @param "aSize" New size of the image in pixels.
+ */
+ IMPORT_C void ResizeL( const TSize& aSize );
+
+ /**
+ * Sets new bitmap this image references to.
+ * @param "aBitmapHandle" Handle of the bitmap this image will be
+ * referencing to.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void SetBitmapL( TInt aBitmapHandle );
+
+ /**
+ * Returns constant reference to CFbsBitmap owned by this instance.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Constant reference to CFbsBitmap.
+ */
+ IMPORT_C CFbsBitmap& Bitmap() const;
+
+ public: // from CVtImage
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TBool NeedHeapLock() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TVtDisplayMode DisplayMode() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TSize Size() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TInt BytesPerRow() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TUint32* DataAddress() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TUint32* LineAddress( TInt aLine ) const;
+
+ private:
+
+ /**
+ * C++ constructor.
+ */
+ CVtImageBitmap();
+
+ /**
+ * Second phase constructor.
+ * @param "aSize" Size of the image in pixels.
+ * @param "aDisplayMode" Display mode of the image.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ConstructL( const TSize& aSize, TDisplayMode aDisplayMode );
+
+ /**
+ * Second phase constructor.
+ * @param "aBitmapHandle" Handle of bitmap to "bind" this instance to.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ConstructL( TInt aBitmapHandle );
+
+ private:
+
+ // CFbsImage this image instance references to
+ CFbsBitmap* iBitmap; // owned
+ };
+
+
+#endif // CVTIMAGEBITMAP_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageIYUV.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEIYUV_H
+#define CVTIMAGEIYUV_H
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// CLASS DECLARATIONS
+
+/**
+* CFbsBitmap image implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageIYUV : public CVtImage
+ {
+ public:
+
+ /**
+ * Creates new instance of CVtImageIYUV.
+ * @param "aSize" Size of the image in pixels.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize );
+
+ /**
+ * Creates new instance of CVtImageIYUV.
+ * @param "aSize" Size of the image in pixels.
+ * @param "aImage" Image data as 8-bit descriptor. Image data is copied into
+ * this instance.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, const TDesC8& aImage );
+
+ /**
+ * Creates new instance of CVtImageIYUV.
+ * @param "aSize" Size of the image in pixels.
+ * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
+ * and thus changes to this instance will be visible in the caller descriptor
+ * as well. Also descriptor must remain accessible lifetime of the current
+ * instance or until new non-referenced image is set.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, TPtr8& aImage );
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVtImageIYUV();
+
+ /**
+ * Updates image with given data.
+ * @param "aImage" New image.
+ * @param "aImage" Image data as 8-bit descriptor. Image data is copied into
+ * this instance.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void SetImageL( const TDesC8& aImage );
+
+ /**
+ * Updates image with given data.
+ * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
+ * and thus changes to this instance will be visible in the caller descriptor
+ * as well. Also descriptor must remain accessible lifetime of the current
+ * instance or until new non-referenced image is set.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void SetImageL( TPtr8& aImage );
+
+ /**
+ * Returns image as descriptor.
+ * @return Image as 8-bit descriptor.
+ */
+ IMPORT_C TPtrC8 Image() const;
+
+ /**
+ * Returns pointer to Y plane of this image.
+ * @return Pointer to Y plane of this image.
+ */
+ IMPORT_C TUint8* Y() const;
+
+ /**
+ * Returns pointer to U plane of this image.
+ * @return Pointer to U plane of this image.
+ */
+ IMPORT_C TUint8* U() const;
+
+ /**
+ * Returns pointer to V plane of this image.
+ * @return Pointer to V plane of this image.
+ */
+ IMPORT_C TUint8* V() const;
+
+ /**
+ * Returns width of the U and V plane in bytes.
+ * @return Width of the U and V plane in bytes.
+ */
+ IMPORT_C TInt UVPlaneWidth() const;
+
+ /**
+ * Returns height of the U and V plane in bytes.
+ * @return Height of the U and V plane in bytes.
+ */
+ IMPORT_C TInt UVPlaneHeight() const;
+
+ public: // from CVtImage
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TBool NeedHeapLock() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TVtDisplayMode DisplayMode() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TSize Size() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TInt BytesPerRow() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TUint32* DataAddress() const;
+
+ /**
+ * From CVtImage. See CVtImage for description.
+ */
+ TUint32* LineAddress( TInt aLine ) const;
+
+
+ private:
+
+ /**
+ * Returns size of the image in bytes (all planes
+ * included).
+ * @return Size of the image in bytes.
+ */
+ TInt ImageSize() const;
+
+ /**
+ * C++ constructor.
+ */
+ CVtImageIYUV( const TSize& aSize );
+
+ /**
+ * Second phase constructor.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ConstructL( const TDesC8* aImage );
+
+ /**
+ * Validates given size.
+ * @exception If the size is not correct leaves with KErrArgument.
+ */
+ void ValidateSizeL( const TSize& aSize );
+
+ /**
+ * Checks the size of the given descriptor against required size.
+ * @exception If the size is not correct leaves with KErrArgument.
+ */
+ void CheckDescriptorSizeL( const TDesC8& aImage );
+
+ /**
+ * Sets Y, U and V plane pointers.
+ */
+ void SetYUVPointers();
+ private:
+
+ // Size of the image
+ TSize iSize;
+
+ // Image data
+ HBufC8* iImage; // owned
+
+ // Image data ptr descriptor
+ TPtr8 iPtrImage;
+
+ // Ptr to Y plane
+ TUint8* iY;
+
+ // Ptr to U plane
+ TUint8* iU;
+
+ // Ptr to V plane
+ TUint8* iV;
+ };
+
+
+#endif // CVTIMAGEIYUV_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImpl.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPL_H
+#define CVTIMAGEROTATORIMPL_H
+
+// INCLUDE FILES
+
+#include "cvtimagerotator.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+* Image scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageRotatorImpl : public CBase
+ {
+ public:
+
+ /**
+ * Sets scaler params.
+ * @param "aParams" Scaling params, including source and target images.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void SetSourceTargetL( const CVtImage& aSource, CVtImage& aTarget );
+
+ /**
+ * Method to check whether bitmap heap locking is needed or not during
+ * scaling process.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return ETrue if bitmap heap lock is needed, EFalse otherwise.
+ */
+ TBool NeedHeapLock() const;
+
+ /**
+ * Pure virtual rotation method.
+ * @param "aContinue" When method returns, this parameter will contain
+ * ETrue if new call is needed (i.e. scaling is not yet finished) or
+ * EFalse if scaling is complete.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ virtual TInt Rotate( TBool& aContinue ) = 0;
+
+ /**
+ * Pure virtual method for checking specific rotation angle support.
+ * @param "aAngle" Rotation type that will be needed.
+ * @return ETrue if aAngle is one of the supported rotation types
+ * EFalse otherwise.
+ */
+ virtual TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle ) = 0;
+
+ /**
+ * Sets rotation angle to be used.
+ * @param "aAngle" Rotation type that will be needed.
+ */
+ void SetAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+ protected:
+
+ /**
+ * C++ constructor.
+ * @param "aAngle" Rotation type that will be needed.
+ */
+ CVtImageRotatorImpl( const CVtImageRotator::TRotationAngle& aAngle );
+
+ private:
+
+ /**
+ * Pure virtual source and target image validation method.
+ * @param "aSource" Constant reference to source image.
+ * @param "aTarget" Constant reference to target image.
+ * @exception If source or target is not valid, this method leaves
+ * with KErrNotSupported.
+ */
+ virtual void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget ) = 0;
+
+ protected:
+
+ // Source for scaling
+ const CVtImage* iSource; // not owned
+
+ // Target image (will hold scaled source)
+ CVtImage* iTarget; // not owned
+
+ // Selected rotation angle
+ CVtImageRotator::TRotationAngle iAngle;
+ };
+
+#endif // CVTIMAGEROTATORIMPL_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplClockwise.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPLCLOCKWISE_H
+#define CVTIMAGEROTATORIMPLCLOCKWISE_H
+
+// INCLUDE FILES
+
+#include "CVtImageRotatorImpl.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+* Image scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageRotatorImplClockwise : public CVtImageRotatorImpl
+ {
+ public:
+ /**
+ * C++ constructor
+ * @param "aAngle" Selected rotation angle.
+ */
+ CVtImageRotatorImplClockwise( const CVtImageRotator::TRotationAngle& aAngle );
+
+ /**
+ * Rotates the image.
+ * @param "aContinue" When method returns, this parameter will contain
+ * ETrue if new call is needed (i.e. scaling is not yet finished) or
+ * EFalse if scaling is complete.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ TInt Rotate( TBool& aContinue );
+
+ /**
+ * Source and target image validation method.
+ * @param "aSource" Constant reference to source image.
+ * @param "aTarget" Constant reference to target image.
+ * @exception If source or target is not valid, this method leaves
+ * with KErrNotSupported.
+ */
+ void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget );
+
+ /**
+ * Method for checking specific rotation angle support.
+ * @param "aAngle" Rotation type that will be needed.
+ * @return ETrue if aAngle is one of the supported rotation types
+ * EFalse otherwise.
+ */
+ TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+ private:
+
+ /**
+ * The rotation implementation.
+ */
+ void DoRotate();
+
+ /**
+ * The rotation implementation for YUV planes.
+ * @param "aSource" Constant pointer to source plane.
+ * @param "aTarget" Pointer to target plane.
+ * @param "aWidth" Width of the plane in pixels.
+ * @param "aHeight" Height of the plane in pixels.
+ * @param "aBytesPerRow" Bytes per row in plane.
+ */
+ void RotatePlane(
+ const TUint8* aSource,
+ TUint8* aTarget,
+ TInt aSourceWidth,
+ TInt aSourceHeight,
+ TInt aSourceBytesPerRow,
+ TInt aTargetHeight,
+ TInt aTargetBytesPerRow );
+ };
+
+#endif // CVTIMAGEROTATORIMPLCLOCKWISE_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplMirrorFlip.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPLMIRRORFLIP_H
+#define CVTIMAGEROTATORIMPLMIRRORFLIP_H
+
+// INCLUDE FILES
+
+#include "CVtImageRotatorImpl.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+class CVtImageIYUV;
+
+// CLASS DECLARATIONS
+
+/**
+* Image scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageRotatorImplMirrorFlip : public CVtImageRotatorImpl
+ {
+ public:
+ /**
+ * C++ constructor
+ * @param "aAngle" Selected rotation angle.
+ */
+ CVtImageRotatorImplMirrorFlip( const CVtImageRotator::TRotationAngle& aAngle );
+
+ /**
+ * Rotates the image.
+ * @param "aContinue" When method returns, this parameter will contain
+ * ETrue if new call is needed (i.e. scaling is not yet finished) or
+ * EFalse if scaling is complete.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ TInt Rotate( TBool& aContinue );
+
+ /**
+ * Source and target image validation method.
+ * @param "aSource" Constant reference to source image.
+ * @param "aTarget" Constant reference to target image.
+ * @exception If source or target is not valid, this method leaves
+ * with KErrNotSupported.
+ */
+ void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget );
+
+ /**
+ * Method for checking specific rotation angle support.
+ * @param "aAngle" Rotation type that will be needed.
+ * @return ETrue if aAngle is one of the supported rotation types
+ * EFalse otherwise.
+ */
+ TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+ private:
+
+ /**
+ * Mirrors image horizontally from iSource to iTarget.
+ */
+ void Mirror();
+
+ /**
+ * Mirrors image horizontally from aTarget to aTarget.
+ */
+ void Mirror( CVtImage& aTarget );
+
+ /**
+ * Mirrors IYUV image from iSource to iTarget.
+ */
+ void MirrorIYUV
+ (
+ const CVtImageIYUV& aSource,
+ CVtImageIYUV& aTarget
+ );
+
+ /**
+ * Mirrors one plane of IYUV image from iSource to iTarget.
+ */
+ void MirrorPlane
+ (
+ TUint8* aSource,
+ TUint8* aTarget,
+ TInt aWidth,
+ TInt aHeight,
+ TInt aBytesPerRow
+ );
+
+ /**
+ * Flips image vertically from iSource to iTarget.
+ */
+ void Flip();
+
+ /**
+ * Flips image vertically from aTarget to aTarget.
+ */
+ void Flip( CVtImage& aTarget );
+
+ /**
+ * Flips IYUV image vertically from iSource to iTarget.
+ */
+ void FlipIYUV
+ (
+ const CVtImageIYUV& aSource,
+ CVtImageIYUV& aTarget
+ );
+
+ /**
+ * Flips one plane of IYUV.
+ */
+ void FlipPlane
+ (
+ TUint8* aSource,
+ TUint8* aTarget,
+ TInt aHeight,
+ TInt aBytesPerRow
+ );
+ };
+
+#endif // CVTIMAGEROTATORIMPLMIRRORFLIP_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScaler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGESCALER_H
+#define CVTIMAGESCALER_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImageScalerImpl;
+class CVtImage;
+class CFbsBitmap;
+
+// CLASS DECLARATIONS
+
+/**
+* Image scaler observer interface.
+*
+* @lib videosource.lib
+*/
+class MVtImageScalerObserver
+ {
+ public:
+ /**
+ * Callback method that is called by CVtImageScaler when scaling has
+ * finished.
+ * @param "aError" KErrNone if the scaling was done successfully, one
+ * of the system wide error codes otherwise.
+ * @return Pointer to newly created instance.
+ */
+ virtual void ScalingFinished( TInt aError ) = 0;
+ };
+
+/**
+* Image scaler.
+*
+* @lib videosource.lib
+*/
+class CVtImageScaler : public CActive
+ {
+ public:
+
+ /**
+ * An enumeration within the CVtImageScaler namespace.
+ * It provides a set of panic codes that may happen during
+ * scaling process.
+ */
+ enum TPanics
+ {
+ /**
+ * RotateL() is called while previous rotation process
+ * has not yet been finished.
+ */
+ EBusy = 1
+ };
+
+ /**
+ * An enumeration within the CVtImageScaler namespace.
+ * It provides a set of supported scaling quality settings.
+ */
+ enum TQuality
+ {
+ /**
+ * Nearest neigbour algorithm. Fast but poor image quality
+ * when scale factor exceeds 2x.
+ */
+ ENearest,
+
+ /**
+ * Weighted average algorithm. Slower than Nearest Neighbour
+ * but also better image quality when scaling at factor 2x or
+ * higher.
+ */
+ EWeightedAverage,
+
+ /**
+ * Bilinear scaling algorithm. Slower than Weighted Average
+ * but also better image quality.
+ */
+ EBilinear
+ };
+
+ public:
+
+ /**
+ * Creates new instance of CVtImageScaler.
+ * @param "aObserver" Reference to instance observer.
+ * @param "aQuality" Scaling quality. If this is omitted, then default
+ * value of EWeightedAverage is used.
+ * @param "aPriority" Active object priority.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageScaler* NewL(
+ MVtImageScalerObserver& aObserver,
+ TQuality aQuality = EWeightedAverage,
+ TPriority aPriority = EPriorityStandard );
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVtImageScaler();
+
+ /**
+ * Sets scaling quality.
+ * @param "aQuality" Scaling quality.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void SetQualityL( TQuality aQuality );
+
+ /**
+ * Scales image to new size.
+ * @param "aSource" Source image that will be scaled.
+ * @param "aTarget" Target image that will hold the scaled image. New
+ * image's dimensions
+ * will be taken from the size of target image.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void ScaleL( const CVtImage& aSource, CVtImage& aTarget );
+
+ /**
+ * Scales image to new size. Possible error during initialization is
+ * returned via MVtImageScalerObserver.
+ * @param "aSource" Source image that will be scaled.
+ * @param "aTarget" Target image that will hold the scaled image. New
+ * image's dimensions will be taken from the size of target image.
+ */
+ IMPORT_C void Scale( const CVtImage& aSource, CVtImage& aTarget );
+
+ /**
+ * Scales image to new size. This scale method is synchronous and
+ * aTarget will contain scaled image of aSource on return. This method
+ * may leave if aSource and/or aTarget are not suitable for scaling.
+ * MVtImageScalerObserver::ScalingFinished is not called when this
+ * method is used.
+ * @param "aSource" Source image that will be scaled.
+ * @param "aTarget" Target image that will hold the scaled image. New
+ * image's dimensions will be taken from the size of target image.
+ */
+ IMPORT_C void ScaleNowL( const CVtImage& aSource, CVtImage& aTarget );
+
+ private: // internal
+
+ /**
+ * C++ default constructor.
+ */
+ CVtImageScaler();
+
+ /**
+ * C++ constructor.
+ * @param "aObserver" Reference to observer.
+ * @param "aPriority" Active object priority.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ CVtImageScaler( MVtImageScalerObserver& aObserver, TPriority aPriority );
+
+ /**
+ * Second phase constructor.
+ * @param "aQuality" Quality of the scaling.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ConstructL( TQuality aQuality );
+
+ /**
+ * Sets iStatus to KRequestPending and calls CActive::SetActive().
+ */
+ void Activate();
+
+ /**
+ * Signals this instance AO with given error code.
+ * @param "aError" Signalling error code.
+ */
+ void Signal( TInt aError );
+
+ private: // from CActive
+
+ /**
+ * This is defined in CActive. Check CActive for description.
+ */
+ void RunL();
+
+ /**
+ * This is defined in CActive. Check CActive for description.
+ */
+ void DoCancel();
+
+ /**
+ * Scale method called by the CAsyncCallBack.
+ */
+ static TInt StaticScale( TAny* aPtr );
+
+ /**
+ * Scale method called by the StaticScale.
+ */
+ void DoScale();
+
+ private:
+
+ // Scaling observer
+ MVtImageScalerObserver& iObserver;
+
+ // Active quality implementation
+ CVtImageScalerImpl* iScalerImpl; // owned
+
+ // Bitmap that will be used for locking global bitmap heap
+ CFbsBitmap* iHeapLock; // owned
+
+ // Asynccallback instance
+ CAsyncCallBack* iAsyncCallBack; // owned
+
+ // This is set to ETrue in DoCancel() method, and when CAsyncCallBack
+ // gets executed, iCancelled is checked whether scaling should be done
+ // or not.
+ TBool iCancelled;
+ };
+
+#endif // CVTIMAGESCALER_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImpl.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPL_H
+#define CVTIMAGESCALERIMPL_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <bitmaptransforms.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+* Image scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageScalerImpl : public CActive
+ {
+ protected:
+
+ /**
+ * Constructor.
+ */
+ CVtImageScalerImpl();
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ ~CVtImageScalerImpl();
+
+ /**
+ * Sets scaler params.
+ * @param "aParams" Scaling params, including source and target images.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void SetSourceTargetL( const CVtImage& aSource, CVtImage& aTarget );
+
+ /**
+ * Method to check whether bitmap heap locking is needed or not during
+ * scaling process.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return ETrue if bitmap heap lock is needed, EFalse otherwise.
+ */
+ TBool NeedHeapLock() const;
+
+ /**
+ * Pure virtual scaling method.
+ * @param "aContinue" When method returns, this parameter will contain
+ * ETrue if new call is needed (i.e. scaling is not yet finished) or
+ * EFalse if scaling is complete.
+ * @return KErrNone or one of the system wide error codes.
+ */
+ virtual TInt Scale( TBool& aContinue ) = 0;
+
+ protected:
+
+ /**
+ * Scales using CBitmapScaler, which is slow but works with any
+ * Symbian color mode.
+ * @param aQuality Scaling quality @see CBitmapScaler::TQualityAlgorithm
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ScaleWithBitmapScalerL(
+ const CBitmapScaler::TQualityAlgorithm aQuality );
+
+ private:
+
+ /**
+ * Pure virtual source and target image validation method.
+ * @param "aSource" Constant reference to source image.
+ * @param "aTarget" Constant reference to target image.
+ * @exception If source or target is not valid, this method leaves
+ * with KErrNotSupported.
+ */
+ virtual void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget ) = 0;
+
+ /**
+ * Method for validating image size.
+ * @param "aSize" Size to be validated.
+ * @param "aMinSize" Minimum allowed size. If this is not given a default
+ * size of TSize( 1, 1 ) is used.
+ * @exception If size is not valid within given parameters, this
+ * method leaves with KErrNotSupported.
+ */
+ void LeaveIfNotValidSizeL(
+ const TSize& aSize,
+ const TSize aMinSize = TSize( 1, 1 ) );
+
+ private: // from CActive
+
+ /**
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ /**
+ * @see CActive::DoCancel
+ */
+ void DoCancel();
+
+ protected:
+
+ // Source for scaling
+ const CVtImage* iSource; // not owned
+
+ // Target image (will hold scaled source)
+ CVtImage* iTarget; // not owned
+
+ // Bitmap scaler instance
+ CBitmapScaler* iScaler;
+
+ // Active scheduler waiter object
+ CActiveSchedulerWait iActiveSchedulerWait;
+
+ };
+
+#endif // CVTIMAGESCALERIMPL_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplBilinear.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLBILINEAR_H
+#define CVTIMAGESCALERIMPLBILINEAR_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+* Bilinear image scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageScalerImplBilinear : public CVtImageScalerImpl
+ {
+ private: // from CVtImageScalerImpl
+
+ /**
+ * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+ */
+ TInt Scale( TBool& aContinue );
+
+ private:
+
+ /**
+ * Validate given parameters.
+ */
+ void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget );
+
+ /**
+ * Initializes internal variables for scaling.
+ */
+ void Initialize();
+
+ /**
+ * Scales images in displaymode EColor4K.
+ */
+ void Scale4K();
+
+ /**
+ * Scales images in displaymode EColor64K.
+ */
+ void Scale64K();
+
+ /**
+ * Scales images in displaymode EColor16M.
+ */
+ void Scale16M();
+
+ /**
+ * Scales images in displaymode EColor16MU.
+ */
+ void Scale16MU();
+
+ /**
+ * Scales images in displaymode EColor16MA.
+ */
+ void Scale16MA();
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 4K and 64K display modes.
+ */
+ void Scale2x4K64K( TUint32 aMask );
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 16M display mode.
+ */
+ void Scale2x16M();
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 16MU and 16MA display modes.
+ */
+ void Scale2x16MU16MA();
+
+ private:
+
+ // Target width ratio to source width
+ TUint32 iU;
+
+ // Target height ratio to source height
+ TUint32 iV;
+ };
+
+#endif // CVTIMAGESCALERIMPLBILINEAR_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplNearest.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLNEAREST_H
+#define CVTIMAGESCALERIMPLNEAREST_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+* Nearest neigbour image scaling implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageScalerImplNearest : public CVtImageScalerImpl
+ {
+ private: // from CVtImageScalerImpl
+
+ /**
+ * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+ */
+ TInt Scale( TBool& aContinue );
+
+ private:
+
+ /**
+ * Validate given parameters.
+ */
+ void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget );
+
+ /**
+ * Initializes internal variables for scaling.
+ */
+ void Initialize();
+
+ /**
+ * Scales images in displaymode EColor4K.
+ */
+ void Scale4K(
+ const TUint16* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint16* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy );
+
+ /**
+ * Scales images in displaymode EColor64K.
+ */
+ void Scale64K(
+ const TUint16* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint16* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy );
+
+ /**
+ * Scales images in displaymode EColor16M.
+ */
+ void Scale16M(
+ const TUint8* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint8* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aTrgPitch,
+ TUint32 aDx,
+ TUint32 aDy );
+
+ /**
+ * Scales images in displaymodes EColor16MU and EColor16MA.
+ */
+ void Scale16MU16MA(
+ const TUint32* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint32* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy );
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 4K and 64K display modes.
+ */
+ void Scale2x4K64K();
+
+ /**
+ * Fast scaling when target is double the source size for 16M
+ * display mode.
+ */
+ void Scale2x16M();
+
+ /**
+ * Fast scaling when target is double the source size for 16MU and 16MA
+ * display modes.
+ */
+ void Scale2x16MU16MA();
+
+ private:
+
+ // Target width ratio to source width
+ TUint32 iU;
+
+ // Target height ratio to source height
+ TUint32 iV;
+ };
+
+#endif // CVTIMAGESCALERIMPLNEAREST_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplWeightedAverage.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+#define CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+* Weighted average scaler implementation.
+*
+* @lib videosource.lib
+*/
+class CVtImageScalerImplWeightedAverage : public CVtImageScalerImpl
+ {
+ private: // from CVtImageScalerImpl
+
+ /**
+ * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+ */
+ TInt Scale( TBool& aContinue );
+
+ private: // methods
+
+ /**
+ * Validate given parameters.
+ */
+ void ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget );
+
+ /**
+ * Initializes internal variables for scaling.
+ */
+ void Initialize();
+
+ /**
+ * Scales images in displaymode EColor4K.
+ */
+ void Scale4K();
+
+ /**
+ * Scales images in displaymode EColor64K.
+ */
+ void Scale64K();
+
+ /**
+ * Scales images in displaymode EColor16M.
+ */
+ void Scale16M();
+
+ /**
+ * Scales images in displaymode EColor16MU.
+ */
+ void Scale16MU();
+
+ /**
+ * Scales images in displaymode EColor16MA.
+ */
+ void Scale16MA();
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 4K and 64K display modes.
+ */
+ void Scale2x4K64K( TUint32 aMask );
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 16M display mode.
+ */
+ void Scale2x16M();
+
+ /**
+ * Fast scaling when target is double the source size for
+ * 16MU and 16MA display modes.
+ */
+ void Scale2x16MU16MA();
+
+ private: // data
+
+ // Target width ratio to source width
+ TUint32 iU;
+
+ // Target height ratio to source height
+ TUint32 iV;
+
+ };
+
+#endif // CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerMacros.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERMACROS_H
+#define CVTIMAGESCALERMACROS_H
+
+// MACROS
+
+#define UNPACK_4K_RED( c ) ( 0xf & ( c >> 8 ) )
+#define UNPACK_4K_GREEN( c ) ( 0xf & ( c >> 4 ) )
+#define UNPACK_4K_BLUE( c ) ( 0xf & c )
+#define PACK_4K_BGR( b, g, r ) \
+ TUint16( ( b ) | ( ( ( g ) | ( ( r ) << 4 ) ) << 4 ) )
+
+#define UNPACK_64K_RED( c ) ( c >> 11 )
+#define UNPACK_64K_GREEN( c ) ( 0x3f & ( c >> 5 ) )
+#define UNPACK_64K_BLUE( c ) ( 0x1f & c )
+#define PACK_64K_BGR( b, g, r ) \
+ TUint16( ( b ) | ( ( ( g ) | ( ( r ) << 6 ) ) << 5 ) )
+
+#define UNPACK_16MU_RED( c ) ( 0xff & ( c >> 16 ) )
+#define UNPACK_16MU_GREEN( c ) ( 0xff & ( c >> 8 ) )
+#define UNPACK_16MU_BLUE( c ) ( c & 0xff )
+#define PACK_16MU_BGR( b, g, r ) \
+ TUint32( ( ( ( ( ( 0xff << 8 ) | ( r ) ) << 8 ) | ( g ) ) << 8 ) | ( b ) )
+
+#define UNPACK_16MA_ALPHA( c ) ( 0xff & ( c >> 24 ) )
+#define UNPACK_16MA_RED( c ) ( 0xff & ( c >> 16 ) )
+#define UNPACK_16MA_GREEN( c ) ( 0xff & ( c >> 8 ) )
+#define UNPACK_16MA_BLUE( c ) ( c & 0xff )
+#define PACK_16MA_ABGR( a, b, g, r ) \
+ TUint32( ( ( ( ( ( ( a ) << 8 ) | ( r ) ) << 8 ) | ( g ) ) << 8 ) | ( b ) )
+
+#endif // CVTIMAGESCALERMACROS_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageTransformsUids.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 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: Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __CVTIMAGETRANSFORMS_HRH__
+#define __CVTIMAGETRANSFORMS_HRH__
+
+#define KUidVtImageTransformsLibrary 0x101F8834
+#define KSharedLibraryUidDefine 0x1000008D
+
+#endif // __CVTIMAGETRANSFORMS_HRH__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/DisplaySinkUids.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 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: Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __DISPLAYSINKUIDS_HRH__
+#define __DISPLAYSINKUIDS_HRH__
+
+#define KUidDisplaySinkLibrary 0x101F8693
+#define KSharedLibraryUidDefine 0x1000008D
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDP.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2004 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: DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDP_H
+#define TDISPLAYSINKPARAMSDP_H
+
+// INCLUDE FILES
+
+#include "mdisplaysink.h"
+#include <Posting_Surface.h>
+
+// CLASS DECLARATION
+
+/**
+* Displaysink initialization parameters for DisplaySink's Display Posting
+* implementation.
+*
+* @lib displaysink.lib
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsDP ) : public TDisplaySinkParams
+ {
+public:
+ // Pointer's pointer to first posting buffer that is filled by the
+ // sink.
+ CPostingSurface::TPostingBuff** iPostingBuffer1;
+
+ // Pointer's pointer to second posting buffer that is filled by the
+ // sink.
+ CPostingSurface::TPostingBuff** iPostingBuffer2;
+
+ // Posting format to be used
+ CPostingSurface::TPostingFormat iPostingFormat;
+
+ // Frame size in pixels
+ TSize iFrameSize;
+ };
+
+#endif // TDISPLAYSINKPARAMSDP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDSA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 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: DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDSA_H
+#define TDISPLAYSINKPARAMSDSA_H
+
+// INCLUDE FILES
+
+#include "cvtimagerotator.h"
+#include "mdisplaysink.h"
+
+// CLASS DECLARATION
+
+/**
+* Displaysink initialization parameters for DisplaySink's Direct Screen Access
+* implementation.
+*
+* @lib displaysink.lib
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsDSA ) : public TDisplaySinkParams
+ {
+public:
+
+ /**
+ * C++ constructor
+ */
+ TDisplaySinkParamsDSA();
+
+public:
+ // Handle to first bitmap that is filled by the sink. 176x144 bitmap (QCIF)
+ TInt iBitmap1Handle;
+
+ // Handle to second bitmap that is filled by the sink. 176x144 bitmap (QCIF)
+ TInt iBitmap2Handle;
+
+ // Angle to which YUV image must be rotated BEFORE it is converted into bitmap.
+ // If CVtImageRotator::ERotationNone is given, image will be converted as it
+ // is received. Also make sure that iBitmap1Handle and iBitmap2Handle contains
+ // correct dimensions AFTER rotation.
+ CVtImageRotator::TRotationAngle iRotationAngle;
+ };
+
+#include "tdisplaysinkparamsdsa.inl"
+
+#endif // TDISPLAYSINKPARAMSDSA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsNGA.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2004-2006 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: Displaysink initialization parameters for DisplaySink's NGA implementation.
+*
+*/
+
+#ifndef TDISPLAYSINKPARAMSNGA_H
+#define TDISPLAYSINKPARAMSNGA_H
+
+// INCLUDE FILES
+
+#include "mdisplaysink.h"
+#include <pixelformats.h>
+//#include <videorenderer.h>
+#include <videoframebuffer.h>
+
+// CLASS DECLARATION
+
+/**
+* Displaysink initialization parameters for DisplaySink's NGA
+* implementation.
+*
+* @lib displaysink.lib
+* @since Series 60 7.0
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsNGA ) : public TDisplaySinkParams
+ {
+public:
+ // Pointer's pointer to first posting buffer that is filled by the
+ // sink.
+ TUint8** iSurfaceBuffer1;
+ //TVideoFrameBuffer** iSurfaceBuffer1;
+
+ // Pointer's pointer to second posting buffer that is filled by the
+ // sink.
+ //TVideoFrameBuffer** iSurfaceBuffer2;
+ TUint8** iSurfaceBuffer2;
+
+ // Posting format to be used
+ TUidPixelFormat iSurfaceFormat;
+
+ // Frame size in pixels
+ TSize iFrameSize;
+ };
+
+#endif // TDISPLAYSINKPARAMSNGA_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/VtImageConverterUids.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 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: Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __VTIMAGECONVERTERUIDS_HRH__
+#define __VTIMAGECONVERTERUIDS_HRH__
+
+#define KUidVtImageConverterLibrary 0x101F86B5
+#define KSharedLibraryUidDefine 0x1000008D
+
+#endif // __VTIMAGECONVERTERUIDS_HRH__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimage.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGE_H
+#define CVTIMAGE_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <gdi.h>
+
+// CLASS DECLARATIONS
+
+/**
+* Abstract base class for VS images.
+*
+* @lib videosource.lib
+*/
+class CVtImage : public CBase
+ {
+ public:
+ /**
+ * Enumeration for supported image types.
+ */
+ enum TVtImageType
+ {
+ /**
+ * CFbsBitmap image.
+ */
+ EVtImageBitmap,
+
+ /**
+ * YUV 420 planar image where all Y samples are found first in memory as an
+ * array of unsigned char (possibly with a larger stride for memory alignment),
+ * followed immediately by all Cr (U) samples (with half the stride of the Y
+ * lines, and half the number of lines), then followed immediately by all Cb
+ * (V) samples in a similar fashion.
+ */
+ EVtImageIYUV
+ };
+
+ /**
+ * Vt display modes. Used for identifying image's data format.
+ */
+ enum TVtDisplayMode
+ {
+ /**
+ * Unsupported display mode.
+ */
+ EVtColorNone,
+
+ /**
+ * 4096 colour display mode (12 bpp).
+ */
+ EVtColor4K,
+
+ /**
+ * 2^16 colour display mode (16 bpp).
+ */
+ EVtColor64K,
+
+ /**
+ * True colour display mode (24 bpp).
+ */
+ EVtColor16M,
+
+ /**
+ * True colour display mode (32 bpp).
+ */
+ EVtColor16MU,
+
+ /**
+ * True colour display mode with alpha (32 bpp).
+ */
+ EVtColor16MA,
+
+ /**
+ * YUV 420 planar display mode.
+ */
+ EVtColorIYUV
+ };
+
+ /**
+ * Pure virtual function to check whether bitmap heap needs to be locked
+ * for this image type.
+ * @return Returns ETrue if bitmap heap lock is required, EFalse
+ * otherwise.
+ */
+ virtual TBool NeedHeapLock() const = 0;
+
+ /**
+ * Pure virtual function to get displaymode from image.
+ * @return Returns image's displaymode.
+ */
+ virtual TVtDisplayMode DisplayMode() const = 0;
+
+ /**
+ * Pure virtual function to get size of the image in pixels
+ * @return Returns size of the image in pixels.
+ */
+ virtual TSize Size() const = 0;
+
+ /**
+ * Pure virtual function to get how many bytes this image has per
+ * scaline.
+ * @return Returns number of bytes per scanline.
+ */
+ virtual TInt BytesPerRow() const = 0;
+
+ /**
+ * Pure virtual function to get pointer to image data.
+ * @return Returns pointer to image data.
+ */
+ virtual TUint32* DataAddress() const = 0;
+
+ /**
+ * Pure virtual function to get pointer to image data at defined line.
+ * If aLine is lower than zero then line zero is returned, also if aLine
+ * is greater than height of the image minus 1 ( height - 1 ) then line
+ * number ( height - 1 ) is returned.
+ * @param "aLine" Number of vertical line for which pointer is wanted.
+ * @return Returns pointer to the beginning of the requested scanline.
+ */
+ virtual TUint32* LineAddress( TInt aLine ) const = 0;
+
+ /**
+ * Method for getting image type.
+ * @return Returns type of the image.
+ */
+ IMPORT_C TVtImageType Type() const;
+
+ public: // static methods
+
+ /**
+ * Converts given TDisplayMode to corresponding TVtDisplayMode.
+ * @param "aMode" Display mode as TDisplayMode.
+ * @return Returns mode as TVtDisplayMode.
+ */
+ static TVtDisplayMode DisplayModeToVtDisplayMode( TDisplayMode aMode );
+
+ protected:
+
+ /**
+ * C++ constructor.
+ */
+ CVtImage( TVtImageType aType );
+
+ private:
+
+ // Type of the image.
+ TVtImageType iType;
+ };
+
+#endif // CVTIMAGE_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimageconverter.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,638 @@
+/*
+* Copyright (c) 2004 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: Image conversion library for VideoTelephony.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGECONVERTER_H
+#define CVTIMAGECONVERTER_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <gdi.h>
+
+// CLASS FORWARDS
+
+class CFbsBitmap;
+class CVTYUVFbsBitmapConverter;
+class CVSFbsBitmapIYUVConverter;
+
+// DATA TYPES
+
+typedef TRgb ( *TVSColorReadFunc ) ( TAny*& );
+
+// CLASS DECLARATIONS
+
+/**
+* Base class for all YUV to CFbsBitmap converters.
+*
+* @lib VTImageConverter.lib
+*/
+class CVTYUVFbsBitmapConverter : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVTYUVFbsBitmapConverter();
+
+ public: // New functions
+
+ /**
+ * Starts image conversion from YUV to CFbsBitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C virtual void ProcessL();
+
+ /**
+ * Sets size of the source YUV image in pixels. This must be implemented
+ * in derived classes.
+ * @param "aSize" Size of source YUV image in pixels.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetSourceSizeL( const TSize& aSize ) = 0;
+
+ /**
+ * Sets source YUV image data. This method must be implemented in derived
+ * classes.
+ * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+ * data is referenced and not copied, given reference must be still
+ * valid when ProcessL() is called.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetSourceL( const TDesC8& aSourceData ) = 0;
+
+ /**
+ * Sets size of the source YUV image in pixels and image data.
+ * This method must be implemented in derived classes.
+ * @param "aSize" Size of source YUV image in pixels.
+ * @param "aSourceData" 8-bit descriptor containing the YUV data.
+ * As data is referenced and not copied, given reference must be still
+ * valid when ProcessL() is called.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetSourceL(
+ const TSize& aSize,
+ const TDesC8& aSourceData ) = 0;
+
+ /**
+ * Sets destination bitmap into which conversion will be made.
+ * @param "aDestinationBitmap" Reference to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C virtual void SetDestinationL(
+ const CFbsBitmap& aDestinationBitmap );
+
+ /**
+ * Sets destination bitmap into which conversion will be made.
+ * Bitmap is given as handle to existing bitmap.
+ * @param "aHandle" Handle to existing bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C virtual void SetDestinationL( TInt aHandle );
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ /**
+ * Updates iY, iU and iV member variables. Must be implemented in
+ * derived classes.
+ * @param "aSourceData" 8-bit descriptor to source YUV data.
+ */
+ virtual void SetYUVPtrs( const TDesC8& aSourceData ) = 0;
+
+ /**
+ * Second phase constructor.
+ * @param "aBitmapHandle" Handle to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ConstructL( TInt aBitmapHandle );
+
+ /**
+ * Second phase constructor that will be called when destination is
+ * changed.
+ * @param "aBitmapHandle" Handle to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ReConstructL( TInt aBitmapHandle );
+
+ /**
+ * Updates internal variables.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SizeUpdateL();
+
+ /**
+ * C++ constructor.
+ * @param "aSourceSize" Source size in pixels.
+ */
+ CVTYUVFbsBitmapConverter( const TSize& aSourceSize );
+
+ /**
+ * Returns source size in pixels.
+ * @return Source size in pixels, as constant reference.
+ */
+ inline const TSize& SourceSize() const;
+
+ /**
+ * Returns source size in pixels.
+ * @return Source size in pixels, as reference.
+ */
+ inline TSize& SourceSize();
+
+ /**
+ * Returns destination size in pixels.
+ * @return Destination size in pixels, as constant reference.
+ */
+ inline const TSize& DestinationSize() const;
+
+ /**
+ * Returns destination size in pixels.
+ * @return Destination size in pixels, as reference.
+ */
+ inline TSize& DestinationSize();
+
+ /**
+ * Main process loop for Color4K mode. This must be implemented in
+ * derived classes.
+ * @param "aWriteFunction" Pointer to function that writes one pixel to
+ * destination.
+ */
+ virtual void DoProcess4K() = 0;
+
+ /**
+ * Main process loop for Color64K mode. This must be implemented in
+ * derived classes.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ virtual void DoProcess64K() = 0;
+
+ /**
+ * Main process loop for Color16M mode. This must be implemented in
+ * derived classes.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ virtual void DoProcess16M() = 0;
+
+ /**
+ * Main process loop for Color16MU mode. This must be implemented in
+ * derived classes.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ virtual void DoProcess16MU16MA() = 0;
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CVTYUVFbsBitmapConverter();
+
+ private: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ // Table of coefficients for EColor4K
+ static const TUint8 COFF_TBL_4K[ 80 ];
+
+ // Table of coefficients for EColor64K
+ static const TUint8 COFF_TBL_64K[ 220 ];
+
+ // Table of coefficients for EColor16M
+ static const TUint8 COFF_TBL_16M[ 528 ];
+
+ // Source size in pixels.
+ TSize iSourceSize;
+
+ // Target size in pixels.
+ TSize iDestinationSize;
+
+ // Pointer to destination bitmap.
+ CFbsBitmap* iDestination; // owned, duplicate
+
+ // Pointer descriptor that points to Y data of the YUV image.
+ const TUint8* iY;
+
+ // Pointer descriptor that points to Cr (U) data of the YUV image.
+ const TUint8* iU;
+
+ // Pointer descriptor that points to Cb (V) data of the YUV image.
+ const TUint8* iV;
+
+ // Horizontal skip real value. After every pixel this valus is added
+ // to X index in conversion loop.
+ TReal32 iVSkipReal;
+
+ // Vertical skip real value. After every pixel this valus is added
+ // to Y index in conversion loop.
+ TReal32 iHSkipReal;
+
+ private: // Data
+ };
+
+/**
+* Base class for YUV 4:2:0 planar image to CFbsBitmap converters.
+*
+* @lib VTImageConverter.lib
+*/
+class CVTYUVPlanarFbsBitmapConverter : public CVTYUVFbsBitmapConverter
+ {
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Sets size of the source YUV image in pixels.
+ * @param "aSize" Size of source YUV image in pixels.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C void SetSourceSizeL( const TSize& aSize );
+
+ /**
+ * Sets source YUV image data.
+ * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+ * data is referenced and
+ * not copied, given reference must be still valid when ProcessL() is
+ * called.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C void SetSourceL( const TDesC8& aSourceData );
+
+ /**
+ * Sets size of the source YUV image in pixels and image data. This
+ * method must be
+ * implemented in derived classes.
+ * @param "aSize" Size of source YUV image in pixels.
+ * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+ * data is referenced and
+ * not copied, given reference must be still valid when ProcessL() is
+ * called.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C void SetSourceL(
+ const TSize& aSize,
+ const TDesC8& aSourceData );
+
+ protected: // Constructors and destructor
+
+ /**
+ * C++ constructor.
+ * @param "aSourceSize" Source size in pixels.
+ */
+ CVTYUVPlanarFbsBitmapConverter( const TSize& aSourceSize );
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ /**
+ * Main process loop for Color4K mode.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess4K();
+
+ /**
+ * Main process loop for Color4K mode when scaling is not required.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess4KNoScale();
+
+ /**
+ * Main process loop for Color64K mode.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess64K();
+
+ /**
+ * Main process loop for Color64K mode when scaling is not required.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess64KNoScale();
+
+ /**
+ * Main process loop for Color16M mode.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess16M();
+
+ /**
+ * Main process loop for Color16M mode when scaling is not required.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess16MNoScale();
+
+ /**
+ * Main process loop for Color16MU and Color16MA modes.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess16MU16MA();
+
+ /**
+ * Main process loop for Color16MU and Color16MA modes when scaling is
+ * not required.
+ * @param "aWriteFunction" Pointer to function that writes one pixel
+ * to destination.
+ */
+ void DoProcess16MU16MANoScale();
+
+ private: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CVTYUVPlanarFbsBitmapConverter();
+
+ private: // Functions from base classes
+ };
+
+/**
+* FourCC IYUV image to CFbsBitmap converter (see IYUV description below).
+*
+* All Y samples are found first in memory as an array of unsigned char
+* (possibly with a larger stride for memory alignment), followed immediately
+* by all Cr (U) samples (with half the stride of the Y lines, and half the
+* number of lines), then followed immediately by all Cb (V) samples in a
+* similar fashion.
+*
+* @lib VTImageConverter.lib
+*/
+class CVTIYUVFbsBitmapConverter : public CVTYUVPlanarFbsBitmapConverter
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aSourceSize" Size of source image in pixels.
+ * @param "aDestination" Reference to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVTIYUVFbsBitmapConverter* NewL(
+ const TSize& aSourceSize,
+ const CFbsBitmap& aDestination );
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aSourceSize" Size of source image in pixels.
+ * @param "aBitmapHandle" Handle to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVTIYUVFbsBitmapConverter* NewL(
+ const TSize& aSourceSize,
+ TInt aBitmapHandle );
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ /**
+ * Updates iY, iU and iV member variables.
+ * @param "aSourceData" 8-bit descriptor to source YUV data.
+ */
+ void SetYUVPtrs( const TDesC8& aSourceData );
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ destructor.
+ * @param "aSourceSize" Source size in pixels.
+ */
+ CVTIYUVFbsBitmapConverter( const TSize& aSourceSize );
+
+ /**
+ * C++ default constructor.
+ */
+ CVTIYUVFbsBitmapConverter();
+ };
+
+/**
+* FourCC YV12 image to CFbsBitmap converter (see YV12 description below).
+*
+* All Y samples are found first in memory as an array of unsigned char
+* (possibly with a larger stride for memory alignment), followed immediately
+* by all Cb (V) samples (with half the stride of the Y lines, and half the
+* number of lines), then followed immediately by all Cr (U) samples in a
+* similar fashion.
+*
+* @lib VTImageConverter.lib
+*/
+class CVTYV12FbsBitmapConverter : public CVTYUVPlanarFbsBitmapConverter
+ {
+ public: // Constructors and destructor
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aSourceSize" Size of source image in pixels.
+ * @param "aDestination" Reference to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVTYV12FbsBitmapConverter* NewL(
+ const TSize& aSourceSize,
+ const CFbsBitmap& aDestination );
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aSourceSize" Size of source image in pixels.
+ * @param "aBitmapHandle" Handle to destination bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVTYV12FbsBitmapConverter* NewL(
+ const TSize& aSourceSize,
+ TInt aBitmapHandle );
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ /**
+ * Updates iY, iU and iV member variables.
+ * @param "aSourceData" 8-bit descriptor to source YUV data.
+ */
+ void SetYUVPtrs( const TDesC8& aSourceData );
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ destructor.
+ * @param "aSourceSize" Source size in pixels.
+ */
+ CVTYV12FbsBitmapConverter( const TSize& aSourceSize );
+
+ /**
+ * C++ default constructor.
+ */
+ CVTYV12FbsBitmapConverter();
+ };
+
+/**
+* CFbsBitmap to FourCC IYUV image converter (see IYUV description below).
+*
+* All Y samples are found first in memory as an array of unsigned char
+* (possibly with a larger stride for memory alignment), followed immediately
+* by all Cr (U) samples (with half the stride of the Y lines, and half the
+* number of lines), then followed immediately by all Cb (V) samples in a
+* similar fashion.
+*
+* @lib VTImageConverter.lib
+*/
+class CVSFbsBitmapIYUVConverter : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aBitmap" Reference to source bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVSFbsBitmapIYUVConverter* NewL(
+ const CFbsBitmap& aBitmap );
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVSFbsBitmapIYUVConverter();
+
+ public: // New functions
+
+ /**
+ * Sets new source bitmap.
+ * @param "aBitmap" Reference to new source bitmap.
+ */
+ IMPORT_C void SetSourceL( const CFbsBitmap& aBitmap );
+
+ /**
+ * Starts image conversion from CFbsBitmap to YUV.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C void ProcessL();
+
+ /**
+ * After successfull ProcessL() call converted YUV image data can be
+ * fetched using this method.
+ * @return 8-bit pointer descriptor (constant) to YUV image data.
+ */
+ IMPORT_C TPtrC8 YUVData() const;
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CVSFbsBitmapIYUVConverter();
+
+ /**
+ * Second phase constructor.
+ * @param "aBitmap" Reference to source bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL( const CFbsBitmap& aBitmap );
+
+ private: // New functions
+
+ /**
+ * Second phase constructor that is called when source is changed.
+ * @param "aBitmap" Reference to source bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ReConstructL( const CFbsBitmap& aBitmap );
+
+ /**
+ * Main process loop.
+ * @param "aReadFunction" Pointer to function that reads one pixel from
+ * source.
+ */
+ void DoProcess( TVSColorReadFunc aReadFunction );
+
+ private: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Destination size in pixels.
+ TSize iSize;
+
+ // Pointer to source bitmap.
+ CFbsBitmap* iSource; // owned, duplicate
+
+ // Heap descriptor that contains converted YUV data.
+ HBufC8* iYUVData; // owned
+
+ // Pointer descriptor that points to Y data of the YUV image.
+ TPtrC8 iY;
+
+ // Pointer descriptor that points to Cr (U) data of the YUV image.
+ TPtrC8 iU;
+
+ // Pointer descriptor that points to Cb (V) data of the YUV image.
+ TPtrC8 iV;
+ };
+
+// INLINE METHODS
+#include "cvtimageconverter.inl"
+
+
+#endif // CVTIMAGECONVERTER_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimageconverter.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2004 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: Image conversion library for VideoTelephony.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGECONVERTER_INL
+#define CVTIMAGECONVERTER_INL
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SourceSize() const
+// Returns source size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline const TSize& CVTYUVFbsBitmapConverter::SourceSize() const
+ {
+ return iSourceSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SourceSize()
+// Returns source size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline TSize& CVTYUVFbsBitmapConverter::SourceSize()
+ {
+ return iSourceSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::DestinationSize() const
+// Returns destination size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline const TSize& CVTYUVFbsBitmapConverter::DestinationSize() const
+ {
+ return iDestinationSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::DestinationSize()
+// Returns destination size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline TSize& CVTYUVFbsBitmapConverter::DestinationSize()
+ {
+ return iDestinationSize;
+ }
+
+#endif CVTIMAGECONVERTER_INL
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimagerotator.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,245 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEROTATOR_H
+#define CVTIMAGEROTATOR_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+class CFbsBitmap;
+class CVtImageRotatorImpl;
+
+// CLASS DECLARATIONS
+
+/**
+* Image rotator observer interface.
+*
+* @lib videosource.lib
+*/
+class MVtImageRotatorObserver
+ {
+ public:
+ /**
+ * Callback method that is called by CVtImageRotator when rotation
+ * process has been finished.
+ * @param "aError" KErrNone if the rotation was done successfully, one
+ * of the system wide error codes otherwise.
+ * @return Pointer to newly created instance.
+ */
+ virtual void RotationFinished( TInt aError ) = 0;
+ };
+
+/**
+* Image rotator.
+*
+* @lib videosource.lib
+*/
+class CVtImageRotator : public CActive
+ {
+ public:
+ /**
+ * An enumeration within the CVtImageRotator namespace.
+ * It provides a set of panic codes that may happen during
+ * rotation process.
+ */
+ enum TPanics
+ {
+ /**
+ * RotateL() is called while previous rotation process
+ * has not yet been finished.
+ */
+ EBusy = 1
+ };
+
+ /**
+ * An enumeration within the CVtImageRotator namespace.
+ * It provides a set of supported rotation and mirror angles.
+ */
+ enum TRotationAngle
+ {
+ /**
+ * Uninitialized place holder. Giving this rotation angle
+ * to RotateL() will make RotateL() leave with error code
+ * KErrNotSupported.
+ */
+ ERotationNone = -1,
+
+ /**
+ * Rotates image 90 degrees in a clockwise direction.
+ */
+ E90DegreesClockwise,
+
+ /**
+ * Rotates image 180 degrees in a clockwise direction.
+ * (flip & mirror)
+ */
+ E180DegreesClockwise,
+
+ /**
+ * Rotates image 270 degrees in a clockwise direction.
+ */
+ E270DegreesClockwise,
+
+ /**
+ * Mirrors the bitmap around the horizontal axis.
+ */
+ EMirrorHorizontalAxis,
+
+ /**
+ * Flips the image around the vertical axis.
+ */
+ EFlipVerticalAxis,
+ };
+
+ public:
+
+ /**
+ * Creates new instance of CVtImageRotator.
+ * @param "aObserver" Reference to instance observer.
+ * @param "aPriority" Active object priority.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ * @return Pointer to newly created instance.
+ */
+ IMPORT_C static CVtImageRotator* NewL(
+ MVtImageRotatorObserver& aObserver,
+ TPriority aPriority = EPriorityLow );
+
+ /**
+ * C++ destructor.
+ */
+ IMPORT_C ~CVtImageRotator();
+
+ /**
+ * Rotates image to given angle.
+ * @param "aSource" Source image that will be rotated.
+ * @param "aTarget" Target image that will hold the rotated image.
+ * @param "aAngle" Rotation angle.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ IMPORT_C void RotateL( const CVtImage& aSource, CVtImage& aTarget,
+ const TRotationAngle& aAngle );
+
+ /**
+ * Rotates image to given angle. Possible error during initialization is
+ * returned via MVtImageRotatorObserver.
+ * @param "aSource" Source image that will be rotated.
+ * @param "aTarget" Target image that will hold the rotated image.
+ * @param "aAngle" Rotation angle.
+ */
+ IMPORT_C void Rotate( const CVtImage& aSource, CVtImage& aTarget,
+ const TRotationAngle& aAngle );
+
+ private: // internal
+
+ /**
+ * C++ default constructor.
+ */
+ CVtImageRotator();
+
+ /**
+ * C++ constructor.
+ * @param "aObserver" Reference to observer.
+ * @param "aPriority" Active object priority.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ CVtImageRotator( MVtImageRotatorObserver& aObserver, TPriority aPriority );
+
+ /**
+ * Second phase constructor.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void ConstructL();
+
+ /**
+ * Creates new instance of rotator implementation if needed.
+ * @param "aAngle" Used rotation angle.
+ * @exception In error situation leaves with one of the system wide
+ * error codes.
+ */
+ void CreateRotatorL( const TRotationAngle& aAngle );
+
+ /**
+ * Sets iStatus to KRequestPending and calls CActive::SetActive().
+ */
+ void Activate();
+
+ /**
+ * Signals this instance AO with given error code.
+ * @param "aError" Signalling error code.
+ */
+ void Signal( TInt aError );
+
+ private: // from CActive
+
+ /**
+ * This is defined in CActive. Check CActive for description.
+ */
+ void RunL();
+
+ /**
+ * This is defined in CActive. Check CActive for description.
+ */
+ void DoCancel();
+
+ /**
+ * Rotate method called by the CAsyncCallBack.
+ */
+ static TInt StaticRotate( TAny* aPtr );
+
+ /**
+ * Rotate method called by the StaticScale.
+ */
+ void DoRotate();
+
+ private:
+
+ // Scaling observer
+ MVtImageRotatorObserver& iObserver;
+
+ // Bitmap that will be used for locking global bitmap heap
+ CFbsBitmap* iHeapLock; // owned
+
+ // Rotator implementation
+ CVtImageRotatorImpl* iRotatorImpl; // owned
+
+ // Asynccallback instance
+ CAsyncCallBack* iAsyncCallBack; // owned
+
+ // This is set to ETrue in DoCancel() method, and when CAsyncCallBack
+ // gets executed, iCancelled is checked whether scaling should be done
+ // or not.
+ TBool iCancelled;
+ };
+
+#endif // CVTIMAGEROTATOR_H
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/mdisplaysink.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2004 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: DisplaySink subsystem.
+*
+*/
+
+
+#ifndef MDISPLAYSINK_H
+#define MDISPLAYSINK_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class MVTVideoSink;
+
+/**
+* MDisplaySinkObserver
+*
+* Sink observer API. Currently only frame size changes are reported using
+* this IF.
+*
+* @lib DisplaySink.lib
+*/
+class MDisplaySinkObserver
+ {
+public:
+ /**
+ * When incoming video frame size changes, this callback will be called.
+ * @param "aFrom" Current frame size.
+ * @param "aTo" New frame size.
+ * @return KErrNone if successful, one of the system wide error codes
+ * @exception May leave with one of the system wide error codes.
+ * otherwise.
+ */
+ virtual void VideoFrameSizeChangedL(
+ const TSize& aFrom,
+ const TSize& aTo ) = 0;
+ };
+
+/**
+* Input parameters for Display Sink
+*
+* @lib DisplaySink.lib
+*/
+class TDisplaySinkParams
+ {
+public:
+
+ /**
+ * Enumeration for limiting frame rate.
+ */
+ enum TFrameRateLimit
+ {
+ /** Don't limit frame rate (default) */
+ EFrameRateLimitNone = 0,
+ /** Limit frame rate to 1.0 frames per second */
+ EFrameRateLimit1_0 = 1000,
+ /** Limit frame rate to 2.5 frames per second */
+ EFrameRateLimit2_5 = 400,
+ /** Limit frame rate to 5.0 frames per second */
+ EFrameRateLimit5_0 = 200,
+ /** Limit frame rate to 7.5 frames per second */
+ EFrameRateLimit7_5 = 133,
+ /** Limit frame rate to 10.0 frames per second */
+ EFrameRateLimit10_0 = 100,
+ /** Limit frame rate to 12.5 frames per second */
+ EFrameRateLimit12_5 = 80,
+ /** Limit frame rate to 15.0 frames per second */
+ EFrameRateLimit15_0 = 67,
+ };
+
+ /**
+ * Flags for selecting correct type sink.
+ */
+ enum TFlags
+ {
+ /** Create instance of DSA version of sink */
+ EDisplaySinkDSA = ( 1 << 0 ),
+ /** Create instance of DP version of sink */
+ EDisplaySinkDP = ( 1 << 1 ),
+ /** Create instance of NGA version of sink */
+ EDisplaySinkNGA = ( 1 << 2 )
+ };
+
+public: // Data
+
+ /**
+ * C++ constructor for initializing some of the variables.
+ */
+ IMPORT_C TDisplaySinkParams();
+
+ // Thread id that gets notified by sink
+ TThreadId iThreadId;
+
+ // Pointer to iStatus member of the Active Object to notify after video
+ // frame is converted
+ TRequestStatus* iRequestStatusPtr;
+
+ // Pointer to Display Sink observer interface
+ MDisplaySinkObserver* iObserver;
+
+ // Frame rate limitation
+ TFrameRateLimit iFrameRateLimit;
+
+ // Sink flags
+ TUint32 iFlags;
+ };
+
+/**
+* MDisplaySink
+*
+* @lib DisplaySink.lib
+*/
+class MDisplaySink
+ {
+public: // data
+
+ // Enumeration for the bitmaps.
+ enum TBitmapNo
+ {
+ EFirstBitmap = 0,
+ ESecondBitmap
+ };
+
+public: // new methods
+
+ /**
+ * Deletes instance and frees all memory.
+ */
+ virtual void Destroy() = 0;
+
+ /**
+ * Mark the bitmap available for use.
+ * @param "aBitmapNo" One of the enumerated TBitmapNo values.
+ */
+ virtual void SetBitmapAvailable( TBitmapNo aBitmapNo ) = 0;
+
+ /**
+ * Cancels sink so that it does not convert bitmaps even it receives data.
+ */
+ virtual void Release() = 0;
+
+ /**
+ * Updates display sink parameters, e.g. when display mode changes.
+ * @param "aParams" Structure that contains new bitmap handles.
+ * @param "aUpdated" Reference to boolean variable that will be set to
+ * ETrue when display sink parameter update has been completed.
+ * @exception May leave with one of the system wide error codes (e.g. in
+ * out of memory situaton).
+ */
+ virtual void UpdateSinkParamsL( const TDisplaySinkParams& aParams,
+ TBool& aUpdated ) = 0;
+
+ /**
+ * Pauses sending of remote video to VT engine.
+ */
+ virtual void Pause() = 0;
+
+ /**
+ * Resumes sending of remote video to VT engine.
+ */
+ virtual void Resume() = 0;
+
+ /**
+ * Operator returns this instance .
+ */
+ virtual operator MVTVideoSink&() = 0;
+
+ /**
+ * This method is called by the VT engine when engine has finished handling
+ * of previous frame and is ready to handle a new one.
+ */
+ virtual void NextFrame() = 0;
+
+ };
+
+/**
+* Creates instance of displaysink.
+*/
+IMPORT_C MDisplaySink* CreateSinkL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData );
+
+#endif // MDISPLAYSINK_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/tdisplaysinkparamsdsa.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 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: DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDSA_INL
+#define TDISPLAYSINKPARAMSDSA_INL
+
+// ====================== TDisplaySinkParamsDSA ==========================
+
+inline TDisplaySinkParamsDSA::TDisplaySinkParamsDSA() : TDisplaySinkParams()
+ {
+ Mem::FillZ( this, sizeof( TDisplaySinkParamsDSA ) );
+ iRotationAngle = CVtImageRotator::ERotationNone;
+ }
+
+#endif TDISPLAYSINKPARAMSDSA_INL
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/vtyuvconverter.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-2006 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: YUV format transcoder.
+*
+*/
+
+
+#ifndef TVTYUVCONVERTER_H
+#define TVTYUVCONVERTER_H
+
+#include <e32base.h>
+
+/**
+ * Yuv format transcoder.
+ *
+ * Implements conversion between different YUV formats.
+ *
+ * @lib VTImageConverter.lib
+ * @since S60 v3.1
+ */
+NONSHARABLE_CLASS( VtYuvConverter )
+ {
+public:
+
+ /**
+ * Converts from 4:2:0 planar source image to 4:2:2 interleaved image.
+ *
+ * @since S60 v3.1
+ * @param aSource Constant descriptor containing source image data.
+ * @param aSize Size of the image in pixels.
+ * @param aTarget Modifiable descriptor for target image data.
+ * @param aStide Number of bytes per scanline in target buffer.
+ * @return KErrNone if conversion was successful, KErrUnderflow if result
+ * does not fit in target buffer or KErrArgument if source buffer's size
+ * does not match with the given source size in pixels.
+ */
+ static TInt ConvertFrom420PlanarTo422Interleaved(
+ const TDesC8& aSource,
+ const TSize& aSize,
+ TDes8& aTarget,
+ TInt aStride );
+
+private:
+
+ /**
+ * Constructor.
+ */
+ VtYuvConverter();
+
+ /**
+ * Copy constructor.
+ */
+ VtYuvConverter( const VtYuvConverter& );
+
+ /**
+ * Returns image size in bytes for 420 planar image that has given pixel
+ * size.
+ */
+ static TInt ByteSize420Planar( const TSize& aSizeInPixels );
+
+ /**
+ * Returns image size in bytes for 422 interleaved image that has given
+ * pixel size.
+ */
+ static TInt ByteSize422Interleaved( const TSize& aSizeInPixels );
+ };
+
+#endif // TVTYUVCONVERTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/rom/DisplaySink.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2004-2007 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:
+* IBY file for DisplaySink
+*
+*
+*/
+
+
+#ifndef __DISPLAYSINK_IBY__
+#define __DISPLAYSINK_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+file=ABI_DIR\BUILD_DIR\VTImageConverter.dll SHARED_LIB_DIR\VTImageConverter.dll
+file=ABI_DIR\BUILD_DIR\DisplaySink.dll SHARED_LIB_DIR\DisplaySink.dll
+file=ABI_DIR\BUILD_DIR\VtImageTransforms.dll SHARED_LIB_DIR\VtImageTransforms.dll
+data=ZSYSTEM\install\displaysink_stub.sis system\install\displaysink_stub.sis
+
+#endif
+
+#endif //__DISPLAYSINK_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySink.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1029 @@
+/*
+* Copyright (c) 2006 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: Display Sink subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "CDisplaySinkDP.h"
+#include "CDisplaySinkDSA.h"
+#include "CDisplaySinkNGA.h"
+#include <mmffourcc.h>
+#include <featmgr.h>
+
+// CONSTANTS
+
+// MACROS
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================= CVtFrameQueue =================================
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::CVtFrameQueue
+// -----------------------------------------------------------------------------
+//
+CVtFrameQueue::CVtFrameQueue() : CActive( EPriorityNormal )
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue<" ) ));
+ _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::ThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVtFrameQueue::ThreadLogon()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon<" ) ));
+ if ( !IsAdded() )
+ {
+ CActiveScheduler::Add( this );
+ }
+ TInt result( iThread.Open( RThread().Id() ) );
+ _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon %d >" ), result ));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::SinkStoppedL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::SinkStoppedL()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL<" ) ));
+ DoReleaseBufferL( iBuffer );
+ DoReleaseBufferL( iReleaseBuffer );
+ _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::ThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::ThreadLogoff()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff<" ) ));
+ if ( IsAdded() )
+ {
+ Deque();
+ }
+ _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Store
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::Store( MVTVideoSource& aSupplier,
+ CMMFDataBuffer* aBuffer,
+ TSize aFrameSize,
+ TPtr8& aPtr )
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Store<" ) ));
+ iSupplier = &aSupplier;
+ iBuffer = aBuffer;
+ iFrameSize = aFrameSize;
+ iPtr = &aPtr;
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Store>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::IsStored
+// -----------------------------------------------------------------------------
+//
+TBool CVtFrameQueue::IsStored() const
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored<" ) ));
+ _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored %d>" ),
+ ( iBuffer != NULL ) ));
+ return ( iBuffer != NULL );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Buffer
+// -----------------------------------------------------------------------------
+//
+TVtMMFDataBuffer CVtFrameQueue::Buffer()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer<" ) ));
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer %d>" ),
+ reinterpret_cast< TUint >( iBuffer ) ));
+ return TVtMMFDataBuffer(iBuffer, iFrameSize, *iPtr);
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Release
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::Release()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Release<" ) ));
+ if ( !IsActive() && IsStored() )
+ {
+ iReleaseBuffer = iBuffer;
+ iBuffer = NULL;
+ iStatus = KRequestPending;
+ TRequestStatus* pStatus = &iStatus;
+ SetActive();
+ iThread.RequestComplete( pStatus, KErrNone );
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Release -done-" ) ));
+ }
+ _IFDBG(PRINT( _L( "CVtFrameQueue::Release>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::RunL()
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::RunL<" ) ));
+ DoReleaseBufferL( iReleaseBuffer );
+ _IFDBG(PRINT( _L( "CVtFrameQueue::RunL>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::DoReleaseBufferL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::DoReleaseBufferL( CMMFDataBuffer*& aBuffer )
+ {
+ _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL<" ) ));
+ if ( aBuffer && iSupplier )
+ {
+ iSupplier->BufferEmptiedL( aBuffer );
+ aBuffer = NULL;
+ }
+ _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::DoCancel()
+ {
+ // nothing to do
+ }
+
+// ============================ CVtCallback =================================
+
+// -----------------------------------------------------------------------------
+// CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver )
+// -----------------------------------------------------------------------------
+//
+CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver )
+: CActive( EPriorityStandard ), iObserver( &aObserver )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()<"), RThread().Id().operator TUint()));
+ CActiveScheduler::Add( this );
+ iOwnThreadId = RThread().Id();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::~CVtCallback()
+// -----------------------------------------------------------------------------
+//
+CVtCallback::~CVtCallback()
+ {
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo )
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+ iCallBackType = EVideoFrameSizeChanged;
+ iFrom = aFrom;
+ iTo = aTo;
+ IssueCallbackL();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::Result() const
+// -----------------------------------------------------------------------------
+//
+TInt CVtCallback::Result() const
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()>"), RThread().Id().operator TUint()));
+ return iResult;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::Completed() const
+// -----------------------------------------------------------------------------
+//
+TBool CVtCallback::Completed() const
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()>"), RThread().Id().operator TUint()));
+ return iCompleted;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::IssueCallbackL()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::IssueCallbackL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()<"), RThread().Id().operator TUint()));
+ iCompleted = EFalse;
+ TRequestStatus* pStatus = &iStatus;
+ RThread thread;
+ if( thread.Id() == iOwnThreadId )
+ {
+ SetActive();
+ User::RequestComplete( pStatus, KErrNone );
+ }
+ else
+ {
+ User::LeaveIfError( thread.Open( iOwnThreadId ) );
+ SetActive();
+ *pStatus = KRequestPending;
+ thread.RequestComplete( pStatus, KErrNone );
+ thread.Close();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::RunL()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::RunL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()<"), RThread().Id().operator TUint()));
+
+ iResult = KErrNone;
+
+ switch( iCallBackType )
+ {
+ case EVideoFrameSizeChanged:
+ iObserver->VideoFrameSizeChangedL( iFrom, iTo );
+ break;
+
+ default:
+ User::Leave( KErrArgument );
+ }
+
+ iCompleted = ETrue;
+
+ _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::DoCancel()
+ {
+ // do nothing!
+ }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::RunError( TInt aError )
+// -----------------------------------------------------------------------------
+//
+TInt CVtCallback::RunError( TInt aError )
+ {
+ iCompleted = ETrue;
+ iResult = aError;
+ return KErrNone;
+ }
+
+// ========================== TDisplaySinkParams ===============================
+
+// -----------------------------------------------------------------------------
+// TDisplaySinkParams::TDisplaySinkParams
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TDisplaySinkParams::TDisplaySinkParams() :
+ iFrameRateLimit( EFrameRateLimitNone )
+ {
+ }
+
+
+// ============================ CDisplaySink ===================================
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::~CDisplaySink
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::~CDisplaySink()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()<"), RThread().Id().operator TUint()));
+ delete iVideoFrameQueue;
+ iBitmapCS.Close();
+ delete iVTSignaller;
+ iVTMimeTypes.Reset();
+ iVTMimeTypes.Close();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()<"), RThread().Id().operator TUint()));
+ iDSFlags = aParams.iFlags;
+ iYuv420PlanarDesc.Delete( 0, iYuv420PlanarDesc.Length() );
+ iYuv420PlanarDesc.Append( KVtVideoMIMETypeYUV420 );
+ User::LeaveIfError( iVTMimeTypes.Append( &iYuv420PlanarDesc ) );
+ iVideoFrameQueue = new ( ELeave ) CVtFrameQueue();
+ iVTSignaller = new ( ELeave ) CVtCallback( *aParams.iObserver );
+ BitmapEntry( EFirstBitmap ).iIsFree = EFalse;
+ BitmapEntry( ESecondBitmap ).iIsFree = EFalse;
+ iThreadId = aParams.iThreadId;
+ iRequestStatusPtr = aParams.iRequestStatusPtr;
+ iFrameSize = QCIF;
+ SetFrameRateLimit( aParams.iFrameRateLimit );
+ User::LeaveIfError( iBitmapCS.CreateLocal() );
+ BaseConstructL( aParams, aInitData );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Destroy
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Destroy()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()<"), RThread().Id().operator TUint()));
+ delete this;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()<"), RThread().Id().operator TUint()));
+ iBitmapCS.Wait();
+ BitmapEntry( aBitmapNo ).iIsFree = ETrue;
+ BaseSetBitmapAvailable( aBitmapNo );
+ iBitmapCS.Signal();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Release
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Release()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()<"), RThread().Id().operator TUint()));
+ iBitmapCS.Wait();
+ if( !iReleased )
+ {
+ iReleased = ETrue;
+ if( iRequestStatusPtr != NULL &&
+ (*iRequestStatusPtr) == KRequestPending )
+ {
+ RThread thread;
+ TInt err = thread.Open( iThreadId );
+ if( err == KErrNone )
+ {
+ *iRequestStatusPtr = KRequestPending;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ thread.RequestComplete( statusP, KErrCancel );
+ thread.Close();
+ }
+ }
+ }
+ iVideoFrameQueue->Release();
+ iBitmapCS.Signal();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::UpdateSinkParamsL( const TDisplaySinkParams& aParams,
+// TBool& aUpdated )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::UpdateSinkParamsL(
+ const TDisplaySinkParams& aParams, TBool& aUpdated )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+ // This modification was requested by the VT engine team
+ iReleased = EFalse;
+ // This modification was requested by the VT engine team
+ iBitmapCS.Wait();
+ BaseUpdateSinkParamsL( aParams );
+ aUpdated = EFalse;
+ iParamsUpdated = &aUpdated;
+ iDSFlags = aParams.iFlags;
+ BitmapEntry( EFirstBitmap ).iIsFree = EFalse;
+ BitmapEntry( ESecondBitmap ).iIsFree = EFalse;
+ iVideoFrameQueue->Release();
+ iBitmapCS.Signal();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Pause()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Pause()
+ {
+ iBitmapCS.Wait();
+ iPaused = ETrue;
+ iVideoFrameQueue->Release();
+ iBitmapCS.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Resume()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Resume()
+ {
+ iBitmapCS.Wait();
+ iPaused = EFalse;
+ iBitmapCS.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::operator MVTVideoSink&()
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::operator MVTVideoSink&()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()>"), RThread().Id().operator TUint()));
+ return *this;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::NextFrame()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::GetMultimediaTypesL() const
+// -----------------------------------------------------------------------------
+//
+const RArray<TDesC8* >& CDisplaySink::GetMultimediaTypesL() const
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()>"), RThread().Id().operator TUint()));
+ return iVTMimeTypes;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetFormatL( const TDesC8& aFormat )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()<"), RThread().Id().operator TUint()));
+ if ( aFormat != KVtVideoMIMETypeYUV420 )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetVideoFrameSizeL( const TSize& aSize )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+ if ( iInitFlags & ESinkThreadLogonCalled )
+ {
+ SinkThreadLogonL();
+ }
+ if ( iInitFlags & EFbsSessionConnected )
+ {
+ TSize size( aSize );
+ BaseSetVideoFrameSizeL( aSize );
+ iFrameSize = aSize;
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::GetVideoFrameSizeL( TSize& aSize ) const
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+ aSize = iFrameSize;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::EmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::EmptyBufferL(
+ TVtMMFDataBuffer aDataBuffer,
+ MVTVideoSource* aSupplier,
+ TMediaId /*aMediaId*/ )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()<"), RThread().Id().operator TUint()));
+ if ( aDataBuffer.GetMMFBuffer() == NULL || aSupplier == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+ if ( iReleased )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): sink released, just return buffer"), RThread().Id().operator TUint()));
+ aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+ return;
+ }
+ else if ( iInitFlags & ESinkThreadLogonCalled )
+ {
+ TRAPD( result, SinkThreadLogonL() );
+ if ( result != KErrNone )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): SinkThreadLogonL failed %d"), RThread().Id().operator TUint(), result));
+ aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() );
+ User::Leave( result );
+ }
+ }
+ if ( aDataBuffer.GetMMFBuffer()->Type() != KVTUidYUVFrameBuffer )
+ {
+ User::Leave( KErrArgument );
+ }
+ if ( iState != EPlaying )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iBitmapCS.Wait();
+
+ CleanupSignalPushL( iBitmapCS );
+ iBuffer = aDataBuffer.GetMMFBuffer();
+ iSupplier = aSupplier;
+ if ( IsOkToSendFrame() )
+ {
+ // Waiting for frame size update?
+ if ( iWaitingForUpdate )
+ {
+ // Update completed?
+ if ( iVTSignaller->Completed() )
+ {
+ // YES: If it failed then Leave
+ if ( iVTSignaller->Result() != KErrNone )
+ {
+ iSupplier->BufferEmptiedL( iBuffer );
+ User::Leave( iVTSignaller->Result() );
+ }
+ }
+ else
+ {
+ // NO: Report buffer emptied and return
+ iSupplier->BufferEmptiedL( iBuffer );
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ return;
+ }
+ }
+
+ // Is param update pending?
+ if ( iParamsUpdated )
+ {
+ // YES: set new params
+ BaseDoUpdateParamsL();
+ *iParamsUpdated = ETrue;
+ iParamsUpdated = 0;
+ iWaitingForUpdate = EFalse;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): params update finished"), RThread().Id().operator TUint()));
+ }
+
+ // Update YUV data descriptor size based on resolution info.
+ TSize size( aDataBuffer.GetFrameSize() );
+ TInt length( ( size.iWidth * size.iHeight * 12 ) / 8 );
+ aDataBuffer.Data().Set( const_cast<TUint8*>( aDataBuffer.Data().Ptr() ), length, length );
+ // Expected frame size same as received size?
+ if ( !BaseSizesMatch( size ) )
+ {
+ if ( !iWaitingForUpdate )
+ {
+ iVTSignaller->VideoFrameSizeChangedL( iExpectedFrameSize,
+ aDataBuffer.GetFrameSize() );
+ BaseVideoFrameSizeChangedL( aDataBuffer.GetFrameSize() );
+ iWaitingForUpdate = ETrue;
+ }
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ return;
+ }
+ // All validation done, now it is ok to do implementation specific
+ // empty buffer.
+ BaseEmptyBufferL( aDataBuffer );
+
+// debugging
+// debugging
+// debugging
+
+ //iFC.PrintStatus();
+
+// debugging
+// debugging
+// debugging
+
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+ // No CleanupStack::PopAndDestroy() here, because cleanup is done in
+ // BaseEmptyBufferL(). Reason behind this decission is that certain
+ // things have to be handled either before or after cleanup and thus
+ // single cleanup here is not enough.
+ return;
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): dropping frame %d < %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval ));
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal()
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::BufferFilledL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::BufferFilledL( CMMFBuffer* /*aBuffer*/ )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()<"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CanCreateSinkBuffer
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySink::CanCreateSinkBuffer()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()>"), RThread().Id().operator TUint()));
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CreateSinkBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CDisplaySink::CreateSinkBufferL(
+ TMediaId /*aMediaId*/,
+ TBool& /*aReference*/ )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()>"), RThread().Id().operator TUint()));
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkThreadLogon( MAsyncEventHandler& /*aEventHandler*/ )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()<"), RThread().Id().operator TUint()));
+ iInitFlags |= ESinkThreadLogonCalled;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()>"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogonL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()<"), RThread().Id().operator TUint()));
+ TInt result( FbsStartup() );
+ if ( result == KErrNone )
+ {
+ CleanupStack::PushL( TCleanupItem( &SinkThreadLogonCleanup, this ) );
+ FbsConnectL();
+ ThreadOpenL();
+ User::LeaveIfError( iVideoFrameQueue->ThreadLogon() );
+ BaseSinkThreadLogonL();
+ iInitFlags &= ~ESinkThreadLogonCalled;
+ CleanupStack::Pop(); // TCleanupItem( &SinkThreadLogonCleanup, this )
+ }
+ User::LeaveIfError( result );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogoff()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()<"), RThread().Id().operator TUint()));
+ BaseSinkThreadLogoff();
+ iVideoFrameQueue->ThreadLogoff();
+ ThreadClose();
+ FbsDisconnect();
+ iInitFlags = 0;
+ iExpectedFrameSize = TSize();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPrimeL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPrimeL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()<"), RThread().Id().operator TUint()));
+ if ( iState != EStopped )
+ {
+ return KErrNone;
+ }
+ iState = EPrimed;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()>"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPlayL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPlayL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()<"), RThread().Id().operator TUint()));
+ if ( iState != EPrimed )
+ {
+ User::Leave( KErrNotReady );
+ }
+ ResetFrameRateLimitter();
+ iState = EPlaying;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()>"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPauseL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPauseL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()<"), RThread().Id().operator TUint()));
+ if ( iState != EPlaying )
+ {
+ return KErrNone;
+ }
+ iState = EPrimed;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()>"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkStopL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkStopL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()<"), RThread().Id().operator TUint()));
+ if ( iState == EStopped )
+ {
+ return KErrNone;
+ }
+ iBitmapCS.Wait();
+ iVideoFrameQueue->SinkStoppedL();
+ iBitmapCS.Signal();
+ iState = EStopped;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()>"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CDisplaySink
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::CDisplaySink() : MVTVideoSink( KNullUid ),
+ iSinkFourCC( 0 ), iState( EStopped )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetFrameRateLimit(
+// TDisplaySinkParams::TFrameRateLimit aFrameRateLimit )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetFrameRateLimit(
+ TDisplaySinkParams::TFrameRateLimit aFrameRateLimit )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()<"), RThread().Id().operator TUint()));
+ iFrameRateInterval = TInt( aFrameRateLimit );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ResetFrameRateLimitter()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ResetFrameRateLimitter()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()<"), RThread().Id().operator TUint()));
+ iMilliSecondsSinceLastFrame = 0;
+ iLastFrameTime = Time::NullTTime();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::BufferFilledL
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySink::IsOkToSendFrame()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame()<"), RThread().Id().operator TUint()));
+ TBool isOkToSendFrame( EFalse );
+ if( iPaused )
+ {
+ // nothing to do here because okToSendFrame defaults to EFalse
+ }
+ else if( iFrameRateInterval == TDisplaySinkParams::EFrameRateLimitNone )
+ {
+ // If no limitation is set -> send frame
+ isOkToSendFrame = ETrue;
+ }
+ else if( iLastFrameTime == Time::NullTTime() )
+ {
+ // EmptyBufferL() is being called the first time after SinkPlayL() ->
+ // send frame
+ iLastFrameTime.HomeTime();
+ isOkToSendFrame = ETrue;
+ }
+ else
+ {
+ // Check if enough time has passed since previous frame sent
+ TTime now;
+ now.HomeTime();
+ TTimeIntervalMicroSeconds interval(
+ now.MicroSecondsFrom( iLastFrameTime ) );
+ iMilliSecondsSinceLastFrame += I64INT( interval.Int64() ) / 1000;
+ iLastFrameTime = now;
+ if( iMilliSecondsSinceLastFrame >= iFrameRateInterval )
+ {
+ // Enough time passed -> send frame
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame(): sending frame %d >= %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval ));
+ isOkToSendFrame = ETrue;
+ while( iMilliSecondsSinceLastFrame >= iFrameRateInterval )
+ {
+ iMilliSecondsSinceLastFrame -= iFrameRateInterval;
+ }
+ }
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame() %d>"), RThread().Id().operator TUint(), isOkToSendFrame));
+ return isOkToSendFrame;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::FbsConnectL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::FbsConnectL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()<"), RThread().Id().operator TUint()));
+ if ( !( iInitFlags & EFbsSessionConnected ) )
+ {
+ User::LeaveIfError( RFbsSession::Connect() );
+ iInitFlags |= EFbsSessionConnected;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ThreadOpenL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ThreadOpenL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()<"), RThread().Id().operator TUint()));
+ if ( !( iInitFlags & EThreadOpened ) )
+ {
+ User::LeaveIfError( iThread.Open( iThreadId ) );
+ iInitFlags |= EThreadOpened;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::FbsDisconnect
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::FbsDisconnect()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()<"), RThread().Id().operator TUint()));
+ if ( iInitFlags & EFbsSessionConnected )
+ {
+ RFbsSession::Disconnect();
+ iInitFlags &= ~EFbsSessionConnected;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ThreadClose
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ThreadClose()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()<"), RThread().Id().operator TUint()));
+ if ( iInitFlags & EThreadOpened )
+ {
+ iThread.Close();
+ iInitFlags &= ~EThreadOpened;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogonCleanup
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogonCleanup( TAny* aPtr )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()<"), RThread().Id().operator TUint()));
+ CDisplaySink* self = reinterpret_cast< CDisplaySink* >( aPtr );
+ self->iVideoFrameQueue->ThreadLogoff();
+ self->ThreadClose();
+ self->FbsDisconnect();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()>"), RThread().Id().operator TUint()));
+ }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// -----------------------------------------------------------------------------
+// CreateSinkL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MDisplaySink* CreateSinkL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData )
+ {
+ MDisplaySink* sink = NULL;
+ if (aParams.iFlags & TDisplaySinkParams::EDisplaySinkNGA)
+ {
+ sink = CDisplaySinkNGA::NewL( aParams, aInitData );
+ }
+ else if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) &&
+ ( aParams.iFlags & TDisplaySinkParams::EDisplaySinkDP ) )
+ {
+ sink = CDisplaySinkDP::NewL( aParams, aInitData );
+ }
+ else
+ {
+ sink = CDisplaySinkDSA::NewL( aParams, aInitData );
+ }
+ return sink;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkDP.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2004 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: Display Sink subsystem for Display Posting.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CDisplaySinkDP.h"
+#include "vtyuvconverter.h"
+
+// MACROS
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP* CDisplaySinkDP::NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NewL()<"), RThread().Id().operator TUint()));
+ CDisplaySinkDP* self = new ( ELeave ) CDisplaySinkDP();
+ CleanupStack::PushL( self );
+ self->ConstructL( aParams, aInitData );
+ CleanupStack::Pop(); // self
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NewL()>"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::CDisplaySinkDP
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP::CDisplaySinkDP()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::Ctor<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::Ctor>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::~CDisplaySinkDP
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP::~CDisplaySinkDP()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::~<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::~>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< const TDisplaySinkParamsDP& >( aParams );
+ if ( !iNewParams.iPostingBuffer1 || !iNewParams.iPostingBuffer2 )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL() posting buffer is NULL!")));
+ User::Leave( KErrArgument );
+ }
+ iBitmapTable[EFirstBitmap].iBuffer = iNewParams.iPostingBuffer1;
+ iBitmapTable[ESecondBitmap].iBuffer = iNewParams.iPostingBuffer2;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDP::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert()<"), RThread().Id().operator TUint()));
+
+ TBool consumed( ETrue );
+ TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+ if ( iBitmapTable[ bitmapNo ].iIsFree &&
+ !iReleased &&
+ ( *iRequestStatusPtr == KRequestPending ) )
+ {
+ CPostingSurface::TPostingBuff* postingBuffer =
+ *iBitmapTable[ bitmapNo ].iBuffer;
+
+ TInt bufferLength(
+ postingBuffer->GetSize().iHeight * postingBuffer->GetStride() );
+
+ TPtr8 ptrBuffer(
+ static_cast< TUint8* >( postingBuffer->GetBuffer() ),
+ bufferLength,
+ bufferLength
+ );
+
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): buffer %d: $%x %d bytes"), RThread().Id().operator TUint(), bitmapNo, postingBuffer->GetBuffer(), bufferLength));
+
+ // Determine wether to convert or copy (420 will be just copied)
+ if ( iNewParams.iPostingFormat ==
+ CPostingSurface::EYuv422LeBt601Range0 )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): converting to 422"), RThread().Id().operator TUint()));
+ VtYuvConverter::ConvertFrom420PlanarTo422Interleaved(
+ aBuffer.Data(),
+ aBuffer.GetFrameSize(),
+ ptrBuffer,
+ postingBuffer->GetStride() );
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): copying as 420"), RThread().Id().operator TUint()));
+ ptrBuffer = aBuffer.Data();
+ }
+
+ iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, bitmapNo );
+ }
+ else
+ {
+ consumed = EFalse;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): could not find free buffer"), RThread().Id().operator TUint()));
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert()>"), RThread().Id().operator TUint()));
+ return consumed;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSinkThreadLogonL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+ UpdateExpectedFrameSizeL();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSinkThreadLogoff()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< const TDisplaySinkParamsDP& >( aParams );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseDoUpdateParamsL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+ iBitmapTable[ EFirstBitmap ].iBuffer = iNewParams.iPostingBuffer1;
+ iBitmapTable[ ESecondBitmap ].iBuffer = iNewParams.iPostingBuffer2;
+ UpdateExpectedFrameSizeL();
+ if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+ {
+ SetFrameRateLimit( iNewParams.iFrameRateLimit );
+ ResetFrameRateLimitter();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSetVideoFrameSizeL( const TSize& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDP::BaseSizesMatch( const TSize& aSize )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+ TBool sizesMatch( iExpectedFrameSize == aSize );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSizesMatch() %d>"), RThread().Id().operator TUint(), sizesMatch));
+ return sizesMatch;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkDP::BitmapEntry( TInt aIndex )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BitmapEntry()>"), RThread().Id().operator TUint()));
+ return iBitmapTable[ aIndex ];
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+ if ( BaseConvert( aVTMMFBuffer ) )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()), aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data() );
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ }
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSetBitmapAvailable( TBitmapNo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+ NextFrame();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseVideoFrameSizeChangedL( const TSize& )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseVideoFrameSizeChangedL( const TSize& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::NextFrame()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NextFrame()<"), RThread().Id().operator TUint()));
+ if ( iVideoFrameQueue->IsStored() )
+ {
+ if ( IsOkToSendFrame() )
+ {
+ BaseConvert( iVideoFrameQueue->Buffer() );
+ }
+ iVideoFrameQueue->Release();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NextFrame()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::UpdateExpectedFrameSizeL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+ iExpectedFrameSize = iNewParams.iFrameSize;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkDSA.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2006 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: Display Sink subsystem for Direct Screen Access.
+*
+*/
+
+
+// INCLUDES
+
+#include <cvtimageconverter.h>
+#include <cvtimageiyuv.h>
+#include "CDisplaySinkDSA.h"
+#include "TDisplaySinkParamsDSA.h"
+
+// MACROS
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+// ======================== CDisplaySinkDSA ==============================
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA* CDisplaySinkDSA::NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::NewL()<"), RThread().Id().operator TUint()));
+ CDisplaySinkDSA* self = new ( ELeave ) CDisplaySinkDSA();
+ CleanupStack::PushL( self );
+ self->ConstructL( aParams, aInitData );
+ CleanupStack::Pop(); // self
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::NewL()>"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::CDisplaySinkDSA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA::CDisplaySinkDSA()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::Ctor<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::Ctor>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::~CDisplaySinkDSA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA::~CDisplaySinkDSA()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::~<"), RThread().Id().operator TUint()));
+ delete iRotator;
+ delete iYUVBitmapConverterVT;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::~>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< TDisplaySinkParamsDSA& > ( aParams );
+ if ( !iNewParams.iBitmap1Handle || !iNewParams.iBitmap2Handle )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL() bitmap handle NULL!") ));
+ User::Leave( KErrArgument );
+ }
+ iBitmapTable[EFirstBitmap].iHandle = iNewParams.iBitmap1Handle;
+ iBitmapTable[ESecondBitmap].iHandle = iNewParams.iBitmap2Handle;
+ iRotator = CVtImageRotator::NewL( *this );
+ iRotationAngle = iNewParams.iRotationAngle;
+ iYUVBitmapConverterVT = CVTIYUVFbsBitmapConverter::NewL(
+ QCIF, iBitmapTable[EFirstBitmap].iHandle );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDSA::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert()<"), RThread().Id().operator TUint()));
+ TBool converted( EFalse );
+ TRAPD( err, ConvertL( aBuffer.Data(), converted ) );
+ if ( err != KErrNone )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert() err=%d"), RThread().Id().operator TUint(), err));
+ converted = EFalse;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert() %d>"), RThread().Id().operator TUint(), converted));
+ return converted;
+ }
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSinkThreadLogonL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+ CVTYUVFbsBitmapConverter* converter1 =
+ CVTIYUVFbsBitmapConverter::NewL(
+ QCIF,
+ iBitmapTable[EFirstBitmap].iHandle );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL() 1"), RThread().Id().operator TUint()));
+ CleanupStack::PushL( converter1 );
+ CVTYUVFbsBitmapConverter* converter2 =
+ CVTIYUVFbsBitmapConverter::NewL(
+ QCIF,
+ iBitmapTable[ESecondBitmap].iHandle );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL() 2"), RThread().Id().operator TUint()));
+ CleanupStack::PushL( converter2 );
+ CleanupStack::Pop( 2 ); // converter1, converter2
+ iYUVBitmapConverter1 = converter1;
+ iYUVBitmapConverter2 = converter2;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSinkThreadLogoff()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+ delete iYUVBitmapConverter1;
+ delete iYUVBitmapConverter2;
+ delete iSourceImg; iSourceImg = 0;
+ delete iTargetImg; iTargetImg = 0;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< const TDisplaySinkParamsDSA& >( aParams );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseDoUpdateParamsL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+ iRotationAngle = iNewParams.iRotationAngle;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL() handle1=%d"), RThread().Id().operator TUint(), iNewParams.iBitmap1Handle));
+ iBitmapTable[ EFirstBitmap ].iHandle = iNewParams.iBitmap1Handle;
+ iBitmapTable[ EFirstBitmap ].iIsFree = ETrue;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL() handle2=%d"), RThread().Id().operator TUint(), iNewParams.iBitmap2Handle));
+ iBitmapTable[ ESecondBitmap ].iHandle = iNewParams.iBitmap2Handle;
+ iBitmapTable[ ESecondBitmap ].iIsFree = EFalse;
+ UpdateExpectedFrameSizeL();
+ iYUVBitmapConverter1->SetSourceSizeL( iExpectedFrameSize );
+ iYUVBitmapConverter1->SetDestinationL( iNewParams.iBitmap1Handle );
+ iYUVBitmapConverter2->SetSourceSizeL( iExpectedFrameSize );
+ iYUVBitmapConverter2->SetDestinationL( iNewParams.iBitmap2Handle );
+ if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+ {
+ SetFrameRateLimit( iNewParams.iFrameRateLimit );
+ ResetFrameRateLimitter();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSetVideoFrameSizeL( const TSize& aSize )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+ TSize size( aSize );
+ if( ( iRotationAngle == CVtImageRotator::E90DegreesClockwise ) ||
+ ( iRotationAngle == CVtImageRotator::E270DegreesClockwise ) )
+ {
+ size = TSize( aSize.iHeight, aSize.iWidth );
+ }
+ iYUVBitmapConverter1->SetSourceSizeL( size );
+ iYUVBitmapConverter2->SetSourceSizeL( size );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDSA::BaseSizesMatch( const TSize& aSize )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+ TBool sizesMatch( iExpectedFrameSize == aSize );
+ TBool rotateChangesDimension(
+ ( iRotationAngle == CVtImageRotator::E90DegreesClockwise ) ||
+ ( iRotationAngle == CVtImageRotator::E270DegreesClockwise ) );
+ if( rotateChangesDimension )
+ {
+ sizesMatch =
+ ( iExpectedFrameSize.iWidth == aSize.iHeight ) &&
+ ( iExpectedFrameSize.iHeight == aSize.iWidth );
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSizesMatch() %d>"), RThread().Id().operator TUint(), sizesMatch));
+ return sizesMatch;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkDSA::BitmapEntry( TInt aIndex )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BitmapEntry()>"), RThread().Id().operator TUint()));
+ return iBitmapTable[ aIndex ];
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+ if( iRotationAngle != CVtImageRotator::ERotationNone )
+ {
+ TSize size( aVTMMFBuffer.GetFrameSize() );
+ TInt length( ( size.iWidth * size.iHeight * 12 ) / 8 );
+ // Modifiable pointer descriptor needed, we don't want a copy of image!
+ TPtr8 ptrData( const_cast< TUint8* >(
+ aVTMMFBuffer.Data().Ptr() ), length, length );
+
+ if( iSourceImg == 0 )
+ {
+ // If source image is not created -> create it
+ iSourceImg = CVtImageIYUV::NewL( size, ptrData );
+ }
+ else
+ {
+ // otherwise just update the data
+ if( iSourceImg->Size() == size )
+ {
+ iSourceImg->SetImageL( ptrData );
+ }
+ else
+ {
+ delete iSourceImg; iSourceImg = 0;
+ iSourceImg = CVtImageIYUV::NewL( size, ptrData );
+ }
+ }
+ iRotator->RotateL( *iSourceImg, *iTargetImg, iRotationAngle );
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ }
+ else
+ {
+ if ( BaseConvert( aVTMMFBuffer ) )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()), aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data());
+ CleanupStack::PopAndDestroy();
+ }
+ }
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+ if ( iVideoFrameQueue->IsStored() )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() buffer pending"), RThread().Id().operator TUint()));
+ if ( !iReleased && ( *iRequestStatusPtr == KRequestPending ) && IsOkToSendFrame() )
+ {
+ TRAPD( result, {
+ iYUVBitmapConverterVT->SetDestinationL(
+ iBitmapTable[ aBitmapNo ].iHandle );
+ iYUVBitmapConverterVT->SetSourceL(
+ iVideoFrameQueue->Buffer().Data() );
+ iYUVBitmapConverterVT->ProcessL();
+ } );
+ if ( result == KErrNone )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() conversion succeeded!"), RThread().Id().operator TUint()));
+ iBitmapTable[ aBitmapNo ].iIsFree = EFalse;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, aBitmapNo );
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() conversion failed!"), RThread().Id().operator TUint()));
+ // Drop frame
+ }
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() dropping frame"), RThread().Id().operator TUint()));
+ // Drop frame
+ }
+ iVideoFrameQueue->Release();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseVideoFrameSizeChangedL( const TSize& aNewSize )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseVideoFrameSizeChangedL( const TSize& aNewSize )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+ iYUVBitmapConverterVT->SetSourceSizeL( aNewSize );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::UpdateExpectedFrameSizeL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+ CFbsBitmap* bm = new ( ELeave ) CFbsBitmap();
+ CleanupStack::PushL( bm );
+ User::LeaveIfError( bm->Duplicate( iBitmapTable[ EFirstBitmap ].iHandle ) );
+ iExpectedFrameSize = bm->SizeInPixels();
+ User::LeaveIfError( bm->Duplicate( iBitmapTable[ ESecondBitmap ].iHandle ) );
+ if( iExpectedFrameSize != bm->SizeInPixels() )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL(): EFirstBitmap size is different from ESecondBitmap size -> Leave()"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+ CleanupStack::PopAndDestroy(); // bm
+ delete iTargetImg; iTargetImg = 0;
+ iTargetImg = CVtImageIYUV::NewL( iExpectedFrameSize );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::RotationFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::RotationFinished( TInt aError )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::RotationFinished()<"), RThread().Id().operator TUint()));
+ // Rotation finished .. do something
+ if( aError == KErrNone )
+ {
+ iBitmapCS.Wait();
+ TBool converted( EFalse );
+ TRAP( aError, ConvertL( iTargetImg->Image(), converted ) );
+ iBitmapCS.Signal();
+ TRAPD( aError2, iSupplier->BufferEmptiedL( iBuffer ) );
+ if( ( aError != KErrNone ) || ( aError2 != KErrNone ) )
+ {
+ *iRequestStatusPtr = KRequestPending;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, aError );
+ }
+ }
+ else
+ {
+ *iRequestStatusPtr = KRequestPending;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, aError );
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::RotationFinished()>"), RThread().Id().operator TUint()));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::ConvertL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::ConvertL( const TPtrC8& aBuffer, TBool& aConverted )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL()<"), RThread().Id().operator TUint()));
+ TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+ if ( iBitmapTable[ bitmapNo ].iIsFree &&
+ !iReleased &&
+ ( *iRequestStatusPtr == KRequestPending ) )
+ {
+ DoConvertL( aBuffer, bitmapNo );
+ aConverted = ETrue;
+ iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, bitmapNo );
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL(): could not find free bitmap"), RThread().Id().operator TUint()));
+ aConverted = EFalse;
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::DoConvert
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::DoConvertL( const TPtrC8& aBuffer, TBitmapNo aBitmapNo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::DoConvertL()<"), RThread().Id().operator TUint()));
+ CVTYUVFbsBitmapConverter* c = 0;
+ switch( aBitmapNo )
+ {
+ case EFirstBitmap:
+ c = iYUVBitmapConverter1;
+ break;
+
+ case ESecondBitmap:
+ c = iYUVBitmapConverter2;
+ break;
+
+ default:
+ User::Leave( KErrArgument );
+ };
+ c->SetSourceL( aBuffer );
+ c->ProcessL();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::DoConvertL()>"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkNGA.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,818 @@
+/*
+* Copyright (c) 2004-2006 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: Class for CDisplaySinkNGA.
+*
+*/
+
+// INCLUDE FILES
+
+#include "CDisplaySinkNGA.h"
+
+// MACROS
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+ static const TUint8 NGA_COFF_TBL_64K[ 220 ]=
+ {
+ 0xe9,0x66,0x01,0x00, // KRedCrFactor
+ 0x1a,0x58,0x00,0x00, // KGreenCbFactor
+ 0xd2,0xb6,0x00,0x00, // KGreenCrFactor
+ 0xa2,0xc5,0x01,0x00, // KBlueCbFactor
+
+ 0x00,0x00,0x00,0x00, // 5-bit
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x01,0x02,0x03,
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+
+ 0x00,0x00,0x00,0x00, // 6-bit
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x01,0x02,0x03,
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+ 0x20,0x21,0x22,0x23,
+ 0x24,0x25,0x26,0x27,
+ 0x28,0x29,0x2a,0x2b,
+ 0x2c,0x2d,0x2e,0x2f,
+ 0x30,0x31,0x32,0x33,
+ 0x34,0x35,0x36,0x37,
+ 0x38,0x39,0x3a,0x3b,
+ 0x3c,0x3d,0x3e,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f
+ };
+
+
+ const TUint8 NGA_COFF_TBL_16M[ 528 ] =
+ {
+ 0xe9,0x66,0x01,0x00, // KRedCrFactor
+ 0x1a,0x58,0x00,0x00, // KGreenCbFactor
+ 0xd2,0xb6,0x00,0x00, // KGreenCrFactor
+ 0xa2,0xc5,0x01,0x00, // KBlueCbFactor
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x01,0x02,0x03, // 8-bit
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+
+ 0x20,0x21,0x22,0x23,
+ 0x24,0x25,0x26,0x27,
+ 0x28,0x29,0x2a,0x2b,
+ 0x2c,0x2d,0x2e,0x2f,
+
+ 0x30,0x31,0x32,0x33,
+ 0x34,0x35,0x36,0x37,
+ 0x38,0x39,0x3a,0x3b,
+ 0x3c,0x3d,0x3e,0x3f,
+
+ 0x40,0x41,0x42,0x43,
+ 0x44,0x45,0x46,0x47,
+ 0x48,0x49,0x4a,0x4b,
+ 0x4c,0x4d,0x4e,0x4f,
+
+ 0x50,0x51,0x52,0x53,
+ 0x54,0x55,0x56,0x57,
+ 0x58,0x59,0x5a,0x5b,
+ 0x5c,0x5d,0x5e,0x5f,
+
+ 0x60,0x61,0x62,0x63,
+ 0x64,0x65,0x66,0x67,
+ 0x68,0x69,0x6a,0x6b,
+ 0x6c,0x6d,0x6e,0x6f,
+
+ 0x70,0x71,0x72,0x73,
+ 0x74,0x75,0x76,0x77,
+ 0x78,0x79,0x7a,0x7b,
+ 0x7c,0x7d,0x7e,0x7f,
+
+ 0x80,0x81,0x82,0x83,
+ 0x84,0x85,0x86,0x87,
+ 0x88,0x89,0x8a,0x8b,
+ 0x8c,0x8d,0x8e,0x8f,
+
+ 0x90,0x91,0x92,0x93,
+ 0x94,0x95,0x96,0x97,
+ 0x98,0x99,0x9a,0x9b,
+ 0x9c,0x9d,0x9e,0x9f,
+
+ 0xa0,0xa1,0xa2,0xa3,
+ 0xa4,0xa5,0xa6,0xa7,
+ 0xa8,0xa9,0xaa,0xab,
+ 0xac,0xad,0xae,0xaf,
+
+ 0xb0,0xb1,0xb2,0xb3,
+ 0xb4,0xb5,0xb6,0xb7,
+ 0xb8,0xb9,0xba,0xbb,
+ 0xbc,0xbd,0xbe,0xbf,
+
+ 0xc0,0xc1,0xc2,0xc3,
+ 0xc4,0xc5,0xc6,0xc7,
+ 0xc8,0xc9,0xca,0xcb,
+ 0xcc,0xcd,0xce,0xcf,
+
+ 0xd0,0xd1,0xd2,0xd3,
+ 0xd4,0xd5,0xd6,0xd7,
+ 0xd8,0xd9,0xda,0xdb,
+ 0xdc,0xdd,0xde,0xdf,
+
+ 0xe0,0xe1,0xe2,0xe3,
+ 0xe4,0xe5,0xe6,0xe7,
+ 0xe8,0xe9,0xea,0xeb,
+ 0xec,0xed,0xee,0xef,
+
+ 0xf0,0xf1,0xf2,0xf3,
+ 0xf4,0xf5,0xf6,0xf7,
+ 0xf8,0xf9,0xfa,0xfb,
+ 0xfc,0xfd,0xfe,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff
+ };
+
+
+ void ConvertFrom420PlanarToRGB_565(
+ const TDesC8& aSource,
+ const TSize& aSize,
+ TDes8& aTarget,
+ TInt aStride )
+ {
+ TInt height( aSize.iHeight >> 1 );
+ TInt width( aSize.iWidth );
+
+ TInt ySize = aSize.iWidth * aSize.iHeight;
+ TInt ySizeDiv4 = ( ySize >> 2 );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( aSource.Mid( 0, ySize ).Ptr() );
+ const TUint32* u = reinterpret_cast< const TUint32* >( aSource.Mid( ySize, ySizeDiv4 ).Ptr() );
+ const TUint32* v = reinterpret_cast< const TUint32* >( aSource.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr() );
+
+ TUint32 uintsPerDestRow = aStride >> 2;
+
+ const TUint32* TargetPtr = reinterpret_cast< const TUint32* >( aTarget.Ptr() );
+
+ TUint32* d1 = const_cast< TUint32* >( TargetPtr );
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TInt32 red;
+ TInt32 green;
+ TInt32 blue;
+ TUint32 r1;
+ const TUint8* clip = NGA_COFF_TBL_64K + 40;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 = green | ( red << 4 );
+ r1 = blue | ( r1 << 4 );
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+ d1[ uintsPerDestRow ] = r1;
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 = green | ( red << 4 );
+ r1 = blue | ( r1 << 4 );
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+ *d1++ = r1;
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += uintsPerDestRow;
+ }
+ }
+
+
+ void ConvertFrom420PlanarToXRGB_8888(
+ const TDesC8& aSource,
+ const TSize& aSize,
+ TDes8& aTarget,
+ TInt aStride )
+ {
+
+ TInt height( aSize.iHeight >> 1 );
+ TInt width( aSize.iWidth );
+
+ TInt ySize = aSize.iWidth * aSize.iHeight;
+ TInt ySizeDiv4 = ( ySize >> 2 );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( aSource.Mid( 0, ySize ).Ptr() );
+ const TUint32* u = reinterpret_cast< const TUint32* >( aSource.Mid( ySize, ySizeDiv4 ).Ptr() );
+ const TUint32* v = reinterpret_cast< const TUint32* >( aSource.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr() );
+
+ TUint32 uintsPerDestRow = aStride >> 2;
+
+ const TUint32* TargetPtr = reinterpret_cast< const TUint32* >( aTarget.Ptr() );
+
+ TUint32* d1 = const_cast< TUint32* >( TargetPtr );
+
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TUint32 p;
+ const TUint8* clip = NGA_COFF_TBL_16M + 144;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ d1[ uintsPerDestRow ] = clip[ yy + cb ] | ( p << 8 );
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ d1[ uintsPerDestRow + 1 ] = clip[ yy + cb ] | ( p << 8 );
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ *d1++ = clip[ yy + cb ] | ( p << 8 );
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ *d1++ = clip[ yy + cb ] | ( p << 8 );
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += uintsPerDestRow;
+ }
+
+ }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA* CDisplaySinkNGA::NewL( TDisplaySinkParams& aParams,
+ const TDesC8& aInitData )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NewL()<"), RThread().Id().operator TUint()));
+ CDisplaySinkNGA* self = new ( ELeave ) CDisplaySinkNGA();
+ CleanupStack::PushL( self );
+ self->ConstructL( aParams, aInitData );
+ CleanupStack::Pop(); // self
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NewL()>"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::CDisplaySinkNGA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA::CDisplaySinkNGA()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::Ctor<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::Ctor>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::~CDisplaySinkNGA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA::~CDisplaySinkNGA()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::~<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::~>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseConstructL( TDisplaySinkParams& aParams,
+ const TDesC8& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< const TDisplaySinkParamsNGA& >( aParams );
+ if ( !iNewParams.iSurfaceBuffer1 || !iNewParams.iSurfaceBuffer2 )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL() surface buffer is NULL!")));
+ User::Leave( KErrArgument );
+ }
+ iBitmapTable[EFirstBitmap].iBuffer = iNewParams.iSurfaceBuffer1;
+ iBitmapTable[ESecondBitmap].iBuffer = iNewParams.iSurfaceBuffer2;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkNGA::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert()<"), RThread().Id().operator TUint()));
+
+ TBool consumed( ETrue );
+ TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+ if ( iBitmapTable[ bitmapNo ].iIsFree &&
+ !iReleased &&
+ ( *iRequestStatusPtr == KRequestPending ) )
+ {
+#if 1
+ TInt bufferLength(
+ //iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 2 ) );
+ iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 3/2 ) );
+#else
+ TInt bufferLength(
+ iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 4 ) );
+#endif
+
+ TPtr8 ptrBuffer(
+ *iBitmapTable[ bitmapNo ].iBuffer,
+ bufferLength,
+ bufferLength
+ );
+
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): buffer %d: $%x %d bytes"), RThread().Id().operator TUint(), bitmapNo, *iBitmapTable[ bitmapNo ].iBuffer, bufferLength));
+
+ // Determine wether to convert or copy (420 will be just copied)
+ //if ( iNewParams.iSurfaceFormat == EUidPixelFormatRGB_565 )
+ if ( iNewParams.iSurfaceFormat == EUidPixelFormatXRGB_8888 )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): converting to RGB565"), RThread().Id().operator TUint()));
+
+ /*
+ ConvertFrom420PlanarToRGB_565(
+ aBuffer.Data(),
+ aBuffer.GetFrameSize(),
+ ptrBuffer,
+ iNewParams.iFrameSize.iWidth * 2 );
+ */
+
+ ConvertFrom420PlanarToXRGB_8888(
+ aBuffer.Data(),
+ aBuffer.GetFrameSize(),
+ ptrBuffer,
+ iNewParams.iFrameSize.iWidth * 4 );
+
+ }
+ else
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): copying as 420"), RThread().Id().operator TUint()));
+ ptrBuffer = aBuffer.Data();
+ }
+
+ iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+ TRequestStatus* statusP = iRequestStatusPtr;
+ iThread.RequestComplete( statusP, bitmapNo );
+ }
+ else
+ {
+ consumed = EFalse;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): could not find free buffer"), RThread().Id().operator TUint()));
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert()>"), RThread().Id().operator TUint()));
+ return consumed;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSinkThreadLogonL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+ UpdateExpectedFrameSizeL();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSinkThreadLogoff()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+ iNewParams = static_cast< const TDisplaySinkParamsNGA& >( aParams );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseDoUpdateParamsL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+ iBitmapTable[ EFirstBitmap ].iBuffer = iNewParams.iSurfaceBuffer1;
+ iBitmapTable[ ESecondBitmap ].iBuffer = iNewParams.iSurfaceBuffer2;
+ UpdateExpectedFrameSizeL();
+ if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+ {
+ SetFrameRateLimit( iNewParams.iFrameRateLimit );
+ ResetFrameRateLimitter();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSetVideoFrameSizeL( const TSize& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkNGA::BaseSizesMatch( const TSize& aSize)
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+ TBool sizesMatch( iExpectedFrameSize == aSize );
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSizesMatch()>"), RThread().Id().operator TUint()));
+ return sizesMatch;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkNGA::BitmapEntry( TInt aIndex )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BitmapEntry()>"), RThread().Id().operator TUint()));
+ return iBitmapTable[ aIndex ];
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+ if ( BaseConvert( aVTMMFBuffer ) )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+ {
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ iSupplier->BufferEmptiedL( iBuffer );
+ }
+ else
+ {
+ iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()), aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data());
+ CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+ }
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSetBitmapAvailable( TBitmapNo )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+ if ( iVideoFrameQueue->IsStored() )
+ {
+ if ( IsOkToSendFrame() )
+ {
+ BaseConvert( iVideoFrameQueue->Buffer() );
+ }
+ iVideoFrameQueue->Release();
+ }
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseVideoFrameSizeChangedL( const TSize& )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseVideoFrameSizeChangedL( const TSize& )
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::NextFrame()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NextFrame()<"), RThread().Id().operator TUint()));
+ iBitmapCS.Wait();
+ if ( iVideoFrameQueue->IsStored() )
+ {
+ if ( IsOkToSendFrame() )
+ {
+ BaseConvert( iVideoFrameQueue->Buffer() );
+ }
+ iVideoFrameQueue->Release();
+ }
+ iBitmapCS.Signal();
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NextFrame()>"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::UpdateExpectedFrameSizeL()
+ {
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+ iExpectedFrameSize = iNewParams.iFrameSize;
+ _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImage.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImage::Type() const
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtImage::TVtImageType CVtImage::Type() const
+ {
+ return iType;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImage::DisplayModeToVtDisplayMode( TDisplayMode aMode )
+// -----------------------------------------------------------------------------
+//
+CVtImage::TVtDisplayMode CVtImage::DisplayModeToVtDisplayMode(
+ TDisplayMode aMode )
+ {
+ TVtDisplayMode mode;
+
+ switch( aMode )
+ {
+ case EColor4K:
+ mode = EVtColor4K;
+ break;
+
+ case EColor64K:
+ mode = EVtColor64K;
+ break;
+
+ case EColor16M:
+ mode = EVtColor16M;
+ break;
+
+ case EColor16MU:
+ mode = EVtColor16MU;
+ break;
+
+ case EColor16MA:
+ case EColor16MAP:
+ mode = EVtColor16MA;
+ break;
+
+ default:
+ mode = EVtColorNone;
+ break;
+ }
+
+ return mode;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImage::CVtImage( TVtImageType aType )
+// -----------------------------------------------------------------------------
+//
+CVtImage::CVtImage( TVtImageType aType )
+: iType( aType )
+ {
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageBitmap.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageBitmap.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NewL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap* CVtImageBitmap::NewL( TInt aBitmapHandle )
+ {
+ CVtImageBitmap* self = new ( ELeave ) CVtImageBitmap();
+ CleanupStack::PushL( self );
+ self->ConstructL( aBitmapHandle );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NewL( const TSize& aSize, TDisplayMode aDisplayMode )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap* CVtImageBitmap::NewL(
+ const TSize& aSize,
+ TDisplayMode aDisplayMode )
+ {
+ CVtImageBitmap* self = new ( ELeave ) CVtImageBitmap();
+ CleanupStack::PushL( self );
+ self->ConstructL( aSize, aDisplayMode );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::~CVtImageBitmap()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap::~CVtImageBitmap()
+ {
+ delete iBitmap;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ResizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageBitmap::ResizeL( const TSize& aSize )
+ {
+ User::LeaveIfError( iBitmap->Resize( aSize ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::SetBitmapL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageBitmap::SetBitmapL( TInt aBitmapHandle )
+ {
+ delete iBitmap;
+ iBitmap = 0;
+ ConstructL( aBitmapHandle );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::Bitmap() const
+// -----------------------------------------------------------------------------
+EXPORT_C CFbsBitmap& CVtImageBitmap::Bitmap() const
+ {
+ return *iBitmap;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageBitmap::NeedHeapLock() const
+ {
+ return iBitmap->IsLargeBitmap();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::DisplayMode() const
+// -----------------------------------------------------------------------------
+CVtImage::TVtDisplayMode CVtImageBitmap::DisplayMode() const
+ {
+ return CVtImage::DisplayModeToVtDisplayMode( iBitmap->DisplayMode() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::Size() const
+// -----------------------------------------------------------------------------
+TSize CVtImageBitmap::Size() const
+ {
+ return iBitmap->SizeInPixels();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::BytesPerRow() const
+// -----------------------------------------------------------------------------
+TInt CVtImageBitmap::BytesPerRow() const
+ {
+ return iBitmap->ScanLineLength( Size().iWidth, iBitmap->DisplayMode() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::DataAddress() const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageBitmap::DataAddress() const
+ {
+ return iBitmap->DataAddress();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::LineAddress( TInt aLine ) const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageBitmap::LineAddress( TInt aLine ) const
+ {
+ if( aLine < 0 )
+ {
+ aLine = 0;
+ }
+ else if( aLine > Size().iHeight - 1 )
+ {
+ aLine = Size().iHeight - 1;
+ }
+ return reinterpret_cast< TUint32* >(
+ reinterpret_cast< TUint8* >( DataAddress() ) + BytesPerRow() * aLine );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::CVtImageBitmap()
+// -----------------------------------------------------------------------------
+CVtImageBitmap::CVtImageBitmap()
+: CVtImage( CVtImage::EVtImageBitmap )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ConstructL( const TSize& aSize, TDisplayMode aDisplayMode )
+// -----------------------------------------------------------------------------
+void CVtImageBitmap::ConstructL( const TSize& aSize, TDisplayMode aDisplayMode )
+ {
+ iBitmap = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap->Create( aSize, aDisplayMode ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ConstructL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+void CVtImageBitmap::ConstructL( TInt aBitmapHandle )
+ {
+ iBitmap = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( iBitmap->Duplicate( aBitmapHandle ) );
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageConverter.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1894 @@
+/*
+* Copyright (c) 2004 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: YUV to bitmap and bitmap to YUV conversion routines for VT
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+#include "cvtimageconverter.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// Calculates average for two integer values
+#define AVG( a, b ) ( ( a + b ) >> 1 )
+
+// MODULE DATA STRUCTURES
+
+/**
+* Holds data for one YUV pixel
+*
+* @lib VTImageConverter.lib
+*/
+struct TVSYCrCb
+ {
+ public:
+ // Y data
+ TInt iY;
+
+ // Cb (U) data
+ TInt iCb;
+
+ // Cr (V) data
+ TInt iCr;
+ };
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RGBtoYCbCr( TVSYCrCb* aYuv, const TRgb& aColor )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 RGBtoYCbCr( TVSYCrCb* aYuv, const TRgb& aColor )
+ {
+ const TInt YRedFactor = 19595; // 0.299 << 16
+ const TInt YGreenFactor = 38470; // 0.587 << 16
+ const TInt YBlueFactor = 7471; // 0.114 << 16
+ const TInt CbRedFactor = 11056; // 0.1687 << 16
+ const TInt CbGreenFactor = 21712; // 0.3313 << 16
+ const TInt CrGreenFactor = 27440; // 0.4187 << 16
+ const TInt CrBlueFactor = 5328; // 0.0813 << 16
+
+ TInt red = aColor.Red();
+ TInt green = aColor.Green();
+ TInt blue = aColor.Blue();
+
+ aYuv->iY = ( YRedFactor * red ) +
+ ( YGreenFactor * green ) +
+ ( YBlueFactor * blue );
+ aYuv->iCb = - ( CbRedFactor * red ) -
+ ( CbGreenFactor * green ) +
+ ( blue << 15 );
+ aYuv->iCr = ( red << 15 ) -
+ ( CrGreenFactor * green ) -
+ ( CrBlueFactor * blue );
+
+ aYuv->iY >>= 16;
+ aYuv->iCb >>= 16;
+ aYuv->iCr >>= 16;
+
+ aYuv->iCb += 128;
+ aYuv->iCr += 128;
+
+ return static_cast< TUint8 >( aYuv->iY );
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor4K( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor4K( TAny*& aSource )
+ {
+ TUint16* s = static_cast< TUint16* >( aSource );
+ TRgb rgb( TRgb::Color4K( *s++ ) );
+ aSource = s;
+ return rgb;
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor64K( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor64K( TAny*& aSource )
+ {
+ TUint16* s = static_cast< TUint16* >( aSource );
+ TRgb rgb( TRgb::Color64K( *s++ ) );
+ aSource = s;
+ return rgb;
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor16M( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16M( TAny*& aSource )
+ {
+ TUint8* s = static_cast< TUint8* >( aSource );
+ TRgb rgb( s[ 2 ], s[ 1 ], s[ 0 ] );
+ aSource = s + 3;
+ return rgb;
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor16MU( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16MU( TAny*& aSource )
+ {
+ TUint32* s = static_cast< TUint32* >( aSource );
+ TRgb rgb( TRgb::Color16MU( *s++ ) );
+ aSource = s;
+ return rgb;
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor16MA( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16MA( TAny*& aSource )
+ {
+ TUint32* s = static_cast< TUint32* >( aSource );
+ TRgb rgb( TRgb::Color16MA( *s++ ) );
+ aSource = s;
+ return rgb;
+ }
+
+// -----------------------------------------------------------------------------
+// VSReadColor16MAP( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16MAP( TAny*& aSource )
+ {
+ TUint32* s = static_cast< TUint32* >( aSource );
+ TRgb rgb( TRgb::Color16MAP( *s++ ) );
+ aSource = s;
+ return rgb;
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_4K[ 80 ]=
+ {
+ 0xe9,0x66,0x01,0x00, // KRedCrFactor
+ 0x1a,0x58,0x00,0x00, // KGreenCbFactor
+ 0xd2,0xb6,0x00,0x00, // KGreenCrFactor
+ 0xa2,0xc5,0x01,0x00, // KBlueCbFactor
+
+ 0x00,0x00,0x00,0x00, // 4-bit
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00, // 5
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x01,0x02,0x03,
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f, // 10
+ 0x0f,0x0f,0x0f,0x0f,
+ 0x0f,0x0f,0x0f,0x0f,
+ 0x0f,0x0f,0x0f,0x0f,
+ 0x0f,0x0f,0x0f,0x0f,
+ 0x0f,0x0f,0x0f,0x0f, // 15
+ 0x0f,0x0f,0x0f,0x0f
+ };
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_64K[ 220 ]=
+ {
+ 0xe9,0x66,0x01,0x00, // KRedCrFactor
+ 0x1a,0x58,0x00,0x00, // KGreenCbFactor
+ 0xd2,0xb6,0x00,0x00, // KGreenCrFactor
+ 0xa2,0xc5,0x01,0x00, // KBlueCbFactor
+
+ 0x00,0x00,0x00,0x00, // 5-bit
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x01,0x02,0x03,
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+ 0x1f,0x1f,0x1f,0x1f,
+
+ 0x00,0x00,0x00,0x00, // 6-bit
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x01,0x02,0x03,
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+ 0x20,0x21,0x22,0x23,
+ 0x24,0x25,0x26,0x27,
+ 0x28,0x29,0x2a,0x2b,
+ 0x2c,0x2d,0x2e,0x2f,
+ 0x30,0x31,0x32,0x33,
+ 0x34,0x35,0x36,0x37,
+ 0x38,0x39,0x3a,0x3b,
+ 0x3c,0x3d,0x3e,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f,
+ 0x3f,0x3f,0x3f,0x3f
+ };
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_16M[ 528 ] =
+ {
+ 0xe9,0x66,0x01,0x00, // KRedCrFactor
+ 0x1a,0x58,0x00,0x00, // KGreenCbFactor
+ 0xd2,0xb6,0x00,0x00, // KGreenCrFactor
+ 0xa2,0xc5,0x01,0x00, // KBlueCbFactor
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,
+
+ 0x00,0x01,0x02,0x03, // 8-bit
+ 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,
+ 0x0c,0x0d,0x0e,0x0f,
+
+ 0x10,0x11,0x12,0x13,
+ 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b,
+ 0x1c,0x1d,0x1e,0x1f,
+
+ 0x20,0x21,0x22,0x23,
+ 0x24,0x25,0x26,0x27,
+ 0x28,0x29,0x2a,0x2b,
+ 0x2c,0x2d,0x2e,0x2f,
+
+ 0x30,0x31,0x32,0x33,
+ 0x34,0x35,0x36,0x37,
+ 0x38,0x39,0x3a,0x3b,
+ 0x3c,0x3d,0x3e,0x3f,
+
+ 0x40,0x41,0x42,0x43,
+ 0x44,0x45,0x46,0x47,
+ 0x48,0x49,0x4a,0x4b,
+ 0x4c,0x4d,0x4e,0x4f,
+
+ 0x50,0x51,0x52,0x53,
+ 0x54,0x55,0x56,0x57,
+ 0x58,0x59,0x5a,0x5b,
+ 0x5c,0x5d,0x5e,0x5f,
+
+ 0x60,0x61,0x62,0x63,
+ 0x64,0x65,0x66,0x67,
+ 0x68,0x69,0x6a,0x6b,
+ 0x6c,0x6d,0x6e,0x6f,
+
+ 0x70,0x71,0x72,0x73,
+ 0x74,0x75,0x76,0x77,
+ 0x78,0x79,0x7a,0x7b,
+ 0x7c,0x7d,0x7e,0x7f,
+
+ 0x80,0x81,0x82,0x83,
+ 0x84,0x85,0x86,0x87,
+ 0x88,0x89,0x8a,0x8b,
+ 0x8c,0x8d,0x8e,0x8f,
+
+ 0x90,0x91,0x92,0x93,
+ 0x94,0x95,0x96,0x97,
+ 0x98,0x99,0x9a,0x9b,
+ 0x9c,0x9d,0x9e,0x9f,
+
+ 0xa0,0xa1,0xa2,0xa3,
+ 0xa4,0xa5,0xa6,0xa7,
+ 0xa8,0xa9,0xaa,0xab,
+ 0xac,0xad,0xae,0xaf,
+
+ 0xb0,0xb1,0xb2,0xb3,
+ 0xb4,0xb5,0xb6,0xb7,
+ 0xb8,0xb9,0xba,0xbb,
+ 0xbc,0xbd,0xbe,0xbf,
+
+ 0xc0,0xc1,0xc2,0xc3,
+ 0xc4,0xc5,0xc6,0xc7,
+ 0xc8,0xc9,0xca,0xcb,
+ 0xcc,0xcd,0xce,0xcf,
+
+ 0xd0,0xd1,0xd2,0xd3,
+ 0xd4,0xd5,0xd6,0xd7,
+ 0xd8,0xd9,0xda,0xdb,
+ 0xdc,0xdd,0xde,0xdf,
+
+ 0xe0,0xe1,0xe2,0xe3,
+ 0xe4,0xe5,0xe6,0xe7,
+ 0xe8,0xe9,0xea,0xeb,
+ 0xec,0xed,0xee,0xef,
+
+ 0xf0,0xf1,0xf2,0xf3,
+ 0xf4,0xf5,0xf6,0xf7,
+ 0xf8,0xf9,0xfa,0xfb,
+ 0xfc,0xfd,0xfe,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff
+ };
+
+// ============================ CVTYUVFbsBitmapConverter =======================
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter(
+// const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter( const TSize& aSourceSize )
+: iSourceSize( aSourceSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+ delete iDestination;
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ProcessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::ProcessL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ProcessL() >>"), RThread().Id().operator TUint()));
+ switch( iDestination->DisplayMode() )
+ {
+ case EColor4K:
+ DoProcess4K();
+ break;
+
+ case EColor64K:
+ DoProcess64K();
+ break;
+
+ case EColor16M:
+ DoProcess16M();
+ break;
+
+ case EColor16MU:
+ case EColor16MA: // 16MU and 16MA are handled equally
+ DoProcess16MU16MA();
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ };
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ProcessL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SetDestinationL(
+// const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::SetDestinationL(
+ const CFbsBitmap& aDestinationBitmap )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() >>"), RThread().Id().operator TUint()));
+ SetDestinationL( aDestinationBitmap.Handle() );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SetDestinationL( TInt aHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::SetDestinationL( TInt aHandle )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() >>"), RThread().Id().operator TUint()));
+ ReConstructL( aHandle );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ConstructL( TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::ConstructL( TInt aBitmapHandle )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ConstructL() >>"), RThread().Id().operator TUint()));
+ iDestination = new (ELeave) CFbsBitmap();
+ ReConstructL( aBitmapHandle );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ReConstructL( TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::ReConstructL( TInt aBitmapHandle )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ReConstructL() >>"), RThread().Id().operator TUint()));
+ User::LeaveIfError( iDestination->Duplicate( aBitmapHandle ) );
+ // make sure that destination bitmap's displaymode is supported
+ if( ( iDestination->DisplayMode() != EColor4K ) &&
+ ( iDestination->DisplayMode() != EColor64K ) &&
+ ( iDestination->DisplayMode() != EColor16M ) &&
+ ( iDestination->DisplayMode() != EColor16MU ) &&
+ ( iDestination->DisplayMode() != EColor16MA )
+ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ iDestinationSize = iDestination->SizeInPixels();
+ SizeUpdateL();
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ReConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SizeUpdateL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::SizeUpdateL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SizeUpdate() >>"), RThread().Id().operator TUint()));
+ if( ( SourceSize().iWidth < 2 ) || ( DestinationSize().iWidth < 2 ) )
+ {
+ User::Leave( KErrNotSupported ); // !!!!
+ }
+
+ iVSkipReal = TReal32( SourceSize().iHeight ) /
+ TReal32( DestinationSize().iHeight );
+ iHSkipReal = TReal32( SourceSize().iWidth ) /
+ TReal32( DestinationSize().iWidth );
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SizeUpdate() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVTYUVPlanarFbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL( const TSize& aSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(
+ const TSize& aSize )
+ {
+ iSourceSize = aSize;
+ SizeUpdateL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+// const TSize& aSize, const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+ const TSize& aSize,
+ const TDesC8& aSourceData )
+ {
+ iSourceSize = aSize;
+ SetSourceL( aSourceData );
+ SizeUpdateL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter(
+// const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter(
+ const TSize& aSourceSize )
+: CVTYUVFbsBitmapConverter( aSourceSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess4K()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess4K()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K() >>"), RThread().Id().operator TUint()));
+
+ // Vertical scaling needed?
+ if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+ {
+ // NO: Use really fast conversion
+ DoProcess4KNoScale();
+ }
+ else
+ {
+
+ // YES: Use slower conversion method
+ const TUint8* y = iY;
+ const TUint8* u = iU;
+ const TUint8* v = iV;
+ const TUint8* clip = COFF_TBL_4K + 40;
+
+ TInt height = DestinationSize().iHeight;
+ TInt width = DestinationSize().iWidth;
+
+ iDestination->LockHeap();
+ TUint32* d = iDestination->DataAddress();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+ for( TInt h = 0; h < height; h++ )
+ {
+ TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+ TInt hTimesW = sourceY * SourceSize().iWidth;
+ TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+ for( TInt w = 0; w < width; w++ )
+ {
+ TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+ TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+ TInt ay = y[ hTimesW + sourceX ];
+ TInt cb = u[ uvIdxW ] - 128;
+ TInt cr = v[ uvIdxW ] - 128;
+
+ TInt greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ TInt red = ay + cr;
+ TInt green = ay - greenCbCr;
+ TInt blue = ay + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ TUint32 s = green | ( red << 4 );
+ s = blue | ( s << 4 );
+
+ w++;
+ sourceX = TInt( TReal32( w ) * iHSkipReal );
+ uvIdxW = uvIdx + ( sourceX >> 1 );
+
+ ay = y[ hTimesW + sourceX ];
+ cb = u[ uvIdxW ] - 128;
+ cr = v[ uvIdxW ] - 128;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ red = ay + cr;
+ green = ay - greenCbCr;
+ blue = ay + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ s |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+ *d++ = s;
+ }
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K(): for <<"), RThread().Id().operator TUint()));
+
+ iDestination->UnlockHeap();
+ }
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale() >>"), RThread().Id().operator TUint()));
+
+ TInt height( SourceSize().iHeight >> 1 );
+ TInt width( SourceSize().iWidth );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+ const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+ const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+ iDestination->LockHeap();
+
+ TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+ ( DestinationSize().iWidth, EColor4K ) >> 2;
+
+ TUint32* d1 = iDestination->DataAddress();
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TInt32 red;
+ TInt32 green;
+ TInt32 blue;
+ TUint32 r1;
+ const TUint8* clip = COFF_TBL_4K + 40;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 = green | ( red << 4 );
+ r1 = blue | ( r1 << 4 );
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+ d1[ uintsPerDestRow ] = r1;
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 = green | ( red << 4 );
+ r1 = blue | ( r1 << 4 );
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 4 ];
+ green = clip[ green >> 4 ];
+ blue = clip[ blue >> 4 ];
+
+ // RGB_444
+ r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+ *d1++ = r1;
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += uintsPerDestRow;
+ }
+
+ iDestination->UnlockHeap();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess64K()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess64K()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K() >>"), RThread().Id().operator TUint()));
+
+ // Vertical scaling needed?
+ if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) ) // !!!
+ {
+ // NO: Use really fast conversion
+ DoProcess64KNoScale();
+ return;
+ }
+ else
+ {
+ // YES: Use slower conversion method
+ const TUint8* y = iY;
+ const TUint8* u = iU;
+ const TUint8* v = iV;
+ const TUint8* clip = COFF_TBL_64K + 40;
+
+ TInt height = DestinationSize().iHeight;
+ TInt width = DestinationSize().iWidth;
+
+ iDestination->LockHeap();
+ TUint32* d = iDestination->DataAddress();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+ for( TInt h = 0; h < height; h++ )
+ {
+ TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+ TInt hTimesW = sourceY * SourceSize().iWidth;
+ TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+ for( TInt w = 0; w < width; w++ )
+ {
+ TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+ TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+ TInt ay = y[ hTimesW + sourceX ];
+ TInt cb = u[ uvIdxW ] - 128;
+ TInt cr = v[ uvIdxW ] - 128;
+
+ TInt greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+ 0x1200000
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ TInt red = ay + cr;
+ TInt green = ay - greenCbCr;
+ TInt blue = ay + cb;
+
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ // RGB_565
+ TUint32 s = green | ( red << 6 );
+ s = blue | ( s << 5 );
+
+ w++;
+ sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+ uvIdxW = uvIdx + ( sourceX >> 1 );
+
+ ay = y[ hTimesW + sourceX ];
+ cb = u[ uvIdxW ] - 128;
+ cr = v[ uvIdxW ] - 128;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+ 0x1200000
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ red = ay + cr;
+ green = ay - greenCbCr;
+ blue = ay + cb;
+
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ s |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+ *d++ = s;
+ }
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K(): for <<"), RThread().Id().operator TUint()));
+
+ iDestination->UnlockHeap();
+ }
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale()
+// Source YUV image must be even divisible by 8.
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale() >>"), RThread().Id().operator TUint()));
+
+ TInt height( SourceSize().iHeight >> 1 );
+ TInt width( SourceSize().iWidth );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+ const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+ const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+ iDestination->LockHeap();
+
+ TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+ ( DestinationSize().iWidth, EColor64K ) >> 2;
+
+ TUint32* d1 = iDestination->DataAddress();
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TInt32 red;
+ TInt32 green;
+ TInt32 blue;
+ TUint32 r1;
+ const TUint8* clip = COFF_TBL_64K + 40;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+ 0x1200000
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ // RGB_565
+ r1 = green | ( red << 6 );
+ r1 = blue | ( r1 << 5 );
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ // clear lowest 3 bits
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ // RGB_565
+ r1 |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+ d1[ uintsPerDestRow ] = r1;
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ // RGB_565
+ r1 = green | ( red << 6 );
+ r1 = blue | ( r1 << 5 );
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ red = yy + cr;
+ green = yy - greenCbCr;
+ blue = yy + cb;
+
+ red = clip[ red >> 3 ];
+ green = clip[ green >> 2 ];
+ blue = clip[ blue >> 3 ];
+
+ // RGB_565
+ r1 |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+ *d1++ = r1;
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += uintsPerDestRow;
+ }
+
+ iDestination->UnlockHeap();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16M()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16M()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M() >>"), RThread().Id().operator TUint()));
+
+ // Vertical scaling needed?
+ if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+ {
+ // NO: Use really fast conversion
+ DoProcess16MNoScale();
+ }
+ else
+ {
+ // YES: Use slower conversion method
+
+ // YES: Use slower conversion method
+ const TUint8* y = iY;
+ const TUint8* u = iU;
+ const TUint8* v = iV;
+ const TUint8* clip = COFF_TBL_16M + 144;
+
+ TInt height = DestinationSize().iHeight;
+ TInt width = DestinationSize().iWidth;
+
+ iDestination->LockHeap();
+
+ TUint8* d = reinterpret_cast<TUint8*>( iDestination->DataAddress() );
+ TUint32 dPitch = iDestination->ScanLineLength( width, iDestination->DisplayMode() );
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+ for( TInt h = 0; h < height; h++ )
+ {
+ TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+ TInt hTimesW = sourceY * SourceSize().iWidth;
+ TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+ TUint8* dTemp = d;
+ for( TInt w = 0; w < width; w++ )
+ {
+ TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+ TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+ TInt ay = y[ hTimesW + sourceX ];
+ TInt cb = u[ uvIdxW ] - 128;
+ TInt cr = v[ uvIdxW ] - 128;
+
+ TInt greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+ ) >> 16;
+
+ *dTemp++ = clip[ ay + cb ];
+ *dTemp++ = clip[ ay - greenCbCr ];
+ *dTemp++ = clip[ ay + cr ];
+ }
+ d += dPitch;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M(): for <<"), RThread().Id().operator TUint()));
+
+ iDestination->UnlockHeap();
+ }
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale() >>"), RThread().Id().operator TUint()));
+
+ TInt height( SourceSize().iHeight >> 1 );
+ TInt width( SourceSize().iWidth );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+ const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+ const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+ iDestination->LockHeap();
+
+ TUint32 bytesPerDestRow = CFbsBitmap::ScanLineLength
+ ( DestinationSize().iWidth, EColor16M );
+
+ TUint8* d1 = reinterpret_cast< TUint8* >( iDestination->DataAddress() );
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TInt32 idx1;
+ TInt32 idx2;
+ const TUint8* clip = COFF_TBL_16M + 144;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ idx1 = 0;
+ idx2 = bytesPerDestRow;
+
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ d1[ idx2++ ] = clip[ yy + cb ];
+ d1[ idx2++ ] = clip[ yy - greenCbCr ];
+ d1[ idx2++ ] = clip[ yy + cr ];
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ d1[ idx2++ ] = clip[ yy + cb ];
+ d1[ idx2++ ] = clip[ yy - greenCbCr ];
+ d1[ idx2++ ] = clip[ yy + cr ];
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ d1[ idx1++ ] = clip[ yy + cb ];
+ d1[ idx1++ ] = clip[ yy - greenCbCr ];
+ d1[ idx1++ ] = clip[ yy + cr ];
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ d1[ idx1++ ] = clip[ yy + cb ];
+ d1[ idx1++ ] = clip[ yy - greenCbCr ];
+ d1[ idx1++ ] = clip[ yy + cr ];
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += bytesPerDestRow * 2;
+ }
+
+ iDestination->UnlockHeap();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA() >>"), RThread().Id().operator TUint()));
+
+ // Vertical scaling needed?
+ if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+ {
+ // NO: Use really fast conversion
+ DoProcess16MU16MANoScale();
+ }
+ else
+ {
+ // YES: Use slower conversion method
+ const TUint8* y = iY;
+ const TUint8* u = iU;
+ const TUint8* v = iV;
+ const TUint8* clip = COFF_TBL_16M + 144;
+
+ TInt height = DestinationSize().iHeight;
+ TInt width = DestinationSize().iWidth;
+
+ iDestination->LockHeap();
+ TUint32* d = iDestination->DataAddress();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+ for( TInt h = 0; h < height; h++ )
+ {
+ TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+ TInt hTimesW = sourceY * SourceSize().iWidth;
+ TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+ for( TInt w = 0; w < width; w++ )
+ {
+ TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+ TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+ TInt ay = y[ hTimesW + sourceX ];
+ TInt cb = u[ uvIdxW ] - 128;
+ TInt cr = v[ uvIdxW ] - 128;
+
+ TInt greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+ ) >> 16;
+
+
+ // 0xffBBGG
+ TUint32 p = 0xff0000 |
+ ( clip[ ay + cr ] << 8 ) | clip[ ay - greenCbCr ];
+ // 0xffBBGGRR
+ *d++ = clip[ ay + cb ] | ( p << 8 );
+ }
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA(): for <<"), RThread().Id().operator TUint()));
+
+ iDestination->UnlockHeap();
+ }
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale() >>"), RThread().Id().operator TUint()));
+
+ TInt height( SourceSize().iHeight >> 1 );
+ TInt width( SourceSize().iWidth );
+
+ const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+ const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+ const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+ iDestination->LockHeap();
+
+ TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+ ( DestinationSize().iWidth, EColor16MU ) >> 2;
+
+ TUint32* d1 = iDestination->DataAddress();
+
+ TUint32 ywidth = width >> 2;
+
+ width >>= 3;
+
+ TInt32 cb;
+ TInt32 cr;
+ TInt32 greenCbCr;
+ TInt32 yy;
+ TUint32 p;
+ const TUint8* clip = COFF_TBL_16M + 144;
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ for( TInt x = 0; x < width; x++ )
+ {
+ TUint32 u1 = *u++;
+ TUint32 v1 = *v++;
+
+ for( TInt c2 = 0; c2 < 2; c2++ )
+ {
+ TUint32 yy2 = y1[ ywidth ];
+ TUint32 yy1 = *y1++;
+
+ for( TInt c = 0; c < 2; c++ )
+ {
+ cb = TInt32( u1 & 0xff ) - 128;
+ u1 >>= 8;
+ cr = TInt32( v1 & 0xff ) - 128;
+ v1 >>= 8;
+
+ greenCbCr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+ cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+ ) >> 16;
+ cr =
+ (
+ cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+ ) >> 16;
+ cb =
+ (
+ cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+ ) >> 16;
+
+ // lower left
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ d1[ uintsPerDestRow ] = clip[ yy + cb ] | ( p << 8 );
+
+ // lower right
+ yy = ( yy2 & 0xff );
+ yy2 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ d1[ uintsPerDestRow + 1 ] = clip[ yy + cb ] | ( p << 8 );
+
+ // upper left
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ *d1++ = clip[ yy + cb ] | ( p << 8 );
+
+ // upper right
+ yy = ( yy1 & 0xff );
+ yy1 >>= 8;
+
+ // 0xffBBGG
+ p = 0xff0000 |
+ ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+ // 0xffBBGGRR
+ *d1++ = clip[ yy + cb ] | ( p << 8 );
+ }
+ }
+ }
+
+ y1 += ( width << 1 );
+ d1 += uintsPerDestRow;
+ }
+
+ iDestination->UnlockHeap();
+
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceL( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+ const TDesC8& aSourceData )
+ {
+ // make sure dimension and buffer size match
+ if( aSourceData.Length() !=
+ ( ( SourceSize().iWidth * SourceSize().iHeight * 12 ) / 8 ) )
+ {
+ User::Leave( KErrArgument );
+ }
+ SetYUVPtrs( aSourceData );
+ }
+
+// ============================ CVTIYUVFbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::NewL( const TSize& aSourceSize,
+// const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTIYUVFbsBitmapConverter* CVTIYUVFbsBitmapConverter::NewL(
+ const TSize& aSourceSize,
+ const CFbsBitmap& aDestinationBitmap )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+ CVTIYUVFbsBitmapConverter* self = NewL(
+ aSourceSize, aDestinationBitmap.Handle() );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::NewL( const TSize& aSourceSize,
+// TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTIYUVFbsBitmapConverter* CVTIYUVFbsBitmapConverter::NewL(
+ const TSize& aSourceSize,
+ TInt aBitmapHandle )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+ CVTIYUVFbsBitmapConverter* self = new (ELeave)
+ CVTIYUVFbsBitmapConverter( aSourceSize );
+ CleanupStack::PushL( self );
+ self->ConstructL( aBitmapHandle );
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTIYUVFbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+ {
+ TInt ySize = SourceSize().iWidth * SourceSize().iHeight;
+ TInt ySizeDiv4 = ( ySize >> 2 );
+ iY = aSourceData.Mid( 0, ySize ).Ptr();
+ iU = aSourceData.Mid( ySize, ySizeDiv4 ).Ptr();
+ iV = aSourceData.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr();
+ }
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter( const TSize&
+// aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter( const TSize& aSourceSize )
+: CVTYUVPlanarFbsBitmapConverter( aSourceSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVTYV12FbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::NewL( const TSize& aSourceSize,
+// const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYV12FbsBitmapConverter* CVTYV12FbsBitmapConverter::NewL(
+ const TSize& aSourceSize,
+ const CFbsBitmap& aDestinationBitmap )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+ CVTYV12FbsBitmapConverter* self = NewL(
+ aSourceSize, aDestinationBitmap.Handle() );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::NewL( const TSize& aSourceSize,
+// TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYV12FbsBitmapConverter* CVTYV12FbsBitmapConverter::NewL(
+ const TSize& aSourceSize,
+ TInt aBitmapHandle )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+ CVTYV12FbsBitmapConverter* self = new (ELeave)
+ CVTYV12FbsBitmapConverter( aSourceSize );
+ CleanupStack::PushL( self );
+ self->ConstructL( aBitmapHandle );
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYV12FbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+ {
+ TInt ySize = SourceSize().iWidth * SourceSize().iHeight;
+ TInt ySizeDiv4 = ( ySize >> 2 );
+ iY = aSourceData.Mid( 0, ySize ).Ptr();
+ iV = aSourceData.Mid( ySize, ySizeDiv4 ).Ptr();
+ iU = aSourceData.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr();
+ }
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter(
+// const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter( const TSize& aSourceSize )
+: CVTYUVPlanarFbsBitmapConverter( aSourceSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVSFbsBitmapIYUVConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::CVSFbsBitmapIYUVConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVSFbsBitmapIYUVConverter::CVSFbsBitmapIYUVConverter()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::NewL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSFbsBitmapIYUVConverter* CVSFbsBitmapIYUVConverter::NewL(
+ const CFbsBitmap& aBitmap )
+ {
+ CVSFbsBitmapIYUVConverter* self = new (ELeave) CVSFbsBitmapIYUVConverter();
+ CleanupStack::PushL( self );
+ self->ConstructL( aBitmap );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter()
+ {
+ delete iSource;
+ delete iYUVData;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::SetSourceL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVSFbsBitmapIYUVConverter::SetSourceL( const CFbsBitmap& aBitmap )
+ {
+ ReConstructL( aBitmap );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ProcessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVSFbsBitmapIYUVConverter::ProcessL()
+ {
+ switch( iSource->DisplayMode() )
+ {
+ case EColor4K:
+ DoProcess( VSReadColor4K );
+ break;
+
+ case EColor64K:
+ DoProcess( VSReadColor64K );
+ break;
+
+ case EColor16M:
+ DoProcess( VSReadColor16M );
+ break;
+
+ case EColor16MU:
+ DoProcess( VSReadColor16MU );
+ break;
+
+ case EColor16MA:
+ DoProcess( VSReadColor16MA );
+ break;
+
+ case EColor16MAP:
+ DoProcess( VSReadColor16MAP );
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ };
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::YUVData() const
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPtrC8 CVSFbsBitmapIYUVConverter::YUVData() const
+ {
+ return *iYUVData;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ConstructL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::ConstructL( const CFbsBitmap& aBitmap )
+ {
+ iSource = new (ELeave) CFbsBitmap();
+ ReConstructL( aBitmap );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ReConstructL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::ReConstructL( const CFbsBitmap& aBitmap )
+ {
+ User::LeaveIfError( iSource->Duplicate( aBitmap.Handle() ) );
+
+ // make sure that source bitmap's displaymode is supported
+ if( ( iSource->DisplayMode() != EColor4K ) &&
+ ( iSource->DisplayMode() != EColor64K ) &&
+ ( iSource->DisplayMode() != EColor16M ) &&
+ ( iSource->DisplayMode() != EColor16MU ) &&
+ ( iSource->DisplayMode() != EColor16MA ) &&
+ ( iSource->DisplayMode() != EColor16MAP ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ if( !iYUVData || !( iSize == iSource->SizeInPixels() ) )
+ {
+ iSize = iSource->SizeInPixels();
+ delete iYUVData; iYUVData = 0;
+ TInt ySize = iSize.iWidth * iSize.iHeight;
+ iYUVData = HBufC8::NewMaxL( ySize + ( ySize >> 1 ) );
+ iY.Set( iYUVData->Des().Mid( 0, ySize ) );
+ iU.Set( iYUVData->Des().Mid( ySize, ySize >> 2 ) );
+ iV.Set( iYUVData->Des().Mid( ySize + ( ySize >> 2 ), ySize >> 2 ) );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::DoProcess( TVSColorReadFunc aReadFunction )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::DoProcess( TVSColorReadFunc aReadFunction )
+ {
+ TUint8* pY = const_cast<TUint8*>( iY.Ptr() );
+ TUint8* pU = const_cast<TUint8*>( iU.Ptr() );
+ TUint8* pV = const_cast<TUint8*>( iV.Ptr() );
+ TVSYCrCb yuv1, yuv2;
+
+ iSource->LockHeap();
+ TAny* s = iSource->DataAddress();
+ for( TInt h = 0; h < iSize.iHeight; h++ )
+ {
+ if( h&1 )
+ {
+ // Note! width must be even divisible by 2
+ for( TInt w = 0; w < iSize.iWidth >> 1; w++ )
+ {
+ *pY++ = RGBtoYCbCr( &yuv1, aReadFunction( s ) );
+ *pY++ = RGBtoYCbCr( &yuv2, aReadFunction( s ) );
+ *pU++ = static_cast<TUint8>( AVG( yuv1.iCb, yuv2.iCb ) );
+ *pV++ = static_cast<TUint8>( AVG( yuv1.iCr, yuv2.iCr ) );
+ }
+ }
+ else
+ {
+ // Note! width must be even divisible by 2
+ for( TInt w = 0; w < iSize.iWidth >> 1; w++ )
+ {
+ *pY++ = RGBtoYCbCr( &yuv1, aReadFunction( s ) );
+ *pY++ = RGBtoYCbCr( &yuv2, aReadFunction( s ) );
+ *pU++ = static_cast<TUint8>(
+ AVG( *pU, AVG( yuv1.iCb, yuv2.iCb ) ) );
+ *pV++ = static_cast<TUint8>(
+ AVG( *pV, AVG( yuv1.iCr, yuv2.iCr ) ) );
+ }
+ // if even row -> decrease pU and pV, we will calculate average for
+ // those on odd rows
+ pU -= ( iSize.iWidth >> 1 );
+ pV -= ( iSize.iWidth >> 1 );
+ }
+ }
+ iSource->UnlockHeap();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageIYUV.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL( const TSize& aSize )
+ {
+ CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+ CleanupStack::PushL( self );
+ self->ConstructL( 0 );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( const TSize& aSize, TDisplayMode aDisplayMode,
+// const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL(
+ const TSize& aSize,
+ const TDesC8& aImage )
+ {
+ CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+ CleanupStack::PushL( self );
+ self->ConstructL( &aImage );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( const TSize& aSize, TDisplayMode aDisplayMode,
+// TPtr8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL(
+ const TSize& aSize,
+ TPtr8& aImage )
+ {
+ CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+ CleanupStack::PushL( self );
+ self->ValidateSizeL( aSize );
+ self->SetImageL( aImage ); // No constructor call!
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::~CVtImageIYUV()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV::~CVtImageIYUV()
+ {
+ delete iImage;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetImageL( const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageIYUV::SetImageL( const TDesC8& aImage )
+ {
+ CheckDescriptorSizeL( aImage );
+ if( !iImage )
+ {
+ ConstructL( &aImage );
+ }
+ else
+ {
+ *iImage = aImage;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetImageL( TPtr8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageIYUV::SetImageL( TPtr8& aImage )
+ {
+ CheckDescriptorSizeL( aImage );
+ delete iImage; iImage = 0;
+ iPtrImage.Set( aImage );
+ SetYUVPointers();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Image() const
+// -----------------------------------------------------------------------------
+EXPORT_C TPtrC8 CVtImageIYUV::Image() const
+ {
+ return iPtrImage;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Y() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::Y() const
+ {
+ return iY;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::U() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::U() const
+ {
+ return iU;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::V() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::V() const
+ {
+ return iV;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::UVPlaneWidth() const
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CVtImageIYUV::UVPlaneWidth() const
+ {
+ return iSize.iWidth / 2;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::UVPlaneHeight() const
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CVtImageIYUV::UVPlaneHeight() const
+ {
+ return iSize.iHeight / 2;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageIYUV::NeedHeapLock() const
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::DisplayMode() const
+// -----------------------------------------------------------------------------
+CVtImage::TVtDisplayMode CVtImageIYUV::DisplayMode() const
+ {
+ return CVtImage::EVtColorIYUV;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Size() const
+// -----------------------------------------------------------------------------
+TSize CVtImageIYUV::Size() const
+ {
+ return iSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::BytesPerRow() const
+// -----------------------------------------------------------------------------
+TInt CVtImageIYUV::BytesPerRow() const
+ {
+ return iSize.iWidth;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::DataAddress() const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageIYUV::DataAddress() const
+ {
+ return reinterpret_cast< TUint32* >( iY );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::LineAddress( TInt aLine ) const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageIYUV::LineAddress( TInt aLine ) const
+ {
+ if( aLine < 0 )
+ {
+ aLine = 0;
+ }
+ else if( aLine > Size().iHeight - 1 )
+ {
+ aLine = Size().iHeight - 1;
+ }
+ return reinterpret_cast< TUint32* >(
+ reinterpret_cast< TUint8* >( DataAddress() ) + BytesPerRow() * aLine );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ImageSize() const
+// -----------------------------------------------------------------------------
+TInt CVtImageIYUV::ImageSize() const
+ {
+ return UVPlaneWidth() * UVPlaneHeight() * 2 + BytesPerRow() * iSize.iHeight;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::CVtImageIYUV( const TSize& aSize )
+// -----------------------------------------------------------------------------
+CVtImageIYUV::CVtImageIYUV( const TSize& aSize )
+: CVtImage( CVtImage::EVtImageIYUV ), iSize( aSize ), iPtrImage( 0, 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ConstructL( const TDesC8* aImage )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::ConstructL( const TDesC8* aImage )
+ {
+ ValidateSizeL( iSize );
+ if( !aImage )
+ {
+ // empty image
+ TInt size( ImageSize() );
+ iImage = HBufC8::NewL( size );
+ iImage->Des().SetLength( size );
+ }
+ else
+ {
+ // prefilled image
+ CheckDescriptorSizeL( *aImage );
+ iImage = aImage->AllocL();
+ }
+ // set ptr descriptor
+ iPtrImage.Set( iImage->Des() );
+ // set YUV pointers
+ SetYUVPointers();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ValidateSizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::ValidateSizeL( const TSize& aSize )
+ {
+ if( ( aSize.iWidth & 1 ) || ( aSize.iHeight & 1 ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::CheckDescriptorSizeL( const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::CheckDescriptorSizeL( const TDesC8& aImage )
+ {
+ if( aImage.Size() != ImageSize() )
+ {
+ User::Leave( KErrArgument );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetYUVPointers()
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::SetYUVPointers()
+ {
+ iY = const_cast< TUint8* >( iPtrImage.Ptr() );
+ iU = iY + BytesPerRow() * iSize.iHeight;
+ iV = iU + UVPlaneWidth() * UVPlaneHeight();
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotator.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "cvtimagerotator.h"
+#include "CVtImageRotatorImplMirrorFlip.h"
+#include "CVtImageRotatorImplClockwise.h"
+
+// CONSTANTS
+
+_LIT( KModuleName, "CVtImageRotator" );
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::NewL( MVtImageRotatorObserver& aObserver,
+// TPriority aPriority )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageRotator* CVtImageRotator::NewL(
+ MVtImageRotatorObserver& aObserver,
+ TPriority aPriority)
+ {
+ CVtImageRotator* self = new ( ELeave ) CVtImageRotator( aObserver, aPriority );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::~CVtImageRotator()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageRotator::~CVtImageRotator()
+ {
+ Cancel();
+ delete iAsyncCallBack;
+ delete iHeapLock;
+ delete iRotatorImpl;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::ScaleL( const CVtImage& aSource,
+// CVtImage& aTarget, const TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageRotator::RotateL( const CVtImage& aSource,
+ CVtImage& aTarget, const TRotationAngle& aAngle )
+ {
+ if ( !IsActive() )
+ {
+ CreateRotatorL( aAngle );
+ iRotatorImpl->SetSourceTargetL( aSource, aTarget );
+ iCancelled = EFalse;
+ Activate();
+ iAsyncCallBack->CallBack();
+ }
+ else
+ {
+ User::Panic( KModuleName(), EBusy );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Rotate
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageRotator::Rotate(
+ const CVtImage& aSource,
+ CVtImage& aTarget, const TRotationAngle& aAngle )
+ {
+ TRAPD( result, RotateL( aSource, aTarget, aAngle ) );
+ if ( result != KErrNone )
+ {
+ Activate();
+ Signal( result );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::CVtImageRotator( MVtImageRotatorObserver& aObserver,
+// TPriority aPriority )
+// -----------------------------------------------------------------------------
+CVtImageRotator::CVtImageRotator( MVtImageRotatorObserver& aObserver,
+ TPriority aPriority )
+: CActive( aPriority ), iObserver( aObserver )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::ConstructL()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::ConstructL()
+ {
+ iHeapLock = new ( ELeave ) CFbsBitmap();
+ iHeapLock->Create( TSize( 1, 1 ), EColor256 );
+ iAsyncCallBack = new ( ELeave )
+ CAsyncCallBack( TCallBack( StaticRotate, this ), Priority() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::CreateRotatorL( const TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+void CVtImageRotator::CreateRotatorL( const TRotationAngle& aAngle )
+ {
+ if( iRotatorImpl )
+ {
+ if( iRotatorImpl->SupportsRotationAngle( aAngle ) )
+ {
+ iRotatorImpl->SetAngle( aAngle );
+ return;
+ }
+ delete iRotatorImpl;
+ iRotatorImpl = 0;
+ }
+
+ switch( aAngle )
+ {
+ case E90DegreesClockwise:
+ case E270DegreesClockwise:
+ iRotatorImpl =
+ new ( ELeave ) CVtImageRotatorImplClockwise( aAngle );
+ break;
+
+ case EMirrorHorizontalAxis:
+ case EFlipVerticalAxis:
+ case E180DegreesClockwise:
+ iRotatorImpl =
+ new ( ELeave ) CVtImageRotatorImplMirrorFlip( aAngle );
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Activate
+// -----------------------------------------------------------------------------
+void CVtImageRotator::Activate()
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+void CVtImageRotator::Signal( TInt aError )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, aError );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::RunL()
+ {
+ iObserver.RotationFinished( iStatus.Int() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::DoCancel()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::DoCancel()
+ {
+ if ( iStatus == KRequestPending )
+ {
+ iCancelled = ETrue;
+ Signal( KErrCancel );
+ iObserver.RotationFinished( KErrCancel );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::StaticRotate()
+// -----------------------------------------------------------------------------
+TInt CVtImageRotator::StaticRotate( TAny* aPtr )
+ {
+ CVtImageRotator* self = reinterpret_cast< CVtImageRotator* >( aPtr );
+ self->DoRotate();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::DoRotate
+// -----------------------------------------------------------------------------
+void CVtImageRotator::DoRotate()
+ {
+ if ( !iCancelled )
+ {
+ TBool more;
+ TBool needsLock = iRotatorImpl->NeedHeapLock();
+ if( needsLock )
+ {
+ iHeapLock->LockHeap( ETrue );
+ }
+ TInt result = iRotatorImpl->Rotate( more );
+ if( needsLock )
+ {
+ iHeapLock->UnlockHeap( ETrue );
+ }
+ if( !more || ( result != KErrNone ) )
+ {
+ Signal( result );
+ }
+ else
+ {
+ iAsyncCallBack->CallBack();
+ }
+ }
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImpl.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImpl.h"
+#include "cvtimage.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ========================== CVtImageRotatorImpl ==============================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::SetSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImpl::SetSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ iSource = iTarget = 0;
+ ValidateSourceTargetL( aSource, aTarget );
+ iSource = &aSource;
+ iTarget = &aTarget;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImpl::NeedHeapLock() const
+ {
+ return iSource->NeedHeapLock() || iTarget->NeedHeapLock();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::SetAngle(
+// const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImpl::SetAngle( const CVtImageRotator::TRotationAngle& aAngle )
+ {
+ iAngle = aAngle;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::CVtImageRotatorImpl(
+// const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImpl::CVtImageRotatorImpl( const CVtImageRotator::TRotationAngle& aAngle )
+: iAngle( aAngle )
+ {
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplClockwise.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImplClockwise.h"
+#include "cvtimage.h"
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageRotatorImplClockwise =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::CVtImageRotatorImplClockwise(
+// const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImplClockwise::CVtImageRotatorImplClockwise(
+ const CVtImageRotator::TRotationAngle& aAngle ) : CVtImageRotatorImpl( aAngle )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::Rotate( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageRotatorImplClockwise::Rotate( TBool& aContinue )
+ {
+ __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplClockwise::Rotate() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt result( KErrNone );
+
+ aContinue = EFalse;
+
+ DoRotate();
+
+ __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplClockwise::Rotate() <<" ), RThread().Id().operator TUint() ) );
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ // SourceWidth == TargetHeight && SourceHeight == TargetWidth
+ if( ( aSource.Size().iWidth != aTarget.Size().iHeight ) ||
+ ( aSource.Size().iHeight != aTarget.Size().iWidth ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // Displaymodes must match
+ if( aSource.DisplayMode() != aTarget.DisplayMode() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // Check that displaymode is one of the supported
+ switch( aSource.DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ case CVtImage::EVtColor16M:
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ case CVtImage::EVtColorIYUV:
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImplClockwise::SupportsRotationAngle(
+ const CVtImageRotator::TRotationAngle& aAngle )
+ {
+ TBool result( EFalse );
+
+ if( ( aAngle == CVtImageRotator::E90DegreesClockwise ) ||
+ ( aAngle == CVtImageRotator::E270DegreesClockwise ) )
+ {
+ result = ETrue;
+ }
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// void CVtImageRotatorImplClockwise::DoRotate()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::DoRotate()
+ {
+ TInt bytesPerRow( iSource->BytesPerRow() );
+
+ TInt height( iSource->Size().iHeight );
+
+ TInt width( iSource->Size().iWidth );
+
+ TInt targetWidth( iTarget->Size().iWidth );
+
+ TInt targetHeight( iTarget->Size().iHeight );
+
+ TInt targetBytesPerRow( iTarget->BytesPerRow() );
+
+ switch( iSource->DisplayMode() )
+ {
+ // DisplayMode: 4K and 64K
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TInt offsetPerRow( -2 );
+
+ if( iAngle == CVtImageRotator::E90DegreesClockwise )
+ {
+ d += targetBytesPerRow - 2;
+
+ if( targetWidth & 1 )
+ {
+ d -= 2;
+ }
+ }
+ else
+ {
+ d += targetBytesPerRow * ( targetHeight - 1 );
+
+ targetBytesPerRow = -targetBytesPerRow;
+
+ offsetPerRow = 2;
+ }
+
+ targetBytesPerRow /= 2; // in loop we need 16-bit precalculated
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register const TUint16* tempS = reinterpret_cast< const TUint16* >( s );
+
+ register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+ for( register TInt x = width - 1; x >= 0; x-- )
+ {
+ *tempD = *tempS++;
+ tempD += targetBytesPerRow;
+ }
+
+ s += bytesPerRow;
+ d += offsetPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16M
+ case CVtImage::EVtColor16M:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TInt offsetPerRow( -3 );
+
+ if( iAngle == CVtImageRotator::E90DegreesClockwise )
+ {
+ d += targetWidth * 3 - 3;
+ }
+ else
+ {
+ d += targetBytesPerRow * ( targetHeight - 1 );
+
+ targetBytesPerRow = -targetBytesPerRow;
+
+ offsetPerRow = 3;
+ }
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register const TUint8* tempS = s;
+
+ register TUint8* tempD = d;
+
+ for( register TInt x = width - 1; x >= 0; x-- )
+ {
+ tempD[ 0 ] = *tempS++;
+ tempD[ 1 ] = *tempS++;
+ tempD[ 2 ] = *tempS++;
+ tempD += targetBytesPerRow;
+ }
+
+ s += bytesPerRow;
+ d += offsetPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16MU and 16MA
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TInt offsetPerRow( -4 );
+
+ if( iAngle == CVtImageRotator::E90DegreesClockwise )
+ {
+ d += targetBytesPerRow - 4;
+ }
+ else
+ {
+ d += targetBytesPerRow * ( targetHeight - 1 );
+
+ targetBytesPerRow = -targetBytesPerRow;
+
+ offsetPerRow = 4;
+ }
+
+ targetBytesPerRow /= 4; // in loop we need 32-bit precalculated
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register const TUint32* tempS = reinterpret_cast< const TUint32* >( s );
+
+ register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+ for( register TInt x = width - 1; x >= 0; x-- )
+ {
+ *tempD = *tempS++;
+ tempD += targetBytesPerRow;
+ }
+
+ s += bytesPerRow;
+ d += offsetPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: IYUV
+ case CVtImage::EVtColorIYUV:
+ {
+ const CVtImageIYUV* src = reinterpret_cast< const CVtImageIYUV* >( iSource );
+ CVtImageIYUV* trg = reinterpret_cast< CVtImageIYUV* >( iTarget );
+ RotatePlane
+ (
+ src->Y(),
+ trg->Y(),
+ width,
+ height,
+ bytesPerRow,
+ targetHeight,
+ targetBytesPerRow
+ );
+
+ RotatePlane
+ (
+ src->U(),
+ trg->U(),
+ src->UVPlaneWidth(),
+ src->UVPlaneHeight(),
+ src->UVPlaneWidth(),
+ trg->UVPlaneHeight(),
+ trg->UVPlaneWidth()
+ );
+
+ RotatePlane
+ (
+ src->V(),
+ trg->V(),
+ src->UVPlaneWidth(),
+ src->UVPlaneHeight(),
+ src->UVPlaneWidth(),
+ trg->UVPlaneHeight(),
+ trg->UVPlaneWidth()
+ );
+
+ }
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::RotatePlane(
+// const TUint8* aSource,
+// TUint8* aTarget,
+// TInt aSourceWidth,
+// TInt aSourceHeight,
+// TInt aSourceBytesPerRow,
+// TInt aTargetHeight,
+// TInt aTargetBytesPerRow )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::RotatePlane(
+ const TUint8* aSource,
+ TUint8* aTarget,
+ TInt aSourceWidth,
+ TInt aSourceHeight,
+ TInt aSourceBytesPerRow,
+ TInt aTargetHeight,
+ TInt aTargetBytesPerRow )
+ {
+ TInt offsetPerRow( -1 );
+
+ if( iAngle == CVtImageRotator::E90DegreesClockwise )
+ {
+ aTarget += aTargetBytesPerRow - 1;
+ }
+ else
+ {
+ aTarget += aTargetBytesPerRow * ( aTargetHeight - 1 );
+ aTargetBytesPerRow = -aTargetBytesPerRow;
+ offsetPerRow = -offsetPerRow;
+ }
+
+ for( TInt y = aSourceHeight - 1; y >= 0; y-- )
+ {
+ register const TUint8* tempS = aSource;
+ register TUint8* tempD = aTarget;
+ for( register TInt x = aSourceWidth - 1; x >= 0; x-- )
+ {
+ *tempD = *tempS++;
+ tempD += aTargetBytesPerRow;
+ }
+
+ aSource += aSourceBytesPerRow;
+ aTarget += offsetPerRow;
+ }
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplMirrorFlip.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,589 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImplMirrorFlip.h"
+#include "cvtimage.h"
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageRotatorImplMirrorFlip =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::CVtImageRotatorImplMirrorFlip(
+// const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImplMirrorFlip::CVtImageRotatorImplMirrorFlip(
+ const CVtImageRotator::TRotationAngle& aAngle ) : CVtImageRotatorImpl( aAngle )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Rotate( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageRotatorImplMirrorFlip::Rotate( TBool& aContinue )
+ {
+ __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplMirrorFlip::Rotate() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt result( KErrNone );
+
+ aContinue = EFalse;
+
+ TBool isSameBitmap( iSource->DataAddress() == iTarget->DataAddress() );
+
+ if( iAngle == CVtImageRotator::EFlipVerticalAxis )
+ {
+ // Are source and target referencing same bitmap?
+ if( isSameBitmap )
+ {
+ // YES: Flip inside bitmap
+ Flip( *iTarget );
+ }
+ else
+ {
+ // NO: Use flipping from source to target
+ Flip();
+ }
+ }
+ else if( iAngle == CVtImageRotator::EMirrorHorizontalAxis )
+ {
+ // Are source and target referencing same bitmap?
+ if( isSameBitmap )
+ {
+ // YES: Mirror inside bitmap
+ Mirror( *iTarget );
+ }
+ else
+ {
+ // NO: Mirror from source to target
+ Mirror();
+ }
+ }
+ else if( iAngle == CVtImageRotator::E180DegreesClockwise )
+ {
+ // Are source and target referencing same bitmap?
+ if( isSameBitmap )
+ {
+ // YES: Mirror inside bitmap
+ Mirror( *iTarget );
+ }
+ else
+ {
+ // NO: Mirror from source to target
+ Mirror();
+ }
+ Flip( *iTarget );
+ }
+
+ __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplMirrorFlip::Rotate() <<" ), RThread().Id().operator TUint() ) );
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+
+
+ // Sizes must match
+ if( aSource.Size() != aTarget.Size() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // Displaymodes must match
+ if( aSource.DisplayMode() != aTarget.DisplayMode() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // Check that displaymode is one of the supported
+ switch( aSource.DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ case CVtImage::EVtColor16M:
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ case CVtImage::EVtColorIYUV:
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImplMirrorFlip::SupportsRotationAngle(
+ const CVtImageRotator::TRotationAngle& aAngle )
+ {
+ TBool result( EFalse );
+
+ if( ( aAngle == CVtImageRotator::EMirrorHorizontalAxis ) ||
+ ( aAngle == CVtImageRotator::EFlipVerticalAxis ) ||
+ ( aAngle == CVtImageRotator::E180DegreesClockwise ) )
+ {
+ result = ETrue;
+ }
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Mirror()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Mirror()
+ {
+ TInt bytesPerRow( iSource->BytesPerRow() );
+
+ TInt height( iSource->Size().iHeight );
+
+ TInt width( iSource->Size().iWidth );
+
+ switch( iSource->DisplayMode() )
+ {
+ // DisplayMode: 4K and 64K
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ d += bytesPerRow;
+
+ if( width & 1 )
+ {
+ d -= 2;
+ }
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register const TUint16* tempS = reinterpret_cast< const TUint16* >( s );
+
+ register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+ for( register TInt x = width - 1; x >= 0; x-- )
+ {
+ *--tempD = *tempS++;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16M
+ case CVtImage::EVtColor16M:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ d += width * 3;
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ const TUint8* tempS = s;
+
+ TUint8* tempD = d - 3;
+
+ for( TInt x = width - 1; x >= 0; x-- )
+ {
+ tempD[ 0 ] = *tempS++;
+ tempD[ 1 ] = *tempS++;
+ tempD[ 2 ] = *tempS++;
+ tempD -= 3;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16MU and 16MA
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ {
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ d += bytesPerRow;
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register const TUint32* tempS = reinterpret_cast< const TUint32* >( s );
+ register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+ for( TInt x = width - 1; x >= 0; x-- )
+ {
+ *--tempD = *tempS++;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // IYUV
+ case CVtImage::EVtColorIYUV:
+ MirrorIYUV( reinterpret_cast< const CVtImageIYUV& >( *iSource ), reinterpret_cast< CVtImageIYUV& >( *iTarget ) );
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Mirror( CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Mirror( CVtImage& aTarget )
+ {
+ TInt bytesPerRow( aTarget.BytesPerRow() );
+
+ TInt height( aTarget.Size().iHeight );
+
+ TInt width( aTarget.Size().iWidth );
+
+ switch( aTarget.DisplayMode() )
+ {
+ // DisplayMode: 4K and 64K
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ {
+ TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+ TUint8* s = reinterpret_cast< TUint8* >( d );
+
+ d += bytesPerRow;
+
+ if( width & 1 )
+ {
+ d -= 2;
+ }
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register TUint16* tempS = reinterpret_cast< TUint16* >( s );
+
+ register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+ for( register TInt x = width/2 - 1; x >= 0; x-- )
+ {
+ TUint16 p = *tempS;
+ *tempS++ = *--tempD;
+ *tempD = p;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16M
+ case CVtImage::EVtColor16M:
+ {
+ TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+ TUint8* s = reinterpret_cast< TUint8* >( d );
+
+ d += width * 3;
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ TUint8* tempS = s;
+
+ TUint8* tempD = d - 3;
+
+ for( TInt x = width/2 - 1; x >= 0; x-- )
+ {
+ TUint8 s = *tempS;
+ TUint8 t = *tempD;
+ *tempD++ = s;
+ *tempS++ = t;
+
+ s = *tempS;
+ t = *tempD;
+ *tempD++ = s;
+ *tempS++ = t;
+
+ s = *tempS;
+ t = *tempD;
+ *tempD++ = s;
+ *tempS++ = t;
+
+ tempD -= 6;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // DisplayMode: 16MU and 16MA
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ {
+ TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+ TUint8* s = reinterpret_cast< TUint8* >( d );
+
+ d += bytesPerRow;
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ register TUint32* tempS = reinterpret_cast< TUint32* >( s );
+ register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+ for( TInt x = width/2 - 1; x >= 0; x-- )
+ {
+ TUint32 p = *tempS;
+ *tempS++ = *--tempD;
+ *tempD = p;
+ }
+
+ s += bytesPerRow;
+
+ d += bytesPerRow;
+ }
+ }
+ break;
+
+ // IYUV
+ case CVtImage::EVtColorIYUV:
+ MirrorIYUV( reinterpret_cast< const CVtImageIYUV& >( aTarget ), reinterpret_cast< CVtImageIYUV& >( aTarget ) );
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::MirrorIYUV( const CVtImageIYUV& aSource,
+// CVtImageIYUV& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::MirrorIYUV( const CVtImageIYUV& aSource,
+ CVtImageIYUV& aTarget )
+ {
+ MirrorPlane( aSource.Y(), aTarget.Y(), aSource.Size().iWidth,
+ aSource.Size().iHeight, aSource.BytesPerRow() );
+ MirrorPlane( aSource.U(), aTarget.U(), aSource.UVPlaneWidth(),
+ aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+ MirrorPlane( aSource.V(), aTarget.V(), aSource.UVPlaneWidth(),
+ aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::MirrorPlane( TUint8* aSource, TUint8* aTarget,
+// TInt aWidth, TInt aHeight, TInt aBytesPerRow )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::MirrorPlane( TUint8* aSource,
+ TUint8* aTarget, TInt aWidth, TInt aHeight, TInt aBytesPerRow )
+ {
+ if( aSource != aTarget )
+ {
+ aTarget += aBytesPerRow;
+ for( TInt y = aHeight - 1; y >= 0; y-- )
+ {
+ register const TUint8* tempS = aSource;
+ register TUint8* tempD = aTarget;
+ for( TInt x = aWidth - 1; x >= 0; x-- )
+ {
+ *--tempD = *tempS++;
+ }
+ aSource += aBytesPerRow;
+ aTarget += aBytesPerRow;
+ }
+ }
+ else
+ {
+ aTarget += aBytesPerRow;
+ for( TInt y = aHeight - 1; y >= 0; y-- )
+ {
+ register TUint8* tempS = aSource;
+ register TUint8* tempD = aTarget;
+ for( TInt x = aWidth/2 - 1; x >= 0; x-- )
+ {
+ TUint8 p = *tempS;
+ *tempS++ = *--tempD;
+ *tempD = p;
+ }
+ aSource += aBytesPerRow;
+ aTarget += aBytesPerRow;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Flip()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Flip()
+ {
+ if( iSource->DisplayMode() == CVtImage::EVtColorIYUV )
+ {
+ FlipIYUV
+ (
+ reinterpret_cast< const CVtImageIYUV& >( *iSource ),
+ reinterpret_cast< CVtImageIYUV& >( *iTarget )
+ );
+ }
+ else
+ {
+ TInt bytesPerRow( iSource->BytesPerRow() );
+
+ TInt height( iSource->Size().iHeight );
+
+ const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ d += ( height - 1 ) * bytesPerRow;
+
+ for( TInt y = height - 1; y >= 0; y-- )
+ {
+ Mem::Copy( d, s, bytesPerRow );
+ s += bytesPerRow;
+ d -= bytesPerRow;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::FlipIYUV()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::FlipIYUV
+ (
+ const CVtImageIYUV& aSource,
+ CVtImageIYUV& aTarget
+ )
+ {
+ FlipPlane( aSource.Y(), aTarget.Y(), aSource.Size().iHeight, aSource.BytesPerRow() );
+ FlipPlane( aSource.U(), aTarget.U(), aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+ FlipPlane( aSource.V(), aTarget.V(), aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::FlipPlane()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::FlipPlane
+ (
+ TUint8* aSource,
+ TUint8* aTarget,
+ TInt aHeight,
+ TInt aBytesPerRow
+ )
+ {
+ TBool doSwap = ( aSource == aTarget );
+
+ aTarget += ( aHeight - 1 ) * aBytesPerRow;
+
+ if( doSwap )
+ {
+ for( TInt y = aHeight / 2 - 1; y >= 0; y-- )
+ {
+ Mem::Swap( aTarget, aSource, aBytesPerRow );
+ aSource += aBytesPerRow;
+ aTarget -= aBytesPerRow;
+ }
+ }
+ else
+ {
+ for( TInt y = aHeight - 1; y >= 0; y-- )
+ {
+ Mem::Copy( aTarget, aSource, aBytesPerRow );
+ aSource += aBytesPerRow;
+ aTarget -= aBytesPerRow;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Flip( CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Flip( CVtImage& aTarget )
+ {
+ if( iSource->DisplayMode() == CVtImage::EVtColorIYUV )
+ {
+ FlipIYUV
+ (
+ reinterpret_cast< const CVtImageIYUV& >( aTarget ),
+ reinterpret_cast< CVtImageIYUV& >( aTarget )
+ );
+ }
+ else
+ {
+ TInt bytesPerRow( aTarget.BytesPerRow() );
+
+ TInt height( aTarget.Size().iHeight );
+
+ TUint8* s = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+ TUint8* d = s;
+
+ d += ( height - 1 ) * bytesPerRow;
+
+ for( TInt y = height / 2 - 1; y >= 0; y-- )
+ {
+ Mem::Swap( d, s, bytesPerRow );
+ s += bytesPerRow;
+ d -= bytesPerRow;
+ }
+ }
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScaler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScaler.h"
+#include "CVtImageScalerImpl.h"
+#include "CVtImageScalerImplNearest.h"
+#include "CVtImageScalerImplWeightedAverage.h"
+#include "CVtImageScalerImplBilinear.h"
+
+// CONSTANTS
+
+_LIT( KModuleName, "CVtImageScaler" );
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::NewL( MVtImageScalerObserver& aObserver, TQuality aQuality,
+// TPriority aPriority )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageScaler* CVtImageScaler::NewL(
+ MVtImageScalerObserver& aObserver,
+ TQuality aQuality,
+ TPriority aPriority )
+ {
+ CVtImageScaler* self = new ( ELeave ) CVtImageScaler( aObserver, aPriority );
+ CleanupStack::PushL( self );
+ self->ConstructL( aQuality );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::~CVtImageScaler()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageScaler::~CVtImageScaler()
+ {
+ Cancel();
+ delete iAsyncCallBack;
+ delete iHeapLock;
+ delete iScalerImpl;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::SetQualityL( TQuality aQuality )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::SetQualityL( TQuality aQuality )
+ {
+ delete iScalerImpl;
+ iScalerImpl = 0;
+
+ switch( aQuality )
+ {
+ case ENearest:
+ iScalerImpl = new ( ELeave ) CVtImageScalerImplNearest();
+ break;
+
+ case EWeightedAverage:
+ iScalerImpl = new ( ELeave ) CVtImageScalerImplWeightedAverage();
+ break;
+
+ case EBilinear:
+ iScalerImpl = new ( ELeave ) CVtImageScalerImplBilinear();
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ScaleL( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::ScaleL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ if( !IsActive() )
+ {
+ if( !iScalerImpl )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iScalerImpl->SetSourceTargetL( aSource, aTarget );
+ iCancelled = EFalse;
+ Activate();
+ iAsyncCallBack->CallBack();
+ }
+ else
+ {
+ User::Panic( KModuleName(), EBusy );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Scale( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::Scale(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ TRAPD( result, ScaleL( aSource, aTarget ) );
+ if( result != KErrNone )
+ {
+ Activate();
+ Signal( result );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ScaleNowL( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::ScaleNowL(
+ const CVtImage& aSource, CVtImage& aTarget )
+ {
+ if( !iScalerImpl )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ iScalerImpl->SetSourceTargetL( aSource, aTarget );
+
+ TInt result;
+ TBool more;
+ TBool needsLock( iScalerImpl->NeedHeapLock() );
+ do
+ {
+
+ if ( needsLock )
+ {
+ iHeapLock->LockHeap( ETrue );
+ }
+
+ result = iScalerImpl->Scale( more );
+
+ if ( needsLock )
+ {
+ iHeapLock->UnlockHeap( ETrue );
+ }
+
+ } while ( more && ( result == KErrNone ) );
+
+ User::LeaveIfError( result );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::CVtImageScaler()
+// -----------------------------------------------------------------------------
+CVtImageScaler::CVtImageScaler( MVtImageScalerObserver& aObserver, TPriority aPriority )
+: CActive( aPriority ), iObserver( aObserver )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ConstructL( TQuality aQuality )
+// -----------------------------------------------------------------------------
+void CVtImageScaler::ConstructL( TQuality aQuality )
+ {
+ SetQualityL( aQuality );
+ iHeapLock = new ( ELeave ) CFbsBitmap();
+ iHeapLock->Create( TSize( 1, 1 ), EColor256 );
+ iAsyncCallBack = new ( ELeave )
+ CAsyncCallBack( TCallBack( StaticScale, this ), Priority() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Activate
+// -----------------------------------------------------------------------------
+void CVtImageScaler::Activate()
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+void CVtImageScaler::Signal( TInt aError )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, aError );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScaler::RunL()
+ {
+ iObserver.ScalingFinished( iStatus.Int() );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::DoCancel()
+// -----------------------------------------------------------------------------
+void CVtImageScaler::DoCancel()
+ {
+ if ( iStatus == KRequestPending )
+ {
+ iCancelled = ETrue;
+ Signal( KErrCancel );
+ iObserver.ScalingFinished( KErrCancel );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::StaticScale()
+// -----------------------------------------------------------------------------
+TInt CVtImageScaler::StaticScale( TAny* aPtr )
+ {
+ CVtImageScaler* self = reinterpret_cast< CVtImageScaler* >( aPtr );
+ self->DoScale();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::DoScale
+// -----------------------------------------------------------------------------
+void CVtImageScaler::DoScale()
+ {
+ if ( !iCancelled )
+ {
+ TBool more;
+ TBool needsLock = iScalerImpl->NeedHeapLock();
+ if ( needsLock )
+ {
+ iHeapLock->LockHeap( ETrue );
+ }
+ TInt result = iScalerImpl->Scale( more );
+ if ( needsLock )
+ {
+ iHeapLock->UnlockHeap( ETrue );
+ }
+ if ( !more || ( result != KErrNone ) )
+ {
+ Signal( result );
+ }
+ else
+ {
+ iAsyncCallBack->CallBack();
+ }
+ }
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImpl.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImpl.h"
+#include "cvtimage.h"
+#include "CVtImageBitmap.h"
+
+// MACROS
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ========================== CVtImageScalerImpl ==============================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::CVtImageScalerImpl()
+// -----------------------------------------------------------------------------
+CVtImageScalerImpl::CVtImageScalerImpl() : CActive( EPriorityStandard )
+ {
+ _IFDBG(PRINT( _L("ScaleImpl.Ctor<") ));
+ CActiveScheduler::Add( this );
+ _IFDBG(PRINT( _L("ScaleImpl.Ctor>") ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::~CVtImageScalerImpl()
+// -----------------------------------------------------------------------------
+CVtImageScalerImpl::~CVtImageScalerImpl()
+ {
+ _IFDBG(PRINT( _L("ScaleImpl.~<") ));
+ Cancel();
+ delete iScaler;
+ _IFDBG(PRINT( _L("ScaleImpl.~>") ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::SetSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::SetSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ iSource = iTarget = 0;
+ LeaveIfNotValidSizeL( aSource.Size(), TSize( 2, 2 ) );
+ LeaveIfNotValidSizeL( aTarget.Size() );
+ ValidateSourceTargetL( aSource, aTarget );
+ iSource = &aSource;
+ iTarget = &aTarget;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageScalerImpl::NeedHeapLock() const
+ {
+ return iSource->NeedHeapLock() || iTarget->NeedHeapLock();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::ScaleWithBitmapScalerL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::ScaleWithBitmapScalerL(
+ const CBitmapScaler::TQualityAlgorithm
+#ifdef _DEBUG
+ aQuality
+#endif // _DEBUG
+ )
+ {
+ _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL<") ));
+ if ( IsActive() || iActiveSchedulerWait.IsStarted() )
+ {
+ _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL LEAVE KErrInUse>") ));
+ User::Leave( KErrInUse );
+ }
+ _IFDBG(PRINT( _L("ScaleImpl::ScaleWithBitmapScalerL aQuality = %d"), aQuality ));
+ CFbsBitmap& source( static_cast< CVtImageBitmap* >(
+ const_cast< CVtImage* >( iSource ) )->Bitmap() );
+ CFbsBitmap& target( static_cast< CVtImageBitmap* >( iTarget )->Bitmap() );
+ iScaler = CBitmapScaler::NewL();
+ SetActive();
+ iScaler->Scale( &iStatus, source, target, EFalse );
+ iActiveSchedulerWait.Start();
+ delete iScaler; iScaler = NULL;
+ _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL iStatus.Int() = %d"), iStatus.Int() ));
+ User::LeaveIfError( iStatus.Int() );
+ _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL>") ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::LeaveIfNotValidSizeL(
+// const TSize& aSize, const TSize aMinSize )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::LeaveIfNotValidSizeL(
+ const TSize& aSize,
+ const TSize aMinSize )
+ {
+ _IFDBG(PRINT( _L("ScaleImpl.LeaveIfNotValidSizeL<") ));
+ if( ( aSize.iWidth < aMinSize.iWidth ) ||
+ ( aSize.iHeight < aMinSize.iHeight ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ _IFDBG(PRINT( _L("ScaleImpl.LeaveIfNotValidSizeL>") ));
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::RunL()
+ {
+ _IFDBG(PRINT( _L("CVtImageScalerImpl.RunL") ));
+ iActiveSchedulerWait.AsyncStop();
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::DoCancel()
+ {
+ _IFDBG(PRINT( _L("CVtImageScalerImpl.DoCancel") ));
+ iScaler->Cancel();
+ iActiveSchedulerWait.AsyncStop();
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplBilinear.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1462 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplBilinear.h"
+#include "cvtimage.h"
+#include "CVtImageScalerMacros.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 14; // 18.14 pseudo real format,
+ // this must be lower than 15!
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplBilinear ==========================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplBilinear::Scale( TBool& aContinue )
+ {
+ TInt result( KErrNone );
+
+ aContinue = EFalse;
+
+ // this implementation does not support different display modes for source
+ // and target
+ if( iSource->DisplayMode() != iTarget->DisplayMode() )
+ {
+ return KErrNotSupported;
+ }
+
+ // if sizes are same, just copy the data
+ if( iSource->Size() == iTarget->Size() )
+ {
+ Mem::Copy(
+ iTarget->DataAddress(),
+ iSource->DataAddress(),
+ iTarget->BytesPerRow() * iTarget->Size().iHeight );
+ }
+ else if ( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight )
+ && ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+ {
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ Scale2x4K64K( 0xeee ); // 0000ggggbbbbrrrr ->
+ break; // mask = %0000111011101110 = 0xeee
+
+ case CVtImage::EVtColor64K:
+ Scale2x4K64K( 0xf7de ); // bbbbbggggggrrrrr ->
+ break; // mask = %1111011111011110 = 0xf7de
+
+ case CVtImage::EVtColor16M:
+ Scale2x16M();
+ break;
+
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ Scale2x16MU16MA();
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMaximumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+ else
+ {
+ Initialize();
+
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ Scale4K();
+ break;
+
+ case CVtImage::EVtColor64K:
+ Scale64K();
+ break;
+
+ case CVtImage::EVtColor16M:
+ Scale16M();
+ break;
+
+ case CVtImage::EVtColor16MU:
+ Scale16MU();
+ break;
+
+ case CVtImage::EVtColor16MA:
+ Scale16MA();
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMaximumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ if( aSource.DisplayMode() != aTarget.DisplayMode() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ switch( aSource.DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ case CVtImage::EVtColor16M:
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ break;
+
+ default:
+ // Scaling for bitmaps is supported for other display modes
+ if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+ aTarget.Type() == CVtImage::EVtImageBitmap ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Initialize()
+ {
+ iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+ iTarget->Size().iWidth;
+ iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+ iTarget->Size().iHeight;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale4K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale4K()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+ TUint32 b11( 0 );
+ TUint32 g11( 0 );
+ TUint32 r11( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint16* s = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint16* snext = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TInt x;
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch
+ // pixels from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_4K_BLUE( p0 );
+ g00 = UNPACK_4K_GREEN( p0 );
+ r00 = UNPACK_4K_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_4K_BLUE( p0 );
+ g01 = UNPACK_4K_GREEN( p0 );
+ r01 = UNPACK_4K_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_4K_BLUE( p0 );
+ g10 = UNPACK_4K_GREEN( p0 );
+ r10 = UNPACK_4K_RED( p0 );
+
+ p0 = *( snext + x0 + 1 );
+
+ b11 = UNPACK_4K_BLUE( p0 );
+ g11 = UNPACK_4K_GREEN( p0 );
+ r11 = UNPACK_4K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t = 0;
+
+ *t++ = PACK_4K_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_4K_BLUE( p0 );
+ g01 = g00 = UNPACK_4K_GREEN( p0 );
+ r01 = r00 = UNPACK_4K_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b11 = b10 = UNPACK_4K_BLUE( p0 );
+ g11 = g10 = UNPACK_4K_GREEN( p0 );
+ r11 = r10 = UNPACK_4K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_4K_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // if width is not even -> then we need to skip one additional byte
+ if( width & 1 )
+ {
+ t++;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale64K()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+ TUint32 b11( 0 );
+ TUint32 g11( 0 );
+ TUint32 r11( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint16* s = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint16* snext = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TInt x;
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_64K_BLUE( p0 );
+ g00 = UNPACK_64K_GREEN( p0 );
+ r00 = UNPACK_64K_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_64K_BLUE( p0 );
+ g01 = UNPACK_64K_GREEN( p0 );
+ r01 = UNPACK_64K_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_64K_BLUE( p0 );
+ g10 = UNPACK_64K_GREEN( p0 );
+ r10 = UNPACK_64K_RED( p0 );
+
+ p0 = *( snext + x0 + 1 );
+
+ b11 = UNPACK_64K_BLUE( p0 );
+ g11 = UNPACK_64K_GREEN( p0 );
+ r11 = UNPACK_64K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_64K_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_64K_BLUE( p0 );
+ g01 = g00 = UNPACK_64K_GREEN( p0 );
+ r01 = r00 = UNPACK_64K_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b11 = b10 = UNPACK_64K_BLUE( p0 );
+ g11 = g10 = UNPACK_64K_GREEN( p0 );
+ r11 = r10 = UNPACK_64K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_64K_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // if width is not even -> then we need to skip one additional byte
+ if( width & 1 )
+ {
+ t++;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16M()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32 t_pitch = iTarget->BytesPerRow();
+
+ TUint8* t = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+ TUint32 b11( 0 );
+ TUint32 g11( 0 );
+ TUint32 r11( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint8* s = reinterpret_cast< TUint8* >(
+ iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint8* snext = reinterpret_cast< TUint8* >(
+ iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TInt x;
+
+ TUint8* d = t;
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+ if( x0 != x0prev )
+ {
+ TUint8* tempSrc = s + x0;
+
+ b00 = *tempSrc++;
+ g00 = *tempSrc++;
+ r00 = *tempSrc++;
+
+ b01 = *tempSrc++;
+ g01 = *tempSrc++;
+ r01 = *tempSrc++;
+
+ tempSrc = snext + x0;
+
+ b10 = *tempSrc++;
+ g10 = *tempSrc++;
+ r10 = *tempSrc++;
+
+ b11 = *tempSrc++;
+ g11 = *tempSrc++;
+ r11 = *tempSrc++;
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *d++ = static_cast< TUint8 >( bres >> KDecimalBits );
+ *d++ = static_cast< TUint8 >( gres >> KDecimalBits );
+ *d++ = static_cast< TUint8 >( rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+ if( x0 != x0prev )
+ {
+ TUint8* tempSrc = s + x0;
+
+ b01 = b00 = *tempSrc++;
+ g01 = g00 = *tempSrc++;
+ r01 = r00 = *tempSrc++;
+
+ tempSrc = snext + x0;
+
+ b11 = b10 = *tempSrc++;
+ g11 = g10 = *tempSrc++;
+ r11 = r10 = *tempSrc++;
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *d++ = static_cast< TUint8 >( bres >> KDecimalBits );
+ *d++ = static_cast< TUint8 >( gres >> KDecimalBits );
+ *d++ = static_cast< TUint8 >( rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ t += t_pitch;
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16MU()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16MU()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MU() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32* t = iTarget->DataAddress();
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+ TUint32 b11( 0 );
+ TUint32 g11( 0 );
+ TUint32 r11( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+ TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TInt x;
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_16MU_BLUE( p0 );
+ g00 = UNPACK_16MU_GREEN( p0 );
+ r00 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_16MU_BLUE( p0 );
+ g01 = UNPACK_16MU_GREEN( p0 );
+ r01 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_16MU_BLUE( p0 );
+ g10 = UNPACK_16MU_GREEN( p0 );
+ r10 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( snext + x0 + 1 );
+
+ b11 = UNPACK_16MU_BLUE( p0 );
+ g11 = UNPACK_16MU_GREEN( p0 );
+ r11 = UNPACK_16MU_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_16MU_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_16MU_BLUE( p0 );
+ g01 = g00 = UNPACK_16MU_GREEN( p0 );
+ r01 = r00 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b11 = b10 = UNPACK_16MU_BLUE( p0 );
+ g11 = g10 = UNPACK_16MU_GREEN( p0 );
+ r11 = r10 = UNPACK_16MU_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_16MU_BGR(
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MU() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16MA()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32* t = iTarget->DataAddress();
+
+ TUint32 sourceY( 0 );
+
+ TUint32 a00( 0 );
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 a01( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 a10( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+ TUint32 a11( 0 );
+ TUint32 b11( 0 );
+ TUint32 g11( 0 );
+ TUint32 r11( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+ TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TInt x;
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ a00 = UNPACK_16MA_ALPHA( p0 );
+ b00 = UNPACK_16MA_BLUE( p0 );
+ g00 = UNPACK_16MA_GREEN( p0 );
+ r00 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ a01 = UNPACK_16MA_ALPHA( p0 );
+ b01 = UNPACK_16MA_BLUE( p0 );
+ g01 = UNPACK_16MA_GREEN( p0 );
+ r01 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ a10 = UNPACK_16MA_ALPHA( p0 );
+ b10 = UNPACK_16MA_BLUE( p0 );
+ g10 = UNPACK_16MA_GREEN( p0 );
+ r10 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( snext + x0 + 1 );
+
+ a11 = UNPACK_16MA_ALPHA( p0 );
+ b11 = UNPACK_16MA_BLUE( p0 );
+ g11 = UNPACK_16MA_GREEN( p0 );
+ r11 = UNPACK_16MA_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 ares = w1 * a00 + w2 * a01 + w3 * a10 + w4 * a11;
+ ares += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_16MA_ABGR(
+ ares >> KDecimalBits,
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ // last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ // If the source is still same then we don't have to fetch pixels
+ // from memory and unpack them again
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ a01 = a00 = UNPACK_16MA_ALPHA( p0 );
+ b01 = b00 = UNPACK_16MA_BLUE( p0 );
+ g01 = g00 = UNPACK_16MA_GREEN( p0 );
+ r01 = r00 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( snext + x0 );
+ a11 = a10 = UNPACK_16MA_ALPHA( p0 );
+ b11 = b10 = UNPACK_16MA_BLUE( p0 );
+ g11 = g10 = UNPACK_16MA_GREEN( p0 );
+ r11 = r10 = UNPACK_16MA_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 w1 = ( du * dv ) >> KDecimalBits;
+ TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+ TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+ TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+ TUint32 ares = w1 * a00 + w2 * a01 + w3 * a10 + w4 * a11;
+ ares += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+ bres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+ gres += ( 1 << ( KDecimalBits - 1 ) );
+ TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+ rres += ( 1 << ( KDecimalBits - 1 ) );
+
+ *t++ = PACK_16MA_ABGR(
+ ares >> KDecimalBits,
+ bres >> KDecimalBits,
+ gres >> KDecimalBits,
+ rres >> KDecimalBits );
+
+ sourceX += iU;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MA() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x4K64K( TUint32 aMask )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x4K64K( TUint32 aMask )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint32* s = iSource->DataAddress();
+ TUint32* d = iTarget->DataAddress();
+ TInt y;
+
+ // first average source rows
+ for( y = 0; y < sheight; y++ )
+ {
+ TUint32* s1 = s;
+ TUint32* d1 = d;
+
+ TUint32 p = *s1++; // 2 pixels
+ TUint32 p1 = p & 0xffff;
+ TUint32 p2 = ( p >> 16 ) & 0xffff;
+ TInt x;
+
+ for( x = 0; x < swidth/2 - 1; x++ )
+ {
+ TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ *d1++ = p1 | ( p1a << 16 );
+
+ p = *s1++; // 2 pixels
+
+ p1 = p & 0xffff;
+ TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ *d1++ = p2 | ( p2a << 16 );
+
+ p2 = ( p >> 16 ) & 0xffff;
+ }
+
+ TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ *d1++ = p1 | ( p1a << 16 );
+
+ if( swidth & 1 )
+ {
+ p = *s1; // 2 pixels
+ p1 = p & 0xffff;
+ TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ *d1++ = p2 | ( p2a << 16 );
+
+ p = *--s1; // 2 pixels
+ p2 = ( p >> 16 ) & 0xffff;
+ *d1++ = p1 | ( p1 << 16 );
+ }
+ else
+ {
+ p = *--s1; // 2 pixels
+ p2 = ( p >> 16 ) & 0xffff;
+ *d1++ = p2 | ( p2 << 16 );
+ }
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ s = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ // then average rows between
+ d = iTarget->DataAddress();
+
+ TUint32 mask32bit = aMask | ( aMask << 16 );
+
+ for( y = 0; y < sheight - 1; y++ )
+ {
+ TUint32* d1 = reinterpret_cast< TUint32* >( d );
+ TUint32* d2 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+ TUint32* d3 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint32 p1 = *d1++;
+ TUint32 p2 = *d3++;
+ *d2++ = ( ( ( p1 ^ p2 ) & mask32bit ) >> 1 ) + ( p1 & p2 );
+ }
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x16M()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TInt y;
+
+ for( y = 0; y < sheight; y++ )
+ {
+ TUint8* s2 = s;
+ TUint8* d1 = d;
+
+ TUint32 g1 = 0;
+ TUint32 b1 = 0;
+ TUint32 r1 = 0;
+
+ TUint32 g2 = 0;
+ TUint32 b2 = 0;
+ TUint32 r2 = 0;
+
+ for( TInt x = 0; x < swidth - 1; x++ )
+ {
+ g1 = *s2++;
+ b1 = *s2++;
+ r1 = *s2++;
+
+ *d1++ = static_cast< TUint8 >( g1 );
+ *d1++ = static_cast< TUint8 >( b1 );
+ *d1++ = static_cast< TUint8 >( r1 );
+
+ g2 = s2[ 0 ];
+ b2 = s2[ 1 ];
+ r2 = s2[ 2 ];
+
+ *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+ }
+
+ *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+ *d1++ = static_cast< TUint8 >( g2 );
+ *d1++ = static_cast< TUint8 >( b2 );
+ *d1++ = static_cast< TUint8 >( r2 );
+
+ d += dpitch * 2;
+ s += spitch;
+ }
+
+ // then average rows between
+ d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ for( y = 0; y < sheight - 1; y++ )
+ {
+ TUint8* d1 = d;
+ TUint8* d2 = d1 + dpitch;
+ TUint8* d3 = d2 + dpitch;
+
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint32 g1 = *d1++;
+ TUint32 g2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+ TUint32 b1 = *d1++;
+ TUint32 b2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+ TUint32 r1 = *d1++;
+ TUint32 r2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+ g1 = *d1++;
+ g2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+ b1 = *d1++;
+ b2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+ r1 = *d1++;
+ r2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+ }
+
+ d += dpitch * 2;
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x16MU16MA()
+ {
+
+#if defined ( __MARM_ARMI__ ) && defined ( NDEBUG ) && defined ( __USE_ASM_OPTS ) // From urel
+
+ asm("stmfd sp!, {r4, r5, r6, r7, r8, r9, sl, r11, r12, lr} ");
+ asm("ldr r11, .L1_671");
+ asm("sub sp, sp, #24 ");
+ asm("mov r6, r0 ");
+ asm("ldr r1, [r6, #4] ");
+ asm("ldr r3, [r1, #0] ");
+ asm("add r0, sp, #16 ");
+ asm("ldr ip, [r3, #20] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("ldr r7, [sp, #20] ");
+ asm("ldr r1, [r6, #4] ");
+ asm("ldr r3, [r1, #0] ");
+ asm("add r0, sp, #8 ");
+ asm("ldr ip, [r3, #20] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("ldr r9, [sp, #8] ");
+ asm("str r9, [sp, #0] ");
+ asm("ldr r0, [r6, #4] ");
+ asm("ldr r3, [r0, #0] ");
+ asm("ldr ip, [r3, #24] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("str r0, [sp, #4] ");
+ asm("ldr r0, [r6, #8] ");
+ asm("ldr r3, [r0, #0] ");
+ asm("ldr ip, [r3, #24] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("mov sl, r0 ");
+ asm("ldr r0, [r6, #4] ");
+ asm("ldr r3, [r0, #0] ");
+ asm("ldr ip, [r3, #28] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("mov r4, r0 ");
+ asm("ldr r0, [r6, #8] ");
+ asm("ldr r3, [r0, #0] ");
+ asm("ldr ip, [r3, #28] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("mov r5, r0 ");
+ asm("subs r8, r7, #1 ");
+ asm("bmi .L1_654 ");
+
+asm(" .L1_656: ");
+ asm("mov ip, r5 ");
+ asm("mov lr, r4 ");
+ asm("ldr r1, [lr], #4 ");
+ asm("ldr r9, [sp, #0] ");
+ asm("cmp r9, #4");
+ asm("bhi .L1_658_1");
+
+ // picture width lower or equal to 4
+ asm("subs r0, r9, #2");
+ asm("bmi .L1_658");
+
+ asm("ldr r9, [lr], #4 ");
+ asm("eor r2, r9, r1 ");
+ asm("and r2, r2, r11 ");
+ asm("and r3, r9, r1 ");
+ asm("add r3, r3, r2, lsr #1 ");
+ asm("str r1, [ip], #4");
+ asm("str r3, [ip], #4");
+
+ asm("subs r0, r0, #1");
+ asm("strmi r9, [ip], #4");
+ asm("strmi r9, [ip], #4");
+ asm("bmi .L1_658");
+
+ asm("ldr r1, [lr], #4 ");
+ asm("eor r2, r9, r1 ");
+ asm("and r2, r2, r11 ");
+ asm("and r3, r9, r1 ");
+ asm("add r3, r3, r2, lsr #1 ");
+ asm("str r9, [ip], #4");
+ asm("str r3, [ip], #4");
+
+ asm("subs r0, r0, #1");
+ asm("strmi r1, [ip], #4");
+ asm("strmi r1, [ip], #4");
+ asm("bmi .L1_658");
+
+ asm("ldr r9, [lr], #4 ");
+ asm("eor r2, r9, r1 ");
+ asm("and r2, r2, r11 ");
+ asm("and r3, r9, r1 ");
+ asm("add r3, r3, r2, lsr #1 ");
+ asm("str r1, [ip], #4");
+ asm("str r3, [ip], #4");
+
+ asm("b .L1_658");
+
+ // picture width higher than 4
+asm(" .L1_658_1:");
+ asm("mov r9, r9, lsr #1 ");
+ asm("subs r0, r9, #2 ");
+ asm("bmi .L1_658 ");
+
+asm(" .L1_660: ");
+ asm("ldr r9, [lr], #4 ");
+ asm("eor r2, r9, r1 ");
+ asm("and r2, r2, r11 ");
+ asm("and r3, r9, r1 ");
+ asm("add r3, r3, r2, lsr #1 ");
+ asm("stmia ip!, { r1, r3, r9 } ");
+ asm("sub r0, r0, #1 ");
+ asm("ldr r1, [lr], #4 ");
+ asm("eor r2, r9, r1 ");
+ asm("and r2, r2, r11 ");
+ asm("and r3, r9, r1 ");
+ asm("add r3, r3, r2, lsr #1 ");
+ asm("str r3, [ip], #4");
+ asm("cmp r0,#0");
+ asm("bge .L1_660 ");
+
+asm(" .L1_658: ");
+ asm("str r1, [ip], #4 ");
+ asm("str r1, [ip, #0] ");
+ asm("add r5, r5, sl, asl #1 ");
+ asm("ldr r9, [sp, #4] ");
+ asm("add r4, r4, r9 ");
+ asm("subs r8, r8, #1 ");
+ asm("bpl .L1_656 ");
+
+asm(" .L1_654: ");
+ asm("ldr r0, [r6, #8] ");
+ asm("ldr r3, [r0, #0] ");
+ asm("ldr ip, [r3, #28] ");
+ asm("mov lr, pc ");
+ asm("bx ip ");
+ asm("mov r5, r0 ");
+ asm("subs r8, r7, #2 ");
+ asm("bmi .L1_664 ");
+
+asm(" .L1_666: ");
+ asm("mov r7, r5 ");
+ asm("add r4, r5, sl ");
+ asm("add r6, r4, sl ");
+ asm("ldr r9, [sp, #0] ");
+ asm("subs lr, r9, #1 ");
+ asm("bmi .L1_668 ");
+
+asm(" .L1_670: ");
+ asm("ldr r1, [r7], #4 ");
+ asm("ldr r2, [r7], #4 ");
+ asm("ldr r0, [r6], #4 ");
+ asm("ldr ip, [r6], #4 ");
+ asm("eor r3, r1, r0 ");
+ asm("and r3, r3, r11 ");
+ asm("and r1, r1, r0 ");
+ asm("add r1, r1, r3, lsr #1 ");
+ asm("str r1, [r4], #4 ");
+ asm("eor r3, r2, ip ");
+ asm("and r3, r3, r11 ");
+ asm("and r2, r2, ip ");
+ asm("add r2, r2, r3, lsr #1 ");
+ asm("str r2, [r4], #4 ");
+ asm("subs lr, lr, #1 ");
+ asm("bpl .L1_670 ");
+
+asm(" .L1_668: ");
+ asm("add r5, r5, sl, asl #1 ");
+ asm("subs r8, r8, #1 ");
+ asm("bpl .L1_666 ");
+
+asm(" .L1_664: ");
+ asm("add r0, r5, sl ");
+ asm("mov r1, r5 ");
+ asm("mov r2, sl ");
+ asm("bl Copy__3MemPvPCvi ");
+ asm("add sp, sp, #24 ");
+ asm("ldmfd sp!, {r4, r5, r6, r7, r8, r9, sl, r11, r12, lr} ");
+ asm("bx lr ");
+
+asm(" .align 0 ");
+asm(" .L1_671: ");
+asm(" .word 0x00fefefe ");
+
+#else
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint32 mask = 0xfefefefe;
+ TUint32* s = iSource->DataAddress();
+ TUint32* d = iTarget->DataAddress();
+ TInt y;
+
+ TUint32 p1;
+ TUint32 p2;
+ TUint32 p3;
+ TUint32 p4;
+
+ // first average source rows
+ for( y = sheight - 1; y >= 0; y-- )
+ {
+ TUint32* s1 = s;
+ TUint32* d1 = d;
+
+ TUint32 p2 = *s1++;
+ TUint32 p1 = 0;
+
+ for( TInt x = swidth - 2; x >= 0; x-- )
+ {
+ *d1++ = p2;
+ p1 = p2;
+ p2 = *s1++;
+ *d1++ = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+ }
+
+ *d1++ = p2;
+ *d1++ = p2;
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ s = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ // then average rows between
+ d = iTarget->DataAddress();
+
+ for( y = sheight - 2; y >= 0; y-- )
+ {
+ TUint32* d1 = reinterpret_cast< TUint32* >( d );
+ TUint32* d2 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+ TUint32* d3 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+ for( TInt x = swidth - 1; x >= 0; x-- )
+ {
+ p1 = *d1++;
+ p2 = *d3++;
+ *d2++ = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+ p3 = *d1++;
+ p4 = *d3++;
+ *d2++ = ( ( ( p3 ^ p4 ) & mask ) >> 1 ) + ( p3 & p4 );
+ }
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+
+#endif
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplNearest.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,522 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplNearest.h"
+#include "cvtimage.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 16; // 16.16 pseudo real format
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplNearest =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplNearest::Scale( TBool& aContinue )
+ {
+ TInt result( KErrNone );
+
+ aContinue = EFalse;
+
+ // this implementation does not support different display modes for source
+ // and target
+ if( iSource->DisplayMode() != iTarget->DisplayMode() )
+ {
+ return KErrNotSupported;
+ }
+
+ // if sizes are same, just copy the data
+ if( iSource->Size() == iTarget->Size() )
+ {
+ Mem::Copy(
+ iTarget->DataAddress(),
+ iSource->DataAddress(),
+ iTarget->BytesPerRow() * iTarget->Size().iHeight );
+ }
+ else if( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight ) &&
+ ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+ {
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ Scale2x4K64K();
+ break;
+
+ case CVtImage::EVtColor16M:
+ Scale2x16M();
+ break;
+
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ Scale2x16MU16MA();
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMinimumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+ else
+ {
+ Initialize();
+
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ Scale4K(
+ reinterpret_cast< const TUint16* >(
+ iSource->DataAddress() ),
+ iSource->BytesPerRow(),
+ reinterpret_cast< TUint16* >( iTarget->DataAddress() ),
+ iTarget->Size().iWidth,
+ iTarget->Size().iHeight,
+ iU,
+ iV );
+ break;
+
+ case CVtImage::EVtColor64K:
+ Scale64K(
+ reinterpret_cast< const TUint16* >(
+ iSource->DataAddress() ),
+ iSource->BytesPerRow(),
+ reinterpret_cast< TUint16* >( iTarget->DataAddress() ),
+ iTarget->Size().iWidth,
+ iTarget->Size().iHeight,
+ iU,
+ iV );
+ break;
+
+ case CVtImage::EVtColor16M:
+ Scale16M(
+ reinterpret_cast< const TUint8* >(
+ iSource->DataAddress() ),
+ iSource->BytesPerRow(),
+ reinterpret_cast< TUint8* >( iTarget->DataAddress() ),
+ iTarget->Size().iWidth,
+ iTarget->Size().iHeight,
+ iTarget->BytesPerRow(),
+ iU,
+ iV );
+ break;
+
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ Scale16MU16MA(
+ iSource->DataAddress(),
+ iSource->BytesPerRow(),
+ iTarget->DataAddress(),
+ iTarget->Size().iWidth,
+ iTarget->Size().iHeight,
+ iU,
+ iV );
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMinimumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ if( aSource.DisplayMode() != aTarget.DisplayMode() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ switch( aSource.DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ case CVtImage::EVtColor16M:
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ break;
+
+ default:
+ // Scaling for bitmaps is supported for other display modes
+ if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+ aTarget.Type() == CVtImage::EVtImageBitmap ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Initialize()
+ {
+ iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+ iTarget->Size().iWidth + 1;
+ iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+ iTarget->Size().iHeight + 1;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale4K(
+// const TUint16* aSrcPtr, TUint32 aSrcWidth, TUint16* aTrgPtr,
+// TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale4K(
+ const TUint16* aSrcPtr,
+ TUint32 aSrcWidth,
+ TUint16* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+ // scaling 4K and 64K is equal procedure
+ Scale64K( aSrcPtr, aSrcWidth, aTrgPtr, aTrgWidth, aTrgHeight, aDx, aDy );
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale64K(
+// const TUint16* aSrcPtr, TUint32 aSrcPitch, TUint16* aTrgPtr,
+// TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale64K(
+ const TUint16* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint16* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TUint32 sy( 0 );
+
+ for( TUint32 y = 0; y < aTrgHeight; y++ )
+ {
+ const TUint16* srow =
+ aSrcPtr + ( sy >> KDecimalBits ) * ( aSrcPitch >> 1 );
+
+ TUint32 sx( 0 );
+
+ TUint32 x( 0 );
+
+ // loop unrolled with 8
+ for( ; x < ( aTrgWidth >> 3 ); x++ )
+ {
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ }
+
+ // handle remaining columns
+ for( x = 0; x < ( aTrgWidth & 7 ); x++ )
+ {
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ }
+
+ // if target width is not even aligning is needed
+ if( aTrgWidth & 1 )
+ {
+ aTrgPtr++;
+ }
+
+ sy += aDy;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale16M(
+// const TUint8* aSrcPtr, TUint32 aSrcPitch, TUint8* aTrgPtr,
+// TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aTrgPitch, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale16M(
+ const TUint8* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint8* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aTrgPitch,
+ TUint32 aDx,
+ TUint32 aDy )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TUint32 sy( 0 );
+
+ for( TUint32 y = 0; y < aTrgHeight; y++ )
+ {
+ const TUint8* s = aSrcPtr + ( sy >> KDecimalBits ) * aSrcPitch;
+
+ TUint8* d = aTrgPtr;
+
+ TUint32 sx( 0 );
+
+ TUint32 x( 0 );
+
+ for( ; x < aTrgWidth; x++ )
+ {
+ const TUint8* tempSrc = s + ( sx >> KDecimalBits ) * 3;
+ *d++ = *tempSrc++;
+ *d++ = *tempSrc++;
+ *d++ = *tempSrc++;
+ sx += aDx;
+ }
+
+ aTrgPtr += aTrgPitch;
+
+ sy += aDy;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale16MU16MA( const TUint32* aSrcPtr,
+// TUint32 aSrcPitch, TUint32* aTrgPtr, TUint32 aTrgWidth, TUint32 aTrgHeight,
+// TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale16MU16MA(
+ const TUint32* aSrcPtr,
+ TUint32 aSrcPitch,
+ TUint32* aTrgPtr,
+ TUint32 aTrgWidth,
+ TUint32 aTrgHeight,
+ TUint32 aDx,
+ TUint32 aDy )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TUint32 sy( 0 );
+
+ for( TUint32 y = 0; y < aTrgHeight; y++ )
+ {
+ const TUint32* srow =
+ aSrcPtr + ( sy >> KDecimalBits ) * ( aSrcPitch >> 2 );
+
+ TUint32 sx( 0 );
+
+ TUint32 x( 0 );
+
+ // loop unrolled with 8
+ for( ; x < ( aTrgWidth >> 3 ); x++ )
+ {
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ }
+
+ // handle remaining columns
+ for( x = 0; x < ( aTrgWidth & 7 ); x++ )
+ {
+ *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+ sx += aDx;
+ }
+
+ sy += aDy;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x4K64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x4K64K()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint16* s = reinterpret_cast< TUint16* >( iSource->DataAddress() );
+ TUint32* d = iTarget->DataAddress();
+
+ for( TInt y = 0; y < sheight; y++ )
+ {
+ TUint16* s2 = s;
+ TUint32* d1 = d;
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint32 p = *s2++;
+ p |= ( p << 16 );
+ *d1++ = p;
+ }
+ d = reinterpret_cast< TUint32* >(
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch ) );
+ s = reinterpret_cast< TUint16* >(
+ reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x16M()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ for( TInt y = 0; y < sheight; y++ )
+ {
+ TUint8* s2 = s;
+ TUint8* d1 = d;
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint8 g = *s2++;
+ TUint8 b = *s2++;
+ TUint8 r = *s2++;
+
+ *d1++ = g;
+ *d1++ = b;
+ *d1++ = r;
+
+ *d1++ = g;
+ *d1++ = b;
+ *d1++ = r;
+ }
+ d = Mem::Copy( d + dpitch, d, dpitch );
+ s += spitch;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x16MU16MA()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint32* s = iSource->DataAddress();
+ TUint32* d = iTarget->DataAddress();
+
+ for( TInt y = 0; y < sheight; y++ )
+ {
+ TUint32* s2 = s;
+ TUint32* d1 = d;
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint32 p = *s2++;
+ *d1++ = p;
+ *d1++ = p;
+ }
+ d = reinterpret_cast< TUint32* >(
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch ) );
+ s = reinterpret_cast< TUint32* >(
+ reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplWeightedAverage.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1183 @@
+/*
+* Copyright (c) 2004 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: Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplWeightedAverage.h"
+#include "cvtimage.h"
+#include "CVtImageScalerMacros.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 16; // 16.16 pseudo real format
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplWeightedAverage ===================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplWeightedAverage::Scale( TBool& aContinue )
+ {
+ TInt result( KErrNone );
+
+ aContinue = EFalse;
+
+ // this implementation does not support different display modes for source
+ // and target
+ if( iSource->DisplayMode() != iTarget->DisplayMode() )
+ {
+ return KErrNotSupported;
+ }
+
+ // if sizes are same, just copy the data
+ if( iSource->Size() == iTarget->Size() )
+ {
+ Mem::Copy(
+ iTarget->DataAddress(),
+ iSource->DataAddress(),
+ iTarget->BytesPerRow() * iTarget->Size().iHeight );
+ }
+ else if ( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight )
+ && ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+ {
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ Scale2x4K64K( 0xeee ); // 0000ggggbbbbrrrr ->
+ break; // mask = %0000111011101110 = 0xeee
+
+ case CVtImage::EVtColor64K:
+ Scale2x4K64K( 0xf7de ); // bbbbbggggggrrrrr ->
+ break; // mask = %1111011111011110 = 0xf7de
+
+ case CVtImage::EVtColor16M:
+ Scale2x16M();
+ break;
+
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ Scale2x16MU16MA();
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMediumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+ else
+ {
+ Initialize();
+
+ switch( iSource->DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ Scale4K();
+ break;
+
+ case CVtImage::EVtColor64K:
+ Scale64K();
+ break;
+
+ case CVtImage::EVtColor16M:
+ Scale16M();
+ break;
+
+ case CVtImage::EVtColor16MU:
+ Scale16MU();
+ break;
+
+ case CVtImage::EVtColor16MA:
+ Scale16MA();
+ break;
+
+ default:
+ if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+ iTarget->Type() == CVtImage::EVtImageBitmap )
+ {
+ TRAPD( error,
+ ScaleWithBitmapScalerL(
+ CBitmapScaler::EMediumQuality ) );
+ result = error;
+ }
+ else
+ {
+ result = KErrNotSupported;
+ }
+ }
+ }
+
+ return result;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::ValidateSourceTargetL(
+ const CVtImage& aSource,
+ CVtImage& aTarget )
+ {
+ // source and target must have same displaymode
+ if( aSource.DisplayMode() != aTarget.DisplayMode() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // only 4K, 64K, 16M and 16MU modes are supported
+ switch( aSource.DisplayMode() )
+ {
+ case CVtImage::EVtColor4K:
+ case CVtImage::EVtColor64K:
+ case CVtImage::EVtColor16M:
+ case CVtImage::EVtColor16MU:
+ case CVtImage::EVtColor16MA:
+ break;
+
+ default:
+ // Scaling for bitmaps is supported for other display modes
+ if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+ aTarget.Type() == CVtImage::EVtImageBitmap ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Initialize()
+ {
+ iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+ iTarget->Size().iWidth;
+ iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+ iTarget->Size().iHeight;
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale4K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale4K()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint16* s = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint16* snext = reinterpret_cast< TUint16* >(
+ iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+
+ TInt x;
+
+ TUint32 x0prev( TUint32( -1 ) );
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_4K_BLUE( p0 );
+ g00 = UNPACK_4K_GREEN( p0 );
+ r00 = UNPACK_4K_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_4K_BLUE( p0 );
+ g01 = UNPACK_4K_GREEN( p0 );
+ r01 = UNPACK_4K_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_4K_BLUE( p0 );
+ g10 = UNPACK_4K_GREEN( p0 );
+ r10 = UNPACK_4K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_4K_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // handle last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_4K_BLUE( p0 );
+ g01 = g00 = UNPACK_4K_GREEN( p0 );
+ r01 = r00 = UNPACK_4K_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b10 = UNPACK_4K_BLUE( p0 );
+ g10 = UNPACK_4K_GREEN( p0 );
+ r10 = UNPACK_4K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_4K_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // if width is not even -> then we need to skip one additional byte
+ if( width & 1 )
+ {
+ t++;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale64K()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint16* s = reinterpret_cast< TUint16* >
+ ( iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint16* snext = reinterpret_cast< TUint16* >
+ ( iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+
+ TInt x;
+
+ TUint32 x0prev( TUint32( -1 ) );
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_64K_BLUE( p0 );
+ g00 = UNPACK_64K_GREEN( p0 );
+ r00 = UNPACK_64K_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_64K_BLUE( p0 );
+ g01 = UNPACK_64K_GREEN( p0 );
+ r01 = UNPACK_64K_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_64K_BLUE( p0 );
+ g10 = UNPACK_64K_GREEN( p0 );
+ r10 = UNPACK_64K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_64K_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // handle last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_64K_BLUE( p0 );
+ g01 = g00 = UNPACK_64K_GREEN( p0 );
+ r01 = r00 = UNPACK_64K_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b10 = UNPACK_64K_BLUE( p0 );
+ g10 = UNPACK_64K_GREEN( p0 );
+ r10 = UNPACK_64K_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_64K_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // if width is not even -> then we need to skip one additional byte
+ if( width & 1 )
+ {
+ t++;
+ }
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16M()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32 t_pitch = iTarget->BytesPerRow();
+
+ TUint8* t = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint8* s = reinterpret_cast< TUint8* >(
+ iSource->LineAddress( sourceY >> KDecimalBits ) );
+ TUint8* snext = reinterpret_cast< TUint8* >(
+ iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+
+ TInt x;
+
+ TUint32 x0prev( TUint32( -1 ) );
+
+ TUint8* d = t;
+
+ // first columns
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+ if( x0 != x0prev )
+ {
+ TUint8* tempSrc = s + x0;
+
+ b00 = *tempSrc++;
+ g00 = *tempSrc++;
+ r00 = *tempSrc++;
+
+ b01 = *tempSrc++;
+ g01 = *tempSrc++;
+ r01 = *tempSrc++;
+
+ tempSrc = snext + x0;
+
+ b10 = *tempSrc++;
+ g10 = *tempSrc++;
+ r10 = *tempSrc++;
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *d++ = static_cast< TUint8 >( bres >> ( KDecimalBits + 1 ) );
+ *d++ = static_cast< TUint8 >( gres >> ( KDecimalBits + 1 ) );
+ *d++ = static_cast< TUint8 >( rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // handle last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+ if( x0 != x0prev )
+ {
+ TUint8* tempSrc = s + x0;
+
+ b01 = b00 = *tempSrc++;
+ g01 = g00 = *tempSrc++;
+ r01 = r00 = *tempSrc++;
+
+ tempSrc = snext + x0;
+
+ b10 = *tempSrc++;
+ g10 = *tempSrc++;
+ r10 = *tempSrc++;
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *d++ = static_cast< TUint8 >( bres >> ( KDecimalBits + 1 ) );
+ *d++ = static_cast< TUint8 >( gres >> ( KDecimalBits + 1 ) );
+ *d++ = static_cast< TUint8 >( rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ t += t_pitch;
+
+ sourceY += iV;
+ }
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16MU()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16MU()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MU() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32* t = iTarget->DataAddress();
+
+ TUint32 sourceY( 0 );
+
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+ TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+
+ TInt x;
+
+ TUint32 x0prev( TUint32( -1 ) );
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ b00 = UNPACK_16MU_BLUE( p0 );
+ g00 = UNPACK_16MU_GREEN( p0 );
+ r00 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ b01 = UNPACK_16MU_BLUE( p0 );
+ g01 = UNPACK_16MU_GREEN( p0 );
+ r01 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ b10 = UNPACK_16MU_BLUE( p0 );
+ g10 = UNPACK_16MU_GREEN( p0 );
+ r10 = UNPACK_16MU_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_16MU_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // handle last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ b01 = b00 = UNPACK_16MU_BLUE( p0 );
+ g01 = g00 = UNPACK_16MU_GREEN( p0 );
+ r01 = r00 = UNPACK_16MU_RED( p0 );
+
+ p0 = *( snext + x0 );
+ b10 = UNPACK_16MU_BLUE( p0 );
+ g10 = UNPACK_16MU_GREEN( p0 );
+ r10 = UNPACK_16MU_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_16MU_BGR(
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ sourceY += iV;
+ }
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MU() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16MA()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt width = iTarget->Size().iWidth;
+
+ TInt height = iTarget->Size().iHeight;
+
+ TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+ TUint32* t = iTarget->DataAddress();
+
+ TUint32 sourceY( 0 );
+
+ TUint32 a00( 0 );
+ TUint32 b00( 0 );
+ TUint32 g00( 0 );
+ TUint32 r00( 0 );
+ TUint32 a01( 0 );
+ TUint32 b01( 0 );
+ TUint32 g01( 0 );
+ TUint32 r01( 0 );
+ TUint32 a10( 0 );
+ TUint32 b10( 0 );
+ TUint32 g10( 0 );
+ TUint32 r10( 0 );
+
+ for( TInt y = 0; y < height; y++ )
+ {
+ TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+ TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+ TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+ TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+ TUint32 sourceX( 0 );
+
+ TInt x;
+
+ TUint32 x0prev( TUint32( -1 ) );
+
+ for( x = 0; x < mod_width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+
+ a00 = UNPACK_16MA_ALPHA( p0 );
+ b00 = UNPACK_16MA_BLUE( p0 );
+ g00 = UNPACK_16MA_GREEN( p0 );
+ r00 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( s + x0 + 1 );
+
+ a01 = UNPACK_16MA_ALPHA( p0 );
+ b01 = UNPACK_16MA_BLUE( p0 );
+ g01 = UNPACK_16MA_GREEN( p0 );
+ r01 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( snext + x0 );
+
+ a10 = UNPACK_16MA_ALPHA( p0 );
+ b10 = UNPACK_16MA_BLUE( p0 );
+ g10 = UNPACK_16MA_GREEN( p0 );
+ r10 = UNPACK_16MA_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 ares = ( du + dv ) * a00 + invdu * a01 + invdv * a10;
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_16MA_ABGR(
+ ares >> ( KDecimalBits + 1 ),
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ // handle last columns
+ for( ; x < width; x++ )
+ {
+ TUint32 x0 = sourceX >> KDecimalBits;
+
+ if( x0 != x0prev )
+ {
+ TUint32 p0 = *( s + x0 );
+ a01 = a00 = UNPACK_16MA_ALPHA( p0 );
+ b01 = b00 = UNPACK_16MA_BLUE( p0 );
+ g01 = g00 = UNPACK_16MA_GREEN( p0 );
+ r01 = r00 = UNPACK_16MA_RED( p0 );
+
+ p0 = *( snext + x0 );
+ a10 = UNPACK_16MA_ALPHA( p0 );
+ b10 = UNPACK_16MA_BLUE( p0 );
+ g10 = UNPACK_16MA_GREEN( p0 );
+ r10 = UNPACK_16MA_RED( p0 );
+
+ x0prev = x0;
+ }
+
+ TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+ TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+ TUint32 ares = ( du + dv ) * a00 + invdu * a01 + invdv * a10;
+ TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+ TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+ TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+ *t++ = PACK_16MA_ABGR(
+ ares >> ( KDecimalBits + 1 ),
+ bres >> ( KDecimalBits + 1 ),
+ gres >> ( KDecimalBits + 1 ),
+ rres >> ( KDecimalBits + 1 ) );
+
+ sourceX += iU;
+ }
+
+ sourceY += iV;
+ }
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MA() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x4K64K( TUint32 aMask )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x4K64K( TUint32 aMask )
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint32* s = iSource->DataAddress();
+ TUint32* d = iTarget->DataAddress();
+ TInt y;
+
+ // first average source rows
+ for( y = 0; y < sheight; y++ )
+ {
+ TUint32* s1 = s;
+ TUint32* d1 = d;
+
+ TUint32 p = *s1++; // 2 pixels
+ TUint32 p1 = p & 0xffff;
+ TUint32 p2 = ( p >> 16 ) & 0xffff;
+ TInt x;
+
+ for( x = 0; x < swidth/2 - 1; x++ )
+ {
+ TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ p1a = ( ( ( p1 ^ p1a ) & aMask ) >> 1 ) + ( p1 & p1a );
+ *d1++ = p1 | ( p1a << 16 );
+
+ p = *s1++; // 2 pixels
+
+ p1 = p & 0xffff;
+ TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ p2a = ( ( ( p2a ^ p2 ) & aMask ) >> 1 ) + ( p2a & p2 );
+ *d1++ = p2 | ( p2a << 16 );
+
+ p2 = ( p >> 16 ) & 0xffff;
+ }
+
+ TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ p1a = ( ( ( p1 ^ p1a ) & aMask ) >> 1 ) + ( p1 & p1a );
+ *d1++ = p1 | ( p1a << 16 );
+
+ if( swidth & 1 )
+ {
+ p = *s1; // 2 pixels
+ p1 = p & 0xffff;
+ TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+ p2a = ( ( ( p2a ^ p2 ) & aMask ) >> 1 ) + ( p2a & p2 );
+ *d1++ = p2 | ( p2a << 16 );
+
+ p = *--s1; // 2 pixels
+ p2 = ( p >> 16 ) & 0xffff;
+ *d1++ = p1 | ( p1 << 16 );
+ }
+ else
+ {
+ p = *--s1; // 2 pixels
+ p2 = ( p >> 16 ) & 0xffff;
+ *d1++ = p2 | ( p2 << 16 );
+ }
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ s = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ // then average rows between
+ d = iTarget->DataAddress();
+
+ for( y = 0; y < sheight - 1; y++ )
+ {
+ TUint32* d1 = reinterpret_cast< TUint32* >( d );
+ TUint32* d2 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+ TUint32* d3 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+ TUint32 p1 = *d1++;
+ for( TInt x = 0; x < swidth - 1; x++ )
+ {
+ TUint32 p11 = p1 & 0xffff;
+ TUint32 p3 = *d3++;
+ TUint32 p31 = p3 & 0xffff;
+
+ TUint32 r1 = ( ( ( p11 ^ p31 ) & aMask ) >> 1 ) + ( p11 & p31 );
+ r1 = ( ( ( p11 ^ r1 ) & aMask ) >> 1 ) + ( p11 & r1 );
+
+ p1 = *d1++; // read ahead
+ TUint32 p21 = p1 & 0xffff;
+ TUint32 r2 = ( ( ( p21 ^ p31 ) & aMask ) >> 1 ) + ( p21 & p31 );
+ r2 = ( ( ( p11 ^ r2 ) & aMask ) >> 1 ) + ( p11 & r2 );
+
+ *d2++ = r1 | ( r2 << 16 );
+ }
+
+ TUint32 p11 = p1 & 0xffff;
+ TUint32 p3 = *d3++;
+ TUint32 p31 = p3 & 0xffff;
+ TUint32 r1 = ( ( ( p11 ^ p31 ) & aMask ) >> 1 ) + ( p11 & p31 );
+ r1 = ( ( ( p11 ^ r1 ) & aMask ) >> 1 ) + ( p11 & r1 );
+ *d2++ = r1 | ( r1 << 16 );
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x16M()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+ TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ TInt y;
+
+ for( y = 0; y < sheight; y++ )
+ {
+ TUint8* s2 = s;
+ TUint8* d1 = d;
+
+ TUint32 g1 = 0;
+ TUint32 b1 = 0;
+ TUint32 r1 = 0;
+
+ TUint32 g2 = 0;
+ TUint32 b2 = 0;
+ TUint32 r2 = 0;
+
+ for( TInt x = 0; x < swidth - 1; x++ )
+ {
+ g1 = *s2++;
+ b1 = *s2++;
+ r1 = *s2++;
+
+ *d1++ = static_cast< TUint8 >( g1 );
+ *d1++ = static_cast< TUint8 >( b1 );
+ *d1++ = static_cast< TUint8 >( r1 );
+
+ g2 = s2[ 0 ];
+ b2 = s2[ 1 ];
+ r2 = s2[ 2 ];
+
+ *d1++ = static_cast< TUint8 >( ( g1 + ( ( g1 + g2 ) >> 1 ) ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( b1 + ( ( b1 + b2 ) >> 1 ) ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( r1 + ( ( r1 + r2 ) >> 1 ) ) >> 1 );
+ }
+
+ *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+ *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+ *d1++ = static_cast< TUint8 >( g2 );
+ *d1++ = static_cast< TUint8 >( b2 );
+ *d1++ = static_cast< TUint8 >( r2 );
+
+ d += dpitch * 2;
+ s += spitch;
+ }
+
+ // then average rows between
+ d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+ for( y = 0; y < sheight - 1; y++ )
+ {
+ TUint8* d1 = d;
+ TUint8* d2 = d1 + dpitch;
+ TUint8* d3 = d2 + dpitch;
+
+ for( TInt x = 0; x < swidth; x++ )
+ {
+ TUint32 g1 = *d1++;
+ TUint32 g2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+ TUint32 b1 = *d1++;
+ TUint32 b2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+ TUint32 r1 = *d1++;
+ TUint32 r2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+ g1 = *d1++;
+ g2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+ b1 = *d1++;
+ b2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+ r1 = *d1++;
+ r2 = *d3++;
+ *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+ }
+
+ d += dpitch * 2;
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x16MU16MA()
+ {
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+ TInt sheight = iSource->Size().iHeight;
+ TInt swidth = iSource->Size().iWidth;
+ TInt spitch = iSource->BytesPerRow();
+ TInt dpitch = iTarget->BytesPerRow();
+
+ TUint32 mask = 0xfefefefe;
+ TUint32* s = iSource->DataAddress();
+ TUint32* d = iTarget->DataAddress();
+ TInt y;
+
+ // first average source rows
+ for( y = 0; y < sheight; y++ )
+ {
+ TInt x;
+ TUint32* s1 = s;
+ TUint32* d1 = d;
+ TUint32 p2 = *s1++;
+ TUint32 p1 = 0;
+ for( x = 0; x < swidth - 1; x++ )
+ {
+ p1 = p2;
+ *d1++ = p1;
+ p2 = *s1++;
+ TUint32 p1a = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+ p1a = ( ( ( p1 ^ p1a ) & mask ) >> 1 ) + ( p1 & p1a );
+ *d1++ = p1a;
+ }
+
+ if( swidth & 1 )
+ {
+ TUint32 p2a = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+ p2a = ( ( ( p2a ^ p2 ) & mask ) >> 1 ) + ( p2a & p2 );
+ *d1++ = p2a;
+ *d1++ = p2;
+ }
+ else
+ {
+ p2 = *--s1;
+ *d1++ = p2;
+ *d1++ = p2;
+ }
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ s = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( s ) + spitch );
+ }
+
+ // then average rows between
+ d = iTarget->DataAddress();
+
+ for( y = 0; y < sheight - 1; y++ )
+ {
+ TUint32* d1 = reinterpret_cast< TUint32* >( d );
+ TUint32* d2 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+ TUint32* d3 = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+ TUint32 p1 = *d1++;
+
+ for( TInt x = 0; x < swidth - 1; x++ )
+ {
+ TUint32 p3 = *d3++;
+ d3++;
+
+ TUint32 r1 = ( ( ( p1 ^ p3 ) & mask ) >> 1 ) + ( p1 & p3 );
+ r1 = ( ( ( p1 ^ r1 ) & mask ) >> 1 ) + ( p1 & r1 );
+
+ *d2++ = r1;
+
+ d1++;
+ TUint32 p2 = *d1++;
+
+ TUint32 r2 = ( ( ( p2 ^ p3 ) & mask ) >> 1 ) + ( p2 & p3 );
+ r2 = ( ( ( p1 ^ r2 ) & mask ) >> 1 ) + ( p1 & r2 );
+
+ *d2++ = r2;
+
+ p1 = p2;
+ }
+
+ TUint32 p3 = *d3++;
+ TUint32 r1 = ( ( ( p1 ^ p3 ) & mask ) >> 1 ) + ( p1 & p3 );
+ r1 = ( ( ( p1 ^ r1 ) & mask ) >> 1 ) + ( p1 & r1 );
+ *d2++ = r1;
+ *d2++ = r1;
+
+ d = reinterpret_cast< TUint32* >
+ ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+ }
+
+ // last row is just copy of previous row, because we cannot calculate
+ // average
+ Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+ __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/vtyuvconverter.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005-2006 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: YUV format transcoder.
+*
+*/
+
+
+#include "vtyuvconverter.h"
+
+#ifdef _DEBUG
+ #include <e32debug.h>
+ #define PRINT RDebug::Print
+ #define _IFDBG(a) a
+#else
+ #define PRINT
+ #define _IFDBG(a)
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ConvertFrom420PlanarTo422Interleaved
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ConvertFrom420PlanarTo422Interleaved(
+ const TDesC8& aSource,
+ const TSize& aSize,
+ TDes8& aTarget,
+ TInt aStride )
+ {
+ _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved<" ) ));
+
+ if ( aTarget.MaxLength() < ByteSize422Interleaved( aSize ) )
+ {
+ _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved> TargetMaxLength < ByteSize422" ) ));
+ return KErrUnderflow;
+ }
+
+ if ( aSource.Size() != ByteSize420Planar( aSize ) )
+ {
+ _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved> 420SourceSize != ByteSize420" ) ));
+ return KErrArgument;
+ }
+
+ TInt planeSize( aSize.iWidth * aSize.iHeight );
+ const TUint8* sy = aSource.Ptr();
+ const TUint8* su = sy + planeSize;
+ const TUint8* sv = su + ( planeSize >> 2 );
+ TUint8* t = const_cast< TUint8* >( aTarget.Ptr() );
+
+ TUint8* tsave = t;
+ for ( TInt y = ( aSize.iHeight >> 1 ) - 1; y >= 0; y-- )
+ {
+ const TUint8* susave = su;
+ const TUint8* svsave = sv;
+ for ( TInt x = ( aSize.iWidth >> 1 ) - 1; x >= 0; x-- )
+ {
+ *t++ = *su++;
+ *t++ = *sy++;
+ *t++ = *sv++;
+ *t++ = *sy++;
+ }
+ tsave = t = tsave + aStride;
+ su = susave;
+ sv = svsave;
+ for ( TInt x = ( aSize.iWidth >> 1 ) - 1; x >= 0; x-- )
+ {
+ *t++ = *su++;
+ *t++ = *sy++;
+ *t++ = *sv++;
+ *t++ = *sy++;
+ }
+ tsave = t = tsave + aStride;
+ }
+
+ _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved>" ) ));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ByteSize420Planar
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ByteSize420Planar( const TSize& aSizeInPixels )
+ {
+ TInt planeSize( aSizeInPixels.iWidth * aSizeInPixels.iHeight );
+ return planeSize + planeSize / 2;
+ }
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ByteSize422Interleaved
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ByteSize422Interleaved( const TSize& aSizeInPixels )
+ {
+ TInt planeSize( aSizeInPixels.iWidth * aSizeInPixels.iHeight );
+ return planeSize * 2;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/EABI/VideoSourceU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,38 @@
+EXPORTS
+ _ZN13CVSController4NewLEP21MVSControllerObserver @ 1 NONAME
+ _ZN14CVsFrameBuffer4NewLEi @ 2 NONAME
+ _ZN14CVsFrameBufferD0Ev @ 3 NONAME
+ _ZN14CVsFrameBufferD1Ev @ 4 NONAME
+ _ZN14CVsFrameBufferD2Ev @ 5 NONAME
+ _ZN16CVSMMFDataBuffer4NewLEi @ 6 NONAME
+ _ZN16CVSMMFDataBuffer4NewLEv @ 7 NONAME
+ _ZN16CVSMMFDataBufferD0Ev @ 8 NONAME
+ _ZN16CVSMMFDataBufferD1Ev @ 9 NONAME
+ _ZN16CVSMMFDataBufferD2Ev @ 10 NONAME
+ _ZTI14CVsFrameBuffer @ 11 NONAME ; #<TI>#
+ _ZTI15CVSDataProvider @ 12 NONAME ; #<TI>#
+ _ZTI16CVSControllerImp @ 13 NONAME ; #<TI>#
+ _ZTI16CVSDataSourceImp @ 14 NONAME ; #<TI>#
+ _ZTI16CVSMMFDataBuffer @ 15 NONAME ; #<TI>#
+ _ZTI17CVSFrameRateTimer @ 16 NONAME ; #<TI>#
+ _ZTI18CSyncCameraReserve @ 17 NONAME ; #<TI>#
+ _ZTI19CVSProviderSwitchAO @ 18 NONAME ; #<TI>#
+ _ZTI21CVSCameraDataProvider @ 19 NONAME ; #<TI>#
+ _ZTI23CVSDataSourceObserverAO @ 20 NONAME ; #<TI>#
+ _ZTI24CProviderErrorNotifierAO @ 21 NONAME ; #<TI>#
+ _ZTI25CVSStillImageDataProvider @ 22 NONAME ; #<TI>#
+ _ZTI28CVSOnboardCameraDataProvider @ 23 NONAME ; #<TI>#
+ _ZTV14CVsFrameBuffer @ 24 NONAME ; #<VT>#
+ _ZTV15CVSDataProvider @ 25 NONAME ; #<VT>#
+ _ZTV16CVSControllerImp @ 26 NONAME ; #<VT>#
+ _ZTV16CVSDataSourceImp @ 27 NONAME ; #<VT>#
+ _ZTV16CVSMMFDataBuffer @ 28 NONAME ; #<VT>#
+ _ZTV17CVSFrameRateTimer @ 29 NONAME ; #<VT>#
+ _ZTV18CSyncCameraReserve @ 30 NONAME ; #<VT>#
+ _ZTV19CVSProviderSwitchAO @ 31 NONAME ; #<VT>#
+ _ZTV21CVSCameraDataProvider @ 32 NONAME ; #<VT>#
+ _ZTV23CVSDataSourceObserverAO @ 33 NONAME ; #<VT>#
+ _ZTV24CProviderErrorNotifierAO @ 34 NONAME ; #<VT>#
+ _ZTV25CVSStillImageDataProvider @ 35 NONAME ; #<VT>#
+ _ZTV28CVSOnboardCameraDataProvider @ 36 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/bmarm/VIDEOSOURCEU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,4 @@
+EXPORTS
+ NewL__13CVSControllerP21MVSControllerObserver @ 1 NONAME R3UNUSED ; CVSController::NewL(MVSControllerObserver *)
+ SwitchDataProviderL__16CVSDataSourceImpP15CVSDataProvider @ 2 NONAME R3UNUSED ; CVSDataSourceImp::SwitchDataProviderL(CVSDataProvider *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/bwins/VIDEOSOURCEU.DEF Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+ ??1CVSMMFDataBuffer@@UAE@XZ @ 1 NONAME ; CVSMMFDataBuffer::~CVSMMFDataBuffer(void)
+ ??1CVsFrameBuffer@@UAE@XZ @ 2 NONAME ; CVsFrameBuffer::~CVsFrameBuffer(void)
+ ?NewL@CVSController@@SAPAV1@PAVMVSControllerObserver@@@Z @ 3 NONAME ; class CVSController * CVSController::NewL(class MVSControllerObserver *)
+ ?NewL@CVSMMFDataBuffer@@SAPAV1@H@Z @ 4 NONAME ; class CVSMMFDataBuffer * CVSMMFDataBuffer::NewL(int)
+ ?NewL@CVSMMFDataBuffer@@SAPAV1@XZ @ 5 NONAME ; class CVSMMFDataBuffer * CVSMMFDataBuffer::NewL(void)
+ ?NewL@CVsFrameBuffer@@SAPAV1@H@Z @ 6 NONAME ; class CVsFrameBuffer * CVsFrameBuffer::NewL(int)
+
Binary file vtprotocolplugins/VideoSource/data/videosource_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/data/videosource_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,29 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videosource"}, (0x101F8692), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videosource.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/group/CApiVideoSource.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2004 - 2006 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: Project definition file for Video Source subsystem
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/VideoSourceUids.hrh"
+
+TARGET videosource.dll
+TARGETTYPE dll
+VENDORID VID_DEFAULT
+
+UID KSharedLibraryUidDefine KUidVideoSourceLibrary
+
+SOURCEPATH ../src
+SOURCE CVSController.cpp
+SOURCE CVSControllerImp.cpp
+SOURCE CVSDataProvider.cpp
+SOURCE CVSStillImageDataProvider.cpp
+SOURCE CVSCameraDataProvider.cpp
+SOURCE CVSOnboardCameraDataProvider.cpp
+SOURCE CVSDataSourceImp.cpp
+SOURCE CVSMMFDataBuffer.cpp
+
+SOURCE cmultiframeloopao.cpp
+SOURCE cmultiframeprovider.cpp
+SOURCE cmultiframedataao.cpp
+USERINCLUDE ../inc
+SYSTEMINCLUDE ../../../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/mmf/server
+SYSTEMINCLUDE /epoc32/include/mmf/common
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY mmfcontrollerframework.lib
+LIBRARY ecam.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY bitgdi.lib
+LIBRARY imageconversion.lib
+LIBRARY vtimageconverter.lib
+LIBRARY vtimagetransforms.lib
+LIBRARY featmgr.lib
+LIBRARY phoneclient.lib
+LIBRARY ws32.lib
+LIBRARY ecamadvsettings.lib
+
+CAPABILITY CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2004 - 2007 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 definition file for Video Source subsystem
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CApiVideoSource.h |../../../inc/capivideosource.h
+../inc/capivideosource.inl |../../../inc/capivideosource.inl
+
+// Export SIS stub file
+../data/videosource_stub.SIS /epoc32/data/z/system/install/videosource_stub.sis
+
+// Export IBY file
+../rom/VideoSource.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videosource.iby)
+
+PRJ_MMPFILES
+CApiVideoSource.mmp
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CApiVideoSource.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,922 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CAPIVIDEOSOURCE_H
+#define CAPIVIDEOSOURCE_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <ecam.h>
+#include <mmfutilities.h>
+#include <mmfdatasource.h>
+#include <mvtprotocolhandler.h>
+#include <ecamimageprocessing.h>
+
+// FORWARD DECLARATIONS
+
+class MVSControllerObserver;
+class MVSDataSourceObserver;
+class MVSDataProviderObserver;
+class CVSDataSource;
+class CVSDataProvider;
+class TVSDataProviderInfo;
+class CVSDataSourceImp;
+class CProviderErrorNotifierAO;
+
+class MFrameBuffer;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+class MDataSink;
+class MDataSource;
+class MAsyncEventHandler;
+class TMMFPrioritySettings;
+class TMMFMessage;
+class CDesC8Array;
+class CVSMMFDataBuffer;
+
+// Camera lost during VT error
+const TInt KVsErrCameraNoLongerReserved = 666;
+// CLASS DECLARATION
+
+/**
+* Initialization settings class for still image provider.
+*
+* @lib videosource.lib
+*/
+class TVSStillImageDataProviderParams
+ {
+ public:
+ /**
+ * Enumeration that defines different initialization
+ * types.
+ */
+ enum TInitialize
+ {
+ /** Created as blank image */
+ EInitializeAsBlankImage,
+ /** Image will be load from General Settings */
+ EInitializeFromGeneralSettings,
+ /** Image will be from file */
+ EInitializeFromFile,
+ /** Imge will be load from phone server */
+ EInitializeAsDefaultStillImage
+ };
+
+ public:
+ /**
+ * Constructor, set iInitialize to EInitializeAsBlankImage. iFileName
+ * is initialized as an empty descriptor.
+ */
+ inline TVSStillImageDataProviderParams();
+
+ /**
+ * Constructor. iFileName is initialized as an empty descriptor.
+ * @param aInitialize Defines how provider must be initialized.
+ */
+ inline TVSStillImageDataProviderParams( const TInitialize aInitialize );
+
+ /**
+ * Constructor. iInitialize is set to EInitializeFromFile.
+ * @param aFileName Name of the file from which this instance will
+ * be initialized.
+ */
+ inline TVSStillImageDataProviderParams( const TFileName& aFileName );
+
+ public:
+ // Initialization type
+ TInitialize iInitialize;
+
+ // Filename for EInitializeFromFile
+ TFileName iFileName;
+ };
+
+typedef TPckgBuf< TVSStillImageDataProviderParams > TVSStillImageDataProviderParamsBuf;
+
+/**
+* An interface to access free MMF buffers.
+*
+* @lib videosource.lib
+*/
+class MVSBufferPool
+ {
+ public:
+
+ /**
+ * Pure virtual function to get next free buffer from free buffer pool.
+ * @param "aRemove" Boolean flag. If ETrue buffer will be removed from
+ * the pool.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Returns pointer to next available buffer in free buffers
+ * queue or NULL if no buffers in queue are available.
+ */
+ virtual CVSMMFDataBuffer* GetBufferL( TBool aRemove ) = 0;
+
+ /**
+ * Frees buffer that was previously got using GetBufferL().
+ * @param "aBuffer" Buffer to be freed.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void FreeBufferL( CVSMMFDataBuffer* aBuffer ) = 0;
+ };
+
+/**
+* An interface to a controller callback functions.
+*
+* @lib videosource.lib
+*/
+class MVSControllerObserver
+ {
+ public:
+
+ /**
+ * Called when provider count has been changed.
+ * @param "aAttached" ETrue if provider attached, else EFalse.
+ */
+ virtual void vsProvidersChanged( TBool aAttached ) = 0;
+ };
+
+/**
+* Controller interface.
+*
+* @lib videosource.lib
+*/
+class CVSController : public CBase
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aObserver" Pointer to controller observer.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ IMPORT_C static CVSController* NewL( MVSControllerObserver* aObserver );
+
+ /**
+ * Pure virtual function to create data source instance.
+ * @param "aObserver" Pointer to data source observer.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new data source instance.
+ */
+ virtual CVSDataSource* CreateDataSourceL(
+ MVSDataSourceObserver* aObserver ) = 0;
+
+ public: // New functions
+
+ /**
+ * Pure virtual function to return provider count and provider index.
+ * @return Number of providers available. Count also acts as zero based
+ * provider index.
+ */
+ virtual TInt ProvidersAvailable() = 0;
+
+ /**
+ * Pure virtual function to return provider information.
+ * @param "aProviderIndex" Index of the provider to return information
+ * for.
+ * @param "aInfo" Reference to the variable where the provider
+ * information is copied.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ProviderInfoL(
+ TInt aProviderIndex,
+ TVSDataProviderInfo& aInfo ) = 0;
+
+ /**
+ * Pure virtual function to create provider instance.
+ * @param "aProviderIndex" Index of the provider to be created.
+ * @param "aObserver" Pointer to provider observer.
+ * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+ * data provider.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new provider instance.
+ */
+ virtual CVSDataProvider* CreateDataProviderL(
+ TInt aProviderIndex,
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool ) = 0;
+
+ public: // Constructor and destructor
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CVSController();
+
+ /**
+ * Inliner to return reference to the controller observer.
+ * @return Reference to the controller observer.
+ */
+ inline MVSControllerObserver& Observer() const;
+
+ protected: // Constructor and destructor
+
+ /**
+ * 2nd phase constructor.
+ * @param "aObserver" Pointer to controller observer
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ConstructL( MVSControllerObserver* aObserver ) = 0;
+
+ protected: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ // Pointer to controller observer
+ MVSControllerObserver* iObserver;
+
+ private: // Data
+
+ };
+
+/**
+* An interface to a provider callback functions.
+*
+* @lib videosource.lib
+*/
+class MVSDataProviderObserver
+ {
+ public:
+
+ /**
+ * Called when an error occurred in provider.
+ * @param "aError" of the system wide error codes.
+ */
+ virtual void vsProviderError( TInt aError ) = 0;
+
+ /**
+ * Called when provider is initalized.
+ */
+ virtual void vsProviderReady() = 0;
+
+ /**
+ * Called when provider has view finder bitmap ready.
+ * @param "aFrame" Reference to the view finder bitmap.
+ */
+ virtual void vsViewFinderFrameReady( CFbsBitmap& aFrame ) = 0;
+ };
+
+/**
+* Extension to standard ECam TCameraInfo class.
+*
+* @lib videosource.lib
+*/
+class TVSDataProviderInfo : public TCameraInfo
+ {
+ public: // Data
+
+ // ETrue if the Freeze() is supported.
+ TBool iFreezeSupported;
+
+ // Pointer to extension information.
+ TAny* iExtension;
+
+ // A bitfield of suported colortones
+ TUint32 iSupportedColorTones;
+ };
+
+/**
+* Provider interface.
+*
+* @lib videosource.lib
+*/
+class CVSDataProvider : public CBase
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aProviderIndex" Index of the provider to be created.
+ * @param "aObserver" Pointer to data provider observer.
+ * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+ * data provider.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CVSDataProvider* NewL(
+ TInt aProviderIndex,
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ /**
+ * Destructor.
+ */
+ ~CVSDataProvider();
+
+ public: // New functions
+
+ /**
+ * Static function get provider count and provider index.
+ * @return Number of providers available. Count also acts as zero based
+ * provider index.
+ */
+ static TInt ProvidersAvailable();
+
+ /**
+ * Static function to return provider information.
+ * @param "aProviderIndex" Index of the provider to return information
+ * for.
+ * @param "aInfo" Reference to the variable to where the provider
+ * information is copied.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ static void ProviderInfoL(
+ TInt aProviderIndex,
+ TVSDataProviderInfo& aInfo );
+
+ /**
+ * Pure virtual function to initialize provider.
+ * @param "aInitParams" Reference to the initialization parameters.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void InitializeL( const TDesC8& aInitParams ) = 0;
+
+ /**
+ * Pure virtual function to cancel initialization of provider.
+ */
+ virtual void CancelInitializing() = 0;
+
+ /**
+ * Pure virtual function to return digital zoom factor.
+ * @return Digital zoom factor.
+ */
+ virtual TInt DigitalZoomFactor() const = 0;
+
+ /**
+ * Pure virtual function to set digital zoom factor.
+ * @param "aDigitalZoomFactor" Digital zoom factor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 ) = 0;
+
+ /**
+ * Pure virtual function to start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL( TSize& aSize ) = 0;
+
+ /**
+ * Pure virtual function to start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @param "aClipRect" Required clip rectangle.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL(
+ TSize& aSize,
+ TRect& aClipRect ) = 0;
+
+ /**
+ * Pure virtual function to start view finder bitmaps using direct
+ * screen access.
+ * @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.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect ) = 0;
+
+ /**
+ * Pure virtual function to start view finder bitmaps using direct
+ * screen access.
+ * @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.
+ * @param "aClipRect" The rectangle to which the screen will be clipped.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect,
+ TRect& aClipRect ) = 0;
+
+ /**
+ * Pure virtual function to test if view finder is active.
+ * @return ETrue if view finder active.
+ */
+ virtual TBool ViewFinderActive() const = 0;
+
+ /**
+ * Pure virtual function to stop view finder bitmaps.
+ */
+ virtual void StopViewFinder() = 0;
+
+ /**
+ * Pure virtual function to return provider information.
+ * @param "aInfo" Reference to the variable to where the provider
+ * information is copied.
+ */
+ virtual void ProviderInfo( TVSDataProviderInfo& aInfo ) = 0;
+
+ /**
+ * 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.
+ * @exception May leave with KErrNotSupported.
+ */
+ virtual void SetViewFinderMirrorL( TBool aMirror ) = 0;
+
+ /**
+ * Gets whether view finder mirroring is active.
+ * @return ETrue if mirroring is set, EFalse if mirroring is not set.
+ */
+ virtual TBool ViewFinderMirror() const = 0;
+
+ /**
+ * Freezes video (i.e. starts sending the last frame until provider is
+ * unfrozen).
+ * @exception May leave with KErrNotSupported if freezing is not supported
+ * by the provider.
+ */
+ virtual void FreezeL() = 0;
+
+ /**
+ * Unfreezes video (i.e. starts sending actual frames).
+ * @exception May leave with KErrNotSupported if freezing
+ * is not supported
+ * by the provider.
+ */
+ virtual void UnfreezeL()= 0;
+
+ /**
+ * Gets whether freeze is active.
+ * @return ETrue if video is frozen, EFalse otherwise.
+ */
+ virtual TBool IsFrozen() const = 0;
+
+ /**
+ * 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.
+ * @since S60 v3.2
+ * @param aContrast
+ */
+ virtual void SetContrastL( TInt aContrast ) = 0;
+
+ /**
+ * Gets the currently set contrast value.
+ * @since S60 v3.2
+ * @param aContrast The currently set contrast value.
+ * @return indication if method succeed or not.
+ */
+ virtual TInt GetContrast( TInt& aContrast ) const = 0;
+
+ /**
+ * Sets the brightness adjustment of the device.
+ * This must be in the range of -100 to +100 or EBrightnessAuto.
+ * May leave with KErrNotSupported if the brightness adjustment
+ * is out of range.
+ * @since S60 v3.2
+ * @param aBrightness The required brightness adjustment.
+ */
+ virtual void SetBrightnessL( TInt aBrightness ) = 0;
+
+ /**
+ * Gets the currently set brightness adjustment value.
+ * @since S60 v3.2
+ * @param aBrightness The currently set brightness adjustment value.
+ * @return indication if method succeed or not.
+ */
+ virtual TInt GetBrightness( TInt& aBrightness ) const = 0;
+
+ /**
+ * Sets the white balance adjustment of the device.
+ * No effect if this is not supported, see
+ * TCameraInfo::iWhiteBalanceModesSupported.
+ * @since S60 v3.2
+ * @param aWhiteBalance The required white balance adjustment.
+ * @leave KErrNotSupported if the specified white balance adjustment
+ * is invalid.
+ */
+ virtual void SetWhiteBalanceL(
+ CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto) = 0;
+
+ /**
+ * Gets the currently set white balance adjustment value.
+ * @since S60 v3.2
+ * @param aWhiteBalance The currently set white balance adjustment value.
+ * @return indication if method succeed or not.
+ */
+ virtual TInt GetWhiteBalance(
+ CCamera::TWhiteBalance& aWhiteBalance ) const = 0;
+
+ /**
+ * Gives the current color tone setting value
+ * @since S60 v3.2
+ * @param aColorTone The currently set color tone adjustment value.
+ * @return indication if method succeed or not.
+ */
+ virtual TInt GetColorTone(
+ CCamera::CCameraImageProcessing::TEffect& aColorTone ) const = 0;
+
+ /**
+ * Sets color tone
+ * @since S60 v3.2
+ * @param aValue new color tone
+ */
+ virtual void SetColorToneL(
+ CCamera::CCameraImageProcessing::TEffect aValue ) = 0;
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId ) = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceThreadLogoff() = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePrimeL() = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePlayL() = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePauseL() = 0;
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceStopL() = 0;
+
+ private: // New functions
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFormatL( const TDesC8& aFormat ) = 0;
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFrameRateL( TReal32 aFrameRate ) = 0;
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetVideoFrameSizeL( const TSize& aSize ) = 0;
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void GetVideoFrameSizeL( TSize& aSize ) const = 0;
+
+ private: // Functions from base classes
+
+ protected: // New functions
+
+ /**
+ * This version of prime method will be called when a provider
+ * is being switched.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void PrimeL() = 0;
+
+ /**
+ * Inliner to test if FillBufferL call is active.
+ * @return ETrue if FillBufferL call is ongoing, else EFalse.
+ */
+ inline TBool FillBufferActive() const;
+
+ /**
+ * Inliner to return the sink that will empty the buffer.
+ * @return Pointer to sink.
+ */
+ inline MVTVideoSink* Consumer() const;
+
+ /**
+ * Inliner to return sink media ID that is used.
+ * @return Media ID identifiyng the stream that is used.
+ */
+ inline TMediaId MediaId() const;
+
+ /**
+ * Inliner to return reference to the provider observer.
+ * @return Reference to the provider observer.
+ */
+ inline MVSDataProviderObserver& Observer() const;
+
+ /**
+ * Saves input parameters given in FillBufferL call.
+ * @param "aConsumer" Pointer to sink that will empty the filled buffer.
+ * @param "aMediaId" Media ID for source/provider stream that is used.
+ */
+ virtual void SetFillBufferParams(
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId );
+
+ /**
+ * Notify observer about provider error.
+ * @param "aError" Error code
+ */
+ void NotifyError( TInt aError );
+
+ /**
+ * Inliner to return reference to the buffer pool.
+ * @return Reference to the buffer pool.
+ */
+ inline MVSBufferPool& BufferPool() const;
+
+ protected: // Constructor and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ CVSDataProvider();
+
+ /**
+ * Constructor.
+ * @param "aObserver" Pointer to provider observer.
+ */
+ CVSDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ /**
+ * 2nd phase constructor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL();
+
+ /**
+ * Returns microseconds from the first SourcePlayL() call.
+ */
+ const TTimeIntervalMicroSeconds& TimeToPlay();
+
+ /**
+ * Resets start time (the time when SourcePlayL() was called).
+ * iStartTime is set to TTime::HomeTime().
+ */
+ void ResetStartTime();
+
+ private: // New functions
+
+ /**
+ *
+ */
+ static TInt CamerasAvailable();
+
+ /**
+ * Sets timestamp for first SourcePlayL() call. This method
+ * is called by the CVSDataSource when data provider is switched.
+ */
+ void SwitchFrom( const CVSDataProvider& anOldProvider );
+
+ /**
+ * Enumerate all providers and create a set of formats that is supported
+ * by all of them.
+ */
+ static void EnumerateVideoFrameFormatsL(
+ CDesC8Array* aSupportedFormats );
+
+ /**
+ * Enumerate all providers and create a set of video frame sizes that
+ * is supported by all of them.
+ */
+ static void EnumerateVideoFrameSizesL(
+ RArray<TSize>& aSupportedSizes,
+ const TDesC8& aFormat );
+
+ /**
+ * Enumerate all providers and create a set of video frame rates that
+ * is supported by all of them.
+ */
+ static void EnumerateVideoFrameRatesL(
+ RArray<TReal32>& aSupportedRates,
+ const TDesC8& aFormat,
+ const TSize& aSize );
+
+ protected: // New functions
+
+ /**
+ * Get video frame size. Implemented in each provider.
+ */
+ virtual void GetVideoFrameSize(
+ TSize& aSize,
+ TInt aSizeIndex,
+ const TDesC8& aFormat ) = 0;
+
+ /**
+ * Get video frame rate. Implemented in each provider.
+ */
+ virtual void GetVideoFrameRate(
+ TReal32& aRate,
+ TInt aRateIndex,
+ const TDesC8& aFormat,
+ const TSize& aSize ) = 0;
+
+ public: // Data
+
+ protected: // Data
+
+ // Boolean that is ETrue when FillBufferL call is active.
+ TBool iFillBufferActive;
+
+ // Sink that empties the buffer filled with video frame. Not owned.
+ MVTVideoSink* iConsumer;
+
+ // Provider's media ID identifying media stream used.
+ TMediaId iMediaId;
+
+ private: // Data
+
+ // Pointer to provider observer.
+ MVSDataProviderObserver* iObserver;
+
+ // Pointer to AO that reports provider errors to provider observer,
+ // used through NotifyError call.
+ CProviderErrorNotifierAO* iErrorNotifier;
+
+ // Pointer to buffer pool
+ MVSBufferPool* iPool;
+
+ // Previous TimeToPlay interval
+ TTimeIntervalMicroSeconds iPreviousTimeToPlay;
+
+ // Start time (time when SourcePlayL() was called)
+ TTime iStartTime;
+
+ private: // Data
+
+ // Source is friend because it's MDataSource and MVTVideoInput derived
+ // calls are forwarded to provider.
+ friend class CVSDataSource;
+
+ // Source is friend because it's MDataSource and MVTVideoInput derived
+ // calls are forwarded to provider.
+ friend class CVSDataSourceImp;
+ };
+
+/**
+* An interface to a data source callback functions.
+*
+* @lib videosource.lib
+*/
+class MVSDataSourceObserver
+ {
+ public:
+
+ /**
+ * Called when provider switch completed.
+ * @param "aOldProvider" Pointer provider that was previously active.
+ */
+ virtual void vsProviderSwitchDone( CVSDataProvider* aOldProvider ) = 0;
+ };
+
+/**
+* Data source interface.
+*
+* @lib videosource.lib
+*/
+class CVSDataSource :
+ public CBase,
+ public MVTVideoSource,
+ public MVSBufferPool
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Static factory function to create data source instance.
+ * @param "aObserver" Pointer to data source observer.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to data source instance.
+ */
+ static CVSDataSource* NewSourceL( MVSDataSourceObserver* aObserver );
+
+ public: // New functions
+
+ /**
+ * Pure virtual function to switch active provider for source.
+ * @param "aNewProvider" Pointer to provider instance.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SwitchDataProviderL( CVSDataProvider* aNewProvider ) = 0;
+
+ /**
+ * Temporarily pause video sending. Used during initialization.
+ */
+ virtual void PauseSending() = 0;
+
+ /**
+ * Resume video sending. Used during initialization.
+ */
+ virtual void ResumeSending() = 0;
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ /**
+ * Inliner to return reference to the data source observer.
+ * @return Reference to the data source observer.
+ */
+ inline MVSDataSourceObserver& Observer() const;
+
+ /**
+ * Inliner to return reference to the provider that is active.
+ * @return Reference to the provider.
+ */
+ inline CVSDataProvider& DataProvider() const;
+
+ /**
+ * Inliner to update member variable holding pointer to provider with
+ * new provider pointer.
+ * @param "aNewProvider" Pointer to (new) provider.
+ * @return Pointer to (old) provider.
+ */
+ inline CVSDataProvider* SwitchProvider( CVSDataProvider* aNewProvider );
+
+ protected: // Constructor and destructor
+
+ /**
+ * Constructor.
+ */
+ CVSDataSource();
+
+ private: // Constructor and destructor
+
+ /**
+ * 2nd phase consturctor.
+ * @param "aObserver" Pointer to data source observer.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL( MVSDataSourceObserver* aObserver );
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Pointer to data source observer.
+ MVSDataSourceObserver* iObserver;
+
+ // Pointer to active provider.
+ CVSDataProvider* iProvider;
+ };
+
+#include "capivideosource.inl"
+
+#endif // CAPIVIDEOSOURCE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,517 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSCAMERADATAPROVIDER_H
+#define CVSCAMERADATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+#include <cvtimagescaler.h>
+#include <cvtimagebitmap.h>
+// CLASS FORWARDS
+
+class CVsFrameBuffer;
+
+// CLASS DECLARATION
+
+/**
+* Internal MFrameBuffer API.
+*
+* @lib videosource.lib
+* @since 5.0
+*/
+class MVsFrameBuffer
+ {
+
+public:
+
+ /**
+ * Copies properties from the given frame buffer.
+ * @param "aSource" Source frame buffer from which propreties will
+ * be copied.
+ */
+ virtual void CopyProperties( MFrameBuffer* aSource ) = 0;
+
+ /**
+ * Copies properties from the given camera buffer.
+ * @param "aSource" Source camera buffer from which propreties will
+ * be copied.
+ */
+ virtual void CopyProperties( MCameraBuffer* aSource ) = 0;
+
+ /**
+ * Copies frame data and properties from the given frame buffer.
+ * @param "aSource" Source frame buffer from which propreties and
+ * frame data will be copied.
+ */
+ virtual void CopyFrameL( MFrameBuffer* aSource ) = 0;
+
+ /**
+ * Copies frame data and properties from the given camera buffer.
+ * @param "aSource" Source camera buffer from which propreties and
+ * frame data will be copied.
+ */
+ virtual void CopyFrameL( MCameraBuffer* aSource ) = 0;
+
+ };
+
+/**
+* Internal MFrameBuffer implementation.
+*
+* @lib videosource.lib
+*/
+class CVsFrameBuffer : public CBase, public MVsFrameBuffer,
+ public MFrameBuffer, public MCameraBuffer
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param "sSize" Size of stored frame in bytes.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ IMPORT_C static CVsFrameBuffer* NewL( TInt aSize );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CVsFrameBuffer();
+
+ public: // from MVsFrameBuffer
+
+ /**
+ * @see MVsFrameBuffer::CopyProperties
+ */
+ virtual void CopyProperties( MFrameBuffer* aSource );
+
+ /**
+ * @see MVsFrameBuffer::CopyProperties
+ */
+ virtual void CopyProperties( MCameraBuffer* aSource );
+
+ /**
+ * @see MVsFrameBuffer::CopyFrameL
+ */
+ virtual void CopyFrameL( MFrameBuffer* aSource );
+
+ /**
+ * @see MVsFrameBuffer::CopyFrameL
+ */
+ virtual void CopyFrameL( MCameraBuffer* aSource );
+
+ public: // from MFrameBuffer
+
+ /**
+ * @see MFrameBuffer::DataL or MCameraBuffer::DataL
+ */
+ TDesC8* DataL( TInt aIndex );
+
+ /**
+ * @see MFrameBuffer::FrameL or MCameraBuffer::FrameL
+ */
+ CFbsBitmap* FrameL( TInt aIndex );
+
+ /**
+ * @see MFrameBuffer::Release or MCameraBuffer::Release
+ */
+ void Release();
+
+ /**
+ * @see MCameraBuffer::FrameSize
+ */
+ TInt FrameSize(TInt aFrameIndex);
+
+ /**
+ * @see MCameraBuffer::ChunkOffsetL
+ */
+ TInt ChunkOffsetL(TInt aFrameIndex);
+
+ /**
+ * @see MCameraBuffer::ChunkL
+ */
+ RChunk& ChunkL();
+
+ /**
+ * @see MCameraBuffer::BitmapL
+ */
+ CFbsBitmap& BitmapL(TInt aFrameIndex);
+
+ /**
+ * @see MCameraBuffer::NumFrames
+ */
+ TInt NumFrames();
+
+ private:
+
+ /**
+ * Constructor.
+ */
+ CVsFrameBuffer();
+
+ /**
+ * Second phase constructor.
+ * @param "aSize" Size of the frame in bytes.
+ */
+ void ConstructL( TInt aSize );
+
+ private:
+
+ HBufC8* iBuffer;
+
+ TPtr8 iPtr;
+
+ };
+
+/**
+* Internal implementation of onboard camera data provider base class. This
+* class is inherited from public provider interface.
+*
+* @lib videosource.lib
+*/
+class CVSCameraDataProvider : public CVSDataProvider, public MCameraObserver, public MVtImageScalerObserver, public MCameraObserver2
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Factory function to create instance of onboard camera data provider.
+ * @param "aObserver" Pointer to provider observer.
+ * @param "aProviderIndex" Index of the provider to be created.
+ * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+ * data provider.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new provider instance.
+ */
+ static CVSCameraDataProvider* NewL(
+ MVSDataProviderObserver* aObserver,
+ TInt aProviderIndex,
+ MVSBufferPool* aPool );
+
+ /**
+ * Destructor.
+ */
+ ~CVSCameraDataProvider();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Initialize provider.
+ * @param "aInitParams" Initialization parameters.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void InitializeL( const TDesC8& aInitParams );
+
+ /**
+ * Cancel initialization of camera provider.
+ */
+ void CancelInitializing();
+
+ /**
+ * Return digital zoom factor.
+ * @return Digital zoom factor.
+ */
+ virtual TInt DigitalZoomFactor() const;
+
+ /**
+ * Set digital zoom factor.
+ * @param "aDigitalZoomFactor" Digital zoom factor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 );
+
+ /**
+ * Start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL( TSize& aSize );
+
+ /**
+ * Start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @param "aClipRect" Required clip rectangle.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL( TSize& aSize,TRect& aClipRect );
+
+ /**
+ * Stop view finder bitmaps.
+ */
+ virtual void StopViewFinder();
+
+ /**
+ * Test if view finder is active.
+ * @return ETrue if view finder active.
+ */
+ virtual TBool ViewFinderActive() const;
+
+ /**
+ * Start view finder bitmaps using direct screen access.
+ * @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.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect );
+
+ /**
+ * Start view finder bitmaps using direct screen access.
+ * @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.
+ * @param "aClipRect" The rectangle to which the screen will be clipped.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect,
+ TRect& aClipRect );
+
+ /**
+ * Return provider information.
+ * @param @param "aInfo" Reference to variable to where the provider
+ * information is copied.
+ */
+ virtual void ProviderInfo( TVSDataProviderInfo& aInfo );
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void SetViewFinderMirrorL( TBool aMirror );
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual TBool ViewFinderMirror() const;
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void FreezeL();
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void UnfreezeL();
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual TBool IsFrozen() const;
+
+ /**
+ * @see CVSDataProvider::SetContrastL for description.
+ */
+ virtual void SetContrastL( TInt aContrast );
+
+ /**
+ * @see CVSDataProvider::GetContrast
+ */
+ virtual TInt GetContrast( TInt& aContrast ) const;
+
+ /**
+ * @see CVSDataProvider::SetBrightnessL for description.
+ */
+ virtual void SetBrightnessL( TInt aBrightness );
+
+ /**
+ * @see CVSDataProvider::GetBrightness for description.
+ */
+ virtual TInt GetBrightness( TInt& aBrightness ) const;
+
+ /**
+ * @see CVSDataProvider::SetWhiteBalanceL for description.
+ */
+ virtual void SetWhiteBalanceL(
+ CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto );
+
+ /**
+ * @see CVSDataProvider::GetWhiteBalance for description.
+ */
+ virtual TInt GetWhiteBalance(
+ CCamera::TWhiteBalance& aWhiteBalance ) const;
+
+ /**
+ * @see CVSDataProvider::GetColorTone for description.
+ */
+ virtual TInt GetColorTone(
+ CCamera::CCameraImageProcessing::TEffect& aColorTone ) const;
+
+ /**
+ * @see CVSDataProvider::SetColorToneL for description.
+ */
+ virtual void SetColorToneL(
+ CCamera::CCameraImageProcessing::TEffect aValue );
+
+ protected: // from MCameraObserver
+
+ /**
+ * @see MCameraObserver::ImageReady
+ */
+ virtual void ImageReady( CFbsBitmap* aBitmap, HBufC8* aData,
+ TInt aError );
+
+ /**
+ * @see MCameraObserver::PowerOnComplete
+ */
+ virtual void PowerOnComplete( TInt aError );
+
+ /**
+ * @see MCameraObserver::ViewFinderFrameReady
+ */
+ virtual void ViewFinderFrameReady( CFbsBitmap& aFrame );
+
+ protected: // from MVtImageScalerObserver
+
+ /**
+ * @see MVtImageScalerObserver::ScalingFinished( TInt aError )
+ */
+ virtual void ScalingFinished( TInt aError );
+
+ protected: // from MCameraObserver2
+
+ /**
+ * @see MCameraObserver2::ImageBufferReady
+ */
+ virtual void ImageBufferReady( MCameraBuffer& aCameraBuffer,
+ TInt aError );
+
+ protected: // New functions
+
+ /**
+ * Inliner to return reference to the onboard camera handle.
+ * @return Reference to the onboard camera handle.
+ */
+ inline CCamera& Camera() const;
+
+ protected: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aObserver" Pointer to provider observer.
+ */
+ CVSCameraDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ private: // Constructors and destructors
+
+ /**
+ * 2nd phase constructor.
+ * @param "aProviderIndex" Index of the provider to be created.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL( TInt aProviderIndex );
+
+ void FreezeViewFinderFrame( CFbsBitmap& aFrame );
+
+ void ScaleFrozenBitmapL( TSize& aSize );
+
+ private: // New functions
+
+ /**
+ * Return provider information.
+ */
+ void ProviderInfoExL( TVSDataProviderInfo& aInfo );
+
+ private: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ enum TFreezePendingFlags
+ {
+ EViewFinderFreezePending = ( 1 << 0 ),
+ EVideoFrameFreezePending = ( 1 << 1 )
+ };
+
+ // Camera handle number.
+ TInt iCameraHandle;
+
+ // ETrue after ReserveComplete for iCamera
+ TBool iReserverComplete;
+
+ // ETrue after PowerOnComplete for iCamera
+ TBool iPowerOnComplete;
+
+ // ETrue after Freeze
+ TBool iFrozen;
+
+ // Contains pending freeze flags after Freeze
+ TUint iFreezePendingFlags;
+
+ // has frozen viewfinder frame copy
+ TBool iHasFrozenVFFrameCopyCreated;
+
+ CVsFrameBuffer* iFrozenFrame;
+
+ RCriticalSection iFreezeCS;
+
+ private: // Data
+
+ // Camera handle.
+ CCamera* iCamera;
+
+ // owned: Copy of frozen VF frame
+ CFbsBitmap* iFrozenVFFrameCopy;
+
+ //
+ CVtImageBitmap* iSource;
+
+ // owned: Scaled version of frozen VF frame (this is sent)
+ CFbsBitmap* iFrozenVFFrameToBeSent;
+
+ //
+ CVtImageBitmap* iTarget;
+
+ // owned: Scaler instance
+ CVtImageScaler* iScaler;
+
+ // ETrue when frozen VF frame is ready to be sent EFalse otherwise
+ TBool iFrozenVfFrameReady;
+
+ // Camera image processing
+ CCamera::CCameraImageProcessing* iCamImgProc;
+
+ private: // friends
+
+ // Stif test module must be set as friend to be able to call protected
+ // and private methods
+ friend class CstiffVideoSourceAPICases;
+
+ };
+
+#include "CVSCameraDataProvider.inl"
+
+#endif // CVSCAMERADATAPROVIDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::Camera
+// -----------------------------------------------------------------------------
+//
+inline CCamera& CVSCameraDataProvider::Camera() const
+ {
+ return *iCamera;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSControllerImp.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSCONTROLLERIMP_H
+#define CVSCONTROLLERIMP_H
+
+// INCLUDE FILES
+#include "CApiVideoSource.h"
+
+// CLASS DECLARATIONS
+
+/**
+* Internal implementation of controller. This class is inherited from
+* public controller interface.
+*
+* @lib videosource.lib
+*/
+class CVSControllerImp : public CVSController
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create controller instance.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new controller instance.
+ */
+ static CVSControllerImp* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CVSControllerImp();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Create data source instance.
+ * @param "aObserver" Pointer to data source observer.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new data source instance.
+ */
+ virtual CVSDataSource* CreateDataSourceL(
+ MVSDataSourceObserver* aObserver );
+
+ /**
+ * Return provider count and provider index.
+ * @return Number of providers available. Count also acts as zero
+ * based provider index.
+ */
+ virtual TInt ProvidersAvailable();
+
+ /**
+ * Return provider information.
+ * @param "aProviderIndex" Index of the provider to return information
+ * for.
+ * @param "aInfo" Reference to the variable where the provider
+ * information is copied.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ProviderInfoL(
+ TInt aProviderIndex,
+ TVSDataProviderInfo& aInfo );
+
+ /**
+ * Create provider instance.
+ * @param "aProviderIndex" Index of the provider to be created.
+ * @param "aObserver" Pointer to provider observer.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new provider instance.
+ */
+ virtual CVSDataProvider* CreateDataProviderL(
+ TInt aProviderIndex,
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // Constructors and destructor
+
+ /**
+ * 2nd phase constructor.
+ * @param "aObserver" Pointer to controller observer
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL( MVSControllerObserver* aObserver );
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ };
+
+#endif // CVSCONTROLLERIMP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSDataSourceImp.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,577 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSDATASOURCEIMP_H
+#define CVSDATASOURCEIMP_H
+
+// INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+// FORWARD DECLARATIONS
+
+class CVSDataSourceImp;
+class CVSMMFDataBuffer;
+
+// CLASS DECLARATION
+
+/**
+* Active Object that handles switch of active provider for data source.
+*
+* @lib videosource.lib
+*/
+class CVSProviderSwitchAO : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Leave safe static constructor.
+ * @param "aDataSourceImp" Pointer to VSDataSourceImp instance.
+ */
+ static CVSProviderSwitchAO* NewL( CVSDataSourceImp* aDataSourceImp );
+
+ /**
+ * Destructor.
+ */
+ ~CVSProviderSwitchAO();
+
+ public: // New functions
+
+ /**
+ * Adds this instance to calling thread's active scheduler.
+ * @param "aEventHandler" Reference to asynchronous event handler. This
+ * will be given to provider that will be switched as active provider
+ * in SourceThreadLogon() call.
+ * @return Possible error code.
+ */
+ TInt ThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * Removes this instance from calling thread's active scheduler.
+ */
+ void ThreadLogoff();
+
+ /**
+ * Initializes provider switch.
+ * @param "aNewProvider" Pointer to CVSDataProvider instance that will
+ * be set as active provider.
+ */
+ void InitiateProviderSwitch( CVSDataProvider* aNewProvider );
+
+ /**
+ * Return reference to event handler.
+ */
+ inline MAsyncEventHandler& EventHandler() { return *iEventHandler; }
+
+ /**
+ * Return pointer to new provider.
+ */
+ inline CVSDataProvider*& NewDataProvider() { return iNewProvider; }
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ /**
+ * Constructor.
+ * @param "aDataSourceImp" Pointer to VSDataSourceImp instance.
+ */
+ CVSProviderSwitchAO( CVSDataSourceImp* aDataSourceImp );
+
+ /**
+ * Leave safe construtor
+ */
+ void ConstructL();
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void DoCancel();
+
+ private: // New functions
+
+ /**
+ * Signals this active object with given error code.
+ * @param "aError" Error code with which active object will be signalled.
+ */
+ void Signal( TInt aError );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Pointer to data source implementation.
+ CVSDataSourceImp* iDataSourceImp; // not owned
+
+ // Pointer to data provider that will be switched.
+ CVSDataProvider* iNewProvider; // not owned
+
+ // Id of thread whose active scheduler this instance is added into.
+ TThreadId iThreadId;
+
+ // Pointer to async handler that will be given to the new provider in
+ // SourceThreadLogon() call.
+ MAsyncEventHandler* iEventHandler; // not owned
+
+ // Critical section for switch handling
+ RCriticalSection iSwitchCs;
+
+ };
+
+/**
+* Data source observer active object. This AO is needed because we want to
+* call vsProviderSwitchDone() callback
+* in correct thread context.
+*
+* @lib videosource.lib
+*/
+class CVSDataSourceObserverAO : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CVSDataSourceObserverAO();
+
+ /**
+ * Destructor.
+ */
+ ~CVSDataSourceObserverAO();
+
+ public: // New functions
+
+ /**
+ * This method is called when CVSProviderSwitchAO has completed provider
+ * switching.
+ * @param "aObserver" Observer that will signalled when RunL() is called.
+ * @param "aOldProvider" Pointer to provider that was active before the
+ * provider switch was done.
+ */
+ void vsProviderSwitchDone(
+ MVSDataSourceObserver& aObserver,
+ CVSDataProvider* aOldProvider );
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void DoCancel();
+
+ private: // New functions
+
+ /**
+ * Signals this active object with given error code.
+ * @param "aError" Error code with which active object will be signalled.
+ */
+ void Signal( TInt aError );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Data source observer pointer
+ MVSDataSourceObserver* iObserver; // not owned
+
+ // Previous active provider
+ CVSDataProvider* iOldProvider; // not owned
+
+ // Thread Id whose active scheduler this instance is added into
+ TThreadId iThreadId;
+ };
+
+
+
+/**
+* Internal implementation of data source. This class is inherited from
+* public data source interface. Some of the implemented MVTVideoSource,
+* MVTVideoInput calls are forwarded to active data provider,
+* some are processed here.
+*
+* @lib videosource.lib
+*/
+class CVSDataSourceImp : public CVSDataSource
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CVSDataSourceImp* NewSourceL();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Switch active provider for source.
+ * @param "aNewProvider" Pointer to provider instance.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void SwitchDataProviderL( CVSDataProvider* aNewProvider );
+
+ /**
+ * @see CVSDataSource::PauseSending
+ */
+ void PauseSending();
+
+ /**
+ * @see CVSDataSource::ResumeSending
+ */
+ void ResumeSending();
+
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CVSDataSourceImp();
+
+ public: // Functions from base classes
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId );
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TBool CanCreateSourceBuffer();
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ TBool &aReference );
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ CMMFBuffer& aSinkBuffer,
+ TBool &aReference );
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual void SourceThreadLogoff();
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TInt SourcePrimeL();
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TInt SourcePlayL();
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TInt SourcePauseL();
+
+ /**
+ * From MVTVideoSource / MDataSource. See MDataSource for description.
+ */
+ virtual TInt SourceStopL();
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ /**
+ * From MDataSource. See MDataSource for description.
+ */
+ virtual void ConstructSourceL(const TDesC8& aInitData);
+
+ public: // Functions from base classes
+
+
+ virtual const RArray<TDesC8* >& GetMultimediaTypesL() const;
+
+
+
+ public: // Functions from base classes
+
+ /**
+ * From MVTVideoInput. See MVTVideoInput for description.
+ */
+ virtual void SetFormatL( const TDesC8& aFormat );
+
+ /**
+ * From MVTVideoInput. See MVTVideoInput for description.
+ */
+ virtual void SetFrameRateL( TReal32 aFrameRate );
+
+ /**
+ * From MVTVideoInput. See MVTVideoInput for description.
+ */
+ virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * From MVTVideoInput. See MVTVideoInput for description.
+ */
+ virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+ private: // New functions
+
+ /**
+ * Starts provider switching. Switching must be done in correct thread
+ * context.
+ * @param "aNewProvider" Pointer to provider that will be switched as
+ * active.
+ * @param "aEventHandler" Reference to asynchronous event handler.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void DoProviderSwitchL(
+ CVSDataProvider* aNewProvider,
+ MAsyncEventHandler& aEventHandler );
+
+ /**
+ * Test if provider switch operation is ongoing.
+ * @return ETrue if provider switch operation was suspended because
+ * buffers were not free.
+ */
+ inline TBool SwitchPending() { return iSwitchPending; };
+
+ /**
+ * Notifies provider observer about error occurred in provider switch.
+ * @param "aError" Standard Symbian error code
+ */
+ void ProviderSwitchError( TInt aError );
+
+ private: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CVSDataSourceImp();
+
+ private: // Functions from base classes
+
+ /**
+ * From MVSBufferPool. See MVSBufferPool for description.
+ */
+ virtual CVSMMFDataBuffer* GetBufferL( TBool aRemove );
+
+ /**
+ * From MVSBufferPool. See MVSBufferPool for description.
+ */
+ virtual void FreeBufferL( CVSMMFDataBuffer* aBuffer );
+
+ private: // New functions
+
+ /**
+ * Add buffer to free buffer pool without locking queue cs.
+ * @return One of the system wide error codes or KErrNone if no error
+ * happens.
+ * @param "aBuffer" A pointer to buffer to add to free buffer pool.
+ * If buffer pointer is found from active buffer pool it is first
+ * removed from there.
+ */
+ TInt FreeBufferNoWait( CVSMMFDataBuffer* aBuffer );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Data source state
+ enum TDataSourceState
+ {
+ EStopped,
+ EPrimed,
+ EPlaying
+ };
+
+ // Data source method call flags
+ enum TCallFlags
+ {
+ // SetVideoFrameSizeL() was called
+ ESetSizeCalled = ( 1 << 0 ),
+
+ // SetFrameRateL() was called
+ ESetFrameRateCalled = ( 1 << 1 ),
+
+ // SetFormatL() was called
+ ESetFormatCalled = ( 1 << 2 )
+ };
+
+ // Data source state
+ TDataSourceState iDSState;
+
+ // Call flags
+ TUint32 iCallFlags;
+
+
+ // Provider switch AO pointer
+ CVSProviderSwitchAO* iProviderSwitchAO;
+
+ // Data source observer AO pointer
+ CVSDataSourceObserverAO* iDataSourceObserverAO; // owned
+
+ // Format heap descriptor pointer
+ HBufC8* iFormat; // owned
+
+ // Frame rate
+ TReal32 iFrameRate;
+
+ // Frame size
+ TSize iSize;
+
+ // SourceThreadLogon() called flag
+ TBool iThreadLogonCalled;
+
+ // Array to return in response to GetMultimediaTypesL call
+ // (supported video frame formats).
+ RArray<TDesC8*> iProtoMimeTypes;
+
+ // Video frame formats supported by all providers.
+ CDesC8Array* iSupportedVideoFormats;
+
+ // Video frame sizes for each format supported by all providers
+ class TVSFrameSize
+ {
+ public:
+ TPtrC8 iFormat; // Primary key, 1st field
+ TSize iSize;
+ };
+ RArray<TVSFrameSize> iSupportedVideoSizes;
+
+ // Video frame rates for each format and frame size supported by all
+ // providers.
+ class TVSFrameRate
+ {
+ public:
+ TPtrC8 iFormat; // Primary key, 1st field
+ TSize iSize; // Primary key, 2nd field
+ TReal32 iRate;
+ };
+
+ RArray<TVSFrameRate> iSupportedFrameRates;
+
+ private: // Data
+
+ // Needs to be friend
+ friend class CVSProviderSwitchAO;
+
+ // MIME type holder
+ TBuf8<128> iYuv420PlanarDesc;
+
+ private: // Data
+
+ // Critical section for queue handling
+ RCriticalSection iQueueCs;
+
+ // Critical section for queue handling
+ RCriticalSection iPauseCs;
+
+ // Queue for buffers that are free for use
+ RPointerArray<CVSMMFDataBuffer> iFreeQueue;
+
+ // Queue for buffers that are being used by the Protocol
+ RPointerArray<CVSMMFDataBuffer> iActiveQueue;
+
+ // All buffers allocated by CreateSourceBufferL()
+ RPointerArray<CVSMMFDataBuffer> iAllocatedBuffers;
+
+ // Number of buffer requests by CreateSourceBufferL()
+ TInt iRequestedBufferCount;
+
+ // Set to ETrue when protocol is initializing (From
+ // SourceThreadLogon to SourcePlayL)
+ TBool iProtoInitOngoing;
+
+ // Set to ETrue if provider switch operation was suspended because
+ // protocol was initializing
+ TBool iProviderSwitchRequestDuringProtoInit;
+
+ // Temporary save pointer, not owned
+ CVSDataProvider* iNewProvider;
+
+ // Critical section for synchronizing access to
+ // iProviderSwitchRequestDuringProtoInit and iProtoInitOngoing
+ RCriticalSection iProtoInitCS;
+
+ // Set to ETrue during DoProviderSwitchL
+ TBool iSwitchOngoing;
+
+ // Set to ETrue when DoProviderSwitchL is needed
+ TBool iSwitchPending;
+
+ // Set to ETrue when video sending is paused to Protocol
+ // Guarded by: iPauseCs
+ TBool iSendingPaused;
+
+ // If true then FBS was started during SourceThreadLogon() and
+ // thus should be stopped in SourceThreadLogoff()
+ TBool iFbsStarted;
+ };
+
+#endif // CVSDATASOURCEIMP_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSMMFDataBuffer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSMMFDATABUFFER_H
+#define CVSMMFDATABUFFER_H
+
+// INCLUDE FILES
+
+#include <mmfdatabuffer.h>
+
+// FORWARD DECLARATIONS
+
+class MFrameBuffer;
+class MCameraBuffer;
+
+/**
+* API of data buffer that allows provider's buffer contents to
+* be given to consumer without copying.
+*
+* @lib videosource.lib
+* @since 5.0
+*/
+class MVSMMFDataBuffer
+ {
+
+public:
+
+ /**
+ * Sets the ECAM frame buffer.
+ * @param "aFrameBuffer" MFrameBuffer pointer.
+ */
+ virtual void SetFrameBufferL( MFrameBuffer* aFrameBuffer ) = 0;
+
+ /**
+ * Sets the ECAM camera buffer.
+ * @param "aFrameBuffer" MFrameBuffer pointer.
+ */
+ virtual void SetFrameBufferL( MCameraBuffer* aCameraBuffer ) = 0;
+
+ /**
+ * Calls Release() for MFrameBuffer and sets aFrameBuffer to NULL.
+ */
+ virtual void ReleaseL() = 0;
+
+ /**
+ * Sets start offset and length of internal iPtr variable (when
+ * pointing to iData).
+ */
+ virtual void SetBufferOffset( TInt aOffset ) = 0;
+
+ /**
+ * Reallocates the max size in bytes.
+ * @param "aMaxBufferSize" New size in bytes.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void ReAllocBufferL( TInt aMaxBufferSize ) = 0;
+
+ /**
+ * Checks whether buffer needs reset or not.
+ * @return ETrue if buffer needs reset, EFalse otherwise.
+ */
+ virtual TBool NeedsReset() const = 0;
+
+ /**
+ * Sets needs reset state.
+ * @param aNeedsReset New reset state.
+ */
+ virtual void SetNeedsReset( TBool aNeedsReset ) = 0;
+
+ /**
+ * Resets buffer (i.e. clears data).
+ */
+ virtual void Reset() = 0;
+
+ };
+
+/**
+* Implementation of data buffer that allows provider's buffer contents to
+* be given to consumer without copying.
+*
+* @lib videosource.lib
+*/
+class CVSMMFDataBuffer : public CMMFDataBuffer, public MVSMMFDataBuffer
+ {
+ public: // new methods
+
+ /**
+ * Static factory function to create instance of this class.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ IMPORT_C static CVSMMFDataBuffer* NewL();
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aMaxBufferSize" Buffer size
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ IMPORT_C static CVSMMFDataBuffer* NewL( TInt aMaxBufferSize );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CVSMMFDataBuffer();
+
+ public: // from CMMFDataBuffer
+
+ /**
+ * @see CMMFDataBuffer::Data
+ */
+ virtual TDes8& Data();
+
+ /**
+ * @see CMMFDataBuffer::Data
+ */
+ virtual const TDesC8& Data() const;
+
+ /**
+ * @see CMMFDataBuffer::SetStatus
+ */
+ virtual void SetStatus( TBufferStatus aStatus );
+
+ /**
+ * @see CMMFDataBuffer::SetRequestSizeL
+ */
+ virtual void SetRequestSizeL( TInt aSize );
+
+ /**
+ * @see CMMFDataBuffer::BufferSize
+ */
+ virtual TUint BufferSize() const;
+
+ /**
+ * @see CMMFDataBuffer::SetPosition
+ */
+ virtual void SetPosition( TUint aPosition );
+
+ public: // from MVSMMFDataBuffer
+
+ /**
+ * @see MVSMMFDataBuffer::SetFrameBufferL
+ */
+ void SetFrameBufferL( MFrameBuffer* aFrameBuffer );
+
+ /**
+ * @see MVSMMFDataBuffer::SetFrameBufferL
+ */
+ void SetFrameBufferL( MCameraBuffer* aCameraBuffer );
+
+ /**
+ * @see MVSMMFDataBuffer::ReleaseL
+ */
+ void ReleaseL();
+
+ /**
+ * @see MVSMMFDataBuffer::SetBufferOffset
+ */
+ void SetBufferOffset( TInt aOffset );
+
+ /**
+ * @see MVSMMFDataBuffer::ReAllocBufferL
+ */
+ void ReAllocBufferL( TInt aMaxBufferSize );
+
+ /**
+ * @see MVSMMFDataBuffer::NeedsReset
+ */
+ TBool NeedsReset() const;
+
+ /**
+ * @see MVSMMFDataBuffer::SetNeedsReset
+ */
+ void SetNeedsReset( TBool aNeedsReset );
+
+ /**
+ * @see MVSMMFDataBuffer::Reset
+ */
+ void Reset();
+
+
+ private: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CVSMMFDataBuffer();
+
+ /**
+ * 2nd phase constructor.
+ * @param "aMaxBufferSize" Buffer size in bytes.
+ */
+ void ConstructL( TInt aMaxBufferSize );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Pointer to ECAM buffer
+ MFrameBuffer* iFrameBuffer;
+
+ // Pointer to ECAM buffer
+ MCameraBuffer* iCameraBuffer;
+
+ // Pointer to data buffer ( n/a for ECAM )
+ TUint8* iData;
+
+ // TPtr8 pointing to iData or ECAM buffer data content
+ TPtr8 iPtr;
+
+ // Max buffer size ( n/a for ECAM )
+ TInt iMaxBufferSize;
+
+ // ETrue if buffers needs reset, EFalse otherwise
+ TBool iNeedsReset;
+
+ // ETrue if buffer is set, EFalse otherwise
+ TBool iIsBufferSet;
+
+ };
+
+#endif // CVSMMFDATABUFFER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSOnboardCameraDataProvider.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,387 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSONBOARDCAMERADATAPROVIDER_H
+#define CVSONBOARDCAMERADATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include "CVSCameraDataProvider.h"
+
+// CLASS DECLARATION
+
+/**
+* Handles provider error notification using interface to provider callback
+* functions. Provider errors can occur in two threads and this class provides
+* error notification in the same thread context that the provider was created.
+*
+* @lib videosource.lib
+*/
+class CProviderErrorNotifierAO : public CActive
+ {
+ public: // New functions
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CProviderErrorNotifierAO* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CProviderErrorNotifierAO();
+
+ private: // New functions
+
+ /**
+ * Notify provider observer about error.
+ * @param "aObserver" Pointer to provider observer to notify.
+ * @param "aError" Error code.
+ */
+ void NotifyError( MVSDataProviderObserver* aObserver, TInt aError );
+
+ private: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CProviderErrorNotifierAO();
+
+ /**
+ * 2nd phase constructor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL();
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void DoCancel();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Pointer to provider observer that will receive the error
+ // notification.
+ MVSDataProviderObserver* iObserver;
+
+ // Error code.
+ TInt iError;
+
+ // Critical section to synchronize access to this object.
+ RCriticalSection iCS;
+
+ // Thread id of the thread in which this object was created.
+ TThreadId iThreadId;
+
+ private: // Data
+
+ // This class is private to CVSDataProvider.
+ friend class CVSDataProvider;
+ };
+
+/**
+* Makes onboard camera Reserve and PowerOn function calls synchronous.
+*
+* @lib videosource.lib
+*/
+class CSyncCameraReserve : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CSyncCameraReserve* NewL();
+
+ public: // New functions
+
+ /**
+ * Starts waiting and returns when RunL is called.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void StartL();
+
+ private: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CSyncCameraReserve();
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void DoCancel();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ private: // Data
+
+ // Active scheduler loop owner. See CActiveSchedulerWait for
+ // description.
+ CActiveSchedulerWait iWait;
+ };
+
+/**
+* Internal implementation of onboard camera data provider. This
+* class is inherited from onboard camera data provider base class.
+*
+* @lib videosource.lib
+*/
+class CVSOnboardCameraDataProvider : public CVSCameraDataProvider
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aObserver" Pointer to provider observer.
+ * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+ * data provider.
+ */
+ CVSOnboardCameraDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ /**
+ * Destructor.
+ */
+ ~CVSOnboardCameraDataProvider();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ void PrimeL();
+
+ private: // Functions from base classes
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId );
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceThreadLogoff();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePrimeL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePlayL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePauseL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceStopL();
+
+ private: // Functions from base classes
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFormatL( const TDesC8& aFormat );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFrameRateL( TReal32 aFrameRate );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+ private: // from MCameraObserver
+
+ /**
+ * @see MCameraObserver::ReserveComplete
+ */
+ virtual void ReserveComplete( TInt aError );
+
+ /**
+ * @see MCameraObserver::FrameBufferReady
+ */
+ virtual void FrameBufferReady( MFrameBuffer* aFrameBuffer,
+ TInt aError );
+
+ private: // from MCameraObserver2
+
+ /**
+ * @see MCameraObserver2::HandleEvent
+ */
+ virtual void HandleEvent(const TECAMEvent& aEvent);
+
+ /**
+ * @see MCameraObserver2::ViewFinderReady
+ */
+ virtual void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+ /**
+ * @see MCameraObserver2::VideoBufferReady
+ */
+ virtual void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+ private: // Functions from base classes
+
+ /**
+ * Get video frame size.
+ */
+ virtual void GetVideoFrameSize(
+ TSize& aSize,
+ TInt aSizeIndex,
+ const TDesC8& aFormat );
+
+ /**
+ * Get video frame rate.
+ */
+ virtual void GetVideoFrameRate(
+ TReal32& aRate,
+ TInt aRateIndex,
+ const TDesC8& aFormat,
+ const TSize& aSize );
+
+ void FreezeFrame( MFrameBuffer* aFrameBuffer );
+
+ void FreezeFrame( MCameraBuffer* aCameraBuffer );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Onboard camera dublicate for the second thread. Owned.
+ CCamera* iCameraDuplicate;
+
+ // MMF controller framwork mixin for event handling
+ MAsyncEventHandler* iEventHandler;
+
+ // Enumerated values for possible states this class can have.
+ enum TState
+ {
+ EStopped,
+ EPrimed,
+ EPlaying
+ };
+
+ // One of the enumerated states.
+ TState iState;
+
+ // ECAM frame rate index.
+ TInt iFrameRateIndex;
+
+ // ECAM frame size index.
+ TInt iFrameSizeIndex;
+
+ // Frame size.
+ TSize iFrameSize;
+
+ // ECAM Video frame format.
+ CCamera::TFormat iFormat;
+
+ // Pointer to AO that makes iCameraDuplicate.Reserve() and PowerOn()
+ // synchronous. Owned. These are called in SourcePrimeL and because
+ // it is synchronous, reserve & poweron must be too.
+ CSyncCameraReserve* iSyncReserve;
+
+ //
+ TBool iAsynchronousReserveIssued;
+
+ // Pointer to dublicated camera bitmap
+ CFbsBitmap* iDublicatedBitmap;
+
+ // Camera lost by force indicator
+ TBool iCameraLost;
+
+ private: // friends
+
+ // Stif test module must be set as friend to be able to call protected
+ // and private methods
+ friend class CstiffVideoSourceAPICases;
+
+ };
+
+#endif // CVSONBOARDCAMERADATAPROVIDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSStillImageDataProvider.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSSTILLIMTAGEDATAPROVIDER_H
+#define CVSSTILLIMTAGEDATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include <gdi.h>
+#include "CApiVideoSource.h"
+#include "cvtimagescaler.h"
+#include <ecamimageprocessing.h>
+
+#include "cactivewait.h"
+#include "mmultiframeprovider.h"
+
+// FORWARD DECLARATIONS
+
+class CImageDecoder;
+class CVSStillImageDataProvider;
+class CVSFrameRateTimer;
+class CVtImageBitmap;
+class CMultiframeProvider;
+
+
+// CLASS DECLARATION
+
+/**
+* Internal implementation of still image data provider. This
+* class is inherited from from public provider interface.
+*
+* @lib videosource.lib
+*/
+class CVSStillImageDataProvider : public CVSDataProvider, MMultiframeprovider
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function create instance of this class.
+ * @param "aObserver" Pointer to provider observer.
+ * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+ * data provider.
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CVSStillImageDataProvider* NewL(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ /**
+ * Destructor.
+ */
+ ~CVSStillImageDataProvider();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Initialize provider.
+ * @param "aInitParams" Reference to the initialization parameters.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void InitializeL( const TDesC8& aInitParams );
+
+ /**
+ * Cancel initialization of still image provider.
+ */
+ void CancelInitializing();
+
+ /**
+ * Return digital zoom factor.
+ * @return Digital zoom factor.
+ */
+ virtual TInt DigitalZoomFactor() const;
+
+ /**
+ * Set digital zoom factor.
+ * @param "aDigitalZoomFactor" Digital zoom factor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 );
+
+ /**
+ * Start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL( TSize& aSize );
+
+ /**
+ * Start view finder bitmaps.
+ * @param "aSize" Size of the returned view finder bitmap.
+ * @param "aClipRect" Required clip rectangle.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderBitmapsL( TSize& aSize,TRect& aClipRect );
+
+ /**
+ * Stop view finder bitmaps.
+ */
+ virtual void StopViewFinder();
+
+ /**
+ * Test if view finder is active.
+ * @return ETrue if view finder active.
+ */
+ virtual TBool ViewFinderActive() const;
+
+ /**
+ * Start view finder bitmaps using direct screen access.
+ * @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.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect );
+
+ /**
+ * Start view finder bitmaps using direct screen access.
+ * @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.
+ * @param "aClipRect" The rectangle to which the screen will be clipped.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ virtual void StartViewFinderDirectL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindow,
+ TRect& aScreenRect,
+ TRect& aClipRect );
+
+ /**
+ * Return provider information.
+ * @param @param "aInfo" Reference to variable to where the provider
+ * information is copied.
+ */
+ virtual void ProviderInfo( TVSDataProviderInfo& aInfo );
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void SetViewFinderMirrorL( TBool aMirror );
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual TBool ViewFinderMirror() const;
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void FreezeL();
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual void UnfreezeL();
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ virtual TBool IsFrozen() const;
+
+ /**
+ * @See CVSDataProvider::SetContrastL for description.
+ */
+ virtual void SetContrastL( TInt aContrast );
+
+ /**
+ * @See CVSDataProvider::GetContrast for description.
+ */
+ virtual TInt GetContrast( TInt& aContrast ) const;
+
+ /**
+ * @See CVSDataProvider::SetBrightnessL for description.
+ */
+ virtual void SetBrightnessL( TInt aBrightness );
+
+ /**
+ * @See CVSDataProvider::GetBrightness for description.
+ */
+ virtual TInt GetBrightness( TInt& aBrightness ) const;
+
+ /**
+ * @See CVSDataProvider::SetWhiteBalanceL for description.
+ */
+ virtual void SetWhiteBalanceL(
+ CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto);
+
+ /**
+ * @See CVSDataProvider::GetWhiteBalance for description.
+ */
+ virtual TInt GetWhiteBalance(
+ CCamera::TWhiteBalance& aWhiteBalance ) const;
+
+ /**
+ * @See CVSDataProvider::GetColorTone for description.
+ */
+ virtual TInt GetColorTone(
+ CCamera::CCameraImageProcessing::TEffect& aColorTone) const;
+
+ /**
+ * @See CVSDataProvider::SetColorToneL for description.
+ */
+ virtual void SetColorToneL(
+ CCamera::CCameraImageProcessing::TEffect aValue );
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ /**
+ * See CVSDataProvider for description.
+ */
+ void PrimeL();
+
+ private:
+
+ private: // Functions from base classes
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId );
+
+ private:
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceThreadLogoff();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePrimeL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePlayL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourcePauseL();
+
+ /**
+ * See MDataSource for description.
+ */
+ virtual void SourceStopL();
+
+ private: // Functions from base classes
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFormatL( const TDesC8& aFormat );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetFrameRateL( TReal32 aFrameRate );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+ /**
+ * See MVTVideoInput for description.
+ */
+ virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+ private: // New functions
+
+ /**
+ * Common initialization of the provider (initializes features
+ * that are always needed by the provider).
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void CommonInitializeL();
+
+ /**
+ * Undo common initialization of still image data provider.
+ */
+ void UndoCommonInitialized();
+
+ /**
+ * Loads image that was set in General Settings application.
+ * @param aType Type of of the general settings image.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void GeneralSettingsInitializeL( const TGeneralSettingsImageType aType );
+
+ /**
+ * Initializes this instance as blank image instance.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void BlankImageInitializeL();
+
+ /**
+ * Initializes this instance from image file.
+ * @param aFileName Name of the file from which this intance will be
+ * initialized.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void FileImageInitializeL( const TFileName& aFileName );
+
+ /**
+ * View finder timer callback. This method is called when view finder
+ * needs updating.
+ */
+ void VFTimer();
+
+ /**
+ * protocol timer callback. This method is called when new frame
+ * will be sent to consumer.
+ */
+ void ProtoTimer();
+
+ /**
+ * Method for creating timer for protocol. This method is called
+ * in Proto thread context.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void CreateProtoTimerL();
+
+ /**
+ * Releases protocol timer. This method is called in Protocol thread
+ * context.
+ */
+ void ReleaseProtoTimer();
+
+ /**
+ * Creates YUV buffer from still image. This method is called in Protocol
+ * thread context.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void CreateYUVDataL();
+
+ /**
+ * Release YUV buffer. This method is called in Protocol thread context.
+ */
+ void ReleaseYUVData();
+
+ private: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aObserver" Pointer to provider observer.
+ */
+ CVSStillImageDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool );
+
+ /**
+ * 2nd phase constructor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL();
+
+ private: // Functions from base classes
+
+ /**
+ * Get video frame size.
+ */
+ virtual void GetVideoFrameSize(
+ TSize& aSize,
+ TInt aSizeIndex,
+ const TDesC8& aFormat );
+
+ /**
+ * Get video frame rate.
+ */
+ virtual void GetVideoFrameRate(
+ TReal32& aRate,
+ TInt aRateIndex,
+ const TDesC8& aFormat,
+ const TSize& aSize );
+
+ /**
+ * Returns current screen display mode.
+ */
+ TDisplayMode DisplayMode() const;
+
+ private:
+
+ // from MMultiframeprovider
+ /**
+ * @See MMultiframeprovider for description.
+ */
+ virtual void InitializeReady();
+
+ /**
+ * @See MMultiframeprovider for description.
+ */
+ virtual void RefreshYUVData( TImageShareDataBuffer& aYUVBitMap );
+
+ /**
+ * @See MMultiframeprovider for description.
+ */
+ virtual void RefreshViewFinder( TImageShareDataBuffer& aVFBitMap );
+
+ /**
+ * @See MMultiframeprovider for description.
+ */
+ virtual void NotifyImageHandlingError( TInt aError );
+
+ public: // Data
+
+ protected: // Data
+ RCriticalSection iFreezeCS;
+ private: // Data
+
+ // Provider state
+ enum TProviderState
+ {
+ EPSUninitialized, // Provider is uninitialized
+ EPSStopped, // Provider is initialized and stopped
+ EPSPrimed, // Provider is initialized and ready for playing
+ EPSPlaying, // Provider is playing
+ EPSInitializing, // Provider is initializing
+ EPSUndoInitializing // Provider is undoinitializing
+ };
+
+ // Provider state
+ TProviderState iPSState;
+
+ // View finder state
+ enum TViewFinderState
+ {
+ EVFStopped, // View finder is not started
+ EVFPlaying // View finder started
+ };
+
+ // View finder state
+ TViewFinderState iVFState;
+
+ // Source bitmap's name
+ TFileName iBitmapFileName;
+
+ // Pointer to view finder timer instance
+ CVSFrameRateTimer* iVFTimer; // owned
+
+ // Pointer to protocol timer instance
+ CVSFrameRateTimer* iProtoTimer; // owned, created in Proto thread context!
+
+ // Target image for CVtImageScaler
+ CVtImageBitmap* iScaled;
+ CVtImageBitmap* iYUVBitMap;
+
+ // Pointer to selected view finder image
+ CVtImageBitmap* iVFCurrent;
+ CVtImageBitmap* iVFBitmap;
+
+ // Pointer to active waiter instance
+ CVSActiveWait< CVSStillImageDataProvider >* iActiveWait; // owned
+
+ // Heap descriptor pointer that contains image as YUV
+ HBufC8* iYUVBuffer; // owned, created in Protocol thread context!
+
+ // Frame counter
+ TUint32 iFrameCount;
+
+ // protocol timer update rate
+ TInt iProtoUpdateRate;
+
+ // Rescaling recuirement flag
+ TBool iVFRescalingRequired;
+
+ // FireServer session instance
+ RFs iFs;
+
+ // Current display mode
+ TDisplayMode iDisplayMode;
+
+ // Viewer instance
+ CMultiframeProvider* iViewer; //owned
+
+ // Traget VF size
+ TSize iTargetSize;
+
+ //Record TVSStillImageDataProviderParams::iInitialize in InitializeL(),
+ //used in CancelInitializing call
+ TVSStillImageDataProviderParams::TInitialize iInitType;
+
+ };
+
+#endif // CVSSTILLIMTAGEDATAPROVIDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/VSPanic.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 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: Panic definitions for videosource module.
+*
+*/
+
+
+#ifndef VSPANIC_H
+#define VSPANIC_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+_LIT( KVSPanicCategory, "VideoSource" );
+
+// DATA TYPES
+enum TVSPanic
+ {
+ EVSPanicSwitchAlreadyPending, // 0
+ EVSPanicProviderNotSet, // 1
+ EVSPanicProviderAlreadyInitialized, // 2
+ EVSPanicProviderNotReady, // 3
+ EVSPanicOperationNotSupported, // 4
+ EVSPanicThreadOpenFailure // 5
+ };
+
+// FUNCTION PROTOTYPES
+extern void Panic( TVSPanic aPanicCode );
+
+#endif // VSPANIC_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/VideoSourceUids.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 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: Uid definition file for Video Source subsystem
+*
+*/
+
+
+
+#ifndef __VIDEOSOURCEUIDS_HRH__
+#define __VIDEOSOURCEUIDS_HRH__
+
+#define KSharedLibraryUidDefine 0x1000008D
+#define KUidVideoSourceLibrary 0x101F8692
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cactivewait.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef C_ACTIVEWAIT_H
+#define C_ACTIVEWAIT_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+/**
+* Active waiter class for waiting any active request. When asynchronous
+* request has been completed a given callback method will be called.
+*
+* @lib videosource.lib
+*/
+template < class R > class CVSActiveWait: public CActive
+ {
+ private :
+
+ typedef void ( R::*TVSActiveWaitCallback) ( TInt );
+
+ public : // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aRequester" ?description
+ */
+ inline CVSActiveWait( R* aRequester );
+
+ /**
+ * Destructor.
+ */
+ inline ~CVSActiveWait();
+
+ /**
+ * Initializes the waiter class.
+ * @param "aCallback" Pointer to callback method that will be called
+ * when asynchronous request has been completed.
+ */
+ inline void InitializeWaiter( TVSActiveWaitCallback aCallback );
+
+ /**
+ * Returns pointer to this active object's TRequestStatus member
+ * (iStatus).
+ * @return Pointer to this classes TRequestStatus member (iStatus).
+ */
+ inline TRequestStatus* RequestStatus();
+
+ /**
+ * Signals waiter with given error code.
+ * @param aError Integer error code.
+ */
+ inline void Signal( TInt aError );
+
+ private : // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ inline void RunL();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ inline void DoCancel();
+
+ private : // Data
+
+ // Pointer to requester. Callback method call will be made in this
+ // context.
+ R* iRequester; // not owned
+
+ // Pointer to callback method.
+ TVSActiveWaitCallback iCallback;
+ };
+
+#include "cactivewait.inl"
+
+#endif // C_ACTIVEWAIT_H
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cactivewait.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,127 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSActiveWait ===============================
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::~CVSActiveWait()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+CVSActiveWait< R >::~CVSActiveWait()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RequestStatus()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+TRequestStatus* CVSActiveWait< R >::RequestStatus()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() <<"), RThread().Id().operator TUint()));
+ return &iStatus;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::Signal( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() >>"), RThread().Id().operator TUint()));
+ if( IsActive() )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aError );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RunL()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() >>"), RThread().Id().operator TUint()));
+ (iRequester->*iCallback)( iStatus.Int() );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::DoCancel()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() >>"), RThread().Id().operator TUint()));
+ if ( iStatus == KRequestPending )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, KErrCancel );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::CVSActiveWait( CAnimatedImageViewer* aRequester )
+// -----------------------------------------------------------------------------
+//
+template < class R >
+CVSActiveWait< R >::CVSActiveWait( R* aRequester )
+: CActive( EPriorityHigh ), iRequester( aRequester )
+ {
+ __IF_DEBUG(Print(_L("CVSActiveWait::CVSActiveWait() >>")));
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("CVSActiveWait::CVSActiveWait() <<")));
+ }
+// -----------------------------------------------------------------------------
+// CVSActiveWait::InitializeWaiter( TVSActiveWaitCallback aCallback )
+// -----------------------------------------------------------------------------
+//
+template < class R >
+void CVSActiveWait< R >::InitializeWaiter( TVSActiveWaitCallback aCallback )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() >>"), RThread().Id().operator TUint()));
+ if ( !IsActive() )
+ {
+ iStatus = KRequestPending;
+ iCallback = aCallback;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() SetActive"), RThread().Id().operator TUint()));
+ SetActive();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() <<"), RThread().Id().operator TUint()));
+ }
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/capivideosource.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+/*
+ * CVSController
+*/
+
+// -----------------------------------------------------------------------------
+// CVSController::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSControllerObserver& CVSController::Observer() const
+ {
+ return *iObserver;
+ }
+
+/*
+ * CVSDataProvider
+*/
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSDataProviderObserver& CVSDataProvider::Observer() const
+ {
+ return *iObserver;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::BufferPool
+// -----------------------------------------------------------------------------
+//
+inline MVSBufferPool& CVSDataProvider::BufferPool() const
+ {
+ return *iPool;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::FillBufferActive
+// -----------------------------------------------------------------------------
+//
+inline TBool CVSDataProvider::FillBufferActive() const
+ {
+ return iFillBufferActive;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::Consumer
+// -----------------------------------------------------------------------------
+//
+inline MVTVideoSink* CVSDataProvider::Consumer() const
+ {
+ return iConsumer;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::MediaId
+// -----------------------------------------------------------------------------
+//
+inline TMediaId CVSDataProvider::MediaId() const
+ {
+ return iMediaId;
+ }
+
+/*
+ * CVSDataSource
+*/
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSDataSourceObserver& CVSDataSource::Observer() const
+ {
+ return *iObserver;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::DataProvider
+// -----------------------------------------------------------------------------
+//
+inline CVSDataProvider& CVSDataSource::DataProvider() const
+ {
+ return *iProvider;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::SwitchProvider
+// -----------------------------------------------------------------------------
+//
+inline CVSDataProvider* CVSDataSource::SwitchProvider(
+ CVSDataProvider* aNewProvider )
+ {
+ CVSDataProvider* oldProvider = iProvider;
+ iProvider = aNewProvider;
+ return oldProvider;
+ }
+
+/*
+ * TVSStillImageDataProviderParams
+ */
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams()
+ : iInitialize( EInitializeAsBlankImage ), iFileName( TPtrC() )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams(
+ const TInitialize aInitialize )
+ : iInitialize( aInitialize ), iFileName( TPtrC() )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams(
+ const TFileName& aFileName )
+ : iInitialize( EInitializeFromFile ), iFileName( aFileName )
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframedataao.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,128 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+#ifndef C_MULTIFRAMEDATAAO_H
+#define C_MULTIFRAMEDATAAO_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "mmultiframeprovider.h"
+// FORWARD DECLARATIONS
+class CMultiframeProvider;
+
+// MACROS
+
+/**
+* @lib videosource.lib
+*/
+// ============================ CMultiframeDataAO ===============================
+NONSHARABLE_CLASS( CMultiframeDataAO ) : public CTimer
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aRequester" instance to requester
+ */
+ CMultiframeDataAO( CMultiframeProvider* aRequester );
+
+ /**
+ * Destructor.
+ */
+ ~CMultiframeDataAO();
+
+ public: // New functions
+
+ /**
+ * Sets observer.
+ * @param "aObserever" instance to observer
+ */
+ void SetObserver( MMultiframeprovider* aObserver );
+
+ /**
+ * Activates CTimer
+ * @param "aUpdateTime" expiration time
+ */
+ void Activate( TTimeIntervalMicroSeconds aUpdateTime, TBool aInit, TBool aVFUpdate );
+
+ /**
+ * Updates local buffer.
+ * @param "aLocalBuffer" local buffer
+ */
+ void LocalBuffer( CVtImageBitmap* aLocalBuffer );
+
+ /**
+ * Updates remote buffer.
+ * @param "aRemoteBuffer" remote buffer
+ */
+ void RemoteBuffer ( CVtImageBitmap* aRemoteBuffer );
+
+ /**
+ * Cancels looping and completes request in correct thread.
+ */
+ void CancelTimeLoop();
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ private: // Data
+
+ // Pointer to observer.
+ MMultiframeprovider* iObserver; // not owned
+
+ // Pointer to requester
+ CMultiframeProvider* iRequester;
+
+ // For updating ViewFinder buffer
+ TImageShareDataBuffer iLocalBuffer;
+ // For updating remote buffer
+ TImageShareDataBuffer iRemoteBuffer;
+
+ // For updating remote buffer if activated when active
+ TImageShareDataBuffer iRemoteSecondBuffer;
+
+ // For updating ViewFinder buffer if activated when active
+ TImageShareDataBuffer iLocalSecondBuffer;
+
+ // Initialization flag
+ TBool iInit;
+
+ // Delta calc ref point
+ TTimeIntervalMicroSeconds iTime;
+
+ // VF update flag
+ TBool iVFUpdate;
+
+ // Id of thread whose active scheduler this instance is added into.
+ TThreadId iThreadId;
+
+ // A flag to indecate loop ao must be stopped
+ TBool iRequireStopping;
+ };
+
+#endif //C_MULTIFRAMEDATAAO_H
+
+// End of File
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframeloopao.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef C_MULTIFRAMELOOPAO_H
+#define C_MULTIFRAMELOOPAO_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CMultiframeProvider;
+
+// MACROS
+
+/**
+* @lib videosource.lib
+* Handles data looping in multi frame sharing case.
+*/
+NONSHARABLE_CLASS( CMultiframeloopAO ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aRequester" instance to requester
+ */
+ CMultiframeloopAO( CMultiframeProvider* aRequester );
+
+ /**
+ * Destructor.
+ */
+ ~CMultiframeloopAO();
+
+ /**
+ * Decreases number of free bitmaps
+ * @param "aCount" count how many bitmaps to be removed
+ */
+ void RemoveFreeBitmaps( TInt aCount );
+
+ /**
+ * Increases number of free bitmaps
+ * @param "aCount" count how many bitmaps to be increased
+ */
+ void SetFreeBitmaps( TInt aCount );
+
+ /**
+ * Cancels looping and completes request in correct thread.
+ */
+ void CancelDataLoop();
+
+ public: // New functions
+
+ /**
+ * Activates looping and completes request in correct thread.
+ */
+ void Signal( );
+
+ /**
+ * Sets frame count.
+ * @param "aCount" frame count
+ */
+ void SetFrameCount( TInt aCount );
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void DoCancel();
+
+ private: // Data
+
+ // Pointer to requester.
+ CMultiframeProvider* iRequester; // not owned
+
+ // Index of frame to be handled
+ TInt iIndex;
+
+ // Total nuber of frames
+ TInt iFramecount;
+
+ // Number of free bitmaps
+ TInt iFreeBMCount;
+
+ // Id of thread whose active scheduler this instance is added into.
+ TThreadId iThreadId;
+
+ // A flag to indecate loop ao must be stopped
+ TBool iRequireStopping;
+ };
+#endif //C_MULTIFRAMELOOPAO_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframeprovider.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,395 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef C_MULTIFRAMEPROVIDER_H
+#define C_MULTIFRAMEPROVIDER_H
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <gdi.h>
+#include "cactivewait.h"
+#include "cvtimagescaler.h"
+#include "mmultiframeprovider.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImageBitmap;
+class CImageDecoder;
+class CMultiframeloopAO;
+class TScalingMediator;
+class CMultiframeProvider;
+class CMultiframeDataAO;
+
+const TInt KFirstFrameIndx = 0;
+
+// CLASS DECLARATION
+// ============================ TScalingMediator ===============================
+/**
+* Internal implementation of still scaling mediator
+* @lib videosource.lib
+*/
+
+NONSHARABLE_CLASS( TScalingMediator) : public MVtImageScalerObserver
+ {
+ public :
+ TScalingMediator();
+ public :
+ /**
+ * @see MVtImageScalerObserver::ScalingFinished( TInt aError )
+ */
+ void ScalingFinished( TInt aError );
+
+ /**
+ * Sets waiter observer
+ */
+ void SetWaiter( CVSActiveWait< CMultiframeProvider >* aWait );
+ private :
+ CVSActiveWait< CMultiframeProvider >* iWait;
+ };
+
+
+// ============================ CMultiframeProvider ===============================
+/**
+* Internal implementation of multiframe provider
+* @lib videosource.lib
+*/
+NONSHARABLE_CLASS( CMultiframeProvider ) : public CBase
+ {
+
+ public : // Constructors and destructor
+
+ /**
+ * Static factory function create instance of this class.
+ * @param "aObserver" Pointer to data provider observer.
+ * @param aDisplayMode current display mode
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CMultiframeProvider* NewL( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode );
+
+ /**
+ * Destructor.
+ */
+ ~CMultiframeProvider();
+
+
+ public : // Functions from base classes
+
+ /**
+ * Initializes this instance from image or multiframe file.
+ * @param aFileName Name of the file from which this intance will be
+ * initialized.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void InitializeL( const TFileName* aFileName );
+
+ /**
+ * Cancel initialization of multiframe provider.
+ * @return ETrue if don't need to wait a error message.
+ */
+ TBool CancelInitializing();
+
+ /**
+ * Initializes this instance for blank image bitmap.
+ */
+ void IniatializeBlankL();
+
+ /**
+ * Initializes this instance for Generalsettings image bitmap.
+ */
+ void IniatializeGSL( const TGeneralSettingsImageType aType );
+ /**
+ * Sets ViewFinder size
+ * @param aSize size of target bitmap (view finder)
+ */
+ void SetVFScalingTargetSize( TSize aSize );
+
+ /**
+ * Decodes and scales initialized image or multiframe file
+ * @param aFrameindex index of frame to be decoded and scaled
+ */
+ void ConvertAndScaleL( TInt aFrameIndex );
+
+ /**
+ * Scales and copies decoded frame for view finder display
+ * @param aSize size of target bitmap ( view fiender )
+ */
+ void ScaleCopy( TSize& aSize, TBool aVFUpdate = EFalse );
+
+ /**
+ * Signals looping AO to proceed to next frame
+ */
+ void NextFrame();
+
+ /**
+ * Clears ViewFinder size
+ */
+ void ClearVFScalingTargetSize();
+
+ /**
+ * Increases number of data consumers by one
+ */
+ void IncreaseDataConsumer();
+
+ /**
+ * Decreases number of data consumers by one
+ * and if number is less than one it cancels data looping
+ * mechanism
+ */
+ void DecreaseDataConsumer();
+
+ /**
+ * Adds used bitmap to free queue
+ */
+ void AddBitmapToFreeQueue();
+
+ /**
+ * Indicates that second VF buffer needs to be used
+ */
+ void UseSecondVfBuffer();
+
+ /**
+ * Indicates that VF has been stopped
+ */
+ TBool IsVFStopped();
+
+ /**
+ * Set ViewFinder of Multiframe provider to stop
+ */
+ void SetVFStop();
+
+ /**
+ * Wait for converting function exit
+ */
+ void WaitForConverting();
+
+ /**
+ * Release converting flag
+ */
+ void ReleaseForConverting();
+
+ private : // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param "aObserver" Pointer to data provider observer.
+ * @param aDisplayMode current display mode
+ */
+ CMultiframeProvider( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode );
+
+ /**
+ * 2nd phase constructor.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void ConstructL();
+
+ /**
+ * Image conversion finished callback. This method is called when image
+ * conversion is done.
+ * @param "aError" Error code. KErrNone if no error happened, one of the
+ * system wide error codes.
+ * otherwise.
+ */
+ void ConversionFinished( TInt aError );
+
+ /**
+ * Image scaling finished callback. This method is called when image
+ * scaling is done.
+ * @param "aError" Error code. KErrNone if no error happened, one of
+ * the system wide error codes.
+ */
+ void BMSScalingFinished( TInt aError );
+
+ /**
+ * Scales VF to new size.
+ * @param "aSize" New VF size.
+ * the system wide error codes.
+ */
+ void ScaleVF( const TSize& aSize );
+
+ /**
+ * When view finder frame must be rescaled (wanted view finder size is
+ * neither QCIF nor QQQCIF) this callback will be called when the
+ * rescaling has finished.
+ * @param "aError" Error code. KErrNone if no error happened, one of
+ * the system wide error codes.
+ */
+ void VFRescalingFinished( TInt aError );
+
+ /**
+ * When view finder frames are rescaled this callback method will be
+ * called.
+ * @param "aError" Error code. KErrNone if no error happened, one of
+ * the system wide error codes.
+ */
+ void VFScalingReady();
+
+ /**
+ * Creates blank bitmap with given size, color mode and color.
+ * @param "aBitmap" Bitmap pointer reference into which pointer to new
+ * isntance will be copied.
+ * @param "aSize" Size of the blank bitmap to be created.
+ * @param "aMode" Color mode for created bitmap.
+ * @param "aColor" Color of created bitmap.
+ * @exception Can leave with one of the system wide error codes.
+ */
+ void CreateBlankBitmapL( CFbsBitmap*& aBitmap, const TSize& aSize, const TDisplayMode& aMode, const TRgb& aColor );
+
+ public : // Data
+
+ TBool iAnimation;
+
+ TBool iConvertAndScale;
+
+ protected: // Data
+
+ RCriticalSection iFreezeCS;
+
+ private : //Data
+
+
+ // Source image for CVtImageScaler
+ CVtImageBitmap* iConverted;
+
+ // Target image for CVtImageScaler
+ CVtImageBitmap* iScaled;
+ CVtImageBitmap* iBuffer1;
+ CVtImageBitmap* iBuffer2;
+
+ // Pointer to remote image
+ CVtImageBitmap* iYUVBitMap;
+
+ // Pointer to QCIF sized view finder image
+ CVtImageBitmap* iVFbitmap;
+ CVtImageBitmap* iFirstVfBuf;
+ CVtImageBitmap* iSecondVfBuf;
+
+ // Boolean values of VF buffer validation
+ TBool iSecondVFBuffer;
+ TBool iFirstVFBuffer;
+
+ // Pointer to bitmap loaded from GS
+ CVtImageBitmap* iGSBitmap;
+
+ // Pointer to selected view finder image
+ CVtImageBitmap* iVFCurrent;
+
+ // Viewer AO instance
+ CMultiframeloopAO* iLoopAo;// owned
+
+ // Initalisation scaling mediator
+ TScalingMediator iInitMediator;
+
+ // ViewFinder scaling scaling mediator
+ TScalingMediator iScalingMediator;
+
+ // Waiter instance for initialisation
+ CVSActiveWait< CMultiframeProvider >* iActiveWaitInit;// owned
+
+ // Waiter instance for scaling
+ CVSActiveWait< CMultiframeProvider >* iActiveWaitScale;// owned
+
+ // Waiter instance for scaling
+ CVSActiveWait< CMultiframeProvider >* iActiveWaitInitScale; // owned
+
+ // VT image scaler instance for initialisation
+ CVtImageScaler* iVtImageScalerInit; // owned
+
+ // VT image scaler instance for scaling
+ CVtImageScaler* iVtImageScalerScale; // owned
+
+ // Image decoder instance
+ CImageDecoder* iImageDecoder; // owned
+
+ // Wanted view finder size
+ TSize iWantedVFSize;
+
+ // FireServer session instance
+ RFs iFs;
+
+ // Current display mode
+ TDisplayMode iDisplayMode;
+
+ // Rescaling recuirement flag
+ TBool iVFRescalingRequired;
+
+ // Multiframe observer instance
+ MMultiframeprovider* iObserver;
+
+ // VF bitmap size
+ TSize iTargetSize;
+
+ // Is blank image share
+ TBool iBlank;
+
+ // Is GS image share
+ TBool iGSImage;
+
+ // Is second bitmap in use
+ TBool iOldBM;
+
+ // Pointer to old bitmap
+ CVtImageBitmap* iOldBitmap;
+
+ // Frame count
+ TInt iCount;
+
+ // Is initialization ongoing flag
+ TBool iInitialization;
+
+ // Frame delay
+ TTimeIntervalMicroSeconds iDelay;
+
+ // Start time for image conversion
+ TTime iStartTime;
+
+ // Data timer expiration / Frame update time
+ TTimeIntervalMicroSeconds iFrameUpdateTime;
+
+ // Pointer to data timer AO
+ CMultiframeDataAO* iDataTimer;
+
+ // Number of data consumers
+ TInt iNumOfConsumers;
+
+ // Queue for bitmaps that are free for use
+ RPointerArray<CVtImageBitmap> iFreeQueue;
+
+ // Pointer to bitmap mask
+ CFbsBitmap* iMask;
+
+ // Pointer to temporary bitmap
+ CVtImageBitmap* iTempBM;
+
+ TSize iVFSize;
+
+ // Boolean value of VF buffer update
+ TBool iVFUpdate;
+
+ // file handle to default VT image
+ RFile iDefaultImageFile;
+ // Boolean value of VF buffer stopping
+ TBool iIsVfStopped;
+
+ // Boolean value of VF buffer stopping
+ TBool iWaitForConverting;
+ };
+
+#endif // C_MULTIFRAMEPROVIDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/mmultiframeprovider.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+#ifndef M_MULTIFRAMEPROVIDER_H
+#define M_MULTIFRAMEPROVIDER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CVtImageBitmap;
+
+// ============================ TImageShareDataBuffer ===============================
+/**
+* Share buffer class
+* @lib videosource.lib
+*/
+NONSHARABLE_CLASS( TImageShareDataBuffer)
+ {
+ public :
+ CVtImageBitmap* iBitmap;
+ TBool iIsBitmapFree;
+ };
+
+ // General Settings image type
+ enum TGeneralSettingsImageType
+ {
+ EGSStillImage,
+ EGSDefaultStillImage
+ };
+
+// ============================ MMultiframeprovider ===============================
+/**
+* Multiframe observer API
+* Interface for receiving data and acknowledgements from multiframe provider.
+* @lib videosource.lib
+*/
+class MMultiframeprovider
+ {
+ public:
+ /**
+ * Indicates when initialization of multiframeprovider has finished
+ */
+ virtual void InitializeReady() = 0;
+
+ /**
+ * Refresh YUV data
+ * @param "aYUVBitMap" reference new YUV data.
+ */
+ virtual void RefreshYUVData( TImageShareDataBuffer& aYUVBitMap ) = 0;
+
+ /**
+ * Refresh VF data
+ * @param "aVFBitMap" reference new VF data.
+ */
+ virtual void RefreshViewFinder( TImageShareDataBuffer& aVFBitMap ) = 0;
+
+ /**
+ * Notifies if error occures in multiframeprovider
+ * @param "aError" symbian wide error code.
+ */
+ virtual void NotifyImageHandlingError( TInt aError ) = 0;
+
+ };
+#endif //M_MULTIFRAMEPROVIDER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/rom/VideoSource.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002 - 2007 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:
+* IBY file for VideoSource
+*
+*
+*/
+
+
+#ifndef __VIDEOSOURCE_IBY__
+#define __VIDEOSOURCE_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+file=ABI_DIR\BUILD_DIR\VideoSource.dll SHARED_LIB_DIR\VideoSource.dll
+
+// Enabler for eclipsing ROM binary
+data=ZSYSTEM\install\videosource_stub.sis system\install\videosource_stub.sis
+
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSCameraDataProvider.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,864 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVSCameraDataProvider.h"
+#include "CVSOnboardCameraDataProvider.h"
+#include "VSPanic.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+static const TReal32 KFrameRate = 15.0;
+static const TInt KFrozenFrameBufferSize = ( KQcifWidth * KQcifHeight ) + ( KQcifWidth * KQcifHeight ) / 2;
+static const TInt KCCameraPriority = 80;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================= CVsFrameBuffer ================================
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::NewL( TInt aSize )
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVsFrameBuffer* CVsFrameBuffer::NewL( TInt aSize )
+ {
+ CVsFrameBuffer* self = new ( ELeave ) CVsFrameBuffer();
+ CleanupStack::PushL( self );
+ self->ConstructL( aSize );
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::~CVsFrameBuffer()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVsFrameBuffer::~CVsFrameBuffer()
+ {
+ delete iBuffer;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyProperties( MFrameBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyProperties( MFrameBuffer* aSource )
+ {
+ MFrameBuffer::iIndexOfFirstFrameInBuffer = aSource->iIndexOfFirstFrameInBuffer;
+ MFrameBuffer::iElapsedTime = aSource->iElapsedTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyProperties( MCameraBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyProperties( MCameraBuffer* aSource )
+ {
+ MCameraBuffer::iIndexOfFirstFrameInBuffer = aSource->iIndexOfFirstFrameInBuffer;
+ MCameraBuffer::iElapsedTime = aSource->iElapsedTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyFrameL( MFrameBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyFrameL( MFrameBuffer* aSource )
+ {
+ iPtr = *( aSource->DataL( 0 ) );
+ CopyProperties( aSource );
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyFrameL( MCameraBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyFrameL( MCameraBuffer* aSource )
+ {
+ iPtr = *( aSource->DataL( 0 ) );
+ CopyProperties( aSource );
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::DataL( TInt aIndex )
+// -----------------------------------------------------------------------------
+//
+TDesC8* CVsFrameBuffer::DataL( TInt aIndex )
+ {
+ if( aIndex != 0 )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ return &iPtr;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::FrameL( TInt aIndex )
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CVsFrameBuffer::FrameL( TInt aIndex )
+ {
+ ( void ) aIndex;
+ User::Leave( KErrNotSupported );
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::Release()
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::Release()
+ {
+ // Nothing to do
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::FrameSize()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::FrameSize( TInt /*aFrameIndex*/ )
+ {
+ return KErrNotSupported;
+ }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ChunkOffsetL()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::ChunkOffsetL( TInt /*aFrameIndex*/ )
+ {
+ User::Leave( KErrNotSupported );
+ return KErrNotSupported;
+ }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ChunkL()
+// -----------------------------------------------------------------------------
+//
+RChunk& CVsFrameBuffer::ChunkL()
+ {
+ User::Leave( KErrNotSupported );
+ RChunk* help = NULL;
+ return *help;
+ }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::BitmapL()
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap& CVsFrameBuffer::BitmapL(TInt /*aFrameIndex*/ )
+ {
+ CFbsBitmap* helpbit = new (ELeave) CFbsBitmap;
+ CleanupStack::PushL( helpbit );
+ User::Leave( KErrNotSupported );
+ CleanupStack::Pop( helpbit );
+ delete helpbit;
+ return *helpbit;
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::NumFrames()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::NumFrames()
+ {
+ return KErrNotSupported;
+ }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CVsFrameBuffer()
+// -----------------------------------------------------------------------------
+//
+CVsFrameBuffer::CVsFrameBuffer()
+: iPtr( 0, 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ConstructL( TInt aSize )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::ConstructL( TInt aSize )
+ {
+ iBuffer = HBufC8::NewL( aSize );
+ iPtr.Set( iBuffer->Des() );
+ }
+
+// ========================= CVSCameraDataProvider =============================
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider* CVSCameraDataProvider::NewL(
+ MVSDataProviderObserver* aObserver,
+ TInt aProviderIndex,
+ MVSBufferPool* aPool )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::NewL() >>"), RThread().Id().operator TUint()));
+ CVSCameraDataProvider* self =
+ new (ELeave) CVSOnboardCameraDataProvider( aObserver, aPool );
+ CleanupStack::PushL( self );
+ self->ConstructL( aProviderIndex );
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::~CVSCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider::~CVSCameraDataProvider()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::~CVSCameraDataProvider() >>"), RThread().Id().operator TUint()));
+ delete iFrozenFrame;
+ delete iFrozenVFFrameCopy;
+ delete iSource;
+ delete iFrozenVFFrameToBeSent;
+ delete iTarget;
+ delete iScaler;
+ delete iCamImgProc;
+ if ( &Camera() != NULL )
+ {
+ Camera().Release();
+ }
+ delete iCamera;
+ iFreezeCS.Close();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::~CVSCameraDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::InitializeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::InitializeL( const TDesC8& /*aInitParams*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+ Camera().Reserve();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::DigitalZoomFactor
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::DigitalZoomFactor() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::DigitalZoomFactor() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::DigitalZoomFactor() <<"), RThread().Id().operator TUint()));
+ return Camera().DigitalZoomFactor();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetDigitalZoomFactorL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetDigitalZoomFactorL( TInt aDigitalZoomFactor)
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetDigitalZoomFactorL() >>"), RThread().Id().operator TUint()));
+ Camera().SetDigitalZoomFactorL( aDigitalZoomFactor );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetDigitalZoomFactorL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( !(info.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ if( IsFrozen()&& iHasFrozenVFFrameCopyCreated )
+ {
+ ScaleFrozenBitmapL( aSize );
+ }
+ Camera().StartViewFinderBitmapsL( aSize );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderBitmapsL( TSize&, TRect& )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StopViewFinder
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StopViewFinder()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StopViewFinder() >>"), RThread().Id().operator TUint()));
+ Camera().StopViewFinder();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StopViewFinder() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderActive
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::ViewFinderActive() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderActive() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderActive() <<"), RThread().Id().operator TUint()));
+ return Camera().ViewFinderActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderDirectL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderDirectL( RWsSession&,
+ CWsScreenDevice&, RWindowBase&, TRect& )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderDirectL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderDirectL( RWsSession&,
+ CWsScreenDevice&, RWindowBase&, TRect&, TRect& )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ProviderInfo
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfo() >>"), RThread().Id().operator TUint()));
+ Camera().CameraInfo( static_cast< TCameraInfo& >( aInfo ) );
+ aInfo.iFreezeSupported = ETrue;
+ TRAP_IGNORE( ProviderInfoExL( aInfo ) );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfo() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetViewFinderMirrorL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetViewFinderMirrorL( TBool aMirror )
+ {
+ Camera().SetViewFinderMirrorL( aMirror );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderMirror
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::ViewFinderMirror() const
+ {
+ return Camera().ViewFinderMirror();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::FreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::FreezeL()
+ {
+ iFreezeCS.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeL() >>"), RThread().Id().operator TUint()));
+ if( !IsFrozen() )
+ {
+ iFrozen = ETrue;
+ iFrozenVfFrameReady = EFalse;
+ iFreezePendingFlags = EViewFinderFreezePending | EVideoFrameFreezePending;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeL() <<"), RThread().Id().operator TUint()));
+ iFreezeCS.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::UnfreezeL()
+ {
+ iFreezeCS.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::UnfreezeL() >>"), RThread().Id().operator TUint()));
+ if( IsFrozen() )
+ {
+ iFrozen = EFalse;
+ iFreezePendingFlags = 0;
+ iHasFrozenVFFrameCopyCreated = EFalse;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::UnfreezeL() <<"), RThread().Id().operator TUint()));
+ iFreezeCS.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::IsFrozen() const
+ {
+ return iFrozen;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ImageReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ImageReady(
+ CFbsBitmap* /*aBitmap*/, HBufC8* /*aData*/, TInt /*aError*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageReady() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::PowerOnComplete
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::PowerOnComplete( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::PowerOnComplete() >>"), RThread().Id().operator TUint()));
+ if ( !iPowerOnComplete )
+ {
+ if ( aError == KErrNone )
+ {
+ iPowerOnComplete = ETrue;
+ iCameraHandle = Camera().Handle();
+ // Setup ECAM so that the returned image is ok even if view finder
+ // is asked before video
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( !(info.iOptionsSupported &
+ TCameraInfo::EViewFinderBitmapsSupported) )
+ {
+ NotifyError( KErrNotSupported );
+ return; // End debug print is missed
+ }
+ TInt sizeIndex, rateIndex;
+ sizeIndex = rateIndex = 0;
+ for (
+ sizeIndex = 0;
+ sizeIndex < info.iNumVideoFrameSizesSupported;
+ sizeIndex++ )
+ {
+ TSize size;
+ Camera().EnumerateVideoFrameSizes(
+ size,
+ sizeIndex,
+ CCamera::EFormatYUV420Planar );
+ if ( size == TSize( KQcifWidth, KQcifHeight ) )
+ {
+ TReal32 rate;
+ for (
+ rateIndex = 0;
+ rateIndex < info.iNumVideoFrameRatesSupported;
+ rateIndex++ )
+ {
+ Camera().EnumerateVideoFrameRates(
+ rate,
+ rateIndex,
+ CCamera::EFormatYUV420Planar,
+ sizeIndex );
+ if ( KFrameRate == rate )
+ {
+ TRAPD(
+ err,
+ Camera().PrepareVideoCaptureL(
+ CCamera::EFormatYUV420Planar,
+ sizeIndex,
+ rateIndex,
+ 2,
+ 1) );
+ if ( err != KErrNone )
+ {
+ NotifyError( err );
+ return; // End debug print is missed
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ Observer().vsProviderReady();
+ }
+ else
+ {
+ NotifyError( aError );
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::PowerOnComplete() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderFrameReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ViewFinderFrameReady( CFbsBitmap& aFrame )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderFrameReady() >>"), RThread().Id().operator TUint()));
+ if( iFreezePendingFlags & EViewFinderFreezePending )
+ {
+ FreezeViewFinderFrame( aFrame );
+ }
+ if( IsFrozen() && !( iFreezePendingFlags & EViewFinderFreezePending ) && iFrozenVfFrameReady )
+ {
+ Observer().vsViewFinderFrameReady( *iFrozenVFFrameToBeSent );
+ }
+ else if( !IsFrozen() )
+ {
+ Observer().vsViewFinderFrameReady( aFrame );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderFrameReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ImageBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/)
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageBufferReady() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageBufferReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ScalingFinished
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ScalingFinished( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScalingFinished() >>"), RThread().Id().operator TUint()));
+ if( aError == KErrNone )
+ {
+ iFrozenVfFrameReady = ETrue;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScalingFinished() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::CVSCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider::CVSCameraDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool ) :
+ CVSDataProvider( aObserver, aPool )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ConstructL( TInt aProviderIndex )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+ CVSDataProvider::ConstructL();
+ // New CCamera API imp
+ // Check which API is suported
+ TRAPD( error, iCamera =
+ CCamera::New2L( *this, aProviderIndex, KCCameraPriority ) );
+ // try to create using API
+ if ( error )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() New2L failed, using NewL instead"), RThread().Id().operator TUint()));
+ iCamera = CCamera::NewL( *this, aProviderIndex );
+ }
+ iFrozenVFFrameCopy = new ( ELeave ) CFbsBitmap();
+ iFrozenVFFrameToBeSent = new ( ELeave ) CFbsBitmap();
+ iScaler = CVtImageScaler::NewL( *this );
+ iFrozenFrame = CVsFrameBuffer::NewL( KFrozenFrameBufferSize );
+
+ iHasFrozenVFFrameCopyCreated = EFalse;
+
+ // Camera image processing
+ TRAP( error, iCamImgProc =
+ CCamera::CCameraImageProcessing::NewL( *iCamera ) );
+ User::LeaveIfError( iFreezeCS.CreateLocal() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::FreezeViewFinderFrame
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::FreezeViewFinderFrame( CFbsBitmap& aFrame )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeViewFinderFrame() >>"), RThread().Id().operator TUint()));
+
+ TSize frameSize( aFrame.SizeInPixels() );
+
+ TUint scanlineLength( CFbsBitmap::ScanLineLength( frameSize.iWidth, aFrame.DisplayMode() ) );
+
+ TInt result = iFrozenVFFrameCopy->Create( frameSize, aFrame.DisplayMode() );
+
+ if( result != KErrNone )
+ {
+ Observer().vsProviderError( result );
+ return;
+ }
+
+ iFrozenVFFrameCopy->LockHeap();
+ const TUint8* source = reinterpret_cast< TUint8* >( aFrame.DataAddress() );
+ TUint8* dest = reinterpret_cast< TUint8* >( iFrozenVFFrameCopy->DataAddress() );
+ for( TInt y = frameSize.iHeight - 1; y >= 0; y-- )
+ {
+ Mem::Copy( dest, source, scanlineLength );
+ dest += scanlineLength;
+ source += scanlineLength;
+ }
+ iFrozenVFFrameCopy->UnlockHeap();
+ TRAP( result, ScaleFrozenBitmapL( frameSize ) );
+ iFreezePendingFlags &= ~EViewFinderFreezePending;
+ iHasFrozenVFFrameCopyCreated = ETrue;
+ if( result != KErrNone )
+ {
+ Observer().vsProviderError( result );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeViewFinderFrame() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ScaleFrozenBitmapL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ScaleFrozenBitmapL( TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScaleFrozenBitmapL() >>"), RThread().Id().operator TUint()));
+ iFrozenVfFrameReady = EFalse;
+ delete iSource; iSource = 0;
+ iSource = CVtImageBitmap::NewL( iFrozenVFFrameCopy->Handle() );
+ User::LeaveIfError( iFrozenVFFrameToBeSent->Create( aSize, iFrozenVFFrameCopy->DisplayMode() ) );
+ delete iTarget; iTarget = 0;
+ iTarget = CVtImageBitmap::NewL( iFrozenVFFrameToBeSent->Handle() );
+ iScaler->Cancel();
+ iScaler->ScaleL( *iSource, *iTarget );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScaleFrozenBitmapL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ProviderInfoExL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ProviderInfoExL( TVSDataProviderInfo& aInfo )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() >>"), RThread().Id().operator TUint()));
+ aInfo.iSupportedColorTones = CCamera::CCameraImageProcessing::EEffectNone;
+ // Check if colortone is suported and set colortone values
+ if ( iCamImgProc )
+ {
+ RArray< TUid > uids;
+ CleanupClosePushL( uids );
+ iCamImgProc->GetSupportedTransformationsL( uids );
+ if ( uids.Find( KUidECamEventImageProcessingEffect ) != KErrNotFound )
+ {
+ TValueInfo type;
+ RArray< TInt > values;
+ CleanupClosePushL( values );
+ iCamImgProc->GetTransformationSupportedValuesL(
+ KUidECamEventImageProcessingEffect, values, type );
+ if ( ( type == EBitField ) && ( values.Count() > 0 ) )
+ {
+ aInfo.iSupportedColorTones = values[ 0 ];
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() valueType is NOT bitfield, fix me"), RThread().Id().operator TUint()));
+ }
+ CleanupStack::PopAndDestroy(); // values.Close()
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() camera image processing not supported"), RThread().Id().operator TUint()));
+ }
+ CleanupStack::PopAndDestroy(); // uids.Close()
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetContrastL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetContrastL( TInt aContrast )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetContrastL() >>"), RThread().Id().operator TUint()));
+ Camera().SetContrastL(aContrast);
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetContrastL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetContrast
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetContrast( TInt& aContrast ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() >>"), RThread().Id().operator TUint()));
+ TInt result( KErrNotSupported );
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( info.iOptionsSupported & TCameraInfo::EContrastSupported )
+ {
+ aContrast = Camera().Contrast();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() %d"), RThread().Id().operator TUint(), aContrast));
+ result = KErrNone;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() <<"), RThread().Id().operator TUint()));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetBrightnessL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetBrightnessL( TInt aBrightness )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetBrightnessL() >>"), RThread().Id().operator TUint()));
+ Camera().SetBrightnessL( aBrightness );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetBrightnessL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetBrightness
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetBrightness( TInt& aBrightness ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() >>"), RThread().Id().operator TUint()));
+ TInt result( KErrNotSupported );
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( info.iOptionsSupported & TCameraInfo::EBrightnessSupported )
+ {
+ aBrightness = Camera().Brightness();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() %d"), aBrightness));
+ result = KErrNone;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() <<"), RThread().Id().operator TUint()));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetWhiteBalanceL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetWhiteBalanceL( CCamera::TWhiteBalance
+ aWhiteBalance )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetWhiteBalanceL() >>"), RThread().Id().operator TUint()));
+ Camera().SetWhiteBalanceL( aWhiteBalance );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetWhiteBalanceL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetWhiteBalance
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetWhiteBalance( CCamera::TWhiteBalance&
+ aWhiteBalance) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetWhiteBalance() >>"),RThread().Id().operator TUint() ) );
+ aWhiteBalance = Camera().WhiteBalance();
+ __IF_DEBUG(Print(_L("WhiteBalance[%d]: CVSCameraDataProvider::GetWhiteBalance() %d"), aWhiteBalance ) );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetWhiteBalance() <<"), RThread().Id().operator TUint() ) );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetColorToneL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetColorToneL(
+ CCamera::CCameraImageProcessing::TEffect aValue )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() >>"), RThread().Id().operator TUint()));
+ if ( iCamImgProc )
+ {
+ iCamImgProc->SetTransformationValue( KUidECamEventImageProcessingEffect, aValue );
+ }
+ else
+ {
+ //Set colortone that is not suported -> Leave
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() LEAVE"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetColorTone
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetColorTone(
+ CCamera::CCameraImageProcessing::TEffect& aColorTone ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() >>"), RThread().Id().operator TUint()));
+ TInt result( KErrNotSupported );
+ if ( iCamImgProc )
+ {
+ aColorTone =
+ static_cast< CCamera::CCameraImageProcessing::TEffect >(
+ iCamImgProc->TransformationValue(
+ KUidECamEventImageProcessingEffect ) );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() %d"), RThread().Id().operator TUint(), aColorTone));
+ result = KErrNone;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() <<"), RThread().Id().operator TUint()));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::CancelInitializing
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::CancelInitializing()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::CancelInitializing() >>"), RThread().Id().operator TUint()));
+ //There is a blank implemention.
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::CancelInitializing() <<"), RThread().Id().operator TUint()));
+ return;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSController.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSController::CVSController()
+// -----------------------------------------------------------------------------
+//
+CVSController::CVSController()
+ {
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSControllerImp.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+
+#include "CVSControllerImp.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panics current thread.
+// -----------------------------------------------------------------------------
+//
+void Panic( TVSPanic aPanicCode )
+ {
+ User::Panic( KVSPanicCategory(), aPanicCode );
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSController::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSController* CVSController::NewL( MVSControllerObserver* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() entering")));
+ if ( aObserver == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+ CVSController* self = CVSControllerImp::NewL();
+ CleanupStack::PushL( self );
+ self->ConstructL( aObserver );
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() returning")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSControllerImp::ConstructL( MVSControllerObserver* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() entering")));
+ iObserver = aObserver;
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() returning")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::NewL
+// -----------------------------------------------------------------------------
+//
+CVSControllerImp* CVSControllerImp::NewL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() entering")));
+ CVSControllerImp* self = new (ELeave) CVSControllerImp;
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() returning")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::~CVSControllerImp
+// -----------------------------------------------------------------------------
+//
+CVSControllerImp::~CVSControllerImp()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() entering")));
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() returning")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::CreateDataSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSource* CVSControllerImp::CreateDataSourceL( MVSDataSourceObserver* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() entering")));
+ CVSDataSource* p = CVSDataSource::NewSourceL( aObserver );
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() returning")));
+ return p;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ProvidersAvailable
+// -----------------------------------------------------------------------------
+//
+TInt CVSControllerImp::ProvidersAvailable()
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() entering")));
+ TInt count = CVSDataProvider::ProvidersAvailable();
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() returning")));
+ return count;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ProviderInfoL
+// -----------------------------------------------------------------------------
+//
+void CVSControllerImp::ProviderInfoL(
+ TInt aProviderIndex,
+ TVSDataProviderInfo& aInfo )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() entering")));
+ if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
+ {
+ User::Leave( KErrNotSupported );
+ }
+ CVSDataProvider::ProviderInfoL( aProviderIndex, aInfo );
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() returning")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::CreateDataProviderL
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVSControllerImp::CreateDataProviderL(
+ TInt aProviderIndex,
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() entering")));
+ if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
+ {
+ User::Leave( KErrArgument );
+ }
+ if ( aObserver == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+ CVSDataProvider* p =
+ CVSDataProvider::NewL( aProviderIndex, aObserver, aPool );
+ __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() returning")));
+ return p;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSDataProvider.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include <badesca.h>
+#include <e32svr.h>
+#include <featmgr.h>
+#include "CApiVideoSource.h"
+#include "CVSCameraDataProvider.h"
+#include "CVSStillImageDataProvider.h"
+#include "CVSOnboardCameraDataProvider.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+class TSizeCount
+ {
+ public:
+ TInt iCount;
+ TSize iSize;
+ };
+
+class TRateCount
+ {
+ public:
+ TInt iCount;
+ TReal32 iRate;
+ };
+
+// LOCAL FUNCTION PROTOTYPES
+
+static TInt TSizeCountTLinearOrderFunc(
+ const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
+static TBool TSizeCountTIdentityRelationFunc(
+ const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
+static TInt TRateCountTLinearOrderFunc(
+ const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
+static TBool TRateCountTIdentityRelationFunc(
+ const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSizeCountTLinearOrderFunc: Used in RArray<TSizeCount)::InsertInOrder
+// -----------------------------------------------------------------------------
+//
+static TInt TSizeCountTLinearOrderFunc(
+ const TSizeCount& aSizeCount1,
+ const TSizeCount& aSizeCount2 )
+ {
+ if ( aSizeCount1.iSize == aSizeCount2.iSize )
+ {
+ return 0;
+ }
+ else
+ {
+ // It is assumed that width and height fit in 16-bit, if they don't,
+ // use TInt64
+ TInt32 s1 =
+ ( aSizeCount1.iSize.iWidth & 0xffff ) << 16 |
+ ( aSizeCount1.iSize.iHeight & 0xffff );
+ TInt32 s2 =
+ ( aSizeCount2.iSize.iWidth & 0xffff ) << 16 |
+ ( aSizeCount2.iSize.iHeight & 0xffff );
+ return s1 - s2;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TSizeCountTIdentityRelationFunc: Used in RArray<TSizeCount)::Find
+// -----------------------------------------------------------------------------
+//
+static TBool TSizeCountTIdentityRelationFunc(
+ const TSizeCount& aSizeCount1,
+ const TSizeCount& aSizeCount2 )
+ {
+ if ( aSizeCount1.iSize == aSizeCount2.iSize )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TRateCountTLinearOrderFunc: Used in RArray<TRateCount)::InsertInOrder
+// -----------------------------------------------------------------------------
+//
+static TInt TRateCountTLinearOrderFunc(
+ const TRateCount& aRateCount1,
+ const TRateCount& aRateCount2 )
+ {
+ if ( aRateCount1.iRate > aRateCount2.iRate )
+ {
+ return 1;
+ }
+
+ if ( aRateCount1.iRate < aRateCount2.iRate )
+ {
+ return -1;
+ }
+
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// TRateCountTIdentityRelationFunc: Used in RArray<TRateCount)::Find
+// -----------------------------------------------------------------------------
+//
+static TBool TRateCountTIdentityRelationFunc(
+ const TRateCount& aRateCount1,
+ const TRateCount& aRateCount2 )
+ {
+ if ( aRateCount1.iRate == aRateCount2.iRate )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVSDataProvider::NewL(
+ TInt aProviderIndex,
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() [aProviderIndex = %d] >>"), RThread().Id().operator TUint(), aProviderIndex));
+
+ CVSDataProvider* self = NULL;
+
+ // Is it ecam
+ TInt count = CamerasAvailable();
+
+ // < 0 == error
+ if( count < 0 )
+ {
+ User::Leave( count );
+ }
+
+ if ( aProviderIndex < count )
+ {
+ self = CVSCameraDataProvider::NewL( aObserver, aProviderIndex, aPool );
+ }
+ else
+ {
+ // Is it still image
+ count += 1;
+
+ if ( aProviderIndex == ( count - 1) )
+ {
+ self = CVSStillImageDataProvider::NewL( aObserver, aPool );
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::~CVSDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider::~CVSDataProvider()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() >>"), RThread().Id().operator TUint()));
+ delete iErrorNotifier;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ProvidersAvailable
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataProvider::ProvidersAvailable()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() >>"), RThread().Id().operator TUint()));
+
+ // Count ecams
+ TInt numProviders = CamerasAvailable();
+
+ // < 0 == error
+ if ( numProviders < 0 )
+ {
+ numProviders = 1; // only still image provider
+ }
+ else
+ {
+ numProviders += 1; // add still
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() [numProviders = %d] <<"), RThread().Id().operator TUint(), numProviders));
+
+ return numProviders;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ProviderInfoL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ProviderInfoL(
+ TInt aProviderIndex,
+ TVSDataProviderInfo& aInfo )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() >>"), RThread().Id().operator TUint()));
+ CVSDataProvider* provider = NewL( aProviderIndex, NULL, NULL);
+ provider->ProviderInfo( aInfo );
+ delete provider;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::SetFillBufferParams
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::SetFillBufferParams(
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId )
+ {
+ iConsumer = aConsumer;
+ iMediaId = aMediaId;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::NotifyError
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::NotifyError( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() >>"), RThread().Id().operator TUint()));
+ iErrorNotifier->NotifyError( &Observer(), aError );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::CVSDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider::CVSDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool ) :
+ iObserver( aObserver ),
+ iPool ( aPool )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+ iErrorNotifier = CProviderErrorNotifierAO::NewL();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::TimeToPlay
+// -----------------------------------------------------------------------------
+//
+const TTimeIntervalMicroSeconds& CVSDataProvider::TimeToPlay()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() >>"), RThread().Id().operator TUint()));
+
+ TTime now;
+ now.HomeTime();
+
+ TTimeIntervalMicroSeconds timeToPlay( now.MicroSecondsFrom( iStartTime ) );
+
+ if( timeToPlay <= iPreviousTimeToPlay )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay(): *WARNING* Time warp backwards! Correcting.."), RThread().Id().operator TUint()));
+ iPreviousTimeToPlay =
+ TTimeIntervalMicroSeconds( iPreviousTimeToPlay.Int64() + 1 );
+ }
+ else
+ {
+ iPreviousTimeToPlay = timeToPlay;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() <<"), RThread().Id().operator TUint()));
+ return iPreviousTimeToPlay;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ResetStartTime
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ResetStartTime()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() >>"), RThread().Id().operator TUint()));
+ iStartTime.HomeTime();
+ iPreviousTimeToPlay = iStartTime.MicroSecondsFrom( iStartTime );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::CamerasAvailable()
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataProvider::CamerasAvailable()
+ {
+ TRAPD( result, FeatureManager::InitializeLibL() );
+
+ if( result != KErrNone )
+ {
+ return result;
+ }
+
+ TInt count( 0 );
+
+ if( FeatureManager::FeatureSupported( KFeatureIdCamera ) )
+ {
+ count = CCamera::CamerasAvailable();
+ }
+
+ FeatureManager::UnInitializeLib();
+
+ return count;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::SwitchFrom
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::SwitchFrom( const CVSDataProvider& anOldProvider )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() >>"), RThread().Id().operator TUint()));
+ iStartTime = anOldProvider.iStartTime;
+ iPreviousTimeToPlay = anOldProvider.iPreviousTimeToPlay;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameFormatsL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameFormatsL(
+ CDesC8Array* aSupportedFormats )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() >>"), RThread().Id().operator TUint()));
+ TInt providerCount = ProvidersAvailable();
+ TInt countOfProvidersThatSupportYUV420Planar = 0;
+ for ( TInt i = 0; i < providerCount; i++ )
+ {
+ TVSDataProviderInfo info;
+ ProviderInfoL( i, info );
+ if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+ {
+ countOfProvidersThatSupportYUV420Planar++;
+ }
+ }
+ if( providerCount > 0 &&
+ providerCount <= countOfProvidersThatSupportYUV420Planar )
+ {
+ aSupportedFormats->AppendL( KVtVideoMIMETypeYUV420 );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameSizesL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameSizesL(
+ RArray<TSize>& aSupportedSizes,
+ const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() >>"), RThread().Id().operator TUint()));
+ CleanupClosePushL( aSupportedSizes );
+ RArray<TSizeCount> sizeCountArray;
+ CleanupClosePushL( sizeCountArray );
+ TInt providerCount = ProvidersAvailable();
+ for ( TInt i = 0; i < providerCount; i++ )
+ {
+ CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
+ CleanupStack::PushL( p );
+ TVSDataProviderInfo info;
+ ProviderInfoL( i, info );
+ for ( TInt j = 0; j < info.iNumVideoFrameSizesSupported; j++ )
+ {
+ TSize size;
+ p->GetVideoFrameSize( size, j, aFormat );
+ if ( size != TSize(0,0) )
+ {
+ TSizeCount sizeCount;
+ sizeCount.iCount = 1;
+ sizeCount.iSize = size;
+ TInt err = sizeCountArray.InsertInOrder(
+ sizeCount,
+ TLinearOrder<TSizeCount>( TSizeCountTLinearOrderFunc ) );
+ if ( err == KErrAlreadyExists )
+ {
+ TInt idx = sizeCountArray.Find(
+ sizeCount,
+ TIdentityRelation<TSizeCount>(
+ TSizeCountTIdentityRelationFunc ) );
+ if ( idx == KErrNotFound )
+ {
+ User::Leave( KErrUnknown );
+ }
+ else
+ {
+ // Increment count of providers that supports the size
+ sizeCountArray[idx].iCount++;
+ }
+ }
+ else
+ {
+ User::LeaveIfError( err );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(); // p
+ }
+ aSupportedSizes.Reset();
+ for ( TInt k = 0; k < sizeCountArray.Count(); k++ )
+ {
+ // Do all providers support the size
+ if ( providerCount > 0 && providerCount <= sizeCountArray[k].iCount )
+ {
+ User::LeaveIfError(
+ aSupportedSizes.Append( sizeCountArray[k].iSize ) );
+ }
+ }
+ CleanupStack::PopAndDestroy(); // sizeCountArray
+ CleanupStack::Pop(); // aSupportedSizes
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameRatesL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameRatesL(
+ RArray<TReal32>& aSupportedRates,
+ const TDesC8& aFormat,
+ const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() >>"), RThread().Id().operator TUint()));
+ CleanupClosePushL( aSupportedRates );
+ RArray<TRateCount> rateCountArray;
+ CleanupClosePushL( rateCountArray );
+ TInt providerCount = ProvidersAvailable();
+ __IF_DEBUG(Print(_L(" LOOKING FOR COMMON SUPPORTED RATES, PROVIDER COUNT: %d"), providerCount));
+ for ( TInt i = 0; i < providerCount; i++ )
+ {
+ __IF_DEBUG(Print(_L(" PROVIDER %d"), i));
+ CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
+ CleanupStack::PushL( p );
+ TVSDataProviderInfo info;
+ ProviderInfoL( i, info );
+ __IF_DEBUG(Print(_L(" info.iNumVideoFrameRatesSupported: %d"), info.iNumVideoFrameRatesSupported));
+ for ( TInt j = 0; j < info.iNumVideoFrameRatesSupported; j++ )
+ {
+ TReal32 rate = 0.0;
+ p->GetVideoFrameRate( rate, j, aFormat, aSize );
+ __IF_DEBUG(Print(_L(" RATE FOR RATE INDEX %d IS %f"), j, rate));
+ if ( rate != 0.0 )
+ {
+ TRateCount rateCount;
+ rateCount.iCount = 1;
+ rateCount.iRate = rate;
+ TInt err = rateCountArray.InsertInOrder(
+ rateCount,
+ TLinearOrder<TRateCount>( TRateCountTLinearOrderFunc ) );
+ if ( err == KErrAlreadyExists )
+ {
+ TInt idx = rateCountArray.Find(
+ rateCount,
+ TIdentityRelation<TRateCount>(
+ TRateCountTIdentityRelationFunc ) );
+ if ( idx == KErrNotFound )
+ {
+ User::Leave( KErrUnknown );
+ }
+ else
+ {
+ // Increment count of providers that supports the rate
+ rateCountArray[idx].iCount++;
+ }
+ }
+ else
+ {
+ User::LeaveIfError( err );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(); // p
+ }
+ aSupportedRates.Reset();
+ for ( TInt k = 0; k < rateCountArray.Count(); k++ )
+ {
+ // Do all providers support the rate
+ if ( providerCount > 0 && providerCount <= rateCountArray[k].iCount )
+ {
+ User::LeaveIfError(
+ aSupportedRates.Append( rateCountArray[k].iRate ) );
+ }
+ }
+ CleanupStack::PopAndDestroy( ); // rateCountArray
+ CleanupStack::Pop(); // aSupportedRates
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() <<"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSDataSourceImp.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1315 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <fbs.h>
+#include <e32svr.h>
+#include <badesca.h>
+#include <mmfdatasourcesink.hrh>
+
+#include "CVSMMFDataBuffer.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+
+ // 4:2:0 planar and 32 bytes extra
+ static const TInt KSourceBufferSize =
+ ( KQcifWidth * KQcifHeight ) + ( ( KQcifWidth * KQcifHeight ) / 2 ) + 12;
+
+// Granularity for video frame format array
+static const TInt KNoOfSupportedFormats = 4;
+
+// How many sequential FillBufferL calls is supported
+static const TInt KNoOfSupportedBuffers = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CVSProviderSwitchAO ============================
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::NewL
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO* CVSProviderSwitchAO::NewL(
+ CVSDataSourceImp* aDataSourceImp )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::NewL() >>"), RThread().Id().operator TUint()));
+ CVSProviderSwitchAO* self =
+ new ( ELeave ) CVSProviderSwitchAO( aDataSourceImp );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ConstructL() >>"), RThread().Id().operator TUint()));
+ User::LeaveIfError( iSwitchCs.CreateLocal() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::CVSProviderSwitchAO
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO::CVSProviderSwitchAO( CVSDataSourceImp* aDataSourceImp )
+: CActive( EPriorityStandard ), iDataSourceImp( aDataSourceImp )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::CVSProviderSwitchAO() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::CVSProviderSwitchAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::~CVSProviderSwitchAO
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO::~CVSProviderSwitchAO()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::~CVSProviderSwitchAO() >>"), RThread().Id().operator TUint()));
+ iSwitchCs.Close();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::~CVSProviderSwitchAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSProviderSwitchAO::ThreadLogon( MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogon() >>"), RThread().Id().operator TUint()));
+ iEventHandler = &aEventHandler;
+ RThread me;
+ iThreadId = me.Id();
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogon() <<"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::ThreadLogoff()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogoff() >>"), RThread().Id().operator TUint()));
+ if( RThread().Id().operator TUint() == iThreadId )
+ {
+ Deque();
+ iThreadId = 0;
+ iNewProvider = NULL;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogoff() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::InitiateProviderSwitch
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::InitiateProviderSwitch(
+ CVSDataProvider* aNewProvider )
+ {
+ iSwitchCs.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::InitiateProviderSwitch() >>"), RThread().Id().operator TUint()));
+ iNewProvider = aNewProvider;
+ iStatus = KRequestPending;
+ SetActive();
+ Signal( KErrNone );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::InitiateProviderSwitch() <<"), RThread().Id().operator TUint()));
+ iSwitchCs.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::RunL()
+ {
+ iSwitchCs.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::RunL() >>"), RThread().Id().operator TUint()));
+ if( iStatus.Int() == KErrNone )
+ {
+ if ( iDataSourceImp->SwitchPending() )
+ {
+ Panic( EVSPanicSwitchAlreadyPending );
+ }
+ TRAPD(
+ leaveCode,
+ iDataSourceImp->DoProviderSwitchL( iNewProvider, *iEventHandler ) );
+ if ( leaveCode != KErrNone )
+ {
+ iDataSourceImp->ProviderSwitchError( leaveCode );
+ }
+ }
+ else
+ {
+ iNewProvider = NULL;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::RunL() <<"), RThread().Id().operator TUint()));
+ iSwitchCs.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::DoCancel() >>"), RThread().Id().operator TUint()));
+ // Nothing to do here. This AO is always signalled when it's activated.
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::Signal
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::Signal( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::Signal() >>"), RThread().Id().operator TUint()));
+ if( IsActive() )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ RThread me;
+ if( me.Id() == iThreadId )
+ {
+ User::RequestComplete( pStatus, aError );
+ }
+ else
+ {
+ if( me.Open( iThreadId ) == KErrNone )
+ {
+ *pStatus = KRequestPending;
+ me.RequestComplete( pStatus, aError );
+ me.Close();
+ }
+ else
+ {
+ Panic( EVSPanicThreadOpenFailure );
+ }
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::Signal() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVSDataSourceObserverAO ========================
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::CVSDataSourceObserverAO
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceObserverAO::CVSDataSourceObserverAO()
+: CActive( EPriorityStandard )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::CVSDataSourceObserverAO() >>"), RThread().Id().operator TUint()));
+ RThread me;
+ iThreadId = me.Id();
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::CVSDataSourceObserverAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::~CVSDataSourceObserverA
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceObserverAO::~CVSDataSourceObserverAO()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::~CVSDataSourceObserverAO() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::~CVSDataSourceObserverAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::vsProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::vsProviderSwitchDone(
+ MVSDataSourceObserver& aObserver,
+ CVSDataProvider* aOldProvider )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::vsProviderSwitchDone() >>"), RThread().Id().operator TUint()));
+ iObserver = &aObserver;
+ iOldProvider = aOldProvider;
+ iStatus = KRequestPending;
+ SetActive();
+ Signal( KErrNone );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::vsProviderSwitchDone() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::RunL() >>"), RThread().Id().operator TUint()));
+ if( iStatus.Int() == KErrNone )
+ {
+ iObserver->vsProviderSwitchDone( iOldProvider );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::DoCancel() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::Signal
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::Signal( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::Signal() >>"), RThread().Id().operator TUint()));
+ TRequestStatus* pStatus = &iStatus;
+ RThread me;
+ if( me.Id() == iThreadId )
+ {
+ User::RequestComplete( pStatus, aError );
+ }
+ else
+ {
+ if( me.Open( iThreadId ) == KErrNone )
+ {
+ *pStatus = KRequestPending;
+ me.RequestComplete( pStatus, aError );
+ me.Close();
+ }
+ else
+ {
+ Panic( EVSPanicThreadOpenFailure );
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::Signal() <<"), RThread().Id().operator TUint()));
+ }
+
+
+
+// =============================== CVSDataSource ===============================
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::NewSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSource* CVSDataSource::NewSourceL( MVSDataSourceObserver* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::NewSourceL() >>"), RThread().Id().operator TUint()));
+ if ( aObserver == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+ CVSDataSource* self = CVSDataSourceImp::NewSourceL();
+ CleanupStack::PushL( self );
+ self->ConstructL( aObserver );
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::NewSourceL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::CVSDataSource
+// -----------------------------------------------------------------------------
+//
+CVSDataSource::CVSDataSource() : MVTVideoSource( KNullUid )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::CVSDataSource() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::CVSDataSource() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSource::ConstructL( MVSDataSourceObserver* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::ConstructL() >>"), RThread().Id().operator TUint()));
+ iObserver = aObserver;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::NewSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp* CVSDataSourceImp::NewSourceL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::NewSourceL() >>"), RThread().Id().operator TUint()));
+ CVSDataSourceImp* self = new (ELeave) CVSDataSourceImp;
+ CleanupStack::PushL( self );
+ self->ConstructSourceL( KNullDesC8 );
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::NewSourceL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SwitchDataProviderL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SwitchDataProviderL(
+ CVSDataProvider* aNewProvider )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProviderL() >>"), RThread().Id().operator TUint()));
+ if ( aNewProvider == NULL )
+ {
+ __IF_DEBUG(Print(_L("SwitchDataProviderL(): NULL argument, leaving.")));
+ User::Leave( KErrArgument );
+ }
+ // Is new provider same as old, then no need to change provider
+ if ( aNewProvider == &DataProvider() )
+ {
+ __IF_DEBUG(Print(_L("SwitchDataProviderL(): New provider same as old: 0x%x"), aNewProvider));
+ Observer().vsProviderSwitchDone( aNewProvider );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProvider() <<"), RThread().Id().operator TUint()));
+ return;
+ }
+ // If Protocol is in the currently initializing itself then complete this switch
+ // request when Protocol ready (from SourcePlayL). No need to protect
+ // iProtoInitOngoing test with CS.
+ if ( iProtoInitOngoing )
+ {
+ __IF_DEBUG(Print(_L("PROTOCOL INIT ONGOING, PENDING SWITCH FOR A WHILE")));
+ iProtoInitCS.Wait();
+ iProviderSwitchRequestDuringProtoInit = ETrue;
+ iNewProvider = aNewProvider;
+ iProtoInitCS.Signal();
+ return;
+ }
+ // Switch provider
+ if ( iThreadLogonCalled )
+ {
+ iProviderSwitchAO->InitiateProviderSwitch( aNewProvider );
+ }
+ else
+ {
+ CVSDataProvider* oldProvider = SwitchProvider( aNewProvider );
+ Observer().vsProviderSwitchDone( oldProvider );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProviderL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::PauseSending
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::PauseSending()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::PauseSending() >>"), RThread().Id().operator TUint()));
+ iPauseCs.Wait();
+ iSendingPaused = ETrue;
+ iPauseCs.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::PauseSending() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::ResumeSending
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ResumeSending()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ResumeSending() >>"), RThread().Id().operator TUint()));
+ iPauseCs.Wait();
+ iSendingPaused = EFalse;
+ iPauseCs.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ResumeSending() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::~CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp::~CVSDataSourceImp()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::~CVSDataSourceImp() >>"), RThread().Id().operator TUint()));
+ delete iDataSourceObserverAO;
+ delete iProviderSwitchAO;
+ iProtoMimeTypes.Close();
+ delete iSupportedVideoFormats;
+ iSupportedVideoSizes.Close();
+ iSupportedFrameRates.Close();
+ // Assuming no need to use critical section here
+ iFreeQueue.Close();
+ iActiveQueue.Close();
+ iAllocatedBuffers.ResetAndDestroy();
+ iQueueCs.Close();
+ iPauseCs.Close();
+ iProtoInitCS.Close();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::~CVSDataSourceImp() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FillBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL() >>"), RThread().Id().operator TUint()));
+
+ if ( aBuffer == NULL || aConsumer == NULL )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ if ( aBuffer->Type() != KUidMmfDataBuffer )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ DataProvider().SetFillBufferParams( aConsumer, aMediaId );
+
+ iPauseCs.Wait();
+ const TBool sendingPaused( iSendingPaused );
+ iPauseCs.Signal();
+
+ if( iSwitchOngoing )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Switch ongoing"), RThread().Id().operator TUint()));
+ // queues are locked by us -> it's safe to modify queues without
+ // locking
+ User::LeaveIfError(
+ FreeBufferNoWait( static_cast<CVSMMFDataBuffer*>( aBuffer ) ) );
+ }
+ else if( iSwitchPending )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Switch pending"), RThread().Id().operator TUint()));
+ FreeBufferL( static_cast<CVSMMFDataBuffer*>( aBuffer ) );
+ TRAPD(
+ err,
+ DoProviderSwitchL(
+ iProviderSwitchAO->NewDataProvider(),
+ iProviderSwitchAO->EventHandler() ) );
+ if( err != KErrNone )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Error in switch = %d"), RThread().Id().operator TUint(), err));
+ // Not leaving from here (it was provider switch related error),
+ // let VT take care of the rest
+ ProviderSwitchError( err );
+ }
+ }
+ else if( sendingPaused )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Sending Paused"), RThread().Id().operator TUint()));
+ // queues are locked by us -> it's safe to modify queues without
+ // locking
+ User::LeaveIfError(
+ FreeBufferNoWait( static_cast<CVSMMFDataBuffer*>( aBuffer ) ) );
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): No switch -> normal FillBufferL()"), RThread().Id().operator TUint()));
+ FreeBufferL( static_cast<CVSMMFDataBuffer*>( aBuffer ) );
+ DataProvider().FillBufferL( aBuffer, aConsumer, aMediaId );
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::BufferEmptiedL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CanCreateSourceBuffer
+// -----------------------------------------------------------------------------
+//
+TBool CVSDataSourceImp::CanCreateSourceBuffer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CanCreateSourceBuffer() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CanCreateSourceBuffer) <<"), RThread().Id().operator TUint()));
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CreateSourceBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVSDataSourceImp::CreateSourceBufferL(
+ TMediaId /*aMediaId*/,
+ TBool &aReference )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() >>"), RThread().Id().operator TUint()));
+ if ( iRequestedBufferCount >= KNoOfSupportedBuffers )
+ {
+ User::Leave( KErrOverflow );
+ }
+ aReference = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL(): Returning buffer: %d [0x%08x]"), RThread().Id().operator TUint(), iRequestedBufferCount + 1, iAllocatedBuffers[ iRequestedBufferCount ]));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() <<"), RThread().Id().operator TUint()));
+ return iAllocatedBuffers[ iRequestedBufferCount++ ];
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CreateSourceBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVSDataSourceImp::CreateSourceBufferL(
+ TMediaId /*aMediaId*/,
+ CMMFBuffer& /*aSinkBuffer*/,
+ TBool &aReference )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() >>"), RThread().Id().operator TUint()));
+ if ( iRequestedBufferCount >= KNoOfSupportedBuffers )
+ {
+ User::Leave( KErrOverflow );
+ }
+ aReference = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL(): Returning buffer: %d [0x%08x]"), RThread().Id().operator TUint(), iRequestedBufferCount + 1, iAllocatedBuffers[ iRequestedBufferCount ]));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() <<"), RThread().Id().operator TUint()));
+ return iAllocatedBuffers[ iRequestedBufferCount++ ];
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourceThreadLogon( MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogon() >>"), RThread().Id().operator TUint()));
+ __ASSERT_DEBUG( (&DataProvider()) != NULL,
+ Panic( EVSPanicProviderNotSet ) );
+ TInt err( KErrNone );
+ if( !iFbsStarted )
+ {
+ // Caller does not start the FBS server when compiled on proxy mode
+ // so we have to take care of that by ourself.
+ err = FbsStartup();
+ if( err == KErrNone )
+ {
+ err = RFbsSession::Connect();
+ if( err == KErrNone )
+ {
+ iFbsStarted = ETrue;
+ }
+ }
+ }
+ if( !iThreadLogonCalled && ( err == KErrNone ) )
+ {
+ err = DataProvider().SourceThreadLogon( aEventHandler );
+ if (err != KErrNone)
+ {
+ return err;
+ }
+ iProviderSwitchAO->ThreadLogon( aEventHandler );
+ iThreadLogonCalled = ETrue;
+ iProtoInitOngoing = ETrue;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SourceThreadLogoff()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogoff() >>"), RThread().Id().operator TUint()));
+
+ iThreadLogonCalled = EFalse;
+
+ if ( iProviderSwitchRequestDuringProtoInit )
+ {
+ __IF_DEBUG(Print(_L("PROTOCOL INIT FAILED, NOW COMPLETING THE SWITCH REQUEST WITH ERROR")));
+ iProviderSwitchRequestDuringProtoInit = EFalse;
+ ProviderSwitchError( KErrAbort );
+ }
+
+ if( &DataProvider() )
+ {
+ DataProvider().SourceThreadLogoff();
+ }
+
+ iSwitchOngoing = iSwitchPending = EFalse;
+
+ iProtoInitOngoing = EFalse;
+
+ // If provider switch ongoing complete it
+ if ( iProviderSwitchAO->NewDataProvider() != NULL )
+ {
+ CVSDataProvider* oldProvider =
+ SwitchProvider( iProviderSwitchAO->NewDataProvider() );
+ Observer().vsProviderSwitchDone( oldProvider );
+ }
+
+ iProviderSwitchAO->ThreadLogoff();
+
+ delete iFormat; iFormat = 0;
+
+ iCallFlags = 0;
+
+ // Clear iFreeQueue
+ while( iFreeQueue.Count() )
+ {
+ iFreeQueue.Remove( 0 );
+ }
+
+ // Clear iActiveQueue
+ while( iActiveQueue.Count() )
+ {
+ iActiveQueue.Remove( 0 );
+ }
+
+ // Set frame buffer to NULL for all buffers
+ for( TInt i = 0; i < iRequestedBufferCount; i++ )
+ {
+ TInt err = KErrNone;
+ // Does not leave when framebuffer is set to NULL
+ // Both type of buffers needs to be nulled
+ TRAP( err, iAllocatedBuffers[i]->SetFrameBufferL( ( MCameraBuffer* )NULL ));
+ TRAP( err, iAllocatedBuffers[i]->SetFrameBufferL( ( MFrameBuffer* )NULL )); }
+
+ // All pre-created buffers are free again
+ iRequestedBufferCount = 0;
+
+ if( iFbsStarted )
+ {
+ RFbsSession::Disconnect();
+ iFbsStarted = EFalse;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePrimeL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePrimeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePrimeL() >>"), RThread().Id().operator TUint()));
+ TRAPD( result, DataProvider().SourcePrimeL() );
+ if( ( result == KErrNone ) || ( result == KRequestPending ) )
+ {
+ iDSState = CVSDataSourceImp::EPrimed;
+ }
+ else
+ {
+ User::Leave( result );
+ }
+ iProtoInitOngoing = EFalse;
+ // If provider switch was requested when Proto was initializing itself then
+ // fill switch request now
+ iProtoInitCS.Wait();
+ if ( iProviderSwitchRequestDuringProtoInit )
+ {
+ __IF_DEBUG(Print(_L("PROTOCOL INIT READY, NOW COMPLETING THE SWITCH REQUEST")));
+ iProviderSwitchRequestDuringProtoInit = EFalse;
+ iProviderSwitchAO->InitiateProviderSwitch( iNewProvider );
+ iNewProvider = NULL;
+ }
+ iProtoInitCS.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePlayL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePlayL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL() >>"), RThread().Id().operator TUint()));
+ if( !iSwitchOngoing )
+ {
+ DataProvider().SourcePlayL();
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only, play will be called after switch"), RThread().Id().operator TUint()));
+ }
+ iDSState = CVSDataSourceImp::EPlaying;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL() <<"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePauseL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePauseL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePauseL() >>"), RThread().Id().operator TUint()));
+ if( !iSwitchOngoing )
+ {
+ DataProvider().SourcePauseL();
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only"), RThread().Id().operator TUint()));
+ }
+ iDSState = CVSDataSourceImp::EPrimed;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePauseL() <<"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceStopL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourceStopL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceStopL() >>"), RThread().Id().operator TUint()));
+ if( !iSwitchOngoing )
+ {
+ DataProvider().SourceStopL();
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only"), RThread().Id().operator TUint()));
+ }
+ iDSState = CVSDataSourceImp::EStopped;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceStopL() <<"), RThread().Id().operator TUint()));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::ConstructSourceL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ConstructSourceL( const TDesC8& /*aInitData*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ConstructSourceL() >>"), RThread().Id().operator TUint()));
+ iYuv420PlanarDesc.Zero();
+ iYuv420PlanarDesc.Append( KVtVideoMIMETypeYUV420 );
+ User::LeaveIfError( iProtoMimeTypes.Append( &iYuv420PlanarDesc ) );
+ iProviderSwitchAO = CVSProviderSwitchAO::NewL( this );
+ iDataSourceObserverAO = new (ELeave) CVSDataSourceObserverAO();
+ iSupportedVideoFormats =
+ new (ELeave) CDesC8ArrayFlat( KNoOfSupportedFormats );
+ // Get formats supported by all providers
+ CVSDataProvider::EnumerateVideoFrameFormatsL( iSupportedVideoFormats );
+ // Get video frame sizes for specified format supported by all providers
+ TInt i, j;
+ i = j = 0;
+ for ( i = 0; i < iSupportedVideoFormats->Count(); i++ )
+ {
+ TPtrC8 format = iSupportedVideoFormats->MdcaPoint( i );
+ RArray<TSize> sizeArray;
+ CleanupClosePushL( sizeArray );
+ CVSDataProvider::EnumerateVideoFrameSizesL( sizeArray, format );
+ for ( j = 0; j < sizeArray.Count(); j++ )
+ {
+ TVSFrameSize sizePerFormat;
+ sizePerFormat.iFormat.Set( format );
+ sizePerFormat.iSize = sizeArray[j];
+ User::LeaveIfError( iSupportedVideoSizes.Append( sizePerFormat ) );
+ }
+ CleanupStack::PopAndDestroy(); // sizeArray
+ }
+ // Get video frame rates for specified frame format and size supported
+ // by all providers
+ for ( i = 0; i < iSupportedVideoSizes.Count(); i++ )
+ {
+ RArray<TReal32> rateArray;
+ CleanupClosePushL( rateArray );
+ CVSDataProvider::EnumerateVideoFrameRatesL(
+ rateArray,
+ iSupportedVideoSizes[i].iFormat,
+ iSupportedVideoSizes[i].iSize );
+ for ( j = 0; j < rateArray.Count(); j++ )
+ {
+ TVSFrameRate framePerSizeAndFormat;
+ framePerSizeAndFormat.iFormat.Set(
+ iSupportedVideoSizes[i].iFormat );
+ framePerSizeAndFormat.iSize = iSupportedVideoSizes[i].iSize;
+ framePerSizeAndFormat.iRate = rateArray[j];
+ User::LeaveIfError( iSupportedFrameRates.Append(
+ framePerSizeAndFormat ) );
+ }
+ CleanupStack::PopAndDestroy(); // rateArray
+ }
+ // Create queue criticalsection
+ User::LeaveIfError( iQueueCs.CreateLocal() );
+ // Create VTEng-Protocol guard
+ User::LeaveIfError( iPauseCs.CreateLocal() );
+ // Pre-create buffers
+ for( i = 0; i < KNoOfSupportedBuffers; i++ )
+ {
+ User::LeaveIfError( iFreeQueue.Append( 0 ) );
+ User::LeaveIfError( iActiveQueue.Append( 0 ) );
+ CVSMMFDataBuffer* buffer = CVSMMFDataBuffer::NewL( KSourceBufferSize );
+ CleanupStack::PushL( buffer );
+ User::LeaveIfError( iAllocatedBuffers.Append( buffer ) );
+ CleanupStack::Pop(); // buffer
+ }
+ for( i = 0; i < KNoOfSupportedBuffers; i++ )
+ {
+ iFreeQueue.Remove( 0 );
+ iActiveQueue.Remove( 0 );
+ }
+ // Init critical sections
+ User::LeaveIfError( iProtoInitCS.CreateLocal() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ConstructSourceL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetMultimediaTypesL
+// -----------------------------------------------------------------------------
+//
+const RArray<TDesC8*>& CVSDataSourceImp::GetMultimediaTypesL() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetMultimediaTypeL() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetMultimediaTypeL() <<"), RThread().Id().operator TUint()));
+ return iProtoMimeTypes;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetFormatL( const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFormatL() >>"), RThread().Id().operator TUint()));
+ if ( &DataProvider() == NULL )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TBool supported = EFalse;
+ for ( TInt i = 0; i < iSupportedVideoFormats->Count(); i++ )
+ {
+ TPtrC8 format = iSupportedVideoFormats->MdcaPoint( i );
+ if ( aFormat == format )
+ {
+ supported = ETrue;
+ break;
+ }
+ }
+ if ( !supported )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ DataProvider().SetFormatL( aFormat );
+ delete iFormat; iFormat = 0;
+ iFormat = aFormat.AllocL();
+ iCallFlags |= ESetFormatCalled;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFormatL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetFrameRateL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetFrameRateL( TReal32 aFrameRate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFrameRateL() >>"), RThread().Id().operator TUint()));
+ if ( &DataProvider() == NULL )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TBool supported = EFalse;
+ for ( TInt i = 0; i < iSupportedFrameRates.Count(); i++ )
+ {
+ TVSFrameRate rate = iSupportedFrameRates[i];
+ if ( rate.iFormat == iFormat->Des() && rate.iSize == iSize)
+ {
+ if ( aFrameRate == rate.iRate )
+ {
+ supported = ETrue;
+ break;
+ }
+ }
+ }
+ if ( !supported )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ DataProvider().SetFrameRateL( aFrameRate );
+ iFrameRate = aFrameRate;
+ iCallFlags |= ESetFrameRateCalled;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetVideoFrameSizeL( const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+ if ( &DataProvider() == NULL )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TBool supported = EFalse;
+ for ( TInt i = 0; i < iSupportedVideoSizes.Count(); i++ )
+ {
+ TVSFrameSize size = iSupportedVideoSizes[i];
+ if ( size.iFormat == iFormat->Des() )
+ {
+ if ( aSize == size.iSize )
+ {
+ supported = ETrue;
+ break;
+ }
+ }
+ }
+ if ( !supported )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ DataProvider().SetVideoFrameSizeL( aSize );
+ iSize = aSize;
+ iCallFlags |= ESetSizeCalled;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::GetVideoFrameSizeL( TSize& aSize ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+ if ( &DataProvider() == NULL )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ DataProvider().GetVideoFrameSizeL( aSize );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::DoProviderSwitchL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::DoProviderSwitchL(
+ CVSDataProvider* aNewProvider,
+ MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL() >>"), RThread().Id().operator TUint()));
+
+ iQueueCs.Wait();
+
+ // If there are entries in iActiveQueue wait until they are freed by Protocol
+ if ( iActiveQueue.Count() > 0 )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL(): activequeue count > 0, <<"), RThread().Id().operator TUint()));
+ iSwitchPending = ETrue;
+ iQueueCs.Signal();
+ return;
+ }
+ else
+ {
+ iSwitchPending = EFalse;
+ }
+
+ iSwitchOngoing = ETrue;
+
+ /*
+ * THE FOLLOWING CALLS USE CActiveSchedulerWait WHICH MEANS SOME OTHER
+ * OBJECT MAY RUN IN BETWEEN THE FOLLOWING CALLS I.E. THESE CALLS ARE NOT
+ * SYNCHRONOUS.
+ */
+
+ User::LeaveIfError( aNewProvider->SourceThreadLogon( aEventHandler ) );
+
+ // Is format set by the Protocol
+ if ( iCallFlags & ESetFormatCalled )
+ {
+ aNewProvider->SetFormatL( *iFormat );
+ }
+ // Is size set by the Protocol
+ if ( iCallFlags & ESetSizeCalled )
+ {
+ aNewProvider->SetVideoFrameSizeL( iSize );
+ }
+ // Is framerate set by the Protocol
+ if ( iCallFlags & ESetFrameRateCalled )
+ {
+ aNewProvider->SetFrameRateL( iFrameRate );
+ }
+ // Stop old provider
+ if ( &DataProvider() != NULL )
+ {
+ switch( iDSState )
+ {
+ case EPlaying:
+ DataProvider().SourcePauseL();
+ DataProvider().SourceStopL();
+ break;
+
+ case EPrimed:
+ DataProvider().SourceStopL();
+ break;
+
+ default:
+ break;
+ };
+ DataProvider().SourceThreadLogoff();
+ }
+
+ // Set new provider state according to current state
+ switch ( iDSState )
+ {
+ case EStopped:
+ break;
+
+ case EPrimed:
+ case EPlaying:
+ aNewProvider->PrimeL();
+
+ // check if SourcePlayL() was called during prime
+ if( iDSState == EPlaying )
+ {
+ aNewProvider->SourcePlayL();
+ aNewProvider->SwitchFrom( DataProvider() );
+ }
+ // or SourceStopL()
+ else if( iDSState == EStopped )
+ {
+ aNewProvider->SourceStopL();
+ }
+ break;
+ }
+ /*
+ * THE FOLLOWING CALLS ARE SUPPOSED TO BE SYNCHRONOUS IN THAT THEY DO NOT
+ * LET ACTIVE SCHEDULER RUN SOME OTHER OBJECT.
+ */
+
+ // Complete switch
+ CVSDataProvider* oldProvider = SwitchProvider( aNewProvider );
+
+ // Set consumer and media id
+ DataProvider().SetFillBufferParams(
+ oldProvider->Consumer(),
+ oldProvider->MediaId() );
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL(): iFreeQueue.Count() = %d, iActiveQueue.Count() = %d"), RThread().Id().operator TUint(), iFreeQueue.Count(), iActiveQueue.Count() ));
+
+ // If old provider has pending FillBufferL() calls -> call FillBufferL()
+ // for new provider if it is in Playing state.
+ if( iDSState == EPlaying )
+ {
+ for ( TInt i = 0; i < iFreeQueue.Count(); i++ )
+ {
+ iFreeQueue[ i ]->Reset();
+ DataProvider().FillBufferL(
+ iFreeQueue[i],
+ DataProvider().Consumer(),
+ DataProvider().MediaId() );
+ }
+ }
+
+ // Buffers that are being used by Protocol are set to be needing a reset
+ for ( TInt i = 0; i < iActiveQueue.Count(); i++ )
+ {
+ iActiveQueue[ i ]->SetNeedsReset( ETrue );
+ }
+
+ iSwitchOngoing = EFalse;
+
+ iQueueCs.Signal();
+
+ iDataSourceObserverAO->vsProviderSwitchDone( Observer(), oldProvider );
+ iProviderSwitchAO->NewDataProvider() = NULL;
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ProviderSwitchError( TInt aError )
+ {
+ DataProvider().NotifyError( aError );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp::CVSDataSourceImp()
+: iFreeQueue( KNoOfSupportedBuffers ), iActiveQueue( KNoOfSupportedBuffers )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CVSDataSourceImp() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CVSDataSourceImp() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetBufferL
+// -----------------------------------------------------------------------------
+//
+CVSMMFDataBuffer* CVSDataSourceImp::GetBufferL( TBool aRemove )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL() >>"), RThread().Id().operator TUint()));
+ if( !iQueueCs.IsBlocked() )
+ {
+ iPauseCs.Wait();
+ const TBool sendingPaused( iSendingPaused );
+ iPauseCs.Signal();
+
+ iQueueCs.Wait();
+
+ // while switch is pending, always return NULL we don't want to let
+ // buffer float around
+ if( iSwitchPending || sendingPaused )
+ {
+ iQueueCs.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): Switch pending or sending paused -> returning NULL"), RThread().Id().operator TUint()));
+ return 0;
+ }
+
+ // If no buffers in free (FillBufferL is called) queue -> return NULL
+ if( !iFreeQueue.Count() )
+ {
+ iQueueCs.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): NO free buffers -> returning NULL"), RThread().Id().operator TUint()));
+ return 0;
+ }
+ // Otherwise get first buffer
+ CVSMMFDataBuffer* temp = iFreeQueue[ 0 ];
+ // Move to active (BufferFilledL is called) queue if requested
+ if( aRemove )
+ {
+ iFreeQueue.Remove( 0 );
+ TInt err = iActiveQueue.Append( temp );
+ if ( err != KErrNone )
+ {
+ iQueueCs.Signal();
+ User::Leave( err );
+ }
+ }
+ iQueueCs.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL() returning [$%x]"), RThread().Id().operator TUint(), temp));
+ return temp;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): blocked, returning [$%08x]"), RThread().Id().operator TUint(), 0));
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FreeBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::FreeBufferL( CVSMMFDataBuffer* aBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferL() >>"), RThread().Id().operator TUint()));
+ iQueueCs.Wait();
+ TInt err = FreeBufferNoWait( aBuffer );
+ iQueueCs.Signal();
+ User::LeaveIfError( err );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferL() <<"), RThread().Id().operator TUint()));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FreeBufferNoWait( CVSMMFDataBuffer* aBuffer )
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::FreeBufferNoWait( CVSMMFDataBuffer* aBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferNoWait() >>"), RThread().Id().operator TUint()));
+
+ // Append buffer into free (FillBufferL is called) queue
+ TInt err( KErrNone );
+
+ // Try finding buffer from active (BufferFilledL is called) queue
+ TInt actIdx = iActiveQueue.Find( aBuffer );
+
+ // If it is found, remove it from there
+ if( actIdx != KErrNotFound )
+ {
+ iActiveQueue.Remove( actIdx );
+ TRAP( err, aBuffer->ReleaseL() );
+ if( err != KErrNone )
+ {
+ return err;
+ }
+ }
+
+ if( iFreeQueue.Find( aBuffer ) == KErrNotFound )
+ {
+ err = iFreeQueue.Append( aBuffer );
+ }
+
+#ifdef _DEBUG
+ TBuf<256> b;
+ TInt i;
+ b = _L("Active: ");
+ for( i = 0; i < iActiveQueue.Count(); i++ )
+ {
+ if( i > 0 )
+ {
+ b.Append( _L(", ") );
+ }
+ TBuf<16> b1;
+ b1.Format( _L("[$%08x]"), iActiveQueue[i] );
+ b.Append( b1 );
+ }
+ RDebug::Print( b );
+
+ b = _L("Free : ");
+ for( i = 0; i < iFreeQueue.Count(); i++ )
+ {
+ if( i > 0 )
+ {
+ b.Append( _L(", ") );
+ }
+ TBuf<16> b1;
+ b1.Format( _L("[$%08x]"), iFreeQueue[i] );
+ b.Append( b1 );
+ }
+ RDebug::Print( b );
+#endif
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferNoWait() <<"), RThread().Id().operator TUint()));
+
+ return err;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSMMFDataBuffer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,343 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <ecam.h>
+#include <e32debug.h>
+#include "CVSMMFDataBuffer.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSMMFDataBuffer ===============================
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer* CVSMMFDataBuffer::NewL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL() >>"), RThread().Id().operator TUint()));
+ CVSMMFDataBuffer* self = new ( ELeave ) CVSMMFDataBuffer;
+ CleanupStack::PushL(self);
+ self->ConstructL( KMMFDataBufferDefaultBufferSize );
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer* CVSMMFDataBuffer::NewL( TInt aMaxBufferSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL() >>"), RThread().Id().operator TUint()));
+ CVSMMFDataBuffer* self = new ( ELeave ) CVSMMFDataBuffer;
+ CleanupStack::PushL(self);
+ self->ConstructL( aMaxBufferSize );
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::~CVSMMFDataBuffer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer::~CVSMMFDataBuffer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::~CVSMMFDataBuffer() >>"), RThread().Id().operator TUint()));
+ delete[] iData;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::~CVSMMFDataBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ReAllocBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ReAllocBufferL( TInt aMaxBufferSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ReAllocBufferL() >>"), RThread().Id().operator TUint()));
+ if ( !iIsBufferSet )
+ {
+ TUint8* tmp = new (ELeave) TUint8[aMaxBufferSize];
+ delete[] iData;
+ iData = tmp;
+ iPtr.Set( iData, 0, aMaxBufferSize );
+ iMaxBufferSize = aMaxBufferSize;
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ReAllocBufferL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NeedsReset
+// -----------------------------------------------------------------------------
+//
+TBool CVSMMFDataBuffer::NeedsReset() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NeedsReset() ><"), RThread().Id().operator TUint()));
+ return iNeedsReset;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetNeedsReset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetNeedsReset( TBool aNeedsReset )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetNeedsReset() >>"), RThread().Id().operator TUint()));
+ iNeedsReset = aNeedsReset;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetNeedsReset() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Reset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::Reset()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Reset() >>"), RThread().Id().operator TUint()));
+ iPtr.Zero();
+ SetNeedsReset( EFalse );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Reset() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Data
+// -----------------------------------------------------------------------------
+//
+TDes8& CVSMMFDataBuffer::Data()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() <<"), RThread().Id().operator TUint()));
+ return iPtr;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Data
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CVSMMFDataBuffer::Data() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() <<"), RThread().Id().operator TUint()));
+ return iPtr;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetStatus
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetStatus( TBufferStatus aStatus )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetStatus() >>"), RThread().Id().operator TUint()));
+ CMMFBuffer::SetStatus( aStatus );
+ if ( iStatus == EBeingFilled )
+ {
+ Reset();
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetStatus() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetRequestSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetRequestSizeL( TInt aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetRequestSizeL() >>"), RThread().Id().operator TUint()));
+ if ( aSize < 0 )
+ {
+ User::Leave( KErrUnderflow );
+ }
+ else if ( aSize > iPtr.MaxLength() )
+ {
+ User::Leave( KErrOverflow );
+ }
+ else
+ {
+ iRequestSize = aSize;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetRequestSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::BufferSize
+// -----------------------------------------------------------------------------
+//
+TUint CVSMMFDataBuffer::BufferSize() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::BufferSize() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::BufferSize() <<"), RThread().Id().operator TUint()));
+ return iPtr.Length();
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetPosition
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetPosition( TUint aPosition )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetPosition() >>"), RThread().Id().operator TUint()));
+ if ( aPosition <= (TUint)iPtr.Length() )
+ {
+ iPosition = aPosition;
+ }
+ else
+ {
+ iPosition = (TUint)iPtr.Length(); // Tried to position beyond end of
+ // data
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetPosition() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetFrameBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetFrameBufferL( MFrameBuffer* aFrameBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() >>"), RThread().Id().operator TUint()));
+ iFrameBuffer = aFrameBuffer;
+ //Buffer is valid
+ iIsBufferSet = ETrue;
+ if ( aFrameBuffer == NULL )
+ {
+ iPtr.Set( iData, 0, iMaxBufferSize );
+ }
+ else
+ {
+ Reset();
+ TPtrC8 ptr( *iFrameBuffer->DataL( 0 ) );
+ iPtr.Set((TUint8*)ptr.Ptr(), ptr.Size(), ptr.Size());
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetFrameBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetFrameBufferL( MCameraBuffer* aCameraBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() >>"), RThread().Id().operator TUint()));
+ iCameraBuffer = aCameraBuffer;
+ //Buffer is valid
+ iIsBufferSet = ETrue;
+ if ( aCameraBuffer == NULL )
+ {
+ iPtr.Set( iData, 0, iMaxBufferSize );
+ }
+ else
+ {
+ Reset();
+ // Take the latest frame data from buffer should be always 0,
+ // but if buffer contains more than 1 frame could be something else
+ TPtrC8 ptr( *iCameraBuffer->DataL( iCameraBuffer->NumFrames() - 1 ) );
+ iPtr.Set((TUint8*)ptr.Ptr(), ptr.Size(), ptr.Size());
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ReleaseL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ReleaseL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Release() >>"), RThread().Id().operator TUint()));
+ if( iFrameBuffer )
+ {
+ iFrameBuffer->Release();
+ SetFrameBufferL( (MFrameBuffer*)NULL );
+ }
+ else if( iCameraBuffer )
+ {
+ iCameraBuffer->Release();
+ SetFrameBufferL( (MCameraBuffer*)NULL );
+ }
+ else
+ {
+ if ( iPtr.Ptr() != iData )
+ {
+ iPtr.Set( iData, 0, iMaxBufferSize );
+ }
+ if( NeedsReset() )
+ {
+ Reset();
+ }
+ }
+
+ //Buffer is no longer valid
+ iIsBufferSet = EFalse;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Release() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetBufferOffset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetBufferOffset( TInt aOffset )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset() >>"), RThread().Id().operator TUint()));
+ if ( !iIsBufferSet )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset(): Length = %d, Offset = %d"), RThread().Id().operator TUint(), iPtr.Length(), aOffset));
+ iPtr.Set( iData + aOffset, iPtr.Length() - aOffset, iMaxBufferSize );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::CVSMMFDataBuffer
+// -----------------------------------------------------------------------------
+//
+CVSMMFDataBuffer::CVSMMFDataBuffer() :
+ CMMFDataBuffer( KUidMmfDataBuffer ), iPtr(0,0,0), iIsBufferSet(EFalse)
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::CVSMMFDataBuffer() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::CVSMMFDataBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ConstructL( TInt aMaxBufferSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ConstructL() >>"), RThread().Id().operator TUint()));
+ iData = new (ELeave) TUint8[aMaxBufferSize];
+ iPtr.Set( iData, 0, aMaxBufferSize );
+ iMaxBufferSize = aMaxBufferSize;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSOnboardCameraDataProvider.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1007 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <fbs.h>
+#include "CVSOnboardCameraDataProvider.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+#include "CVSMMFDataBuffer.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+const TInt KQCIFWidth = 176;
+const TInt KQCIFHeight = 144;
+
+// MACROS
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CProviderErrorNotifierAO =======================
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::NewL
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO* CProviderErrorNotifierAO::NewL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() >>"), RThread().Id().operator TUint()));
+ CProviderErrorNotifierAO* self = new ( ELeave ) CProviderErrorNotifierAO();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::~CProviderErrorNotifierAO
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO::~CProviderErrorNotifierAO()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ iCS.Close();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::NotifyError
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::NotifyError(
+ MVSDataProviderObserver* aObserver,
+ TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() >>"), RThread().Id().operator TUint()));
+ iCS.Wait();
+ iObserver = aObserver;
+ iError = aError;
+ TRequestStatus* statusP = &iStatus;
+ RThread thread;
+ if( thread.Open( iThreadId ) == KErrNone )
+ {
+ *statusP = KRequestPending;
+ thread.RequestComplete( statusP, KErrNone );
+ thread.Close();
+ }
+ else
+ {
+ Panic( EVSPanicThreadOpenFailure );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::CProviderErrorNotifierAO
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO::CProviderErrorNotifierAO() :
+ CActive( EPriorityNormal )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint()));
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() >>"), RThread().Id().operator TUint()));
+ iCS.CreateLocal();
+ iThreadId = RThread().Id();
+ iStatus = KRequestPending;
+ SetActive();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() >>"), RThread().Id().operator TUint()));
+ if( iStatus == KRequestPending )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrCancel );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() >>"), RThread().Id().operator TUint()));
+ TInt err = iStatus.Int();
+ if ( err == KErrCancel )
+ {
+ return;
+ }
+ if ( iObserver != NULL )
+ {
+ iObserver->vsProviderError( iError );
+ }
+ iStatus = KRequestPending;
+ SetActive();
+ iCS.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CSyncCameraReserve =============================
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::CSyncCameraReserve
+// -----------------------------------------------------------------------------
+//
+CSyncCameraReserve::CSyncCameraReserve() : CActive( EPriorityNormal )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() >>"), RThread().Id().operator TUint()));
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::StartL
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::StartL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() >>"), RThread().Id().operator TUint()));
+ SetActive();
+ iStatus = KRequestPending;
+ iWait.Start();
+ User::LeaveIfError( iStatus.Int() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::NewL
+// -----------------------------------------------------------------------------
+//
+CSyncCameraReserve* CSyncCameraReserve::NewL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() >>"), RThread().Id().operator TUint()));
+ CSyncCameraReserve* self = new ( ELeave ) CSyncCameraReserve();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::RunL
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() >>"), RThread().Id().operator TUint()));
+ iWait.AsyncStop();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVSOnboardCameraDataProvider ===================
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider(
+ MVSDataProviderObserver* aObserver, MVSBufferPool* aPool ) :
+ CVSCameraDataProvider( aObserver, aPool ),iCameraLost( EFalse )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint()));
+ iState = EStopped;
+ iFormat = CCamera::EFormatYUV420Planar;
+ iDublicatedBitmap = new CFbsBitmap();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint()));
+ delete iDublicatedBitmap;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::PrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::PrimeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() >>"), RThread().Id().operator TUint()));
+
+ const TBool primeable( iCameraDuplicate && ( iState == EStopped ) );
+
+ if ( !primeable )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ iAsynchronousReserveIssued = EFalse;
+ iCameraDuplicate->Reserve();
+ iSyncReserve->StartL(); // Returns when from ReserveComplete() has been
+ // signalled iSyncReserve
+
+ // Reserve ok, prepare capture next
+ iCameraDuplicate->PrepareVideoCaptureL(
+ iFormat,
+ iFrameSizeIndex,
+ iFrameRateIndex,
+ 2,
+ 1 );
+
+ SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) );
+
+ iState = EPrimed;
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FillBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FillBufferL(
+ CMMFBuffer* /*aBuffer*/,
+ MVTVideoSink* /*aConsumer*/,
+ TMediaId /*aMediaId*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() >>"), RThread().Id().operator TUint()));
+ if ( iState != EPlaying )
+ {
+ User::Leave( KErrNotReady );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::BufferEmptiedL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSOnboardCameraDataProvider::SourceThreadLogon(
+ MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() >>"), RThread().Id().operator TUint()));
+ TInt err = KErrNone;
+ iEventHandler = &aEventHandler;
+ if ( iCameraDuplicate )
+ {
+ Panic( EVSPanicProviderAlreadyInitialized );
+ }
+ TRAP( err, iCameraDuplicate =
+ CCamera::NewDuplicate2L( (MCameraObserver2&)*this, iCameraHandle) );
+
+ if ( err != KErrNone )
+ {
+ TRAP( err, iCameraDuplicate =
+ CCamera::NewDuplicateL( (MCameraObserver&)*this, iCameraHandle) );
+ if (err != KErrNone)
+ {
+ return err;
+ }
+ }
+ iCameraLost = EFalse;
+
+ TCameraInfo info;
+ iCameraDuplicate->CameraInfo( info );
+ if ( !(info.iOptionsSupported & TCameraInfo::EVideoCaptureSupported) )
+ {
+ delete iCameraDuplicate;
+ iCameraDuplicate = NULL;
+ return KErrNotSupported;
+ }
+ if ( iSyncReserve == NULL )
+ {
+ TRAP( err, iSyncReserve = CSyncCameraReserve::NewL() );
+ if ( err != KErrNone )
+ {
+ delete iCameraDuplicate;
+ iCameraDuplicate = NULL;
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourceThreadLogoff()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() >>"), RThread().Id().operator TUint()));
+ delete iCameraDuplicate;
+ iCameraDuplicate = NULL;
+ iState = EStopped;
+ delete iSyncReserve;
+ iSyncReserve = NULL;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePrimeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() >>"), RThread().Id().operator TUint()));
+ const TBool primeable( iCameraDuplicate && ( iState == EStopped ) );
+ if ( !primeable )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iAsynchronousReserveIssued = ETrue;
+ iCameraDuplicate->Reserve();
+ User::Leave( KRequestPending );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePlayL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePlayL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() >>"), RThread().Id().operator TUint()));
+ if ( iState != EPrimed )
+ {
+ User::Leave( KErrNotReady );
+ }
+ ResetStartTime();
+ iCameraDuplicate->StartVideoCapture();
+ iState = EPlaying;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePauseL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePauseL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() >>"), RThread().Id().operator TUint()));
+ if ( iState != EPlaying )
+ {
+ return;
+ }
+ iCameraDuplicate->StopVideoCapture();
+ iState = EPrimed;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceStopL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourceStopL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() >>"), RThread().Id().operator TUint()));
+ if ( iState == EStopped )
+ {
+ return;
+ }
+ SourcePauseL();
+ iCameraDuplicate->Release();
+ iState = EStopped;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetFormatL( const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() >>"), RThread().Id().operator TUint()));
+ if ( !iCameraDuplicate )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TCameraInfo info;
+ iCameraDuplicate->CameraInfo( info );
+ if ( aFormat == KVtVideoMIMETypeYUV420 )
+ {
+ if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+ {
+ iFormat = CCamera::EFormatYUV420Planar;
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetFrameRateL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetFrameRateL( TReal32 aFrameRate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() >>"), RThread().Id().operator TUint()));
+ if ( !iCameraDuplicate )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TCameraInfo info;
+ iCameraDuplicate->CameraInfo( info );
+ TBool found = EFalse;
+ for ( TInt i = 0; i < info.iNumVideoFrameRatesSupported; i++ )
+ {
+ TReal32 rate = 0;
+ iCameraDuplicate->EnumerateVideoFrameRates(
+ rate,
+ i,
+ iFormat,
+ iFrameSizeIndex );
+ if ( rate == aFrameRate )
+ {
+ iFrameRateIndex = i;
+ found = ETrue;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+ if ( !iCameraDuplicate )
+ {
+ User::Leave( KErrBadHandle );
+ }
+ TCameraInfo info;
+ iCameraDuplicate->CameraInfo( info );
+ TBool found = EFalse;
+ for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ )
+ {
+ TSize size;
+ iCameraDuplicate->EnumerateVideoFrameSizes( size, i, iFormat );
+ if ( size == aSize )
+ {
+ iFrameSizeIndex = i;
+ iFrameSize = size;
+ found = ETrue;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+ aSize = iFrameSize;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::ReserveComplete
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::ReserveComplete( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() >>"), RThread().Id().operator TUint()));
+ if ( !iReserverComplete )
+ {
+ if ( aError == KErrNone )
+ {
+ iReserverComplete = ETrue;
+ Camera().PowerOn();
+ }
+ else
+ {
+ NotifyError( aError );
+ }
+ }
+ else
+ {
+ if( iAsynchronousReserveIssued )
+ {
+ iAsynchronousReserveIssued = EFalse;
+
+ if( aError == KErrNone && iCameraDuplicate )
+ {
+ // Reserve ok, prepare capture next
+ TRAP(
+ aError,
+ iCameraDuplicate->PrepareVideoCaptureL(
+ iFormat,
+ iFrameSizeIndex,
+ iFrameRateIndex,
+ 2,
+ 1 ) );
+
+ if( aError == KErrNone )
+ {
+ TRAP( aError, SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) ) );
+
+ if( aError == KErrNone )
+ {
+ // Everything ok in PrimeL()
+ iState = EPrimed;
+ }
+ }
+ }
+ TMMFEvent event( TUid::Uid( KVtUidDataSrcPrime ), aError );
+ iEventHandler->SendEventToClient( event );
+ }
+ else
+ {
+ TRequestStatus* statusP = &iSyncReserve->iStatus;
+ User::RequestComplete( statusP, aError );
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FrameBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FrameBufferReady(
+ MFrameBuffer* aFrameBuffer,
+ TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() >>"), RThread().Id().operator TUint()));
+
+ iFreezeCS.Wait();
+
+ if ( aError == KErrNone )
+ {
+ if( iFreezePendingFlags & EVideoFrameFreezePending )
+ {
+ FreezeFrame( aFrameBuffer );
+ }
+
+ CVSMMFDataBuffer* buffer = NULL;
+
+ TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+
+ if( err == KErrNone )
+ {
+ if ( buffer )
+ {
+ MFrameBuffer* frameBufferToBeUsed = aFrameBuffer;
+
+ if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) )
+ {
+ iFrozenFrame->CopyProperties( aFrameBuffer );
+ aFrameBuffer->Release();
+ frameBufferToBeUsed = iFrozenFrame;
+ }
+
+ TRAP( err, buffer->SetFrameBufferL( frameBufferToBeUsed ) );
+
+ if ( err != KErrNone )
+ {
+ TInt leaveCode = KErrNone;
+ TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+ }
+ else
+ {
+ buffer->SetTimeToPlay( TimeToPlay() );
+ buffer->SetFrameNumber( aFrameBuffer->iIndexOfFirstFrameInBuffer );
+ TRAP( err, Consumer()->BufferFilledL( buffer ) );
+ if ( err != KErrNone )
+ {
+ TInt leaveCode = KErrNone;
+ TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+ }
+ }
+ }
+ else
+ {
+ aFrameBuffer->Release();
+ }
+ }
+
+ if( err != KErrNone )
+ {
+ NotifyError( err );
+ }
+ }
+ else
+ {
+ NotifyError( aError );
+ }
+
+ iFreezeCS.Signal();
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameSize
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameSize(
+ TSize& aSize,
+ TInt aSizeIndex,
+ const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() >>"), RThread().Id().operator TUint()));
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( aFormat == KVtVideoMIMETypeYUV420 )
+ {
+ if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+ {
+ Camera().EnumerateVideoFrameSizes( aSize, aSizeIndex, CCamera::EFormatYUV420Planar );
+ }
+ else
+ {
+ aSize.SetSize( 0, 0 );
+ }
+ }
+ else
+ {
+ aSize.SetSize( 0, 0 );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameRate
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameRate(
+ TReal32& aRate,
+ TInt aRateIndex,
+ const TDesC8& aFormat,
+ const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() >>"), RThread().Id().operator TUint()));
+ TCameraInfo info;
+ Camera().CameraInfo( info );
+ if ( aFormat == KVtVideoMIMETypeYUV420 )
+ {
+ if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+ {
+ TBool found = EFalse;
+ for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ )
+ {
+ TSize size;
+ Camera().EnumerateVideoFrameSizes(
+ size,
+ i,
+ CCamera::EFormatYUV420Planar );
+ if ( size == aSize )
+ {
+ Camera().EnumerateVideoFrameRates(
+ aRate,
+ aRateIndex,
+ CCamera::EFormatYUV420Planar,
+ i );
+ found = ETrue;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ aRate = 0.0;
+ }
+ }
+ else
+ {
+ aRate = 0.0;
+ }
+ }
+ else
+ {
+ aRate = 0.0;
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FreezeFrame
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FreezeFrame( MFrameBuffer* aFrameBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint()));
+
+ TRAPD( error, iFrozenFrame->CopyFrameL( aFrameBuffer ) );
+
+ if( error != KErrNone )
+ {
+ Observer().vsProviderError( error );
+ }
+ else
+ {
+ iFreezePendingFlags &= ~EVideoFrameFreezePending;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FreezeFrame
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FreezeFrame( MCameraBuffer* aCameraBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint()));
+
+ TRAPD( error, iFrozenFrame->CopyFrameL( aCameraBuffer ) );
+
+ if( error != KErrNone )
+ {
+ Observer().vsProviderError( error );
+ }
+ else
+ {
+ iFreezePendingFlags &= ~EVideoFrameFreezePending;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::HandleEvent
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::HandleEvent( const TECAMEvent& aEvent )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() event %d>>"),
+ RThread().Id().operator TUint(), aEvent.iEventType ));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() iErrorCode %d>"),
+ RThread().Id().operator TUint(), aEvent.iErrorCode ));
+ //Needs to handled first
+ if( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+ {
+ iCameraLost = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost>>"),
+ RThread().Id().operator TUint()));
+ NotifyError( KVsErrCameraNoLongerReserved );
+ }
+ //Do not care errors that occures if camera is lost
+ if ( aEvent.iErrorCode != KErrNone )
+ {
+ if ( iCameraLost )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost error<<"),
+ RThread().Id().operator TUint()));
+ return;
+ }
+ }
+ // Gets called twice for both threads
+ if ( aEvent.iEventType == KUidECamEventReserveComplete )
+ {
+ ReserveComplete( aEvent.iErrorCode );
+ }
+ else if( aEvent.iEventType == KUidECamEventPowerOnComplete )
+ {
+ PowerOnComplete( aEvent.iErrorCode );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::ViewFinderReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::ViewFinderReady( MCameraBuffer& aCameraBuffer,TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() error %d >>"), RThread().Id().operator TUint(), aError ));
+ // If error occures notify observer
+ if ( aError != KErrNone && !iCameraLost )
+ {
+ NotifyError( aError );
+ return;
+ }
+ // If camera has been lost do nothing
+ // because event to indicate cameralost has come or is coming
+ else if ( iCameraLost )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() Camera lost<<"),
+ RThread().Id().operator TUint()));
+ return;
+ }
+ // If there is more than 1 frame in buffer
+ // something has went wrong and error (-38) has occured
+ if ( aCameraBuffer.NumFrames() > 1 )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() FRAMES [%d] IN BUFFER >>"),
+ RThread().Id().operator TUint(), aCameraBuffer.NumFrames()));
+ }
+
+ //Duplicate camera buffers the newest bitmap
+ //In case of error release buffer and notify observer
+ if ( !iDublicatedBitmap )
+ {
+ aCameraBuffer.Release();
+ NotifyError( KErrBadDescriptor );
+ return;
+ }
+ iDublicatedBitmap->BeginDataAccess();
+ TRAPD( err, iDublicatedBitmap->Duplicate( aCameraBuffer.BitmapL( aCameraBuffer.NumFrames() - 1 ).Handle() ) );
+ iDublicatedBitmap->EndDataAccess();
+ if( err != KErrNone )
+ {
+ aCameraBuffer.Release();
+ NotifyError( KErrBadDescriptor );
+ return;
+ }
+
+ // Send dublicated bitmap to UI
+ ViewFinderFrameReady( *iDublicatedBitmap );
+
+ //Release camera buffer for further usage
+ aCameraBuffer.Release();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() <<"),
+ RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::VideoBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::VideoBufferReady( MCameraBuffer& aCameraBuffer,TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() >>"), RThread().Id().operator TUint()));
+
+ iFreezeCS.Wait();
+
+ // If there is more than 1 frame in buffer
+ // print it out
+ // calculate delta which indicates how many frames are skipped
+ TInt delta = 0;
+ if ( aCameraBuffer.NumFrames() > 1 )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() FRAMES [%d] IN BUFFER >>"),
+ RThread().Id().operator TUint(), aCameraBuffer.NumFrames()));
+ delta = aCameraBuffer.NumFrames() - 1;
+ }
+
+ if ( aError == KErrNone )
+ {
+ if( iFreezePendingFlags & EVideoFrameFreezePending )
+ {
+ FreezeFrame( &aCameraBuffer );
+ }
+
+ CVSMMFDataBuffer* buffer = NULL;
+
+ TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+
+ if( err == KErrNone )
+ {
+ if ( buffer )
+ {
+ MCameraBuffer* cameraBufferToBeUsed = &aCameraBuffer;
+
+ if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) )
+ {
+ iFrozenFrame->CopyProperties( &aCameraBuffer );
+ ( &aCameraBuffer )->Release();
+ cameraBufferToBeUsed = iFrozenFrame;
+ }
+
+ TRAP( err, buffer->SetFrameBufferL( cameraBufferToBeUsed ) );
+
+ if ( err != KErrNone )
+ {
+ TInt leaveCode = KErrNone;
+ TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+ }
+ else
+ {
+ buffer->SetTimeToPlay( TimeToPlay() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() iIndexOfFirstFrameInBuffer [%d]>>"),
+ RThread().Id().operator TUint(), aCameraBuffer.iIndexOfFirstFrameInBuffer + delta));
+ buffer->SetFrameNumber( ( &aCameraBuffer )->iIndexOfFirstFrameInBuffer + delta );
+ TRAP( err, Consumer()->BufferFilledL( buffer ) );
+ if ( err != KErrNone )
+ {
+ TInt leaveCode = KErrNone;
+ TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+ }
+ }
+ }
+ else
+ {
+ ( &aCameraBuffer )->Release();
+ }
+ }
+ else
+ {
+ NotifyError( err );
+ }
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() Camera lost"),
+ RThread().Id().operator TUint()));
+ if ( !iCameraLost )
+ {
+ NotifyError( aError );
+ }
+ }
+ iFreezeCS.Signal();
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSStillImageDataProvider.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1191 @@
+/*
+* Copyright (c) 2006 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <bautils.h>
+#include <imageconversion.h>
+#include <cvtimageconverter.h>
+#include <rphcltserver.h>
+#include <cphcltimagehandler.h>
+#include <w32std.h>
+
+#include "CVSStillImageDataProvider.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+#include "cvtimagebitmap.h"
+#include "CVSMMFDataBuffer.h"
+
+#include "cmultiframeprovider.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KMinZoom = 0;
+static const TInt KMaxZoom = 0;
+static const TInt KMaxDigitalZoom = 0;
+static const TReal32 KMinZoomFactor = 0.0;
+static const TReal32 KMaxZoomFactor = 0.0;
+static const TReal32 KMaxDigitalZoomFactor = 1.0;
+static const TInt KNumVideoSizesSupported = 1;
+static const TInt KNumVideoFrameSizesSupported = 1;
+static const TInt KNumVideoFrameRatesSupported = 1;
+static const TInt KMaxFramesPerBufferSupported = 1;
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+static const TReal32 KFrameRate = 15.0;
+static const TUint32 KVSViewFinderUpdateRate = 1000000/15; // 15 times per second
+
+// TYPE DEFINITIONS
+
+// Timer expired callback
+
+typedef void (CVSStillImageDataProvider::*TTimerElapsed) ();
+
+// INTERNAL CLASSES
+
+/**
+* Timer class that calls given callback method when timer request has been
+* completed. If the timer request is cancelled then callback will not be
+* called.
+*
+* @lib videosource.lib
+*/
+class CVSFrameRateTimer : public CTimer
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Static factory function to create instance of this class.
+ * @param "aRequester" ?description
+ * @exception Can leave with one of the system wide error codes.
+ * @return Pointer to new instance.
+ */
+ static CVSFrameRateTimer* NewL( CVSStillImageDataProvider* aRequester );
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * Starts timer request. When timer request has been completed given
+ * callback method will be called.
+ * @param "anInterval" Interval after which event is to occur,
+ * in microseconds.
+ * @param "aFunction" Callback method that will be called when timer
+ * request has been completed.
+ */
+ void After(
+ TTimeIntervalMicroSeconds32 anInterval,
+ TTimerElapsed aFunction );
+
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CVSFrameRateTimer();
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // Constructors and destrcutor
+
+ /**
+ * Constructor.
+ * @param "aRequester" ?description
+ */
+ CVSFrameRateTimer( CVSStillImageDataProvider* aRequester );
+
+ private: // New functions
+
+ private: // Functions from base classes
+
+ /**
+ * From CActive. See CActive for description.
+ */
+ void RunL();
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ // Pointer to requester (i.e. through which callback call will be made)
+ CVSStillImageDataProvider* iRequester; // not owned
+
+ // Pointer to callback method.
+ TTimerElapsed iFunction;
+ };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CVSFrameRateTimer ==============================
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::NewL( CVSStillImageDataProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer* CVSFrameRateTimer::NewL(
+ CVSStillImageDataProvider* aRequester )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::NewL() >>"), RThread().Id().operator TUint()));
+ CVSFrameRateTimer* self = new (ELeave) CVSFrameRateTimer( aRequester );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::CVSFrameRateTimer( CVSStillImageDataProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer::CVSFrameRateTimer( CVSStillImageDataProvider* aRequester )
+: CTimer( EPriorityStandard ), iRequester( aRequester )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::CVSFrameRateTimer() >>"), RThread().Id().operator TUint()));
+ // Added to CActiveScheduler in CVSStillImageDataProvider::InitializeL
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::CVSFrameRateTimer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::After(
+// TTimeIntervalMicroSeconds32 anInterval, TTimerElapsed aFunction )
+// -----------------------------------------------------------------------------
+//
+void CVSFrameRateTimer::After(
+ TTimeIntervalMicroSeconds32 anInterval,
+ TTimerElapsed aFunction )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::After() >>"), RThread().Id().operator TUint()));
+ if ( iFunction == aFunction )
+ {
+ if ( !IsActive() )
+ {
+ iFunction = aFunction;
+ CTimer::After( anInterval );
+ }
+ }
+ else
+ {
+ if ( !IsActive() )
+ {
+ iFunction = aFunction;
+ CTimer::After( anInterval );
+ }
+ else
+ {
+ User::Panic(_L("VideoSource"),KErrGeneral);
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::After() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::~CVSFrameRateTimer()
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer::~CVSFrameRateTimer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::~CVSFrameRateTimer() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::~CVSFrameRateTimer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::RunL()
+// -----------------------------------------------------------------------------
+//
+void CVSFrameRateTimer::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::RunL() >>"), RThread().Id().operator TUint()));
+ if( iStatus.Int() == KErrNone )
+ {
+ (iRequester->*iFunction)();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// ============================ CVSStillImageDataProvider ===============================
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::NewL(
+// MVSDataProviderObserver* aObserver, MVSBufferPool* aPool )
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider* CVSStillImageDataProvider::NewL(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVSStillImageDataProvider::NewL() >>"), RThread().Id().operator TUint()));
+ CVSStillImageDataProvider* self =
+ new (ELeave) CVSStillImageDataProvider( aObserver, aPool );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CVSStillImageDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::~CVSStillImageDataProvider()
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider::~CVSStillImageDataProvider()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::~CVSStillImageDataProvider() this %x >>"), RThread().Id().operator TUint(), this));
+ iFs.Close();
+ delete iVFTimer;
+ delete iActiveWait;
+ delete iViewer;
+ iFreezeCS.Close();
+ delete iScaled;
+ ReleaseYUVData();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::~CVSStillImageDataProvider() this %x <<"), RThread().Id().operator TUint(), this));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::InitializeL( const TDesC8& aInitParams )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::InitializeL( const TDesC8& aInitParams )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+
+ CommonInitializeL();
+
+ TPckgBuf< TVSStillImageDataProviderParams > pb;
+ pb.Copy( aInitParams );
+
+ iInitType = pb().iInitialize;
+ iPSState = EPSInitializing;
+
+ switch( pb().iInitialize )
+ {
+ /** Initialize from blank image */
+ case TVSStillImageDataProviderParams::EInitializeAsBlankImage:
+ BlankImageInitializeL();
+ break;
+
+ /** Initialize from General Settings */
+ case TVSStillImageDataProviderParams::EInitializeFromGeneralSettings:
+ GeneralSettingsInitializeL( EGSStillImage );
+ break;
+
+ /** Initilaize from General Settings*/
+ case TVSStillImageDataProviderParams::EInitializeAsDefaultStillImage:
+ GeneralSettingsInitializeL( EGSDefaultStillImage );
+ break;
+
+ /** Initialize from file */
+ case TVSStillImageDataProviderParams::EInitializeFromFile:
+ FileImageInitializeL( pb().iFileName );
+ break;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CommonInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CommonInitializeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CommonInitializeL() >>"), RThread().Id().operator TUint()));
+ iVFTimer = CVSFrameRateTimer::NewL( this );
+ CActiveScheduler::Add( iVFTimer );
+ iActiveWait = new (ELeave) CVSActiveWait< CVSStillImageDataProvider > ( this );
+
+ //Create viewer
+ iViewer = CMultiframeProvider::NewL( this , iDisplayMode );
+ User::LeaveIfError( iFreezeCS.CreateLocal() );
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CommonInitializeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GeneralSettingsInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GeneralSettingsInitializeL( const TGeneralSettingsImageType aType )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GeneralSettingsInitializeL() >>"), RThread().Id().operator TUint()));
+ iViewer->IniatializeGSL( aType );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GeneralSettingsInitializeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::BlankImageInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::BlankImageInitializeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BlankImageInitializeL() %x >>"), RThread().Id().operator TUint(), this));
+ iViewer->IniatializeBlankL();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BlankImageInitializeL() %x <<"), RThread().Id().operator TUint(), this));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FileImageInitializeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FileImageInitializeL( const TFileName& aFileName )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FileImageInitializeL(): %S >>"), RThread().Id().operator TUint(), &aFileName ));
+ iViewer->InitializeL( &aFileName );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FileImageInitializeL() %x <<"), RThread().Id().operator TUint(), this));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::DigitalZoomFactor() const
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::DigitalZoomFactor() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::DigitalZoomFactor() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::DigitalZoomFactor() <<"), RThread().Id().operator TUint()));
+ return KMaxDigitalZoom;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetDigitalZoomFactorL(
+// TInt /*aDigitalZoomFactor*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetDigitalZoomFactorL(
+ TInt /*aDigitalZoomFactor*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetDigitalZoomFactorL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetDigitalZoomFactorL() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+ __ASSERT_DEBUG( iPSState > EPSUninitialized,
+ Panic( EVSPanicProviderNotReady ) );
+ iVFState = EVFPlaying;
+ iViewer->ClearVFScalingTargetSize();
+ iTargetSize = aSize;
+ iViewer->SetVFScalingTargetSize( aSize );
+ iViewer->ScaleCopy( aSize, ETrue );
+ iViewer->IncreaseDataConsumer();
+ iViewer->NextFrame();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderBitmapsL(
+// TSize& /*aSize*/, TRect& /*aClipRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderBitmapsL(
+ TSize& /*aSize*/,
+ TRect& /*aClipRect*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StopViewFinder()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StopViewFinder()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StopViewFinder() >>"), RThread().Id().operator TUint()));
+ // Make sure scaler is cancelled (just in case!)
+ iViewer->ClearVFScalingTargetSize();
+ iViewer->DecreaseDataConsumer();
+ iViewer->SetVFStop();
+ // No double stopping..
+ if( iVFState != EVFStopped )
+ {
+ iVFState = EVFStopped;
+ iVFTimer->Cancel();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StopViewFinder() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ViewFinderActive() const
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::ViewFinderActive() const
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ViewFinderActive() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ViewFinderActive() <<"), RThread().Id().operator TUint()));
+ return ( iVFState == EVFPlaying );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderDirectL(
+// RWsSession& /*aWs*/, CWsScreenDevice& /*aScreenDevice*/,
+// RWindowBase& /*aWindow*/, TRect& /*aScreenRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderDirectL(
+ RWsSession& /*aWs*/,
+ CWsScreenDevice& /*aScreenDevice*/,
+ RWindowBase& /*aWindow*/,
+ TRect& /*aScreenRect*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+ User::Leave(KErrNotSupported);
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderDirectL(
+// RWsSession& /*aWs*/, CWsScreenDevice& /*aScreenDevice*/,
+// RWindowBase& /*aWindow*/, TRect& /*aScreenRect*/, TRect& /*aClipRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderDirectL(
+ RWsSession& /*aWs*/,
+ CWsScreenDevice& /*aScreenDevice*/,
+ RWindowBase& /*aWindow*/,
+ TRect& /*aScreenRect*/,
+ TRect& /*aClipRect*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+ User::Leave(KErrNotSupported);
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ProviderInfo() >>"), RThread().Id().operator TUint()));
+ Mem::FillZ( &aInfo, sizeof( aInfo ) );
+ aInfo.iHardwareVersion = TVersion( 0, 0, 0 );
+ aInfo.iSoftwareVersion = TVersion( 0, 0, 0 );
+ aInfo.iOrientation = TCameraInfo::EOrientationUnknown;
+ aInfo.iOptionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+ TCameraInfo::EVideoCaptureSupported;
+ aInfo.iFlashModesSupported = CCamera::EFlashNone;
+ aInfo.iExposureModesSupported = CCamera::EExposureAuto;
+ aInfo.iWhiteBalanceModesSupported = CCamera::EWBAuto;
+ aInfo.iMinZoom = KMinZoom;
+ aInfo.iMaxZoom = KMaxZoom;
+ aInfo.iMaxDigitalZoom = KMaxDigitalZoom;
+ aInfo.iMinZoomFactor = KMinZoomFactor;
+ aInfo.iMaxZoomFactor = KMaxZoomFactor;
+ aInfo.iMaxDigitalZoomFactor = KMaxDigitalZoomFactor;
+ aInfo.iImageFormatsSupported = CCamera::EFormatFbsBitmapColor64K |
+ CCamera::EFormatFbsBitmapColor16M;
+ aInfo.iNumVideoFrameSizesSupported = KNumVideoSizesSupported;
+ aInfo.iNumVideoFrameSizesSupported = KNumVideoFrameSizesSupported;
+ aInfo.iNumVideoFrameRatesSupported = KNumVideoFrameRatesSupported;
+ aInfo.iVideoFrameFormatsSupported = CCamera::EFormatYUV420Planar;
+ aInfo.iMaxFramesPerBufferSupported = KMaxFramesPerBufferSupported;
+ aInfo.iFreezeSupported = EFalse;
+
+ aInfo.iSupportedColorTones =
+ CCamera::CCameraImageProcessing::EEffectNone;
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ProviderInfo() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetViewFinderMirrorL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetViewFinderMirrorL( TBool /*aMirror*/ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ViewFinderMirror
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::ViewFinderMirror() const
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FreezeL()
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::UnfreezeL()
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::IsFrozen() const
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::PrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::PrimeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::PrimeL() &%x >>"), RThread().Id().operator TUint(), this));
+ SourcePrimeL();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::PrimeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FillBufferL(
+// CMMFBuffer* aBuffer, MVTVideoSink* aConsumer, TMediaId aMediaId )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FillBufferL(
+ CMMFBuffer* /*aBuffer*/,
+ MVTVideoSink* /*aConsumer*/,
+ TMediaId /*aMediaId*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FillBufferL() &%x >>"), RThread().Id().operator TUint(),this));
+ if ( iPSState != EPSPlaying )
+ {
+ User::Leave( KErrNotReady );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FillBufferL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceThreadLogon(
+// MAsyncEventHandler& /*aEventHandler*/ )
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::SourceThreadLogon(
+ MAsyncEventHandler& /*aEventHandler*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogon() &%x >>"), RThread().Id().operator TUint(),this));
+ __ASSERT_DEBUG( iPSState > EPSUninitialized,
+ Panic( EVSPanicProviderNotReady ) );
+ TRAPD( err, CreateProtoTimerL() );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceThreadLogoff()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourceThreadLogoff()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogoff() &%x >>"), RThread().Id().operator TUint(),this));
+ ReleaseProtoTimer();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePrimeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePrimeL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePrimeL() &%x >>"), RThread().Id().operator TUint(),this));
+ iPSState = EPSPrimed;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePlayL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePlayL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePlayL() &%x >>"), RThread().Id().operator TUint(),this));
+ iPSState = EPSPlaying;
+ iFrameCount = 0;
+ ResetStartTime();
+ iViewer->IncreaseDataConsumer();
+ iProtoTimer->After( iProtoUpdateRate, &CVSStillImageDataProvider::ProtoTimer );
+ iViewer->NextFrame();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePlayL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePauseL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePauseL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePauseL() &%x >>"), RThread().Id().operator TUint(),this));
+ if ( iProtoTimer != NULL )
+ {
+ iProtoTimer->Cancel();
+ }
+ iPSState = EPSPrimed;
+ iViewer->DecreaseDataConsumer();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePauseL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceStopL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourceStopL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceStopL() &%x >>"), RThread().Id().operator TUint(),this));
+ if ( iProtoTimer != NULL )
+ {
+ iProtoTimer->Cancel();
+ }
+ iPSState = EPSStopped;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceStopL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetFormatL( const TDesC8& aFormat )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetFormatL( const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFormatL() &%x >>"), RThread().Id().operator TUint(),this));
+ if ( aFormat != KVtVideoMIMETypeYUV420 )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFormatL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetFrameRateL( TReal32 aFrameRate )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetFrameRateL( TReal32 aFrameRate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFrameRateL() &%x >>"), RThread().Id().operator TUint(),this));
+ if ( aFrameRate != KFrameRate )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ iProtoUpdateRate = static_cast<TInt>( 1000000.0 / aFrameRate );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetVideoFrameSizeL() &%x >>"), RThread().Id().operator TUint(),this));
+ if( aSize != TSize( KQcifWidth, KQcifHeight ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::GetVideoFrameSizeL() &%x >>"), RThread().Id().operator TUint(),this));
+ aSize = TSize( KQcifWidth, KQcifHeight );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::VFTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::VFTimer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::VFTimer() >>"), RThread().Id().operator TUint()));
+ if( iVFState == EVFPlaying )
+ {
+ Observer().vsViewFinderFrameReady( iVFBitmap->Bitmap() );
+ iVFTimer->After( KVSViewFinderUpdateRate, &CVSStillImageDataProvider::VFTimer );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::VFTimer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ProtoTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ProtoTimer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer() this %x >>"), RThread().Id().operator TUint(), this));
+ iFrameCount++;
+ CVSMMFDataBuffer* buffer = NULL;
+ TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+ if ( err != KErrNone )
+ {
+ NotifyError( err );
+ }
+ if( buffer )
+ {
+ buffer->SetFrameNumber( iFrameCount );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): iFrameCount %d"), RThread().Id().operator TUint(), iFrameCount));
+ buffer->SetTimeToPlay( TimeToPlay() );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): SetTimeToPlay() = $%08x:$%08x"), RThread().Id().operator TUint(), I64HIGH( buffer->TimeToPlay().Int64() ), I64LOW( buffer->TimeToPlay().Int64() ) ));
+ iFreezeCS.Wait();
+ buffer->Data() = *iYUVBuffer;
+ iFreezeCS.Signal();
+ TRAPD( err, Consumer()->BufferFilledL( buffer ) );
+ if( err != KErrNone )
+ {
+ TInt leaveCode = KErrNone;
+ TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+ NotifyError( err );
+ }
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): GetBufferL() returned NULL"), RThread().Id().operator TUint()));
+ }
+ // Just to make sure that we're actually playing. We also check that
+ // iProtoTimer still exists BECAUSE BufferFilledL() may call
+ // SourceThreadLogoff() if a switch is pending
+ if( iProtoTimer && ( iPSState == EPSPlaying ) )
+ {
+ iProtoTimer->After( iProtoUpdateRate, &CVSStillImageDataProvider::ProtoTimer );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer() this %x <<"), RThread().Id().operator TUint(), this));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateProtoTimerL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CreateProtoTimerL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateProtoTimerL() >>"), RThread().Id().operator TUint()));
+ iProtoTimer = CVSFrameRateTimer::NewL( this );
+ CActiveScheduler::Add( iProtoTimer );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateProtoTimerL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ReleaseProtoTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ReleaseProtoTimer()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseProtoTimer() >>"), RThread().Id().operator TUint()));
+ delete iProtoTimer;
+ iProtoTimer = 0;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseProtoTimer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateYUVDataL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CreateYUVDataL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateYUVDataL() this %x >>"), RThread().Id().operator TUint(), this));
+ CVSFbsBitmapIYUVConverter* conv =
+ CVSFbsBitmapIYUVConverter::NewL( iYUVBitMap->Bitmap() );
+ CleanupStack::PushL( conv );
+ conv->ProcessL();
+ iFreezeCS.Wait();
+ ReleaseYUVData();
+ iYUVBuffer = conv->YUVData().AllocL();
+ iFreezeCS.Signal();
+ CleanupStack::PopAndDestroy(); // conv
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateYUVDataL() iYUVBuffer %x <<"), RThread().Id().operator TUint(), iYUVBuffer));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ReleaseYUVData()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ReleaseYUVData()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseYUVData() >>"), RThread().Id().operator TUint()));
+ delete iYUVBuffer;
+ iYUVBuffer = 0;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseYUVData() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CVSStillImageDataProvider(
+// MVSDataProviderObserver* aObserver )
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider::CVSStillImageDataProvider(
+ MVSDataProviderObserver* aObserver,
+ MVSBufferPool* aPool ) :
+ CVSDataProvider( aObserver, aPool ), iProtoUpdateRate( 1000000.0 / KFrameRate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CVSStillImageDataProvider() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CVSStillImageDataProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ConstructL() this %x >>"), RThread().Id().operator TUint(), this));
+ CVSDataProvider::ConstructL();
+ User::LeaveIfError( iFs.Connect() );
+ RWsSession wsSession;
+ User::LeaveIfError( wsSession.Connect() );
+ CleanupClosePushL( wsSession );
+ CWsScreenDevice* wsScreenDevice = new ( ELeave ) CWsScreenDevice( wsSession );
+ CleanupStack::PushL( wsScreenDevice );
+ User::LeaveIfError( wsScreenDevice->Construct() );
+ //iDisplayMode = wsScreenDevice->DisplayMode();/* = EColor16MU;*/
+ iDisplayMode = EColor16MU;
+ CleanupStack::PopAndDestroy( 2 ); // wsSession, wsScreenDevice
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ConstructL() this %x <<"), RThread().Id().operator TUint(), this));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameSize(
+// TSize& aSize, TInt /*aSizeIndex*/, const TDesC8& aFormat )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameSize(
+ TSize& aSize,
+ TInt /*aSizeIndex*/,
+ const TDesC8& aFormat )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameSize() >>"), RThread().Id().operator TUint()));
+ if ( aFormat == KVtVideoMIMETypeYUV420 )
+ {
+ aSize.SetSize( KQcifWidth, KQcifHeight );
+ }
+ else
+ {
+ aSize.SetSize( 0, 0 );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameSize() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameRate(
+// TReal32& aRate, TInt /*aRateIndex*/, const TDesC8& aFormat,
+// const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameRate(
+ TReal32& aRate,
+ TInt /*aRateIndex*/,
+ const TDesC8& aFormat,
+ const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameRate() >>"), RThread().Id().operator TUint()));
+ if ( aFormat == KVtVideoMIMETypeYUV420 &&
+ aSize == TSize( KQcifWidth, KQcifHeight ) )
+ {
+ aRate = KFrameRate;
+ }
+ else
+ {
+ aRate = 0.0;
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameRate() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::DisplayMode
+// -----------------------------------------------------------------------------
+//
+TDisplayMode CVSStillImageDataProvider::DisplayMode() const
+ {
+#ifdef _DEBUG
+ TUint threadId( RThread().Id() );
+ switch( iDisplayMode )
+ {
+ case EColor4K:
+ RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor4K" ), threadId );
+ break;
+ case EColor64K:
+ RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor64K" ), threadId );
+ break;
+ case EColor16M:
+ RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor16M" ), threadId );
+ break;
+ case EColor16MU:
+ RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor16MU" ), threadId );
+ break;
+ default:
+ RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = %d" ), threadId, iDisplayMode );
+ break;
+ }
+#endif // _DEBUG
+ return iDisplayMode;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetContrastL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetContrastL(TInt /*aContrast*/)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]:CVSStillImageDataProvider::SetContrastL() LEAVE"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetContrast
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetContrast(TInt& /*aContrast*/) const
+ {
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetBrightnessL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetBrightnessL(TInt /*aBrightness*/)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]:CVSStillImageDataProvider::SetBrightnessL() LEAVE"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetBrightness
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetBrightness(TInt& /*aBrightness*/ ) const
+ {
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetWhiteBalanceL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetWhiteBalanceL( CCamera::TWhiteBalance /*aWhiteBalance*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetWhiteBalanceL() LEAVE"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetWhiteBalance
+// -----------------------------------------------------------------------------
+//
+ TInt CVSStillImageDataProvider::GetWhiteBalance(CCamera::TWhiteBalance& /*aWhiteBalance*/) const
+ {
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetColorToneL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetColorToneL( CCamera::CCameraImageProcessing::TEffect /*aValue*/ )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetColorToneL() LEAVE"), RThread().Id().operator TUint()));
+ User::Leave( KErrNotSupported );
+ }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetColorTone
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetColorTone( CCamera::CCameraImageProcessing::TEffect& /*aColorTone*/ ) const
+ {
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::InitializeReady
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::InitializeReady()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeReady()>> "), RThread().Id().operator TUint()));
+ if ( EPSUndoInitializing == iPSState )
+ {
+ NotifyError(KErrCancel);
+ UndoCommonInitialized();
+ iPSState = EPSUninitialized;
+ }
+ else
+ {
+ iPSState = EPSStopped;
+ Observer().vsProviderReady();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeReady()<< "), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::RefreshYUVData
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::RefreshYUVData( TImageShareDataBuffer& aYUVBitMap )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshYUVData()>> "), RThread().Id().operator TUint()));
+ iYUVBitMap = aYUVBitMap.iBitmap;
+ //Create YUV buffer only in play state
+ TRAP_IGNORE ( CreateYUVDataL() );
+ aYUVBitMap.iIsBitmapFree = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshYUVData()<< "), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::RefreshViewFinder
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::RefreshViewFinder( TImageShareDataBuffer& aVFBitMap )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder()>> "), RThread().Id().operator TUint()));
+ iVFBitmap = aVFBitMap.iBitmap;
+ aVFBitMap.iIsBitmapFree = ETrue;
+ // Allow VF refresh only if size is what
+ // has beed aquired and play state is on
+ if ( ( iTargetSize == iVFBitmap->Size() ) && ( iVFState == EVFPlaying ) )
+ {
+ iVFTimer->After( 1, &CVSStillImageDataProvider::VFTimer );
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder() conditon doesn't match, iVFState[%d] "), RThread().Id().operator TUint(), iVFState));
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder()<< "), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::NotifyImageHandlingError
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::NotifyImageHandlingError( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::NotifyImageHandlingError()>> "), RThread().Id().operator TUint()));
+ NotifyError( aError );
+ if ( ( KErrCancel == aError ) && ( EPSUndoInitializing == iPSState ) )
+ {
+ UndoCommonInitialized();
+ iPSState = EPSUninitialized;
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::NotifyImageHandlingError()<< "), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CancelInitializing
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CancelInitializing()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing()>> "), RThread().Id().operator TUint()));
+ if ( iPSState != EPSInitializing )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing(), iPSState is not valid,%d>> "), RThread().Id().operator TUint(), iPSState));
+ return;
+ }
+
+ if ( iInitType != TVSStillImageDataProviderParams::EInitializeFromFile )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing(), iInitType is not valid,%d>> "), RThread().Id().operator TUint(), iInitType));
+ return;
+ }
+ if ( iViewer->CancelInitializing() )
+ {
+ // In this condition, convert was cancelled , no any message will receive from multiframe provider,
+ // so delete multiFrame provider, and change IPSState, NotifyError to VT Engine
+ NotifyError(KErrCancel);
+ UndoCommonInitialized();
+ iPSState = EPSUninitialized;
+ }
+ else
+ {
+ // In this condition, cnverting is finished, and Scale will cancel(CVtImageScaler->Cancel()), but in CVtImageScaler::DoCancel(),
+ // there is a error notify exist, so we must wait the error message from multiframe provider,
+ // we change the iPSState to EPSUndoInitializing for waiting error message.
+ // Error message will be received in function CVSStillImageDataProvider::NotifyImageHandlingError
+ iPSState = EPSUndoInitializing;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing()<< "), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::UndoCommonInitialized
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::UndoCommonInitialized()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::UndoCommonInitialized()>> "), RThread().Id().operator TUint()));
+
+ iFreezeCS.Close();
+ if ( NULL != iVFTimer )
+ {
+ iVFTimer->Cancel();
+ }
+
+ delete iViewer;
+ iViewer = NULL;
+
+ delete iActiveWait;
+ iActiveWait = NULL;
+
+ delete iVFTimer;
+ iVFTimer = NULL;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::UndoCommonInitialized()<< "), RThread().Id().operator TUint()));
+
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cactivewait.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cactivewait.h"
+
+const TInt KFirstFrameIndx = 0;
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSActiveWait ===============================
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::~CVSActiveWait()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+CVSActiveWait< R >::~CVSActiveWait()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RequestStatus()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+TRequestStatus* CVSActiveWait< R >::RequestStatus()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() <<"), RThread().Id().operator TUint()));
+ return &iStatus;
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::Signal( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() >>"), RThread().Id().operator TUint()));
+ if( IsActive() )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aError );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RunL()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() >>"), RThread().Id().operator TUint()));
+ (iRequester->*iCallback)( iStatus.Int() );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::DoCancel()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() >>"), RThread().Id().operator TUint()));
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, KErrCancel );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframedataao.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,177 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmultiframedataao.h"
+#include "mmultiframeprovider.h"
+#include "cmultiframeprovider.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+// ============================ CMultiframeDataAO ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::CMultiframeDataAO( CMultiframeProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CMultiframeDataAO::CMultiframeDataAO( CMultiframeProvider* aRequester )
+: CTimer( EPriorityHigh ), iRequester( aRequester )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CMultiframeDataAO() >>"), RThread().Id().operator TUint()));
+ RThread me;
+ iThreadId = me.Id();
+ CActiveScheduler::Add( this );
+ TRAP_IGNORE(CTimer::ConstructL());
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CMultiframeDataAO() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::SetObserver( MMultiframeprovider* aObserever )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::SetObserver( MMultiframeprovider* aObserver )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::SetObserver() >>"), RThread().Id().operator TUint()));
+ iObserver = aObserver;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::SetObserver() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::~CMultiframeDataAO()
+// -----------------------------------------------------------------------------
+//
+CMultiframeDataAO::~CMultiframeDataAO()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::~CMultiframeDataAO() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::~CMultiframeDataAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::Activate( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::Activate( TTimeIntervalMicroSeconds aUpdateTime, TBool aInit, TBool aVFUpdate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::Activate() >>"), RThread().Id().operator TUint()));
+
+ TTimeIntervalMicroSeconds32 time = aUpdateTime.Int64();
+ iInit = aInit;
+ iVFUpdate = aVFUpdate;
+ if ( !IsActive() )
+ {
+ CTimer::After( time );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::Activate() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::LocalBuffer( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::LocalBuffer( CVtImageBitmap* aLocalBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::LocalBuffer() >>"), RThread().Id().operator TUint()));
+ iLocalBuffer.iBitmap = aLocalBuffer;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::LocalBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::RemoteBuffer( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::RemoteBuffer( CVtImageBitmap* aRemoteBuffer )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RemoteBuffer() >>"), RThread().Id().operator TUint()));
+ iRemoteBuffer.iBitmap = aRemoteBuffer;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RemoteBuffer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::RunL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::RunL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() >>"), RThread().Id().operator TUint()));
+
+ //stop loop ao
+ if (iRequireStopping)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() cancel by flag"), RThread().Id().operator TUint()));
+ iRequireStopping = EFalse;
+ return;
+ }
+
+ if ( !iVFUpdate )
+ {
+ iObserver->RefreshYUVData( iRemoteBuffer );
+ }
+ iObserver->RefreshViewFinder( iLocalBuffer );
+ iRequester->UseSecondVfBuffer();
+ if ( iInit )
+ {
+ iObserver->InitializeReady();
+ }
+ if ( !iVFUpdate )
+ {
+ iRequester->AddBitmapToFreeQueue();
+ }
+ if ( !iInit && !iVFUpdate )
+ {
+ iRequester->NextFrame();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::CancelTimeLoop()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::CancelTimeLoop()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CancelTimeLoop >>"), RThread().Id().operator TUint()));
+ if ( IsActive() )
+ {
+ if ( iStatus == KRequestPending )
+ {
+ RThread me;
+ if ( me.Id() == iThreadId )
+ {
+ Cancel();
+ iRequireStopping = EFalse;
+ }
+ else
+ {
+ iRequireStopping = ETrue;
+ }
+ }
+ else
+ {
+ iRequireStopping = ETrue;
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CancelTimeLoop <<"), RThread().Id().operator TUint()));
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframeloopao.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,233 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmultiframeloopao.h"
+#include "cmultiframeprovider.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+// ============================ CMultiframeloopAO ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::CMultiframeloopAO( CMultiframeProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CMultiframeloopAO::CMultiframeloopAO( CMultiframeProvider* aRequester )
+: CActive( EPriorityLow ), iRequester( aRequester ), iFreeBMCount(0), iRequireStopping(EFalse)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CMultiframeloopAO() >>"), RThread().Id().operator TUint()));
+ RThread me;
+ iThreadId = me.Id();
+ CActiveScheduler::Add( this );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CMultiframeloopAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::~CMultiframeloopAO()
+// -----------------------------------------------------------------------------
+//
+CMultiframeloopAO::~CMultiframeloopAO()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::~CMultiframeloopAO() >>"), RThread().Id().operator TUint()));
+ Cancel();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::~CMultiframeloopAO() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::Signal( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::Signal( )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::Signal() >>"), RThread().Id().operator TUint()));
+ iRequester->iAnimation = ETrue;
+ if ( !IsActive() )
+ {
+ SetActive();
+ TRequestStatus* pStatus = &iStatus;
+ RThread me;
+ if ( me.Id() == iThreadId )
+ {
+ User::RequestComplete( pStatus, KErrNone );
+ }
+ else
+ {
+ if ( me.Open( iThreadId ) == KErrNone )
+ {
+ *pStatus = KRequestPending;
+ me.RequestComplete( pStatus, KErrNone );
+ me.Close();
+ }
+ else
+ {
+ Panic( EVSPanicThreadOpenFailure );
+ }
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::Signal() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::RunL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::RunL()
+ {
+ iRequester->WaitForConverting();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() >>"), RThread().Id().operator TUint()));
+
+ //stop loop ao
+ if (iRequireStopping)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() CANCEL CALLED,stop by flag"), RThread().Id().operator TUint()));
+ iRequireStopping = EFalse;
+ iRequester->ReleaseForConverting();
+ return;
+ }
+
+ // Cancel is handled in this way because
+ if ( iStatus == KErrCancel)
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() CANCEL CALLED IN PROTO THREAD STOP LOOPPING"), RThread().Id().operator TUint()));
+ iRequester->ReleaseForConverting();
+ return;
+ }
+
+ //If free bitmaps proceed next frame
+ if ( iFreeBMCount > 0 )
+ {
+ ++iIndex;
+ // Loop animation starting from first frame
+ if ( iIndex > iFramecount - 1 )
+ {
+ iIndex = KFirstFrameIndx;
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() RunL index %d"), RThread().Id().operator TUint(), iIndex));
+ iRequester->ConvertAndScaleL( iIndex );
+ }
+ //Wait until free bitmaps to proceed
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() NO FREE BMs"), RThread().Id().operator TUint()));
+ iStatus = KRequestPending;
+ SetActive();
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() <<"), RThread().Id().operator TUint()));
+ iRequester->ReleaseForConverting();
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::RemoveFreeBitmaps()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::RemoveFreeBitmaps( TInt aCount )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RemoveFreeBitmaps() >>"), RThread().Id().operator TUint()));
+ iFreeBMCount = iFreeBMCount - aCount;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RemoveFreeBitmaps() frames %d <<"), RThread().Id().operator TUint(), aCount));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::SetFreeBitmaps()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::SetFreeBitmaps( TInt aCount )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFreeBitmaps() >>"), RThread().Id().operator TUint()));
+ iFreeBMCount = iFreeBMCount + aCount;
+ if ( IsActive() && iStatus == KRequestPending)
+ {
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, KErrNone );
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFreeBitmaps() frames %d <<"), RThread().Id().operator TUint(), aCount));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::SetFrameCount()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::SetFrameCount( TInt aCount )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFrameCount() >>"), RThread().Id().operator TUint()));
+ iFramecount = aCount;
+ iIndex = 0;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFrameCount() frames %d <<"), RThread().Id().operator TUint(), aCount));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::CancelDataLoop()
+// -----------------------------------------------------------------------------
+//
+ void CMultiframeloopAO::CancelDataLoop()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CancelDataLoop() >>"), RThread().Id().operator TUint()));
+ if ( IsActive() )
+ {
+ if ( iStatus == KRequestPending )
+ {
+ RThread me;
+ if ( me.Id() == iThreadId )
+ {
+ Cancel();
+ }
+ else
+ {
+ if ( me.Open( iThreadId ) == KErrNone )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ *pStatus = KRequestPending;
+ me.RequestComplete( pStatus, KErrCancel );
+ me.Close();
+ }
+ else
+ {
+ Panic( EVSPanicThreadOpenFailure );
+ }
+ }
+ }
+ else
+ {
+ iRequireStopping = ETrue;
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CancelDataLoop() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::DoCancel()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::DoCancel() >>"), RThread().Id().operator TUint()));
+ if ( iStatus == KRequestPending )
+ {
+ TRequestStatus* pStatus = &iStatus;
+ User::RequestComplete( pStatus, KErrCancel );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::DoCancel() <<"), RThread().Id().operator TUint()));
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframeprovider.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1024 @@
+/*
+* 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: Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include <imageconversion.h>
+#include <cvtimageconverter.h>
+#include <rphcltserver.h>
+#include <cphcltimagehandler.h>
+#include <bautils.h>
+
+#include "cmultiframeprovider.h"
+#include "cmultiframeloopao.h"
+#include "cmultiframedataao.h"
+
+#include "CVSStillImageDataProvider.h"
+#include "cvtimagebitmap.h"
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+
+// Default bitmap size is VGA
+static const TInt KDefaultBitmapSizeWidth = 640;
+static const TInt KDefaultBitmapSizeHeight = 480;
+
+// MACROS
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// ============================ TScalingMediator ===============================
+
+// -----------------------------------------------------------------------------
+// TScalingMediator::TScalingMediator( )
+// -----------------------------------------------------------------------------
+//
+TScalingMediator::TScalingMediator()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TScalingMediator::ScalingFinished( )
+// -----------------------------------------------------------------------------
+//
+void TScalingMediator::ScalingFinished( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("TScalingMediator::ScalingFinished() >>")));
+ iWait->Signal( aError );
+ __IF_DEBUG(Print(_L("TScalingMediator::ScalingFinished() error %d <<"), aError));
+ }
+// -----------------------------------------------------------------------------
+// TScalingMediator::ScalingFinished( )
+// -----------------------------------------------------------------------------
+//
+void TScalingMediator::SetWaiter( CVSActiveWait< CMultiframeProvider >* aWait )
+ {
+ iWait = aWait;
+ }
+
+// ============================ CMultiframeProvider ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::NewL( )
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider* CMultiframeProvider::NewL( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode )
+ {
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CMultiframeProvider::NewL() >>"), RThread().Id().operator TUint()));
+ CMultiframeProvider* self =
+ new (ELeave) CMultiframeProvider( aObserver, aDisplayMode );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ __IF_DEBUG(Print(_L("VideoSource: [%d] CMultiframeProvider::NewL() <<"), RThread().Id().operator TUint()));
+ return self;
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::CMultiframeProvider(
+// MVSDataProviderObserver* aObserver )
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider::CMultiframeProvider(
+ MMultiframeprovider* aObserver , TDisplayMode aDisplayMode ): iDisplayMode( aDisplayMode ), iObserver( aObserver ), iBlank( EFalse ), iGSImage( EFalse )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::CMultiframeProvider() >>"), RThread().Id().operator TUint()));
+ //Set target VF size QCIF as default
+ iTargetSize.SetSize( KQcifWidth , KQcifHeight );
+ iVFSize.SetSize( KQcifWidth , KQcifHeight );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::CMultiframeProvider() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::~CMultiframeProvider()
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider::~CMultiframeProvider()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::~CMultiframeProvider() >>"), RThread().Id().operator TUint()));
+ iFs.Close();
+ iFreezeCS.Close();
+ delete iImageDecoder; iImageDecoder = 0;
+ delete iVtImageScalerInit;
+ delete iVtImageScalerScale;
+ delete iActiveWaitInit;
+ delete iActiveWaitScale;
+ delete iActiveWaitInitScale;
+ delete iConverted;
+ delete iMask;
+ delete iTempBM;
+ delete iDataTimer;
+ delete iLoopAo;
+ if ( iScaled != iBuffer1 && iScaled != iBuffer2 )
+ {
+ delete iScaled;
+ }
+ delete iGSBitmap;
+ if ( !iBlank || !iGSImage )
+ {
+ delete iBuffer1;
+ delete iBuffer2;
+ }
+ delete iFirstVfBuf;
+ delete iSecondVfBuf;
+ iFreeQueue.Close();
+ iDefaultImageFile.Close();
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::~CMultiframeProvider() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+ User::LeaveIfError( iFs.Connect() );
+ User::LeaveIfError( iFreezeCS.CreateLocal() );
+
+ // Create waiters and mediators for scaling purposes
+ iActiveWaitInit = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+ iActiveWaitScale = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+ iActiveWaitInitScale = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+ iInitMediator.SetWaiter( iActiveWaitInitScale );
+ iScalingMediator.SetWaiter( iActiveWaitScale );
+ iVtImageScalerInit = CVtImageScaler::NewL( iInitMediator, CVtImageScaler::EBilinear );
+ iVtImageScalerScale = CVtImageScaler::NewL( iScalingMediator, CVtImageScaler::EBilinear );
+ iDataTimer = new (ELeave) CMultiframeDataAO( this );
+ iDataTimer->SetObserver( iObserver );
+ iLoopAo = new (ELeave) CMultiframeloopAO( this );
+ iFirstVfBuf = CVtImageBitmap::NewL( TSize( KQcifWidth >> 2, KQcifHeight >> 2 ), iDisplayMode );
+ iSecondVfBuf = CVtImageBitmap::NewL( TSize( KQcifWidth >> 2, KQcifHeight >> 2 ), iDisplayMode );
+ iSecondVFBuffer = EFalse;
+ iFirstVFBuffer = ETrue;
+ iIsVfStopped = EFalse;
+ iWaitForConverting = EFalse;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IniatializeGSL()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IniatializeGSL( const TGeneralSettingsImageType aType )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeGSL() >>"), RThread().Id().operator TUint()));
+ if ( aType == EGSStillImage )
+ {
+ // Open connection to phone server
+ RPhCltServer phoneClient;
+ User::LeaveIfError( phoneClient.Connect() );
+ CleanupClosePushL( phoneClient );
+
+ CPhCltImageHandler* stillH = CPhCltImageHandler::NewL();
+ CleanupStack::PushL( stillH );
+
+ // Load images
+ CPhCltImageParams* imageParams;
+ imageParams = stillH->CPhCltBaseImageParamsL( EPhCltTypeVTStill );
+ CleanupStack::PushL( imageParams );
+ User::LeaveIfError( stillH->LoadImages( imageParams ) );
+
+ // Duplicate to image
+ if( imageParams->Count() > 0 )
+ {
+ __IF_DEBUG(Print(_L("iImageCount > 0")));
+ iGSBitmap = CVtImageBitmap::NewL( imageParams->GetImageL( 0 ) );
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("iImageCount <= 0 -> User::Leave( KErrNotFound )")));
+ User::Leave( KErrNotFound );
+ }
+ // Cleanup
+ CleanupStack::PopAndDestroy( 3 ); // phoneClient, stillH, imageParams
+ iScaled = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+
+ // If bitmap has different display mode than screen, then new bitmap
+ // is created and image is converted to screen's display mode
+ if ( iGSBitmap->Bitmap().DisplayMode() != iDisplayMode ||
+ iGSBitmap->Bitmap().ExtendedBitmapType() != KNullUid )
+ {
+ CVtImageBitmap* temp = CVtImageBitmap::NewL(
+ iGSBitmap->Bitmap().SizeInPixels(), iDisplayMode );
+ CleanupStack::PushL( temp );
+ // Color conversion is done by blitting it to other bitmap
+ CFbsBitmapDevice* fbd = CFbsBitmapDevice::NewL( &temp->Bitmap() );
+ CleanupStack::PushL( fbd );
+ CFbsBitGc* fgc = NULL;
+ User::LeaveIfError( fbd->CreateContext( fgc ) );
+ CleanupStack::PushL( fgc );
+ fgc->BitBlt( TPoint(), &iGSBitmap->Bitmap() );
+ CleanupStack::PopAndDestroy( 2 ); // fbd, fgc
+ CleanupStack::Pop(); // temp
+ delete iGSBitmap; iGSBitmap = NULL;
+ iGSBitmap = temp;
+ }
+ iGSImage = ETrue;
+ iCount = 1;
+ iActiveWaitInit->InitializeWaiter( &CMultiframeProvider::ConversionFinished );
+ iActiveWaitInit->Signal( KErrNone );
+ }
+ else
+ { // default still image prepared by using file handle
+ InitializeL( NULL );
+ }
+ iInitialization = ETrue;
+ iDelay = 0;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeGSL() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IniatializeBlank()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IniatializeBlankL()
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeBlank() >>"), RThread().Id().operator TUint()));
+ iBlank = ETrue;
+ iInitialization = ETrue;
+ iDelay = 0;
+ iCount = 1;
+
+ CFbsBitmap* tempBitmap = 0;
+
+ CreateBlankBitmapL(
+ tempBitmap,
+ TSize( KQcifWidth, KQcifHeight ),
+ iDisplayMode,
+#ifdef _DEBUG
+ KRgbYellow
+#else
+ KRgbBlack
+#endif
+ );
+
+ CleanupStack::PushL( tempBitmap );
+ iScaled = CVtImageBitmap::NewL( tempBitmap->Handle() );
+ CleanupStack::PopAndDestroy(); // tempBitmap
+ tempBitmap = 0;
+
+ iActiveWaitInit->InitializeWaiter( &CMultiframeProvider::BMSScalingFinished );
+ iActiveWaitInit->Signal( KErrNone );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeBlank() <<"), RThread().Id().operator TUint()));
+ }
+ // -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateBlankBitmapL(
+// CFbsBitmap*& aBitmap, const TSize& aSize, const TDisplayMode& aMode,
+// const TRgb& aColor )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::CreateBlankBitmapL(
+ CFbsBitmap*& aBitmap,
+ const TSize& aSize,
+ const TDisplayMode& aMode,
+ const TRgb& aColor )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CreateBlankBitmapL() >>"), RThread().Id().operator TUint()));
+ if( aBitmap )
+ {
+ delete aBitmap;
+ aBitmap = 0;
+ }
+ aBitmap = new (ELeave) CFbsBitmap();
+ User::LeaveIfError( aBitmap->Create( aSize, aMode ) );
+ CFbsBitmapDevice* fbd = CFbsBitmapDevice::NewL( aBitmap );
+ CleanupStack::PushL( fbd );
+ CFbsBitGc* fgc = 0;
+ User::LeaveIfError( fbd->CreateContext( fgc ) );
+ CleanupStack::PushL( fgc );
+
+ fgc->SetPenColor( aColor );
+ fgc->SetBrushColor( aColor );
+ fgc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+ fgc->DrawRect( TRect( aSize ) );
+
+ CleanupStack::PopAndDestroy( 2 ); // fbd, fgc
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CreateBlankBitmapL() <<"), RThread().Id().operator TUint()));
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::Iniatialize()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::InitializeL( const TFileName* aFileName )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+ // Create bitmaps used for conversion and scaling
+ iBuffer1 = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+ iBuffer2 = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+ User::LeaveIfError( iFreeQueue.Append( iBuffer1 ) );
+ User::LeaveIfError( iFreeQueue.Append( iBuffer2 ) );
+ iLoopAo->SetFreeBitmaps( 2 );
+
+ // Create ICL decoder in its own thread for current file
+ TInt decodingoptions(
+ CImageDecoder::TOptions( CImageDecoder::EOptionAlwaysThread | CImageDecoder::EAllowGeneratedMask ) );
+
+ if ( aFileName )
+ {
+ __IF_DEBUG(Print(_L(" file name exist, creating CImageDecoder")));
+ iImageDecoder = CImageDecoder::FileNewL( iFs, *aFileName, (CImageDecoder::TOptions )decodingoptions /*CImageDecoder::EOptionNone*/ );
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L(" default vt image file => use phone server")));
+ // default VT image file handle obtained from phone server
+ RPhCltServer phoneClient;
+ User::LeaveIfError( phoneClient.Connect() );
+ __IF_DEBUG(Print(_L(" connected to phone server")));
+ CleanupClosePushL( phoneClient );
+ CPhCltImageHandler* handler = CPhCltImageHandler::NewL();
+ CleanupStack::PushL( handler );
+ __IF_DEBUG(Print(_L(" created image handler")));
+ User::LeaveIfError( handler->OpenDefaultVtImage( iDefaultImageFile ) );
+ decodingoptions &= ~CImageDecoder::EOptionAlwaysThread;
+ __IF_DEBUG(Print(_L(" creating image decoder")));
+ iImageDecoder = CImageDecoder::FileNewL( iDefaultImageFile, ContentAccess::EPlay, (CImageDecoder::TOptions )decodingoptions );
+ __IF_DEBUG(Print(_L(" created image decoder")));
+ CleanupStack::PopAndDestroy( 2 ); // handler, phoneClient
+ }
+ // Use ICL to calculate frame count
+ iCount = iImageDecoder->FrameCount();
+ __IF_DEBUG(Print(_L(" frame count=%d"),iCount));
+ //If advanced flags are on show only first frame!
+ for ( TInt index = 0; index < iCount; ++index )
+ {
+ TFrameInfo frameInfo( iImageDecoder->FrameInfo( index ) );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() frameInfo.iFlags %b >>"), RThread().Id().operator TUint(), frameInfo.iFlags));
+ if ( frameInfo.iFlags & TFrameInfo::ELeaveInPlace )
+ {
+ iDelay = 0;
+ iCount = 1;
+ }
+ }
+ //Set num of frames to viewer AO
+ iLoopAo->SetFrameCount( iCount );
+ //For default loopping frame sequence is disabled
+ iAnimation = EFalse;
+ iInitialization = ETrue;
+ //Start ICL image conversion (decoding) and local scaling
+ ConvertAndScaleL( KFirstFrameIndx );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::SetVFScalingTargetSize()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::SetVFScalingTargetSize( TSize aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::SetVFScalingTargetSize() >>"), RThread().Id().operator TUint()));
+ iTargetSize = aSize;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::SetVFScalingTargetSize() W %d H %d <<"), RThread().Id().operator TUint(), aSize.iWidth , aSize.iHeight ));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConvertAndScaleL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConvertAndScaleL( TInt aFrameIndex )
+ {
+ // Variables related to Bitmap size
+ // calculation
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() aFrameIndex %d>>"), RThread().Id().operator TUint(),aFrameIndex));
+ TSize convertedBitmapSize;
+ TFrameInfo frameInfo( iImageDecoder->FrameInfo( aFrameIndex ) );
+ if ( !iInitialization )
+ {
+ TInt delayindex;
+ delayindex = aFrameIndex - 1;
+ if ( delayindex < KFirstFrameIndx )
+ {
+ delayindex = ( iCount - 1 );
+ }
+ TFrameInfo delayframeInfo( iImageDecoder->FrameInfo( delayindex ) );
+ iDelay = delayframeInfo.iDelay;
+ }
+ else
+ {
+ iDelay = 1;
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() iDelay %d>>"), RThread().Id().operator TUint(),iDelay.Int64() ));
+#ifdef _DEBUG
+ TUint threadId( RThread().Id() );
+ switch ( frameInfo.iFrameDisplayMode )
+ {
+ case EColor4K:
+ RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor4K" ),
+ threadId );
+ break;
+ case EColor64K:
+ RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor64K" ),
+ threadId );
+ break;
+ case EColor16M:
+ RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor16M" ),
+ threadId );
+ break;
+ case EColor16MU:
+ RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor16MU" ),
+ threadId );
+ break;
+ default:
+ RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = %d" ),
+ threadId, frameInfo.iFrameDisplayMode );
+ break;
+ }
+
+ RDebug::Print( _L( "VideoSource [%d]: CMultiframeProvider:: frameInfo.iFlags %d" ),
+ threadId,frameInfo.iFlags );
+#endif // _DEBUG
+
+ // Use imagedecoder to calculate how many times source picture needs to be divided by 2
+ // to fit in default (VGA) picture
+ TInt reductionfactor = iImageDecoder->ReductionFactor( frameInfo.iOverallSizeInPixels,
+ TSize( KDefaultBitmapSizeWidth, KDefaultBitmapSizeHeight ) );
+ if ( iImageDecoder->ReducedSize( frameInfo.iOverallSizeInPixels, reductionfactor, convertedBitmapSize ) )
+ {
+ convertedBitmapSize = frameInfo.iOverallSizeInPixels;
+ }
+
+#ifdef _DEBUG
+ RDebug::Print( _L( "VideoSource [%d]: convertedBitmapSize Width = %d convertedBitmapSize Height = %d" ),
+ threadId, convertedBitmapSize.iWidth, convertedBitmapSize.iHeight );
+#endif // _DEBUG
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() iConverted"), RThread().Id().operator TUint()));
+ iConverted = CVtImageBitmap::NewL( convertedBitmapSize, iDisplayMode );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() iConverted"), RThread().Id().operator TUint()));
+#ifdef _DEBUG
+ RDebug::Print( _L( "VideoSource [%d]: convBitmap Width = %d convBitmap Height = %d" ),
+ threadId, iConverted->Size().iWidth, iConverted->Size().iHeight );
+#endif // _DEBUG
+
+ iStartTime.HomeTime();
+ if ( iFreeQueue.Count() < 2 )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConvertAndScale() iFreeQueue.Count() < 2 "), RThread().Id().operator TUint()));
+ iOldBM = ETrue;
+ iOldBitmap = iScaled;
+ }
+ iScaled = iFreeQueue[ 0 ];
+ iFreeQueue.Remove( 0 );
+ iLoopAo->RemoveFreeBitmaps( 1 );
+ iActiveWaitInit->InitializeWaiter( &CMultiframeProvider::ConversionFinished );
+ // Check if masking is supported
+ if ( frameInfo.iFlags & TFrameInfo::ETransparencyPossible )
+ {
+ // Create mask for bitmap
+ iMask = new ( ELeave )CFbsBitmap();
+ User::LeaveIfError( iMask->Create( convertedBitmapSize, EGray256 ));
+ iTempBM = CVtImageBitmap::NewL( convertedBitmapSize, iDisplayMode );
+ iImageDecoder->Convert( iActiveWaitInit->RequestStatus(), iTempBM->Bitmap(), *iMask, aFrameIndex );
+ }
+ // No mask
+ else
+ {
+ iImageDecoder->Convert( iActiveWaitInit->RequestStatus(), iConverted->Bitmap(), aFrameIndex );
+ }
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConversionFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConversionFinished( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() >>"), RThread().Id().operator TUint()));
+ if ( iCount == 1 || aError )
+ {
+ // delete decoder if not needed any more
+ // 1) single frame image, no further frames to convert
+ // 2) error occured, decoder won't be used anyway
+ __IF_DEBUG(Print(_L(" single frame image => destruct iImageDecoder, err %d"), aError ) );
+ delete iImageDecoder;
+ iImageDecoder = NULL;
+ }
+ // no harm done if other than this used, handle would already be 0
+ iDefaultImageFile.Close();
+ if ( aError == KErrNone )
+ {
+ iActiveWaitInitScale->InitializeWaiter( &CMultiframeProvider::BMSScalingFinished );
+ if ( iGSImage )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() scale GS "), RThread().Id().operator TUint()));
+ iVtImageScalerInit->Scale( *iGSBitmap, *iScaled );
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() scale "), RThread().Id().operator TUint()));
+ // Blit mask into a converted bitmap
+ if ( iMask )
+ {
+ CGraphicsContext* bitmapcontext = NULL;
+ CFbsBitmapDevice* bitmapdevice = NULL;
+ // Create bm device
+ TRAPD( error, bitmapdevice = CFbsBitmapDevice::NewL( &( iConverted->Bitmap() ) ) );
+ if ( error != KErrNone )
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ delete bitmapdevice;
+ delete iTempBM;
+ delete iMask;
+ iMask = NULL;
+ iTempBM = NULL;
+ return;
+ }
+ // Create GC for bm
+ error = bitmapdevice->CreateContext( bitmapcontext );
+ if ( error != KErrNone )
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ delete bitmapdevice;
+ delete bitmapcontext;
+ delete iTempBM;
+ delete iMask;
+ iMask = NULL;
+ iTempBM = NULL;
+ return;
+ }
+ // Fill destination bitmap with white color
+ TRect rect( iConverted->Size() );
+ bitmapcontext->SetBrushStyle( CGraphicsContext:: ESolidBrush );
+ bitmapcontext->SetPenStyle( CGraphicsContext::ESolidPen );
+ bitmapcontext->SetBrushColor( KRgbWhite );
+ bitmapcontext->SetPenColor( KRgbWhite);
+ bitmapcontext->DrawRect( rect );
+
+ // Draw mask and data bitmap into a same destination bm
+ bitmapcontext->DrawBitmapMasked( iConverted->Size(), &( iTempBM->Bitmap() ), iConverted->Size(), iMask, EFalse );
+ delete bitmapdevice;
+ delete bitmapcontext;
+ delete iTempBM;
+ delete iMask;
+ iMask = NULL;
+ iTempBM = NULL;
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConversionFinished() iMask"), RThread().Id().operator TUint()));
+ }
+ iVtImageScalerInit->Scale( *iConverted, *iScaled );
+ }
+ }
+ // Allways inform Decoding problems
+ else
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ delete iTempBM;
+ delete iMask;
+ iMask = NULL;
+ iTempBM = NULL;
+ // GIF used when error happen
+ if ( iCount > 1 )
+ {
+ iCount = 1;
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() error %d <<"), RThread().Id().operator TUint(), aError));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::BMSScalingFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::BMSScalingFinished( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::BMSScalingFinished() >>"), RThread().Id().operator TUint()));
+ if ( aError == KErrNone )
+ {
+ VFScalingReady();
+ }
+ else
+ {
+#if 0
+ if ( aError != KErrCancel ) // If KErrCancel, then ignore error!
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ }
+ //Needs to be deleted also in cancel case
+ delete iConverted; iConverted = NULL;
+#endif
+ delete iConverted; iConverted = NULL;
+ iObserver->NotifyImageHandlingError( aError );
+
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::BMSScalingFinished() err %d <<"), RThread().Id().operator TUint(), aError));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::AddBitmapToFreeQueue( CVtImageBitmap* aBitmap )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::AddBitmapToFreeQueue()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() >>"), RThread().Id().operator TUint()));
+ if ( iOldBM )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() OLD BM"), RThread().Id().operator TUint()));
+ iOldBM = EFalse;
+ User::LeaveIfError( iFreeQueue.Append( iOldBitmap ) );
+ }
+ else
+ {
+ User::LeaveIfError( iFreeQueue.Append( iScaled ) );
+ }
+ iLoopAo->SetFreeBitmaps( 1 );
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::UseSecondVfBuffer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::UseSecondVfBuffer()
+ {
+ iSecondVFBuffer = ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::VFScalingReady()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::VFScalingReady()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() >>"), RThread().Id().operator TUint()));
+ delete iConverted; iConverted = 0;
+
+ // Calculate frame update delay here!
+ TTime refpointtime;
+ refpointtime.HomeTime();
+ TTimeIntervalMicroSeconds deltaTime = refpointtime.MicroSecondsFrom( iStartTime );
+ iFrameUpdateTime = iDelay.Int64() - deltaTime.Int64();
+ if ( iFrameUpdateTime < 0 )
+ {
+ iFrameUpdateTime = 1;
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() iFrameUpdateTime %d>>"), RThread().Id().operator TUint(), iFrameUpdateTime.Int64()));
+ // Scale VF to fit in requested size
+ // size is as default QCIF
+ if ( iIsVfStopped )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()VF Stop>>"), RThread().Id().operator TUint()));
+ if ( iActiveWaitScale->IsActive() )
+ {
+ //ScaleCopy running
+ //Waiting is OK
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()ScaleCopy running>>"), RThread().Id().operator TUint()));
+ }
+ else
+ {
+ //ScaleCopy is not running, Jump ScaleCopy
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()jump ScaleCopy>>"), RThread().Id().operator TUint()));
+ iActiveWaitScale->InitializeWaiter( &CMultiframeProvider::VFRescalingFinished );
+ iActiveWaitScale->Signal(KErrNone);
+ }
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()Normal run>>"), RThread().Id().operator TUint()));
+ iVFUpdate = EFalse;
+ ScaleCopy( iTargetSize );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ScaleCopy( TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ScaleCopy( TSize& aSize, TBool aVFUpdate )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy() >>"), RThread().Id().operator TUint()));
+
+ iVFUpdate = aVFUpdate;
+ iVFSize = aSize;
+ if ( iSecondVFBuffer && !iFirstVFBuffer )
+ {
+ iVFbitmap = iSecondVfBuf;
+ iSecondVFBuffer = EFalse;
+ iFirstVFBuffer = ETrue;
+ }
+ else
+ {
+ iVFbitmap = iFirstVfBuf;
+ iFirstVFBuffer = EFalse;
+ }
+ //If Scaling is ongoing
+ if ( iActiveWaitScale->IsActive() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy(): active, storing size"), RThread().Id().operator TUint()));
+ iWantedVFSize = aSize;
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy(): scaling NOW"), RThread().Id().operator TUint()));
+ iActiveWaitScale->InitializeWaiter( &CMultiframeProvider::VFRescalingFinished );
+ TInt result( iVFbitmap->Bitmap().Resize( aSize ) );
+ __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy() result %d <<"), RThread().Id().operator TUint(), result));
+ if ( result != KErrNone )
+ {
+ iActiveWaitScale->Signal( result );
+ }
+ else
+ {
+ iVtImageScalerScale->Scale( *iScaled, *iVFbitmap );
+ }
+ }
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::NextFrame()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::NextFrame()
+ {
+ iFreezeCS.Wait();
+ iInitialization = EFalse;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() >>"), RThread().Id().operator TUint()));
+
+ if ( iNumOfConsumers < 1 )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() Consumer < 1>>"), RThread().Id().operator TUint()));
+ iFreezeCS.Signal();
+ return;
+ }
+
+ if (iCount > 1 && !iActiveWaitInit->IsActive() )
+ {
+ if (iWaitForConverting)
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() Because CMultiframeloopAO::RunL is executing, so Signal is not needed"), RThread().Id().operator TUint()));
+ }
+ else
+ {
+ iLoopAo->Signal();
+ }
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() <<"), RThread().Id().operator TUint()));
+ iFreezeCS.Signal();
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IncreaseDataConsumer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IncreaseDataConsumer()
+ {
+ iFreezeCS.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IncreaseDataConsumer() >>"), RThread().Id().operator TUint()));
+ ++iNumOfConsumers;
+ iFreezeCS.Signal();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IncreaseDataConsumer() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::DecreaseDataConsumer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::DecreaseDataConsumer()
+ {
+ iFreezeCS.Wait();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::DecreaseDataConsumer() >>"), RThread().Id().operator TUint()));
+ --iNumOfConsumers;
+ if ( iNumOfConsumers < 1 )
+ {
+ iLoopAo->CancelDataLoop();
+ iDataTimer->CancelTimeLoop();
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::DecreaseDataConsumer() <<"), RThread().Id().operator TUint()));
+ iFreezeCS.Signal();
+ }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ScaleVF( const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ScaleVF( const TSize& aSize )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScaleVF() >>"), RThread().Id().operator TUint()));
+ iActiveWaitScale->InitializeWaiter( &CMultiframeProvider::VFRescalingFinished );
+ TInt result( iVFbitmap->Bitmap().Resize( aSize ) );
+ ClearVFScalingTargetSize();
+ if ( result != KErrNone )
+ {
+ iActiveWaitScale->Signal( result );
+ }
+ else
+ {
+ iVtImageScalerScale->Scale( *iScaled, *iVFbitmap );
+ }
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScaleVF() result %d <<"), RThread().Id().operator TUint(), result));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::VFRescalingFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::VFRescalingFinished( TInt aError )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() >>"), RThread().Id().operator TUint()));
+ if ( aError == KErrNone )
+ {
+ if ( iWantedVFSize != TSize() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() REScaling needed"), RThread().Id().operator TUint()));
+ ScaleVF( iWantedVFSize );
+ ClearVFScalingTargetSize();
+ }
+ else
+ {
+ iDataTimer->CancelTimeLoop();
+
+ if ( !iIsVfStopped && !iVFUpdate )
+ {
+ //Normally, VF and VS work
+ iVFCurrent = iVFbitmap;
+ iYUVBitMap = iScaled;
+ iDataTimer->LocalBuffer(iVFCurrent);
+ iDataTimer->RemoteBuffer(iYUVBitMap);
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() normal, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+ iFrameUpdateTime.Int64()));
+ iDataTimer->Activate(iFrameUpdateTime, iInitialization, iVFUpdate);
+ }
+ else if ( iIsVfStopped && !iVFUpdate )
+ {
+ //VF doesn't work.
+ iYUVBitMap = iScaled;
+ iDataTimer->RemoteBuffer(iYUVBitMap);
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() VF Stop, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+ iFrameUpdateTime.Int64()));
+ iDataTimer->Activate( iFrameUpdateTime, iInitialization, iVFUpdate);
+ }
+ else if ( iIsVfStopped && iVFUpdate )
+ {
+ //VF restart
+ iIsVfStopped = EFalse;
+ iVFUpdate = EFalse;
+ iVFCurrent = iVFbitmap;
+ iYUVBitMap = iScaled;
+ iDataTimer->LocalBuffer(iVFCurrent);
+ iDataTimer->RemoteBuffer(iYUVBitMap);
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() VF Restart iFrameUpdateTime 1>>"),
+ RThread().Id().operator TUint()));
+ iDataTimer->Activate(1, iInitialization, iVFUpdate);
+ }
+ else
+ {
+ //maybe this condition never execute.
+ iVFCurrent = iVFbitmap;
+ iDataTimer->LocalBuffer(iVFCurrent);
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() last one, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+ iFrameUpdateTime.Int64()));
+ iDataTimer->Activate( 1, iInitialization, iVFUpdate);
+ }
+ }
+ }
+#if 0
+ else if ( ( aError == KErrCancel ) )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() CANCEL"), RThread().Id().operator TUint()));
+ }
+ else if( aError != KErrCancel ) // If KErrCancel, then ignore error!
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ }
+#endif
+ else
+ {
+ iObserver->NotifyImageHandlingError( aError );
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() err %d <<"), RThread().Id().operator TUint(), aError));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IsVFStopped()
+// -----------------------------------------------------------------------------
+//
+TBool CMultiframeProvider::IsVFStopped()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IsVFStopped() >>"), RThread().Id().operator TUint()));
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IsVFStopped() <<"), RThread().Id().operator TUint()));
+ return iIsVfStopped;
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::SetVFStop()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::SetVFStop()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::SetVFStop() >>"), RThread().Id().operator TUint()));
+ iIsVfStopped = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::SetVFStop() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::WaitForConverting()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::WaitForConverting()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::WaitForConverting() >>"), RThread().Id().operator TUint()));
+ iWaitForConverting = ETrue;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::WaitForConverting() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::WaitForConverting()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ReleaseForConverting()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ReleaseForConverting() >>"), RThread().Id().operator TUint()));
+ iWaitForConverting = EFalse;
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ReleaseForConverting() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ClearVFScalingTargetSize()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ClearVFScalingTargetSize()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ClearVFScalingTargetSize() >>"), RThread().Id().operator TUint()));
+ iWantedVFSize = TSize();
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ClearVFScalingTargetSize() <<"), RThread().Id().operator TUint()));
+ }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::CancelInitializing()
+// -----------------------------------------------------------------------------
+//
+TBool CMultiframeProvider::CancelInitializing()
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() >>"), RThread().Id().operator TUint()));
+ TBool lResult = EFalse;
+
+ if ( NULL == iImageDecoder )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() iImageDecoder is NULL ==="), RThread().Id().operator TUint()));
+ // In this condition, Convert is already finished
+ if ( iVtImageScalerInit->IsActive() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iVtImageScalerInit->Cancel ==="),
+ RThread().Id().operator TUint(), __LINE__));
+ iVtImageScalerInit->Cancel();
+ }
+ else if ( iActiveWaitInitScale->IsActive() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iActiveWaitInitScale->Cancel ==="),
+ RThread().Id().operator TUint(), __LINE__));
+ iActiveWaitInitScale->Cancel();
+ }
+ else if ( iVtImageScalerScale->IsActive() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iVtImageScalerScale->Cancel ==="),
+ RThread().Id().operator TUint(), __LINE__));
+ iVtImageScalerScale->Cancel();
+ }
+ else if ( iActiveWaitScale->IsActive() )
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iActiveWaitScale->Cancel ==="),
+ RThread().Id().operator TUint(), __LINE__));
+ iActiveWaitScale->Cancel();
+ }
+ else
+ {
+ //In this condition, the convert,scale,copyScale were finished,
+ //so do nothing, Waiting for InitializeReady()
+ __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() Nothong to do,wait finish ==="),
+ RThread().Id().operator TUint(), __LINE__));
+ }
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() cancel convert ==="), RThread().Id().operator TUint()));
+ //Convert is not finished, so we can cancel it, and return ETrue
+ iImageDecoder->Cancel();
+ lResult = ETrue;
+ }
+
+ __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() <<"), RThread().Id().operator TUint()));
+ return lResult;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 - 2006 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: Build information for Video Telephony protocol subsystem.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Include components' bld.inf files
+#include "../DisplaySink/group/bld.inf"
+#include "../VideoSource/group/bld.inf"
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/bwins/videotelprotou.def Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,13 @@
+EXPORTS
+ ?DeleteAudioSink@VTProtocolFactory@@SAHPAVMVTAudioSink@@@Z @ 1 NONAME ; int VTProtocolFactory::DeleteAudioSink(class MVTAudioSink *)
+ ?CreateAudioSink@VTProtocolFactory@@SAPAVMVTAudioSink@@XZ @ 2 NONAME ; class MVTAudioSink * VTProtocolFactory::CreateAudioSink(void)
+ ?CreateCommServerL@VTProtocolFactory@@SAPAVMCommServer@@ABVTDesC16@@H@Z @ 3 NONAME ; class MCommServer * VTProtocolFactory::CreateCommServerL(class TDesC16 const &, int)
+ ?CreateUserInputIndication@VTProtocolFactory@@SAPAVMVTUserInput@@W4TUserInputType@@E@Z @ 4 NONAME ; class MVTUserInput * VTProtocolFactory::CreateUserInputIndication(enum TUserInputType, unsigned char)
+ ?CreateSessionCommandL@VTProtocolFactory@@SAPAVMVtSessionCommand@@PAVMVtProtocolHandler@@HAAW4TVt3G324MSupported@@@Z @ 5 NONAME ; class MVtSessionCommand * VTProtocolFactory::CreateSessionCommandL(class MVtProtocolHandler *, int, enum TVt3G324MSupported &)
+ ?DeletAudioSource@VTProtocolFactory@@SAHPAVMVTAudioSource@@@Z @ 6 NONAME ; int VTProtocolFactory::DeletAudioSource(class MVTAudioSource *)
+ ?GetAudioConfigCommandL@VTProtocolFactory@@SAPAVMVtAudioConfigCommand@@PAVMVTAudioSink@@@Z @ 7 NONAME ; class MVtAudioConfigCommand * VTProtocolFactory::GetAudioConfigCommandL(class MVTAudioSink *)
+ ?CreateAudioSource@VTProtocolFactory@@SAPAVMVTAudioSource@@XZ @ 8 NONAME ; class MVTAudioSource * VTProtocolFactory::CreateAudioSource(void)
+ ?DeleteCommServerL@VTProtocolFactory@@SAXPAVMCommServer@@@Z @ 9 NONAME ; void VTProtocolFactory::DeleteCommServerL(class MCommServer *)
+ ?DeleteUserInputIndication@VTProtocolFactory@@SAXPAVMVTUserInput@@@Z @ 10 NONAME ; void VTProtocolFactory::DeleteUserInputIndication(class MVTUserInput *)
+ ?DeleteSessionCommand@VTProtocolFactory@@SAXPAVMVtSessionCommand@@@Z @ 11 NONAME ; void VTProtocolFactory::DeleteSessionCommand(class MVtSessionCommand *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/eabi/videotelprotou.def Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,13 @@
+EXPORTS
+ _ZN17VTProtocolFactory15CreateAudioSinkEv @ 1 NONAME
+ _ZN17VTProtocolFactory15DeleteAudioSinkEP12MVTAudioSink @ 2 NONAME
+ _ZN17VTProtocolFactory16DeletAudioSourceEP14MVTAudioSource @ 3 NONAME
+ _ZN17VTProtocolFactory17CreateAudioSourceEv @ 4 NONAME
+ _ZN17VTProtocolFactory17CreateCommServerLERK7TDesC16i @ 5 NONAME
+ _ZN17VTProtocolFactory17DeleteCommServerLEP11MCommServer @ 6 NONAME
+ _ZN17VTProtocolFactory20DeleteSessionCommandEP17MVtSessionCommand @ 7 NONAME
+ _ZN17VTProtocolFactory21CreateSessionCommandLEP18MVtProtocolHandleriR18TVt3G324MSupported @ 8 NONAME
+ _ZN17VTProtocolFactory22GetAudioConfigCommandLEP12MVTAudioSink @ 9 NONAME
+ _ZN17VTProtocolFactory25CreateUserInputIndicationE14TUserInputTypeh @ 10 NONAME
+ _ZN17VTProtocolFactory25DeleteUserInputIndicationEP12MVTUserInput @ 11 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2004 - 2007 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: vtprotocols build information file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../inc/mvtprotocolhandler.h |../../inc/mvtprotocolhandler.h
+
+
+PRJ_MMPFILES
+
+../group/videotelproto.mmp
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/group/videotelproto.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2004 - 2006 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: This is project specification file for the Vtprotocols.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET videotelproto.dll
+TARGETTYPE dll
+UID 0x1000008d 0x20021182
+
+
+SOURCEPATH ../src
+
+SOURCE cdatasinkproxy.cpp
+SOURCE cdatasourceproxy.cpp
+SOURCE caudioconfighandler.cpp
+SOURCE ch324confighandler.cpp
+SOURCE csessionhandler.cpp
+SOURCE cvideoconfighandler.cpp
+SOURCE cvtuserinput.cpp
+SOURCE vtprotocolfactory.cpp
+
+DOCUMENT ../../bld.inf
+
+USERINCLUDE ../inc/
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../inc
+SYSTEMINCLUDE /epoc32/include/mmf/common
+SYSTEMINCLUDE /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
+
+LIBRARY commonengine.lib
+LIBRARY mediaclientaudio.lib
+
+
+
+DEBUGLIBRARY vtlogger.lib
+
+LIBRARY pv2waysymbianadapter.lib
+LIBRARY mmfdevsound.lib
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/caudioconfighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2004-2006 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 CAUDIOCONFIGHANDLER_H
+#define CAUDIOCONFIGHANDLER_H
+NONSHARABLE_CLASS( TAudioConfigHandler ) : public MPVAudioOutputControlObserver
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TAudioConfigHandler( MVtProtocolHandler* aProtocolHandler);
+
+ /**
+ * Signals completion of the audio output control command.
+ * @param aId The command id of the completed command.
+ * @param aCmd The command type.
+ * @param aContextData The context data passed in with the command.
+ * @param aStatus The command completion status.
+ **/
+ virtual void AudioOutputControlCommandComplete(TPVCommandId aId
+ ,TPVAudioOutputControlCommand aCmd
+ ,TAny *aContextData
+ ,TInt aStatus);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CAudioConfigCommand ) : public CBase,
+ public MVtAudioConfigCommand
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ CAudioConfigCommand(MPVAudioOutputControl* aAudioCtrl);
+
+ /**
+ * Destructor.
+ */
+ ~CAudioConfigCommand();
+
+ /**
+ * Method to set the playback volume to the specified value.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aNewVolume
+ * An input parameter to hold the value for the requested playback volume.
+ *
+ * @returns TInt
+ * Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt SetAudioVolumeL(TInt aVolume);
+
+ /**
+ * Method to get the maximum valid value for the playback volume.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aMaxVolume
+ * An output parameter to hold the value for the maximum valid playback volume.
+ * Note that the parameter should not be used until the callback indicates that the
+ * method has completed.
+ *
+ * @returns TInt
+ * Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume);
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+ private:
+ MPVAudioOutputControl* iAudioCtrl;
+ TAudioConfigHandler* iAudioConfigHandler;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/ccommserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004-2006 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 CCOMMSERVER_H
+#define CCOMMSERVER_H
+NONSHARABLE_CLASS( CCommServer ) : public CBase,
+ public MCommServer
+ {
+ public:
+ MPVCommServerBase* iComm;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cdatasinkproxy.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2004-2006 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 CDATASINKPROXY_H
+#define CDATASINKPROXY_H
+NONSHARABLE_CLASS( CPVDisplaySinkNodeProxy ) : public CBase,
+ public MVTVideoSource
+ {
+ public: //New
+ /**
+ * Constructor .
+ */
+ CPVDisplaySinkNodeProxy();
+ /**
+ * Set new supplier.
+ * @param aSupplier
+ */
+ void SetSupplier(MPVDataSourceBase* aSupplier);
+ public: //From MVTVideoSource
+ /**
+ * Method called by a data sink to pass back an emptied buffer to the source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data source actively requests a consumer ie a data sink
+ * to empty a buffer by calling the data sinks EmptyBufferL.
+ * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+ *
+ * @param "aBuffer"
+ * The buffer that has been emptied by a data sink and is now available for reuse
+ */
+ virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
+ private:
+ MPVDataSourceBase* iSupplier;
+ };
+
+NONSHARABLE_CLASS( CDisplaySinkProxy ) : public CBase,
+ public MPVDataSink,
+ public MPVVideoOutput
+ {
+ public: //From MPVPluginBase
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return Multimedia types supported by the data source/sink. The reference
+ * is valid until the MPVPluginBase derived object is destroyed.
+ **/
+ virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const;
+ /**
+ * This API is to allow for extensibility of the plugin interface.
+ * It allows a caller to ask for all UUIDs associated with a particular MIME type.
+ * If interfaces of the requested MIME type are found within the plugin, they are added
+ * to the UUIDs array.
+ *
+ * Also added to the UUIDs array will be all interfaces which have the requested MIME
+ * type as a base MIME type. This functionality can be turned off.
+ *
+ * @param aMimeType The MIME type of the desired interfaces
+ * @param aUuids An array to hold the discovered UUIDs
+ * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
+ **/
+ virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false );
+ /**
+ * This API is to allow for extensibility of the plugin interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aUuid The UUID of the desired interface
+ * @param aInterfacePtr The output pointer to the desired interface
+ **/
+ virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr );
+ /**
+ * This API is used to provide a timebase for plugins that deal with synchronized media data
+ **/
+ virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase);
+ public: //From MPVDataSinkBase
+ /**
+ * Method called by a MDataSource to request the data sink to empty aBuffer of data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+ * to empty a buffer. The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+ * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The full buffer that needs emptying of it's data
+ *
+ * @param "aSupplier"
+ * The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+ * callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data
+ */
+ virtual void EmptyBufferL(CMMFBuffer* aBuffer, MPVDataSourceBase* aSupplier, TMediaId aMediaId);
+ /**
+ * Method called by a data source to pass back an filled buffer to the sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data sink actively requests a supplier ie a data source
+ * to fill a buffer by calling the data sources FillBufferL.
+ * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+ *
+ * @param "aBuffer"
+ * The buffer that has been filled by a data source and is now available for processing
+ */
+ virtual void BufferFilledL(CMMFBuffer* aBuffer);
+ /**
+ * Method to indicate whether the data sink can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data sink can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSinkBuffer();
+ /**
+ * Returns a buffer created by the data sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data.
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the sink
+ * and should be used in preference to the source buffer provided the source buffer
+ * is also not a reference buffer.
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference );
+ /**
+ * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+ *
+ * This method may be required as the thread that the data sink was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SinkThreadLogon rather than in the creation
+ * of the data sink.
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * initialisation is required and/or the data sink can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
+ /**
+ * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+ *
+ * This method may be required as the thread that the data sink is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SinkThreadLogoff();
+ /**
+ * Method to 'prime' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific 'priming' is required
+ */
+ virtual TInt SinkPrimeL();
+ /**
+ * Method to 'play' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SinkPlayL();
+ /**
+ * Method to 'pause' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'pause'
+ */
+ virtual TInt SinkPauseL();
+
+ /**
+ * Method to 'stop' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'stop'
+ */
+ virtual TInt SinkStopL();
+ public: //From MPVVideoOutput
+
+ /**
+ * Set the video frame format. This must be from the list of supported formats.
+ * @param "aFormat" A mime string describing the video frame format.
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void SetFormatL(const TDesC8& aFormat);
+
+ /**
+ * Set the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void SetVideoFrameSizeL(const TSize& aSize);
+
+ /**
+ * Get the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void GetVideoFrameSizeL(TSize& aSize) const;
+ public:
+ /**
+ * Constructor.
+ */
+ CDisplaySinkProxy(MVTVideoSink* aDisplaySink);
+
+ /**
+ * ConstructL
+ */
+ void ConstructL();
+
+ /**
+ * NewL
+ */
+ static CDisplaySinkProxy* NewL(MVTVideoSink* aDisplaySink);
+ /**
+ * Get pointer object of data sink.
+ * @return member variant:iDisplaySink
+ */
+ MVTVideoSink* DisplaySink() { return iDisplaySink; }
+ private:
+ MVTVideoSink* iDisplaySink;
+ CPVDisplaySinkNodeProxy* iDSNodeProxy;
+
+ };
+
+NONSHARABLE_CLASS( CAudioSinkProxy ) : public CBase,
+ public MVTAudioSink
+ {
+ public:
+ MPVDataSink* iAudioSink;
+ };
+
+#endif
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cdatasourceproxy.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,322 @@
+/*
+* Copyright (c) 2004-2006 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 CDATASOURCEPROXY_H
+#define CDATASOURCEPROXY_H
+NONSHARABLE_CLASS( CPVCameraSourceNodeProxy ) : public CBase,
+ public MAsyncEventHandler,
+ public MVTVideoSink
+ {
+ public: //From MAsyncEventHandler
+ /**
+ * Send event to client.
+ * @param aEvent
+ */
+ virtual TInt SendEventToClient(const TMMFEvent &aEvent);
+ public: //From MVTVideoSink
+
+ /**
+ * Method called by a data source to pass back an filled buffer to the sink.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data sink actively requests a supplier ie a data source
+ * to fill a buffer by calling the data sources FillBufferL.
+ * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+ *
+ * @param "aBuffer"
+ * The buffer that has been filled by a data source and is now available for processing
+ */
+ void BufferFilledL(CMMFBuffer* aBuffer);
+
+ public: //New
+ /**
+ * Constructor.
+ */
+ CPVCameraSourceNodeProxy();
+
+ /**
+ * Set consumer object.
+ * @param aConsumer new object
+ */
+ void SetConsumer(MPVDataSinkBase* aConsumer);
+ private:
+ MPVDataSinkBase* iConsumer;
+ };
+
+NONSHARABLE_CLASS( CVideoSourceProxy ) : public CBase,
+ public MPVDataSource,
+ public MPVVideoInput
+ {
+ public: //From MPVPluginBase
+
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return Multimedia types supported by the data source/sink. The reference
+ * is valid until the MPVPluginBase derived object is destroyed.
+ **/
+ virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const;
+
+ /**
+ * This API is to allow for extensibility of the plugin interface.
+ * It allows a caller to ask for all UUIDs associated with a particular MIME type.
+ * If interfaces of the requested MIME type are found within the plugin, they are added
+ * to the UUIDs array.
+ *
+ * Also added to the UUIDs array will be all interfaces which have the requested MIME
+ * type as a base MIME type. This functionality can be turned off.
+ *
+ * @param aMimeType The MIME type of the desired interfaces
+ * @param aUuids An array to hold the discovered UUIDs
+ * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
+ **/
+ virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false );
+
+ /**
+ * This API is to allow for extensibility of the plugin interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aUuid The UUID of the desired interface
+ * @param aInterfacePtr The output pointer to the desired interface
+ **/
+ virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr );
+
+ /**
+ * This API is used to provide a timebase for plugins that deal with synchronized media data
+ **/
+ virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase);
+ public: //From MPVDataSourceBase
+
+ /**
+ * Method called by a MDataSink to request the data source to fill aBuffer with data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+ * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled
+ * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The buffer that needs filling with data
+ *
+ * @param "aConsumer"
+ * The data sink that consumes the data. The data source needs this to make the BufferFilledL
+ * callback on aConsumer when the data source has completed filling the aBuffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ */
+ virtual void FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId /*aMediaId*/);
+
+ /**
+ * Returns a buffer created by the data source.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer
+ * is also not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, TBool &aReference);
+
+ /**
+ * Returns a buffer created by the data source.
+ *
+ * This is a virtual function that a derived class can implement.
+ * This can be used in preference to the above CreateSourceBufferL method in cases where
+ * the source buffer creation has a dependancy on the sink buffer
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aSinkBuffer"
+ * The sink buffer the nature of which may influence the creation of the source buffer
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference);
+
+ /**
+ * Method to 'logon' the data source to the same thread that source will be supplying data in.
+ *
+ * This method may be required as the thread that the data source was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SourceThreadLogon rather than in the creation
+ * of the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * initialisation is required and/or the data source can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+ /**
+ * Method to 'logoff' the data source from the same thread that source supplies data in.
+ *
+ * This method may be required as the thread that the data source is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SourceThreadLogoff();
+
+ /**
+ * Method to 'prime' the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific 'priming' is required
+ */
+ virtual TInt SourcePrimeL();
+
+ /**
+ * Method to 'play' the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SourcePlayL();
+
+ /**
+ * Method to 'pause' the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'pause'
+ */
+ virtual TInt SourcePauseL();
+
+ /**
+ * Method to 'stop' the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'stop'
+ */
+ virtual TInt SourceStopL();
+
+ /**
+ * Method called by a data sink to pass back an emptied buffer to the source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data source actively requests a consumer ie a data sink
+ * to empty a buffer by calling the data sinks EmptyBufferL.
+ * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+ *
+ * @param "aBuffer"
+ * The buffer that has been emptied by a data sink and is now available for reuse
+ */
+ virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
+
+ /**
+ * Method to indicate whether the data source can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data source can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSourceBuffer();
+ public: //From MPVVideoInput
+
+ /**
+ * Set the video frame format. This must be from the list of supported formats.
+ * @param "aFormat" The mime string describing the video frame format.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFormatL(const TDesC8& aFormat);
+
+ /**
+ * Set the video frame rate. This must be within the range of supported frame rates
+ * for the current frame size.
+ * @param "aFrameRate" The video frame rate to set.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFrameRateL(TReal32 aFrameRate);
+
+ /**
+ * Set the video frame size.
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetVideoFrameSizeL(const TSize& aSize);
+
+ /**
+ * Get the video frame size.
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void GetVideoFrameSizeL(TSize& aSize) const;
+ public: //new
+ /**
+ * Constructor.
+ */
+ CVideoSourceProxy(MVTVideoSource* aVideoSource);
+ /**
+ * ConstructL.
+ */
+ void ConstructL( );
+
+ /**
+ * NewL.
+ */
+ static CVideoSourceProxy* NewL(MVTVideoSource* aVideoSource);
+
+ /**
+ * Get member variant.
+ * @return memeber variant:iVideoSource
+ */
+ MVTVideoSource* VideoSource() { return iVideoSource; }
+ private:
+ MVTVideoSource* iVideoSource;
+ CPVCameraSourceNodeProxy* iCameraSourceNodeProxy;
+ };
+
+NONSHARABLE_CLASS( CAudioSourceProxy ) : public CBase,
+ public MVTAudioSource
+ {
+ public:
+ MPVDataSource* iAudioSource;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/ch324confighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2004-2006 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 CH324ConfigHandler_H
+#define CH324ConfigHandler_H
+NONSHARABLE_CLASS( TH324ConfigHandler ) : public MPVH324MConfigSymbianObserver
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+ /**
+ Handle an event that has been generated.
+
+ @param aResponse The response to a previously issued command.
+ */
+ virtual void MPVH324MConfigCommandCompletedL(const CPVCmdResponse& aResponse);
+
+ /**
+ Handle an information event.
+
+ @param aEvent
+ */
+ virtual void MPVH324MConfigInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CH324ConfigCommand ): public CBase,
+ public MVtH324ConfigCommand
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CH324ConfigCommand();
+
+ /**
+ * Sets the vendor identification data. This does not cause the stack to issue a vendor identifiation request.
+ * Set to NULL to disable sending vendor id. If set to a valid parameter before Connect, it will cause the stack
+ * to automatically send it along with the TCS message.
+ * @param cc
+ * T35 Country code
+ * @param ext
+ * T35 Extension
+ * @param mc
+ * T35 Manufacturer code
+ * @param aProduct
+ * Product number
+ * @param aVersion
+ * Version number
+ **/
+ virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion);
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff);
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+ * according to the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff);
+
+ /**
+ * This API allows the user to specify the supported resolutions for video for transmit and receive.
+ *
+ **/
+ virtual TInt SetSupportedResolutions( );
+ /**
+ * This API allows the user to set options for fast call setup procedures
+ **/
+ virtual TInt SetFastCsupOptions( );
+
+ /**
+ * Causes the protocol to send the specified user input to the remote terminal using
+ * control channel. The user input can be either DTMF ot Alphanumeric
+ * @param user_input A pointer to MVTUserInput
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt SendUserInputMessageL(MVTUserInput& user_input);
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler the observer for command status and unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+
+ /**
+ * Get member variant.
+ */
+ MPVH324MConfig*& PVH324ConfigInterface() { return iH324Config; }
+ private:
+ MPVH324MConfig* iH324Config;
+ TH324ConfigHandler* iH324ConfigHandler;
+ };
+#endif
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/csessionhandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2004-2006 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 CSESSIOHANDLER_H
+#define CSESSIOHANDLER_H
+NONSHARABLE_CLASS( TSessionHandler ) : public MPVCommandStatusObserver,
+ public MPVInformationalEventObserver,
+ public MPVErrorEventObserver
+ {
+ public:
+
+ /**
+ Handle an event that has been generated.
+
+ @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void CommandCompletedL(const CPVCmdResponse& aResponse);
+
+ /**
+ * Handle an informational event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+
+ /**
+ * Handle an error event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleErrorEventL(const CPVAsyncErrorEvent& aEvent);
+ public:
+ /**
+ * Constructor.
+ */
+ TSessionHandler(MVtProtocolHandler* aProtocolHandler);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CSessionCommand ): public CBase,
+ public MVtSessionCommand
+ {
+ public:
+ /**
+ * Contructor.
+ */
+ CSessionCommand(TSessionHandler* aSessionHandler, MPV2WaySymbianInterface* aPv2Way);
+
+ /**
+ * Destructor.
+ */
+ ~CSessionCommand();
+
+ /**
+ * This function is valid only in the EIdle state. It is a no-op when
+ * invoked in any other state. It causes the protocol to transition
+ * to the ESetup state. The terminal remains in the EInitializing state during
+ * the transition.
+ *
+ *
+ * @param aInitInfo
+ * A reference to a TVtInitInfo structure which set Mona on and off
+ *
+ * @leave This method can leave with one of the following error codes
+ * KPVErrInvalidState if invoked in the incorrect state
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt InitProtocolL(TVtInitInfo& aInitInfo);
+
+ /**
+ * For an incoming track (MVTVideoSink) this function pauses sending
+ * media to the sink (output device) and stops the sink. It then does the protocol
+ * negotiations with the remote terminal to pause the logical channel for
+ * the specified track.
+ *
+ * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+ * source. It also performs any necessary protocol negotiations with the remote terminal.
+ * EVtCommandPause will be sent to the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt PauseVideoL(MVTVideoSource& aDataSource);
+ virtual TInt PauseVideoL(MVTVideoSink& aDataSink);
+ virtual TInt PauseAudioL(MVTAudioSource& aAudioSource);
+
+ /**
+ * Resume a previously paused incoming or outgoing track. For incoming,
+ * this function starts resumes playing out the media to the appropriate
+ * sink based on the current settings. For outgoing it resumes encoding
+ * and sending media from the source.
+ *
+ * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResumeVideoL(MVTVideoSource& aDataSource);
+ virtual TInt ResumeVideoL(MVTVideoSink& aDataSink);
+ virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource);
+
+ /**
+ * This function is valid only in the ESetup and EInitializing state. It is a
+ * no-op when invoked in the EIdle state and returns KPVErrInvalidState
+ * if invoked in any other state.
+ *
+ * It causes the protocol to transition back to the EIdle state. The
+ * terminal remains in the EResetting state during the transition.
+ *
+ * While resetting, the protocol de-allocates all resources resources that
+ * had been previously allocated. When it completes, ResetComplete is called
+ * and the protocol reverts to the EIdle state.
+ *
+ * @leave This method can leave with one of the following error codes
+ * KPVErrInvalidState if invoked in the incorrect state
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResetProtocolL();
+
+ /**
+ * This function can be invoked only in the ESetup state. The terminal starts connecting with the remote
+ * terminal based on the specified options and capabilities.
+ * The EVtCommandConnect command completion event will be passed to the observer
+ * when connect completes.
+ * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+ * GetSessionParamsL may be called after call setup is started to get the list of available channels
+ * and their capabilities.
+ * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+ * EVtIndicationIncommingTrack event.
+ *
+ * @param aComm
+ * An optional pointer to a comm server to provide comm source and sink end-points.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ConnectToProtocolL(MCommServer* aComm);
+
+ /**
+ * Allows an application to provide a media source to be associated with a logical channel
+ * of communication with the peer. Sources should be added after the EVtIndicationOutgoingTrack
+ * indication is received for a newly established logical channel. The media type and
+ * channel id associated with the logical channel are specified as part of the indication.
+ * This function accepts a MVtVideoSource which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * Data sources could be of the following types:
+ * a)raw media sources like camera, microphone etc.
+ * b)sources of compressed data like file, gateway component etc.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this source.
+ * @param aDataSource
+ * reference to the data source
+ * @leave This method can leave with one of the following error codes
+ * KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+ * KPVErrInvalidState if invoked in the incorrect state
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @return A unique command id for asynchronous completion
+ */
+ virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource);
+ virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource);
+
+ /**
+ * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+ * logical channel of communication with the peer.
+ * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+ * channel id.
+ * Regular incoming channels are established by the peer and are
+ * indicated using the EVtIndicationIncomingTrack indication.
+ * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this sink.
+ * @param aDataSink The data sink to be added
+ *
+ * @return A unique command id for asynchronous completion
+ **/
+ virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink);
+ virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink);
+
+ /**
+ * This API is to allow the user to cancel all pending requests. The current request being
+ * processed, if any, will also be aborted.
+ * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt CancelAllCommandsL( );
+
+ /**
+ * The Disconnect call is valid only when invoked in the EConnecting, and
+ * EConnected states. It causes the terminal to transition to the
+ * EDisconnecting state. All the media tracks both incoming and outgoing
+ * will be closed on invoking Disconnect. On completion, the terminal
+ * goes to the ESetup state.
+ *
+ * It is a no-op when called in any other state.
+ *
+ * This is an asynchronous request. The EvtCommandDisconnect event will be
+ * sent to the observer when the request processing is complete. This
+ * is the only event the Phone application should expect after calling
+ * Disconnect.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt DisconnectFromProtocolL();
+
+ /**
+ * This API is to allow for extensibility of the protocol interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aType
+ * @param aProtocolCommand
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand);
+
+ /**
+ * This APIis to be used to release an interface that was previously obtained using
+ * QueryInterfaceL.
+ * @param aType
+ * @param
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand);
+ public:
+ MPV2WaySymbianInterface *iPv2Way;
+ private:
+ CVideoSourceProxy* iVideoSource;
+ CDisplaySinkProxy* iDisplaySink;
+ TSessionHandler* iSessionHandler;
+ };
+#endif
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cvideoconfighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2004-2006 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 CVideoConfigHandler_H
+#define CVideoConfigHandler_H
+NONSHARABLE_CLASS( TVideoConfigHandler ): public MPvMp4H263EncExtensionSymbianObserver
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+ /**
+ Handle an event that has been generated.
+
+ @param aResponse The response to a previously issued command.
+ */
+ virtual void MPvMp4H263EncExtensionCommandCompletedL(const CPVCmdResponse& aResponse);
+
+ /**
+ Handle an information event.
+
+ @param aEvent
+ */
+ virtual void HandleMPvMp4H263EncExtensionInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CVideoConfigCommand ) : public CBase,
+ public MVtVideoConfigCommand
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CVideoConfigCommand();
+
+ /**
+ * Sets the I-Frame refresh rate of the encoded output.
+ *
+ * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+ * @return True if successful, else false
+ */
+ virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval);
+
+ /**
+ * Requests the encoder to encode the next frame as an I-Frame. This menthod is valid
+ * only when the node is in EPVMFNodeStarted state. If successful, the next encoded
+ * frame will be an I-Frame.
+ *
+ * @return True for success, else false
+ */
+ virtual TInt RequestNextIntraFrame();
+
+ /**
+ * Sets the frame rate of encoded output for the specified layer.
+ * @param aFrameRate Frame rate for the specified layer in frames per second.
+ * @return True if successful, else false.
+ */
+ virtual TInt SetVideoFrameRate(TUint32 aFrameRate);
+
+ /**
+ * This API allows the user to specify separate observers for the extension interface.
+ *
+ * @param aHandler the observer for unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+
+ /**
+ * Get member variant.
+ */
+ MPvMp4H263EncExtensionInterfaceSymbian*& PVVideoEncoderInterface() { return iH263Encoder; }
+ private:
+ MPvMp4H263EncExtensionInterfaceSymbian* iH263Encoder;
+ TVideoConfigHandler* iVideoConfigHandler;
+ };
+#endif
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cvtuserinput.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2004-2006 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 CVTUSERINPUT_H
+#define CVTUSERINPUT_H
+NONSHARABLE_CLASS( CVTUserInputDtmf ) : public CBase,
+ public MVTUserInput
+ {
+ public:
+ /**
+ * ConstructL.
+ */
+ void ConstructL(TUint8 aTone);
+ /**
+ * NewL.
+ */
+ static CVTUserInputDtmf* NewL(TUint8 aTone);
+
+ /**
+ * Destructor.
+ */
+ ~CVTUserInputDtmf();
+
+ /**
+ * Virtual function to return the user input type
+ **/
+ virtual TUserInputType GetType();
+ CPVUserInputDtmfSymbian* iUII;
+ };
+
+NONSHARABLE_CLASS( CVTUserInputAlphanumeric ) : public CBase,
+ public MVTUserInput
+ {
+ public:
+ /**
+ * ConstructL.
+ */
+ void ConstructL(TUint8 aTone);
+ /**
+ * NewL.
+ */
+ static CVTUserInputAlphanumeric* NewL(TUint8 aTone);
+
+ /**
+ * Destructor.
+ */
+ ~CVTUserInputAlphanumeric();
+
+ /**
+ * Virtual function to return the user input type
+ **/
+ virtual TUserInputType GetType();
+ CPVUserInputAlphanumericSymbian* iUII;
+ };
+#endif
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/mvtprotocolhandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1131 @@
+/*
+* Copyright (c) 2004-2006 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 MVTENGMEDIAHANDLER_H
+#define MVTENGMEDIAHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmfdatabuffer.h>
+#include <mmfutilities.h>
+#include <mmfcontrollerframework.h>
+
+typedef TInt TVtCommandId;
+typedef TInt TVtCommandStatus;
+typedef TDesC8 TVtMIMEType;
+
+const TUid KVTUidYUVFrameBuffer = {0xFFFFFF0d};
+const TInt KVtUidDataSrcPrime = 0xFFFFFF08;
+const TInt KVtUidDataSrcPlay = 0xFFFFFF09;
+const TInt KVtUidDataSrcPause = 0xFFFFFF0A;
+const TInt KVtUidDataSrcStop = 0xFFFFFF0B;
+
+_LIT8(KVtVideoMIMETypeH263, "/video/x-pv/compressed/h263");
+_LIT8(KVtVideoMIMETypeM4V, "/video/x-pv/compressed/m4v");
+_LIT8(KVtVideoMIMETypeH264, "/video/x-pv/compressed/h264");
+_LIT8(KVtAudioMIMETypeAMRIF2, "/audio/x-pv/compressed/amr/if2");
+_LIT8(KVtAudioMIMETypeAMRWBIF2, "/audio/x-pv/compressed/amrwb/if2");
+_LIT8(KVtVideoMIMETypeYUV420, "/video/x-pv/raw/yuv420");
+
+enum TVt3G324MSupported
+ {
+ EVt3G324MMissing,
+ EVt3G324MSupported
+ };
+
+enum TVtConfigType
+ {
+ EVtH324Config,
+ EVtVideoEncoderConfig
+ };
+
+enum TVtCommandType {
+ EVtCommandInit,
+ EVtCommandGetSDKInfo,
+ EVtCommandGetProtocolState = 3,
+ EVtCommandReset,
+ EVtCommandAddDataSource = 6,
+ EVtCommandRemoveDataSource,
+ EVtCommandAddDataSink,
+ EVtCommandRemoveDataSink,
+ EVtCommandConnect,
+ EVtCommandDisconnect,
+ EVtCommandPause,
+ EVtCommandResume,
+ EVtCommandGetProtocolInterface =20,
+ EVtCommandDeleteProtocolInterface,
+ EVtCommandCancelAllCommands
+ };
+
+enum TVtIndicationType
+ {
+ EVtIndicationVideoSpatialTamporalTradeOffCommand,
+ EVtIndicationVideoSpatialTamporalTradeOffIndication,
+ EVtIndicationUserInputCapability = 6,
+ EVtIndicationIncomingTrack = 41,
+ EVtIndicationOutgoingTrack,
+ EVtIndicationDisconnect,
+ EVtIndicationClosingTrack,
+ EVtIndicationCloseTrack,
+ EVtIndicationPauseTrack,
+ EVtIndicationResumeTrack
+ };
+
+enum TVtMediaType
+ {
+ EVtAudio = 1,
+ EVtVideo,
+ EVtControl,
+ EVtData,
+ EVtUserInput,
+ EVtMediaNone
+ };
+
+enum TVtAudioOutputControlCommand
+ {
+ EVtAudioOutputControlGetMaxVolume,
+ EVtAudioOutputControlGetVolume,
+ EVtAudioOutputControlSetVolume,
+ EVtAudioOutputControlGetBalance,
+ EVtAudioOutputControlSetBalance
+ };
+
+const TUint8 EVtIncoming = 1;
+
+enum TUserInputType
+ {
+ EVtUiiDTMF,
+ EVtUiiAlphaNumeric
+ };
+
+struct TVtInitInfo
+ {
+ TBool iAMRWBOn;
+ TBool iDisableMpeg4;
+ };
+
+struct TVtIndicationEvent
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtIndicationEvent(TInt aEventType, const TUint8 *aLocalBuffer) : iEventType(aEventType), iLocalBuffer(aLocalBuffer)
+ {}
+ public:
+ TInt iEventType;
+ const TUint8 *iLocalBuffer;
+ };
+
+struct TVtCommandResponse
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtCommandResponse(TVtCommandType aCmdType, TInt aCmdId, TInt iCmdStatus) : iCmdType(aCmdType), iCmdId(aCmdId), iCmdStatus(iCmdStatus)
+ {}
+ public:
+ TVtCommandType iCmdType;
+ TInt iCmdId;
+ TInt iCmdStatus;
+ };
+
+struct TVtErrorEvent
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtErrorEvent(TInt aEventType) : iEventType(aEventType) {}
+ public:
+ TInt iEventType;
+ };
+
+struct TVtMMFDataBuffer
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtMMFDataBuffer(CMMFBuffer* aMmfBuffer,TSize aFrameSize, TPtr8& aPtr) : iMmfBuffer(aMmfBuffer), iFrameSize(aFrameSize), iPtr(aPtr) {}
+
+ /**
+ * Get the YUV frame size.
+ * @return The frame size, in pixels
+ */
+ TSize GetFrameSize() {return iFrameSize;}
+
+ /**
+ * Get MMF buffer.
+ * @return the MMF buffer
+ */
+ CMMFBuffer* GetMMFBuffer() {return iMmfBuffer;}
+
+ /**
+ * Get MMF buffer.
+ * @return the MMF buffer
+ */
+ const CMMFBuffer* GetMMFBuffer() const {return iMmfBuffer;}
+
+ /**
+ * @return Returns a reference to the data buffer
+ **/
+ TPtr8& Data() {return iPtr;}
+
+ /**
+ * @return Returns the frame size of the contained buffer.
+ **/
+ const TSize GetFrameSize() const {return iFrameSize;}
+
+ /**
+ * @return Returns a reference to the data buffer
+ **/
+ const TPtr8& Data() const {return iPtr;}
+ private:
+ CMMFBuffer* iMmfBuffer;
+ TSize iFrameSize;
+ TPtr8& iPtr;
+ };
+
+class MVTVideoInput
+ {
+ public:
+
+ /**
+ * Set the video frame format. This must be from the list of supported formats.
+ * @param "aFormat" The mime string describing the video frame format.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFormatL(const TDesC8& aFormat) {}
+
+ /**
+ * Set the video frame rate. This must be within the range of supported frame rates
+ * for the current frame size.
+ * @param "aFrameRate" The video frame rate to set.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFrameRateL(TReal32 aFrameRate) {}
+
+ /**
+ * Set the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+ /**
+ * Get the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return
+ **/
+ virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+ };
+
+class MVTVideoOutput
+ {
+ public:
+
+ /**
+ * Sets the data format using MIME string.
+ * @param aFormat The format as a MIME string.
+ **/
+ virtual void SetFormatL(const TDesC8& aFormat) {}
+
+ /**
+ * Set the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+ /**
+ * Get the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return
+ **/
+ virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+ };
+
+//This class is empty
+class MVTAudioSource
+ {
+ };
+
+//This class is empty
+class MVTAudioSink
+ {
+ };
+
+class MVTVideoSource;
+class MVTVideoSink : public MVTVideoOutput
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ MVTVideoSink(TUid aType): iDataSinkType(aType) {}
+
+ /**
+ * Method called by a data source to request the data sink to empty aBuffer of data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+ * to empty a buffer. The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+ * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The full buffer that needs emptying of it's data
+ *
+ * @param "aSupplier"
+ * The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+ * callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data
+ */
+ virtual void EmptyBufferL(
+ TVtMMFDataBuffer aDataBuffer,
+ MVTVideoSource* aSupplier,
+ TMediaId aMediaId ) {}
+
+ /**
+ * Method called by a data source to pass back an filled buffer to the sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data sink actively requests a supplier ie a data source
+ * to fill a buffer by calling the data sources FillBufferL.
+ * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+ *
+ * @param "aBuffer"
+ * The buffer that has been filled by a data source and is now available for processing
+ */
+ virtual void BufferFilledL( CMMFBuffer* aBuffer ) = 0;
+
+ /**
+ * Method to indicate whether the data sink can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data sink can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSinkBuffer() {return EFalse;}
+
+ /**
+ * Returns a buffer created by the data sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data.
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the sink
+ * and should be used in preference to the source buffer provided the source buffer
+ * is also not a reference buffer.
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSinkBufferL(
+ TMediaId aMediaId,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+ *
+ * This method may be required as the thread that the data sink was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SinkThreadLogon rather than in the creation
+ * of the data sink.
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * initialisation is required and/or the data sink can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+ /**
+ * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+ *
+ * This method may be required as the thread that the data sink is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SinkThreadLogoff() {}
+
+ /**
+ * Method to 'prime' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific 'priming' is required
+ */
+ virtual TInt SinkPrimeL() {return 0;}
+
+ /**
+ * Method to 'play' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SinkPlayL() {return 0;}
+
+ /**
+ * Method to 'pause' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'pause'
+ */
+ virtual TInt SinkPauseL() {return 0;}
+
+ /**
+ * Method to 'stop' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'stop'
+ */
+ virtual TInt SinkStopL() {return 0;}
+ private:
+ TUid iDataSinkType;
+ };
+
+class MVTVideoSource : public MVTVideoInput
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ MVTVideoSource(TUid aType): iDataSourceType(aType) {}
+
+ /**
+ * Method called by a data sink to request the data source to fill aBuffer with data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+ * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled
+ * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The buffer that needs filling with data
+ *
+ * @param "aConsumer"
+ * The data sink that consumes the data. The data source needs this to make the BufferFilledL
+ * callback on aConsumer when the data source has completed filling the aBuffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId ) {}
+
+ /**
+ * Method called by a data sink to pass back an emptied buffer to the source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data source actively requests a consumer ie a data sink
+ * to empty a buffer by calling the data sinks EmptyBufferL.
+ * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+ *
+ * @param "aBuffer"
+ * The buffer that has been emptied by a data sink and is now available for reuse
+ */
+ virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) = 0;
+
+ /**
+ * Method to indicate whether the data source can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data source can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSourceBuffer() {return EFalse;}
+
+ /**
+ * Returns a buffer created by the data source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer
+ * is also not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Returns a buffer created by the data source
+ *
+ * This is a virtual function that a derived class can implement.
+ * This can be used in preference to the above CreateSourceBufferL method in cases where
+ * the source buffer creation has a dependancy on the sink buffer
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aSinkBuffer"
+ * The sink buffer the nature of which may influence the creation of the source buffer
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ CMMFBuffer& aSinkBuffer,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Method to 'logon' the data source to the same thread that source will be supplying data in.
+ *
+ * This method may be required as the thread that the data source was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SourceThreadLogon rather than in the creation
+ * of the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * initialisation is required and/or the data source can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+ /**
+ * Method to 'logoff' the data source from the same thread that source supplies data in.
+ *
+ * This method may be required as the thread that the data source is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SourceThreadLogoff() {}
+
+ /**
+ * Method to 'prime' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific 'priming' is required
+ */
+ virtual TInt SourcePrimeL() {return 0;}
+
+ /**
+ * Method to 'play' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SourcePlayL() {return 0;}
+
+ /**
+ * Method to 'pause' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'pause'
+ */
+ virtual TInt SourcePauseL() {return 0;}
+
+ /**
+ * Method to 'stop' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'stop'
+ */
+ virtual TInt SourceStopL() {return 0;}
+ private:
+ TUid iDataSourceType;
+ };
+
+class MCommServer
+ {
+ };
+
+class MVtProtocolCommand
+ {
+ public:
+ enum TVtProtocolState
+ {
+ EIdle,
+ EInitializing,
+ ESetup,
+ EConnecting,
+ EConnected,
+ EDisconnecting,
+ EResetting
+ };
+ };
+
+class MVtProtocolHandler
+ {
+ public:
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an informational event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleSessionInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+ /**
+ * Handle an error event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent) = 0;
+
+ /**
+ * Signals completion of the audio output control command.
+ * @param aId The command id of the completed command.
+ * @param aCmd The command type.
+ * @param aContextData The context data passed in with the command.
+ * @param aStatus The command completion status.
+ **/
+ virtual void HandleAudioOutputControlCommandComplete(TInt aId, TVtAudioOutputControlCommand aCmd, TAny *aContextData ,TInt aStatus) = 0;
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleVideoEncoderCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleVideoEncoderInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleH324MConfigCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleH324MConfigInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+ virtual ~MVtProtocolHandler() {}
+ };
+
+
+class MVtSessionCommand : public MVtProtocolCommand
+ {
+ public:
+ /**
+ * This function is valid only in the EIdle state. It is a no-op when
+ * invoked in any other state. It causes the protocol to transition
+ * to the ESetup state. The terminal remains in the EInitializing state during
+ * the transition.
+ *
+ *
+ * @param aInitInfo
+ * A reference to a TVtInitInfo structure which set Mona on and off
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt InitProtocolL(TVtInitInfo& aInitInfo) = 0;
+
+ /**
+ * For an incoming track (MVTVideoSink) this function pauses sending
+ * media to the sink (output device) and stops the sink. It then does the protocol
+ * negotiations with the remote terminal to pause the logical channel for
+ * the specified track.
+ *
+ * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+ * source. It also performs any necessary protocol negotiations with the remote terminal.
+ * EVtCommandPause will be sent to the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt PauseVideoL(MVTVideoSource& aDataSource) = 0;
+ virtual TInt PauseVideoL(MVTVideoSink& aDataSink) = 0;
+ virtual TInt PauseAudioL(MVTAudioSource& aAudioSource) = 0;
+
+ /**
+ * Resume a previously paused incoming or outgoing track. For incoming,
+ * this function starts resumes playing out the media to the appropriate
+ * sink based on the current settings. For outgoing it resumes encoding
+ * and sending media from the source.
+ * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResumeVideoL(MVTVideoSource& aDataSource) = 0;
+ virtual TInt ResumeVideoL(MVTVideoSink& aDataSink) = 0;
+ virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource) = 0;
+
+ /**
+ * This function is valid only in the ESetup and EInitializing state. It is a
+ * no-op when invoked in the EIdle state
+ *
+ * It causes the protocol to transition back to the EIdle state. The
+ * terminal remains in the EResetting state during the transition.
+ *
+ * While resetting, the protocol de-allocates all resources resources that
+ * had been previously allocated. When it completes, ResetComplete is called
+ * and the protocol reverts to the EIdle state.
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResetProtocolL() = 0;
+
+ /**
+ * This function can be invoked only in the ESetup state. The terminal starts connecting with the remote
+ * terminal based on the specified options and capabilities.
+ * The EVtCommandConnect command completion event will be passed to the observer
+ * when connect completes.
+ * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+ * GetSessionParamsL may be called after call setup is started to get the list of available channels
+ * and their capabilities.
+ * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+ * EVtIndicationIncommingTrack event.
+ *
+ * @param aComm
+ * An optional pointer to a comm server to provide comm source and sink end-points.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ConnectToProtocolL(MCommServer* aComm) = 0;
+
+ /**
+ * Allows an application to provide a media source to be associated with a logical channel
+ * of communication with the peer. Sources should be added after the EVtIndicationOutgoingTrack
+ * indication is received for a newly established logical channel. The media type and
+ * channel id associated with the logical channel are specified as part of the indication.
+ * This function accepts a MVtVideoSource which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * Data sources could be of the following types:
+ * a)raw media sources like camera, microphone etc.
+ * b)sources of compressed data like file, gateway component etc.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this source.
+ * @param aDataSource
+ * reference to the data source
+ * @leave This method can leave with one of the following error codes
+ * KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @return A unique command id for asynchronous completion
+ */
+ virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource) = 0;
+ virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) = 0;
+
+ /**
+ * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+ * logical channel of communication with the peer.
+ * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+ * channel id.
+ * Regular incoming channels are established by the peer and are
+ * indicated using the EVtIndicationIncomingTrack indication.
+ * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this sink.
+ * @param aDataSink The data sink to be added
+ *
+ * @return A unique command id for asynchronous completion
+ **/
+ virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink) = 0;
+ virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) = 0;
+
+ /**
+ * This API is to allow the user to cancel all pending requests. The current request being
+ * processed, if any, will also be aborted.
+ * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt CancelAllCommandsL( ) = 0;
+
+ /**
+ * The Disconnect call is valid only when invoked in the EConnecting, and
+ * EConnected states. It causes the terminal to transition to the
+ * EDisconnecting state. All the media tracks both incoming and outgoing
+ * will be closed on invoking Disconnect. On completion, the terminal
+ * goes to the ESetup state.
+ *
+ * It is a no-op when called in any other state.
+ *
+ * This is an asynchronous request. The EvtCommandDisconnect event will be
+ * sent to the observer when the request processing is complete. This
+ * is the only event the Phone application should expect after calling
+ * Disconnect.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt DisconnectFromProtocolL() = 0;
+
+ /**
+ * This API is to allow for extensibility of the protocol interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aType
+ * @param aProtocolCommand
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) = 0;
+
+ /**
+ * This APIis to be used to release an interface that was previously obtained using
+ * QueryInterfaceL.
+ * @param aType
+ * @param
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*) = 0;
+
+ /**
+ * Destructor.
+ */
+ virtual ~MVtSessionCommand() {}
+ };
+
+class MVTUserInput
+ {
+ public:
+
+ /**
+ * @returns Returns the user input type.
+ **/
+ virtual TUserInputType GetType() = 0;
+ virtual ~MVTUserInput() {}
+ };
+
+class MVtH324ConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler the observer for command status and unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Sets the vendor identification data. This does not cause the stack to issue a vendor identifiation request.
+ * Set to NULL to disable sending vendor id. If set to a valid parameter before Connect, it will cause the stack
+ * to automatically send it along with the TCS message.
+ * @param cc
+ * T35 Country code
+ * @param ext
+ * T35 Extension
+ * @param mc
+ * T35 Manufacturer code
+ * @param aProduct
+ * Product number
+ * @param aVersion
+ * Version number
+ **/
+ virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) = 0;
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+ * according to the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+ /**
+ * This API allows the user to specify the supported resolutions for video for transmit and receive.
+ *
+ **/
+ virtual TInt SetSupportedResolutions( ) = 0;
+
+ /**
+ * This API allows the user to set options for fast call setup procedures
+ **/
+
+ virtual TInt SetFastCsupOptions( ) = 0;
+
+ /**
+ * Causes the protocol to send the specified user input to the remote terminal using
+ * control channel. The user input can be either DTMF ot Alphanumeric
+ * @param user_input A pointer to MVTUserInput
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt SendUserInputMessageL(MVTUserInput& user_input) = 0;
+ };
+
+class MVtVideoConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify separate observers for the extension interface.
+ *
+ * @param aHandler the observer for unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Sets the I-Frame refresh rate of the encoded output.
+ *
+ * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+ * @return True if successful, else false
+ */
+ virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval) = 0;
+
+ /**
+ * Requests the encoder to encode the next frame as an I-Frame. If successful, the next encoded
+ * frame will be an I-Frame.
+ *
+ * @return True for success, else false
+ */
+ virtual TInt RequestNextIntraFrame() = 0;
+
+ /**
+ * Sets the frame rate of encoded output for the specified layer.
+ * @param aFrameRate Frame rate for the specified layer in frames per second.
+ * @return True if successful, else false.
+ */
+ virtual TInt SetVideoFrameRate(TUint32 aFrameRate) = 0;
+ };
+
+class MVtAudioConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Method to set the playback volume to the specified value.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aNewVolume
+ * An input parameter to hold the value for the requested playback volume.
+ *
+ * @returns Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt SetAudioVolumeL(TInt aVolume) = 0;
+
+ /**
+ * Method to get the maximum valid value for the playback volume.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aMaxVolume
+ * An output parameter to hold the value for the maximum valid playback volume.
+ * Note that the parameter should not be used until the callback indicates that the
+ * method has completed.
+ *
+ * @returns Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume) = 0;
+ };
+
+class VTProtocolFactory
+ {
+ public:
+
+ /**
+ * Create one instance.
+ */
+ IMPORT_C static MVtSessionCommand* CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported);
+
+ /**
+ * This function allows the application to delete an instance of a terminal
+ * and reclaim all allocated resources. A terminal should be deleted only in
+ * the EIdle state. An attempt to delete a terminal in any other state will
+ * result in unpredictable behavior.
+ *
+ * @param terminal the terminal to be deleted.
+ *
+ **/
+ IMPORT_C static void DeleteSessionCommand( MVtSessionCommand* aSessionCommand );
+
+ /**
+ * Creates an instance of a DevSound audio data source.
+ *
+ * @param None
+ *
+ * @returns A pointer to the interface
+ **/
+ IMPORT_C static MVTAudioSource* CreateAudioSource();
+
+ /**
+ * Deletes an instance of a DevSound audio data source
+ * that was previously created with CreateAudioSource();
+ *
+ * @param aSource The audio data source to be deleted.
+ *
+ * @returns status
+ **/
+ IMPORT_C static TInt DeletAudioSource(MVTAudioSource *aSource);
+
+ /**
+ * Creates an instance of a DevSound audio data sink.
+ *
+ * @param None
+ *
+ * @returns A pointer to the interface
+ **/
+ IMPORT_C static MVTAudioSink* CreateAudioSink();
+
+ /**
+ * Deletes an instance of a DevSound audio data sink
+ * that was previously created with CreateAudioSink();
+ *
+ * @param The audio data sink to be deleted.
+ *
+ * @returns status
+ **/
+ IMPORT_C static TInt DeleteAudioSink(MVTAudioSink *aSink);
+
+ /**
+ * Creates an instance of a comm server of a particular name, to be used to
+ * initialize the terminal.
+ *
+ *
+ * @returns A pointer to a terminal or leaves if the type is invalid or the system is out of resources
+ **/
+ IMPORT_C static MCommServer* CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal=EFalse);
+
+ /**
+ * This function allows the application to delete an instance of a comm server
+ * and reclaim all allocated resources. A comm server should be deleted only when the
+ * protocol is in the EIdle state. An attempt to delete a comm server in any other state
+ * could result in memory corruption within the protocol. This function will leave with
+ * KErrInUse if the comm server is still in use. However it will not check the state of the
+ * protocol that is using the comm server.
+ *
+ * @param aCommServer the comm server to be deleted.
+ *
+ * @returns a status code indicating success or failure
+ **/
+ IMPORT_C static void DeleteCommServerL(MCommServer* aCommServer);
+
+ /**
+ * Create instance.
+ * @param aUIITyep
+ * @param aTone
+ */
+ IMPORT_C static MVTUserInput* CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone);
+
+ /**
+ * Delete instance.
+ * @param aUII
+ */
+ IMPORT_C static void DeleteUserInputIndication(MVTUserInput* aUII);
+
+ /**
+ *
+ * @param aAudioSink
+ */
+ IMPORT_C static MVtAudioConfigCommand* GetAudioConfigCommandL(MVTAudioSink* aAudioSink);
+ };
+
+#endif
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/caudioconfighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_2way_symbian_interface.h>
+#include <pv_audio_output_control_interface.h>
+#include "mvtprotocolhandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::TAudioConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TAudioConfigHandler::TAudioConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::AudioOutputControlCommandComplete
+// Signals completion of the audio output control command.
+// -----------------------------------------------------------------------------
+//
+void TAudioConfigHandler::AudioOutputControlCommandComplete(TPVCommandId aId
+ ,TPVAudioOutputControlCommand aCmd
+ ,TAny *aContextData
+ ,TInt aStatus)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete<")));
+ iProtocolHandler->HandleAudioOutputControlCommandComplete(aId, (TVtAudioOutputControlCommand)aCmd, aContextData, aStatus);
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete>")));
+ }
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::CAudioConfigCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::CAudioConfigCommand(MPVAudioOutputControl* aAudioCtrl) : iAudioCtrl(aAudioCtrl)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand<")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CAudioConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL<")));
+ iAudioConfigHandler = new (ELeave)TAudioConfigHandler(aHandler);
+ iAudioCtrl->SetAudioOutputControlObserver(iAudioConfigHandler);
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetAudioVolumeL
+// Method to set the playback volume to the specified value.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::SetAudioVolumeL(TInt aVolume)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL aVolume %d"), aVolume));
+ return iAudioCtrl->SetVolumeL(aVolume);
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::GetMaxAudioVolumeL
+// Method to get the maximum valid value for the playback volume.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::GetMaxAudioVolumeL(TInt& aMaxVolume)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL aMaxVolume %d"), aMaxVolume));
+ return iAudioCtrl->GetMaxVolumeL(aMaxVolume);
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::~CAudioConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::~CAudioConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand>")));
+ delete iAudioConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand")));
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cdatasinkproxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_plugin_interfaces.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::SetSupplier
+// Set new supplier .
+// -----------------------------------------------------------------------------
+//
+void CPVDisplaySinkNodeProxy::SetSupplier(MPVDataSourceBase* aSupplier)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CPVDisplaySinkNodeProxy::SetSupplier<")));
+ iSupplier = aSupplier;
+ __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::SetSupplier>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::BufferEmptiedL
+// Method called by a data sink to pass back an emptied buffer to the source.
+// -----------------------------------------------------------------------------
+//
+void CPVDisplaySinkNodeProxy::BufferEmptiedL(CMMFBuffer* aBuffer)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL<" ) ));
+ iSupplier->BufferEmptiedL(aBuffer); //call actually PV code
+ __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy() : MVTVideoSource(KNullUid)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CDisplaySinkProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy::CDisplaySinkProxy(MVTVideoSink* aDisplaySink) : MPVDataSink(KNullUid), iDisplaySink(aDisplaySink)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy<" ) ));
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy iDisplaySink %d>" ), iDisplaySink));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::ConstructL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL<" ) ));
+ iDSNodeProxy = new (ELeave)CPVDisplaySinkNodeProxy();
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL>" ) ));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy* CDisplaySinkProxy::NewL(MVTVideoSink* aDisplaySink)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL<" ) ));
+ CDisplaySinkProxy* self = new (ELeave)CDisplaySinkProxy(aDisplaySink);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL>" ) ));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::QueryInterface
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr )
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface<" ) ));
+ if ( aUuid == KPVUidVideoOutputInterface )
+ {
+ MPVVideoInput* interfaceP = (MPVVideoInput*) this;
+ aInterfacePtr = (TPVInterfacePtr) interfaceP;
+ }
+ else
+ {
+ aInterfacePtr = NULL;
+ }
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface aInterfacePtr %d>" ), aInterfacePtr ));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::GetMultimediaTypesL
+// This API returns multimedias type supported by the data source/sink.
+// -----------------------------------------------------------------------------
+//
+const RArray<TPVMIMEType *>& CDisplaySinkProxy::GetMultimediaTypesL() const
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetMultimediaTypesL" ) ));
+ return iDisplaySink->GetMultimediaTypesL();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::QueryUUID
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetTimebaseL
+// This API is used to provide a timebase for plugins that deal with synchronized media data.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::EmptyBufferL
+// Method called by a MDataSource to request the data sink to empty aBuffer of data.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::EmptyBufferL(CMMFBuffer *aBuffer, MPVDataSourceBase* aSupplier, TMediaId)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL<" ) ));
+ iDSNodeProxy->SetSupplier(aSupplier);
+ CPVMMFPointerBuffer& pvMMFBuffer = *static_cast< CPVMMFPointerBuffer* >( aBuffer );
+ TVtMMFDataBuffer mmfDataBuffer(aBuffer, pvMMFBuffer.GetFrameSize(), static_cast<TPtr8&>(pvMMFBuffer.Data()));
+ iDisplaySink->EmptyBufferL(mmfDataBuffer, iDSNodeProxy, TMediaId());
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL>" ) ));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::BufferFilledL
+// Method called by a data source to pass back an filled buffer to the sink.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::BufferFilledL(CMMFBuffer* aBuffer)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::BufferFilledL" ) ));
+ return iDisplaySink->BufferFilledL(aBuffer);
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CanCreateSinkBuffer
+// Method to indicate whether the data sink can create a buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkProxy::CanCreateSinkBuffer()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CanCreateSinkBuffer" ) ));
+ return iDisplaySink->CanCreateSinkBuffer();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CreateSinkBufferL
+// Returns a buffer created by the data sink
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CDisplaySinkProxy::CreateSinkBufferL(TMediaId aMediaId, TBool &aReference )
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CreateSinkBufferL" ) ));
+ return iDisplaySink->CreateSinkBufferL(aMediaId, aReference);
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkThreadLogon
+// Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkThreadLogon( MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogon" ) ));
+ return iDisplaySink->SinkThreadLogon(aEventHandler);
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkThreadLogoff
+// Method to 'logoff' the data sink from the same thread that sink consumes data in.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SinkThreadLogoff()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogoff" ) ));
+ iDisplaySink->SinkThreadLogoff();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPrimeL
+// Method to 'prime' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPrimeL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPrimeL" ) ));
+ return iDisplaySink->SinkPrimeL();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPlayL
+// Method to 'play' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPlayL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPlayL" ) ));
+ return iDisplaySink->SinkPlayL();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPauseL
+// Method to 'pause' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPauseL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPauseL" ) ));
+ return iDisplaySink->SinkPauseL();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkStopL
+// Method to 'stop' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkStopL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkStopL" ) ));
+ return iDisplaySink->SinkStopL();
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetFormatL
+// Set the video frame format. This must be from the list of supported formats.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetFormatL(const TDesC8& aFormat)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetFormatL" ) ));
+ iDisplaySink->SetFormatL(aFormat);
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetVideoFrameSizeL
+// Set the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetVideoFrameSizeL(const TSize& aSize)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetVideoFrameSizeL" ) ));
+ iDisplaySink->SetVideoFrameSizeL(aSize);
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::GetVideoFrameSizeL
+// Get the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::GetVideoFrameSizeL(TSize& aSize) const
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetVideoFrameSizeL" ) ));
+ iDisplaySink->GetVideoFrameSizeL(aSize);
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cdatasourceproxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,334 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_plugin_interfaces.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy() : MVTVideoSink(KNullUid)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::SetConsumer
+// Set consumer object.
+// -----------------------------------------------------------------------------
+//
+void CPVCameraSourceNodeProxy::SetConsumer(MPVDataSinkBase* aConsumer)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer<")));
+ iConsumer = aConsumer;
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::BufferFilledL
+// Method called by a data source to pass back an filled buffer to the sink.
+// -----------------------------------------------------------------------------
+//
+void CPVCameraSourceNodeProxy::BufferFilledL(CMMFBuffer* aBuffer)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL<")));
+ iConsumer->BufferFilledL(aBuffer);
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::SendEventToClient
+// Send event to client.
+// -----------------------------------------------------------------------------
+//
+TInt CPVCameraSourceNodeProxy::SendEventToClient(const TMMFEvent &aEvent)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient<")));
+ MAsyncEventHandler* eventHandler = dynamic_cast<MAsyncEventHandler*>(iConsumer);
+ TInt result = eventHandler->SendEventToClient(aEvent);
+ __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient>")));
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CVideoSourceProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy::CVideoSourceProxy(MVTVideoSource* aDataSource) : MPVDataSource(KNullUid), iVideoSource(aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy<")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy iVideoSource %d>"), iVideoSource));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL<")));
+ iCameraSourceNodeProxy = new (ELeave) CPVCameraSourceNodeProxy();
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy* CVideoSourceProxy::NewL(MVTVideoSource* aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL<")));
+ CVideoSourceProxy* self = new (ELeave)CVideoSourceProxy(aDataSource);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL>")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::QueryInterface
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface<")));
+ if ( aUuid == KPVUidVideoInputInterface )
+ {
+ MPVVideoInput* interfaceP = (MPVVideoInput*) this;
+ aInterfacePtr = (TPVInterfacePtr) interfaceP;
+ }
+ else
+ {
+ aInterfacePtr = NULL;
+ }
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface aInterfacePtr %d<"), aInterfacePtr));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::GetMultimediaTypesL
+// This API returns multimedias type supported by the data source/sink.
+// -----------------------------------------------------------------------------
+//
+const RArray<TPVMIMEType *>& CVideoSourceProxy::GetMultimediaTypesL() const
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetMultimediaTypesL iVideoSource %d"), iVideoSource));
+ const RArray<TPVMIMEType *>& multimediaType = iVideoSource->GetMultimediaTypesL();
+ return multimediaType;
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::QueryUUID
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetTimebaseL
+// This API is used to provide a timebase for plugins that deal with synchronized media data.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL<")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::FillBufferL
+// Method called by a MDataSink to request the data source to fill aBuffer with data.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId aMediaId )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL<")));
+ iCameraSourceNodeProxy->SetConsumer(aConsumer);
+ iVideoSource->FillBufferL(aBuffer, iCameraSourceNodeProxy, aMediaId);
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CreateSourceBufferL
+// Returns a buffer created by the data source.
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, TBool &aReference )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL")));
+ return iVideoSource->CreateSourceBufferL(aMediaId, aReference);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CreateSourceBufferL
+// Returns a buffer created by the data source.
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL")));
+ return iVideoSource->CreateSourceBufferL(aMediaId, aSinkBuffer, aReference);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceThreadLogon
+// Method to 'logon' the data source to the same thread that source will be supplying data in.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourceThreadLogon( MAsyncEventHandler& aEventHandler )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogon")));
+ return iVideoSource->SourceThreadLogon(aEventHandler);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceThreadLogoff
+// Method to 'logoff' the data source from the same thread that source supplies data in.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SourceThreadLogoff()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff<")));
+ iVideoSource->SourceThreadLogoff();
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePrimeL
+// Method to 'prime' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePrimeL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePrimeL<")));
+ return iVideoSource->SourcePrimeL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePlayL
+// Method to 'play' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePlayL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePlayL")));
+ return iVideoSource->SourcePlayL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePauseL
+// Method to 'pause' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePauseL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePauseL")));
+ return iVideoSource->SourcePauseL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceStopL
+// Method to 'stop' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourceStopL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceStopL")));
+ return iVideoSource->SourceStopL();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::BufferEmptiedL
+// Method called by a data sink to pass back an emptied buffer to the source.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::BufferEmptiedL(CMMFBuffer* aBuffer)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::BufferEmptiedL")));
+ iVideoSource->BufferEmptiedL(aBuffer);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CanCreateSourceBuffer
+// Method to indicate whether the data source can create a buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CVideoSourceProxy::CanCreateSourceBuffer()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CanCreateSourceBuffer")));
+ return iVideoSource->CanCreateSourceBuffer();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetFormatL
+// Set the video frame format. This must be from the list of supported formats.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetFormatL(const TDesC8& aFormat)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFormatL")));
+ iVideoSource->SetFormatL(aFormat);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetFrameRateL
+// Set the video frame rate. This must be within the range of supported frame rates.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetFrameRateL(TReal32 aFrameRate)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFrameRateL")));
+ iVideoSource->SetFrameRateL(aFrameRate);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetVideoFrameSizeL
+// Set the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetVideoFrameSizeL(const TSize& aSize)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL <")));
+ iVideoSource->SetVideoFrameSizeL(aSize);
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL >")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::GetVideoFrameSizeL
+// Get the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::GetVideoFrameSizeL(TSize& aSize) const
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL<")));
+ iVideoSource->GetVideoFrameSizeL(aSize);
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL>")));
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/ch324confighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include "mvtprotocolhandler.h"
+#include "ch324confighandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// Define image sizes.
+// QCIF.
+const TInt KVtProtoResolutionQCIFWidth = 176;
+const TInt KVtProtoResolutionQCIFHeight = 144;
+
+// SQCIF.
+const TInt KVtProtoResolutionSQCIFWidth = 128;
+const TInt KVtProtoResolutionSQCIFHeight = 96;
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::TH324ConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TH324ConfigHandler::TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::MPVH324MConfigCommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TH324ConfigHandler::MPVH324MConfigCommandCompletedL(const CPVCmdResponse& aResponse)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL<")));
+ TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+ TInt cmdId = aResponse.GetCmdId();
+ TInt cmdResponse = aResponse.GetCmdStatus();
+ TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
+ iProtocolHandler->HandleH324MConfigCommandCompletedL(commandRsp);
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::MPVH324MConfigInformationalEventL
+// Handle an information event.
+// -----------------------------------------------------------------------------
+//
+void TH324ConfigHandler::MPVH324MConfigInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL<")));
+ const TUint8* buffer = aEvent.GetLocalBuffer();
+ TInt eventType = aEvent.GetEventType();
+ TVtIndicationEvent vtEvent(eventType, buffer);
+ iProtocolHandler->HandleH324MConfigInformationalEventL(vtEvent);
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVendorId
+// Sets the vendor identification data.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetVendorId")));
+ return iH324Config->SetVendor(cc, ext, mc, aProduct, aVersion);
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand")));
+ return iH324Config->SendVideoTemporalSpatialTradeoffCommand(aLogicalChannel, aTradeoff);
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication")));
+ return iH324Config->SendVideoTemporalSpatialTradeoffIndication(aLogicalChannel, aTradeoff);
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVideoResolutions
+// This API allows the user to specify the supported resolutions for video for transmit and receive.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetSupportedResolutions()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetSupportedResolutions")));
+ RArray<TPVVideoResolutionRange> resolutions;
+ TPVVideoResolutionRange qcif;
+ qcif.first.iWidth = KVtProtoResolutionQCIFWidth;
+ qcif.first.iHeight = KVtProtoResolutionQCIFHeight;
+ qcif.last.iWidth = KVtProtoResolutionQCIFWidth;
+ qcif.last.iHeight = KVtProtoResolutionQCIFHeight;
+ TInt err( resolutions.Append( qcif ) );
+ if ( err == KErrNone )
+ {
+ TPVVideoResolutionRange sqcif;
+ sqcif.first.iWidth = KVtProtoResolutionSQCIFWidth;
+ sqcif.first.iHeight = KVtProtoResolutionSQCIFHeight;
+ sqcif.last.iWidth = KVtProtoResolutionSQCIFWidth;
+ sqcif.last.iHeight = KVtProtoResolutionSQCIFHeight;
+ err = resolutions.Append( sqcif );
+ if ( err == KErrNone )
+ {
+ err = iH324Config->SetVideoResolutions( INCOMING, resolutions );
+ }
+ }
+ resolutions.Close();
+
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetFastCsupOptions
+// This API allows the user to set options for fast call setup procedures.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetFastCsupOptions( )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetFastCsupOptions")));
+ TPVH324FastCsupOptions fastCsupOptions;
+ fastCsupOptions.iEnableWnsrp = ETrue;
+ fastCsupOptions.iEnableMona = EFalse;
+ return iH324Config->SetFastCsupOptions(fastCsupOptions);
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendUserInputMessageL
+// Causes the vt2way to send the specified user input to the remote terminal using
+// control channel.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendUserInputMessageL(MVTUserInput& user_input)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL<")));
+ if ( user_input.GetType() == EVtUiiDTMF )
+ {
+ CVTUserInputDtmf* dtmf = static_cast<CVTUserInputDtmf*>(&user_input);
+ return iH324Config->SendUserInputL(*dtmf->iUII);
+ }
+ else if (user_input.GetType() == EVtUiiAlphaNumeric)
+ {
+ CVTUserInputAlphanumeric* alphanumeric = static_cast<CVTUserInputAlphanumeric*>(&user_input);
+ return iH324Config->SendUserInputL(*alphanumeric->iUII);
+ }
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CH324ConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL<")));
+ iH324ConfigHandler = new (ELeave)TH324ConfigHandler(aHandler);
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL observer %d"), iH324ConfigHandler));
+ iH324Config->SetObserver(iH324ConfigHandler);
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::~CH324ConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CH324ConfigCommand::~CH324ConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand<")));
+ delete iH324ConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand>")));
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/csessionhandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_plugin_interfaces.h>
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include <pv_mp4_h263_enc_extension_interface_symbian.h>
+#include <pv_audio_output_control_interface.h>
+#include <pv_2way_factory.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+#include "cdatasourceproxy.h"
+#include "csessionhandler.h"
+#include "ccommserver.h"
+#include "ch324confighandler.h"
+#include "cvideoconfighandler.h"
+#include "caudioconfighandler.h"
+
+#define DEBUG_CFG_BB_LOOPBACK 0
+#define DEBUG_CFG_PV_LOOPBACK 0
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+const TInt KVtProtoMultiplexingDelay = 150;
+const TInt EVtGet324CtrlInterface = 15;
+const TInt EVtGetH263EncInterface = 24;
+// -----------------------------------------------------------------------------
+// TSessionHandler::TSessionHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TSessionHandler::TSessionHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::CommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::CommandCompletedL(const CPVCmdResponse& aResponse)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::CommandCompletedL<")));
+ TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+ TInt cmdId = (TInt)aResponse.GetCmdId();
+ TInt cmdResponse = aResponse.GetCmdStatus();
+ TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
+ iProtocolHandler->HandleSessionCommandEventL(commandRsp);
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::CommandCompletedL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::HandleInformationalEventL
+// Handle an informational event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::HandleInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleInformationalEventL<")));
+ const TUint8* buffer = aEvent.GetLocalBuffer();
+ TInt eventType = aEvent.GetEventType();
+ TVtIndicationEvent vtEvent(eventType, buffer);
+ iProtocolHandler->HandleSessionInformationalEventL(vtEvent);
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleInformationalEventL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::HandleErrorEventL
+// Handle an error event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::HandleErrorEventL(const CPVAsyncErrorEvent& aEvent)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleErrorEventL<")));
+ TVtErrorEvent event(aEvent.GetEventType());
+ iProtocolHandler->HandleSessionErrorEventL(event);
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleErrorEventL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CSessionCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::CSessionCommand(TSessionHandler* aSessionHandler, MPV2WaySymbianInterface* aPv2Way)
+ : iPv2Way(aPv2Way), iSessionHandler(aSessionHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand<")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::~CSessionComman
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::~CSessionCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand<")));
+ delete iVideoSource;
+ delete iDisplaySink;
+ delete iSessionHandler;
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ConnectToProtocolL
+// This function can be invoked only in the ESetup state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ConnectToProtocolL(MCommServer* aComm)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL")));
+ TPVConnectOptions connectOptions;
+ connectOptions.iLoopbackMode = PV_LOOPBACK_NONE;
+#ifdef _DEBUG
+ if ( DEBUG_CFG_BB_LOOPBACK )
+ {
+ connectOptions.iLoopbackMode = PV_LOOPBACK_COMM;
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback COMM")));
+ }
+ else if ( DEBUG_CFG_PV_LOOPBACK )
+ {
+ connectOptions.iLoopbackMode = PV_LOOPBACK_MUX;
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback MUX")));
+ }
+ else
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback NONE")));
+ }
+#endif
+ CCommServer* commServer = static_cast<CCommServer*>(aComm);
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL commServer %d"), commServer));
+ return iPv2Way->ConnectL(connectOptions, commServer->iComm);
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DisconnectFromProtocolL
+// The Disconnect call is valid only when invoked in the EConnecting, and
+// EConnected states.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DisconnectFromProtocolL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DisconnectFromProtocolL")));
+ return iPv2Way->DisconnectL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResetProtocolL
+// This function is valid only in the ESetup and EInitializing state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResetProtocolL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResetProtocolL")));
+ return iPv2Way->ResetL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::InitProtocolL
+// This function is valid only in the EIdle state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::InitProtocolL(TVtInitInfo& aInitInfo)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::InitProtocolL")));
+ CPV2WayInitInfo initInfo;
+ initInfo.iMultiplexingDelayMs = KVtProtoMultiplexingDelay;
+
+ if (aInitInfo.iAMRWBOn)
+ {
+ initInfo.iIncomingAudioFormats.
+ Append((TDesC8 *)&KVtAudioMIMETypeAMRWBIF2);
+
+ initInfo.iOutgoingAudioFormats.
+ Append((TDesC8 *)&KVtAudioMIMETypeAMRWBIF2);
+ }
+
+ initInfo.iIncomingAudioFormats.
+ Append((TDesC8 *)&KVtAudioMIMETypeAMRIF2);
+
+ initInfo.iOutgoingAudioFormats.
+ Append((TDesC8 *)&KVtAudioMIMETypeAMRIF2);
+
+ initInfo.iIncomingVideoFormats.
+ Append( (TDesC8 *) &KVtVideoMIMETypeH264 );
+
+ initInfo.iOutgoingVideoFormats.
+ Append( (TDesC8 *) &KVtVideoMIMETypeH264 );
+
+ if (!aInitInfo.iDisableMpeg4)
+ {
+ initInfo.iIncomingVideoFormats.
+ Append((TDesC8 *)&KVtVideoMIMETypeM4V);
+
+ initInfo.iOutgoingVideoFormats.
+ Append((TDesC8 *)&KVtVideoMIMETypeM4V);
+ }
+
+ initInfo.iIncomingVideoFormats.
+ Append((TDesC8 *)&KVtVideoMIMETypeH263);
+
+ initInfo.iOutgoingVideoFormats.
+ Append((TDesC8 *)&KVtVideoMIMETypeH263);
+
+ return iPv2Way->InitL(initInfo);
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSinkL(const TUint aChannelId, MVTVideoSink& aDataSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL aChannelId %d"), aChannelId));
+ iDisplaySink =CDisplaySinkProxy::NewL(&aDataSink);
+ return iPv2Way->AddDataSinkL(aChannelId, *iDisplaySink);
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSourceL(const TUint aChannelId, MVTVideoSource& aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL aChannelId %d"), aChannelId));
+ iVideoSource = CVideoSourceProxy::NewL(&aDataSource);
+ return iPv2Way->AddDataSourceL(aChannelId, *iVideoSource);
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL aChannelId %d"), aChannelId));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aDataSource);
+ return iPv2Way->AddDataSourceL(aChannelId, *(audioSourceProxy->iAudioSource));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL aChannelId %d"), aChannelId));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(&aDataSink);
+ return iPv2Way->AddDataSinkL(aChannelId, *(audioSinkProxy->iAudioSink));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVTVideoSink) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));
+ if (&aTrack == iVideoSource->VideoSource())
+ {
+ return iPv2Way->PauseL(*iVideoSource);
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVtVideoSink) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSink& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));
+ if (&aTrack == iDisplaySink->DisplaySink())
+ {
+ return iPv2Way->PauseL(*iDisplaySink);
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseAudioL
+// For an incoming track (MVTAudioSource) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseAudioL(MVTAudioSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseAudioL")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+ return iPv2Way->PauseL(*(audioSourceProxy->iAudioSource));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));
+ if (&aTrack == iVideoSource->VideoSource())
+ {
+ return iPv2Way->ResumeL(*iVideoSource);
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSink& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));
+ if (&aTrack == iDisplaySink->DisplaySink())
+ {
+ return iPv2Way->ResumeL(*iDisplaySink);
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeAudioL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeAudioL(MVTAudioSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeAudioL")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+ return iPv2Way->ResumeL(*(audioSourceProxy->iAudioSource));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CancelAllCommandsL
+// This API is to allow the user to cancel all pending requests.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::CancelAllCommandsL( )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CancelAllCommandsL")));
+ return iPv2Way->CancelAllCommandsL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::GetProtocolInterfaceL
+// This API is to allow for extensibility of the protocol interface.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL<")));
+ TInt commandId = 0;
+ if (aType == EVtH324Config)
+ {
+ CH324ConfigCommand* H324ConfigCommand = new (ELeave)CH324ConfigCommand();
+ commandId = iPv2Way->QueryInterfaceL(
+ KPVUidH324ConfigInterface,
+ ( MPVInterface*& ) H324ConfigCommand->PVH324ConfigInterface(),
+ ( void* ) EVtGet324CtrlInterface );
+
+ aProtocolCommand = H324ConfigCommand;
+ }
+ else if (aType == EVtVideoEncoderConfig)
+ {
+ CVideoConfigCommand* videoConfigCommand = new (ELeave)CVideoConfigCommand();
+ commandId = iPv2Way->QueryInterfaceL(
+ KPVUidVidEncConfigInterface,
+ ( MPVInterface*& ) videoConfigCommand->PVVideoEncoderInterface(),
+ ( void* ) EVtGetH263EncInterface );
+
+ aProtocolCommand = videoConfigCommand;
+ }
+ else
+ {
+ ;
+ }
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL aType %d, aProtocolCommand %d>"), aType, aProtocolCommand));
+ return commandId;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DeleteProtocolInterfaceL
+// This APIis to be used to release an interface that was previously obtained using
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL<")));
+ TInt commandId = 0;
+ if (aType == EVtH324Config)
+ {
+ CH324ConfigCommand* H324ConfigCommand = static_cast<CH324ConfigCommand*>(aProtocolCommand);
+ commandId = iPv2Way->ReleaseInterfaceL(H324ConfigCommand->PVH324ConfigInterface());
+ delete H324ConfigCommand;
+ }
+ else if (aType == EVtVideoEncoderConfig)
+ {
+ CVideoConfigCommand* videoConfigCommand = static_cast<CVideoConfigCommand*>(aProtocolCommand);
+ commandId = iPv2Way->ReleaseInterfaceL(videoConfigCommand->PVVideoEncoderInterface());
+ delete videoConfigCommand;
+ }
+ else
+ {
+ ;
+ }
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL aType, aProtocolCommand %d>"), aType, aProtocolCommand));
+ return commandId;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cvideoconfighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_2way_symbian_interface.h>
+#include <pv_mp4_h263_enc_extension_interface_symbian.h>
+#include "mvtprotocolhandler.h"
+#include "cvideoconfighandler.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::TVideoConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TVideoConfigHandler::TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL(const CPVCmdResponse& aResponse)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL<")));
+ TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+ TInt cmdId = aResponse.GetCmdId();
+ TInt cmdResponse = aResponse.GetCmdStatus();
+ TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
+ iProtocolHandler->HandleVideoEncoderCommandCompletedL(commandRsp);
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL
+// Handle an information event.
+// -----------------------------------------------------------------------------
+//
+void TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL<")));
+ const TUint8* buffer = aEvent.GetLocalBuffer();
+ TInt eventType = aEvent.GetEventType();
+ TVtIndicationEvent vtEvent(eventType, buffer);
+ iProtocolHandler->HandleVideoEncoderInformationalEventL(vtEvent);
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetObserverL
+// This API allows the user to specify separate observers for the extension interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL<")));
+ iVideoConfigHandler = new (ELeave)TVideoConfigHandler(aHandler);
+ iH263Encoder->SetObserver(iVideoConfigHandler);
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetIntraFrameInterval
+// Sets the I-Frame refresh rate of the encoded output.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetIntraFrameInterval(TUint32 aIFrameInterval)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval aIFrameInterval %d"), aIFrameInterval));
+ return iH263Encoder->SetIFrameInterval(aIFrameInterval);
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::RequestNextIntraFrame
+// Requests the encoder to encode the next frame as an I-Frame.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::RequestNextIntraFrame()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::RequestNextIntraFrame")));
+ return iH263Encoder->RequestIFrame();
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetVideoFrameRate
+// Sets the frame rate of encoded output for the specified layer.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetVideoFrameRate(TUint32 aFrameRate)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate aFrameRate %d"), aFrameRate));
+ return iH263Encoder->SetOutputFrameRate(aFrameRate);
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::~CVideoConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoConfigCommand::~CVideoConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+ delete iVideoConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cvtuserinput.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include "mvtprotocolhandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputDtmf::ConstructL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL<")));
+ iUII = CPVUserInputDtmfSymbian::NewL( aTone, EFalse, 0 );
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::CVTUserInputDtmf
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf* CVTUserInputDtmf::NewL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL<")));
+ CVTUserInputDtmf* self = new (ELeave)CVTUserInputDtmf();
+ CleanupStack::PushL(self);
+ self->ConstructL(aTone);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL>")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::~CVTUserInputDtmf
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf::~CVTUserInputDtmf()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf<")));
+ delete iUII;
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::GetType
+// Virtual function to return the user input type
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputDtmf::GetType()
+ {
+ return EVtUiiDTMF;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputAlphanumeric::ConstructL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL<")));
+ TBuf8<1> tone;
+ tone.Append( aTone );
+ iUII = CPVUserInputAlphanumericSymbian::NewL( tone );
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::CVTUserInputAlphanumeric
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric* CVTUserInputAlphanumeric::NewL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL<")));
+ CVTUserInputAlphanumeric* self = new (ELeave)CVTUserInputAlphanumeric();
+ CleanupStack::PushL(self);
+ self->ConstructL(aTone);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL>")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric<")));
+ delete iUII;
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::GetType
+// Virtual function to return the user input type.
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputAlphanumeric::GetType()
+ {
+ return EVtUiiAlphaNumeric;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/vtprotocolfactory.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2004-2006 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 <pv_plugin_interfaces.h>
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include <pv_audio_output_control_interface.h>
+#include <pv_2way_factory.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+#include "cdatasinkproxy.h"
+#include "csessionhandler.h"
+#include "caudioconfighandler.h"
+#include "cvtuserinput.h"
+#include "ccommserver.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateSessionCommandL
+// Create one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtSessionCommand* VTProtocolFactory::CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL<")));
+ a3G324MSupported = EVt3G324MSupported;
+ TSessionHandler * sessionHandler = new (ELeave)TSessionHandler(aProtocolHandler);
+ CleanupStack::PushL(sessionHandler);
+ MPV2WaySymbianInterface *pv2Way = CPV2WayFactory::CreateTerminalL(sessionHandler, sessionHandler, sessionHandler, aEnableProxy );
+ CSessionCommand* sessionCommand = new (ELeave)CSessionCommand(sessionHandler, pv2Way);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL sessionCommand %d>"), sessionCommand));
+ return sessionCommand;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteSessionCommand
+// This function allows the application to delete an instance of a terminal
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteSessionCommand( MVtSessionCommand* aSessionCommand )
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand<")));
+ CSessionCommand* sessionCommand = static_cast<CSessionCommand*>(aSessionCommand);
+ CPV2WayFactory::DeleteTerminal( sessionCommand->iPv2Way );
+ delete aSessionCommand;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSource
+// Creates an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSource* VTProtocolFactory::CreateAudioSource()
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource<")));
+ TInt err( KErrNone );
+ CAudioSourceProxy* audioSourceProxy = NULL;
+ TRAP (err, audioSourceProxy = new (ELeave) CAudioSourceProxy() );
+ if (err != KErrNone)
+ {
+ return NULL;
+ }
+ audioSourceProxy->iAudioSource = CPVDevSoundAudioFactory::CreateDevSoundAudioDataSource();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource audioSourceProxy %d>"), audioSourceProxy));
+ return audioSourceProxy;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeletAudioSource
+// Deletes an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeletAudioSource(MVTAudioSource *aSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource<")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(aSource);
+ CPVDevSoundAudioFactory::DeleteDevSoundAudioDataSource(audioSourceProxy->iAudioSource);
+ delete aSource;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSink
+// Creates an instance of a DevSound audio data sink.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSink* VTProtocolFactory::CreateAudioSink()
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink<")));
+ TInt err( KErrNone );
+ CAudioSinkProxy* audioSinkProxy = NULL;
+ TRAP(err, audioSinkProxy = new (ELeave) CAudioSinkProxy() );
+ if (err != KErrNone)
+ {
+ return NULL;
+ }
+ audioSinkProxy->iAudioSink = CPVDevSoundAudioFactory::CreateDevSoundAudioDataSink();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink audioSinkProxy %d>"), audioSinkProxy));
+ return audioSinkProxy;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteAudioSink
+// Deletes an instance of a DevSound audio data sink
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeleteAudioSink(MVTAudioSink *aSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink<")));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aSink);
+ CPVDevSoundAudioFactory::DeleteDevSoundAudioDataSink(audioSinkProxy->iAudioSink);
+ delete aSink;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateCommServerL
+// Creates an instance of a comm server of a particular name, to be used to
+// initialize the terminal.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MCommServer* VTProtocolFactory::CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL<")));
+ CCommServer* commServer = new (ELeave)CCommServer();
+ CleanupStack::PushL(commServer);
+ commServer->iComm = CPVCommFactory::CreateCommServerL(aName, aEnableBitReversal);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL commServer %d>"), commServer));
+ return commServer;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteCommServerL
+// This function allows the application to delete an instance of a comm server
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteCommServerL(MCommServer* aCommServer)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL<")));
+ CCommServer* commServer = static_cast<CCommServer*>(aCommServer);
+ CPVCommFactory::DeleteCommServerL(commServer->iComm);
+ delete aCommServer;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateUserInputIndication
+// Create instance .
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTUserInput* VTProtocolFactory::CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateUserInputIndication")));
+ if ( aUIIType == EVtUiiDTMF )
+ {
+ CVTUserInputDtmf* uii = CVTUserInputDtmf::NewL(aTone);
+ return uii;
+ }
+ else if (aUIIType == EVtUiiAlphaNumeric)
+ {
+ CVTUserInputAlphanumeric* uii = CVTUserInputAlphanumeric::NewL(aTone);
+ return uii;
+ }
+ else
+ {
+ return NULL;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteUserInputIndication
+// Delete instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteUserInputIndication(MVTUserInput* aUII)
+ {
+ delete aUII;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::GetAudioConfigCommandL
+// Get one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtAudioConfigCommand* VTProtocolFactory::GetAudioConfigCommandL(MVTAudioSink* aAudioSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL<")));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aAudioSink);
+ MPVAudioOutputControl* audioCtrl = CPVDevSoundAudioFactory::GetDevSoundAudioOutputControl(
+ audioSinkProxy->iAudioSink, ETrue );
+ CAudioConfigCommand* audioConfigCommand = new (ELeave)CAudioConfigCommand(audioCtrl);
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL audioConfigCommand %d>"), audioConfigCommand));
+ return audioConfigCommand;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/bwins/videotelprotou.def Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,13 @@
+EXPORTS
+ ?DeleteAudioSink@VTProtocolFactory@@SAHPAVMVTAudioSink@@@Z @ 1 NONAME ; int VTProtocolFactory::DeleteAudioSink(class MVTAudioSink *)
+ ?CreateAudioSink@VTProtocolFactory@@SAPAVMVTAudioSink@@XZ @ 2 NONAME ; class MVTAudioSink * VTProtocolFactory::CreateAudioSink(void)
+ ?CreateCommServerL@VTProtocolFactory@@SAPAVMCommServer@@ABVTDesC16@@H@Z @ 3 NONAME ; class MCommServer * VTProtocolFactory::CreateCommServerL(class TDesC16 const &, int)
+ ?CreateUserInputIndication@VTProtocolFactory@@SAPAVMVTUserInput@@W4TUserInputType@@E@Z @ 4 NONAME ; class MVTUserInput * VTProtocolFactory::CreateUserInputIndication(enum TUserInputType, unsigned char)
+ ?CreateSessionCommandL@VTProtocolFactory@@SAPAVMVtSessionCommand@@PAVMVtProtocolHandler@@HAAW4TVt3G324MSupported@@@Z @ 5 NONAME ; class MVtSessionCommand * VTProtocolFactory::CreateSessionCommandL(class MVtProtocolHandler *, int, enum TVt3G324MSupported &)
+ ?DeletAudioSource@VTProtocolFactory@@SAHPAVMVTAudioSource@@@Z @ 6 NONAME ; int VTProtocolFactory::DeletAudioSource(class MVTAudioSource *)
+ ?GetAudioConfigCommandL@VTProtocolFactory@@SAPAVMVtAudioConfigCommand@@PAVMVTAudioSink@@@Z @ 7 NONAME ; class MVtAudioConfigCommand * VTProtocolFactory::GetAudioConfigCommandL(class MVTAudioSink *)
+ ?CreateAudioSource@VTProtocolFactory@@SAPAVMVTAudioSource@@XZ @ 8 NONAME ; class MVTAudioSource * VTProtocolFactory::CreateAudioSource(void)
+ ?DeleteCommServerL@VTProtocolFactory@@SAXPAVMCommServer@@@Z @ 9 NONAME ; void VTProtocolFactory::DeleteCommServerL(class MCommServer *)
+ ?DeleteUserInputIndication@VTProtocolFactory@@SAXPAVMVTUserInput@@@Z @ 10 NONAME ; void VTProtocolFactory::DeleteUserInputIndication(class MVTUserInput *)
+ ?DeleteSessionCommand@VTProtocolFactory@@SAXPAVMVtSessionCommand@@@Z @ 11 NONAME ; void VTProtocolFactory::DeleteSessionCommand(class MVtSessionCommand *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/eabi/videotelprotou.def Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,13 @@
+EXPORTS
+ _ZN17VTProtocolFactory15CreateAudioSinkEv @ 1 NONAME
+ _ZN17VTProtocolFactory15DeleteAudioSinkEP12MVTAudioSink @ 2 NONAME
+ _ZN17VTProtocolFactory16DeletAudioSourceEP14MVTAudioSource @ 3 NONAME
+ _ZN17VTProtocolFactory17CreateAudioSourceEv @ 4 NONAME
+ _ZN17VTProtocolFactory17CreateCommServerLERK7TDesC16i @ 5 NONAME
+ _ZN17VTProtocolFactory17DeleteCommServerLEP11MCommServer @ 6 NONAME
+ _ZN17VTProtocolFactory20DeleteSessionCommandEP17MVtSessionCommand @ 7 NONAME
+ _ZN17VTProtocolFactory21CreateSessionCommandLEP18MVtProtocolHandleriR18TVt3G324MSupported @ 8 NONAME
+ _ZN17VTProtocolFactory22GetAudioConfigCommandLEP12MVTAudioSink @ 9 NONAME
+ _ZN17VTProtocolFactory25CreateUserInputIndicationE14TUserInputTypeh @ 10 NONAME
+ _ZN17VTProtocolFactory25DeleteUserInputIndicationEP12MVTUserInput @ 11 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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: Video Telephony Protocol
+*
+*/
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../inc/MVtProtocolHandler.h |../../inc/MVtProtocolHandler.h
+
+
+PRJ_MMPFILES
+
+../Group/videotelproto.mmp
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/group/videotelproto.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* 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: Video telephony protocol
+*
+*/
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET videotelproto.dll
+TARGETTYPE dll
+UID 0x1000008d 0x20021182
+
+
+SOURCEPATH ../src
+
+SOURCE cdatasinkproxy.cpp
+SOURCE cdatasourceproxy.cpp
+SOURCE caudioconfighandler.cpp
+SOURCE ch324confighandler.cpp
+SOURCE csessionhandler.cpp
+SOURCE cvideoconfighandler.cpp
+SOURCE cvtuserinput.cpp
+SOURCE vtprotocolfactory.cpp
+
+DOCUMENT ../../group/bld.inf
+
+USERINCLUDE ../inc/
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../inc
+SYSTEMINCLUDE /epoc32/include/mmf/common
+SYSTEMINCLUDE /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
+
+LIBRARY commonengine.lib
+LIBRARY MediaClientAudio.lib
+
+
+
+DEBUGLIBRARY vtlogger.lib
+
+LIBRARY MMFDevSound.lib
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/caudioconfighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,86 @@
+/*
+* 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: Audio configuration interface
+*
+*/
+
+#ifndef CAUDIOCONFIGHANDLER_H
+#define CAUDIOCONFIGHANDLER_H
+NONSHARABLE_CLASS( TAudioConfigHandler )
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TAudioConfigHandler( MVtProtocolHandler* aProtocolHandler);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CAudioConfigCommand ) : public CBase,
+ public MVtAudioConfigCommand
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ CAudioConfigCommand();
+
+ /**
+ * Destructor.
+ */
+ ~CAudioConfigCommand();
+
+ /**
+ * Method to set the playback volume to the specified value.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aNewVolume
+ * An input parameter to hold the value for the requested playback volume.
+ *
+ * @returns TInt
+ * Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt SetAudioVolumeL(TInt aVolume);
+
+ /**
+ * Method to get the maximum valid value for the playback volume.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aMaxVolume
+ * An output parameter to hold the value for the maximum valid playback volume.
+ * Note that the parameter should not be used until the callback indicates that the
+ * method has completed.
+ *
+ * @returns TInt
+ * Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume);
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+ private:
+ TAudioConfigHandler* iAudioConfigHandler;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/ccommserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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: Comm server interface
+*
+*/
+
+#ifndef CCOMMSERVER_H
+#define CCOMMSERVER_H
+NONSHARABLE_CLASS( CCommServer ) : public CBase,
+ public MCommServer
+ {
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cdatasinkproxy.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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: Data Sink Proxy interface
+*
+*/
+
+#ifndef CDATASINKPROXY_H
+#define CDATASINKPROXY_H
+
+NONSHARABLE_CLASS( CDisplaySinkProxy ) : public CBase
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ CDisplaySinkProxy(MVTVideoSink* aDisplaySink);
+
+ /**
+ * ConstructL
+ */
+ void ConstructL();
+
+ /**
+ * NewL
+ */
+ static CDisplaySinkProxy* NewL(MVTVideoSink* aDisplaySink);
+ /**
+ * Get pointer object of data sink.
+ * @return member variant:iDisplaySink
+ */
+ MVTVideoSink* DisplaySink() { return iDisplaySink; }
+ private:
+ MVTVideoSink* iDisplaySink;
+ };
+
+NONSHARABLE_CLASS( CAudioSinkProxy ) : public CBase,
+ public MVTAudioSink
+ {
+ };
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cdatasourceproxy.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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: Data Source proxy interface
+*
+*/
+
+#ifndef CDATASOURCEPROXY_H
+#define CDATASOURCEPROXY_H
+
+NONSHARABLE_CLASS( CVideoSourceProxy ) : public CBase
+ {
+ public: //new
+ /**
+ * Constructor.
+ */
+ CVideoSourceProxy(MVTVideoSource* aVideoSource);
+ /**
+ * ConstructL.
+ */
+ void ConstructL( );
+
+ /**
+ * NewL.
+ */
+ static CVideoSourceProxy* NewL(MVTVideoSource* aVideoSource);
+
+ /**
+ * Get member variant.
+ * @return memeber variant:iVideoSource
+ */
+ MVTVideoSource* VideoSource() { return iVideoSource; }
+ private:
+ MVTVideoSource* iVideoSource;
+ };
+
+NONSHARABLE_CLASS( CAudioSourceProxy ) : public CBase,
+ public MVTAudioSource
+ {
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/ch324confighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* 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: H324M configuration interface
+*
+*/
+
+#ifndef CH324ConfigHandler_H
+#define CH324ConfigHandler_H
+NONSHARABLE_CLASS( TH324ConfigHandler )
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CH324ConfigCommand ): public CBase,
+ public MVtH324ConfigCommand
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CH324ConfigCommand();
+
+ /**
+ * Sets the vendor identification data. This does not cause the stack to issue a vendor identifiation request.
+ * Set to NULL to disable sending vendor id. If set to a valid parameter before Connect, it will cause the stack
+ * to automatically send it along with the TCS message.
+ * @param cc
+ * T35 Country code
+ * @param ext
+ * T35 Extension
+ * @param mc
+ * T35 Manufacturer code
+ * @param aProduct
+ * Product number
+ * @param aVersion
+ * Version number
+ **/
+ virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion);
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff);
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+ * according to the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff);
+
+ /**
+ * This API allows the user to specify the supported resolutions for video for transmit and receive.
+ *
+ **/
+ virtual TInt SetSupportedResolutions( );
+ /**
+ * This API allows the user to set options for fast call setup procedures
+ **/
+ virtual TInt SetFastCsupOptions( );
+
+ /**
+ * Causes the protocol to send the specified user input to the remote terminal using
+ * control channel. The user input can be either DTMF ot Alphanumeric
+ * @param user_input A pointer to MVTUserInput
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt SendUserInputMessageL(MVTUserInput& user_input);
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler the observer for command status and unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+
+ private:
+ TH324ConfigHandler* iH324ConfigHandler;
+ };
+#endif
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/csessionhandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,223 @@
+/*
+* 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: Session command interface
+*
+*/
+
+#ifndef CSESSIOHANDLER_H
+#define CSESSIOHANDLER_H
+NONSHARABLE_CLASS( TSessionHandler )
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TSessionHandler(MVtProtocolHandler* aProtocolHandler);
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CSessionCommand ): public CBase,
+ public MVtSessionCommand
+ {
+ public:
+ /**
+ * Contructor.
+ */
+ CSessionCommand(TSessionHandler* aSessionHandler);
+
+ /**
+ * Destructor.
+ */
+ ~CSessionCommand();
+
+ /**
+ * This function is valid only in the EIdle state. It is a no-op when
+ * invoked in any other state. It causes the protocol to transition
+ * to the ESetup state. The terminal remains in the EInitializing state during
+ * the transition.
+ *
+ *
+ * @param aInitInfo
+ * A reference to a TVtInitInfo structure which set Mona on and off
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt InitProtocolL(TVtInitInfo& aInitInfo);
+
+ /**
+ * For an incoming track (MVTVideoSink) this function pauses sending
+ * media to the sink (output device) and stops the sink. It then does the protocol
+ * negotiations with the remote terminal to pause the logical channel for
+ * the specified track.
+ *
+ * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+ * source. It also performs any necessary protocol negotiations with the remote terminal.
+ * EVtCommandPause will be sent to the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt PauseVideoL(MVTVideoSource& aDataSource);
+ virtual TInt PauseVideoL(MVTVideoSink& aDataSink);
+ virtual TInt PauseAudioL(MVTAudioSource& aAudioSource);
+
+ /**
+ * Resume a previously paused incoming or outgoing track. For incoming,
+ * this function starts resumes playing out the media to the appropriate
+ * sink based on the current settings. For outgoing it resumes encoding
+ * and sending media from the source.
+ *
+ * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResumeVideoL(MVTVideoSource& aDataSource);
+ virtual TInt ResumeVideoL(MVTVideoSink& aDataSink);
+ virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource);
+
+ /**
+ * This function is valid only in the ESetup and EInitializing state. It is a
+ * no-op when invoked in the EIdle state
+ *
+ * It causes the protocol to transition back to the EIdle state. The
+ * terminal remains in the EResetting state during the transition.
+ *
+ * While resetting, the protocol de-allocates all resources resources that
+ * had been previously allocated. When it completes, ResetComplete is called
+ * and the protocol reverts to the EIdle state.
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResetProtocolL();
+
+ /**
+ * This function can be invoked only in the ESetup state. The terminal starts connecting with the remote
+ * terminal based on the specified options and capabilities.
+ * The EVtCommandConnect command completion event will be passed to the observer
+ * when connect completes.
+ * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+ * GetSessionParamsL may be called after call setup is started to get the list of available channels
+ * and their capabilities.
+ * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+ * EVtIndicationIncommingTrack event.
+ *
+ * @param aComm
+ * An optional pointer to a comm server to provide comm source and sink end-points.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ConnectToProtocolL(MCommServer* aComm);
+
+ /**
+ * Allows an application to provide a media source to be associated with a logical channel
+ * of communication with the peer. Sources should be added after the EVtIndicationOutgoingTrack
+ * indication is received for a newly established logical channel. The media type and
+ * channel id associated with the logical channel are specified as part of the indication.
+ * This function accepts a MVtVideoSource which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * Data sources could be of the following types:
+ * a)raw media sources like camera, microphone etc.
+ * b)sources of compressed data like file, gateway component etc.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this source.
+ * @param aDataSource
+ * reference to the data source
+ * @leave This method can leave with one of the following error codes
+ * KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+ * KPVErrInvalidState if invoked in the incorrect state
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @return A unique command id for asynchronous completion
+ */
+ virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource);
+ virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource);
+
+ /**
+ * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+ * logical channel of communication with the peer.
+ * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+ * channel id.
+ * Regular incoming channels are established by the peer and are
+ * indicated using the EVtIndicationIncomingTrack indication.
+ * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this sink.
+ * @param aDataSink The data sink to be added
+ *
+ * @return A unique command id for asynchronous completion
+ **/
+ virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink);
+ virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink);
+
+ /**
+ * This API is to allow the user to cancel all pending requests. The current request being
+ * processed, if any, will also be aborted.
+ * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt CancelAllCommandsL( );
+
+ /**
+ * The Disconnect call is valid only when invoked in the EConnecting, and
+ * EConnected states. It causes the terminal to transition to the
+ * EDisconnecting state. All the media tracks both incoming and outgoing
+ * will be closed on invoking Disconnect. On completion, the terminal
+ * goes to the ESetup state.
+ *
+ * It is a no-op when called in any other state.
+ *
+ * This is an asynchronous request. The EvtCommandDisconnect event will be
+ * sent to the observer when the request processing is complete. This
+ * is the only event the Phone application should expect after calling
+ * Disconnect.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt DisconnectFromProtocolL();
+
+ /**
+ * This API is to allow for extensibility of the protocol interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aType
+ * @param aProtocolCommand
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand);
+
+ /**
+ * This APIis to be used to release an interface that was previously obtained using
+ * QueryInterfaceL.
+ * @param aType
+ * @param
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand);
+ private:
+ CVideoSourceProxy* iVideoSource;
+ CDisplaySinkProxy* iDisplaySink;
+ TSessionHandler* iSessionHandler;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cvideoconfighandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* 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: Video configuration interface
+*
+*/
+
+#ifndef CVideoConfigHandler_H
+#define CVideoConfigHandler_H
+NONSHARABLE_CLASS( TVideoConfigHandler )
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+ private:
+ MVtProtocolHandler* iProtocolHandler;
+ };
+
+NONSHARABLE_CLASS( CVideoConfigCommand ) : public CBase,
+ public MVtVideoConfigCommand
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CVideoConfigCommand();
+
+ /**
+ * Sets the I-Frame refresh rate of the encoded output.
+ *
+ * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+ * @return True if successful, else false
+ */
+ virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval);
+
+ /**
+ * Requests the encoder to encode the next frame as an I-Frame. This menthod is valid
+ * only when the node is in EPVMFNodeStarted state. If successful, the next encoded
+ * frame will be an I-Frame.
+ *
+ * @return True for success, else false
+ */
+ virtual TInt RequestNextIntraFrame();
+
+ /**
+ * Sets the frame rate of encoded output for the specified layer.
+ * @param aFrameRate Frame rate for the specified layer in frames per second.
+ * @return True if successful, else false.
+ */
+ virtual TInt SetVideoFrameRate(TUint32 aFrameRate);
+
+ /**
+ * This API allows the user to specify separate observers for the extension interface.
+ *
+ * @param aHandler the observer for unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler);
+
+ private:
+ TVideoConfigHandler* iVideoConfigHandler;
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cvtuserinput.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* 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: User input interface
+*
+*/
+
+#ifndef CVTUSERINPUT_H
+#define CVTUSERINPUT_H
+NONSHARABLE_CLASS( CVTUserInputDtmf ) : public CBase,
+ public MVTUserInput
+ {
+ public:
+ /**
+ * ConstructL.
+ */
+ void ConstructL(TUint8 aTone);
+ /**
+ * NewL.
+ */
+ static CVTUserInputDtmf* NewL(TUint8 aTone);
+
+ /**
+ * Destructor.
+ */
+ ~CVTUserInputDtmf();
+
+ /**
+ * Virtual function to return the user input type
+ **/
+ virtual TUserInputType GetType();
+ };
+
+NONSHARABLE_CLASS( CVTUserInputAlphanumeric ) : public CBase,
+ public MVTUserInput
+ {
+ public:
+ /**
+ * ConstructL.
+ */
+ void ConstructL(TUint8 aTone);
+ /**
+ * NewL.
+ */
+ static CVTUserInputAlphanumeric* NewL(TUint8 aTone);
+
+ /**
+ * Destructor.
+ */
+ ~CVTUserInputAlphanumeric();
+
+ /**
+ * Virtual function to return the user input type
+ **/
+ virtual TUserInputType GetType();
+ };
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/mvtprotocolhandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,1124 @@
+/*
+* 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: Video Telephony Protocol interface
+*
+*/
+
+#ifndef MVTENGMEDIAHANDLER_H
+#define MVTENGMEDIAHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmfdatabuffer.h>
+#include <mmfutilities.h>
+#include <mmfcontrollerframework.h>
+
+typedef TInt TVtCommandId;
+typedef TInt TVtCommandStatus;
+typedef TDesC8 TVtMIMEType;
+
+const TUid KVTUidYUVFrameBuffer = {0xFFFFFF0d};
+const TInt KVtUidDataSrcPrime = 0xFFFFFF08;
+const TInt KVtUidDataSrcPlay = 0xFFFFFF09;
+const TInt KVtUidDataSrcPause = 0xFFFFFF0A;
+const TInt KVtUidDataSrcStop = 0xFFFFFF0B;
+
+_LIT8(KVtVideoMIMETypeYUV420, "/video/x-pv/raw/yuv420");
+
+enum TVt3G324MSupported
+ {
+ EVt3G324MMissing,
+ EVt3G324MSupported
+ };
+
+enum TVtConfigType
+ {
+ EVtH324Config,
+ EVtVideoEncoderConfig
+ };
+
+enum TVtCommandType {
+ EVtCommandInit,
+ EVtCommandGetSDKInfo,
+ EVtCommandGetProtocolState = 3,
+ EVtCommandReset,
+ EVtCommandAddDataSource = 6,
+ EVtCommandRemoveDataSource,
+ EVtCommandAddDataSink,
+ EVtCommandRemoveDataSink,
+ EVtCommandConnect,
+ EVtCommandDisconnect,
+ EVtCommandPause,
+ EVtCommandResume,
+ EVtCommandGetProtocolInterface =20,
+ EVtCommandDeleteProtocolInterface,
+ EVtCommandCancelAllCommands
+ };
+
+enum TVtIndicationType
+ {
+ EVtIndicationVideoSpatialTamporalTradeOffCommand,
+ EVtIndicationVideoSpatialTamporalTradeOffIndication,
+ EVtIndicationUserInputCapability = 6,
+ EVtIndicationIncomingTrack = 41,
+ EVtIndicationOutgoingTrack,
+ EVtIndicationDisconnect,
+ EVtIndicationClosingTrack,
+ EVtIndicationCloseTrack,
+ EVtIndicationPauseTrack,
+ EVtIndicationResumeTrack
+ };
+
+enum TVtMediaType
+ {
+ EVtAudio = 1,
+ EVtVideo,
+ EVtControl,
+ EVtData,
+ EVtUserInput,
+ EVtMediaNone
+ };
+
+enum TVtAudioOutputControlCommand
+ {
+ EVtAudioOutputControlGetMaxVolume,
+ EVtAudioOutputControlGetVolume,
+ EVtAudioOutputControlSetVolume,
+ EVtAudioOutputControlGetBalance,
+ EVtAudioOutputControlSetBalance
+ };
+
+const TUint8 EVtIncoming = 1;
+
+enum TUserInputType
+ {
+ EVtUiiDTMF,
+ EVtUiiAlphaNumeric
+ };
+
+struct TVtInitInfo
+ {
+ TBool iAMRWBOn;
+ TBool iDisableMpeg4;
+ };
+
+struct TVtIndicationEvent
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtIndicationEvent(TInt aEventType, const TUint8 *aLocalBuffer) : iEventType(aEventType), iLocalBuffer(aLocalBuffer)
+ {}
+ public:
+ TInt iEventType;
+ const TUint8 *iLocalBuffer;
+ };
+
+struct TVtCommandResponse
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtCommandResponse(TVtCommandType aCmdType, TInt aCmdId, TInt iCmdStatus) : iCmdType(aCmdType), iCmdId(aCmdId), iCmdStatus(iCmdStatus)
+ {}
+ public:
+ TVtCommandType iCmdType;
+ TInt iCmdId;
+ TInt iCmdStatus;
+ };
+
+struct TVtErrorEvent
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtErrorEvent(TInt aEventType) : iEventType(aEventType) {}
+ public:
+ TInt iEventType;
+ };
+
+struct TVtMMFDataBuffer
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ TVtMMFDataBuffer(CMMFBuffer* aMmfBuffer,TSize aFrameSize, TPtr8& aPtr) : iMmfBuffer(aMmfBuffer), iFrameSize(aFrameSize), iPtr(aPtr) {}
+
+ /**
+ * Get the YUV frame size.
+ * @return The frame size, in pixels
+ */
+ TSize GetFrameSize() {return iFrameSize;}
+
+ /**
+ * Get MMF buffer.
+ * @return the MMF buffer
+ */
+ CMMFBuffer* GetMMFBuffer() {return iMmfBuffer;}
+
+ /**
+ * Get MMF buffer.
+ * @return the MMF buffer
+ */
+ const CMMFBuffer* GetMMFBuffer() const {return iMmfBuffer;}
+
+ /**
+ * @return Returns a reference to the data buffer
+ **/
+ TPtr8& Data() {return iPtr;}
+
+ /**
+ * @return Returns the frame size of the contained buffer.
+ **/
+ const TSize GetFrameSize() const {return iFrameSize;}
+
+ /**
+ * @return Returns a reference to the data buffer
+ **/
+ const TPtr8& Data() const {return iPtr;}
+ private:
+ CMMFBuffer* iMmfBuffer;
+ TSize iFrameSize;
+ TPtr8& iPtr;
+ };
+
+class MVTVideoInput
+ {
+ public:
+
+ /**
+ * Set the video frame format. This must be from the list of supported formats.
+ * @param "aFormat" The mime string describing the video frame format.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFormatL(const TDesC8& aFormat) {}
+
+ /**
+ * Set the video frame rate. This must be within the range of supported frame rates
+ * for the current frame size.
+ * @param "aFrameRate" The video frame rate to set.
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetFrameRateL(TReal32 aFrameRate) {}
+
+ /**
+ * Set the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+ /**
+ * Get the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ */
+ virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return
+ **/
+ virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+ };
+
+class MVTVideoOutput
+ {
+ public:
+
+ /**
+ * Sets the data format using MIME string.
+ * @param aFormat The format as a MIME string.
+ **/
+ virtual void SetFormatL(const TDesC8& aFormat) {}
+
+ /**
+ * Set the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+ /**
+ * Get the video frame size
+ * @param "aSize" The video frame size, in pixels
+ * @exception Can leave with one of the system wide error codes
+ **/
+ virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+ /**
+ * This API returns multimedias type supported by the data source/sink -
+ * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure.
+ * @return
+ **/
+ virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+ };
+
+//This class is empty
+class MVTAudioSource
+ {
+ };
+
+//This class is empty
+class MVTAudioSink
+ {
+ };
+
+class MVTVideoSource;
+class MVTVideoSink : public MVTVideoOutput
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ MVTVideoSink(TUid aType): iDataSinkType(aType) {}
+
+ /**
+ * Method called by a data source to request the data sink to empty aBuffer of data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+ * to empty a buffer. The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+ * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The full buffer that needs emptying of it's data
+ *
+ * @param "aSupplier"
+ * The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+ * callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data
+ */
+ virtual void EmptyBufferL(
+ TVtMMFDataBuffer aDataBuffer,
+ MVTVideoSource* aSupplier,
+ TMediaId aMediaId ) {}
+
+ /**
+ * Method called by a data source to pass back an filled buffer to the sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data sink actively requests a supplier ie a data source
+ * to fill a buffer by calling the data sources FillBufferL.
+ * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+ *
+ * @param "aBuffer"
+ * The buffer that has been filled by a data source and is now available for processing
+ */
+ virtual void BufferFilledL( CMMFBuffer* aBuffer ) = 0;
+
+ /**
+ * Method to indicate whether the data sink can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data sink can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSinkBuffer() {return EFalse;}
+
+ /**
+ * Returns a buffer created by the data sink
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data.
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the sink
+ * and should be used in preference to the source buffer provided the source buffer
+ * is also not a reference buffer.
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSinkBufferL(
+ TMediaId aMediaId,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+ *
+ * This method may be required as the thread that the data sink was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SinkThreadLogon rather than in the creation
+ * of the data sink.
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * initialisation is required and/or the data sink can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+ /**
+ * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+ *
+ * This method may be required as the thread that the data sink is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data sink can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SinkThreadLogoff() {}
+
+ /**
+ * Method to 'prime' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific 'priming' is required
+ */
+ virtual TInt SinkPrimeL() {return 0;}
+
+ /**
+ * Method to 'play' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SinkPlayL() {return 0;}
+
+ /**
+ * Method to 'pause' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'pause'
+ */
+ virtual TInt SinkPauseL() {return 0;}
+
+ /**
+ * Method to 'stop' the data sink
+ *
+ * This is a virtual function that a derrived data sink can implement if
+ * any data sink specific action is required to 'stop'
+ */
+ virtual TInt SinkStopL() {return 0;}
+ private:
+ TUid iDataSinkType;
+ };
+
+class MVTVideoSource : public MVTVideoInput
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ MVTVideoSource(TUid aType): iDataSourceType(aType) {}
+
+ /**
+ * Method called by a data sink to request the data source to fill aBuffer with data.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+ * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled
+ * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+ *
+ * @param "aBuffer"
+ * The buffer that needs filling with data
+ *
+ * @param "aConsumer"
+ * The data sink that consumes the data. The data source needs this to make the BufferFilledL
+ * callback on aConsumer when the data source has completed filling the aBuffer.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ */
+ virtual void FillBufferL(
+ CMMFBuffer* aBuffer,
+ MVTVideoSink* aConsumer,
+ TMediaId aMediaId ) {}
+
+ /**
+ * Method called by a data sink to pass back an emptied buffer to the source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * This method is used as the callback when the data source actively requests a consumer ie a data sink
+ * to empty a buffer by calling the data sinks EmptyBufferL.
+ * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+ *
+ * @param "aBuffer"
+ * The buffer that has been emptied by a data sink and is now available for reuse
+ */
+ virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) = 0;
+
+ /**
+ * Method to indicate whether the data source can create a buffer.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @return ETrue if the data source can create a buffer else EFalse
+ */
+ virtual TBool CanCreateSourceBuffer() {return EFalse;}
+
+ /**
+ * Returns a buffer created by the data source
+ *
+ * This is a pure virtual function that each derived class must implement.
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer
+ * is also not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Returns a buffer created by the data source
+ *
+ * This is a virtual function that a derived class can implement.
+ * This can be used in preference to the above CreateSourceBufferL method in cases where
+ * the source buffer creation has a dependancy on the sink buffer
+ *
+ * @param "aMediaId"
+ * This identifies the type of media eg audio or video and the stream id.
+ * This parameter is required in cases where the source can supply data
+ * of more than one media type and/or multiple strams of data eg a multimedia file
+ *
+ * @param "aSinkBuffer"
+ * The sink buffer the nature of which may influence the creation of the source buffer
+ *
+ * @param "aReference"
+ * This must be written to by the method to indicate whether the created buffer is
+ * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source
+ * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+ * .
+ * @return The created buffer
+ */
+ virtual CMMFBuffer* CreateSourceBufferL(
+ TMediaId aMediaId,
+ CMMFBuffer& aSinkBuffer,
+ TBool &aReference ) {return NULL;}
+
+ /**
+ * Method to 'logon' the data source to the same thread that source will be supplying data in.
+ *
+ * This method may be required as the thread that the data source was created in is not always
+ * the same thread that the data transfer will take place in. Therefore any thread specific
+ * initialisation needs to be performed in the SourceThreadLogon rather than in the creation
+ * of the data source.
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * initialisation is required and/or the data source can create any asynchronous events.
+ *
+ *
+ * @param "aEventHandler"
+ * This is an MAsyncEventHandler to handle asynchronous events that occur during the
+ * transfer of multimedia data. The event handler must be in the same thread as the data transfer
+ * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+ *
+ *
+ * @return KErrNone if successful, otherwise a system wide error code.
+ */
+ virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+ /**
+ * Method to 'logoff' the data source from the same thread that source supplies data in.
+ *
+ * This method may be required as the thread that the data source is deleted in may not be
+ * the same thread that the data transfer took place in. Therefore any thread specific
+ * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+ *
+ * This is a virtual function that a derrived data source can implement if any thread specific
+ * releasing of resources is required.
+ */
+ virtual void SourceThreadLogoff() {}
+
+ /**
+ * Method to 'prime' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific 'priming' is required
+ */
+ virtual TInt SourcePrimeL() {return 0;}
+
+ /**
+ * Method to 'play' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required prior to 'playing'ie the start of data transfer
+ */
+ virtual TInt SourcePlayL() {return 0;}
+
+ /**
+ * Method to 'pause' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'pause'
+ */
+ virtual TInt SourcePauseL() {return 0;}
+
+ /**
+ * Method to 'stop' the data source
+ *
+ * This is a virtual function that a derrived data source can implement if
+ * any data source specific action is required to 'stop'
+ */
+ virtual TInt SourceStopL() {return 0;}
+ private:
+ TUid iDataSourceType;
+ };
+
+class MCommServer
+ {
+ };
+
+class MVtProtocolCommand
+ {
+ public:
+ enum TVtProtocolState
+ {
+ EIdle,
+ EInitializing,
+ ESetup,
+ EConnecting,
+ EConnected,
+ EDisconnecting,
+ EResetting
+ };
+ };
+
+class MVtProtocolHandler
+ {
+ public:
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an informational event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleSessionInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+ /**
+ * Handle an error event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent) = 0;
+
+ /**
+ * Signals completion of the audio output control command.
+ * @param aId The command id of the completed command.
+ * @param aCmd The command type.
+ * @param aContextData The context data passed in with the command.
+ * @param aStatus The command completion status.
+ **/
+ virtual void HandleAudioOutputControlCommandComplete(TInt aId, TVtAudioOutputControlCommand aCmd, TAny *aContextData ,TInt aStatus) = 0;
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleVideoEncoderCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleVideoEncoderInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aResponse" "The response to a previously issued command."
+ */
+ virtual void HandleH324MConfigCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+ /**
+ * Handle an event that has been generated.
+ *
+ * @param "aEvent" "The event to be handled."
+ */
+ virtual void HandleH324MConfigInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+ virtual ~MVtProtocolHandler() {}
+ };
+
+
+class MVtSessionCommand : public MVtProtocolCommand
+ {
+ public:
+ /**
+ * This function is valid only in the EIdle state. It is a no-op when
+ * invoked in any other state. It causes the protocol to transition
+ * to the ESetup state. The terminal remains in the EInitializing state during
+ * the transition.
+ *
+ *
+ * @param aInitInfo
+ * A reference to a TVtInitInfo structure which set Mona on and off
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt InitProtocolL(TVtInitInfo& aInitInfo) = 0;
+
+ /**
+ * For an incoming track (MVTVideoSink) this function pauses sending
+ * media to the sink (output device) and stops the sink. It then does the protocol
+ * negotiations with the remote terminal to pause the logical channel for
+ * the specified track.
+ *
+ * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+ * source. It also performs any necessary protocol negotiations with the remote terminal.
+ * EVtCommandPause will be sent to the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt PauseVideoL(MVTVideoSource& aDataSource) = 0;
+ virtual TInt PauseVideoL(MVTVideoSink& aDataSink) = 0;
+ virtual TInt PauseAudioL(MVTAudioSource& aAudioSource) = 0;
+
+ /**
+ * Resume a previously paused incoming or outgoing track. For incoming,
+ * this function starts resumes playing out the media to the appropriate
+ * sink based on the current settings. For outgoing it resumes encoding
+ * and sending media from the source.
+ * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResumeVideoL(MVTVideoSource& aDataSource) = 0;
+ virtual TInt ResumeVideoL(MVTVideoSink& aDataSink) = 0;
+ virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource) = 0;
+
+ /**
+ * This function is valid only in the ESetup and EInitializing state. It is a
+ * no-op when invoked in the EIdle state
+ *
+ * It causes the protocol to transition back to the EIdle state. The
+ * terminal remains in the EResetting state during the transition.
+ *
+ * While resetting, the protocol de-allocates all resources resources that
+ * had been previously allocated. When it completes, ResetComplete is called
+ * and the protocol reverts to the EIdle state.
+ *
+ * @leave This method can leave with one of the following error codes
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ResetProtocolL() = 0;
+
+ /**
+ * This function can be invoked only in the ESetup state. The terminal starts connecting with the remote
+ * terminal based on the specified options and capabilities.
+ * The EVtCommandConnect command completion event will be passed to the observer
+ * when connect completes.
+ * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+ * GetSessionParamsL may be called after call setup is started to get the list of available channels
+ * and their capabilities.
+ * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+ * EVtIndicationIncommingTrack event.
+ *
+ * @param aComm
+ * An optional pointer to a comm server to provide comm source and sink end-points.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt ConnectToProtocolL(MCommServer* aComm) = 0;
+
+ /**
+ * Allows an application to provide a media source to be associated with a logical channel
+ * of communication with the peer. Sources should be added after the EVtIndicationOutgoingTrack
+ * indication is received for a newly established logical channel. The media type and
+ * channel id associated with the logical channel are specified as part of the indication.
+ * This function accepts a MVtVideoSource which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * Data sources could be of the following types:
+ * a)raw media sources like camera, microphone etc.
+ * b)sources of compressed data like file, gateway component etc.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this source.
+ * @param aDataSource
+ * reference to the data source
+ * @leave This method can leave with one of the following error codes
+ * KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+ * KErrNoMemory if the SDK failed to allocate memory during this operation
+ * @return A unique command id for asynchronous completion
+ */
+ virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource) = 0;
+ virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) = 0;
+
+ /**
+ * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+ * logical channel of communication with the peer.
+ * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+ * channel id.
+ * Regular incoming channels are established by the peer and are
+ * indicated using the EVtIndicationIncomingTrack indication.
+ * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+ * for advertizing capability and exposing configuration APIs.
+ * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+ *
+ * @param aChannelId
+ * Indicates the channel id to be associated with this sink.
+ * @param aDataSink The data sink to be added
+ *
+ * @return A unique command id for asynchronous completion
+ **/
+ virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink) = 0;
+ virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) = 0;
+
+ /**
+ * This API is to allow the user to cancel all pending requests. The current request being
+ * processed, if any, will also be aborted.
+ * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt CancelAllCommandsL( ) = 0;
+
+ /**
+ * The Disconnect call is valid only when invoked in the EConnecting, and
+ * EConnected states. It causes the terminal to transition to the
+ * EDisconnecting state. All the media tracks both incoming and outgoing
+ * will be closed on invoking Disconnect. On completion, the terminal
+ * goes to the ESetup state.
+ *
+ * It is a no-op when called in any other state.
+ *
+ * This is an asynchronous request. The EvtCommandDisconnect event will be
+ * sent to the observer when the request processing is complete. This
+ * is the only event the Phone application should expect after calling
+ * Disconnect.
+ *
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt DisconnectFromProtocolL() = 0;
+
+ /**
+ * This API is to allow for extensibility of the protocol interface.
+ * It allows a caller to ask for an instance of a particular interface object to be returned.
+ * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
+ * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+ * returned if it is supported. Otherwise the returned pointer is NULL.
+ * @param aType
+ * @param aProtocolCommand
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) = 0;
+
+ /**
+ * This APIis to be used to release an interface that was previously obtained using
+ * QueryInterfaceL.
+ * @param aType
+ * @param
+ * @exception not_supported
+ * leaves if the specified interface id is not supported.
+ **/
+ virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*) = 0;
+
+ /**
+ * Destructor.
+ */
+ virtual ~MVtSessionCommand() {}
+ };
+
+class MVTUserInput
+ {
+ public:
+
+ /**
+ * @returns Returns the user input type.
+ **/
+ virtual TUserInputType GetType() = 0;
+ virtual ~MVTUserInput() {}
+ };
+
+class MVtH324ConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler the observer for command status and unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Sets the vendor identification data. This does not cause the stack to issue a vendor identifiation request.
+ * Set to NULL to disable sending vendor id. If set to a valid parameter before Connect, it will cause the stack
+ * to automatically send it along with the TCS message.
+ * @param cc
+ * T35 Country code
+ * @param ext
+ * T35 Extension
+ * @param mc
+ * T35 Manufacturer code
+ * @param aProduct
+ * Product number
+ * @param aVersion
+ * Version number
+ **/
+ virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) = 0;
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+ /**
+ * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+ * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+ * according to the tradeoff value.
+ * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+ * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+ * to precise values of spatial resolution or frame rate.
+ *
+ **/
+ virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+ /**
+ * This API allows the user to specify the supported resolutions for video for transmit and receive.
+ *
+ **/
+ virtual TInt SetSupportedResolutions( ) = 0;
+
+ /**
+ * This API allows the user to set options for fast call setup procedures
+ **/
+
+ virtual TInt SetFastCsupOptions( ) = 0;
+
+ /**
+ * Causes the protocol to send the specified user input to the remote terminal using
+ * control channel. The user input can be either DTMF ot Alphanumeric
+ * @param user_input A pointer to MVTUserInput
+ * @returns A unique command id for asynchronous completion
+ **/
+ virtual TInt SendUserInputMessageL(MVTUserInput& user_input) = 0;
+ };
+
+class MVtVideoConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify separate observers for the extension interface.
+ *
+ * @param aHandler the observer for unsolicited informational events
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Sets the I-Frame refresh rate of the encoded output.
+ *
+ * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+ * @return True if successful, else false
+ */
+ virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval) = 0;
+
+ /**
+ * Requests the encoder to encode the next frame as an I-Frame. If successful, the next encoded
+ * frame will be an I-Frame.
+ *
+ * @return True for success, else false
+ */
+ virtual TInt RequestNextIntraFrame() = 0;
+
+ /**
+ * Sets the frame rate of encoded output for the specified layer.
+ * @param aFrameRate Frame rate for the specified layer in frames per second.
+ * @return True if successful, else false.
+ */
+ virtual TInt SetVideoFrameRate(TUint32 aFrameRate) = 0;
+ };
+
+class MVtAudioConfigCommand : public MVtProtocolCommand
+ {
+ public:
+
+ /**
+ * This API allows the user to specify observers for the 324m interface.
+ *
+ * @param aHandler
+ **/
+ virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+ /**
+ * Method to set the playback volume to the specified value.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aNewVolume
+ * An input parameter to hold the value for the requested playback volume.
+ *
+ * @returns Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt SetAudioVolumeL(TInt aVolume) = 0;
+
+ /**
+ * Method to get the maximum valid value for the playback volume.
+ *
+ * This is a pure virtual function that each derived class must implement.
+ * It is also an asynchronous function which will be answered with a callback.
+ *
+ * @param aMaxVolume
+ * An output parameter to hold the value for the maximum valid playback volume.
+ * Note that the parameter should not be used until the callback indicates that the
+ * method has completed.
+ *
+ * @returns Returns a command ID that can be used to identify a command completion result with corresponding request.
+ */
+ virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume) = 0;
+ };
+
+class VTProtocolFactory
+ {
+ public:
+
+ /**
+ * Create one instance.
+ */
+ IMPORT_C static MVtSessionCommand* CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported);
+
+ /**
+ * This function allows the application to delete an instance of a terminal
+ * and reclaim all allocated resources. A terminal should be deleted only in
+ * the EIdle state. An attempt to delete a terminal in any other state will
+ * result in unpredictable behavior.
+ *
+ * @param terminal the terminal to be deleted.
+ *
+ **/
+ IMPORT_C static void DeleteSessionCommand( MVtSessionCommand* aSessionCommand );
+
+ /**
+ * Creates an instance of a DevSound audio data source.
+ *
+ * @param None
+ *
+ * @returns A pointer to the interface
+ **/
+ IMPORT_C static MVTAudioSource* CreateAudioSource();
+
+ /**
+ * Deletes an instance of a DevSound audio data source
+ * that was previously created with CreateAudioSource();
+ *
+ * @param aSource The audio data source to be deleted.
+ *
+ * @returns status
+ **/
+ IMPORT_C static TInt DeletAudioSource(MVTAudioSource *aSource);
+
+ /**
+ * Creates an instance of a DevSound audio data sink.
+ *
+ * @param None
+ *
+ * @returns A pointer to the interface
+ **/
+ IMPORT_C static MVTAudioSink* CreateAudioSink();
+
+ /**
+ * Deletes an instance of a DevSound audio data sink
+ * that was previously created with CreateAudioSink();
+ *
+ * @param The audio data sink to be deleted.
+ *
+ * @returns status
+ **/
+ IMPORT_C static TInt DeleteAudioSink(MVTAudioSink *aSink);
+
+ /**
+ * Creates an instance of a comm server of a particular name, to be used to
+ * initialize the terminal.
+ *
+ *
+ * @returns A pointer to a terminal or leaves if the type is invalid or the system is out of resources
+ **/
+ IMPORT_C static MCommServer* CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal=EFalse);
+
+ /**
+ * This function allows the application to delete an instance of a comm server
+ * and reclaim all allocated resources. A comm server should be deleted only when the
+ * protocol is in the EIdle state. An attempt to delete a comm server in any other state
+ * could result in memory corruption within the protocol. This function will leave with
+ * KErrInUse if the comm server is still in use. However it will not check the state of the
+ * protocol that is using the comm server.
+ *
+ * @param aCommServer the comm server to be deleted.
+ *
+ * @returns a status code indicating success or failure
+ **/
+ IMPORT_C static void DeleteCommServerL(MCommServer* aCommServer);
+
+ /**
+ * Create instance.
+ * @param aUIITyep
+ * @param aTone
+ */
+ IMPORT_C static MVTUserInput* CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone);
+
+ /**
+ * Delete instance.
+ * @param aUII
+ */
+ IMPORT_C static void DeleteUserInputIndication(MVTUserInput* aUII);
+
+ /**
+ *
+ * @param aAudioSink
+ */
+ IMPORT_C static MVtAudioConfigCommand* GetAudioConfigCommandL(MVTAudioSink* aAudioSink);
+ };
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/caudioconfighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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: Audio configuration implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::TAudioConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TAudioConfigHandler::TAudioConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::CAudioConfigCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::CAudioConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand<")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CAudioConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL<")));
+ iAudioConfigHandler = new (ELeave)TAudioConfigHandler(aHandler);
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetAudioVolumeL
+// Method to set the playback volume to the specified value.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::SetAudioVolumeL(TInt aVolume)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL aVolume %d"), aVolume));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::GetMaxAudioVolumeL
+// Method to get the maximum valid value for the playback volume.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::GetMaxAudioVolumeL(TInt& aMaxVolume)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL")));
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL aMaxVolume %d"), aMaxVolume));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::~CAudioConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::~CAudioConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand>")));
+ delete iAudioConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand")));
+ }
+// End of File
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cdatasinkproxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* 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: Data sink proxy implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CDisplaySinkProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy::CDisplaySinkProxy(MVTVideoSink* aDisplaySink) : iDisplaySink(aDisplaySink)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy<" ) ));
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy iDisplaySink %d>" ), iDisplaySink));
+ }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::ConstructL()
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL<" ) ));
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL>" ) ));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy* CDisplaySinkProxy::NewL(MVTVideoSink* aDisplaySink)
+ {
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL<" ) ));
+ CDisplaySinkProxy* self = new (ELeave)CDisplaySinkProxy(aDisplaySink);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL>" ) ));
+ return self;
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cdatasourceproxy.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* 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: Data source proxy implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CVideoSourceProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy::CVideoSourceProxy(MVTVideoSource* aDataSource) : iVideoSource(aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy<")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy iVideoSource %d>"), iVideoSource));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::ConstructL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL<")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy* CVideoSourceProxy::NewL(MVTVideoSource* aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL<")));
+ CVideoSourceProxy* self = new (ELeave)CVideoSourceProxy(aDataSource);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL>")));
+ return self;
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/ch324confighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* 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: H324 configuration implementation
+*
+*/
+
+
+#include "mvtprotocolhandler.h"
+#include "ch324confighandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::TH324ConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TH324ConfigHandler::TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVendorId
+// Sets the vendor identification data.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetVendorId")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVideoResolutions
+// This API allows the user to specify the supported resolutions for video for transmit and receive.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetSupportedResolutions()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetSupportedResolutions")));
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetFastCsupOptions
+// This API allows the user to set options for fast call setup procedures.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetFastCsupOptions( )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetFastCsupOptions")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendUserInputMessageL
+// Causes the vt2way to send the specified user input to the remote terminal using
+// control channel.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendUserInputMessageL(MVTUserInput& user_input)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL<")));
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CH324ConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL<")));
+ iH324ConfigHandler = new (ELeave)TH324ConfigHandler(aHandler);
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL observer %d"), iH324ConfigHandler));
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::~CH324ConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CH324ConfigCommand::~CH324ConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand<")));
+ delete iH324ConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand>")));
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/csessionhandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,314 @@
+/*
+* 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: Session command implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+#include "cdatasourceproxy.h"
+#include "csessionhandler.h"
+#include "ccommserver.h"
+#include "ch324confighandler.h"
+#include "cvideoconfighandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::TSessionHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TSessionHandler::TSessionHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler>")));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CSessionCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::CSessionCommand(TSessionHandler* aSessionHandler)
+ : iSessionHandler(aSessionHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand<")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::~CSessionComman
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::~CSessionCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand<")));
+ delete iVideoSource;
+ delete iDisplaySink;
+ delete iSessionHandler;
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ConnectToProtocolL
+// This function can be invoked only in the ESetup state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ConnectToProtocolL(MCommServer* aComm)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL")));
+ CCommServer* commServer = static_cast<CCommServer*>(aComm);
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL commServer %d"), commServer));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DisconnectFromProtocolL
+// The Disconnect call is valid only when invoked in the EConnecting, and
+// EConnected states.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DisconnectFromProtocolL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DisconnectFromProtocolL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResetProtocolL
+// This function is valid only in the ESetup and EInitializing state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResetProtocolL()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResetProtocolL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::InitProtocolL
+// This function is valid only in the EIdle state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::InitProtocolL(TVtInitInfo& aInitInfo)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::InitProtocolL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSinkL(const TUint aChannelId, MVTVideoSink& aDataSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL aChannelId %d"), aChannelId));
+ iDisplaySink =CDisplaySinkProxy::NewL(&aDataSink);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSourceL(const TUint aChannelId, MVTVideoSource& aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL aChannelId %d"), aChannelId));
+ iVideoSource = CVideoSourceProxy::NewL(&aDataSource);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL aChannelId %d"), aChannelId));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aDataSource);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL")));
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL aChannelId %d"), aChannelId));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(&aDataSink);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVTVideoSink) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVtVideoSink) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSink& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseAudioL
+// For an incoming track (MVTAudioSource) this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseAudioL(MVTAudioSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseAudioL")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSink& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeAudioL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeAudioL(MVTAudioSource& aTrack)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeAudioL")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CancelAllCommandsL
+// This API is to allow the user to cancel all pending requests.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::CancelAllCommandsL( )
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CancelAllCommandsL")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::GetProtocolInterfaceL
+// This API is to allow for extensibility of the protocol interface.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL<")));
+ TInt commandId = 0;
+ if (aType == EVtH324Config)
+ {
+ CH324ConfigCommand* H324ConfigCommand = new (ELeave)CH324ConfigCommand();
+
+ aProtocolCommand = H324ConfigCommand;
+ }
+ else if (aType == EVtVideoEncoderConfig)
+ {
+ CVideoConfigCommand* videoConfigCommand = new (ELeave)CVideoConfigCommand();
+
+ aProtocolCommand = videoConfigCommand;
+ }
+ else
+ {
+ ;
+ }
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL aType %d, aProtocolCommand %d>"), aType, aProtocolCommand));
+ return commandId;
+ }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DeleteProtocolInterfaceL
+// This APIis to be used to release an interface that was previously obtained using
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL<")));
+ TInt commandId = 0;
+ if (aType == EVtH324Config)
+ {
+ CH324ConfigCommand* H324ConfigCommand = static_cast<CH324ConfigCommand*>(aProtocolCommand);
+
+ delete H324ConfigCommand;
+ }
+ else if (aType == EVtVideoEncoderConfig)
+ {
+ CVideoConfigCommand* videoConfigCommand = static_cast<CVideoConfigCommand*>(aProtocolCommand);
+
+ delete videoConfigCommand;
+ }
+ else
+ {
+ ;
+ }
+ __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL aType, aProtocolCommand %d>"), aType, aProtocolCommand));
+ return commandId;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cvideoconfighandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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: Video configuration implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cvideoconfighandler.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::TVideoConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TVideoConfigHandler::TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler<")));
+ __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetObserverL
+// This API allows the user to specify separate observers for the extension interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL<")));
+ iVideoConfigHandler = new (ELeave)TVideoConfigHandler(aHandler);
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetIntraFrameInterval
+// Sets the I-Frame refresh rate of the encoded output.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetIntraFrameInterval(TUint32 aIFrameInterval)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval aIFrameInterval %d"), aIFrameInterval));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::RequestNextIntraFrame
+// Requests the encoder to encode the next frame as an I-Frame.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::RequestNextIntraFrame()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::RequestNextIntraFrame")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetVideoFrameRate
+// Sets the frame rate of encoded output for the specified layer.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetVideoFrameRate(TUint32 aFrameRate)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate")));
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate aFrameRate %d"), aFrameRate));
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::~CVideoConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoConfigCommand::~CVideoConfigCommand()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+ delete iVideoConfigHandler;
+ __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cvtuserinput.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* 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: VT User input implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputDtmf::ConstructL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL<")));
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::CVTUserInputDtmf
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf* CVTUserInputDtmf::NewL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL<")));
+ CVTUserInputDtmf* self = new (ELeave)CVTUserInputDtmf();
+ CleanupStack::PushL(self);
+ self->ConstructL(aTone);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL>")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::~CVTUserInputDtmf
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf::~CVTUserInputDtmf()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf<")));
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::GetType
+// Virtual function to return the user input type
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputDtmf::GetType()
+ {
+ return EVtUiiDTMF;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputAlphanumeric::ConstructL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL<")));
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::CVTUserInputAlphanumeric
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric* CVTUserInputAlphanumeric::NewL(TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL<")));
+ CVTUserInputAlphanumeric* self = new (ELeave)CVTUserInputAlphanumeric();
+ CleanupStack::PushL(self);
+ self->ConstructL(aTone);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL>")));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric()
+ {
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric<")));
+ __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric>")));
+ }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::GetType
+// Virtual function to return the user input type.
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputAlphanumeric::GetType()
+ {
+ return EVtUiiAlphaNumeric;
+ }
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/vtprotocolfactory.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,208 @@
+/*
+* 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: Protocol factory implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+#include "cdatasinkproxy.h"
+#include "csessionhandler.h"
+#include "caudioconfighandler.h"
+#include "cvtuserinput.h"
+#include "ccommserver.h"
+
+#ifdef _DEBUG
+# define __IF_DEBUG(t) {RDebug::t;}
+#else
+# define __IF_DEBUG(t)
+#endif
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateSessionCommandL
+// Create one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtSessionCommand* VTProtocolFactory::CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL<")));
+ a3G324MSupported = EVt3G324MMissing;
+ TSessionHandler * sessionHandler = new (ELeave)TSessionHandler(aProtocolHandler);
+ CleanupStack::PushL(sessionHandler);
+ CSessionCommand* sessionCommand = new (ELeave)CSessionCommand(sessionHandler);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL sessionCommand %d>"), sessionCommand));
+ return sessionCommand;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteSessionCommand
+// This function allows the application to delete an instance of a terminal
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteSessionCommand( MVtSessionCommand* aSessionCommand )
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand<")));
+ CSessionCommand* sessionCommand = static_cast<CSessionCommand*>(aSessionCommand);
+ delete aSessionCommand;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand>")));
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSource
+// Creates an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSource* VTProtocolFactory::CreateAudioSource()
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource<")));
+ TInt err( KErrNone );
+ CAudioSourceProxy* audioSourceProxy = NULL;
+ TRAP (err, audioSourceProxy = new (ELeave) CAudioSourceProxy() );
+ if (err != KErrNone)
+ {
+ return NULL;
+ }
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource audioSourceProxy %d>"), audioSourceProxy));
+ return audioSourceProxy;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeletAudioSource
+// Deletes an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeletAudioSource(MVTAudioSource *aSource)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource<")));
+ CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(aSource);
+ delete aSource;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSink
+// Creates an instance of a DevSound audio data sink.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSink* VTProtocolFactory::CreateAudioSink()
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink<")));
+ TInt err( KErrNone );
+ CAudioSinkProxy* audioSinkProxy = NULL;
+ TRAP(err, audioSinkProxy = new (ELeave) CAudioSinkProxy() );
+ if (err != KErrNone)
+ {
+ return NULL;
+ }
+
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink audioSinkProxy %d>"), audioSinkProxy));
+ return audioSinkProxy;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteAudioSink
+// Deletes an instance of a DevSound audio data sink
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeleteAudioSink(MVTAudioSink *aSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink<")));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aSink);
+ delete aSink;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink>")));
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateCommServerL
+// Creates an instance of a comm server of a particular name, to be used to
+// initialize the terminal.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MCommServer* VTProtocolFactory::CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL<")));
+ CCommServer* commServer = new (ELeave)CCommServer();
+ CleanupStack::PushL(commServer);
+ CleanupStack::Pop();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL commServer %d>"), commServer));
+ return commServer;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteCommServerL
+// This function allows the application to delete an instance of a comm server
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteCommServerL(MCommServer* aCommServer)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL<")));
+ CCommServer* commServer = static_cast<CCommServer*>(aCommServer);
+ delete aCommServer;
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL>")));
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateUserInputIndication
+// Create instance .
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTUserInput* VTProtocolFactory::CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateUserInputIndication")));
+ if (aUIIType == EVtUiiDTMF)
+ {
+ CVTUserInputDtmf* uii = CVTUserInputDtmf::NewL(aTone);
+ return uii;
+ }
+ else if (aUIIType == EVtUiiAlphaNumeric)
+ {
+ CVTUserInputAlphanumeric* uii = CVTUserInputAlphanumeric::NewL(aTone);
+ return uii;
+ }
+ else
+ {
+ return NULL;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteUserInputIndication
+// Delete instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteUserInputIndication(MVTUserInput* aUII)
+ {
+ delete aUII;
+ }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::GetAudioConfigCommandL
+// Get one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtAudioConfigCommand* VTProtocolFactory::GetAudioConfigCommandL(MVTAudioSink* aAudioSink)
+ {
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL<")));
+ CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aAudioSink);
+ CAudioConfigCommand* audioConfigCommand = new (ELeave)CAudioConfigCommand();
+ __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL audioConfigCommand %d>"), audioConfigCommand));
+ return audioConfigCommand;
+ }
+
+// end of file
Binary file vtuis/lcvtapp/cenrep/keys_s60videotelephony.xls has changed
Binary file vtuis/lcvtapp/conf/s60videotelephony.confml has changed
Binary file vtuis/lcvtapp/conf/s60videotelephony_102072D0.crml has changed
Binary file vtuis/lcvtapp/conf/s60videotelephony_10281872.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/data/videotelui_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videotelui"}, (0x101F8681), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videotelui.exe"
+""-"z:\resource\apps\videotelui.rsc"
+""-"z:\private\10003a3f\import\apps\videotelui_reg.rsc"
\ No newline at end of file
Binary file vtuis/lcvtapp/data/videotelui_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/inc/VideoTelephonyInternalCRKeys.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* 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: Video Telephony internal Central Repository keys
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYINTERNALCRKEYS_H
+#define VIDEOTELEPHONYINTERNALCRKEYS_H
+
+#include <e32std.h>
+
+/**
+* Video Telephony Variation API
+* Keys under this category are used in defining video telephony variation.
+*/
+const TUid KCRUidVTVariation = {0x102072D0};
+
+/**
+* Video Telephony Local Variation Flags. Values are defined in
+* VideoTelephonyVariant.hrh.
+*/
+const TUint32 KVTLocalVariationFlags = 0x00000001;
+
+/**
+* Video Telephony Configuration API
+* Keys under this category are used for configuring video call behaviour.
+* @since S60 3.1
+*/
+const TUid KCRUidVTConfiguration = {0x10281872};
+
+/**
+* This key controls minimum, normal and maximum frame rate for video encoder.
+* Integer values in the string are between 0 and 31 separated by space.
+* Example for key value is "5 10 5".
+*/
+const TUint32 KVTVideoFrameRates = 0x00000001;
+
+/**
+* Defines layout (screen orientation) used by Video Telephone application
+* per active camera. Each camera has one of the following configurations:
+* 1) "LS" = Landscape
+* 2) "PR" = Portrait
+* 3) "OL" = Obey device layout (normal operation)
+* Camera values are:
+* 1) "C1" = VT primary camera (inwards)
+* 2) "C2" = VT secondary camera (outwards)
+* Example value (portrait for cam1, landscape for cam2): C1:PR C2:LS
+*/
+const TUint32 KVTCameraLayout = 0x00000002;
+
+/**
+* Lists implementation UIDs for MPEG4, H.263 and H.264 encoders for video
+* telephony in hexadecimal separated by space
+*/
+const TUint32 KVTVideoEncoderUIDs = 0x00000003;
+
+/**
+* Lists implementation UIDs for MPEG4, H.263 and H.264 decoders for video
+* telephony in hexadecimal separated by space
+*/
+const TUint32 KVTVideoDecoderUIDs = 0x00000004;
+
+/**
+* Lists implementation UIDs for AMR-NB and future audio encoders for video
+* telephony (in hex, separated by space)
+*/
+const TUint32 KVTAudioEncoderUIDs = 0x00000005;
+
+/**
+* Lists implementation UIDs for AMR-NB and future audio decoders for video
+* telephony (in hex, separated by space)
+*/
+const TUint32 KVTAudioDecoderUIDs = 0x00000006;
+
+/**
+* Lists processing delay for MPEG4, H.263 and H.264 encoders for video
+* telephony in unsigned 32-bit integers separated by space
+*/
+const TUint32 KVTVideoEncoderDelay = 0x00000007;
+
+/**
+* Lists processing delay for MPEG4, H.263 and H.264 decoders for video
+* telephony in unsigned 32-bit integers separated by space
+*/
+const TUint32 KVTVideoDecoderDelay = 0x00000008;
+
+/**
+* Lists processing delay for AMR-NB and future audio encoders for video
+* telephony (in unsigned 32-bit integers, separated by space)
+*/
+const TUint32 KVTAudioEncoderDelay = 0x00000009;
+
+/**
+* Lists processing delay for AMR-NB and future audio decoders for video
+* telephony (in unsigned 32-bit integers, separated by space)
+*/
+const TUint32 KVTAudioDecoderDelay = 0x0000000A;
+
+/*
+* Defines number of toolbar buttons. Three buttons is minimum
+* and seven is maximum.
+*/
+const TUint32 KVTToolbarCommands = 0x0000000B;
+
+#endif // VIDEOTELEPHONYINTERNALCRKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/inc/VideoTelephonyVariant.hrh Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* 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: Bit flag definitions for VT local variation.
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYVARIANT_HRH
+#define VIDEOTELEPHONYVARIANT_HRH
+
+
+/**
+* KVTLVFlagScalingMethodENearest defines whether the video image is
+* scaled using Nearest algorithm, which is fast, but quality is low.
+* When the flag is set ENearest is used.
+* @since S60 v2.8
+*/
+#define KVTLVFlagScalingMethodENearest 0x00000001
+
+/**
+* KVTLVFlagScalingMethodEBilinear defines whether the video image is
+* scaled using Bilinear algorithm, which offers the best quality, but in a
+* slow way. When the flag is set Bilinear is used.
+* @since S60 v2.8
+*/
+#define KVTLVFlagScalingMethodEBilinear 0x00000002
+
+/**
+* KVTLVFlagEnableBitReversal defines if bit order should be
+* reversed in PV.
+* When the flag is set bit order is reversed.
+*/
+#define KVTLVFlagEnableBitReversal 0x00000004
+
+/**
+* KVTLVFlagEnableAMR_WB defines if AMR wideband is supported in video calls.
+* @since S60 v5.0
+*/
+#define KVTLVFlagEnableAMR_WB 0x00000008
+
+/**
+* KVTLVFlagSupportMpeg4 defines whether the PV should support Mepg4.
+* @since S60 v5.0
+*/
+#define KVTLVFlagDisableMpeg4 0x00000010
+
+#endif // VIDEOTELEPHONYVARIANT_HRH
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/lcapplication.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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:
+*
+*/
+//USER
+#include "lcapplication.h"
+#include "cvtlogger.h"
+
+LcHbApplication* LcHbApplication::self = 0;
+
+// -----------------------------------------------------------------------------
+// LcHbApplication::LcHbApplication
+// -----------------------------------------------------------------------------
+//
+LcHbApplication::LcHbApplication(int &argc, char *argv[]) :
+ HbApplication(argc, argv)
+{
+ __VTPRINT( DEBUG_GEN, "LcHbApplication::LcHbApplication()");
+ self = this;
+}
+
+// -----------------------------------------------------------------------------
+// LcHbApplication::~LcHbApplication
+// -----------------------------------------------------------------------------
+//
+LcHbApplication::~LcHbApplication()
+{
+ self = 0;
+}
+
+// -----------------------------------------------------------------------------
+// LcHbApplication::quit
+// -----------------------------------------------------------------------------
+//
+void LcHbApplication::quit()
+{
+ __VTPRINT( DEBUG_GEN, "LcHbApplication::quit()");
+ if (self) {
+ emit self->handleQuit();
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/lcapplication.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:
+*
+*/
+#ifndef LCAPPLICATION_H
+#define LCAPPLICATION_H
+
+#include <hbapplication.h>
+
+class LcHbApplication : public HbApplication
+{
+Q_OBJECT
+public:
+
+ LcHbApplication(int &argc, char *argv[]);
+ ~LcHbApplication();
+
+signals:
+
+ void handleQuit();
+
+public slots:
+
+ //from QCoreApplication
+ static void quit();
+
+private: //data
+
+ static LcHbApplication* self;
+};
+
+#endif //LCAPPLICATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/lcvtapp.pro Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 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:
+#
+#
+
+TEMPLATE = app
+TARGET = videotelui
+CONFIG += hb
+TRANSLATIONS = video_telephone.ts
+
+INCLUDEPATH += ../../inc
+# Input
+HEADERS += lcapplication.h
+SOURCES += lcapplication.cpp main.cpp
+
+symbian: {
+
+ :BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+ :BLD_INF_RULES.prj_exports += "./rom/videotelui.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videotelui.iby)"
+ :BLD_INF_RULES.prj_exports += "./rom/videoteluiResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(videoteluiResources.iby)"
+ :BLD_INF_RULES.prj_exports += "./conf/s60videotelephony.confml APP_LAYER_CONFML(s60videotelephony.confml)"
+ :BLD_INF_RULES.prj_exports += "./conf/s60videotelephony_102072D0.crml APP_LAYER_CRML(s60videotelephony_102072D0.crml)"
+ :BLD_INF_RULES.prj_exports += "./conf/s60videotelephony_10281872.crml APP_LAYER_CRML(s60videotelephony_10281872.crml)"
+ :BLD_INF_RULES.prj_exports += "./inc/VideoTelephonyVariant.hrh |../../inc/videotelephonyvariant.hrh"
+ :BLD_INF_RULES.prj_exports += "./inc/VideoTelephonyInternalCRKeys.h |../../inc/videotelephonyinternalcrkeys.h"
+ :BLD_INF_RULES.prj_exports += "./data/videotelui_stub.sis /epoc32/data/z/system/install/videotelui_stub.sis"
+
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0x101F8681
+ TARGET.VID = 0x101FB657
+ TARGET.CAPABILITY = CAP_APPLICATION NetworkControl SwEvent Location MultimediaDD CommDD
+ LIBS += -llivecommsui -lvtlogger -lapgrfx -lcone
+ RSS_RULES += "hidden = KAppIsHidden;"
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/main.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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:
+*
+*/
+//SYSTEM
+#include <lcviewmanager.h>
+#include <QLocale>
+#include <QTranslator>
+#include <eikenv.h>
+#include <apgwgnam.h>
+
+//USER
+#include "cvtlogger.h"
+#include "lcapplication.h"
+
+
+int main(int argc, char *argv[])
+{
+ LcHbApplication app(argc, argv);
+ CVtLogger::Initialize(); // Cannot do before app creation as activescheduler is installed at that stage
+ __VTPRINT2(CVtLogger::ELogToFile, "videotelui.exe::main entered: argc=%d ",argc);
+ if (argc > 0)
+ {
+ QString arg1Str(QString::fromUtf8(argv[0]));
+ TPtrC arg1(arg1Str.utf16());
+ CVtLogger::Print(CVtLogger::ELogToFile,arg1);
+ }
+
+ //Load application-specific translator
+ QString lang = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ QTranslator translator;
+ if ( translator.load( path + "video_telephone_" + lang + ".qm") ){
+ app.installTranslator(&translator);
+ } else {
+ __VTPRINT( DEBUG_GEN, "videotelui.exe::main, couldn't load translation" );
+ }
+
+ // Temporarily set VT as system app as otherwise GOOM memory releasing will shut
+ // down the process when running low on graphics mem.
+ CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(CEikonEnv::Static()->WsSession());
+ wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down
+ wgName->SetCaptionL(_L("Videotelephony"));
+ wgName->SetAppUid(TUid::Uid(0x101F8681));
+ wgName->SetWindowGroupName(CEikonEnv::Static()->RootWin());
+ CleanupStack::PopAndDestroy();
+
+ QString engineName("Videotelephony");
+ QString applicationName("Video Telephone");
+
+ LcViewManager viewManager(engineName,applicationName);
+
+ QObject::connect( &app, SIGNAL( handleQuit() ),
+ &viewManager, SLOT( terminateSession() ),
+ Qt::QueuedConnection );
+
+ int err = app.exec();
+ __VTPRINT2(CVtLogger::ELogToFile, "videotelui.exe::main returns %d ",err);
+ CVtLogger::Uninitialize();
+ return err;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/rom/videotelui.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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: IBY file
+ *
+*/
+
+
+#ifndef __VIDEOTELUI_IBY__
+#define __VIDEOTELUI_IBY__
+
+REM Video Telephone application
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+file=ABI_DIR\urel\videotelui.exe PROGRAMS_DIR\videotelui.exe
+data=DATAZ_\private\10003a3f\import\apps\videotelui_reg.rsc \private\10003a3f\import\apps\videotelui_reg.rsc
+
+// Enabler for eclipsing ROM binaries
+data=ZSYSTEM\install\videotelui_stub.sis system\install\videotelui_stub.sis
+
+#endif // __CS_VIDEO_TELEPHONY
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtapp/rom/videoteluiResources.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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: IBY file
+ *
+*/
+
+
+#ifndef __VIDEOTELUI_RESOURCES_IBY__
+#define __VIDEOTELUI_RESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef __CS_VIDEO_TELEPHONY
+data=DATAZ_\APP_RESOURCE_DIR\videotelui.rsc APP_RESOURCE_DIR\videotelui.rsc
+data=DATAZ_\QT_TRANSLATIONS_DIR\video_telephone.qm QT_TRANSLATIONS_DIR\video_telephone.qm
+#endif // __CS_VIDEO_TELEPHONY
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/data/F0112235.rss Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* ==============================================================================
+* Name : F0112234.rss
+* Part of :
+* Description :
+* Version :
+*
+* Copyright © 2004 Nokia Corporation.
+* This material, including documentation and any related
+* computer programs, is protected by copyright controlled by
+* Nokia Corporation. All rights are reserved. Copying,
+* including reproducing, storing, adapting or translating, any
+* or all of this material requires the prior written consent of
+* Nokia Corporation. This material also contains confidential
+* information which may not be disclosed to others without the
+* prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+#include "registryinfov2.rh"
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ // UID for the DLL
+ dll_uid = 0xF0112235;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x20021340;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x20021342;
+ version_no = 1;
+ default_data = "Videotelephony";
+ rom_only = 0;
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/data/lcvtplugin.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,16 @@
+; Languages
+;
+&EN
+
+; Header
+#{"lcvtplugin patch"}, (0xF0112235), 1, 0, 0, TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\udeb\lcvtengineplugin.dll" - "!:\sys\bin\lcvtengineplugin.dll"
+"\epoc32\data\Z\Resource\Plugins\lcvtengineplugin.RSC"-"!:\resource\plugins\lcvtengineplugin.RSC"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/data/lcvtplugin_stub.pkg Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,30 @@
+;
+; Copyright (c) 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:
+;
+; Languages
+&EN
+
+; Header
+#{"lcvtplugin"}, (0xF0112235), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"Z:\sys\bin\lcvtengineplugin.dll"
+""-"Z:\resource\plugins\lcvtengineplugin.RSC"
\ No newline at end of file
Binary file vtuis/lcvtplugin/data/lcvtplugin_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/group/bld.inf Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,9 @@
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+// Export IBY files
+../rom/lcvt.iby CORE_APP_LAYER_IBY_EXPORT_PATH(lcvt.iby)
+../data/lcvtplugin_stub.sis /epoc32/data/z/system/install/lcvtplugin_stub.sis
+
+PRJ_MMPFILES
+lcvt.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/group/lcvt.mmp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* ==============================================================================
+* Name : lcvt.mmp
+* Part of :
+* Description :
+* Version :
+*
+* Copyright © 2006 Nokia Corporation.
+* This material, including documentation and any related
+* computer programs, is protected by copyright controlled by
+* Nokia Corporation. All rights are reserved. Copying,
+* including reproducing, storing, adapting or translating, any
+* or all of this material requires the prior written consent of
+* Nokia Corporation. This material also contains confidential
+* information which may not be disclosed to others without the
+* prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// Vendor ID assignment.
+VENDORID VID_DEFAULT
+
+TARGET lcvtengineplugin.dll
+TARGETTYPE PLUGIN
+
+EPOCALLOWDLLDATA
+
+UID 0x10009D8D 0xF0112235
+
+USERINCLUDE ../inc/base
+USERINCLUDE ../inc/common
+USERINCLUDE ../inc/control
+USERINCLUDE ../inc/states
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+
+SOURCEPATH ../src/base
+SOURCE dllmain.cpp clcvtengine.cpp clcvtsession.cpp clcvtcmdexecutor.cpp clcvtactiveexec.cpp clcvtappshutter.cpp
+
+SOURCEPATH ../src/common
+SOURCE lcvtutility.cpp tlcvtstates.cpp tlcvtaudiostate.cpp tlcvtmediastate.cpp
+
+SOURCEPATH ../src/control
+SOURCE tlcvtcamerahandler.cpp clcvtlocalvideoplayer.cpp clcvtremotevideoplayer.cpp clcvtvideoplayerbase.cpp
+
+SOURCEPATH ../src/states
+SOURCE tlcvtstatebase.cpp tlcvtstatestarting.cpp tlcvtstaterunning.cpp tlcvtstateresetting.cpp
+
+
+SOURCEPATH ../data
+START RESOURCE F0112235.rss
+TARGET lcvtengineplugin.rsc
+END
+
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY flogger.lib
+LIBRARY centralrepository.lib
+LIBRARY featmgr.lib
+LIBRARY ws32.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY fbscli.lib
+LIBRARY gdi.lib
+
+LIBRARY eikcore.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcoctl.lib
+LIBRARY apgrfx.lib
+LIBRARY eikdlg.lib
+LIBRARY bitgdi.lib
+LIBRARY egul.lib
+
+LIBRARY aknlayout.lib
+LIBRARY aknlayout2.lib
+LIBRARY avkon.lib
+LIBRARY aknskins.lib
+LIBRARY aknnotify.lib
+
+
+LIBRARY videoteleng.lib
+DEBUGLIBRARY vtlogger.lib
+
+LIBRARY phoneclient.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/clcvtactiveexec.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,169 @@
+/*
+* 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: Asynchronous execution class for LC VT plugin.
+*
+*/
+
+
+
+#ifndef CLCVTACTIVEEXEC_H
+#define CLCVTACTIVEEXEC_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CLcVtActiveExec;
+
+// CLASS DECLARATION
+
+/**
+* Interface for asynchronous execution.
+*
+* @since Series 60 2.6
+*/
+class MLcVtActiveExec
+ {
+ public: // New functions
+
+ /**
+ * Starts execution of a command.
+ * @param aActiveExec active executor.
+ * @param aState state based on which execution can be started.
+ * @param aNextState next state.
+ * @param aRequest request status, which should be used if operation is
+ * asynchronous.
+ * @return ETrue if operation was synchronous, otherwise EFalse.
+ */
+ virtual TBool ActiveExecExecuteL(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aState,
+ TInt& aNextState,
+ TRequestStatus& aRequest ) = 0;
+
+ /**
+ * Decide whether to continue or not.
+ * @param aActiveExec active executor.
+ * @param aState current state, should be updated to new state.
+ * @param aError error code.
+ * @return ETrue if continued, EFalse if stopped.
+ */
+ virtual TBool ActiveExecContinue(
+ CLcVtActiveExec& aActiveExec,
+ TInt& aState,
+ const TInt aError ) = 0;
+
+ /**
+ * Cancels operation of specific state.
+ * @param aActiveExec active executor.
+ * @param aState state.
+ */
+ virtual void ActiveExecCancel(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aState ) = 0;
+
+ /**
+ * Informs that operation has been finished.
+ * @param aActiveExec active executor.
+ * @param aInitialState initial state.
+ */
+ virtual void ActiveExecDone(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aInitialState ) = 0;
+
+ };
+
+/**
+* Asynchronous execution class for LC VT plugin.
+*
+* @since Series 60 2.6
+*/
+class CLcVtActiveExec
+ : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ * @param aPriority priority of the active object.
+ */
+ CLcVtActiveExec(
+ const TInt aPriority );
+
+ /**
+ * Destructor.
+ */
+ ~CLcVtActiveExec();
+
+ public: // New functions
+
+ /**
+ * Starts execution.
+ * @param aStartState initial state.
+ * @param aExec executor.
+ */
+ void Start(
+ TInt aStartState,
+ MLcVtActiveExec& aExec );
+
+ /**
+ * Initial state of currently
+ * active operation.
+ *
+ * @return initial state, or KErrNotFound if no operation ongoing.
+ */
+ TInt InitialState() const;
+
+ /**
+ * Returns request status.
+ * @return request status.
+ */
+ TInt RequestStatus() const;
+
+ protected: // Functions from base classes
+
+ /**
+ * @see CActive::RunL.
+ */
+ virtual void RunL();
+
+ /**
+ * @see CActive::DoCancel.
+ */
+ virtual void DoCancel();
+
+ /**
+ * @see CActive::RunError.
+ */
+ virtual TInt RunError( TInt aError );
+
+ private:
+
+ // Ref to active executor.
+ MLcVtActiveExec* iActiveExec;
+
+ // Initial state.
+ TInt iInitialState;
+
+ // Current state.
+ TInt iCurrentState;
+
+ // Next state.
+ TInt iNextState;
+
+ };
+
+#endif // CLCVTACTIVEEXEC_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/clcvtappshutter.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* 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: Class responsible for application exit.
+*
+*/
+
+
+#ifndef C_VTUIAPPSHUTTER_H
+#define C_VTUIAPPSHUTTER_H
+
+#include <babitflags.h>
+
+#include <mphcltemergencycallobserver.h>
+#include <cphcltemergencycall.h>
+#include <rphcltserver.h>
+
+class CAsyncCallBack;
+class MLcVtShutterObserver;
+class MLcVtStateContext;
+
+/**
+* Shutdown service for the application. This is singleton
+* which deletes itself when shutdown is complete.
+*
+* @since S60 v3.2
+*/
+class CLcVtAppShutter : public CBase
+ {
+public:
+
+ /**
+ * Returns the instance of application shutter.
+ *
+ * @param aComms for sending call ending related commands to Phone.
+ * @param aObserver observer informed when shutdown is completed.
+ * @return the application shutter
+ */
+ static CLcVtAppShutter* InstanceL(
+ MLcVtShutterObserver& aObserver );
+
+ /**
+ * Starts shutdown.
+ */
+ void StartShutdown();
+
+ /**
+ * Starts shutdown because emergency call was requested by the user.
+ * If supplied number is detected other than emergency number this method
+ * leaves KErrArgument.
+ * @param aStateContext for accessing emergency number and local
+ * variation.
+ */
+ void ShutdownWithEmergencyCallL( MLcVtStateContext& aStateContext );
+
+ /**
+ * Callback from emergency caller.
+ */
+ void EmergencyCallDoneL();
+
+private:
+
+ /**
+ * Exits the application if no pending shutdown preparation
+ * is ongoing. Deletes itself as last action.
+ */
+ void ShutdownIfReadyAndDestroy();
+
+
+ /**
+ * Enques async callback.
+ */
+ void EnqueCallbackL( TCallBack& aCallback );
+
+ /**
+ * Asynch callback handling response to emergency call creation.
+ */
+ static TInt EmergencyResponseCallback( TAny* aAny );
+
+ /** C++ constructor */
+ CLcVtAppShutter( MLcVtShutterObserver& aObserver );
+
+ /** destructor */
+ ~CLcVtAppShutter();
+
+private: // for making shutdown with emergency call
+ class CEmergencyCaller : public CBase, private MPhCltEmergencyCallObserver
+ {
+ public:
+ /**
+ * Dials emergency call. Object destroys itself when
+ * response is received.
+ */
+ static CEmergencyCaller* DialEmergencyL(
+ CLcVtAppShutter& aObserver,
+ MLcVtStateContext& aStateContext );
+
+ // Destructor
+ ~CEmergencyCaller();
+
+ private: // C++ constructor
+
+ CEmergencyCaller(
+ CLcVtAppShutter& aObserver,
+ MLcVtStateContext& aStateContext );
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+ public: // from MPhCltEmergencyCallObserver
+ /**
+ * @see MPhCltEmergencyCallObserver::HandleEmergencyDialL
+ */
+ virtual void HandleEmergencyDialL( const TInt aStatus );
+
+ private: // Data
+
+ // Emergency number
+ TPhCltTelephoneNumber iNumber;
+
+ // Phone Server session
+ RPhCltServer iServer;
+
+ // Emergency call handler
+ CPhCltEmergencyCall* iEmergency;
+
+ // Observer for callback
+ CLcVtAppShutter& iObserver;
+
+ // State context for gettin entered numbers and local variation
+ MLcVtStateContext& iStateContext;
+ };
+private: // Data
+
+ /**
+ * Guard flags for completing shutdown.
+ * All must be cleared before shutdown
+ * can be completed.
+ */
+ enum TShutterFlags
+ {
+ /** Waiting for call on StartShutdown() */
+ EShutterWaitingStart,
+ /** Waiting for callback on emegency call request */
+ EShutterWaitingEmergencyCallback,
+ };
+
+ // Asynch callback
+ CAsyncCallBack* iCallback;
+
+ // guard flags
+ TBitFlags8 iPendingStateFlags;
+
+ // Observer to notify when application exit
+ // is allowed.
+ MLcVtShutterObserver& iObserver;
+
+ // Handles emergency call dialling
+ CEmergencyCaller* iEmergencyCaller;
+
+ };
+
+#endif // C_VTUIAPPSHUTTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/clcvtcmdexecutor.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* 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: Class for command execution for Video Telephone application.
+*
+*/
+
+#ifndef CLCVTCMDEXECUTOR_H_
+#define CLCVTCMDEXECUTOR_H_
+
+// INCLUDES
+#include <e32base.h>
+#include <mvtengcommandobserver.h>
+
+// FORWARD DECLARATIONS
+class MVtEngCommandHandler;
+class MLcVtEngineCommandManager;
+
+// CLASS DECLARATION
+
+/**
+* Class for command execution for Video Telephone application.
+*
+* @since Series 60 2.6
+*/
+class CLcVtCmdExecutor
+ : public CBase,
+ private MVtEngCommandObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ *
+ * @param aSelfPtr optional pointer to itself.
+ * @param aCommandHandler command handler.
+ * @param aCommandManager command manager.
+ */
+ CLcVtCmdExecutor(
+ CLcVtCmdExecutor** aSelfPtr,
+ MVtEngCommandHandler& aCommandHandler,
+ MLcVtEngineCommandManager& aCommandManager );
+
+ /**
+ * Destructor.
+ */
+ ~CLcVtCmdExecutor();
+
+ public: // New functions
+
+ /**
+ * Executes command.
+ * @param aCommandId command identifier.
+ * @param aParams parameters.
+ * @param aRequest request status, optional.
+ */
+ void ExecuteCmdL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* aParams,
+ TRequestStatus* aRequest );
+
+ /**
+ * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+ */
+ virtual void HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError );
+
+ protected: // New functions
+
+ /**
+ * Completes dialog with error.
+ * Note: this method will delete the dialog.
+ * @param aError error code.
+ */
+ void Complete( const TInt aError );
+
+ private:
+ /**
+ * Handles execution failure.
+ * @param aResult error code.
+ */
+ void HandleExecuteFailed( TInt aResult );
+
+ private:
+
+ // Inner class.
+ class CActiveCmd;
+
+ // Friend.
+ friend class CActiveCmd;
+
+ //pointer to itself
+ CLcVtCmdExecutor** iSelfPtr;
+
+ // Error code.
+ TInt* iError;
+
+ // Request status.
+ TRequestStatus* iRequest;
+
+ // Ref to command handler.
+ MVtEngCommandHandler& iCommandHandler;
+
+ // Ref to command manager.
+ MLcVtEngineCommandManager& iCommandManager;
+
+ // Command to be executed.
+ TVtEngCommandId iCommand;
+
+ // Owned parameters.
+ HBufC8* iCommandParams;
+
+ // ETrue if command has been completed.
+ TBool iCommandCompleted;
+
+ // Owned active object to perform the command.
+ CActiveCmd* iActiveCmd;
+
+ // ActiveSheduler Waiter inside CLcVtCmdExecutor
+ CActiveSchedulerWait iWait;
+
+ };
+
+
+
+#endif /* CLCVTCMDEXECUTOR_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/clcvtengine.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* 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: LiveComm Videotelephony Plugin Class
+*
+*/
+
+#ifndef CLCVTENGINE_H
+#define CLCVTENGINE_H
+
+#include <e32base.h>
+#include <lcengine.h>
+
+class CLcVtSession;
+class MLcSessionObserver;
+class MLcUiProvider;
+class MLcSession;
+
+class CLcVtEngine : public CLcEngine
+ {
+public:
+
+ /**
+ * Static constructor
+ *
+ * @param aParams ECom instantiation parameters
+ * @return An initialized instance of this class.
+ */
+ static CLcVtEngine* NewL( TAny* aParams );
+
+ ~CLcVtEngine();
+
+public: // From CLcEngine
+
+ MLcSession& Session();
+
+ TBool IsFeatureSupported( TLcFeature aLcFeature );
+
+private:
+ void ConstructL();
+ CLcVtEngine();
+
+private:
+
+ CLcVtSession* iSession;
+
+ };
+
+#endif // CLCVTENGINE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/clcvtsession.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,569 @@
+/*
+* ==========================================================================
+* Name : lcvtsession.h
+* Description :
+* Version :
+*
+* Copyright ?2005 Nokia Corporation.
+* This material, including documentation and any related
+* computer programs, is protected by copyright controlled by
+* Nokia Corporation. All rights are reserved. Copying,
+* including reproducing, storing, adapting or translating, any
+* or all of this material requires the prior written consent of
+* Nokia Corporation. This material also contains confidential
+* information which may not be disclosed to others without the
+* prior written consent of Nokia Corporation.
+* ==========================================================================
+*/
+
+#ifndef LCVTSESSION_H
+#define LCVTSESSION_H
+
+#include <e32base.h>
+#include <w32std.h>
+#include <f32file.h>
+#include <e32property.h>
+#include <UikonInternalPSKeys.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+#include <AknQueryDialog.h>
+#include <gdi.h>
+
+#include <lcsession.h>
+#include <lcaudiocontrol.h>
+#include <lcsessionobserver.h>
+#include <lcuiprovider.h>
+#include <lcengine.h>
+
+#include <cvtlogger.h>
+#include <mvtengeventobserver.h>
+#include <mvtengcommandobserver.h>
+#include <mvtengcommandhandler.h>
+#include <mvtengframeobserver.h>
+#include <mvtengaudio.h>
+#include <mvtengsessioninfo.h>
+#include <vtengevents.h>
+#include <mvtengmedia.h>
+
+#include <tvtengrendering.h>
+#include <tvtengrenderingdp.h>
+#include <tvtengrenderingnga.h>
+#include <tvtengrenderingdsa.h>
+
+
+#include "tlcvtcamerahandler.h"
+#include "clcvtactiveexec.h"
+#include "tlcvtstatebase.h"
+
+#define NGA_VIDEO_RENDER
+
+class CVtEngModel;
+class CLcVtLocalVideoPlayer;
+class CLcVtRemoteVideoPlayer;
+class TLcVtStates;
+class CLcVtCmdExecutor;
+
+
+class CLcVtSession : public CBase,
+ public MLcSession,
+ public MLcAudioControl,
+ public MLcVtActiveExec,
+ public MLcVtStateContext
+ {
+public:
+
+ static CLcVtSession* NewL();
+
+ ~CLcVtSession();
+
+public: // From MLcSession
+
+ TLcSessionState LcSessionState() const;
+
+ void EstablishLcSessionL();
+
+ void TerminateLcSessionL();
+
+ void SetLcSessionObserver( MLcSessionObserver* aObserver );
+
+ void SetLcUiProvider( MLcUiProvider* aUiProvider );
+
+ TBool IsBackgroundStartup();
+
+ MLcVideoPlayer* RemoteVideoPlayer();
+
+ MLcVideoPlayer* LocalVideoPlayer();
+
+ const TDesC& LocalDisplayName();
+
+ const TDesC& RemoteDisplayName();
+
+ TInt SetParameter( TInt aId, TInt aValue );
+
+ TInt ParameterValue( TInt aId );
+
+ TInt SetForegroundStatus( TBool aIsForeground );
+
+ const TDesC& RemoteDetails();
+
+ void UpdateLcSessionL();
+
+ TBool SendDialTone( TChar aKey );
+
+public: // from MLcAudioControl
+
+ TBool IsLcAudioMutedL();
+
+ void MuteLcAudioL( TBool aMute );
+
+ TBool IsLcMicMutedL();
+
+ void MuteLcMicL( TBool aMute );
+
+ TBool IsEnablingLcLoudspeakerAllowed();
+
+ void EnableLcLoudspeakerL( TBool aEnabled );
+
+ TBool IsLcLoudspeakerEnabled();
+
+ TInt LcVolumeL();
+
+ void SetLcVolumeL( TInt aValue );
+
+ void IncreaseLcVolumeL();
+
+ void DecreaseLcVolumeL();
+
+public: //from MLcVtActiveExec
+ /**
+ * @see MLcVtActiveExec::ActiveExecExecuteL.
+ */
+ TBool ActiveExecExecuteL(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aState,
+ TInt& aNextState,
+ TRequestStatus& aRequest );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecContinue.
+ */
+ TBool ActiveExecContinue(
+ CLcVtActiveExec& aActiveExec,
+ TInt& aState,
+ const TInt aError );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecCancel.
+ */
+ void ActiveExecCancel(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aState );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecDone.
+ */
+ virtual void ActiveExecDone(
+ CLcVtActiveExec& aActiveExec,
+ const TInt aInitialState );
+
+public: //new function
+ /**
+ * @see MLcVtActiveExec::ActiveExecExecuteL.
+ */
+ TBool ActiveExecInitExecuteL(
+ const TInt aState,
+ TInt& aNextState,
+ TRequestStatus& aRequest );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecContinue.
+ */
+ TBool ActiveExecInitContinue(
+ TInt& aState,
+ const TInt aError );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecCancel.
+ */
+ void ActiveExecInitCancel(
+ const TInt aState );
+
+ /**
+ * @see MLcVtActiveExec::ActiveExecDone.
+ */
+ void ActiveExecInitDone(
+ const TInt aInitialState );
+
+ /**
+ * Executes command taking no parameters.
+ * @param aCommand command to be performed.
+ * @param aRequest request status.
+ */
+ void ActiveExecInitExecuteCommandL(
+ const TVtEngCommandId aCommand,
+ TRequestStatus& aRequest );
+
+ /**
+ * Executes command taking no parameters.
+ * @param aCommand command to be performed.
+ * @param aParam command parameters.
+ * @param aRequest request status.
+ */
+ template < class T >
+ void ActiveExecInitExecuteCommandL(
+ const TVtEngCommandId aCommand,
+ T& aParam,
+ TRequestStatus& aRequest );
+
+ /**
+ * Executes prepare viewfinder command.
+ * @param aRequest request status to be completed when finished.
+ */
+ void ActiveExecInitPrepareViewFinderL(
+ TRequestStatus& aRequest );
+
+ /**
+ * Executes prepare remote render command.
+ * @param aRequest request status to be completed when finished.
+ */
+ void ActiveExecInitPrepareRemoteRenderL(
+ TRequestStatus& aRequest );
+
+ /**
+ * Executes 'prepare camera' command.
+ * @param aSource source to be prepared.
+ * @param aRequest request status.
+ */
+ void ActiveExecInitPrepareCameraL(
+ const MVtEngMedia::TMediaSource aSource,
+ TRequestStatus& aRequest );
+
+ /**
+ * Executes 'set source' command.
+ * @param aSource source to be selected.
+ * @param aRequest request status.
+ */
+ void ActiveExecInitSetSourceL(
+ const MVtEngMedia::TMediaSource aSource,
+ TRequestStatus& aRequest );
+
+ /**
+ * Performs a command without any parameters.
+ * @param aCommand command to be performed.
+ */
+ void ExecuteCmdL( const TVtEngCommandId aCommand );
+
+ /**
+ * Performs a command with a parameter.
+ * @param aCommmand command to be performed.
+ * @param aParam parameter.
+ */
+ template< class T >
+ void ExecuteCmdL(
+ const TVtEngCommandId aCommand,
+ T& aParam );
+
+ // ASYNCHRONOUS EXECUTION:
+
+ /**
+ * Performs a command without any parameters.
+ * @param aExecutorPtr pointer to which returned value is stored.
+ * @param aCommand command to be performed.
+ * @param aStatus request status.
+ * @return dialog.
+ */
+ CLcVtCmdExecutor* ExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aExecutorPtr,
+ const TVtEngCommandId aCommand,
+ TRequestStatus& aStatus );
+
+ /**
+ * Performs a command with a parameter.
+ * @param aExecutorPtr pointer to which returned value is stored.
+ * @param aCommmand command to be performed.
+ * @param aParam parameter.
+ * @param aStatus request status.
+ * @return dialog.
+ */
+ template< class T >
+ CLcVtCmdExecutor* ExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aExecutorPtr,
+ const TVtEngCommandId aCommand,
+ T& aParam,
+ TRequestStatus& aStatus );
+
+ /**
+ * Performs a command.
+ * @param aExecutorPtr pointer to which returned value is stored.
+ * @param aCommand command.
+ * @param aParams parameter, optional.
+ * @param aStatus request status.
+ * @return dialog.
+ */
+ CLcVtCmdExecutor* DoExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aExecutorPtr,
+ const TVtEngCommandId aCommand,
+ TDesC8* aParams,
+ TRequestStatus& aStatus );
+
+ /**
+ * Executes command in TRAP harnness.
+ * @param aCommand command identifier.
+ * @param aParam optional, parameters.
+ * @return error code.
+ */
+ TInt Execute( const TVtEngCommandId aCommand, TDesC8* aParam );
+
+ /**
+ * Handles layout changes basically calling HandleLayoutChangedL
+ * in trap harness.
+ * @return error code.
+ */
+ //TInt HandleLayoutChanged();
+
+ /**
+ * Handles layout changes.
+ */
+ void HandleLayoutChangedL();
+
+public: //from MLcVtStateContext
+
+ /** @see MLcVtStateContext::StartupPhase1L */
+ void StartupPhase1L();
+
+ /** @see MLcVtStateContext::ShutdownL */
+ void ShutdownL();
+
+ /** @see MLcVtStateContext::StartupPhase2L */
+ void StartupPhase2L();
+
+ /** @see MLcVtStateContext::ChangeApplicationFocus */
+ void ChangeApplicationFocus( const TBool aForeground );
+
+ /** @see MLcVtStateContext::ChangeState */
+ void ChangeState( TLcVtStateBase* aState );
+
+ /** @see MLcVtStateContext::StartTone */
+ //void StartDtmfTone( const TChar& aTone );
+
+ /** @see MLcVtStateContext::StopTone */
+ //void StopDtmfTone();
+
+ /** @see MLcVtStateContext::Model */
+ CVtEngModel& Model();
+
+ /** @see MLcVtStateContext::NumberSource*/
+ TDesC* NumberSource() const;
+
+ /** @see MLcVtStateContext::RefreshL */
+ void RefreshL( const TInt aRefreshFlags );
+
+ /** @see MLcVtStateContext::RefreshStatesL */
+ void RefreshStatesL();
+
+ /** @see MLcVtStateContext::DoExecuteCmdL */
+ void DoExecuteCmdL(
+ const TVtEngCommandId aCommand,
+ TDesC8* aParams );
+
+ /** @see MLcVtStateContext::DoHandleLayoutChangedL */
+ void DoHandleLayoutChangedL();
+
+ /** From MLcVtShutterObserver via MLcVtStateContext
+ * Exits the application.
+ */
+ void HandleShutdownReady();
+
+ /** @see MLcVtStateContext::SetCallIdL */
+ void SetCallIdL( const TInt aCallId );
+
+ /** @see MLcVtStateContext::SetCallNameL */
+ TBool SetCallNameL( const TDesC& aName );
+
+ /** @see MLcVtStateContext::SetCallNumberL */
+ void SetCallNumberL( const TDesC& aNumber );
+
+ /** @see MLcVtStateContext::StartShutdown */
+ void StartShutdown();
+
+public: //new functions
+
+ /**
+ * Static async callback for handling layout change.
+ */
+ //static TInt DelayedHandleLayoutChanged( TAny* aPtr );
+
+ /**
+ * Callback function to exit.
+ * @param aAny pointer to instance of this class.
+ * @return KErrNone always.
+ */
+ static TInt DoExit( TAny* aAny );
+
+ /**
+ * Close UI Application.
+ */
+ void CloseApp();
+
+ /**
+ * Handles engine reset.
+ */
+ void HandleEngineResetL();
+
+ /**
+ * Handle plugin command.
+ */
+ void HandleCommandL(const TInt acommand);
+
+ /**
+ * Sets given zoom step, if it allowed.
+ * @param aZoomStep New zoom step to be set.
+ */
+ void SetZoomFactorL( TInt aZoomStep );
+
+ /**
+ * Updates rendering parameters.
+ */
+ void UpdateRenderingParametersL();
+
+ inline TLcVtStates& LcVtStates();
+
+#ifndef NGA_VIDEO_RENDER
+ void vtHandleFrameL( CFbsBitmap* aBitmap );
+#endif
+ TBool IsFeatureSupported( CLcEngine::TLcFeature aLcFeature );
+
+
+private:
+ CLcVtSession();
+
+ void ConstructL();
+
+#ifndef NGA_VIDEO_RENDER
+ /**
+ * connect to font & bitmap server.
+ */
+ void ConnectFbsServerL();
+
+ /**
+ * disconnect from font & bitmap server.
+ */
+ void DisconnectFbsServer();
+#endif
+
+ // COMMAND HANDLING
+
+ /**
+ * Enables audio (unmute microphone).
+ */
+ void CmdEnableAudioL();
+
+ /**
+ * Disables audio (mute microphone).
+ */
+ void CmdDisableAudioL();
+
+ /**
+ * Switches used camera.
+ * @param aPrimaryCamera ETrue if primary camera is to be selected,
+ * EFalse if secondary camera is to be selected.
+ */
+ void CmdUseCameraL( const TBool aPrimaryCamera );
+
+ /**
+ * Activates loudspeaker.
+ */
+ void CmdActivateLoudspeakerL();
+
+ /**
+ * Deactivates loudspeaker.
+ */
+ void CmdDeactivateLoudspeakerL();
+
+ /**
+ * Enables video.
+ */
+ void CmdEnableVideoL();
+
+ /**
+ * Disables video.
+ */
+ void CmdDisableVideoL();
+
+#ifdef NGA_VIDEO_RENDER
+ void CreateVideoWindowsL();
+ void DestroyVideoWindows();
+#endif
+
+private:
+ class CEventObserver;
+
+private:
+#ifdef NGA_VIDEO_RENDER
+ RWindow* iRemoteVideoWindow;
+ RWindow* iLocalVideoWindow;
+#else
+ CFbsBitmap* iDummy;
+ CWindowGc* iGc;
+ TBool iFbsStarted;
+ RWsSession* iWsSession;
+ CWsScreenDevice* iWsSessionScreenDev;
+ RWindowGroup *iRootWin;
+#endif
+ // Owned event observer.
+ CEventObserver* iEventObserver;
+ // Engine model.
+ CVtEngModel* iModel;
+ // plugin states (media, audio, boolean variables)
+ TLcVtStates* iLcVtStates;
+
+ TVtCameraHandler iCameraHandler;
+ CLcVtLocalVideoPlayer* iLocalVideoPlayer;
+ CLcVtRemoteVideoPlayer* iRemoteVideoPlayer;
+
+ MLcSessionObserver* iObserver;
+ MLcUiProvider* iUiProvider;
+
+ TLcSessionState iSessionState;
+
+ // Owned active executor for initialisation / uninitialisation.
+ CLcVtActiveExec* iActiveExec;
+
+ CLcVtCmdExecutor* iCmdExecutor;
+
+ // Reference to request status.
+ TRequestStatus* iShutdownRequest;
+
+ TLcVtStateBase* iState;
+
+ // ASync callback.
+ CAsyncCallBack* iAsyncCallback;
+
+ // Async callback for layout change
+ //CAsyncCallBack* iLayoutChangeCallback;
+
+ // DTMF tone, used as parameter to KVtEngStartDtmfTone.
+ TPckgBuf< TChar > iDtmfTone;
+
+ TBool iLoudspeakerEnabled;
+ TBool iMute;
+
+ RWindow* iMainWindow;
+
+ RWsSession iRwSession;
+ RWindowGroup* iRwGroup;
+ CWsScreenDevice* iDev;
+
+ HBufC* iRemoteDisplayName;
+ HBufC* iRemoteDetails;
+
+ };
+
+
+TLcVtStates& CLcVtSession::LcVtStates()
+ {
+ return *iLcVtStates;
+ }
+#endif // LCVTSESSION_H
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/lcvtplugincommand.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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: Plguin command
+*
+*/
+
+#ifndef LCVTPLUGINCOMMAND_H_
+#define LCVTPLUGINCOMMAND_H_
+
+enum
+ {
+ // End active call
+ EPluginCmdEndActiveCall = 5000,
+ // Switch to voice call
+ EPluginCmdCreateVoice,
+ // Create a emergency call
+ EPluginCmdDialEmergency,
+ // Enable video
+ EPluginCmdEnableVideo,
+ // Enable audio
+ EPluginCmdEnableAudio,
+ // Disable video
+ EPluginCmdDisableVideo,
+ // Disable audio
+ EPluginCmdDisableAudio,
+ // Use primary camera
+ EPluginCmdUsePrimaryCamera,
+ // Use secondary camera
+ EPluginCmdUseSecondaryCamera,
+ // Active Loudspeaker
+ EPluginCmdActivateLoudspeaker,
+ // Deactive Loudspeaker
+ EPluginCmdDeactivateLoudspeaker
+ };
+
+
+#endif /* LCVTPLUGINCOMMAND_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/mlcvtenginecommandmanager.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,43 @@
+/*
+ * mlcvtenginecommandmanager.h
+ *
+ * Created on: Jun 29, 2009
+ * Author: z51wang
+ */
+
+#ifndef M_LCVTENGINECOMMANDMANAGER_H
+#define M_LCVTENGINECOMMANDMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MVtEngCommandObserver;
+
+// CLASS DECLARATION
+
+/**
+* Command manager class for Video Telephone application.
+*
+* @since Series 60 2.6
+*/
+class MLcVtEngineCommandManager
+ {
+ public: // New functions
+
+ /**
+ * Adds observer.
+ * @param aObserver observer to be added.
+ */
+ virtual void AddObserverL( MVtEngCommandObserver& aObserver ) = 0;
+
+ /**
+ * Removes observer.
+ * @param aObserver observer to be removed.
+ */
+ virtual void RemoveObserver( MVtEngCommandObserver& aObserver ) = 0;
+
+ };
+
+
+#endif /* M_LCVTENGINECOMMANDMANAGER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/mlcvtshutterobserver.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* 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: Interface for reporting application shutdown readiness.
+*
+*/
+
+
+#ifndef M_MLCVTSHUTTEROBSERVER_H
+#define M_MLCVTSHUTTEROBSERVER_H
+
+
+/**
+* Observer interface for reporting shutdown readiness.
+*
+* @since S60 v3.2
+*/
+class MLcVtShutterObserver
+ {
+public:
+
+ /**
+ * Called when application can exit.
+ */
+ virtual void HandleShutdownReady() = 0;
+ };
+
+#endif // M_MLCVTSHUTTEROBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/base/mlcvtstatecontext.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* 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: Interface for state objects to request application services.
+*
+*/
+
+
+#ifndef M_MLCVTSTATECONTEXT_H
+#define M_MLCVTSTATECONTEXT_H
+
+#include <e32def.h>
+#include <vtengcommands.h>
+#include "mlcvtshutterobserver.h"
+
+class TLcVtStateBase;
+class CVtEngModel;
+
+/**
+* Provides service interface for vt plugin state objects.
+*
+* @since S60 v3.2
+*/
+class MLcVtStateContext : public MLcVtShutterObserver
+ {
+ public:
+
+ /**
+ * Starts first phase of startup when prepare is received.
+ */
+ virtual void StartupPhase1L() = 0;
+
+ /**
+ * Starts application shutdown.
+ */
+ virtual void ShutdownL() = 0;
+
+ /**
+ * Starts second phase of startup.
+ */
+ virtual void StartupPhase2L() = 0;
+
+ /**
+ * Sets application to foreground and background.
+ * @param aForeground ETrue => foreground, EFalse => background
+ */
+ virtual void ChangeApplicationFocus( const TBool aForeground ) = 0;
+
+ /**
+ * Changes current application state.
+ * @param aState new state
+ */
+ virtual void ChangeState( TLcVtStateBase* aState ) = 0;
+
+ /**
+ * Starts DTMF tone.
+ * @param aTone DTMF tone.
+ */
+ //virtual void StartDtmfTone( const TChar& aTone ) = 0;
+
+ /**
+ * Stops tarts DTMF tone.
+ */
+ //virtual void StopDtmfTone() = 0;
+
+ /**
+ * Returns model.
+ * @return model
+ */
+ virtual CVtEngModel& Model() = 0;
+
+ /**
+ * Returns source containing numbers typed by the user.
+ * @return number soure
+ */
+ virtual TDesC* NumberSource() const = 0;
+
+ /**
+ * Executes engine command.
+ * @param aCommand command id
+ * @param aParams command params
+ */
+ virtual void DoExecuteCmdL( const TVtEngCommandId aCommand,
+ TDesC8* aParams ) = 0;
+
+ /**
+ * Refreshes application UI.
+ * @param aRefreshFlags identifies what to refresh
+ */
+ virtual void RefreshL( const TInt aRefreshFlags ) = 0;
+
+ /**
+ * Updates engine states.
+ */
+ virtual void RefreshStatesL() = 0;
+
+ /**
+ * Handles layout change.
+ */
+ //virtual void DoHandleLayoutChangedL() = 0;
+
+ /**
+ * Sets call id.
+ */
+ virtual void SetCallIdL( const TInt aCallId ) = 0;
+
+ /**
+ * Sets display text of remote end.
+ */
+ virtual TBool SetCallNameL( const TDesC& aName ) = 0;
+
+ /**
+ * Sets call number text of remote end.
+ */
+ virtual void SetCallNumberL( const TDesC& aNumber ) = 0;
+
+ /**
+ * Start shutdown process
+ */
+ virtual void StartShutdown() = 0;
+
+
+ /**
+ * Refresh flags
+ */
+ enum TRefreshFlags
+ {
+ /** Navipane is refreshed */
+ ENaviPane = 0x01,
+ /** Softkeys are refreshed */
+ ESoftkeys = 0x02,
+ /** Refreshes blind (video availability) status */
+ EBlind = 0x04,
+ /** Refreshes state sync with call handling */
+ ESynchronise = 0x08,
+ /** Refreshes internal states (media etc) */
+ EUiStates = 0x10,
+ /** Refreshes everything */
+ EAll = ENaviPane |
+ ESoftkeys |
+ EBlind |
+ ESynchronise |
+ EUiStates
+ };
+ };
+
+
+#endif // M_MLCVTSTATECONTEXT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/lcvtutility.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* 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: Utility methods for Video Telephone application.
+*
+*/
+
+
+
+#ifndef LCVTUTILITY_H
+#define LCVTUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mvtengaudio.h>
+#include <mvtengmedia.h>
+#include <w32std.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Utility methods for Video Telephone application.
+*
+* @since Series 60 2.6
+*/
+class LcVtUtility
+ {
+ public: // New functions
+
+ /**
+ * Enumerates audio routing masks.
+ */
+ enum TAudioRoutingMask
+ {
+ // Deactivate loudspeaker.
+ EDeactivateLoudspeaker = (1<<0),
+ // Activate loudspeaker.
+ EActivateLoudspeaker = (1<<1),
+ // Deactivate BT handsfree.
+ EDeactivateBtHandsfree = (1<<2),
+ // Activate BT handsfree.
+ EActivateBtHandsfree = (1<<3)
+ };
+
+ /**
+ * Gets audio routing availabilities.
+ * @param aAudio audio instance.
+ * @param aAvailable availability bitmap.
+ */
+ static void GetAudioRoutingAvailability(
+ MVtEngAudio& aAudio,
+ TInt& aAvailable );
+
+ /**
+ * Gets outgoing media state.
+ * @param aMedia media instance.
+ * @param aAvailable availability bitmap.
+ */
+ static void GetOutgoingMediaState(
+ MVtEngMedia& aMedia,
+ TInt& aAvailable );
+
+ /**
+ * Gets incoming media state.
+ * @param aMedia media instance.
+ * @param aAvailable availability bitmap.
+ */
+ static void GetIncomingMediaState(
+ MVtEngMedia& aMedia,
+ TInt& aAvailable );
+
+ /**
+ * Checks if media has still image.
+ * @param aMedia media instance.
+ * @return ETrue if media has still image.
+ */
+ static TBool HasStillImage(
+ MVtEngMedia& aMedia );
+
+ /**
+ * Gets freeze's current status.
+ * @param aMedia media instance.
+ * @return ETrue if active provider is frozen, EFalse otherwise.
+ */
+ static TBool GetFreezeState(
+ MVtEngMedia& aMedia );
+
+ /**
+ * Checks if freeze is supported.
+ * @param aMedia media instance.
+ * @return ETrue if freeze is supported.
+ */
+ static TBool IsFreezeSupported(
+ MVtEngMedia& aMedia );
+
+ /**
+ * Gets current local video quality setting.
+ * @param aMedia media instance.
+ * @param aVideoQuality Current local video quality settings.
+ */
+ static void GetVideoQuality(
+ MVtEngMedia& aMedia,
+ MVtEngMedia::TVideoQuality& aVideoQuality );
+ /**
+ * Gets current object sharing state.
+ * @param aMedia media instance.
+ * @param aShareObjectState contains current object sharing state on
+ * return.
+ */
+ static void GetObjectSharingState( MVtEngMedia& aMedia,
+ MVtEngMedia::TShareObjectState& aShareObjectState );
+
+ /**
+ * Checks if zooming is allowed.
+ * @param aMedia media instance.
+ * @return ETrue if allowed, EFalse otherwise.
+ */
+ static TBool IsZoomAllowed(
+ MVtEngMedia& aMedia );
+
+ /**
+ * Checks if the device has cameras currently attached.
+ * @param aMedia media instance.
+ * @return ETrue if there are cameras available.
+ */
+ static TBool HasCameras( MVtEngMedia& aMedia );
+
+ /**
+ * Checks if the character is DTMF enabled.
+ * @param aChar The character.
+ * @return ETrue if this character is DTMF character.
+ */
+ static TBool IsDTMFCharacter( const TChar aChar );
+
+ private:
+
+ /**
+ * Checks if audio routing is available.
+ * @param aAudio audio instance.
+ * @param aCurrent current speaker.
+ * @param aSource source speaker.
+ * @param aTarget target speaker.
+ */
+ static TBool IsAudioRoutingAvailable(
+ MVtEngAudio& aAudio,
+ const MVtEngAudio::TAudioRoutingState aCurrent,
+ const MVtEngAudio::TAudioRoutingState aSource,
+ const MVtEngAudio::TAudioRoutingState aTarget );
+
+ };
+
+#endif // LCVTUTILITY_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtaudiostate.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* 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: Audio state class definition.
+*
+*/
+
+
+#ifndef T_LCVTAUDIOSTATE_H
+#define T_LCVTAUDIOSTATE_H
+
+#include <e32base.h>
+
+#include "tlcvtflagcontainer.h"
+
+class CVtEngModel;
+
+/**
+ * TLcVtAudioState
+ *
+ * Contains status information about video telephony audio.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TLcVtAudioState ) : public TLcVtUpdateableFlagContainer
+ {
+public:
+
+ /**
+ * Constructor
+ *
+ * @param aModel Reference to VT engine model.
+ */
+ inline TLcVtAudioState( CVtEngModel& aModel );
+
+ /**
+ * Return whether audio is enabled or not.
+ *
+ * @return ETrue if audio is enabled EFalse otherwise.
+ */
+ inline TBool IsAudio() const;
+
+ /**
+ * Return whether BT handsfree can be activated or not.
+ *
+ * @return ETrue if BT handsfree can be activated EFalse otherwise.
+ */
+ inline TBool CanActivateBtHf() const;
+
+ /**
+ * Return whether BT handsfree can be deactivated or not.
+ *
+ * @return ETrue if BT handsfree can be deactivated EFalse otherwise.
+ */
+ inline TBool CanDeactivateBtHf() const;
+
+ /**
+ * Return whether loudspeaker can be activated or not.
+ *
+ * @return ETrue if loudpseaker can be activated EFalse otherwise.
+ */
+ inline TBool CanActivateLoudspeaker() const;
+
+ /**
+ * Return whether loudspeaker can be deactivated or not.
+ *
+ * @return ETrue if loudspeaker can be deactivated EFalse otherwise.
+ */
+ inline TBool CanDeactivateLoudspeaker() const;
+
+ /**
+ * Return whether or not audio is permanently stopped.
+ *
+ * @return ETrue if audio is permanently stopped.
+ */
+ inline TBool IsAudioPermanentlyStopped() const;
+
+private: // from TVtUpdateableFlagContainer
+
+ /**
+ * @see TVtUpdateableFlagContainer::UpdateFlags
+ */
+ void UpdateFlags();
+
+private:
+
+ // Enumeration for audio state flags.
+ enum TFlags
+ {
+ /** Is set if audio is currently enabled. */
+ EIsAudio = ( 1<<0 ),
+ /** Is set if BT handsfree can be activated. */
+ ECanActivateBtHf = ( 1<<1 ),
+ /** Is set if BT handsfree can be deactivated. */
+ ECanDeactivateBtHf = ( 1<<2 ),
+ /** Is set if loudspeaker can be activated. */
+ ECanActivateLoudspeaker = ( 1<<3 ),
+ /** Is set if loudspeaker can be deactivated. */
+ ECanDeactivateLoudspeaker = ( 1<<4 ),
+ /** Set if audio is permanently stopped */
+ EIsAudioPermanentlyStopped = ( 1<<5 )
+ };
+
+ // Reference to engine model instance
+ CVtEngModel& iModel;
+
+ };
+
+#include "tlcvtaudiostate.inl"
+
+#endif // T_LCVTAUDIOSTATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtaudiostate.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* 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: Audio state class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::TLcVtAudioState
+// -----------------------------------------------------------------------------
+//
+TLcVtAudioState::TLcVtAudioState( CVtEngModel& aModel )
+: iModel( aModel )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::IsAudio
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::IsAudio() const
+ {
+ return IsFlag( EIsAudio );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::CanActivateBtHf
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::CanActivateBtHf() const
+ {
+ return IsFlag( ECanActivateBtHf );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::CanDeactivateBtHf
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::CanDeactivateBtHf() const
+ {
+ return IsFlag( ECanDeactivateBtHf );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::CanActivateLoudspeaker
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::CanActivateLoudspeaker() const
+ {
+ return IsFlag( ECanActivateLoudspeaker );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::CanDeactivateLoudspeaker
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::CanDeactivateLoudspeaker() const
+ {
+ return IsFlag( ECanDeactivateLoudspeaker );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::IsAudioPermanentlyStopped
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtAudioState::IsAudioPermanentlyStopped() const
+ {
+ return IsFlag( EIsAudioPermanentlyStopped );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtflagcontainer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,108 @@
+/*
+* 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: Flag container class definition.
+*
+*/
+
+
+#ifndef T_LCVTFLAGCONTAINER_H
+#define T_LCVTFLAGCONTAINER_H
+
+#include <e32base.h>
+
+/**
+ * TLcVtFlagContainer
+ *
+ * Flag container is a class that holds maximum of 32 different flags. Also
+ * contains methods for setting, clearing and getting the flag state.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TLcVtFlagContainer )
+ {
+public:
+
+ /**
+ * Constructor.
+ */
+ inline TLcVtFlagContainer();
+
+protected:
+
+ /**
+ * Clears all flags.
+ */
+ inline void Clear();
+
+ /**
+ * Tests flag.
+ */
+ inline TBool IsFlag( TUint32 aFlags ) const;
+
+ /**
+ * Sets flag(s).
+ */
+ inline void SetFlag( TUint32 aFlags );
+
+ /**
+ * Clears flag(s).
+ */
+ inline void ClearFlag( TUint32 aFlags );
+
+ /**
+ * Gets flag value.
+ */
+ inline TUint32 Value() const;
+
+ /**
+ * Sets flag value.
+ */
+ inline void SetValue( TUint32 aValue );
+
+private:
+
+ // Current flags
+ TUint32 iFlags;
+
+ };
+
+/**
+ * TLcVtUpdateableFlagContainer
+ *
+ * A flag container with Update() method that can be called to get
+ * flags updated in one pass.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TLcVtUpdateableFlagContainer ) : public TLcVtFlagContainer
+ {
+public:
+
+ /**
+ * Issues flag updation.
+ */
+ inline void Update();
+
+private:
+
+ /**
+ * Called when flags needs to be updated (as a result to call Update()).
+ */
+ virtual void UpdateFlags() = 0;
+
+ };
+
+#include "tlcvtflagcontainer.inl"
+
+#endif // T_LCVTFLAGCONTAINER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtflagcontainer.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* 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: Flag container class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::TLcVtFlagContainer
+// -----------------------------------------------------------------------------
+//
+TLcVtFlagContainer::TLcVtFlagContainer()
+ {
+ Clear();
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::Clear
+// -----------------------------------------------------------------------------
+//
+void TLcVtFlagContainer::Clear()
+ {
+ iFlags = 0;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::IsFlag
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtFlagContainer::IsFlag( TUint32 aFlags ) const
+ {
+ return ( iFlags & aFlags );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::SetFlag
+// -----------------------------------------------------------------------------
+//
+void TLcVtFlagContainer::SetFlag( TUint32 aFlags )
+ {
+ iFlags |= aFlags;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::ClearFlag
+// -----------------------------------------------------------------------------
+//
+void TLcVtFlagContainer::ClearFlag( TUint32 aFlags )
+ {
+ iFlags &= ~aFlags;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::Value
+// -----------------------------------------------------------------------------
+//
+TUint32 TLcVtFlagContainer::Value() const
+ {
+ return iFlags;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtFlagContainer::SetValue
+// -----------------------------------------------------------------------------
+//
+void TLcVtFlagContainer::SetValue( TUint32 aValue )
+ {
+ iFlags = aValue;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtUpdateableFlagContainer::Update
+// -----------------------------------------------------------------------------
+//
+void TLcVtUpdateableFlagContainer::Update()
+ {
+ Clear();
+ UpdateFlags();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtmediastate.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,216 @@
+/*
+* 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: Media state class definition.
+*
+*/
+
+
+#ifndef T_LCVTMEDIASTATE_H
+#define T_LCVTMEDIASTATE_H
+
+#include <e32base.h>
+
+#include "tlcvtflagcontainer.h"
+
+class MVtEngMedia;
+class MVtEngCommandHandler;
+
+/**
+ * TLcVtMediaState
+ *
+ * Contains information about media's (video) current status.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TLcVtMediaState ) : public TLcVtUpdateableFlagContainer
+ {
+public:
+
+ /**
+ * Constructor.
+ *
+ * @param aMedia Reference to VT engine media object.
+ * @param aCommandHandler Reference to command handler object.
+ */
+ inline TLcVtMediaState( MVtEngMedia& aMedia,
+ MVtEngCommandHandler& aCommandHandler );
+
+ /**
+ * Return whether or not video is being sent.
+ *
+ * @return ETrue if video is being sent.
+ */
+ inline TBool IsVideo() const;
+
+ /**
+ * Return whether or not any camera is available in device.
+ *
+ * @return ETrue if any camera is available in device.
+ */
+ inline TBool HasCamera() const;
+
+ /**
+ * Return whether or not freeze is supported for active video source.
+ *
+ * @return ETrue if freeze is supported for active video source.
+ */
+ inline TBool IsFreezeSupported() const;
+
+ /**
+ * Return whether or not active video source is frozen.
+ *
+ * @return ETrue if video is frozen.
+ */
+ inline TBool IsFrozen() const;
+
+ /**
+ * Return whether or not share is active.
+ *
+ * @return ETrue if still image is being shared.
+ */
+ inline TBool IsSharing() const;
+
+ /**
+ * Return whether or not sharing is being initialized.
+ *
+ * @return ETrue if still image sharing is being initialized.
+ */
+ inline TBool IsInitializingShare() const;
+
+ /**
+ * Return whether or not primary camera is being used by VT.
+ *
+ * @return ETrue if primary camera is being used.
+ */
+ inline TBool IsPrimaryCameraInUse() const;
+
+ /**
+ * Return whether or not secondary camera is being used by VT.
+ *
+ * @return ETrue if secondary camera is being used.
+ */
+ inline TBool IsSecondaryCameraInUse() const;
+
+ /**
+ * Return whether or not it is possible to share.
+ *
+ * @return ETrue if sharing is not allowed.
+ */
+ inline TBool IsNotAbleToShare() const;
+
+ /**
+ * Return whether or not device has primary camera.
+ *
+ * @return ETrue if primary camera is available.
+ */
+ inline TBool HasPrimaryCamera() const;
+
+ /**
+ * Return whether or not device has secondary camera.
+ *
+ * @return ETrue if secondary camera is available.
+ */
+ inline TBool HasSecondaryCamera() const;
+
+ /**
+ * Return whether or not active video source supports contrast setting.
+ *
+ * @return ETrue if contrast settingis allowed.
+ */
+ inline TBool IsContrastSupported() const;
+
+ /**
+ * Return whether or not active video source supports white balance setting.
+ *
+ * @return ETrue if white balance setting is allowed.
+ */
+ inline TBool IsWhiteBalanceSupported() const;
+
+ /**
+ * Return whether or not active video source supports color tone setting.
+ *
+ * @return ETrue if colour tone setting is allowed.
+ */
+ inline TBool IsColorToneSupported() const;
+
+ /**
+ * Return whether or not active video source supports brightness setting.
+ *
+ * @return ETrue if brightness setting is allowed.
+ */
+ inline TBool IsBrightnessSupported() const;
+
+ /**
+ * Return whether or not video is permanently stopped.
+ *
+ * @return ETrue if video is permanently stopped.
+ */
+ inline TBool IsVideoPermanentlyStopped() const;
+
+private: // from TVtUpdateableFlagContainer
+
+ /**
+ * @see TVtUpdateableFlagContainer::UpdateFlags
+ */
+ void UpdateFlags();
+
+private:
+
+ // Enumeration for media state flags.
+ enum TFlags
+ {
+ /** Set if video is currently enabled. */
+ EIsVideo = ( 1<<0 ),
+ /** Set if device has any cameras */
+ EHasCamera = ( 1<<1 ),
+ /** Set if current active video source supports freezing */
+ EIsFreezeSupported = ( 1<<2 ),
+ /** Set if current active video source is frozen */
+ EIsFrozen = ( 1<<3 ),
+ /** Set if sharing is active */
+ EIsSharing = ( 1<<4 ),
+ /** Set if sharing is being initialized */
+ EIsInitializingShare = ( 1<<5 ),
+ /** Set if device's primary camera is being used by VT application */
+ EIsPrimaryCameraInUse = ( 1<<6 ),
+ /** Set if device's secondary camera is being used by VT application */
+ EIsSecondaryCameraInUse = ( 1<<7 ),
+ /** Set if it is not possible to share */
+ EIsNotAbleToShare = ( 1<<8 ),
+ /** Set if device has primary camera */
+ EHasPrimaryCamera = ( 1<<9 ),
+ /** Set if device has secondary camera */
+ EHasSecondaryCamera = ( 1<<10 ),
+ /** Set if current video source supports contrast setting */
+ EIsContrastSupported = ( 1<<11 ),
+ /** Set if current video source supports white balance setting */
+ EIsWhiteBalanceSupported = ( 1<<12 ),
+ /** Set if current video source supports color tone setting */
+ EIsColorToneSupported = ( 1<<13 ),
+ /** Set if current video source supports brightness setting */
+ EIsBrightnessSupported = ( 1<<14 ),
+ /** Set if video is permanently stopped*/
+ EIsVideoPermanentlyStopped = ( 1<<15 )
+ };
+
+ // Reference to engine media instance.
+ MVtEngMedia& iMedia;
+
+ // Reference to engine command handler instance.
+ MVtEngCommandHandler& iCommandHandler;
+ };
+
+#include "tlcvtmediastate.inl"
+
+#endif // T_LCVTMEDIASTATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtmediastate.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,171 @@
+/*
+* 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: Media state class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::TLcVtMediaState
+// -----------------------------------------------------------------------------
+//
+TLcVtMediaState::TLcVtMediaState( MVtEngMedia& aMedia,
+ MVtEngCommandHandler& aCommandHandler )
+ : iMedia( aMedia ), iCommandHandler( aCommandHandler )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsVideo
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsVideo() const
+ {
+ return IsFlag( EIsVideo );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::HasCamera
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::HasCamera() const
+ {
+ return IsFlag( EHasCamera );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsFreezeSupported
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsFreezeSupported() const
+ {
+ return IsFlag( EIsFreezeSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsFrozen() const
+ {
+ return IsFlag( EIsFrozen );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsSharing
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsSharing() const
+ {
+ return IsFlag( EIsSharing );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsInitializingShare
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsInitializingShare() const
+ {
+ return IsFlag( EIsInitializingShare );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsPrimaryCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsPrimaryCameraInUse() const
+ {
+ return IsFlag( EIsPrimaryCameraInUse );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsSecondaryCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsSecondaryCameraInUse() const
+ {
+ return IsFlag( EIsSecondaryCameraInUse );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsNotAbleToShare
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsNotAbleToShare() const
+ {
+ return IsFlag( EIsNotAbleToShare );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::HasPrimaryCamera
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::HasPrimaryCamera() const
+ {
+ return IsFlag( EHasPrimaryCamera );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::HasSecondaryCamera
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::HasSecondaryCamera() const
+ {
+ return IsFlag( EHasSecondaryCamera );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsContrastSupported
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsContrastSupported() const
+ {
+ return IsFlag( EIsContrastSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsWhiteBalanceSupported
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsWhiteBalanceSupported() const
+ {
+ return IsFlag( EIsWhiteBalanceSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsColorToneSupported
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsColorToneSupported() const
+ {
+ return IsFlag( EIsColorToneSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsBrightnessSupported
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsBrightnessSupported() const
+ {
+ return IsFlag( EIsBrightnessSupported );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::IsVideoPermanentlyStopped
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtMediaState::IsVideoPermanentlyStopped() const
+ {
+ return IsFlag( EIsVideoPermanentlyStopped );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtstates.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,333 @@
+/*
+* 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: LC VT states class definition.
+*
+*/
+
+
+#ifndef T_LCVTSTATES_H
+#define T_LCVTSTATES_H
+
+#include <e32base.h>
+
+#include "tlcvtmediastate.h"
+#include "tlcvtaudiostate.h"
+
+class CVtEngModel;
+class MVtEngCameraPreferences;
+
+/**
+ * TLcVtStates
+ *
+ * Contains information about Application UI's current status.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TLcVtStates ) : public TLcVtFlagContainer
+ {
+
+public: // enumerations
+
+ /**
+ * Lc VT plugin execution state (will be set by the plugin state classes)
+ */
+ enum TLcVtExecState
+ {
+ EExecStateStarting,
+ EExecStateRunning,
+ EExecStateResetting,
+ EExecStateFinalized
+ };
+
+public:
+
+ /**
+ * Constructor.
+ */
+ TLcVtStates( CVtEngModel& aModel );
+
+ /**
+ * Updates UI states.
+ */
+ void Update();
+
+ /**
+ * Return whether or not ColorToneSetting
+ * is supported by current camera.
+ *
+ * @return ETrue if at least one color tone setting is available,
+ * EFalse otherwise.
+ */
+ TBool IsColorToneSettingAvailable() const;
+
+ /**
+ * Return whether or not WhiteBalanceSetting
+ * is supported by current camera.
+ *
+ * @return ETrue if at least one white balance setting is available,
+ * EFalse otherwise.
+ */
+ TBool IsWhiteBalanceSettingAvailable() const;
+
+ /**
+ * Return whether or not ontrast setting
+ * is supported by current camera.
+ *
+ * @return ETrue if at contrast setting is available,
+ * EFalse otherwise.
+ */
+ TBool IsContrastSettingAvailable() const;
+
+ /**
+ * Return whether or not brightness setting
+ * is supported by current camera.
+ *
+ * @return ETrue if brightness setting is available,
+ * EFalse otherwise.
+ */
+ TBool IsBrightnessSettingAvailable() const;
+
+ /**
+ * Returns reference to media state object
+ *
+ * @return Reference to media state object.
+ */
+ inline const TLcVtMediaState& MediaState() const;
+
+ /**
+ * Returns reference to audio state object
+ *
+ * @return Reference to audio state object.
+ */
+ inline const TLcVtAudioState& AudioState() const;
+
+ /**
+ * Sets or clears EIsCLIReceived
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetCLIReceived( TBool aSet );
+
+ /**
+ * Check if EIsCLIReceived is set
+ *
+ * @return ETrue if EIsCLIReceived is set EFalse otherwise
+ */
+ inline TBool IsCLIReceived() const;
+
+ /**
+ * Sets or clears EIsLayoutChangeNeeded
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetLayoutChangeNeeded( TBool aSet );
+
+ /**
+ * Check if EIsLayoutChangeNeeded is set
+ *
+ * @return ETrue if EIsLayoutChangeNeeded is set EFalse otherwise
+ */
+ inline TBool IsLayoutChangeNeeded() const;
+
+ /**
+ * Sets or clears EIsDeviceLockOn
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetDeviceLockOn( TBool aSet );
+
+ /**
+ * Check if EIsDeviceLockOn is set
+ *
+ * @return ETrue if EIsDeviceLockOn is set EFalse otherwise
+ */
+ inline TBool IsDeviceLockOn() const;
+
+ /**
+ * Sets or clears EDetailsReceived
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetDetailsReceived( TBool aSet );
+
+ /**
+ * Check if EDetailsReceived is set
+ *
+ * @return ETrue if EDetailsReceived is set EFalse otherwise
+ */
+ inline TBool IsDetailsReceived() const;
+
+ /**
+ * Sets or clears EWaitingForFirstFrame
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetWaitingForFirstFrame( TBool aSet );
+
+ /**
+ * Check if EWaitingForFirstFrame is set
+ *
+ * @return ETrue if EWaitingForFirstFrame is set EFalse otherwise
+ */
+ inline TBool IsWaitingForFirstFrame() const;
+
+ /**
+ * Sets or clears EUseSQCif
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetUseSQCif( TBool aSet );
+
+ /**
+ * Check if EUseSQCif is set
+ *
+ * @return ETrue if EUseSQCif is set EFalse otherwise
+ */
+ inline TBool IsUseSQCif() const;
+
+ /**
+ * Sets or clears EIsThisApplicationForeground
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetThisApplicationForeground( TBool aSet );
+
+ /**
+ * Check if EIsThisApplicationForeground is set
+ *
+ * @return ETrue if EIsThisApplicationForeground is set EFalse otherwise
+ */
+ inline TBool IsThisApplicationForeground() const;
+
+ /**
+ * Sets or clears EIsDisableBlindSetting
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetDisableBlindSetting( TBool aSet );
+
+ /**
+ * Check if EIsDisableBlindSetting is set
+ *
+ * @return ETrue if EIsDisableBlindSetting is set EFalse otherwise
+ */
+ inline TBool IsDisableBlindSetting() const;
+
+ /**
+ * Sets or clears EExecShowCameraInUse
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetExecShowCameraInUse( TBool aSet );
+
+ /**
+ * Check if EExecShowCameraInUse is set
+ *
+ * @return ETrue if EExecShowCameraInUse is set EFalse otherwise
+ */
+ inline TBool IsExecShowCameraInUse() const;
+
+ /**
+ * Sets or clears EIsWaitingCall
+ *
+ * @param aSet ETrue if setting will be set, EFalse otherwise.
+ */
+ inline void SetWaitingCall( TBool aSet );
+
+ /**
+ * Check if there is waiting video/voice call.
+ *
+ * @return ETrue if waiting call is ongoing, EFalse otherwise
+ */
+ inline TBool IsWaitingCall() const;
+
+ /**
+ * Returns application's execution state.
+ * @return Application's current execution state.
+ */
+ inline TLcVtExecState ExecState() const;
+
+ /**
+ * Sets application's execution state.
+ * @param aState Application's new execution state.
+ */
+ inline void SetExecState( const TLcVtExecState aState );
+
+private: // methods to be accessed only by certain classes (see friends)
+
+
+
+private:
+
+ // Enumeration for ui state flags.
+ enum TFlags
+ {
+ /** Set if CLI is received */
+ EIsCLIReceived = ( 1<<0 ),
+
+ /** Set if layout change is needed */
+ EIsLayoutChangeNeeded = ( 1<<1 ),
+
+ /** Set if device lock is on */
+ EIsDeviceLockOn = ( 1<<2 ),
+
+ /** Set if details have been received */
+ EDetailsReceived = ( 1<<3 ),
+
+ /** Set if waiting for first frame */
+ EWaitingForFirstFrame = ( 1<<4 ),
+
+ /** Set if SQCIF is being used */
+ EUseSQCif = ( 1 << 5 ),
+
+ /** Set if application on foreground */
+ EIsThisApplicationForeground = ( 1<<6 ),
+
+ /** Set if blind setting should be temporarily disabled.
+ This is used in preventing blind bitmap from flashing
+ while operations involving multiple engine commands/events
+ take place (e.g. 'Swap image places' and layout switch). */
+ EIsDisableBlindSetting = ( 1<<7 ),
+
+ /** Set if camera in use note should be shown. */
+ EExecShowCameraInUse = ( 1<<8 ),
+
+ /** Set if waiting call exists */
+ EIsWaitingCall = ( 1<<9 ),
+ };
+
+ // Engine media state
+ TLcVtMediaState iMediaState;
+
+ // Engine audio state
+ TLcVtAudioState iAudioState;
+
+ // Refrence to engine
+ CVtEngModel& iModel;
+
+ // Refrence to camera prefrences
+ MVtEngCameraPreferences* iCameraPref;
+
+ // Application execution state
+ TLcVtExecState iExecState;
+
+private: // friends
+
+ //friend class TLcVtStateBase;
+
+ };
+
+#include "tlcvtstates.inl"
+
+#endif // T_LCVTSTATES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/common/tlcvtstates.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* 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: LC VT states class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::MediaState
+// -----------------------------------------------------------------------------
+//
+const TLcVtMediaState& TLcVtStates::MediaState() const
+ {
+ return iMediaState;
+ }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::AudioState
+// -----------------------------------------------------------------------------
+//
+const TLcVtAudioState& TLcVtStates::AudioState() const
+ {
+ return iAudioState;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetCLIReceived
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetCLIReceived( TBool aSet )
+ {
+ aSet ? SetFlag( EIsCLIReceived ) : ClearFlag( EIsCLIReceived );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsCLIReceived
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsCLIReceived() const
+ {
+ return IsFlag( EIsCLIReceived );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetLayoutChangeNeeded
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetLayoutChangeNeeded( TBool aSet )
+ {
+ aSet ? SetFlag( EIsLayoutChangeNeeded ) :
+ ClearFlag( EIsLayoutChangeNeeded );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsLayoutChangeNeeded
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsLayoutChangeNeeded() const
+ {
+ return IsFlag( EIsLayoutChangeNeeded );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetDeviceLockOn
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetDeviceLockOn( TBool aSet )
+ {
+ aSet ? SetFlag( EIsDeviceLockOn ) :
+ ClearFlag( EIsDeviceLockOn );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsDeviceLockOn
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsDeviceLockOn() const
+ {
+ return IsFlag( EIsDeviceLockOn );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetDetailsReceived
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetDetailsReceived( TBool aSet )
+ {
+ aSet ? SetFlag( EDetailsReceived ) :
+ ClearFlag( EDetailsReceived );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsDetailsReceived
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsDetailsReceived() const
+ {
+ return IsFlag( EDetailsReceived );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetWaitingForFirstFrame
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetWaitingForFirstFrame( TBool aSet )
+ {
+ aSet ? SetFlag( EWaitingForFirstFrame ) :
+ ClearFlag( EWaitingForFirstFrame );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsWaitingForFirstFrame
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsWaitingForFirstFrame() const
+ {
+ return IsFlag( EWaitingForFirstFrame );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetUseSQCif
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetUseSQCif( TBool aSet )
+ {
+ aSet ? SetFlag( EUseSQCif ) :
+ ClearFlag( EUseSQCif );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsUseSQCif
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsUseSQCif() const
+ {
+ return IsFlag( EUseSQCif );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetThisApplicationForeground
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetThisApplicationForeground( TBool aSet )
+ {
+ aSet ? SetFlag( EIsThisApplicationForeground ) :
+ ClearFlag( EIsThisApplicationForeground );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsThisApplicationForeground
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsThisApplicationForeground() const
+ {
+ return IsFlag( EIsThisApplicationForeground );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetDisableBlindSetting
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetDisableBlindSetting( TBool aSet )
+ {
+ aSet ? SetFlag( EIsDisableBlindSetting ) :
+ ClearFlag( EIsDisableBlindSetting );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsDisableBlindSetting
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsDisableBlindSetting() const
+ {
+ return IsFlag( EIsDisableBlindSetting );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetExecShowCameraInUse
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetExecShowCameraInUse( TBool aSet )
+ {
+ aSet ? SetFlag( EExecShowCameraInUse ) :
+ ClearFlag( EExecShowCameraInUse );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsExecShowCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsExecShowCameraInUse() const
+ {
+ return IsFlag( EExecShowCameraInUse );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates:::SetWaitingCall
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetWaitingCall( TBool aSet )
+ {
+ aSet ? SetFlag( EIsWaitingCall ) :
+ ClearFlag( EIsWaitingCall );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsWaitingCall
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsWaitingCall() const
+ {
+ return IsFlag( EIsWaitingCall );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::SetExecState
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::SetExecState( const TLcVtExecState aState )
+ {
+ iExecState = aState;
+ }
+// -----------------------------------------------------------------------------
+// TLcVtStates::ExecState
+// -----------------------------------------------------------------------------
+//
+TLcVtStates::TLcVtExecState TLcVtStates::ExecState() const
+ {
+ return iExecState;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/control/clcvtlocalvideoplayer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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: LiveComm Videotelephony's Local Video Player
+*
+*/
+#ifndef LCVTLOCALVIDEOPLAYER_H
+#define LCVTLOCALVIDEOPLAYER_H
+
+#include <e32base.h>
+#include "clcvtvideoplayerbase.h"
+
+
+// FORWARD DECLARATIONS
+class CLcVtSession;
+class TVtCameraHandler;
+class MLcWindow;
+class MLcAudioControl;
+
+class CLcVtLocalVideoPlayer : public CLcVtVideoPlayerBase
+ {
+public: // Constructors and destructor
+
+ static CLcVtLocalVideoPlayer* NewL(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl,
+ TVtCameraHandler& aCameraHandler);
+
+ ~CLcVtLocalVideoPlayer();
+
+public: // from CLcVtVideoPlayerBase
+
+ TLcVideoPlayerState LcVideoPlayerState() const;
+
+ TBool LcIsPlayingL();
+
+ void LcPlayL( TLcVideoPlayerSource aSource=ECameraSource );
+
+ void LcPauseL();
+
+ MLcCameraControl* LcCameraControl();
+
+ MLcZoomControl* LcZoomControl();
+
+ MLcBrightnessControl* LcBrightnessControl();
+
+ void SetLcWindowRectL( TRect aRect );
+
+ void SetLcWindowOrientationL(
+ TLcWindowOrientation aOrientation );
+
+public:
+ TBool IsOrientationChanged();
+
+private: // Constructors
+
+ CLcVtLocalVideoPlayer(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl,
+ TVtCameraHandler& aCameraHandler);
+
+ void ConstructL();
+
+private: // Data
+
+ TVtCameraHandler& iCameraHandler;
+ TBool iIsPlaying;
+ TBool iOrientationChanged;
+
+ };
+
+
+#endif //LCVTLOCALVIDEOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/control/clcvtremotevideoplayer.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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: LiveComm Videotelephony's Remte Video Player
+*
+*/
+#ifndef LCVTREMOTEVIDEOPLAYER_H
+#define LCVTREMOTEVIDEOPLAYER_H
+
+#include <e32base.h>
+#include "clcvtvideoplayerbase.h"
+
+class CLcVtRemoteVideoPlayer : public CLcVtVideoPlayerBase
+ {
+public: // Constructors and destructor
+
+ static CLcVtRemoteVideoPlayer* NewL(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl );
+
+
+ ~CLcVtRemoteVideoPlayer();
+
+
+public: // from CLcVtVideoPlayerBase
+
+ TLcVideoPlayerState LcVideoPlayerState() const;
+
+ TBool LcIsPlayingL();
+
+ void SetLcWindowRectL( TRect aRect );
+
+
+private: // Constructors
+
+ CLcVtRemoteVideoPlayer(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl );
+
+ void ConstructL();
+
+private: // Data
+ };
+
+#endif //LCVTREMOTEVIDEOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/control/clcvtvideoplayerbase.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,100 @@
+/*
+* 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: LiveComm Videotelephony's Video Player Base Class
+*
+*/
+
+#ifndef LCVTPLAYERS_H
+#define LCVTPLAYERS_H
+
+#include <e32base.h>
+
+#include <lcvideoplayer.h>
+#include <lcwindow.h>
+#include <lcaudiocontrol.h>
+#include <lcsourcefilecontrol.h>
+#include <lcdestinationfilecontrol.h>
+#include "clcvtsession.h"
+
+
+class CLcVtVideoPlayerBase : public CBase, public MLcVideoPlayer, public MLcWindow
+ {
+
+public: // Constructors and destructor
+
+ ~CLcVtVideoPlayerBase();
+
+public: // from MLcVideoPlayer
+
+ //TLcVideoPlayerState LcVideoPlayerState() const;
+
+ //TBool LcIsPlayingL();
+
+ void LcPlayL( TLcVideoPlayerSource aSource=ECameraSource );
+
+ void LcPauseL();
+
+ MLcWindow* LcWindow();
+
+ MLcCameraControl* LcCameraControl();
+
+ MLcSourceFileControl* LcSourceFileControl();
+
+ MLcDestinationFileControl* LcDestinationFileControl();
+
+ MLcAudioControl* LcAudioControl();
+
+ MLcZoomControl* LcZoomControl();
+
+ MLcBrightnessControl* LcBrightnessControl();
+
+
+public: // from MLcWindow
+
+ void EnableLcWindowL( TBool aEnable );
+
+ TBool IsLcWindowEnabled();
+
+ void SetLcWindowRectL( TRect aRect );
+
+ TRect LcWindowRect();
+
+ void SetLcWindowOrientationL(
+ TLcWindowOrientation aOrientation );
+
+ TLcWindowOrientation LcWindowOrientationL();
+
+protected: // Constructors
+
+ CLcVtVideoPlayerBase(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl );
+
+protected: // Data
+
+ CLcVtSession* ivtSession; // Not owned
+
+ MLcAudioControl& iLcAudioControl;
+
+ TBool iIsWindowEnabled;
+
+ TRect iWindowRect;
+
+ MLcWindow::TLcWindowOrientation iWindowOrientation;
+ };
+
+
+#endif // LCVTPLAYERS_H
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/control/tlcvtcamerahandler.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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: LiveComm Videotelephony's Camera Handler
+*
+*/
+
+#ifndef LCVTCAMERAHANDLER_H
+#define LCVTCAMERAHANDLER_H
+
+#include <lccameracontrol.h>
+#include <lcbrightnesscontrol.h>
+#include <lczoomcontrol.h>
+
+class CLcVtSession;
+
+class TVtCameraHandler :
+ public MLcCameraControl,
+ public MLcBrightnessControl,
+ public MLcZoomControl
+ {
+ public: // From MLcCameraControl
+
+ TInt LcCameraCountL();
+
+ TInt CurrentLcCameraIndex();
+
+ void ToggleLcCameraL();
+
+ public: // From MLcBrightnessControl
+
+ TInt MinLcBrightnessL();
+
+ TInt MaxLcBrightnessL();
+
+ TInt LcBrightnessL();
+
+ void SetLcBrightnessL( TInt aValue );
+
+ void IncreaseLcBrightnessL();
+
+ void DecreaseLcBrightnessL();
+
+ public: // From MLcZoomControl
+
+ TInt MinLcZoomL();
+
+ TInt MaxLcZoomL();
+
+ TInt LcZoomValueL();
+
+ void SetLcZoomValueL( TInt aValue );
+
+ void LcZoomInL();
+
+ void LcZoomOutL();
+
+ public:
+
+ TVtCameraHandler();
+
+ void SetSession( CLcVtSession* aSession );
+
+ private:
+
+ enum TCurrentCamera
+ {
+ ECameraNotAvailable = KErrNotFound,
+ EBackCamera = 0,
+ EFrontCamera = 1
+ };
+
+ private: // Data
+
+ CLcVtSession* ivtSession; // Not owned
+
+ };
+
+#endif //LCVTCAMERAHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/states/tlcvtpluginstates.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,279 @@
+/*
+* 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: Concrete VT plugin state classes
+*
+*/
+
+
+#ifndef T_LCVTPLUGINSTATES_H
+#define T_LCVTPLUGINSTATES_H
+
+#include "tlcvtstatebase.h"
+#include <babitflags.h>
+#include <vtengcommands.h>
+
+
+/**
+* Initial application state. Responsible for startup phase 1 and
+* startup phase 2 (see EVtUiAppUiStartup in CVtUiAppUi.cpp).
+* Certain other state changes are required for phase 2 and history
+* of their reception is handled with precondition flags.
+*
+* @since S60 v3.2
+*/
+class TLcVtStateStarting : public TLcVtStateBase
+ {
+public:
+ /**
+ * returns singleton instance of TLcVtStateStarting
+ * @param aCtx state context
+ * @param aUiStates UI states
+ * @return singleton
+ */
+ static TLcVtStateStarting* InstanceL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates );
+
+public: // from TLcVtStateBase
+
+ /** @see TLcVtStateBase */
+ virtual void LcVtStartupPhase1DoneL();
+
+ /** @see TLcVtStateBase */
+ virtual void LcVtStartupPhase2DoneL();
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+ /** @see TLcVtStateBase */
+ virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+ /** @see TLcVtStateBase */
+ virtual TBool PreHandleForegroundChangedL( TBool aIsForeground );
+
+private: // from TLcVtStateBase
+
+ /** @see TLcVtStateBase */
+ virtual void OpenL();
+
+ /** @see TLcVtStateBase */
+ virtual void Close();
+
+private: // new methods
+
+ void CheckSessionStateL();
+
+ static TInt AsynchOpen( TAny* aAny );
+
+ void DoOpenL();
+
+ /** Preconditions that must be passed in order to proceed
+ * to Phase 2 in startup.
+ */
+ enum TPreconditions
+ {
+ /** waiting for CLI from engine*/
+ EWaitingCLI,
+ /** waiting for phase1 to complete */
+ EWaitingPhase1ToComplete,
+ /** waiting for engine to get proper state */
+ EWaitingSessionState
+ };
+
+ /**
+ * Clears precondition passed as argument and checks if any
+ * preconditions hold and if not proceeds to phase 2 of startup.
+ */
+ void CheckPhase2StartupL( const TPreconditions aClearCondition );
+
+ void HandleCLIReceivedL();
+
+private: // constructors and destructors
+
+ // c++ constructor
+ TLcVtStateStarting(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates );
+
+ // Destructor
+ virtual ~TLcVtStateStarting();
+
+private: // data members
+
+ // Precondition for state change to running
+ TBitFlags8 iPreconditions;
+
+ // Singleton
+ static TLcVtStateStarting* iInstance;
+
+ // Starts phase1 startup in state state context. Needed because
+ // initial state is opened from within state context construction.
+ CAsyncCallBack* iStartCallback;
+ };
+
+/**
+* Application state that is active in normal operation.
+*
+* @since S60 v3.2
+*/
+class TLcVtStateRunning : public TLcVtStateBase
+ {
+public:
+ /**
+ * returns singleton instance of TLcVtStateRunning
+ * @param aCtx state context
+ * @param aUiStates UI states
+ * @return singleton
+ */
+ static TLcVtStateRunning* InstanceL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates );
+
+public: // from TLcVtStateBase
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+ /** @see TLcVtStateBase */
+ virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+ /** @see TLcVtStateBase */
+ virtual TBool PreHandleForegroundChangedL( TBool aIsForeground );
+ /** @see TLcVtStateBase */
+ //virtual void HandleLayoutChangedL();
+
+ /** @see TLcVtStateBase */
+ //virtual void StartDtmfTone( const TChar& aTone );
+
+ /** @see TLcVtStateBase */
+ //virtual void StopDtmfTone();
+
+ /** @see TLcVtStateBase */
+ virtual void OpenL();
+
+private: // from TLcVtStateBase
+ /** @see TLcVtStateBase */
+ virtual void Close();
+
+private: // constructors and destructors
+
+ // c++ constructor
+ TLcVtStateRunning(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates );
+
+ // Destructor
+ virtual ~TLcVtStateRunning();
+
+private: // new functions
+
+ /** Requests call handling subsystem to initiate a voice call.
+ * Starts shutdown of the application.
+ */
+ void CreateVoiceCallL();
+
+ /** Dials emergency call and starts shutdown */
+ void DialEmergencyCallL();
+
+ void ShutdownWithEngineCommandL( const TInt aCommand );
+
+private: // data members
+ // singleton
+ static TLcVtStateRunning* iInstance;
+
+ };
+
+/**
+* Application state that is active during shutdown.
+*
+* @since S60 v3.2
+*/
+class TLcVtStateResetting : public TLcVtStateBase
+ {
+public:
+ /**
+ * returns singleton instance of TLcVtStateResetting
+ * @param aCtx state context
+ * @param aUiStates UI states
+ * @param aCommand engine command to send when resetting state activates
+ * @return singleton
+ */
+ static TLcVtStateResetting* InstanceL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates,
+ const TVtEngCommandId aCommand = KVtEngCommandNone );
+
+public: // from TLcVtStateBase
+
+ /** @see TLcVtStateBase */
+ virtual void LcVtStartupFailedL();
+
+ /** @see TLcVtStateBase */
+ virtual void ShutdownDoneL();
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError );
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+ /** @see TLcVtStateBase */
+ virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+ /** @see TLcVtStateBase */
+ virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+ /** @see TLcVtStateBase */
+ virtual TBool PreHandleForegroundChangedL( TBool aIsForeground );
+
+ /** @see TLcVtStateBase */
+ //virtual void HandleLayoutChangedL();
+
+private: // from TLcVtStateBase
+
+ /** @see TLcVtStateBase */
+ virtual void OpenL();
+
+ /** @see TLcVtStateBase */
+ virtual void Close();
+
+private: // constructors and destructors
+
+ // c++ constructor
+ TLcVtStateResetting(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates,
+ const TVtEngCommandId aCommand = KVtEngCommandNone );
+
+ // Destructor
+ virtual ~TLcVtStateResetting();
+
+private: // data members
+
+ // Singleton
+ static TLcVtStateResetting* iInstance;
+
+ // Used in user originated shutdown (end active call/switch to voice)
+ TVtEngCommandId iCommand;
+ };
+
+#endif // T_LCVTPLUGINSTATES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/states/tlcvtstatebase.h Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,248 @@
+/*
+* 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: Base class for application states.
+*
+*/
+
+
+#ifndef T_LCVTSTATEBASE_H
+#define T_LCVTSTATEBASE_H
+
+#include <e32base.h>
+#include <mvtengsessioninfo.h>
+#include "mlcvtstatecontext.h"
+#include "mlcvtshutterobserver.h"
+#include "tlcvtstates.h"
+
+/**
+* Base class for application states related to application startup, normal
+* operation and shutdown. AppUi delegates decision making by forwarding
+* events/commands it receives to current state.
+* Not all event handlers declared by the base class are applicable in
+* all concrete states. All methods returning TEventResponse imply that it may
+* consume the event completely and caller should not process it further.
+*
+* It should be kept in mind that as new functionality is added to application,
+* state classes may need changes if e.g. handling of specific event should be
+* allowed in appUi. By default event handler in specific state may consume all
+* events. Note that in this context e.g. HandleCommandL is considered as an
+* event handler.
+*
+* @since S60 v3.2
+*/
+class TLcVtStateBase : public MLcVtShutterObserver
+ {
+public: // new functions
+
+ /**
+ * Return value from state's event handlers.
+ */
+ enum TEventResponse
+ {
+ /** Event was handled by a state and should
+ * not be further processed by caller.
+ */
+ EEventHandled,
+ /** Event can be handled by caller. */
+ EEventNotHandled
+ };
+
+ /**
+ * Performs state dependent actions when phase 1 of
+ * startup is completed.
+ */
+ virtual void LcVtStartupPhase1DoneL();
+
+ /**
+ * Performs state dependent actions when startup fails.
+ */
+ virtual void LcVtStartupFailedL();
+
+ /**
+ * Performs state dependent actions when phase 2 of
+ * startup is completed.
+ */
+ virtual void LcVtStartupPhase2DoneL();
+
+ /**
+ * Handles completion of shutdown.
+ */
+ virtual void ShutdownDoneL();
+
+ /**
+ * Handles completion of an VT engine command.
+ * @param aCommand completed command
+ * @param aError error
+ * @return event response, is caller allowed to handle event
+ */
+ virtual TEventResponse HandleVTCommandPerformedL(
+ const TVtEngCommandId aCommand,
+ const TInt aError );
+
+ /**
+ * Handles event from the engine.
+ * @param aEvent
+ * @return event response, is caller allowed to handle event
+ */
+ virtual TEventResponse HandleVtEventL( const TInt aEvent );
+
+ /**
+ * Handles command from the user (or application framework).
+ * @param aCommand
+ * @return event response, is caller allowed to handle event
+ */
+ virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+ /**
+ * Performs state dependent actions for foreground change event.
+ * @param aIsForeground foreground status passed from UI framework
+ * @return ETrue if application should behave as in foreground
+ */
+ virtual TBool HandleForegroundChangedL( const TBool aIsForeground ) = 0;
+
+ /**
+ * Performs state dependent previous actions for foreground change event.
+ * @param aIsForeground foreground status passed from UI framework
+ * @return ETrue if application should behave as in foreground
+ */
+ virtual TBool PreHandleForegroundChangedL( const TBool aIsForeground ) = 0;
+
+ /**
+ * Performs state dependent actions for layout change.
+ */
+ //virtual void HandleLayoutChangedL();
+
+ /**
+ * Sends DTMF tone if allowed by current state.
+ * @param aTone DTMF tone to send
+ */
+ //virtual void StartDtmfTone( const TChar& aTone );
+
+ /**
+ * Stops DTMF tone if allowed by current state.
+ */
+ //virtual void StopDtmfTone();
+
+ /**
+ * Sets initial application state.
+ * @param aCtx state context providing services to states
+ * @param aUiStates ui states
+ */
+ static void SetInitialStateL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates);
+
+public: // from MLcVtShutterObserver
+
+ /**
+ * Handles 'shutdown ready' event.
+ */
+ virtual void HandleShutdownReady();
+
+
+protected: // for concrete state classes
+
+ /**
+ * Destructor, for cleanup.
+ */
+ virtual ~TLcVtStateBase();
+
+ /**
+ * Performs entry action for a state.
+ */
+ virtual void OpenL() = 0;
+
+ /**
+ * Performs exit action for a state and deletes that state.
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Sets current state.
+ */
+ void ChangeStateL( TLcVtStateBase& aNewState );
+
+ /**
+ * Sets transition to resetting state as cleanup item.
+ */
+ void CleanupResetPushL();
+
+ /**
+ * Starts shutdown when leave occurred.
+ */
+ static void TransitionToReset( TAny* aAny );
+
+
+ /**
+ * Ends the call if necessary and starts shutdown.
+ * @return ETrue if shutdown started.
+ */
+ TBool CheckEndActiveCallL();
+
+ /**
+ * Returns engine session state.
+ * @param aUpdate is state forced to update
+ * @return session state
+ */
+ MVtEngSessionInfo::TSessionState SessionState(
+ const TBool aUpdate ) const;
+
+ /**
+ * Delegates engine command execution to the state context.
+ */
+ template < typename T >
+ inline void ExecuteEngineCommand(
+ TInt aCommand, T& aParam );
+
+ /**
+ * Sets execution state.
+ */
+ void SetExecState( const TLcVtStates::TLcVtExecState aState );
+
+protected: // constructor
+
+ // c++ constructor
+ TLcVtStateBase( MLcVtStateContext& aCtx, TLcVtStates& aUiStates );
+
+
+private: // new functions
+
+ /**
+ * Updates applications lock state and sends to background if
+ * the device is locked.
+ */
+ void HandleDeviceLockEventL( const TBool aDeviceIsLocked );
+
+protected: // data members
+
+ // Context providing services to states
+ MLcVtStateContext& iCtx;
+
+ // Various application specific state information
+ TLcVtStates& iUiStates;
+
+ /** Prevents sending end call command to call handling if ETrue.
+ * It is not allowed when call clearing is network originated.
+ */
+
+ /**
+ * shutdown request received
+ */
+ static TBool iShutdownRequested;
+
+ };
+
+#include "tlcvtstatebase.inl"
+
+#endif // T_LCVTSTATEBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/inc/states/tlcvtstatebase.inl Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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: Base class for application states.
+*
+*/
+
+
+template < typename T >
+inline void TLcVtStateBase::ExecuteEngineCommand(
+ TInt aCommand, T& aParam )
+ {
+ TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ),
+ sizeof( T ) );
+ TRAP_IGNORE( iCtx.DoExecuteCmdL( aCommand, ¶ms ) );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/rom/lcvt.iby Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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: IBY file
+ *
+*/
+
+
+#ifndef __LCVTPLUGIN_IBY__
+#define __LCVTPLUGIN_IBY__
+
+REM Video telephony plugin libraries
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+ECOM_PLUGIN(lcvtengineplugin.dll,lcvtengineplugin.rsc)
+
+// Enabler for eclipsing ROM binaries
+data=ZSYSTEM\install\lcvtplugin_stub.sis system\install\lcvtplugin_stub.sis
+
+#endif
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/clcvtactiveexec.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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: Implementation of the CLcVtActiveExec class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "clcvtactiveexec.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::CLcVtActiveExec
+// -----------------------------------------------------------------------------
+//
+CLcVtActiveExec::CLcVtActiveExec(
+ const TInt aPriority )
+ : CActive( aPriority )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::~CLcVtActiveExec
+// -----------------------------------------------------------------------------
+//
+CLcVtActiveExec::~CLcVtActiveExec()
+ {
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::Start
+// -----------------------------------------------------------------------------
+//
+void CLcVtActiveExec::Start(
+ TInt aStartState,
+ MLcVtActiveExec& aExec )
+ {
+ Cancel();
+
+ iInitialState = aStartState;
+ iCurrentState = aStartState;
+ iNextState = aStartState;
+
+ iActiveExec = &aExec;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::InitialState
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtActiveExec::InitialState() const
+ {
+ return iInitialState;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::RequestStatus
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtActiveExec::RequestStatus() const
+ {
+ return iStatus.Int();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::RunL
+// -----------------------------------------------------------------------------
+//
+void CLcVtActiveExec::RunL()
+ {
+ User::LeaveIfError( iStatus.Int() );
+ TBool synch = ETrue;
+
+ // Execute to the next asynchronous operation.
+ while ( synch )
+ {
+ iCurrentState = iNextState;
+ if ( iCurrentState )
+ {
+ synch = iActiveExec->ActiveExecExecuteL(
+ *this,
+ iCurrentState,
+ iNextState,
+ iStatus );
+
+ if ( !synch )
+ {
+ SetActive();
+ }
+ }
+ else
+ {
+ iActiveExec->ActiveExecDone( *this, iInitialState );
+ if ( !IsActive() )
+ {
+ iInitialState = 0;
+ }
+
+ synch = EFalse;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CLcVtActiveExec::DoCancel()
+ {
+ if ( iActiveExec )
+ {
+ iActiveExec->ActiveExecCancel( *this, iCurrentState );
+
+ iCurrentState = 0;
+ iActiveExec = NULL;
+ iInitialState = 0;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtActiveExec::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtActiveExec::RunError( TInt aError )
+ {
+ if ( iActiveExec->ActiveExecContinue( *this, iCurrentState, aError ) )
+ {
+ iNextState = iCurrentState;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ }
+ else
+ {
+ if ( !IsActive() )
+ {
+ iInitialState = 0;
+ }
+ }
+
+ return KErrNone;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/clcvtappshutter.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,258 @@
+/*
+* 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: Class responsible for application exit.
+*
+*/
+
+
+#include "clcvtappshutter.h"
+#include "mlcvtshutterobserver.h"
+#include "mlcvtstatecontext.h"
+//#include "mlcvtnumbersource.h"
+//#include "tvtuilocalvariation.h"
+#include <cvtlogger.h>
+//#include <eikenv.h>
+//#include <AknUtils.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+
+// singleton instance
+static CLcVtAppShutter* iAppShutter = NULL;
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::InstanceL
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter* CLcVtAppShutter::InstanceL(
+ MLcVtShutterObserver& aObserver )
+ {
+ __VTPRINTENTER( "CLcVtAppShutter.InstanceL" )
+ if ( iAppShutter == NULL )
+ {
+ iAppShutter = new ( ELeave )
+ CLcVtAppShutter( aObserver );
+ }
+ __VTPRINTEXIT( "CLcVtAppShutter.InstanceL" )
+ return iAppShutter;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CLcVtAppShutter
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter::CLcVtAppShutter(
+ MLcVtShutterObserver& aObserver ) :
+ iPendingStateFlags( 0 ),
+ iObserver( aObserver )
+ {
+ iPendingStateFlags.Set( EShutterWaitingStart );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::~CLcVtAppShutter
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter::~CLcVtAppShutter()
+ {
+ __VTPRINTENTER( "CLcVtAppShutter.~" )
+ // mark singleton null
+ iAppShutter = NULL;
+ delete iCallback;
+ __VTPRINTEXIT( "CLcVtAppShutter.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::StartShutdown
+// Called when application may exit, i.e TVtUiStateResetting state receives
+// ShutdownDoneL message.
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::StartShutdown()
+ {
+ __VTPRINTENTER( "CLcVtAppShutter.StartShutdown" )
+ iPendingStateFlags.Clear( EShutterWaitingStart );
+ ShutdownIfReadyAndDestroy();
+ __VTPRINTEXIT( "CLcVtAppShutter.StartShutdown" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::ShutdownWithEmergencyCallL
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::ShutdownWithEmergencyCallL(
+ MLcVtStateContext& aStateContext )
+ {
+ // Leaves if other than emergency number is supplied...
+ CEmergencyCaller* emergency = CEmergencyCaller::DialEmergencyL( *this,
+ aStateContext );
+ // therefore the flag and member variable must not be set before above call.
+ iPendingStateFlags.Set( EShutterWaitingEmergencyCallback );
+ iEmergencyCaller = emergency;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::EmergencyCallDoneL
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::EmergencyCallDoneL()
+ {
+ // Destruction of emergency handler is done asynchrounously to avoid
+ // problems that might
+ iPendingStateFlags.Clear( EShutterWaitingEmergencyCallback );
+ TCallBack cb( EmergencyResponseCallback, this );
+ EnqueCallbackL( cb );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::EmergencyResponseCallback
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtAppShutter::EmergencyResponseCallback( TAny* aAny )
+ {
+ CLcVtAppShutter* shutter =
+ reinterpret_cast<CLcVtAppShutter*>( aAny );
+ // delete callback
+ delete shutter->iCallback;
+ shutter->iCallback = NULL;
+ // delete emergency caller
+ delete shutter->iEmergencyCaller;
+ shutter->iEmergencyCaller = NULL;
+
+ shutter->ShutdownIfReadyAndDestroy();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::EnqueCallbackL
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::EnqueCallbackL( TCallBack& aCallback )
+ {
+ __VTPRINTENTER( "CLcVtAppShutter.EnqueAsyncCommsCommandL" )
+ if ( !iCallback )
+ {
+ iCallback = new ( ELeave ) CAsyncCallBack( aCallback, EPriorityHigh );
+ }
+ iCallback->Call();
+ __VTPRINTEXIT( "CLcVtAppShutter.EnqueAsyncCommsCommandL" )
+ __VTPRINTEXIT( "CLcVtAppShutter.EnqueCallbackL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::ShutdownIfReadyAndDestroy
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::ShutdownIfReadyAndDestroy()
+ {
+ __VTPRINTENTER( "CLcVtAppShutter.ShutdownIfReadyAndDestroy" )
+ __VTPRINT2( DEBUG_GEN, " shutter flags %d",
+ iPendingStateFlags.Value() );
+ if ( !iPendingStateFlags.Value() )
+ {
+ iObserver.HandleShutdownReady();
+ delete this;
+ }
+ __VTPRINTEXIT( "CLcVtAppShutter.ShutdownIfReadyAndDestroy" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CEmergencyCaller::DialEmergencyL
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter::CEmergencyCaller* CLcVtAppShutter::CEmergencyCaller::
+ DialEmergencyL(
+ CLcVtAppShutter& aObserver,
+ MLcVtStateContext& aStateContext )
+ {
+ __VTPRINTENTER( "CEmergencyCaller.DialEmergencyL" )
+ CLcVtAppShutter::CEmergencyCaller* self = new ( ELeave )
+ CLcVtAppShutter::CEmergencyCaller( aObserver, aStateContext );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ __VTPRINTEXIT( "CEmergencyCaller.DialEmergencyL" )
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CEmergencyCaller::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::CEmergencyCaller::ConstructL()
+ {
+ __VTPRINTENTER( "CEmergencyCaller.ConstructL" )
+ /*
+ const MVtUiNumberSource* source = iStateContext.NumberSource();
+ if ( source )
+ {
+ source->GetContents( iNumber );
+ AknTextUtils::ConvertDigitsTo( iNumber, EDigitTypeWestern );
+ User::LeaveIfError( iServer.Connect() );
+ iEmergency = CPhCltEmergencyCall::NewL( this );
+ TBool isEmergenyNumber = EFalse;
+ const TInt err =
+ iEmergency->FindEmergencyPhoneNumber( iNumber, isEmergenyNumber );
+
+ if ( err == KErrNone && isEmergenyNumber )
+ {
+ __VTPRINT( DEBUG_GEN, "iEmergency->DialEmergencyCallL")
+ iEmergency->DialEmergencyCallL( iNumber );
+ }
+ if ( !isEmergenyNumber || err )
+ {
+ __VTPRINT( DEBUG_GEN, " not EC number => leave" )
+ // Not an emergency call number. Abort emergency call process.
+ User::Leave( KErrArgument );
+ }
+ }
+ */
+ __VTPRINTEXIT( "CEmergencyCaller.ConstructL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CEmergencyCaller::CEmergencyCaller
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter::CEmergencyCaller::CEmergencyCaller(
+ CLcVtAppShutter& aObserver,
+ MLcVtStateContext& aStateContext ) :
+ iObserver( aObserver ),
+ iStateContext( aStateContext )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CEmergencyCaller::~CEmergencyCaller
+// -----------------------------------------------------------------------------
+//
+CLcVtAppShutter::CEmergencyCaller::~CEmergencyCaller()
+ {
+ __VTPRINTENTER( "CEmergencyCaller.~" )
+ delete iEmergency;
+ iServer.Close();
+ __VTPRINTEXIT( "CEmergencyCaller.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtAppShutter::CEmergencyCaller::HandleEmergencyDialL
+// -----------------------------------------------------------------------------
+//
+void CLcVtAppShutter::CEmergencyCaller::HandleEmergencyDialL(
+ const TInt )
+ {
+ __VTPRINTENTER( "CEmergencyCaller.HandleEmergencyDialL" )
+ iObserver.EmergencyCallDoneL();
+ __VTPRINTEXIT( "CEmergencyCaller.HandleEmergencyDialL" )
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/clcvtcmdexecutor.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,360 @@
+/*
+* 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: Implementation of the CLcVtCmdExecutor class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "clcvtcmdexecutor.h"
+#include "mlcvtenginecommandmanager.h"
+#include <mvtengcommandhandler.h>
+#include <cvtlogger.h>
+
+// MODULE DATA STRUCTURES
+
+/**
+* Active object to perform asynchronous commands.
+* @since Series 60 2.6
+*/
+class CLcVtCmdExecutor::CActiveCmd
+ : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor.
+ */
+ CActiveCmd(
+ CLcVtCmdExecutor& aDialog,
+ MVtEngCommandHandler& aCommandHandler,
+ TVtEngCommandId aCommand,
+ TDesC8* aParams );
+
+ /**
+ * Destructor.
+ */
+ ~CActiveCmd();
+
+ public: // New functions
+
+ /**
+ * Starts active object. Command will be performed in RunL.
+ */
+ void Start();
+
+ /**
+ * Checks if command has been performed.
+ * @return ETrue if command has been performed.
+ */
+ TBool CommandPerformed() const;
+
+ private:
+
+ /**
+ * @see CActive::RunL
+ */
+ void RunL();
+
+ /**
+ * @see CActive::DoCancel.
+ */
+ void DoCancel();
+
+ /**
+ * @see CActive::RunError.
+ */
+ TInt RunError( TInt aResult );
+
+ private:
+
+ // Ref to dialog.
+ CLcVtCmdExecutor& iExecutor;
+
+ // Ref to command handler.
+ MVtEngCommandHandler& iCommandHandler;
+
+ // Command to be executed.
+ TVtEngCommandId iCommand;
+
+ // Owned parameters.
+ TDesC8* iCommandParams;
+
+ // ETrue if command has been performed.
+ TBool iCommandPerformed;
+
+ };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CLcVtCmdExecutor
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor::CLcVtCmdExecutor(
+ CLcVtCmdExecutor** aSelfPtr,
+ MVtEngCommandHandler& aCommandHandler,
+ MLcVtEngineCommandManager& aCommandManager )
+ : iSelfPtr( aSelfPtr ),
+ iCommandHandler( aCommandHandler ),
+ iCommandManager( aCommandManager )
+ {
+ iRequest = NULL;
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.Ctor this=%d", (TInt)this )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::~CLcVtCmdExecutor
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor::~CLcVtCmdExecutor()
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.~" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.~ this=%d", (TInt)this )
+ if ( iActiveCmd )
+ {
+ if ( !iCommandCompleted && iActiveCmd->CommandPerformed() )
+ {
+ iCommandHandler.CancelCommand( iCommand ); // ignore error
+ }
+ }
+ delete iCommandParams;
+ delete iActiveCmd;
+
+ iCommandManager.RemoveObserver( *this );
+
+ if ( iSelfPtr )
+ {
+ *iSelfPtr = NULL;
+ iSelfPtr = NULL;
+ }
+
+ if ( iRequest )
+ {
+ __VTPRINT(DEBUG_GEN, "CLcVtCmdExecutor::~CLcVtCmdExecutor RequestComplete")
+ User::RequestComplete( iRequest, KErrCancel );
+ iRequest = NULL;
+ }
+ else
+ {
+ if ( iWait.IsStarted())
+ {
+ __VTPRINT(DEBUG_GEN, "CLcVtCmdExecutor::~CLcVtCmdExecutor AsyncStop")
+ iWait.AsyncStop();
+ }
+ }
+
+
+ __VTPRINTEXIT( "CLcVtCmdExecutor.~" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::ExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::ExecuteCmdL(
+ const TVtEngCommandId aCommandId,
+ TDesC8* aParams,
+ TRequestStatus* aRequest )
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.ExecuteCmdL" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.ExecuteCmdL this=%d", (TInt)this )
+ iCommand = aCommandId;
+ CleanupStack::PushL( this );
+ if ( aParams )
+ {
+ iCommandParams = aParams->AllocL();
+ }
+
+ iCommandManager.AddObserverL( *this );
+ CleanupStack::Pop( this );
+
+ iActiveCmd =
+ new ( ELeave ) CActiveCmd(
+ *this, iCommandHandler, iCommand, iCommandParams );
+ iActiveCmd->Start();
+
+ if ( !aRequest )
+ {
+ TInt error = KErrNone;
+ iError = &error;
+ //Start Active Schedule
+ iWait.Start();
+ User::LeaveIfError( error );
+ }
+ else
+ {
+ *aRequest = KRequestPending;
+ iRequest = aRequest;
+ }
+
+ __VTPRINTEXIT( "CLcVtCmdExecutor.ExecuteCmdL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::Complete
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::Complete( const TInt aError )
+ {
+ if ( iError )
+ {
+ *iError = aError;
+ }
+
+ if ( iRequest )
+ {
+ User::RequestComplete( iRequest, aError );
+ iRequest = NULL;
+ }
+
+ delete this;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError )
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.HandleVTCommandPerformed" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.HandleVTCommandPerformed.cmd.%d", aCommand )
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.HandleVTCommandPerformed.err.%d", aError )
+ if ( iActiveCmd && ( aCommand == iCommand ) )
+ {
+ if ( iActiveCmd->CommandPerformed() && !iCommandCompleted )
+ {
+ __VTPRINT( DEBUG_GEN, "CLcVtCmdExecutor.match" )
+ iCommandCompleted = ETrue;
+ // Corrupted images may leave during initialization, thus we have
+ // to mask out errors when they happen during share initialize.
+ // Error code is handled correctly in CVtUiAppUi::CEventObserver::
+ // HandleVTCommandPerformedL() method, thus it will not be ignored.
+ if ( aCommand == KVtEngInitializeShareImage )
+ {
+ Complete( KErrNone );
+ }
+ else
+ {
+ Complete( aError );
+ }
+ }
+ }
+ __VTPRINTEXIT( "CLcVtCmdExecutor.HandleVTCommandPerformed" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::HandleExecuteFailed
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::HandleExecuteFailed( TInt aResult )
+ {
+ __VTPRINT3( DEBUG_GEN, "CLcVtCmdExecutor.Fail this=%d res=%d",
+ (TInt)this, aResult )
+ Complete( aResult );
+ }
+
+// Implementation of CLcVtCmdExecutor::CActiveCmd:
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::CActiveCmd
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor::CActiveCmd::CActiveCmd(
+ CLcVtCmdExecutor& aExecutor,
+ MVtEngCommandHandler& aCommandHandler,
+ TVtEngCommandId aCommand,
+ TDesC8* aParams)
+ : CActive( CActive::EPriorityHigh ),
+ iExecutor( aExecutor ),
+ iCommandHandler( aCommandHandler ),
+ iCommand( aCommand ),
+ iCommandParams( aParams )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::~CActiveCmd
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor::CActiveCmd::~CActiveCmd()
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.CActiveCmd.Dtor this=%d", (TInt)this )
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::Start
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::CActiveCmd::Start()
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.CActiveCmd.Start" )
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ __VTPRINTEXITR( "CLcVtCmdExecutor.CActiveCmd.Start this=%d", (TInt)this )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::CommandPerformed
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtCmdExecutor::CActiveCmd::CommandPerformed() const
+ {
+ __VTPRINT3( DEBUG_GEN, "CLcVtCmdExecutor.CActiveCmd.Perf this=%d,cmd=%d",
+ (TInt)this, iCommandPerformed )
+ return iCommandPerformed;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::RunL
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::CActiveCmd::RunL()
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.CActiveCmd.RunL" )
+ iCommandHandler.ExecuteL( iCommand, iCommandParams );
+ iCommandPerformed = ETrue;
+ __VTPRINTEXITR( "CLcVtCmdExecutor.CActiveCmd.RunL this=%d", (TInt)this )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtCmdExecutor::CActiveCmd::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CLcVtCmdExecutor::CActiveCmd::DoCancel()
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtCmdExecutor.CActiveCmd.DoCnl this=%d", (TInt)this )
+ // Request is completed immediately.
+ }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtCmdExecutor::CActiveCmd::RunError( TInt aResult )
+ {
+ __VTPRINTENTER( "CLcVtCmdExecutor.CActiveCmd.RunError" )
+ // Exception was raised in RunL. Inform the dialog to close itself.
+ iExecutor.HandleExecuteFailed( aResult );
+ __VTPRINTEXITR( "CLcVtCmdExecutor.CActiveCmd.RunError this=%d", (TInt)this )
+ return KErrNone;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/clcvtengine.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* 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: LiveComm Videotelephony Plugin Class
+*
+*/
+
+#include <lcsession.h>
+#include <lcuiprovider.h>
+#include <lcsessionobserver.h>
+#include "clcvtengine.h"
+#include "clcvtsession.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtEngine* CLcVtEngine::NewL( TAny* aParams )
+ {
+ CLcVtEngine* self = new ( ELeave ) CLcVtEngine;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+CLcVtEngine::~CLcVtEngine()
+ {
+ delete iSession;
+ }
+
+MLcSession& CLcVtEngine::Session()
+ {
+ return *iSession;
+ }
+
+void CLcVtEngine::ConstructL()
+ {
+ iSession = CLcVtSession::NewL();
+ }
+
+CLcVtEngine::CLcVtEngine() : CLcEngine()
+ {
+
+ }
+
+TBool CLcVtEngine::IsFeatureSupported( TLcFeature aLcFeature )
+ {
+ return iSession->IsFeatureSupported( aLcFeature );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/clcvtsession.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,2317 @@
+/*
+* 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: LiveComm Videotelephony Plugin session Class
+*
+*/
+
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cmn.h>
+#include <featmgr.h>
+
+#include <w32std.h>
+#include <coecntrl.h>
+#include <eikenv.h>
+#include <eikappui.h>
+#include <apgcli.h>
+
+#include "clcvtsession.h"
+
+#include "cvtengmodel.h"
+
+#include "clcvtvideoplayerbase.h"
+#include "clcvtlocalvideoplayer.h"
+#include "clcvtremotevideoplayer.h"
+#include "tlcvtstates.h"
+#include "clcvtcmdexecutor.h"
+#include "mlcvtenginecommandmanager.h"
+#include "lcvtplugincommand.h"
+#include "lcvtutility.h"
+
+// Default call index.
+const TInt KVtUiDefaultCallId = 1;
+
+// Granularity of command observer array.
+const TInt KLcVtCommandObserverArrayGranularity = 5;
+
+
+
+// Enumerates states for CLcVtActiveExec.
+enum
+ {
+ // Operation finished. Must equal to zero.
+ EVtSessionNone,
+
+ // Active execution states for iActiveExec:
+
+ // Startup (prepare engine):
+ EVtSessionStartup = 100, // 100
+ // Initialise engine.
+ EVtSessionStartupInitEngine = EVtSessionStartup, // 100
+ // Prepare viewfinder.
+ EVtSessionStartupPrepareViewfinder, // 101
+ // Prepare remote render.
+ EVtSessionStartupPrepareRemoteRender, // 102
+ // Startup Finish
+ EVtSessionStartupFinish, // 103
+
+ // Shutdown (reset engine):
+ EVtSessionShutdown = 300, // 300
+ // Hide application.
+ EVtSessionShutdownHideApplication = EVtSessionShutdown, // 300
+ // Reset engine.
+ EVtSessionShutdownResetEngine, // 301
+
+
+ // Answered:
+ EVtSessionAnswered = 500, // 500
+ // Start remote render.
+ EVtSessionAnsweredStartRemoteRender = EVtSessionAnswered, // 500
+ // Prepare Camere
+ EVtSessionAnsweredDoPrepareCamera, // 501
+ // Select camera as source.
+ EVtSessionAnsweredSetlectCamera, // 502
+ // Select blank image as source.
+ EVtSessionAnsweredSetlectNone,
+ // Start view finder
+ EVtSessionAnsweredStartViewFinder, // 504
+ // Show Application
+ EVtSessionAnsweredBringToForeground, // 505
+
+ //EVtSessionAnswered = 500, // 500
+ //EVtSessionAnsweredBringToForeground = EVtSessionAnswered, // 505
+
+ // Finish.
+ EVtSessionAnsweredFinish // 506
+ };
+
+
+/**
+ * Encapsulates event handling.
+ * @since Series 60 2.6
+ */
+class CLcVtSession::CEventObserver
+ : public CBase,
+ public MLcVtEngineCommandManager,
+ public MVtEngEventObserver,
+#ifndef NGA_VIDEO_RENDER
+ public MVtEngFrameObserver,
+#endif
+ public MVtEngCommandObserver
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two-phased constructor.
+ * @param aSession plugin session.
+ */
+ static CEventObserver* NewL(CLcVtSession& aSession);
+
+ /**
+ * Destructor.
+ */
+ ~CEventObserver();
+
+ public: // Functions from base classes
+
+ /**
+ * @see MLcVtEngineCommandManager::AddObserverL.
+ */
+ void AddObserverL( MVtEngCommandObserver& aObserver );
+
+ /**
+ * @see MLcVtEngineCommandManager::RemoveObserver.
+ */
+ void RemoveObserver( MVtEngCommandObserver& aObserver );
+
+ /**
+ * @see MVtEngEventObserver::HandleVtEventL.
+ */
+ void HandleVtEventL( TInt aEvent );
+
+ /**
+ * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+ */
+ void HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError );
+#ifndef NGA_VIDEO_RENDER
+ /**
+ * @see MVtEngFrameObserver::vtHandleFrameL.
+ */
+ void vtHandleFrameL( TFrameType aType, CFbsBitmap* aBitmap );
+
+ /**
+ * @see MVtEngFrameObserver::vtSetFrame
+ */
+ void vtSetFrame( TFrameType aType, CFbsBitmap* aBitmap );
+#endif
+ private:
+
+ /**
+ * Constructor.
+ * @param aSession plugin session.
+ */
+ CEventObserver(CLcVtSession& aSession );
+
+ /**
+ * Symbian OS constructor.
+ */
+ void ConstructL();
+
+ private:
+
+ // Ref to plugin session.
+ CLcVtSession& iSession;
+
+ // ETrue when command events are being sent.
+ TBool iInCommandPerformed;
+
+ // Owned array of observers.
+ RPointerArray< MVtEngCommandObserver > iCommandObservers;
+
+ };
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtSession* CLcVtSession::NewL()
+ {
+ CLcVtSession* self = new ( ELeave ) CLcVtSession();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtSession::CLcVtSession( )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ConstructL()
+ {
+
+ __VTPRINTENTER( "CLcVtSession.ConstructL" )
+
+ __VTPRINT( DEBUG_MEDIA , "FeatureManager::InitializeLibL()" )
+ FeatureManager::InitializeLibL();
+
+ __VTPRINT( DEBUG_MEDIA , "iCameraHandler.SetSession(this)" )
+ iCameraHandler.SetSession(this);
+ __VTPRINT( DEBUG_MEDIA , "iRemoteVideoPlayer = CLcVtRemoteVideoPlayer_NewL" )
+ iRemoteVideoPlayer = CLcVtRemoteVideoPlayer::NewL(this, *this);
+ __VTPRINT( DEBUG_MEDIA , "iLocalVideoPlayer = CLcVtLocalVideoPlayer_NewL" )
+ iLocalVideoPlayer = CLcVtLocalVideoPlayer::NewL(this, *this, iCameraHandler);
+
+#ifndef NGA_VIDEO_RENDER
+ iFbsStarted = EFalse;
+
+ __VTPRINT( DEBUG_MEDIA , "iWsSession = &(CCoeEnv::Static()->WsSession())" )
+ iWsSession = &(CCoeEnv::Static()->WsSession());
+ __VTPRINT( DEBUG_MEDIA , "iWsSessionScreenDev = CCoeEnv::Static()->ScreenDevice()" )
+ iWsSessionScreenDev = CCoeEnv::Static()->ScreenDevice();
+ __VTPRINT( DEBUG_MEDIA , "iRootWin = &(CCoeEnv::Static()->RootWin())" )
+ iRootWin = &(CCoeEnv::Static()->RootWin());
+
+ __VTPRINT( DEBUG_MEDIA , "ConnectFbsServerL()" )
+ ConnectFbsServerL();
+#endif
+ __VTPRINT( DEBUG_MEDIA , "iEventObserver = CEventObserver_NewL" )
+ iEventObserver = CEventObserver::NewL( *this );
+
+ iModel = CVtEngModel::NewL( *iEventObserver, *iEventObserver );
+
+ __VTPRINT( DEBUG_MEDIA , "iLcVtStates_new" )
+ iLcVtStates = new ( ELeave ) TLcVtStates( *iModel );
+ __VTPRINT( DEBUG_MEDIA , "iLcVtStates->Update()" )
+ iLcVtStates->Update();
+
+ __VTPRINT( DEBUG_MEDIA , "new_iActiveExec" )
+ iActiveExec =
+ new ( ELeave ) CLcVtActiveExec( CActive::EPriorityHigh );
+
+ __VTPRINT( DEBUG_MEDIA , "SetCallIdL( KVtUiDefaultCallId )" )
+ SetCallIdL( KVtUiDefaultCallId );
+
+ __VTPRINT( DEBUG_MEDIA , "iAsyncCallback" )
+ iAsyncCallback =
+ new ( ELeave ) CAsyncCallBack (
+ TCallBack( &DoExit, this ),
+ CActive::EPriorityStandard );
+#if 0
+ __VTPRINT( DEBUG_MEDIA , "iLayoutChangeCallback" )
+ iLayoutChangeCallback =
+ new ( ELeave ) CAsyncCallBack(
+ TCallBack( &DelayedHandleLayoutChanged, this ),
+ CActive::EPriorityStandard );
+#endif
+ __VTPRINTEXIT( "CLcVtSession.ConstructL" )
+
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtSession::~CLcVtSession()
+ {
+ __VTPRINTENTER( "CLcVtSession.~CLcVtSession" )
+
+ //delete iLayoutChangeCallback;
+ delete iAsyncCallback;
+
+#ifndef NGA_VIDEO_RENDER
+ DisconnectFbsServer();
+#endif
+ delete iActiveExec;
+ delete iLcVtStates;
+
+ delete iModel;
+
+ delete iEventObserver;
+ iEventObserver = NULL;
+
+#ifdef NGA_VIDEO_RENDER
+ DestroyVideoWindows();
+#endif
+
+ delete iLocalVideoPlayer;
+ delete iRemoteVideoPlayer;
+
+ delete iRemoteDisplayName;
+ delete iRemoteDetails;
+ __VTPRINTEXIT( "CLcVtSession.~CLcVtSession" )
+ FeatureManager::UnInitializeLib();
+ }
+
+#ifndef NGA_VIDEO_RENDER
+void CLcVtSession::ConnectFbsServerL()
+ {
+ // VT use bitmaps viewfinder now, So we start FBS server for proto demo
+ // and later we will use Qt image object to implement bitmaps view finder or we will use direct view finder
+ TInt err( KErrNone );
+ // Start Font&Bitmap server
+ err = FbsStartup();
+ if ( err == KErrNone )
+ {
+ err = RFbsSession::Connect();
+ if( err == KErrNone )
+ {
+ iFbsStarted = ETrue;
+ }
+ }
+
+ iDummy = new ( ELeave ) CFbsBitmap();
+ //CleanupStack::PushL( iDummy );
+ User::LeaveIfError( iDummy->Create( TSize( 4096, 1 ), EColor64K ) );
+
+ iGc = new (ELeave) CWindowGc( iWsSessionScreenDev );
+ //CleanupStack::PushL( iGc );
+ User::LeaveIfError( iGc->Construct());
+
+ //CleanupStack::Pop(2);
+ }
+
+
+void CLcVtSession::DisconnectFbsServer()
+ {
+ delete iGc;
+ delete iDummy;
+ if ( iFbsStarted )
+ {
+ RFbsSession::Disconnect();
+ iFbsStarted = EFalse;
+ }
+ }
+#endif
+#ifdef NGA_VIDEO_RENDER
+
+_LIT(KVTWindowGroupName,"32VTPluginVideoWindow");
+
+void CLcVtSession::CreateVideoWindowsL()
+ {
+ __VTPRINTENTER( "CLcVtSession.CreateVideoWindowsL" )
+ User::LeaveIfError( iRwSession.Connect() );
+
+ iRwGroup = new (ELeave) RWindowGroup( iRwSession ) ;
+ iRwGroup->Construct( (TUint32)iRwGroup, EFalse );
+
+ iRwGroup->SetName( KVTWindowGroupName );
+ iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNeverAtFront );
+ iRwGroup->AutoForeground(EFalse);
+
+ iDev = new (ELeave) CWsScreenDevice( iRwSession );
+ iDev->Construct( );
+
+ iRemoteVideoWindow = new (ELeave) RWindow( iRwSession );
+ iRemoteVideoWindow->Construct( *iRwGroup, (TUint32)iRemoteVideoWindow );
+
+ TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect();
+ iRemoteVideoWindow->SetExtent( RMRect.iTl, RMRect.Size() );
+ iRemoteVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront );
+ iRemoteVideoWindow->Activate();
+
+ iLocalVideoWindow = new (ELeave) RWindow( iRwSession );
+ iLocalVideoWindow->Construct( *iRwGroup, (TUint32)iLocalVideoWindow );
+
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ iLocalVideoWindow->SetExtent( VFRect.iTl, VFRect.Size() );
+ iLocalVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront );
+ iLocalVideoWindow->Activate();
+
+ iRwSession.Flush();
+
+ __VTPRINTEXIT( "CLcVtSession.CreateVideoWindowsL" )
+ }
+
+void CLcVtSession::DestroyVideoWindows()
+ {
+
+ delete iDev;
+ iDev = NULL;
+ delete iRemoteVideoWindow;
+ iRemoteVideoWindow = NULL;
+ delete iLocalVideoWindow;
+ iLocalVideoWindow = NULL;
+ delete iRwGroup;
+ iRwGroup = NULL;
+ iRwSession.Close();
+ }
+
+#endif
+
+
+void CLcVtSession::SetLcSessionObserver( MLcSessionObserver* aObserver )
+ {
+ iObserver = aObserver;
+ }
+
+void CLcVtSession::SetLcUiProvider( MLcUiProvider* aUiProvider )
+ {
+ iUiProvider = aUiProvider;
+ }
+
+TBool CLcVtSession::IsBackgroundStartup()
+ {
+ return ETrue;
+ }
+
+TBool CLcVtSession::SendDialTone( TChar aKey )
+ {
+ iDtmfTone = aKey;
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.SendDialTone: %d", iDtmfTone() )
+ if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone )
+ {
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+ }
+
+void CLcVtSession::EstablishLcSessionL()
+ {
+ __VTPRINTENTER( "CLcVtSession.EstablishLcSessionL" )
+
+ TLcVtStateBase::SetInitialStateL( *this, *iLcVtStates );
+
+ __VTPRINTEXIT( "CLcVtSession.EstablishLcSessionL" )
+ }
+
+void CLcVtSession::TerminateLcSessionL()
+ {
+ __VTPRINTENTER( "CLcVtSession.TerminateLcSessionL" )
+
+ HandleCommandL( EPluginCmdEndActiveCall );
+
+ __VTPRINTEXIT( "CLcVtSession.TerminateLcSessionL" )
+ }
+
+MLcVideoPlayer* CLcVtSession::RemoteVideoPlayer()
+ {
+ return iRemoteVideoPlayer;
+ }
+
+MLcVideoPlayer* CLcVtSession::LocalVideoPlayer()
+ {
+ return iLocalVideoPlayer;
+ }
+
+MLcSession::TLcSessionState CLcVtSession::LcSessionState() const
+ {
+ return iSessionState;
+ }
+
+const TDesC& CLcVtSession::LocalDisplayName()
+ {
+ return KNullDesC;
+ }
+const TDesC& CLcVtSession::RemoteDisplayName()
+ {
+ if ( iRemoteDisplayName )
+ {
+ return *iRemoteDisplayName;
+ }
+ return KNullDesC;
+ }
+
+TInt CLcVtSession::SetParameter( TInt aId, TInt aValue )
+ {
+ if (aId == 0)
+ iMainWindow = reinterpret_cast<RWindow*>(aValue);
+
+ return 0;
+ }
+
+TInt CLcVtSession::ParameterValue( TInt aId )
+ {
+ return 0;
+ }
+
+const TDesC& CLcVtSession::RemoteDetails()
+ {
+ if ( iRemoteDetails )
+ {
+ return *iRemoteDetails;
+ }
+ return KNullDesC;
+ }
+
+void CLcVtSession::UpdateLcSessionL()
+ {
+ __VTPRINTENTER( "CLcVtSession.UpdateLcSessionL" )
+
+ if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning )
+ {
+ __VTPRINTEXIT( "CLcVtSession.UpdateLcSessionL -- State Not OK" )
+ return;
+ }
+#if 0
+ if(iLocalVideoPlayer->IsOrientationChanged())
+ HandleLayoutChanged();
+ else
+ UpdateRenderingParametersL();
+#endif
+ UpdateRenderingParametersL();
+ __VTPRINTEXIT( "CLcVtSession.UpdateLcSessionL" )
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::IsLcAudioMutedL()
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::MuteLcAudioL( TBool aMute )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::IsLcMicMutedL()
+ {
+ TBool result = !(iLcVtStates->AudioState().IsAudio());
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsLcMicMutedL = %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::MuteLcMicL( TBool aMute )
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.MuteLcMicL aMute = %d", aMute )
+
+ if(aMute)
+ {
+ HandleCommandL(EPluginCmdDisableAudio);
+ }
+ else
+ {
+ HandleCommandL(EPluginCmdEnableAudio);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::IsEnablingLcLoudspeakerAllowed()
+ {
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::EnableLcLoudspeakerL( TBool aEnabled )
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.EnableLcLoudspeakerL aEnabled = %d", aEnabled )
+
+ if(aEnabled)
+ {
+ HandleCommandL(EPluginCmdActivateLoudspeaker);
+ }
+ else
+ {
+ HandleCommandL(EPluginCmdDeactivateLoudspeaker);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::IsLcLoudspeakerEnabled()
+ {
+ TBool result = !(iLcVtStates->AudioState().CanActivateLoudspeaker());
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsLcLoudspeakerEnabled = %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtSession::LcVolumeL()
+ {
+ MVtEngAudio& audio = iModel->Audio();
+ MVtEngAudio::TAudioRoutingState audioRouting;
+ User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+ const TInt volume( audio.OutputVolume(
+ !( audioRouting == MVtEngAudio::EAudioLoudspeaker ) ) );
+
+ return volume;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::SetLcVolumeL( TInt aValue )
+ {
+ __VTPRINTENTER( "CLcVtSession.SetLcVolumeL" )
+ MVtEngAudio& audio = iModel->Audio();
+ const TInt HandsetVolume( audio.OutputVolume(ETrue) );
+ const TInt HandsfreeVolume( audio.OutputVolume(EFalse) );
+ MVtEngAudio::TVtEngOutputVolume volume;
+ volume.iHandsetVolume = HandsetVolume;
+ volume.iHandsfreeVolume = HandsfreeVolume;
+
+ MVtEngAudio::TAudioRoutingState audioRouting;
+ User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+ if(audioRouting == MVtEngAudio::EAudioHandset)
+ volume.iHandsetVolume = aValue;
+ else
+ volume.iHandsfreeVolume = aValue;
+
+ ExecuteCmdL( KVtEngSetAudioVolume, volume );
+ __VTPRINTEXIT( "CLcVtSession.SetLcVolumeL" )
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::IncreaseLcVolumeL()
+ {
+ ExecuteCmdL( KVtEngIncreaseAudioVolume );
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcAudioControl
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::DecreaseLcVolumeL()
+ {
+ ExecuteCmdL( KVtEngDecreaseAudioVolume );
+ }
+
+CVtEngModel& CLcVtSession::Model()
+ {
+ return *iModel;
+ }
+
+
+void CLcVtSession::HandleCommandL(const TInt aCommand)
+ {
+
+ __VTPRINTENTER( "CLcVtSession.HandleCommandL" )
+
+ if ( iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning )
+ {
+ __VTPRINTEXIT( "CLcVtSession.HandleCommandL NOT ready" )
+ return;
+ }
+
+ if ( iState->HandleCommandL( aCommand ) == TLcVtStateBase::EEventHandled )
+ {
+ __VTPRINTEXIT( "CLcVtSession.HandleCommandL <silently ignoring> 0" )
+ return;
+ }
+
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.HandleCommandL command = %d", aCommand )
+
+ switch ( aCommand )
+ {
+ case EPluginCmdEnableAudio:
+ CmdEnableAudioL();
+ break;
+
+ case EPluginCmdDisableAudio:
+ CmdDisableAudioL();
+ break;
+
+ case EPluginCmdUsePrimaryCamera:
+ CmdUseCameraL( ETrue );
+ break;
+
+ case EPluginCmdUseSecondaryCamera:
+ CmdUseCameraL( EFalse );
+ break;
+
+ case EPluginCmdEnableVideo:
+ CmdEnableVideoL();
+ break;
+
+ case EPluginCmdDisableVideo:
+ CmdDisableVideoL();
+ break;
+
+ case EPluginCmdActivateLoudspeaker:
+ CmdActivateLoudspeakerL();
+ break;
+
+ case EPluginCmdDeactivateLoudspeaker:
+ CmdDeactivateLoudspeakerL();
+ break;
+
+ }
+
+ __VTPRINTEXIT( "CLcVtSession.HandleCommandL" )
+
+ iLcVtStates->Update();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdEnableAudioL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdEnableAudioL()
+ {
+ ExecuteCmdL( KVtEngUnmuteOutgoingAudio );
+ iLcVtStates->Update();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdDisableAudioL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdDisableAudioL()
+ {
+ ExecuteCmdL( KVtEngMuteOutgoingAudio );
+ iLcVtStates->Update();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdUseCameraL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdUseCameraL( const TBool aPrimaryCamera )
+ {
+
+ MVtEngMedia& media = iModel->Media();
+
+ MVtEngMedia::TMediaSource selectedSource =
+ ( aPrimaryCamera ) ?
+ MVtEngMedia::EMediaCameraPri : MVtEngMedia::EMediaCameraSec;
+
+ TInt available = 0;
+ LcVtUtility::GetOutgoingMediaState( media, available );
+ if ( available & MVtEngMedia::EMediaVideo )
+ {
+ ExecuteCmdL( KVtEngStopViewFinder );
+
+ TRAPD( err, ExecuteCmdL( KVtEngSetSource, selectedSource ) );
+
+ if ( err == KErrNone )
+ {
+ ExecuteCmdL( KVtEngStartViewFinder );
+ }
+ else
+ {
+ //ShowOtherCameraNotUsableNoteL();
+ }
+ }
+ else
+ {
+ /*
+ MVtEngMedia::TPrepareCameraParams params;
+ params.iMediaSource = selectedSource;
+ params.iInitialize = EFalse;
+ TRAPD( err, ExecuteCmdL( KVtEngPrepareCamera, params ) );
+ if ( err != KErrNone )
+ {
+ ShowOtherCameraNotUsableNoteL();
+ }
+ */
+ }
+
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdEnableVideoL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdEnableVideoL()
+ {
+ // if outgoing video is frozen
+ MVtEngMedia& media = iModel->Media();
+ if ( LcVtUtility::GetFreezeState( media ) )
+ {
+ ExecuteCmdL( KVtEngUnfreeze );
+ // swap images if needed
+ //RestoreViewFinderL();
+ }
+ else
+ {
+ ExecuteCmdL( KVtEngStopViewFinder );
+ //iUplinkWindow->SetStreamBitmap( NULL );
+ MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera;
+ ExecuteCmdL( KVtEngSetSource, source );
+ MVtEngMedia::TCameraId id;
+ if ( iModel->Media().GetCurrentCameraId( id ) == KErrInUse )
+ {
+ //ShowCameraInUseNoteL();
+ }
+ ExecuteCmdL( KVtEngStartViewFinder );
+ }
+ // update VB settings
+ //UpdateVBSettingL();
+ iLcVtStates->Update();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdDisableVideoL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdDisableVideoL()
+ {
+ ExecuteCmdL( KVtEngStopViewFinder );
+
+ //iUplinkWindow->SetStreamBitmap( NULL );
+
+ TInt err = KErrNotFound;
+ if ( LcVtUtility::HasStillImage( iModel->Media() ) )
+ {
+ __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.HasStill" )
+ MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaStillImage;
+ TRAP( err, ExecuteCmdL( KVtEngSetSource, source ) );
+ }
+ if ( ( err != KErrNone ) )
+ {
+ __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.MediaNone" )
+ MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone;
+ ExecuteCmdL( KVtEngSetSource, source );
+ }
+
+ ExecuteCmdL( KVtEngStartViewFinder );
+ iLcVtStates->Update();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdActivateLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdActivateLoudspeakerL()
+ {
+ MVtEngAudio::TVtEngRoutingSetting audioSetting =
+ MVtEngAudio::EActivateHandsfree;
+ ExecuteCmdL( KVtEngSetAudioRouting, audioSetting );
+ iLcVtStates->Update();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CmdDeactivateLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CmdDeactivateLoudspeakerL()
+ {
+ MVtEngAudio::TVtEngRoutingSetting audioSetting =
+ MVtEngAudio::EDeactivateHansfree;
+ ExecuteCmdL( KVtEngSetAudioRouting, audioSetting );
+ iLcVtStates->Update();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::SetZoomFactorL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::SetZoomFactorL( TInt aZoomStep )
+ {
+ __VTPRINTENTER( "CLcVtSessionCLcVtSession.SetZoomFactorL" )
+ MVtEngMedia& media = iModel->Media();
+ if ( LcVtUtility::IsZoomAllowed( media ) )
+ {
+ ExecuteCmdL( KVtEngSetZoomStep, aZoomStep );
+ }
+ __VTPRINTEXIT( "CLcVtSession.SetZoomFactorL" )
+ }
+
+#ifndef NGA_VIDEO_RENDER
+//local video display, VT use bitmaps vf now, and maybe replace by direct vf later
+void CLcVtSession::vtHandleFrameL( CFbsBitmap* aBitmap )
+ {
+ __VTPRINTENTER( "CLcVtSession.vtHandleFrameL" )
+
+ /*
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ const TPoint KVFcordinate( VFRect.iTl.iX, VFRect.iTl.iY );
+ iMainWindow->Invalidate();
+ iMainWindow->BeginRedraw();
+ iGc->Activate( *iMainWindow );
+ aBitmap->BeginDataAccess();
+ aBitmap->EndDataAccess();
+ iGc->BitBlt( KVFcordinate , aBitmap );
+ iGc->Deactivate();
+ iMainWindow->EndRedraw();
+ */
+
+ /*
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ const TPoint KVFcordinate( VFRect.iTl.iX -2 , VFRect.iTl.iY - 168 );
+ iLocalVideoWindow->Invalidate();
+ iLocalVideoWindow->BeginRedraw();
+ iGc->Activate( *iLocalVideoWindow );
+ iGc->BitBlt( KVFcordinate , aBitmap );
+ iGc->Deactivate();
+ iLocalVideoWindow->EndRedraw();
+ */
+
+ __VTPRINTEXIT("CLcVtSession.vtHandleFrameL")
+ }
+#endif
+
+TInt CLcVtSession::SetForegroundStatus( TBool aIsForeground )
+{
+ __VTPRINTENTER( "CLcVtSession.SetForegroundStatus" )
+ __VTPRINT2( DEBUG_MEDIA , " foreground: %d", aIsForeground )
+
+ if ( iRwGroup )
+ {
+ TInt priority = aIsForeground ? ECoeWinPriorityNormal : ECoeWinPriorityNeverAtFront;
+ iRwGroup->SetOrdinalPosition( 1 , priority );
+ iRemoteVideoWindow->SetOrdinalPosition( 1 , priority );
+ iLocalVideoWindow->SetOrdinalPosition( 1 , priority );
+ iRwSession.Flush();
+ }
+ __VTPRINTEXIT( "CLcVtSession.SetForegroundStatus" )
+
+ return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ShutdownL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ShutdownL()
+ {
+ __VTPRINTENTER( "CLcVtSession.ShutdownL" )
+ iActiveExec->Start( EVtSessionShutdown, *this );
+ __VTPRINTEXIT( "CLcVtSession.ShutdownL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::StartupPhase1L
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::StartupPhase1L()
+ {
+ __VTPRINTENTER( "CLcVtSession.StartupPhase1L" )
+ iActiveExec->Start( EVtSessionStartup, *this );
+ __VTPRINTEXIT( "CLcVtSession.StartupPhase1L" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::StartupPhase2L
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::StartupPhase2L()
+ {
+ __VTPRINTENTER( "CLcVtSession.StartupPhase2L" )
+ iActiveExec->Start( EVtSessionAnswered, *this );
+ __VTPRINTEXIT( "CLcVtSession.StartupPhase2L" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecExecuteL
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::ActiveExecExecuteL(
+ CLcVtActiveExec& /*aActiveExec*/,
+ const TInt aState,
+ TInt& aNextState,
+ TRequestStatus& aRequest )
+ {
+ return ActiveExecInitExecuteL(
+ aState,
+ aNextState,
+ aRequest );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecContinue
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::ActiveExecContinue(
+ CLcVtActiveExec& /*aActiveExec*/,
+ TInt& aState,
+ const TInt aError )
+ {
+ return ActiveExecInitContinue( aState, aError );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecCancel
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecCancel(
+ CLcVtActiveExec& /*aActiveExec*/,
+ TInt aState )
+ {
+ ActiveExecInitCancel( aState );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecDone
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecDone(
+ CLcVtActiveExec& /*aActiveExec*/,
+ const TInt aInitialState )
+ {
+ ActiveExecInitDone( aInitialState );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitCancel
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitCancel(
+ const TInt /*aState*/ )
+ {
+ __VTPRINTENTER( "CLcVtSession.InitExecCancel" )
+
+ delete iCmdExecutor;
+
+ if ( iShutdownRequest )
+ {
+ User::RequestComplete( iShutdownRequest, KErrCancel );
+ iShutdownRequest = NULL;
+ }
+ __VTPRINTEXIT( "CLcVtSession.InitExecCancel" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitDone
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitDone(
+ const TInt aInitialState )
+ {
+ __VTPRINTENTER( "CLcVtSession.ExecInitDone" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.InitExecDone.ini=%d", aInitialState )
+ // Operation succeeded
+
+ // Now we have finished.
+ if ( iState )
+ {
+ if ( aInitialState == EVtSessionAnswered )
+ {
+ TRAP_IGNORE( iState->LcVtStartupPhase2DoneL() );
+ iSessionState = EOpen;
+ iObserver->StateChanged( *this );
+ }
+ else if ( aInitialState == EVtSessionShutdown )
+ {
+ TRAP_IGNORE( iState->ShutdownDoneL() );
+ }
+ else // EVtSessionStartup
+ {
+ TRAP_IGNORE( iState->LcVtStartupPhase1DoneL() );
+ }
+ }
+ __VTPRINTEXIT( "CLcVtSession.ExecInitDone" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitExecuteL
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::ActiveExecInitExecuteL(
+ const TInt aState,
+ TInt& aNextState,
+ TRequestStatus& aRequest )
+ {
+ __VTPRINTENTER( "CLcVtSession.ActiveExecInitExecuteL" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.st=%d", aState )
+
+ TBool synch = EFalse;
+
+ switch ( aState )
+ {
+ // Startup chain:
+ case EVtSessionStartupInitEngine:
+ //ChangeApplicationFocus(ETrue);
+#if defined (__WINS__)
+ ActiveExecInitExecuteCommandL( KVtEngInitializeEngineDiag, aRequest );
+#else
+ ActiveExecInitExecuteCommandL( KVtEngInitializeEngine, aRequest );
+#endif
+ aNextState = EVtSessionStartupPrepareViewfinder;
+ //aNextState = EVtSessionStartupFinish;
+ break;
+
+ case EVtSessionStartupPrepareViewfinder:
+ //iSessionState = EOpen;
+ //iObserver->StateChanged( *this );
+
+#ifdef NGA_VIDEO_RENDER
+ CreateVideoWindowsL();
+#endif
+ ActiveExecInitPrepareViewFinderL( aRequest );
+ aNextState = EVtSessionStartupPrepareRemoteRender;
+ break;
+
+ case EVtSessionStartupPrepareRemoteRender:
+ ActiveExecInitPrepareRemoteRenderL( aRequest );
+ aNextState = EVtSessionStartupFinish;
+ break;
+
+ case EVtSessionStartupFinish:
+ aNextState = EVtSessionNone;
+ synch = ETrue;
+ break;
+
+
+ // Shutdown chain:
+ case EVtSessionShutdownHideApplication:
+ ChangeApplicationFocus( EFalse );
+ synch = ETrue;
+ aNextState = EVtSessionShutdownResetEngine;
+ break;
+ case EVtSessionShutdownResetEngine:
+ {
+ aRequest = KRequestPending;
+
+ MVtEngCommandHandler& command = iModel->CommandHandler();
+ // There should not be any commands ongoing because
+ // we have canceled all dialogs (and this should
+ // be the only command without dialog).
+ command.CancelCommand( command.PendingCommand() ); // ignore error
+ command.ExecuteL( KVtEngResetEngine, NULL );
+ iShutdownRequest = &aRequest;
+
+ aNextState = EVtSessionNone;
+ }
+ break;
+
+
+
+ // Answered chain:
+ case EVtSessionAnsweredStartRemoteRender:
+ {
+ ActiveExecInitExecuteCommandL( KVtEngStartRenderRemote, aRequest );
+ //TRequestStatus* status = &aRequest;
+ //User::RequestComplete( status, KErrNone );
+
+ MVtEngSessionInfo& session = iModel->Session();
+ MVtEngMedia& media = iModel->Media();
+ if ( LcVtUtility::HasCameras( media ) )
+ {
+ //aNextState = EVtSessionAnsweredDoPrepareCamera;
+ aNextState = EVtSessionAnsweredSetlectNone;
+ }
+ else
+ {
+ aNextState = EVtSessionAnsweredSetlectNone;
+ }
+ }
+ break;
+
+ case EVtSessionAnsweredSetlectNone:
+ {
+ ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest );
+ aNextState = EVtSessionAnsweredStartViewFinder;
+ }
+ break;
+ case EVtSessionAnsweredDoPrepareCamera:
+ {
+ MVtEngMedia& media = iModel->Media();
+ MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera;
+ ActiveExecInitPrepareCameraL( source, aRequest );
+ aNextState = EVtSessionAnsweredSetlectCamera;
+ }
+ break;
+
+ case EVtSessionAnsweredSetlectCamera:
+ ActiveExecInitSetSourceL( MVtEngMedia::EMediaCamera, aRequest );
+ aNextState = EVtSessionAnsweredStartViewFinder;
+ break;
+
+ case EVtSessionAnsweredStartViewFinder:
+ ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest );
+ aNextState = EVtSessionAnsweredBringToForeground;
+ break;
+
+ case EVtSessionAnsweredBringToForeground:
+ {
+ //CreateVideoWindowsL();
+
+ ChangeApplicationFocus(ETrue);
+ TRequestStatus* status = &aRequest;
+ User::RequestComplete( status, KErrNone );
+ aNextState = EVtSessionAnsweredFinish;
+ }
+ break;
+
+ case EVtSessionAnsweredFinish:
+ {
+ //iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNormal );
+
+ TBool handleAsForeground( ETrue );
+ TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ), sizeof( TBool ) );
+ MVtEngCommandHandler& command = iModel->CommandHandler();
+ TRAPD( err, command.ExecuteL( KVtEngSetUIForeground, ¶ms ));
+ if(err != KErrNone)
+ {
+ err = KErrNone;
+ }
+
+ iLcVtStates->Update();
+
+ iObserver->StateChanged( *iLocalVideoPlayer );
+ iObserver->StateChanged( *iRemoteVideoPlayer );
+
+ synch = ETrue;
+ aNextState = EVtSessionNone;
+ }
+ break;
+ }
+
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.sync=%d", synch )
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.next=%d", aNextState )
+ __VTPRINTEXITR( "CLcVtSession.ActiveExecInitExecuteL %d", synch )
+ return synch;
+
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitContinue
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::ActiveExecInitContinue(
+ TInt& aState,
+ const TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "CLcVtSession.InitExecCont" )
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.InitExecCont.st=%d", aState )
+
+ const TBool cont = EFalse;
+ __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.cont=%d", cont )
+
+ if ( !cont )
+ {
+ // Operation failed.
+ if ( iState )
+ {
+ TRAP_IGNORE( iState->LcVtStartupFailedL() );
+ }
+ }
+ __VTPRINTEXITR( "VtUi.InitExecCont %d", cont )
+ return cont;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitExecuteCommandL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitExecuteCommandL(
+ const TVtEngCommandId aCommand,
+ TRequestStatus& aRequest )
+ {
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ aCommand,
+ aRequest );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitPrepareViewFinderL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitPrepareViewFinderL(
+ TRequestStatus& aRequest )
+ {
+
+ __VTPRINTENTER( "CLcVtSession.ActiveExecInitPrepareViewFinderL" )
+
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ TSize size (VFRect.Size());
+
+#ifdef NGA_VIDEO_RENDER
+
+ __VTPRINT3(DEBUG_GEN, "CLcVtSession.ActiveExecInitPrepareViewFinderL size(%d,%d)", size.iWidth, size.iHeight )
+
+ iLocalVideoWindow->SetPosition( VFRect.iTl );
+ iLocalVideoWindow->SetSize( VFRect.Size() );
+
+ iRwSession.Flush();
+
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iX: %d", VFRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iY: %d", VFRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iWidth: %d", VFRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iHeight: %d", VFRect.Height() )
+
+ TVtEngRenderingOptionsNGA configViewfinder( *iLocalVideoWindow, iRwSession );
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareViewFinder,
+ configViewfinder,
+ aRequest );
+
+
+ /*
+ TPoint point( 0, 0 );
+ TRect vfRect( point, size );
+
+ TVtEngRenderingOptionsDSA configViewfinder(*iEventObserver, iRwSession ,*iDev, *iLocalVideoWindow, vfRect, vfRect);
+
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareViewFinderDSA,
+ configViewfinder,
+ aRequest );
+ */
+
+#else
+
+ __VTPRINT3(DEBUG_GEN, "CLcVtSession.ActiveExecInitPrepareViewFinderL size(%d,%d)", size.iWidth, size.iHeight )
+
+ TVtEngRenderingOptions configViewfinder(*iEventObserver, size);
+
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareViewFinder,
+ configViewfinder,
+ aRequest );
+
+#endif
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitPrepareRemoteRenderL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitPrepareRemoteRenderL(
+ TRequestStatus& aRequest )
+ {
+
+ TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect();
+ const TSize KRMsize( RMRect.Size());
+ TRect screen( KRMsize );
+ TRect clip( KRMsize );
+
+#ifdef NGA_VIDEO_RENDER
+
+ iRemoteVideoWindow->SetPosition( RMRect.iTl );
+ iRemoteVideoWindow->SetSize( RMRect.Size() );
+
+ iRwSession.Flush();
+
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iX: %d", RMRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iY: %d", RMRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iWidth: %d", RMRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iHeight: %d", RMRect.Height() )
+
+
+ TVtEngRenderingOptionsNGA configRemoteRender( *iRemoteVideoWindow, iRwSession );
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareRemoteRenderNGA,
+ configRemoteRender,
+ aRequest );
+
+#else
+
+ const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY );
+
+ TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate );
+
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareRemoteRenderDP,
+ configRemoteRender,
+ aRequest );
+
+#endif
+
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitPrepareCameraL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitPrepareCameraL(
+ const MVtEngMedia::TMediaSource aSource,
+ TRequestStatus& aRequest )
+ {
+ MVtEngMedia::TPrepareCameraParams params;
+ params.iMediaSource = aSource;
+ params.iInitialize = ETrue;
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngPrepareCamera,
+ params,
+ aRequest );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ActiveExecInitSetSourceL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ActiveExecInitSetSourceL(
+ const MVtEngMedia::TMediaSource aSource,
+ TRequestStatus& aRequest )
+ {
+ MVtEngMedia::TMediaSource source =
+ aSource;
+ iCmdExecutor =
+ ExecuteCmdAsyncL(
+ &iCmdExecutor,
+ KVtEngSetSource,
+ source,
+ aRequest );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor* CLcVtSession::ExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aDialogPtr,
+ const TVtEngCommandId aCommand,
+ TRequestStatus& aStatus )
+ {
+ return DoExecuteCmdAsyncL( aDialogPtr, aCommand, NULL, aStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+template< class T >
+CLcVtCmdExecutor* CLcVtSession::ExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aDialogPtr,
+ const TVtEngCommandId aCommand,
+ T& aParam,
+ TRequestStatus& aStatus )
+ {
+ TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) );
+ return DoExecuteCmdAsyncL( aDialogPtr, aCommand, ¶ms, aStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::DoExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+CLcVtCmdExecutor* CLcVtSession::DoExecuteCmdAsyncL(
+ CLcVtCmdExecutor** aDialogPtr,
+ const TVtEngCommandId aCommand,
+ TDesC8* aParams,
+ TRequestStatus& aStatus )
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.DoExecAsync.cmd=%d", aCommand )
+ MVtEngCommandHandler& command = iModel->CommandHandler();
+ const TInt caps = command.GetCommandCaps( aCommand );
+
+ if ( caps >= KErrNone )
+ {
+ const TBool asynchronous =
+ ( caps & MVtEngCommandHandler::EAttribAsync );
+
+ if ( asynchronous )
+ {
+ CLcVtCmdExecutor* executor =
+ new ( ELeave ) CLcVtCmdExecutor(
+ aDialogPtr,
+ iModel->CommandHandler(),
+ *iEventObserver );
+ executor->ExecuteCmdL( aCommand, aParams, &aStatus );
+ return executor;
+ }
+ else
+ {
+ command.ExecuteL( aCommand, aParams );
+ RefreshStatesL();
+ TRequestStatus* status = &aStatus;
+ User::RequestComplete( status, KErrNone );
+ }
+ }
+ else
+ {
+ // Failed.
+ User::Leave( caps );
+ }
+
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ExecuteCmdL( const TVtEngCommandId aCommand )
+ {
+ DoExecuteCmdL( aCommand, NULL );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+template< class T >
+void CLcVtSession::ExecuteCmdL(
+ const TVtEngCommandId aCommand,
+ T& aParam )
+ {
+ TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) );
+ DoExecuteCmdL( aCommand, ¶ms );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::DoExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::DoExecuteCmdL(
+ const TVtEngCommandId aCommand,
+ TDesC8* aParams )
+ {
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.DoExec.cmd=%d", aCommand )
+ MVtEngCommandHandler& command = iModel->CommandHandler();
+ const TInt caps = command.GetCommandCaps( aCommand );
+
+ if ( caps >= KErrNone )
+ {
+ const TBool asynchronous =
+ ( caps & MVtEngCommandHandler::EAttribAsync );
+
+ if ( asynchronous )
+ {
+ CLcVtCmdExecutor* executor =
+ new ( ELeave ) CLcVtCmdExecutor(
+ NULL,
+ iModel->CommandHandler(),
+ *iEventObserver );
+ iUiProvider->BlockUi(ETrue);
+ //executor->ExecuteCmdL( aCommand, aParams, NULL );
+ TRAPD( err, executor->ExecuteCmdL( aCommand, aParams, NULL ) );
+ iUiProvider->BlockUi(EFalse);
+ if(err != KErrNone)
+ User::Leave(err);
+
+ }
+ else
+ {
+ command.ExecuteL( aCommand, aParams );
+ RefreshStatesL();
+ }
+ }
+ else
+ {
+ // Failed.
+ User::Leave( caps );
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::Execute
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtSession::Execute( const TVtEngCommandId aCommand, TDesC8* aParam )
+ {
+ MVtEngCommandHandler& command = iModel->CommandHandler();
+ TRAPD( err, command.ExecuteL( aCommand, aParam ) );
+#ifdef VTDEBUG
+ if ( err != KErrNone )
+ {
+ __VTPRINT3( DEBUG_GEN, "CLcVtSession.Execute.Nok.cmd=%d,err=%d", aCommand, err )
+ }
+#endif // VTDEBUG
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ChangeApplicationFocus
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ChangeApplicationFocus( const TBool aForeground )
+ {
+ __VTPRINTENTER( "CLcVtSession.ChangeApplicationFocus" )
+ if ( iUiProvider ){
+ iUiProvider->HandleForegroundStatus(aForeground);
+ }
+ __VTPRINTEXIT( "CLcVtSession.ChangeApplicationFocus" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::ChangeState
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::ChangeState( TLcVtStateBase* aState )
+ {
+ __VTPRINTENTER( "CLcVtSession.ChangeState" )
+ iState = aState;
+ __VTPRINTEXIT( "CLcVtSession.ChangeState" )
+ }
+
+#if 0
+// -----------------------------------------------------------------------------
+// CLcVtSession::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::StartDtmfTone( const TChar& aTone )
+ {
+ // should be called only through current application state
+ iDtmfTone = aTone;
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.DTMF.Start.%d", iDtmfTone() )
+ if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone )
+ {
+ iDtmfTone = 0;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::StopDtmfTone()
+ {
+ // should be called only through current application state
+ if ( iDtmfTone() )
+ {
+ __VTPRINT( DEBUG_GEN, "CLcVtSession.DTMF.STOP" )
+ (void) Execute( KVtEngStopDtmfTone, NULL );
+ iDtmfTone = 0;
+ }
+ }
+#endif
+// -----------------------------------------------------------------------------
+// CLcVtSession::SetCallIdL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::SetCallIdL( const TInt aCallId )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::SetCallNameL
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtSession::SetCallNameL( const TDesC& aName )
+ {
+ HBufC* name = aName.AllocL();
+ delete iRemoteDisplayName;
+ iRemoteDisplayName = name;
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::SetCallNameL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::SetCallNumberL( const TDesC& aNumber )
+ {
+ HBufC* number = aNumber.AllocL();
+ delete iRemoteDetails;
+ iRemoteDetails = number;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::StartShutdown
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::StartShutdown()
+ {
+ __VTPRINTENTER( "CLcVtSession.StartShutdown" )
+ iSessionState = EClosing;
+ if ( iObserver != NULL )
+ {
+ iObserver->StateChanged( *this );
+ }
+ //iUiProvider->BlockUi(ETrue);
+ __VTPRINTEXIT( "CLcVtSession.StartShutdown" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::NumberSource
+// -----------------------------------------------------------------------------
+//
+TDesC* CLcVtSession::NumberSource() const
+ {
+ return NULL;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::RefreshL( const TInt aRefreshFlags )
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::RefreshStatesL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::RefreshStatesL()
+ {
+ __VTPRINTENTER( "CLcVtSession.RefreshStatesL" )
+ // If transaction (set of commands) is pending refresh in delayed until
+ // all of them are processed.
+ __VTPRINTEXIT( "CLcVtSession.RefreshStatesL" )
+ }
+
+#if 0
+// -----------------------------------------------------------------------------
+// CLcVtSession::HandleLayoutChanged
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtSession::HandleLayoutChanged()
+ {
+ __VTPRINTENTER( "CLcVtSession.HandleLayoutChanged" )
+ iLayoutChangeCallback->CallBack();
+ __VTPRINTEXIT( "CLcVtSession.HandleLayoutChanged" )
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::DelayedHandleLayoutChanged
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtSession::DelayedHandleLayoutChanged( TAny* aPtr )
+ {
+ __VTPRINTENTER( "CLcVtSession.DelayedHandleLayoutChanged" )
+ CLcVtSession* self = reinterpret_cast< CLcVtSession* > ( aPtr );
+ //self->iUiStates->SetDisableBlindSetting( ETrue );
+ TRAPD( err, self->HandleLayoutChangedL() );
+ //self->iUiStates->SetDisableBlindSetting( EFalse );
+ //self->RefreshBlind();
+ __VTPRINTENTER( "CLcVtSession.DelayedHandleLayoutChanged" )
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::HandleLayoutChangedL()
+ {
+ __VTPRINTENTER( "CLcVtSession.LayoutChg" )
+
+ if ( iState )
+ {
+ iState->HandleLayoutChangedL();
+ }
+
+ /*
+ if ( !iAllowVideoDlgShowed )
+ {
+ if ( iState )
+ {
+ iState->HandleLayoutChangedL();
+ }
+ }
+ else
+ {
+ iUiStates->SetLayoutChangeNeeded( EFalse );
+ DoHandleLayoutChangedL();
+ }
+ */
+ __VTPRINTEXIT( "CLcVtSession.LayoutChg" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::DoHandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::DoHandleLayoutChangedL()
+ {
+ __VTPRINTENTER( "CLcVtSession.DoLayoutChg" )
+
+ // Fully update rendering parameters
+ UpdateRenderingParametersL();
+ // Notify engine about layout change
+ //iLayoutChg = ETrue;
+ TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) );
+ //iLayoutChg = EFalse;
+
+ // Not ready error is allowed to happen (e.g. when sharing)
+ if ( error && ( error != KErrNotReady ) )
+ {
+ User::Leave( error );
+ }
+ else
+ {
+ __VTPRINT( DEBUG_GEN,
+ "CLcVtSession.DoLayoutChg KVtEngHandleLayoutChange == KErrNotReady (ok)" )
+ }
+
+ __VTPRINTEXIT( "CLcVtSession.DoLayoutChg" )
+ }
+#endif
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::UpdateRenderingParametersL
+// -----------------------------------------------------------------------------
+//
+#ifdef NGA_VIDEO_RENDER
+
+void CLcVtSession::UpdateRenderingParametersL()
+ {
+ __VTPRINTENTER( "CLcVtSession.UpdateRenderingParametersL" )
+
+ iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNormal );
+
+ TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect();
+ iRemoteVideoWindow->SetExtent( RMRect.iTl, RMRect.Size() );
+ iRemoteVideoWindow->SetOrdinalPosition( 1 , ECoeWinPriorityNeverAtFront );
+ iRemoteVideoWindow->SetTransparencyAlphaChannel();
+
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iX: %d", RMRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iY: %d", RMRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iWidth: %d", RMRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iHeight: %d", RMRect.Height() )
+
+
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ iLocalVideoWindow->SetExtent( VFRect.iTl, VFRect.Size() );
+ iLocalVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront );
+ iLocalVideoWindow->SetTransparencyAlphaChannel();
+
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iX: %d", VFRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iY: %d", VFRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iWidth: %d", VFRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iHeight: %d", VFRect.Height() )
+
+ iRwSession.Flush();
+
+ __VTPRINTEXIT( "CLcVtSession.UpdateRenderingParametersL" )
+
+ }
+
+
+#else
+
+void CLcVtSession::UpdateRenderingParametersL()
+ {
+
+ __VTPRINTENTER( "CLcVtSession.UpdateRenderingParametersL" )
+
+ MVtEngMedia& media = iModel->Media();
+ const TBool viewFinderStarted =
+ media.RenderingStarted( MVtEngMedia::EMediaOutgoing );
+ const TBool remoteRenderStarted =
+ media.RenderingStarted( MVtEngMedia::EMediaIncoming );
+
+ // Stop viewfinder & remote render.
+ if( viewFinderStarted )
+ {
+ ExecuteCmdL( KVtEngStopViewFinder );
+ }
+ ExecuteCmdL( KVtEngStopRenderRemote );
+
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ TSize size (VFRect.Size());
+
+ TVtEngRenderingOptions configViewfinder(*iEventObserver,size);
+
+ ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder );
+
+ // Prepare remote render.
+ TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect();
+ const TSize KRMsize( RMRect.Size());
+ TRect screen( KRMsize );
+ TRect clip( KRMsize );
+ const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY );
+
+ TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate );
+
+ TRAPD ( err, ExecuteCmdL(
+ KVtEngPrepareRemoteRenderDP,
+ configRemoteRender ) );
+
+ if ( err != KErrNone )
+ {
+ if ( viewFinderStarted )
+ {
+ // Start viewfinder.
+ ExecuteCmdL( KVtEngStartViewFinder );
+ }
+ User::Leave ( err );
+ }
+
+ // Start remote render.
+ TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) );
+
+ if ( viewFinderStarted )
+ {
+ // Start viewfinder.
+ ExecuteCmdL( KVtEngStartViewFinder );
+ }
+
+ __VTPRINTEXIT( "CLcVtSession.UpdateRenderingParametersL" )
+
+ }
+
+#endif
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::HandleEngineResetL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::HandleEngineResetL()
+ {
+ __VTPRINTENTER( "CLcVtSession.HandleEngineResetL" )
+ if ( iShutdownRequest )
+ {
+ __VTPRINT( DEBUG_GEN, " CLcVtSession.HandleEngineResetL shutdown" )
+ User::RequestComplete( iShutdownRequest, KErrNone );
+ iShutdownRequest = NULL;
+ }
+ __VTPRINTEXIT( "CLcVtSession.HandleEngineResetL" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::HandleShutdownReady
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::HandleShutdownReady()
+ {
+ __VTPRINTENTER( "CLcVtSession.HandleShutdownReady" )
+
+ if(iAsyncCallback->IsActive())
+ {
+ iAsyncCallback->Cancel();
+ }
+
+ iAsyncCallback->Set(
+ TCallBack( &DoExit, this ) );
+ iAsyncCallback->CallBack();
+ __VTPRINTEXIT( "CLcVtSession.HandleShutdownReady" )
+ }
+
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::DoExit
+// -----------------------------------------------------------------------------
+//
+TInt CLcVtSession::DoExit( TAny* aSession )
+ {
+ __VTPRINTENTER( "CLcVtSession.DoExit" )
+ CLcVtSession* self = static_cast< CLcVtSession* >( aSession );
+ self->iAsyncCallback->Cancel();
+ // Before exiting ensure there are no pending actions.
+ self->ActiveExecInitCancel( 0 );
+ self->CloseApp();
+ __VTPRINTEXIT( "CLcVtSession.DoExit" )
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CloseApp
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CloseApp()
+ {
+ __VTPRINTENTER( "CLcVtSession.CloseApp" )
+ //iUiProvider->BlockUi(EFalse);
+#if 0
+ if(iEventObserver)
+ {
+ delete iEventObserver;
+ iEventObserver = NULL;
+ }
+#endif
+ iSessionState = EClosed;
+ iObserver->StateChanged( *this );
+ __VTPRINTEXIT( "CLcVtSession.CloseApp" )
+ }
+
+// Implementation of CLcVtSession::CEventObserver
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::CEventObserver
+// -----------------------------------------------------------------------------
+//
+CLcVtSession::CEventObserver::CEventObserver( CLcVtSession& aSession )
+ :iSession(aSession),
+ iCommandObservers( KLcVtCommandObserverArrayGranularity )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CEventObserver::ConstructL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::NewL
+// -----------------------------------------------------------------------------
+//
+CLcVtSession::CEventObserver* CLcVtSession::CEventObserver::NewL( CLcVtSession& aSession )
+ {
+ CEventObserver* self = new ( ELeave ) CEventObserver(aSession );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::~CEventObserver
+// -----------------------------------------------------------------------------
+//
+CLcVtSession::CEventObserver::~CEventObserver()
+ {
+ iCommandObservers.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::AddObserverL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CEventObserver::AddObserverL(
+ MVtEngCommandObserver& aObserver )
+ {
+ User::LeaveIfError(
+ iCommandObservers.Append( &aObserver ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::CEventObserver::RemoveObserver
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::CEventObserver::RemoveObserver(
+ MVtEngCommandObserver& aObserver )
+ {
+ const TInt pos = iCommandObservers.Find( &aObserver );
+ if ( pos != KErrNotFound )
+ {
+ if ( !iInCommandPerformed )
+ {
+ iCommandObservers.Remove( pos );
+ }
+ else
+ {
+ iCommandObservers[ pos ] = NULL;
+ }
+ }
+ }
+
+
+void CLcVtSession::CEventObserver::HandleVtEventL( TInt aEvent )
+ {
+ __VTPRINTENTER( "CEventObserver.HandleVtEventL" )
+ __VTPRINT2( DEBUG_GEN, "CEventObserver.HandleVtEventL event=%d ",aEvent );
+
+ /** Allow application state to handle event first. It may also deny further
+ * handling by indicating the event was handled */
+ if ( iSession.iState &&
+ iSession.iState->HandleVtEventL( aEvent )
+ == TLcVtStateBase::EEventHandled )
+ {
+ __VTPRINTEXITR( "CEventObserver.HandleVtEventL %d", 0 )
+ return;
+ }
+
+ iSession.iLcVtStates->Update();
+
+ iSession.iObserver->Updated(*(iSession.iLocalVideoPlayer));
+ iSession.iObserver->Updated(*(iSession.iRemoteVideoPlayer));
+
+ __VTPRINTEXIT( "CEventObserver.HandleVtEventL" )
+ }
+
+void CLcVtSession::CEventObserver::HandleVTCommandPerformedL(
+ TVtEngCommandId aCommand,
+ const TInt aError )
+ {
+ __VTPRINTENTER( "CEventObserver.HandleVTCommandPerformedL" )
+ __VTPRINT3( DEBUG_GEN, "CEventObserver.HandleVTCommandPerformedL cmd=%d , result=%d",aCommand, aError );
+
+ if ( iSession.iState &&
+ iSession.iState->HandleVTCommandPerformedL( aCommand, aError ) ==
+ TLcVtStateBase::EEventHandled )
+ {
+ // state didn't allow further processing of command completion
+ __VTPRINTEXITR( "CEventObserver.HandleVTCommandPerformedL %d", 0 )
+ return;
+ }
+
+ iSession.RefreshStatesL();
+
+ iSession.iLcVtStates->Update();
+
+ const TInt count = iCommandObservers.Count();
+ TInt nullPosition = KErrNotFound;
+
+ iInCommandPerformed = ETrue;
+
+ // iInCommandPerformed equals ETrue while inside the following loop;
+ // Exceptions must not be raised.
+ for ( TInt index = 0; index < count; index++ )
+ {
+ MVtEngCommandObserver* obs = iCommandObservers[ index ];
+ if ( obs )
+ {
+ TRAP_IGNORE( obs->HandleVTCommandPerformedL( aCommand, aError ) );
+ }
+ else
+ {
+ // We store only one position; eventually all NULL elements of the
+ // array will be removed.
+ nullPosition = index;
+ }
+ }
+ iInCommandPerformed = EFalse;
+
+ if ( nullPosition != KErrNotFound )
+ {
+ iCommandObservers.Remove( nullPosition );
+ }
+
+
+ // Specific handling of some commands:
+ if ( aCommand == KVtEngResetEngine ) // Engine has been reset
+ {
+ //__ASSERT_ALWAYS( !aError, VtUiPanic::Panic( EVtUiPanicResetFailed ) );
+ iSession.HandleEngineResetL();
+ }
+
+
+ __VTPRINTEXITR( "CEventObserver.HandleVTCommandPerformedL %d", 1 )
+
+ }
+
+#ifndef NGA_VIDEO_RENDER
+void CLcVtSession::CEventObserver::vtHandleFrameL(
+ TFrameType aType,
+ CFbsBitmap* aBitmap )
+ {
+ iSession.vtHandleFrameL( aBitmap);
+ }
+
+void CLcVtSession::CEventObserver::vtSetFrame(
+ TFrameType aType,
+ CFbsBitmap* aBitmap )
+ {
+ }
+#endif
+
+TBool CLcVtSession::IsFeatureSupported( CLcEngine::TLcFeature aLcFeature )
+{
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsFeatureSupported feature=%d", aLcFeature)
+ TBool flag = EFalse;
+ switch ( aLcFeature )
+ {
+ case CLcEngine::ELcSendVideoQuery:
+ {
+ MVtEngSessionInfo::TDirection direction;
+ if ( iModel->Session().GetDirection( direction ) != KErrNone )
+ {
+ direction = MVtEngSessionInfo::EDirectionMT;
+ }
+ __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsFeatureSupported direction=%d", direction )
+ flag = ( direction == MVtEngSessionInfo::EDirectionMT );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // return feature not supported if not handled
+ return flag;
+}
+
+// End of file
+
+/*
+ *
+// -----------------------------------------------------------------------------
+// CLcVtSession::UpdateLocalVideoRenderParamL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::UpdateLocalVideoRenderParamL()
+ {
+ __VTPRINTENTER( "CLcVtSession.UpdateLocalVideoRenderParamL" )
+
+ if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning )
+ {
+ __VTPRINTEXIT( "CLcVtSession.UpdateLocalVideoRenderParamL -- not running state" )
+ return;
+ }
+
+ MVtEngMedia& media = Model().Media();
+ const TBool viewFinderStarted =
+ media.RenderingStarted( MVtEngMedia::EMediaOutgoing );
+
+ if( viewFinderStarted )
+ {
+ ExecuteCmdL( KVtEngStopViewFinder );
+ }
+
+ TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect();
+ TSize size (VFRect.Size());
+
+ TVtEngRenderingOptions configViewfinder(*iEventObserver,size);
+
+ ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder );
+
+ if ( viewFinderStarted )
+ {
+ // Start viewfinder.
+ ExecuteCmdL( KVtEngStartViewFinder );
+ }
+
+ __VTPRINTEXIT( "CLcVtSession.UpdateLocalVideoRenderParamL" )
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::UpdateRemoteVideoRenderParamL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::UpdateRemoteVideoRenderParamL()
+ {
+ __VTPRINTENTER( "CLcVtSession.UpdateRemoteVideoRenderParamL" )
+
+ if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning )
+ {
+ __VTPRINTEXIT( "CLcVtSession.UpdateRemoteVideoRenderParamL -- not running state" )
+ return;
+ }
+
+ MVtEngMedia& media = Model().Media();
+ const TBool remoteRenderStarted =
+ media.RenderingStarted( MVtEngMedia::EMediaIncoming );
+
+ ExecuteCmdL( KVtEngStopRenderRemote );
+
+ TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect();
+ const TSize KRMsize( RMRect.Size());
+ TRect screen( KRMsize );
+ TRect clip( KRMsize );
+ const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY );
+
+ __VTPRINT2( DEBUG_MEDIA , " RMRect.iTl.iX: %d", RMRect.iTl.iX)
+ __VTPRINT2( DEBUG_MEDIA , " RMRect.iTl.iY: %d", RMRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " RMRect.iWidth: %d", RMRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " RMRect.iHeight: %d", RMRect.Height() )
+
+ TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate );
+
+ ExecuteCmdL(
+ KVtEngPrepareRemoteRenderDP,
+ configRemoteRender );
+
+ TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) );
+
+ __VTPRINTEXIT( "CLcVtSession.UpdateRemoteVideoRenderParamL" )
+
+ }
+
+// -----------------------------------------------------------------------------
+// CLcVtSession::LayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void CLcVtSession::LayoutChangedL()
+ {
+ __VTPRINTENTER( "CLcVtSession.LayoutChangedL" )
+
+ if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning )
+ {
+ __VTPRINTEXIT( "CLcVtSession.LayoutChangedL -- not running state" )
+ return;
+ }
+
+ TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) );
+
+ __VTPRINTEXIT( "CLcVtSession.LayoutChangedL" )
+ }
+
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/base/dllmain.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* ==============================================================================
+* Name : dllmain.cpp
+* Part of :
+* Description :
+* Version :
+*
+* Copyright ?2004 Nokia Corporation.
+* This material, including documentation and any related
+* computer programs, is protected by copyright controlled by
+* Nokia Corporation. All rights are reserved. Copying,
+* including reproducing, storing, adapting or translating, any
+* or all of this material requires the prior written consent of
+* Nokia Corporation. This material also contains confidential
+* information which may not be disclosed to others without the
+* prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "clcvtengine.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy Implementations[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x20021342, CLcVtEngine::NewL )
+ };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+//
+// Exported proxy for instantiation method resolution
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aCount )
+ {
+ aCount = sizeof( Implementations ) / sizeof( TImplementationProxy );
+ return Implementations;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/common/lcvtutility.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,319 @@
+/*
+* 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: Implementation of the VtUiUtility class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "lcvtutility.h"
+#include <featmgr.h>
+#include <mvtengmedia.h>
+#include <cvtlogger.h>
+
+// Characters to open number entry.
+//_LIT( KVtUiDTMFCharacters, "0123456789*#" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetAudioRoutingAvailability
+// -----------------------------------------------------------------------------
+//
+void LcVtUtility::GetAudioRoutingAvailability(
+ MVtEngAudio& aAudio,
+ TInt& aAvailable )
+ {
+ aAvailable = 0;
+ //const TBool bluetoothAudioSupported = ETrue;
+
+ MVtEngAudio::TAudioRoutingState routingState;
+ if ( aAudio.GetRoutingState( routingState ) == KErrNone )
+ {
+ // Deactivate BT handsfree.
+ if ( /*bluetoothAudioSupported &&*/
+ IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioBT,
+ MVtEngAudio::EAudioHandset ) )
+ {
+ aAvailable |= EDeactivateBtHandsfree;
+ }
+
+ // Activate BT handsfree.
+ if ( /*bluetoothAudioSupported &&*/
+ ( IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioHandset,
+ MVtEngAudio::EAudioBT ) ||
+ IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioLoudspeaker,
+ MVtEngAudio::EAudioBT ) ) )
+ {
+ aAvailable |= EActivateBtHandsfree;
+ }
+
+ // Deactivate loudspeaker
+ if ( IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioLoudspeaker,
+ MVtEngAudio::EAudioHandset ) )
+ {
+ aAvailable |= EDeactivateLoudspeaker;
+ }
+
+ // Activate loudspeaker
+ if ( IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioHandset,
+ MVtEngAudio::EAudioLoudspeaker ) ||
+ ( /*bluetoothAudioSupported &&*/
+ IsAudioRoutingAvailable(
+ aAudio,
+ routingState,
+ MVtEngAudio::EAudioBT,
+ MVtEngAudio::EAudioLoudspeaker ) ) )
+ {
+ aAvailable |= EActivateLoudspeaker;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetOutgoingMediaState
+// -----------------------------------------------------------------------------
+//
+void LcVtUtility::GetOutgoingMediaState(
+ MVtEngMedia& aMedia,
+ TInt& aAvailable )
+ {
+ TInt outgoingMediaState;
+ const TInt err =
+ aMedia.GetMediaState(
+ MVtEngMedia::EMediaOutgoing,
+ outgoingMediaState );
+ if ( err == KErrNone )
+ {
+ // If source is still image, then video sending is off.
+ MVtEngMedia::TMediaSource source;
+ if ( aMedia.GetSource( source ) == KErrNone )
+ {
+ if ( source == MVtEngMedia::EMediaStillImage )
+ {
+ outgoingMediaState &= ~MVtEngMedia::EMediaVideo;
+ }
+ }
+ TBool freezeSupported;
+ if( aMedia.GetFreezeSupported( freezeSupported ) == KErrNone )
+ {
+ TBool isFrozen;
+ if( freezeSupported && aMedia.GetFreezeState( isFrozen ) == KErrNone )
+ {
+ if( isFrozen )
+ {
+ outgoingMediaState &= ~MVtEngMedia::EMediaVideo;
+ }
+ }
+ }
+ }
+ else
+ {
+ outgoingMediaState =
+ ( MVtEngMedia::EMediaAudio | MVtEngMedia::EMediaVideo );
+ }
+ aAvailable = outgoingMediaState;
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetIncomingMediaState
+// -----------------------------------------------------------------------------
+//
+void LcVtUtility::GetIncomingMediaState(
+ MVtEngMedia& aMedia,
+ TInt& aAvailable )
+ {
+ TInt mediaState;
+ const TInt err =
+ aMedia.GetMediaState(
+ MVtEngMedia::EMediaIncoming,
+ mediaState );
+ if ( err != KErrNone )
+ {
+ mediaState =
+ ( MVtEngMedia::EMediaAudio | MVtEngMedia::EMediaVideo );
+ }
+
+ aAvailable = mediaState;
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::HasStillImage
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::HasStillImage(
+ MVtEngMedia& aMedia )
+ {
+ TInt caps;
+ const TInt capsErr = aMedia.GetSourcesCaps( caps );
+ return ( capsErr == KErrNone ) &&
+ ( caps & MVtEngMedia::ESourceCapsStillImage );
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetFreezeState
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::GetFreezeState(
+ MVtEngMedia& aMedia )
+ {
+ TBool isFrozen;
+ const TInt err = aMedia.GetFreezeState( isFrozen );
+ if ( err == KErrNone )
+ {
+ return isFrozen;
+ }
+ else //provider was not ready
+ {
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::IsFreezeSupported
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::IsFreezeSupported(
+ MVtEngMedia& aMedia )
+ {
+ TBool isFreezeSupported;
+ const TInt err = aMedia.GetFreezeSupported( isFreezeSupported );
+ if ( err == KErrNone )
+ {
+ return isFreezeSupported;
+ }
+ else //provider was not ready
+ {
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetVideoQuality
+// -----------------------------------------------------------------------------
+//
+void LcVtUtility::GetVideoQuality(
+ MVtEngMedia& aMedia,
+ MVtEngMedia::TVideoQuality& aVideoQuality )
+ {
+ aMedia.GetVideoQuality( aVideoQuality );
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void LcVtUtility::GetObjectSharingState(
+ MVtEngMedia& aMedia,
+ MVtEngMedia::TShareObjectState& aShareObjectState )
+ {
+ aMedia.GetObjectSharingState( aShareObjectState );
+ }
+
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::IsZoomAllowed
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::IsZoomAllowed(
+ MVtEngMedia& aMedia )
+ {
+ TBool result = EFalse;
+
+ TInt currentStep;
+ if ( aMedia.GetCurrentZoomStep( currentStep ) == KErrNone )
+ {
+ TInt max;
+ if ( aMedia.GetMaxZoomStep( max ) == KErrNone )
+ {
+ // Zooming is allowed if maximum zoom step is greater than
+ // zero and camera is in use (and not still image / none).
+ TInt avail;
+ GetOutgoingMediaState( aMedia, avail );
+
+ result = ( max > 0 ) && ( avail & MVtEngMedia::EMediaVideo );
+ }
+ }
+
+ __VTPRINT2( DEBUG_GEN, "Ui.AllowZoom.%d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::HasCameras
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::HasCameras( MVtEngMedia& aMedia )
+ {
+ TInt sourceCaps;
+ if ( aMedia.GetSourcesCaps( sourceCaps ) != KErrNone )
+ {
+ sourceCaps = 0;
+ }
+ return ( sourceCaps & MVtEngMedia::ESourceCapsPrimaryCamera ) ||
+ ( sourceCaps & MVtEngMedia::ESourceCapsSecondaryCamera );
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::IsAudioRoutingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::IsAudioRoutingAvailable(
+ MVtEngAudio& aAudio,
+ const MVtEngAudio::TAudioRoutingState aCurrent,
+ const MVtEngAudio::TAudioRoutingState aSource,
+ const MVtEngAudio::TAudioRoutingState aTarget )
+ {
+ TBool result = EFalse;
+ if ( aCurrent == aSource )
+ {
+ TBool available = EFalse;
+ TInt err = aAudio.GetRoutingAvailability( aTarget, available );
+
+ result = ( ( err == KErrNone ) && ( available ) );
+ }
+
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// LcVtUtility::IsDTMFCharacter
+// -----------------------------------------------------------------------------
+//
+TBool LcVtUtility::IsDTMFCharacter( const TChar aChar )
+ {
+ return EFalse;
+ /*
+ return
+ ( KVtUiDTMFCharacters().Locate( aChar ) != KErrNotFound );
+ */
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/common/tlcvtaudiostate.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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: Audio state class.
+*
+*/
+
+
+#include <cvtengmodel.h>
+
+#include "tlcvtaudiostate.h"
+#include "lcvtutility.h"
+
+// -----------------------------------------------------------------------------
+// TLcVtAudioState::UpdateFlags
+// -----------------------------------------------------------------------------
+//
+void TLcVtAudioState::UpdateFlags()
+ {
+ TInt avail( 0 );
+
+ LcVtUtility::GetAudioRoutingAvailability( iModel.Audio(), avail );
+
+ const TBool videoCallConnected ( iModel.Media().VideoCallConnected());
+ //Before update AudioRouting, video call state must to be checked.
+ //AudioRouting can not be changed if call is not in EConnected state.
+ if ( videoCallConnected )
+ {
+ if ( avail & LcVtUtility::EDeactivateBtHandsfree )
+ {
+ SetFlag( ECanDeactivateBtHf );
+ }
+ if ( avail & LcVtUtility::EActivateBtHandsfree )
+ {
+ SetFlag( ECanActivateBtHf );
+ }
+ if ( avail & LcVtUtility::EDeactivateLoudspeaker )
+ {
+ SetFlag( ECanDeactivateLoudspeaker );
+ }
+ if ( avail & LcVtUtility::EActivateLoudspeaker )
+ {
+ SetFlag( ECanActivateLoudspeaker );
+ }
+ }
+
+ LcVtUtility::GetOutgoingMediaState( iModel.Media(), avail );
+
+ if ( avail & MVtEngMedia::EMediaAudio )
+ {
+ SetFlag( EIsAudio );
+ }
+
+ TInt status ( 0 );
+ iModel.Media().GetMediaState( MVtEngMedia::EMediaOutgoing, status );
+ if ( !(status & MVtEngMedia::EMediaAudioChannelOpen ) )
+ {
+ SetFlag( EIsAudioPermanentlyStopped );
+ }
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/common/tlcvtmediastate.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* 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: Media state class.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <mvtengmedia.h>
+#include <mvtengcommandhandler.h>
+
+#include "tlcvtmediastate.h"
+#include "lcvtutility.h"
+
+// -----------------------------------------------------------------------------
+// TLcVtMediaState::UpdateFlags
+// -----------------------------------------------------------------------------
+//
+void TLcVtMediaState::UpdateFlags()
+ {
+ __VTPRINTENTER( "MediaState.UpdateFlags" )
+ TInt avail( 0 );
+
+ LcVtUtility::GetOutgoingMediaState( iMedia, avail );
+
+ if ( avail & MVtEngMedia::EMediaVideo )
+ {
+ SetFlag( EIsVideo );
+ }
+
+ if ( LcVtUtility::HasCameras( iMedia ) )
+ {
+ SetFlag( EHasCamera );
+ }
+
+ if ( LcVtUtility::IsFreezeSupported( iMedia ) )
+ {
+ SetFlag( EIsFreezeSupported );
+ }
+
+ if ( LcVtUtility::GetFreezeState( iMedia ) )
+ {
+ SetFlag( EIsFrozen );
+ }
+
+ MVtEngMedia::TShareObjectState shareObjectState;
+ LcVtUtility::GetObjectSharingState( iMedia, shareObjectState );
+
+ if ( shareObjectState == MVtEngMedia::ESharingImage )
+ {
+ SetFlag( EIsSharing );
+ }
+ else if ( ( shareObjectState == MVtEngMedia::EInitializingShareImage ) ||
+ ( shareObjectState == MVtEngMedia::EInitializingShareVideoClip ) )
+ {
+ SetFlag( EIsInitializingShare );
+ }
+ else if ( shareObjectState == MVtEngMedia::ENotAbleToShare )
+ {
+ SetFlag( EIsNotAbleToShare );
+ }
+ // Camera configuration
+
+ MVtEngMedia::TCameraId cameraId;
+ TInt err = iMedia.GetCurrentCameraId( cameraId );
+
+ // Don't care if camera is not ready, just what is selected camera
+ if ( err == KErrNone || err == KErrNotReady )
+ {
+ SetFlag( ( cameraId == MVtEngMedia::EPrimaryCamera ) ?
+ EIsPrimaryCameraInUse : EIsSecondaryCameraInUse );
+ }
+
+ TInt sourcesCaps( 0 );
+ iMedia.GetSourcesCaps( sourcesCaps );
+ if ( sourcesCaps & MVtEngMedia::ESourceCapsPrimaryCamera )
+ {
+ SetFlag( EHasPrimaryCamera );
+ }
+ if ( sourcesCaps & MVtEngMedia::ESourceCapsSecondaryCamera )
+ {
+ SetFlag( EHasSecondaryCamera );
+ }
+
+ TInt status ( 0 );
+ iMedia.GetMediaState( MVtEngMedia::EMediaOutgoing, status );
+ if ( !( status & MVtEngMedia::EMediaVideoChannelOpen ) )
+ {
+ SetFlag( EIsVideoPermanentlyStopped );
+ }
+
+ __VTPRINTEXITR( "MediaState.UpdateFlags bits = %b", Value() )
+
+ // Video preferences
+/*
+ TInt caps( iCommandHandler.GetCommandCaps( KVtEngSetContrast ) );
+ if ( caps & MVtEngCommandHandler::EAttribEnabled )
+ {
+ SetFlag( EIsContrastSupported );
+ }
+
+ caps = iCommandHandler.GetCommandCaps( KVtEngSetBrightness );
+ if ( caps & MVtEngCommandHandler::EAttribEnabled )
+ {
+ SetFlag( EIsBrightnessSupported );
+ }
+
+ caps = iCommandHandler.GetCommandCaps( KVtEngSetWhiteBalance );
+ if ( caps & MVtEngCommandHandler::EAttribEnabled )
+ {
+ SetFlag( EIsWhiteBalanceSupported );
+ }
+
+ caps = iCommandHandler.GetCommandCaps( KVtEngSetColorTone );
+ if ( caps & MVtEngCommandHandler::EAttribEnabled )
+ {
+ SetFlag( EIsColorToneSupported );
+ }
+
+*/
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/common/tlcvtstates.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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: Video UI states class.
+*
+*/
+
+
+#include <cvtengmodel.h>
+#include <mvtengcamerapreferences.h>
+#include <cvtlogger.h>
+
+#include "tlcvtstates.h"
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::TLcVtStates
+// -----------------------------------------------------------------------------
+//
+TLcVtStates::TLcVtStates( CVtEngModel& aModel )
+ : iMediaState( aModel.Media(), aModel.CommandHandler() ), iAudioState( aModel ),
+ iModel( aModel ), iExecState( EExecStateStarting)
+ {
+ // get camera preferences
+ iCameraPref = static_cast<MVtEngCameraPreferences*>
+ ( iModel.Extension( KVtEngExtensionCameraPreferences ) );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::Update
+// -----------------------------------------------------------------------------
+//
+void TLcVtStates::Update()
+ {
+ __VTPRINTENTER( "TLcVtStates.Update" )
+ iMediaState.Update();
+ iAudioState.Update();
+ __VTPRINTEXIT( "TLcVtStates.Update" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsColorToneSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsColorToneSettingAvailable() const
+ {
+ __VTPRINTENTER( "TLcVtStates.IsColorToneSettingAvailable" )
+ TUint32 supportedModes;
+ // Get supported whitebalance modes
+ if ( iCameraPref )
+ {
+ if ( iCameraPref->GetSupportedColorTones( supportedModes ) )
+ {
+ // error occured
+ __VTPRINTEXIT( "TLcVtStates.IsColorToneSettingAvailableErr" )
+ return EFalse;
+ }
+ }
+
+ // Clean the flag, flags that are possible are
+ // A bitfield of suported colortones
+ // ENormal = 0x00,
+ // ESepia = 0x01,
+ // EGrayscale = 0x02,
+ // ENegative = 0x04
+ supportedModes &= 0x07;
+
+ // If supported modes is 0 automatic,then return EFalse
+ __VTPRINTEXIT( "TLcVtStates.IsColorToneSettingAvailable" )
+ return supportedModes;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsWhiteBalanceSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsWhiteBalanceSettingAvailable() const
+ {
+ __VTPRINTENTER( "TLcVtStates.IsWhiteBalanceSettingAvailable" )
+ TUint32 supportedModes;
+ // Get supported whitebalance modes
+ if ( iCameraPref )
+ {
+ if ( iCameraPref->GetSupportedWhiteBalanceModes( supportedModes ) )
+ {
+ // error occured
+ __VTPRINTEXIT( "TLcVtStates.IsWhiteBalanceSettingAvailableErr" )
+ return EFalse;
+ }
+ }
+ __VTPRINT2( DEBUG_GEN, "IsWhiteBalanceSettingAvailable=%d", supportedModes )
+ // If supported modes is 0 ,then return EFalse
+ __VTPRINTEXIT( "TLcVtStates.IsWhiteBalanceSettingAvailable2" )
+ return supportedModes;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsContrastSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsContrastSettingAvailable() const
+ {
+ __VTPRINTENTER( "TLcVtStates.IsContrastSettingAvailable" )
+ TBool ret( ETrue );
+ if ( iCameraPref )
+ {
+ TInt temp;
+ ret = !iCameraPref->GetContrast( temp );
+ }
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStates::IsBrightnessSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStates::IsBrightnessSettingAvailable() const
+ {
+ __VTPRINTENTER( "TLcVtStates.IsBrightnessSettingAvailable" )
+ TBool ret( ETrue );
+ if ( iCameraPref )
+ {
+ TInt temp;
+ ret = !iCameraPref->GetBrightness( temp );
+ }
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/control/clcvtlocalvideoplayer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* 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: LiveComm Videotelephony's Local Video Player
+*
+*/
+
+#include "clcvtlocalvideoplayer.h"
+#include "tlcvtcamerahandler.h"
+#include "lcvtplugincommand.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+
+CLcVtLocalVideoPlayer* CLcVtLocalVideoPlayer::NewL(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl,
+ TVtCameraHandler& aCameraHandler)
+ {
+ CLcVtLocalVideoPlayer* self =
+ new( ELeave )CLcVtLocalVideoPlayer(
+ avtSession,
+ aLcAudioControl,
+ aCameraHandler);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtLocalVideoPlayer::CLcVtLocalVideoPlayer(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl,
+ TVtCameraHandler& aCameraHandler) :
+ CLcVtVideoPlayerBase( avtSession, aLcAudioControl ),
+ iCameraHandler( aCameraHandler )
+ {
+ iIsPlaying = ETrue;
+ iOrientationChanged = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CLcVtLocalVideoPlayer::ConstructL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtLocalVideoPlayer::~CLcVtLocalVideoPlayer()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcVideoPlayer::TLcVideoPlayerState
+CLcVtLocalVideoPlayer::LcVideoPlayerState() const
+ {
+ TLcVideoPlayerState playerState = MLcVideoPlayer::EPlaying;
+ return playerState;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtLocalVideoPlayer::LcIsPlayingL()
+ {
+ TBool result = ivtSession->LcVtStates().MediaState().IsVideo();
+ __VTPRINT2( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcIsPlayingL = %d", result )
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+void CLcVtLocalVideoPlayer::LcPlayL(TLcVideoPlayerSource /*aSource*/)
+ {
+ __VTPRINT( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcPlayL" )
+ iIsPlaying = ETrue;
+ ivtSession->HandleCommandL(EPluginCmdEnableVideo);
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+void CLcVtLocalVideoPlayer::LcPauseL()
+ {
+ __VTPRINT( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcPauseL" )
+ iIsPlaying = EFalse;
+ ivtSession->HandleCommandL(EPluginCmdDisableVideo);
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcCameraControl* CLcVtLocalVideoPlayer::LcCameraControl()
+ {
+ return &iCameraHandler;
+ }
+
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcZoomControl* CLcVtLocalVideoPlayer::LcZoomControl()
+ {
+ return &iCameraHandler;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcBrightnessControl* CLcVtLocalVideoPlayer::LcBrightnessControl()
+ {
+ return &iCameraHandler;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtLocalVideoPlayer::SetLcWindowRectL( TRect aRect )
+ {
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.RMRect.iTl.iX: %d", aRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.RMRect.iTl.iY: %d", aRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.RMRect.iWidth: %d", aRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.RMRect.iHeight: %d", aRect.Height() )
+
+ CLcVtVideoPlayerBase::SetLcWindowRectL( aRect );
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtLocalVideoPlayer::SetLcWindowOrientationL( TLcWindowOrientation aOrientation )
+ {
+ __VTPRINT2( DEBUG_MEDIA , "CLcVtLocalVideoPlayer.SetLcWindowOrientationL: %d", aOrientation )
+ iOrientationChanged = EFalse;
+ if( aOrientation != iWindowOrientation )
+ iOrientationChanged = ETrue;
+ CLcVtVideoPlayerBase::SetLcWindowOrientationL( aOrientation );
+ }
+
+TBool CLcVtLocalVideoPlayer::IsOrientationChanged()
+ {
+ return iOrientationChanged;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/control/clcvtremotevideoplayer.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* 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: LiveComm Videotelephony's Remte Video Player
+*
+*/
+
+#include "clcvtremotevideoplayer.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtRemoteVideoPlayer* CLcVtRemoteVideoPlayer::NewL(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl )
+ {
+ CLcVtRemoteVideoPlayer* self =
+ new( ELeave ) CLcVtRemoteVideoPlayer( avtSession, aLcAudioControl );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtRemoteVideoPlayer::CLcVtRemoteVideoPlayer(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl ) :
+ CLcVtVideoPlayerBase( avtSession, aLcAudioControl )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CLcVtRemoteVideoPlayer::ConstructL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtRemoteVideoPlayer::~CLcVtRemoteVideoPlayer()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcVideoPlayer::TLcVideoPlayerState
+CLcVtRemoteVideoPlayer::LcVideoPlayerState() const
+ {
+ TLcVideoPlayerState playerState = MLcVideoPlayer::EPlaying;
+ return playerState;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtRemoteVideoPlayer::LcIsPlayingL()
+ {
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtRemoteVideoPlayer::SetLcWindowRectL( TRect aRect )
+ {
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iX: %d", aRect.iTl.iX )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iY: %d", aRect.iTl.iY )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iWidth: %d", aRect.Width() )
+ __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iHeight: %d", aRect.Height() )
+
+ CLcVtVideoPlayerBase::SetLcWindowRectL( aRect );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/control/clcvtvideoplayerbase.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* 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: LiveComm Videotelephony's Video Player Base Class
+*
+*/
+
+#include "clcvtvideoplayerbase.h"
+#include "clcvtsession.h"
+
+
+CLcVtVideoPlayerBase::CLcVtVideoPlayerBase(
+ CLcVtSession* avtSession,
+ MLcAudioControl& aLcAudioControl ) :
+ ivtSession( avtSession ),
+ iLcAudioControl( aLcAudioControl )
+ {
+ iIsWindowEnabled = ETrue;
+ iWindowOrientation = MLcWindow::EPortrait;
+ }
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CLcVtVideoPlayerBase::~CLcVtVideoPlayerBase()
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+#if 0
+MLcVideoPlayer::TLcVideoPlayerState
+CLcVtVideoPlayerBase::LcVideoPlayerState() const
+ {
+ return MLcVideoPlayer::EUnavailable;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtVideoPlayerBase::LcIsPlayingL()
+ {
+ return EFalse;
+ }
+#endif
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+void CLcVtVideoPlayerBase::LcPlayL( TLcVideoPlayerSource /*aSource*/ )
+ {
+ // NOP
+ __VTPRINT( DEBUG_GEN, "CLcVtVideoPlayerBase.LcPlayL" )
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+void CLcVtVideoPlayerBase::LcPauseL()
+ {
+ // NOP
+ __VTPRINT( DEBUG_GEN, "CLcVtVideoPlayerBase.LcPauseL" )
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcWindow* CLcVtVideoPlayerBase::LcWindow()
+ {
+ return this;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcCameraControl* CLcVtVideoPlayerBase::LcCameraControl()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcSourceFileControl* CLcVtVideoPlayerBase::LcSourceFileControl()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcDestinationFileControl* CLcVtVideoPlayerBase::LcDestinationFileControl()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcAudioControl* CLcVtVideoPlayerBase::LcAudioControl()
+ {
+ return &iLcAudioControl;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcZoomControl* CLcVtVideoPlayerBase::LcZoomControl()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcVideoPlayer
+// -----------------------------------------------------------------------------
+//
+MLcBrightnessControl* CLcVtVideoPlayerBase::LcBrightnessControl()
+ {
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtVideoPlayerBase::EnableLcWindowL( TBool aEnable )
+ {
+ iIsWindowEnabled = aEnable;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+TBool CLcVtVideoPlayerBase::IsLcWindowEnabled()
+ {
+ return iIsWindowEnabled;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtVideoPlayerBase::SetLcWindowRectL( TRect aRect )
+ {
+ iWindowRect = aRect;
+ }
+
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+TRect CLcVtVideoPlayerBase::LcWindowRect()
+ {
+ return iWindowRect;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+void CLcVtVideoPlayerBase::SetLcWindowOrientationL(
+ TLcWindowOrientation aOrientation )
+ {
+ iWindowOrientation = aOrientation;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcWindow
+// -----------------------------------------------------------------------------
+//
+MLcWindow::TLcWindowOrientation CLcVtVideoPlayerBase::LcWindowOrientationL()
+ {
+ return iWindowOrientation;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/control/tlcvtcamerahandler.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,239 @@
+/*
+* 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: LiveComm Videotelephony's Camera Handler
+*
+*/
+
+
+#include "tlcvtcamerahandler.h"
+#include "clcvtsession.h"
+#include "tlcvtstates.h"
+#include "lcvtplugincommand.h"
+#include "lcvtutility.h"
+#include "cvtengmodel.h"
+
+
+TVtCameraHandler::TVtCameraHandler() :
+ivtSession( NULL )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcCameraControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::LcCameraCountL()
+ {
+ return 2;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcCameraControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::CurrentLcCameraIndex()
+ {
+ if(ivtSession->LcVtStates().MediaState().IsPrimaryCameraInUse())
+ return EFrontCamera;
+
+ return EBackCamera;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcCameraControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::ToggleLcCameraL()
+ {
+ if(ivtSession->LcVtStates().MediaState().IsPrimaryCameraInUse())
+ ivtSession->HandleCommandL(EPluginCmdUseSecondaryCamera);
+ else
+ ivtSession->HandleCommandL(EPluginCmdUsePrimaryCamera);
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::MinLcBrightnessL()
+ {
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::MaxLcBrightnessL()
+ {
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::LcBrightnessL()
+ {
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::SetLcBrightnessL( TInt aValue )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::IncreaseLcBrightnessL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcBrightnessControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::DecreaseLcBrightnessL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::MinLcZoomL()
+ {
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::MaxLcZoomL()
+ {
+ MVtEngMedia& media = ivtSession->Model().Media();
+
+ if(!LcVtUtility::IsZoomAllowed(media))
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.MaxLcZoomL ZoomNotAllow" )
+ return 0;
+ }
+
+ TInt max( 0 );
+ const TInt error( media.GetMaxZoomStep( max ) );
+ max = ( error ? 0 : max );
+
+ __VTPRINT2( DEBUG_GEN, "TVtCameraHandler.MaxLcZoomL value=%d", max )
+
+ return max;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+TInt TVtCameraHandler::LcZoomValueL()
+ {
+ MVtEngMedia& media = ivtSession->Model().Media();
+
+ if(!LcVtUtility::IsZoomAllowed(media))
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.LcZoomValueL ZoomNotAllow" )
+ return 0;
+ }
+
+ TInt current( 0 );
+ const TInt error( media.GetCurrentZoomStep( current ) );
+ current = ( error ? 0 : current );
+ __VTPRINT2( DEBUG_GEN, "TVtCameraHandler.LcZoomValueL value=%d", 0 )
+ return current;
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::SetLcZoomValueL( TInt aValue )
+ {
+ MVtEngMedia& media = ivtSession->Model().Media();
+
+ if(!LcVtUtility::IsZoomAllowed(media))
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.SetLcZoomValueL ZoomNotAllow" )
+ return;
+ }
+
+ if( aValue < 0 || aValue > MaxLcZoomL() )
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.SetLcZoomValueL - Invalidate value" )
+ return;
+ }
+
+ __VTPRINT2( DEBUG_GEN, "TVtCameraHandler.SetLcZoomValueL Call SetZoomFactorL(%d)" , aValue );
+ ivtSession->SetZoomFactorL( aValue );
+
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::LcZoomInL()
+ {
+ MVtEngMedia& media = ivtSession->Model().Media();
+
+ if(!LcVtUtility::IsZoomAllowed(media))
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.LcZoomInL ZoomNotAllow" )
+ return;
+ }
+
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.LcZoomInL Call SetLcZoomValueL" )
+ SetLcZoomValueL(LcZoomValueL() + 1);
+ }
+
+// -----------------------------------------------------------------------------
+// From MLcZoomControl
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::LcZoomOutL()
+ {
+ MVtEngMedia& media = ivtSession->Model().Media();
+
+ if(!LcVtUtility::IsZoomAllowed(media))
+ {
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.LcZoomOutL ZoomNotAllow" )
+ return;
+ }
+
+ __VTPRINT( DEBUG_GEN, "TVtCameraHandler.LcZoomOutL Call SetLcZoomValueL" )
+ SetLcZoomValueL(LcZoomValueL() - 1);
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TVtCameraHandler::SetSession( CLcVtSession* aSession )
+ {
+ ivtSession = aSession;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/states/tlcvtstatebase.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,382 @@
+/*
+* 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: base class for lc vt plugin states
+*
+*/
+
+
+#include "tlcvtstatebase.h"
+#include "tlcvtstates.h"
+#include "tlcvtpluginstates.h"
+#include "clcvtappshutter.h"
+#include "mlcvtstatecontext.h"
+#include <StringLoader.h>
+#include <cvtlogger.h>
+#include <cvtengmodel.h>
+#include <vtengevents.h>
+#include <mvtengcommandhandler.h>
+
+// By default call ending command is allowed to send to call handling.
+
+// Initially no shutdown request
+TBool TLcVtStateBase::iShutdownRequested = EFalse;
+
+// -----------------------------------------------------------------------------
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TLcVtStateBase(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates ) : iCtx(aCtx), iUiStates( aUiStates )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::~TLcVtStateBase()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::LcVtStartupPhase1DoneL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::LcVtStartupPhase1DoneL()
+ {
+ // no default behavior
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::LcVtStartupPhase2DoneL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::LcVtStartupPhase2DoneL()
+ {
+ // no default behavior
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::ShutdownDoneL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::ShutdownDoneL()
+ {
+ // no default behavior
+ }
+#if 0
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateBase::HandleForegroundChangedL(
+ const TBool /*aIsForegroung*/ )
+ {
+ // no default behavior
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateBase::PreHandleForegroundChangedL(
+ const TBool /*aIsForegroung*/ )
+ {
+ // no default behavior
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::StartDtmfTone( const TChar& /*aTone*/ )
+ {
+ // no default behavior
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::StopDtmfTone()
+ {
+ // no default behavior
+ }
+#endif
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::SetInitialStateL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::SetInitialStateL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.SetInitialState" )
+ TLcVtStateBase* initialState =
+ TLcVtStateStarting::InstanceL( aCtx, aUiStates );
+ aCtx.ChangeState( initialState );
+ initialState->OpenL();
+ __VTPRINTEXIT( "TLcVtStateBase.SetInitialState" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::LcVtStartupFailedL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::LcVtStartupFailedL()
+ {
+ __VTPRINTENTER( "TLcVtStateBase.AppUiStartupFailedL" )
+ // Shutdown
+ ChangeStateL( *TLcVtStateResetting::InstanceL( iCtx, iUiStates ) );
+ __VTPRINTEXIT( "TLcVtStateBase.AppUiStartupFailedL" )
+ }
+#if 0
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::OpenL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::OpenL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::Close
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::Close()
+ {
+ }
+#endif
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::ChangeStateL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::ChangeStateL( TLcVtStateBase& aNewState )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.ChangeStateL" )
+
+ // Check for transition to already active state.
+ TLcVtStateBase* state = &aNewState;
+ if ( state == this )
+ {
+ __VTPRINTEXITR( "TLcVtStateBase.ChangeStateL %d", 0 )
+ return;
+ }
+ const TVtEngCommandId pending =
+ iCtx.Model().CommandHandler().PendingCommand();
+ if ( pending != KVtEngCommandNone &&
+ state == TLcVtStateResetting::InstanceL( iCtx, iUiStates ) )
+ {
+ // delay shutdown until engine command completes
+ __VTPRINT2( DEBUG_GEN, "TLcVtStateBase.ChangeStateL, pengind command is: %d", pending );
+ TLcVtStateBase::iShutdownRequested = ETrue;
+
+ if ( pending == KVtEngInitializeShareImage )
+ {
+ iCtx.Model().CommandHandler().CancelCommand( pending );
+ }
+
+ __VTPRINTEXITR( "TLcVtStateBase.ChangeStateL %d", KErrNotReady )
+ return;
+ }
+ __VTPRINT( DEBUG_GEN,
+ " TLcVtStateBase.ChangeStateL !! STATE TRANSITION !!" )
+ iCtx.ChangeState( &aNewState );
+ Close();
+ // perform entry action for new state
+ aNewState.OpenL();
+ __VTPRINTEXITR( "TLcVtStateBase.ChangeStateL %d", 1 )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::CleanupResetPushL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::CleanupResetPushL()
+ {
+ // Shutdown if leave occurs in critical ops.
+ CleanupStack::PushL(
+ TCleanupItem( TransitionToReset, this ) );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::TransitionToReset
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::TransitionToReset( TAny* aAny )
+ {
+ TLcVtStateBase* state = reinterpret_cast< TLcVtStateBase* >( aAny );
+ TRAP_IGNORE( state->ChangeStateL( *TLcVtStateResetting::InstanceL(
+ state->iCtx, state->iUiStates ) ) );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateBase::HandleVTCommandPerformedL(
+ TVtEngCommandId /*aCommand*/,
+ const TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleVTCommandPerformedL" )
+ // By default all UI is allowed to handle all command completions.
+ TEventResponse handled = EEventNotHandled;
+
+ // check if shutdown requested while command was pending
+ const TVtEngCommandId pending = iCtx.Model().CommandHandler().PendingCommand();
+ if ( pending == KVtEngCommandNone &&
+ TLcVtStateBase::iShutdownRequested )
+ {
+ __VTPRINT( DEBUG_GEN, "Handling delayed shutdown" );
+ ChangeStateL( *TLcVtStateResetting::InstanceL(
+ iCtx, iUiStates ) );
+ }
+ __VTPRINTEXIT( "TLcVtStateBase.HandleVTCommandPerformedL" )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateBase::HandleVtEventL(
+ const TInt aEvent )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleVtEventL" )
+ TEventResponse handled = EEventHandled;
+ switch ( aEvent )
+ {
+ case KVtEngDeviceLockOn:
+ case KVtEngDeviceLockOff:
+ HandleDeviceLockEventL( aEvent == KVtEngDeviceLockOn );
+ break;
+ case KVtEngRemoteDisconnect:
+ /** Don't allow sending of end active call command to call handling
+ * because requesting disconnect from the network after NW originated
+ * termination violates standards.
+ */
+ break;
+ default:
+ handled = EEventNotHandled;
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateBase.HandleVtEventL" )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateBase::HandleCommandL(
+ const TInt /*aCommand*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleCommandL" )
+ TEventResponse handled = EEventNotHandled;
+ __VTPRINTEXITR( "TLcVtStateBase.HandleCommandL %d", handled )
+ return handled;
+ }
+#if 0
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::HandleLayoutChangedL( )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleLayoutChangedL" )
+ // By default only indicate that layout change needs to be handled.
+ iUiStates.SetLayoutChangeNeeded( ETrue );
+ __VTPRINTEXIT( "TLcVtStateBase.HandleLayoutChangedL" )
+ }
+#endif
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleShutdownReady
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::HandleShutdownReady()
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleShutdownReady" )
+ // forwarded to AppUi which handles UI framework exit
+ iCtx.HandleShutdownReady();
+ iCtx.ChangeState( NULL );
+ // deletes current state
+ Close();
+ __VTPRINTEXIT( "TLcVtStateBase.HandleShutdownReady" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::HandleDeviceLockEventL
+//
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::HandleDeviceLockEventL( const TBool aDeviceIsLocked )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.HandleDeviceLockEventL" )
+ iUiStates.SetDeviceLockOn( aDeviceIsLocked );
+ if ( aDeviceIsLocked )
+ {
+ iCtx.ChangeApplicationFocus( EFalse );
+ }
+ __VTPRINTEXITR( "TLcVtStateBase.HandleDeviceLockEventL lock state=%d",
+ aDeviceIsLocked )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::CheckEndActiveCallL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateBase::CheckEndActiveCallL()
+ {
+ __VTPRINTENTER( "TLcVtStateBase.CheckEndActiveCallL" )
+ const MVtEngSessionInfo::TSessionState state = SessionState( EFalse );
+ TBool shutdownStarted( EFalse );
+ if ( state == MVtEngSessionInfo::EIdle )
+ {
+ __VTPRINT( DEBUG_GEN, "VtUi.Release bearer" )
+ // h.245 session is ended
+ ChangeStateL( *TLcVtStateResetting::InstanceL( iCtx, iUiStates ) );
+ shutdownStarted = ETrue;
+ }
+ __VTPRINTEXITR( "TLcVtStateBase.CheckEndActiveCallL %d",
+ shutdownStarted )
+ return shutdownStarted;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::SessionState
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState TLcVtStateBase::SessionState(
+ const TBool aUpdate ) const
+ {
+ const CVtEngModel& model = iCtx.Model();
+ const MVtEngSessionInfo& session = model.Session();
+ return session.State( aUpdate );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateBase::SetExecState
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateBase::SetExecState( const TLcVtStates::TLcVtExecState aState )
+ {
+ __VTPRINTENTER( "TLcVtStateBase.SetExecState" )
+ iUiStates.SetExecState( aState );
+ __VTPRINTEXITR( "TLcVtStateBase.SetExecState %d", aState )
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/states/tlcvtstateresetting.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,254 @@
+/*
+* 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: waiting details application state
+*
+*/
+
+
+#include "tlcvtstates.h"
+#include "tlcvtpluginstates.h"
+#include "mlcvtstatecontext.h"
+#include "clcvtappshutter.h"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+
+TLcVtStateResetting* TLcVtStateResetting::iInstance = NULL;
+
+// c++ constructor
+TLcVtStateResetting::TLcVtStateResetting(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates,
+ const TVtEngCommandId aCommand )
+ : TLcVtStateBase( aCtx, aUiStates ),
+ iCommand( aCommand )
+ {
+ __VTPRINT2( DEBUG_GEN, "TLcVtStateResetting.ctr iCommand=%d", iCommand )
+ iCtx.StartShutdown();
+ }
+
+// Destructor
+TLcVtStateResetting::~TLcVtStateResetting()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::
+// -----------------------------------------------------------------------------
+//
+TLcVtStateResetting* TLcVtStateResetting::InstanceL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates,
+ const TVtEngCommandId aCommand )
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.InstanceL" )
+ if ( iInstance == NULL )
+ {
+ iInstance = new ( ELeave ) TLcVtStateResetting(
+ aCtx, aUiStates, aCommand );
+ }
+ else if ( aCommand != KVtEngCommandNone )
+ { // if call ending is UI originated, command is given
+ iInstance->iCommand = aCommand;
+ __VTPRINT2( DEBUG_GEN, "TLcVtStateResetting.InstanceL iCommand=%d",
+ iInstance->iCommand )
+ }
+ __VTPRINTEXIT( "TLcVtStateResetting.InstanceL" )
+ return iInstance;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::ShutdownDoneL
+// AppUi has finished its own shutdown steps. Notify app shutter that it may
+// proceed.
+//
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateResetting::ShutdownDoneL()
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.ShutdownDone" )
+ CLcVtAppShutter* shutter = CLcVtAppShutter::InstanceL( *this );
+ shutter->StartShutdown();
+ __VTPRINTEXIT( "TLcVtStateResetting.ShutdownDone" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::AppUiStartupFailedL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateResetting::LcVtStartupFailedL()
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.LcVtStartupFailedL" )
+ // no-op (overrides default behavior)
+ __VTPRINTEXIT( "TLcVtStateResetting.LcVtStartupFailedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateResetting::HandleVTCommandPerformedL
+ (
+ TVtEngCommandId aCommand,
+ const TInt /*aError*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.HandleVTCommandPerformedL" )
+ // By default responses to commands are ignored while resetting
+ TEventResponse handled = EEventHandled;
+ switch ( aCommand )
+ {
+ case KVtEngResetEngine:
+ // Allow UI to process reset command response
+ handled = EEventNotHandled;
+ break;
+ case KVtEngTerminateSession:
+ case KVtEngSwitchToVoice:
+ //
+ handled = EEventNotHandled;
+ iCtx.ShutdownL();
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateResetting.HandleVTCommandPerformedL" )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateResetting::HandleVtEventL(
+ const TInt aEvent )
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.HandleVtEventL" )
+ TEventResponse handled = EEventHandled;
+ switch ( aEvent )
+ {
+ // While resetting appUi should not handle these events.
+ case KVtEngSourceChanged:
+ case KVtEngCameraChanged:
+ case KVtEngSourceCapsChanged:
+ case KVtEngSessionStateChanged:
+ case KVtEngDurationSettingChanged:
+ case KVtEngAudioOutputVolumeChanged:
+ case KVtEngAudioRoutingAvailabilityChanged:
+ case KVtEngAudioRoutingChanged:
+ case KVtEngAudioMuted:
+ case KVtEngAudioUnmuted:
+ case KVtEngRemoteVideoStopped:
+ case KVtEngSessionWaitingCallActive:
+ case KVtEngSessionWaitingCallInactive:
+ break;
+ default:
+ // allow appUi to handle other events
+ handled = EEventNotHandled;
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateResetting.HandleVtEventL" )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateResetting::HandleCommandL(
+ const TInt /*aCommand*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.HandleCommandL" )
+ /* All commands ignored while resetting. CAknAppUi::Exit() is called
+ when shutdown is completed with asistance of CVtUiAppShutter */
+ __VTPRINTEXIT( "TLcVtStateResetting.HandleCommandL" )
+ return EEventHandled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateResetting::HandleForegroundChangedL(
+ const TBool /*aIsForeground*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.HandleForegroundChangedL" )
+ __VTPRINTEXIT( "TLcVtStateResetting.HandleForegroundChangedL" )
+ // not on "foreground" while resetting
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateResetting::PreHandleForegroundChangedL(
+ const TBool /*aIsForegroung*/ )
+ {
+ // no default behavior
+ return EFalse;
+ }
+
+#if 0
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateResetting::HandleLayoutChangedL()
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.HandleLayoutChangedL" )
+ // no-op (overrides default behavior)
+ __VTPRINTEXIT( "TLcVtStateResetting.HandleLayoutChangedL" )
+ }
+#endif
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::OpenL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateResetting::OpenL()
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.OpenL" )
+ SetExecState( TLcVtStates::EExecStateResetting );
+ //iCtx.StopDtmfTone();
+ iCtx.ChangeApplicationFocus( EFalse );
+
+ if ( iCommand != KVtEngCommandNone )
+ {
+ // Command is either KVtEngTerminateSession or KVtEngSwitchToVoice
+ // Need to wait for callback before ShutdownL can be called on context.
+ iCtx.DoExecuteCmdL( iCommand, NULL );
+ }
+ else
+ {
+ // This branch is executed when resetting state is opened due
+ // to emergency call or state change to one causing shutdown.
+ // No need to wait for any callbacks (emergency call callback
+ // handled by CVtUiAppShutter).
+ iCtx.ShutdownL();
+ }
+ __VTPRINTEXIT( "TLcVtStateResetting.OpenL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateResetting::Close
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateResetting::Close()
+ {
+ __VTPRINTENTER( "TLcVtStateResetting.Close" )
+ SetExecState( TLcVtStates::EExecStateFinalized );
+ if ( TLcVtStateResetting::iInstance )
+ {
+ delete TLcVtStateResetting::iInstance;
+ TLcVtStateResetting::iInstance = NULL;
+ }
+ __VTPRINTEXIT( "TLcVtStateResetting.Close" )
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/states/tlcvtstaterunning.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,291 @@
+/*
+* 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: running (normal operation) application state
+*
+*/
+
+
+#include "tlcvtstates.h"
+#include "tlcvtpluginstates.h"
+#include "mlcvtstatecontext.h"
+#include "clcvtappshutter.h"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+#include <StringLoader.h>
+#include "lcvtplugincommand.h"
+
+TLcVtStateRunning* TLcVtStateRunning::iInstance = NULL;
+
+// c++ constructor
+TLcVtStateRunning::TLcVtStateRunning(
+ MLcVtStateContext& aCtx, TLcVtStates& aUiStates )
+ : TLcVtStateBase( aCtx, aUiStates )
+ {
+ }
+
+// Destructor
+TLcVtStateRunning::~TLcVtStateRunning()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::InstanceL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateRunning * TLcVtStateRunning::InstanceL(
+ MLcVtStateContext& aCtx,
+ TLcVtStates& aUiStates )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.InstanceL" )
+ if ( iInstance == NULL )
+ iInstance = new ( ELeave ) TLcVtStateRunning( aCtx, aUiStates );
+ __VTPRINTEXIT( "TLcVtStateRunning.InstanceL" )
+ return iInstance;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateRunning::HandleVtEventL(
+ const TInt aEvent )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.HandleVtEventL" )
+ // let TVtUiAppStateBase base class do common tasks
+ TEventResponse handled = TLcVtStateBase::HandleVtEventL( aEvent );
+ switch ( aEvent )
+ {
+ case KVtEngDeviceLockOn:
+ case KVtEngDeviceLockOff:
+ TLcVtStateBase::HandleVtEventL( aEvent );
+ if ( aEvent == KVtEngDeviceLockOff )
+ {
+ iCtx.ChangeApplicationFocus( ETrue );
+ }
+ break;
+ case KVtEngSessionStateChanged:
+ if ( CheckEndActiveCallL() )
+ {
+ // At this point shutdown is in progress. Don't allow
+ // appUi to do actions due to this event.
+ handled = EEventHandled;
+ }
+ break;
+ default:
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateRunning.HandleVtEventL" )
+ return handled;
+ }
+
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateRunning::HandleCommandL(
+ const TInt aCommand )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.HandleCommandL" )
+ /** By default all commands are enabled by running state.
+ * Other details command validations are done elsewhere
+ */
+ TEventResponse handled = EEventHandled;
+
+ switch ( aCommand )
+ {
+ case EPluginCmdEndActiveCall:
+ ShutdownWithEngineCommandL( KVtEngTerminateSession );
+ break;
+ case EPluginCmdCreateVoice:
+ CreateVoiceCallL();
+ break;
+ case EPluginCmdDialEmergency:
+ // Attempt emergency call. Note that emergency number check is done
+ // after calling DialEmergencyCallL and if supplied number is not
+ // emergency leave occurs.
+ TRAP_IGNORE( DialEmergencyCallL() );
+ break;
+ default:
+ handled = TLcVtStateBase::HandleCommandL( aCommand );
+ break;
+ }
+
+ __VTPRINTEXITR( "TLcVtStateRunning.HandleCommandL %d", handled )
+ return handled;
+ }
+
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateRunning::HandleForegroundChangedL( const TBool aIsForeground )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.HandleForegroundChangedL" )
+
+ iCtx.RefreshL( MLcVtStateContext::ENaviPane );
+
+ TBool handleAsForeground( aIsForeground );
+ TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ),
+ sizeof( TBool ) );
+ iCtx.DoExecuteCmdL( KVtEngSetUIForeground, ¶ms );
+ __VTPRINTEXIT( "TLcVtStateRunning.HandleForegroundChangedL" )
+ return handleAsForeground;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateRunning::PreHandleForegroundChangedL( const TBool aIsForeground )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.PreHandleForegroundChangedL" )
+ TBool handleAsForeground( aIsForeground );
+ TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ), sizeof( TBool ) );
+ iCtx.DoExecuteCmdL( KVtEngSetUIForeground, ¶ms );
+ __VTPRINTEXIT( "TLcVtStateRunning.PreHandleForegroundChangedL" )
+ return handleAsForeground;
+ }
+#if 0
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::HandleLayoutChangedL( )
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.HandleLayoutChangedL" )
+ iUiStates.SetLayoutChangeNeeded( EFalse );
+ iCtx.DoHandleLayoutChangedL();
+ __VTPRINTEXIT( "TLcVtStateRunning.HandleLayoutChangedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::StartDtmfTone( const TChar& aTone )
+ {
+ iCtx.StartDtmfTone( aTone );
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::StopDtmfTone()
+ {
+ iCtx.StopDtmfTone();
+ }
+#endif
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::CreateVoiceCallL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::CreateVoiceCallL()
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.CreateVoiceCallL" )
+
+ //TInt result( KErrNone );
+ /*
+ HBufC* prompt =
+ StringLoader::LoadLC( R_VIDEOTELUI_QTN_QUERY_CREATE_VOICE_CALL );
+
+ // Create and initialize query dialog
+ CAknQueryDialog* createVoiceCallDlg = CAknQueryDialog::NewL();
+ CleanupStack::PushL( createVoiceCallDlg );
+ createVoiceCallDlg->SetPromptL( *prompt );
+ CleanupStack::Pop(); // createVoiceCallDlg
+
+ iCreateVoiceCallDlg = createVoiceCallDlg;
+ TInt result( KErrNone );
+ TRAPD( error, result = iCreateVoiceCallDlg->ExecuteLD(
+ R_VIDEOTELUI_CREATE_VOICE_QUERY ) );
+ // Just set to NULL because ExecuteLD() deletes instance
+ iCreateVoiceCallDlg = NULL;
+ // Leave if ExecuteLD() left
+ User::LeaveIfError( error );
+ CleanupStack::PopAndDestroy( ); // prompt
+ if ( result )
+ {
+ //user answered yes
+ iCtx.DoExecuteCmdL( KVtEngSwitchToVoice, NULL );
+ }
+ */
+ __VTPRINTEXITR( "TLcVtStateRunning.CreateVoiceCallL %d", KErrNone )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::ShutdownWithEngineCommandL
+// Starts shutdown with command to engine.
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::ShutdownWithEngineCommandL( const TInt aCommand )
+ {
+ __VTPRINTENTER(
+ "TLcVtStateRunning.ShutdownWithEngineCommandL" )
+ TLcVtStateBase* resetState =
+ TLcVtStateResetting::InstanceL( iCtx, iUiStates, aCommand );
+ CLcVtAppShutter* shutter = CLcVtAppShutter::InstanceL( *resetState );
+
+ // open resetting state, handles engine command request/reply
+ ChangeStateL( *resetState );
+
+ __VTPRINTEXIT( "TLcVtStateRunning.ShutdownWithEngineCommandL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::DialEmergencyCallL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::DialEmergencyCallL()
+ {
+ __VTPRINTENTER(
+ "TLcVtStateRunning.DialEmergencyCallL" )
+ TLcVtStateBase* resetState =
+ TLcVtStateResetting::InstanceL( iCtx, iUiStates );
+ CLcVtAppShutter* shutter = CLcVtAppShutter::InstanceL( *resetState );
+ if ( shutter )
+ {
+ // Make emergency call and proceed when 1) state has given permission
+ // and 2) callback from emergency call api is received
+ shutter->ShutdownWithEmergencyCallL( iCtx );
+ ChangeStateL( *resetState );
+ }
+ __VTPRINTEXIT( "TLcVtStateRunning.DialEmergencyCallL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::OpenL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::OpenL()
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.OpenL" )
+ SetExecState( TLcVtStates::EExecStateRunning );
+ iCtx.RefreshStatesL();
+ __VTPRINTEXIT( "TLcVtStateRunning.OpenL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateRunning::Close
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateRunning::Close()
+ {
+ __VTPRINTENTER( "TLcVtStateRunning.Close" )
+ delete TLcVtStateRunning::iInstance;
+ TLcVtStateRunning::iInstance = NULL;
+ __VTPRINTEXIT( "TLcVtStateRunning.Close" )
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/lcvtplugin/src/states/tlcvtstatestarting.cpp Thu Jul 22 16:34:21 2010 +0100
@@ -0,0 +1,317 @@
+/*
+* 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: waiting details application state
+*
+*/
+
+
+#include "tlcvtstates.h"
+#include "tlcvtpluginstates.h"
+#include "mlcvtstatecontext.h"
+#include "clcvtappshutter.h"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+#include <vtengcommands.h>
+#include <cvtengmodel.h>
+#include <mvtengsessioninfo.h>
+
+
+TLcVtStateStarting* TLcVtStateStarting::iInstance = NULL;
+
+// c++ constructor
+TLcVtStateStarting::TLcVtStateStarting(
+ MLcVtStateContext& aCtx, TLcVtStates& aUiStates )
+ : TLcVtStateBase( aCtx, aUiStates )
+ {
+ iPreconditions.Set( EWaitingCLI );
+ iPreconditions.Set( EWaitingPhase1ToComplete );
+ iStartCallback = NULL;
+ }
+
+// Destructor
+ TLcVtStateStarting::~TLcVtStateStarting()
+ {
+ delete iStartCallback;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::InstanceL
+//
+// -----------------------------------------------------------------------------
+//
+TLcVtStateStarting * TLcVtStateStarting::InstanceL(
+ MLcVtStateContext& aCtx, TLcVtStates& aUiStates )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.InstanceL" )
+ if ( iInstance == NULL )
+ {
+ iInstance = new ( ELeave ) TLcVtStateStarting( aCtx, aUiStates );
+ }
+ __VTPRINTEXIT( "TLcVtStateStarting.InstanceL" )
+ return iInstance;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::LcVtStartupPhase1DoneL
+//
+// Phase 1 of application startup is completed, check if we can proceed to
+// phase 2.
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::LcVtStartupPhase1DoneL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.LcVtStartupPhase1DoneL" )
+ // From startup phase point of view we're ready to proceed
+ // to phase 2. Clear that precondition and proceed if otherwise ready.
+ CheckPhase2StartupL( EWaitingPhase1ToComplete );
+ __VTPRINTEXIT( "TLcVtStateStarting.LcVtStartupPhase1DoneL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::LcVtStartupPhase2DoneL
+//
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::LcVtStartupPhase2DoneL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.LcVtStartupPhase2DoneL" )
+ // Phase 2 completed, proceed to next state
+ ChangeStateL( *TLcVtStateRunning::InstanceL( iCtx, iUiStates ) );
+ __VTPRINTEXIT( "TLcVtStateStarting.LcVtStartupPhase2DoneL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::HandleVtEventL
+//
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateStarting::HandleVtEventL(
+ const TInt aEvent )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.HandleVtEventL" )
+ TEventResponse handled = EEventHandled;
+ switch ( aEvent )
+ {
+ case KVtEngRemoteDisconnect:
+ // base class handles this.
+ handled = TLcVtStateBase::HandleVtEventL( aEvent );
+ break;
+ case KVtEngSessionStateChanged:
+ {
+ // check if session state is proper for proceeding to next phase
+ // in startup.
+ CheckSessionStateL();
+ }
+ break;
+ case KVtEngRemoteVideoStarted:
+ // allow to start remote video rendering
+ case KVtEngSourceChanged:
+ // allow handling of source changed event
+ handled = EEventNotHandled;
+ break;
+ case KVtEngCLIAvailable:
+ HandleCLIReceivedL();
+ break;
+
+ case KVtEngDeviceLockOn:
+ case KVtEngDeviceLockOff:
+ default:
+ handled = TLcVtStateBase::HandleVtEventL( aEvent );
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateStarting.HandleVtEventL" )
+ return handled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::HandleCommandL
+//
+// -----------------------------------------------------------------------------
+//
+TLcVtStateBase::TEventResponse TLcVtStateStarting::HandleCommandL(
+ const TInt /*aCommand*/ )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.HandleCommandL" )
+ __VTPRINTEXIT( "TLcVtStateStarting.HandleCommandL" )
+ //return EEventNotHandled;
+ return EEventHandled;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::HandleForegroundChangedL
+//
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateStarting::HandleForegroundChangedL( const TBool aIsForeground )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.HandleForegroundChangedL" )
+
+ iCtx.RefreshL( MLcVtStateContext::ENaviPane );
+
+ // behave as in background if CLI (=details) has not yet received
+ TBool handleAsForeground( aIsForeground && iUiStates.IsDetailsReceived() );
+ TLcVtStateBase::ExecuteEngineCommand( KVtEngSetUIForeground,
+ handleAsForeground );
+
+ __VTPRINTEXIT( "TLcVtStateStarting.HandleForegroundChangedL" )
+ return handleAsForeground;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TLcVtStateStarting::PreHandleForegroundChangedL(
+ const TBool /*aIsForegroung*/ )
+ {
+ // no default behavior
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::OpenL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::OpenL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.OpenL" )
+ iStartCallback = new ( ELeave ) CAsyncCallBack (
+ TCallBack( &AsynchOpen, this ),
+ CActive::EPriorityStandard );
+ iStartCallback->CallBack();
+ __VTPRINTEXIT( "TLcVtStateStarting.OpenL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::AsynchOpen
+// asynchronous entry to the state.
+// -----------------------------------------------------------------------------
+//
+TInt TLcVtStateStarting::AsynchOpen( TAny* aAny )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.AsynchOpen" )
+ TLcVtStateStarting* state = reinterpret_cast<TLcVtStateStarting*>( aAny );
+ delete state->iStartCallback;
+ state->iStartCallback = NULL;
+ TRAPD( res, state->DoOpenL() );
+ __VTPRINTEXITR( "TLcVtStateStarting.AsynchOpen err=%d", res )
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::DoOpenL
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::DoOpenL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.DoOpenL" )
+ if ( !CheckEndActiveCallL() )
+ {
+ // not shutting down, proceed to phase 1
+ iCtx.StartupPhase1L();
+ }
+ __VTPRINTEXIT( "TLcVtStateStarting.DoOpenL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::CheckSessionStateL
+// Resolve action based on session state change in the engine.
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::CheckSessionStateL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.CheckSessionStateL" )
+ const MVtEngSessionInfo::TSessionState state = SessionState( EFalse );
+ switch ( state )
+ {
+ case MVtEngSessionInfo::EConnected:
+ case MVtEngSessionInfo::ENegotiating:
+ case MVtEngSessionInfo::EOpen:
+ // From session state point of view we're ready to proceed.
+ // Clear precondition and proceed if otherwise ready.
+ CheckPhase2StartupL( EWaitingSessionState );
+ break;
+ default:
+ // Is session state such that we need to shutdown?
+ CheckEndActiveCallL();
+ break;
+ }
+ __VTPRINTEXIT( "TLcVtStateStarting.CheckSessionStateL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::CheckPhase2StartupL
+//
+// mark precondition passed and if no more preconditions exist proceed
+// in startup.
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::CheckPhase2StartupL(
+ const TPreconditions aCond )
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.CheckPhase2StartupL" )
+ // First check that at least one precondition holds
+ if ( iPreconditions.Value() )
+ {
+ iPreconditions.Clear( aCond );
+ if ( !iPreconditions.Value() )
+ {
+ CleanupResetPushL(); // start shutdown if StartupPhase2L leaves
+ iCtx.StartupPhase2L();
+ CleanupStack::Pop(); // CleanupResetPushL
+ }
+ }
+#ifdef VTDEBUG
+ else {
+ __VTPRINT( DEBUG_GEN, "TLcVtStateStarting.CheckPhase2StartupL NoOp!" )
+ }
+#endif // VTDEBUG
+ __VTPRINTEXITR( "TLcVtStateStarting.CheckPhase2StartupL cond=%d",
+ (TInt) iPreconditions.Value() )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::HandleCLIReceivedL
+// CLI reception from engine is one of the two preconditions for proceeding
+// to phase2 startup.
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::HandleCLIReceivedL()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.HandleCLIReceivedL" )
+ const MVtEngSessionInfo& session = iCtx.Model().Session();
+ MVtEngSessionInfo::TCLI cli;
+ if ( session.GetCLI( cli ) == KErrNone )
+ {
+ iUiStates.SetDetailsReceived( ETrue );
+ iUiStates.SetCLIReceived( cli.iVoiceCallPossible );
+ iCtx.SetCallIdL( cli.iCallId );
+ iCtx.SetCallNameL( cli.iName );
+ iCtx.SetCallNumberL( cli.iCallNumber );
+ }
+ CheckPhase2StartupL( EWaitingCLI );
+ __VTPRINTEXIT( "TLcVtStateStarting.HandleCLIReceivedL" )
+ }
+
+// -----------------------------------------------------------------------------
+// TLcVtStateStarting::Close
+// -----------------------------------------------------------------------------
+//
+void TLcVtStateStarting::Close()
+ {
+ __VTPRINTENTER( "TLcVtStateStarting.Close" )
+ delete TLcVtStateStarting::iInstance;
+ TLcVtStateStarting::iInstance = NULL;
+ __VTPRINTEXIT( "TLcVtStateStarting.Close" )
+ }