46
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "SVGLockedRealTimeEntity.h"
|
|
18 |
|
|
19 |
CSvgLockedRealTimeEntity* CSvgLockedRealTimeEntity::NewL(CSvgDocumentImpl* aDoc)
|
|
20 |
{
|
|
21 |
CSvgLockedRealTimeEntity* self = new (ELeave) CSvgLockedRealTimeEntity(aDoc);
|
|
22 |
CleanupStack::PushL(self);
|
|
23 |
self->ConstructL(aDoc);
|
|
24 |
CleanupStack::Pop(self);
|
|
25 |
return self;
|
|
26 |
}
|
|
27 |
//==========================================================================
|
|
28 |
void CSvgLockedRealTimeEntity::ConstructL(CSvgDocumentImpl* aDoc)
|
|
29 |
{
|
|
30 |
iOwnerDocument = aDoc;
|
|
31 |
}
|
|
32 |
//==========================================================================
|
|
33 |
CSvgLockedRealTimeEntity::CSvgLockedRealTimeEntity(CSvgDocumentImpl* aDoc): CSvgMediaElementBase( aDoc ),
|
|
34 |
iIsPaused(EFalse),
|
|
35 |
iSyncMasterCurrent(EFalse)
|
|
36 |
{
|
|
37 |
//SyncBehaviour is locked
|
|
38 |
//MediaState is ready always
|
|
39 |
|
|
40 |
}
|
|
41 |
//==========================================================================
|
|
42 |
CSvgLockedRealTimeEntity::~CSvgLockedRealTimeEntity()
|
|
43 |
{
|
|
44 |
|
|
45 |
}
|
|
46 |
|
|
47 |
//==========================================================================
|
|
48 |
//from svgelementimpl
|
|
49 |
void CSvgLockedRealTimeEntity::Print(TInt /*aValue*/)
|
|
50 |
{
|
|
51 |
|
|
52 |
}
|
|
53 |
|
|
54 |
//==========================================================================
|
|
55 |
/**
|
|
56 |
* The parent time container provides the timing clock to
|
|
57 |
* the timed entity (audio, video, animation, document)
|
|
58 |
* using this routine.
|
|
59 |
* @since S60 3.2
|
|
60 |
* @param aTick Current tick information
|
|
61 |
* @return none.
|
|
62 |
*/
|
|
63 |
void CSvgLockedRealTimeEntity::ParentTimeContainerTick( TSvgTick /*aTick*/ )
|
|
64 |
{
|
|
65 |
|
|
66 |
}
|
|
67 |
|
|
68 |
//==========================================================================
|
|
69 |
/**
|
|
70 |
* Returns the sync behavior of the entity.
|
|
71 |
* @since S60 3.2
|
|
72 |
* @param none.
|
|
73 |
* @return TSvgSyncBehaviour Element's Sync Behaviour.
|
|
74 |
*/
|
|
75 |
TSvgSyncBehaviour CSvgLockedRealTimeEntity::GetEntitySyncBehavior()
|
|
76 |
{
|
|
77 |
return ESvgSyncLocked;
|
|
78 |
}
|
|
79 |
|
|
80 |
//==========================================================================
|
|
81 |
/**
|
|
82 |
* When the timed entity acts as timing master in the time container,
|
|
83 |
* the time container gets the timed entity clock using this method
|
|
84 |
* and feeds to rest of timed entities.
|
|
85 |
* @since S60 3.2
|
|
86 |
* @param aEntityCurTime Current Entity Time in msecs.
|
|
87 |
* @return none.
|
|
88 |
*/
|
|
89 |
void CSvgLockedRealTimeEntity::GetEntityCurrentTime( TUint32& aEntityCurTime )
|
|
90 |
{
|
|
91 |
//Keep returning the same time if the entity is paused
|
|
92 |
if(iIsPaused)
|
|
93 |
{
|
|
94 |
aEntityCurTime = iStoredTick.iParentTcTick;
|
|
95 |
}
|
|
96 |
//add the relative time difference in realtimetick to parenttick
|
|
97 |
else
|
|
98 |
{
|
|
99 |
TSvgTick curTick = iOwnerDocument->TimeContainer()->GetCurTick();
|
|
100 |
TInt32 delta = curTick.iRealTimeTick - iStoredTick.iRealTimeTick;
|
|
101 |
|
|
102 |
if(delta < 0)
|
|
103 |
delta = 0;
|
|
104 |
|
|
105 |
aEntityCurTime = iStoredTick.iParentTcTick + delta;
|
|
106 |
|
|
107 |
}
|
|
108 |
}
|
|
109 |
//==========================================================================
|
|
110 |
/**
|
|
111 |
* Returns the configured sync master value(as per DOM tree) as specified
|
|
112 |
* in the SVG content.
|
|
113 |
* @since S60 3.2
|
|
114 |
* @param aIsSyncMaster Indicates whether the element is configured as
|
|
115 |
* Sync Master.
|
|
116 |
* Locked Real Time Entity can never be configured as syncmaster hence
|
|
117 |
* This implementation is NULL
|
|
118 |
* @return none.
|
|
119 |
*/
|
|
120 |
void CSvgLockedRealTimeEntity::GetCnfSyncMasterStatus( TBool& /*aIsSyncMaster*/ )
|
|
121 |
{
|
|
122 |
|
|
123 |
}
|
|
124 |
|
|
125 |
//==========================================================================
|
|
126 |
/**
|
|
127 |
* Check if timed entity is going to act as timing master in the
|
|
128 |
* time container. This behavior could change dynamically.
|
|
129 |
* @since S60 3.2
|
|
130 |
* @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
|
|
131 |
* @return none.
|
|
132 |
*/
|
|
133 |
void CSvgLockedRealTimeEntity::GetCurSyncMasterStatus( TBool& isSyncMaster )
|
|
134 |
{
|
|
135 |
isSyncMaster = iSyncMasterCurrent;
|
|
136 |
}
|
|
137 |
|
|
138 |
//==========================================================================
|
|
139 |
/** If some other element is resolved as syncMaster in the time container group,
|
|
140 |
* this element can not act as sync master.
|
|
141 |
* @since S60 3.2
|
|
142 |
* @param aSyncMasterStatus Indicates whether the element is currrently
|
|
143 |
* Sync Master.
|
|
144 |
* @return none.
|
|
145 |
*/
|
|
146 |
void CSvgLockedRealTimeEntity::SetCurSyncMasterStatus( TBool aSyncMasterStatus )
|
|
147 |
{
|
|
148 |
//iSyncMasterCurrent stores current Mastership status of LRT
|
|
149 |
// only if LRT is getting set as syncmaster then only we store the current tick
|
|
150 |
if(aSyncMasterStatus && !iSyncMasterCurrent)
|
|
151 |
{
|
|
152 |
iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
|
|
153 |
#ifdef _DEBUG
|
|
154 |
RDebug::Printf("LRT gets set as Syncmaster \n");
|
|
155 |
#endif
|
|
156 |
}
|
|
157 |
if(iSyncMasterCurrent != aSyncMasterStatus)
|
|
158 |
{
|
|
159 |
iSyncMasterCurrent = aSyncMasterStatus;
|
|
160 |
}
|
|
161 |
#ifdef _DEBUG
|
|
162 |
RDebug::Printf("====================================");
|
|
163 |
RDebug::Printf("IStoredTick.iRealTimeTick %d", iStoredTick.iRealTimeTick);
|
|
164 |
RDebug::Printf("iStoredTick.iParentTcTick %d", iStoredTick.iParentTcTick);
|
|
165 |
RDebug::Printf("====================================");
|
|
166 |
#endif
|
|
167 |
}
|
|
168 |
|
|
169 |
|
|
170 |
//==========================================================================
|
|
171 |
/**
|
|
172 |
* Check if timed entity can provide timing ticks to rest of time
|
|
173 |
* container elements. This behavior could change dynamically.
|
|
174 |
* For example, if audio clip is over, the audio element can't generate
|
|
175 |
* ticks for others.
|
|
176 |
* @since S60 3.2
|
|
177 |
* @param none.
|
|
178 |
* @return TBool True if can generate timing tick.
|
|
179 |
*/
|
|
180 |
// LRT can always generate tick, it acts as a pseudo realtime
|
|
181 |
TBool CSvgLockedRealTimeEntity::CanGenerateTick()
|
|
182 |
{
|
|
183 |
return ETrue;
|
|
184 |
}
|
|
185 |
//==========================================================================
|
|
186 |
/**
|
|
187 |
* Check if timed entity can use its parent's tick. Usually only the
|
|
188 |
* parent document should return true for this function.
|
|
189 |
* All other elements return false
|
|
190 |
* @since S60 3.2
|
|
191 |
* @param none.
|
|
192 |
* @return TBool True if can use parent's timing tick.
|
|
193 |
*/
|
|
194 |
//only used in animation purposes
|
|
195 |
TBool CSvgLockedRealTimeEntity::CanUseParentTick()
|
|
196 |
{
|
|
197 |
return EFalse;
|
|
198 |
}
|
|
199 |
|
|
200 |
//==========================================================================
|
|
201 |
/**
|
|
202 |
* If the timed entity needs to be in sync with the time container and
|
|
203 |
* it has slipped beyond the sync tolerance limit, the method is called to
|
|
204 |
* bring the element in sync with the time container.
|
|
205 |
* @since S60 3.2
|
|
206 |
* @param aSynctime Time for resync in msecs.
|
|
207 |
* @return none.
|
|
208 |
*/
|
|
209 |
|
|
210 |
void CSvgLockedRealTimeEntity::ResyncTimedEntity( TUint32 /*aSynctime*/ )
|
|
211 |
{
|
|
212 |
|
|
213 |
}
|
|
214 |
|
|
215 |
//==========================================================================
|
|
216 |
/**
|
|
217 |
* This would be used for pausing the locked timed entity while other locked
|
|
218 |
* timed entities get loaded.
|
|
219 |
* @since S60 3.2
|
|
220 |
* @param none.
|
|
221 |
* @return none.
|
|
222 |
*/
|
|
223 |
void CSvgLockedRealTimeEntity::PauseTimedEntity()
|
|
224 |
{
|
|
225 |
iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
|
|
226 |
iIsPaused = ETrue;
|
|
227 |
}
|
|
228 |
//==========================================================================
|
|
229 |
/**
|
|
230 |
* This would be used for resuming the locked timed entity once all locked
|
|
231 |
* timed entities get loaded.
|
|
232 |
* @since S60 3.2
|
|
233 |
* @param none.
|
|
234 |
* @return none.
|
|
235 |
*/
|
|
236 |
void CSvgLockedRealTimeEntity::ResumeTimedEntity()
|
|
237 |
{
|
|
238 |
iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
|
|
239 |
iIsPaused = EFalse;
|
|
240 |
}
|
|
241 |
//==========================================================================
|
|
242 |
/**
|
|
243 |
* This would be used for stopping the timed entity.
|
|
244 |
* @since S60 3.2
|
|
245 |
* @param none.
|
|
246 |
* @return none.
|
|
247 |
*/
|
|
248 |
void CSvgLockedRealTimeEntity::StopTimedEntity()
|
|
249 |
{
|
|
250 |
iStoredTick.iParentTcTick = 0;
|
|
251 |
iStoredTick.iRealTimeTick = 0;
|
|
252 |
}
|
|
253 |
|
|
254 |
//==========================================================================
|
|
255 |
/* Return the type of class
|
|
256 |
@Return Type Enumeration of object type
|
|
257 |
@Parameters none
|
|
258 |
*/
|
|
259 |
TSvgObjectType CSvgLockedRealTimeEntity::ObjectType()
|
|
260 |
{
|
|
261 |
return ESvgLockedRealTimeEntity;
|
|
262 |
}
|
|
263 |
|
|
264 |
//==========================================================================
|
|
265 |
//for animation element
|
|
266 |
CSvgTimeContainer* CSvgLockedRealTimeEntity::GetChildTimeContainer()
|
|
267 |
{
|
|
268 |
return NULL;
|
|
269 |
}
|
|
270 |
TBool CSvgLockedRealTimeEntity::AnimProcL( MSvgTimerEvent* /*aEvent*/ )
|
|
271 |
{
|
|
272 |
return ETrue;
|
|
273 |
}
|
|
274 |
void CSvgLockedRealTimeEntity::ResetAnimationL()
|
|
275 |
{
|
|
276 |
|
|
277 |
}
|
|
278 |
|
|
279 |
/*******************************End of file*********************************/
|