60
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-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: Cache implementation for media items sharing the same Id space
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include "glxcache.h"
|
|
22 |
|
|
23 |
#include <glxassert.h>
|
|
24 |
#include <mpxmediadrmdefs.h> // for DRM attributes
|
|
25 |
#include <mpxmediacontainerdefs.h>
|
|
26 |
#include <mpxmediacollectiondetaildefs.h>
|
|
27 |
#include <glxthumbnailattributeinfo.h>
|
|
28 |
#include <glxtracer.h>
|
|
29 |
#include <lbsposition.h> //for TCoordinate
|
|
30 |
|
|
31 |
#include "glxcachemanager.h"
|
|
32 |
#include "glxmedialist.h"
|
|
33 |
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
// Constructor
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
CGlxCache::CGlxCache( const TGlxIdSpaceId& aIdSpaceId, CGlxCacheManager* aCacheManager )
|
|
39 |
: iIdSpaceId( aIdSpaceId ), iCacheManager(aCacheManager)
|
|
40 |
{
|
|
41 |
TRACER("CGlxCache::CGlxCache");
|
|
42 |
}
|
|
43 |
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
// Destructor
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
//
|
|
48 |
CGlxCache::~CGlxCache()
|
|
49 |
{
|
|
50 |
TRACER("CGlxCache::Destructor");
|
|
51 |
iItemPool.ResetAndDestroy();
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// IdSpaceId
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
TGlxIdSpaceId CGlxCache::IdSpaceId() const
|
|
59 |
{
|
|
60 |
TRACER("CGlxCache::IdSpaceId");
|
|
61 |
|
|
62 |
return iIdSpaceId;
|
|
63 |
}
|
|
64 |
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
// return a media object or null
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CGlxMedia* CGlxCache::Media( const TGlxMediaId& aId ) const
|
|
70 |
{
|
|
71 |
TRACER("CGlxCache::Media");
|
|
72 |
|
|
73 |
TInt index = iItemPool.FindInOrder(aId, (&MediaItemOrderByKey));
|
|
74 |
if ( KErrNotFound != index )
|
|
75 |
{
|
|
76 |
return iItemPool[index];
|
|
77 |
}
|
|
78 |
|
|
79 |
return NULL;
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// FindItemForceCreateL
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
CGlxMedia* CGlxCache::FindItemForceCreateL( const TGlxMediaId& aId )
|
|
87 |
{
|
|
88 |
TRACER("CGlxCache::FindItemForceCreateL");
|
|
89 |
|
|
90 |
CGlxMedia* media = Media( aId );
|
|
91 |
|
|
92 |
if ( !media )
|
|
93 |
{
|
|
94 |
media = CreateItemL( aId );
|
|
95 |
}
|
|
96 |
|
|
97 |
return media;
|
|
98 |
}
|
|
99 |
|
|
100 |
// -----------------------------------------------------------------------------
|
|
101 |
// CreateItemL
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
CGlxMedia* CGlxCache::CreateItemL(const TGlxMediaId& aId)
|
|
105 |
{
|
|
106 |
TRACER("CGlxCache::CreateItemL");
|
|
107 |
|
|
108 |
CGlxMedia* item = NULL;
|
|
109 |
|
|
110 |
iItemPool.ReserveL( iItemPool.Count() + 1 );
|
|
111 |
item = new (ELeave) CGlxMedia(aId);
|
|
112 |
TLinearOrder<CGlxMedia> orderer (&MediaItemOrderById);
|
|
113 |
iItemPool.InsertInOrder(item, orderer);
|
|
114 |
|
|
115 |
// Safe to fail, since if the media objects is not used by any lists,
|
|
116 |
// garbage collection will simply delete it
|
|
117 |
RPointerArray<CGlxMediaList>& mediaLists = CGlxMediaList::MediaListsL();
|
|
118 |
|
|
119 |
TInt count = mediaLists.Count();
|
|
120 |
item->ReserveUsersL(count);
|
|
121 |
for (TInt i = 0; i < count; i++)
|
|
122 |
{
|
|
123 |
mediaLists[i]->OfferMedia(iIdSpaceId, item);
|
|
124 |
}
|
|
125 |
|
|
126 |
return item;
|
|
127 |
}
|
|
128 |
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
// MediaUpdatedL
|
|
131 |
// -----------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CGlxCache::MediaUpdatedL(const CMPXMedia& aMedia)
|
|
134 |
{
|
|
135 |
TRACER("CGlxCache::MediaUpdatedL");
|
|
136 |
|
|
137 |
if (aMedia.IsSupported(KMPXMediaArrayContents))
|
|
138 |
{
|
|
139 |
#ifdef _DEBUG
|
|
140 |
TTime startTime;
|
|
141 |
startTime.HomeTime();
|
|
142 |
#endif
|
|
143 |
CMPXMediaArray* mediaArray = aMedia.ValueCObjectL<CMPXMediaArray> (
|
|
144 |
KMPXMediaArrayContents);
|
|
145 |
CleanupStack::PushL(mediaArray);
|
|
146 |
|
|
147 |
TInt arrayCount = mediaArray->Count();
|
|
148 |
GLX_DEBUG2("CGlxCache::MediaUpdatedL() arrayCount=%d", arrayCount);
|
|
149 |
for (TInt count = 0; count < arrayCount; ++count)
|
|
150 |
{
|
|
151 |
UpdateMediaL(*((*mediaArray)[count]));
|
|
152 |
}
|
|
153 |
|
|
154 |
CleanupStack::PopAndDestroy(mediaArray);
|
|
155 |
#ifdef _DEBUG
|
|
156 |
TTime stopTime;
|
|
157 |
stopTime.HomeTime();
|
|
158 |
GLX_DEBUG2("=>CGlxCache::MediaUpdatedL() took <%d> us",
|
|
159 |
(TInt)stopTime.MicroSecondsFrom(startTime).Int64());
|
|
160 |
#endif
|
|
161 |
}
|
|
162 |
else
|
|
163 |
{
|
|
164 |
UpdateMediaL(aMedia);
|
|
165 |
}
|
|
166 |
}
|
|
167 |
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
// UpdateMediaL
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
void CGlxCache::UpdateMediaL(const CMPXMedia& aMedia)
|
|
172 |
{
|
|
173 |
TRACER("CGlxCache::UpdateMediaL");
|
|
174 |
|
|
175 |
if ( !aMedia.IsSupported(KMPXMediaGeneralId) )
|
|
176 |
{
|
|
177 |
return;
|
|
178 |
}
|
|
179 |
// Copy/synchronize attributes
|
|
180 |
TGlxMediaId id ((TUint32)aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
|
|
181 |
GLX_DEBUG2("CGlxCache::UpdateMediaL() id=%d", id.Value());
|
|
182 |
CGlxMedia* item = Media( id );
|
|
183 |
|
|
184 |
RArray<TMPXAttribute> newAttributes;
|
|
185 |
CleanupClosePushL(newAttributes);
|
|
186 |
|
|
187 |
if ( item )
|
|
188 |
{
|
|
189 |
GLX_DEBUG2("MGallery - CGlxCacheManager::HandleCollectionMediaL() existing item for item id %d", id.Value());
|
|
190 |
CopyNewAndModifiedL(*item, aMedia, newAttributes);
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
GLX_DEBUG2("MGallery - CGlxCacheManager::HandleCollectionMediaL() new item for item id %d", id.Value());
|
|
195 |
|
|
196 |
// This is a new item. Create a media object and offer it to all lists.
|
|
197 |
// If the item is no longer needed by any list, then this is ok, since
|
|
198 |
// garbage collection will delete the item
|
|
199 |
// Add in id order.
|
|
200 |
item = CreateItemL(id);
|
|
201 |
|
|
202 |
CopyNewAndModifiedL(*item, aMedia, newAttributes);
|
|
203 |
}
|
|
204 |
|
|
205 |
// Broadcast the new attributes to all observers of the item
|
|
206 |
if (newAttributes.Count() > 0)
|
|
207 |
{
|
|
208 |
TInt count = item->UserCount();
|
|
209 |
for (TInt i = 0; i < count; i++)
|
|
210 |
{
|
|
211 |
item->User( i ).HandleAttributesAvailableL( item->IndexInUser( i ), newAttributes );
|
|
212 |
}
|
|
213 |
}
|
|
214 |
|
|
215 |
CleanupStack::PopAndDestroy(&newAttributes);
|
|
216 |
}
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
// Deletes the media item
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
void CGlxCache::CleanupMedia(const TGlxMediaId& aMediaId)
|
|
221 |
{
|
|
222 |
TRACER("CGlxCache::CleanupMedia");
|
|
223 |
GLX_DEBUG2("CGlxCache::CleanupMedia - aMediaId = %d", aMediaId.Value());
|
|
224 |
if(iCacheManager)
|
|
225 |
{
|
|
226 |
iCacheManager->CleanupMedia(aMediaId);
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
// -----------------------------------------------------------------------------
|
|
231 |
// Handles modifications of item in cache
|
|
232 |
// -----------------------------------------------------------------------------
|
|
233 |
void CGlxCache::HandleItemModified(const TGlxMediaId& aId, const RArray<TMPXAttribute>& aAttributes)
|
|
234 |
{
|
|
235 |
TRACER("CGlxCache::HandleItemModified");
|
|
236 |
|
|
237 |
TInt index = iItemPool.FindInOrder(aId, (&MediaItemOrderByKey));
|
|
238 |
if (index != KErrNotFound)
|
|
239 |
{
|
|
240 |
iItemPool[index]->HandleModified(aAttributes);
|
|
241 |
}
|
|
242 |
}
|
|
243 |
|
|
244 |
// -----------------------------------------------------------------------------
|
|
245 |
// Copies new and modified attributes from the provided media object
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CGlxCache::CopyNewAndModifiedL(CGlxMedia& aTarget, const CMPXMedia& aSource,
|
|
249 |
RArray<TMPXAttribute>& aNewAttributes)
|
|
250 |
{
|
|
251 |
TRACER("CGlxCache::CopyNewAndModifiedL");
|
|
252 |
CleanupClosePushL(aNewAttributes);
|
|
253 |
|
|
254 |
/// @todo This is all temporary until global chunk based CMPXMedia is available
|
|
255 |
TInt count = aSource.Count();
|
|
256 |
GLX_DEBUG2("CGlxCache::CopyNewAndModifiedL() Attribs count=%d", count);
|
|
257 |
aNewAttributes.ReserveL( count );
|
|
258 |
|
|
259 |
for (TInt i = 0; i < count; i++)
|
|
260 |
{
|
|
261 |
const TMPXAttribute& attrib = aSource.Attribute(i);
|
|
262 |
|
|
263 |
if (attrib == KMPXMediaGeneralId)
|
|
264 |
{
|
|
265 |
// Ignore id
|
|
266 |
__ASSERT_DEBUG((TUint32)aSource.ValueTObjectL<TMPXItemId>(attrib) == aTarget.Id().Value(),
|
|
267 |
Panic(EGlxPanicIllegalArgument)); // aMedia relates to another media object than this
|
|
268 |
}
|
|
269 |
else
|
|
270 |
{
|
|
271 |
if (!aTarget.IsSupported(attrib))
|
|
272 |
{
|
|
273 |
TMPXAttributeType type = aSource.Type(i);
|
|
274 |
|
|
275 |
if (type == EMPXTypeText)
|
|
276 |
{
|
|
277 |
aTarget.SetTextValueL(attrib, aSource.ValueText(attrib));
|
|
278 |
}
|
|
279 |
else if (type == EMPXTypeCObject)
|
|
280 |
{
|
|
281 |
if ( KGlxMediaIdThumbnail == attrib.ContentId() )
|
|
282 |
{
|
|
283 |
// This is a thumbnail
|
|
284 |
CFbsBitmap* thumbnail = iCacheManager->TempThumbnail();
|
|
285 |
|
|
286 |
if ( thumbnail && iCacheManager->TempThumbnailId() == aTarget.Id() )
|
|
287 |
{
|
|
288 |
// Add new thumbnail attribute
|
|
289 |
CGlxThumbnailAttribute* value =
|
|
290 |
aSource.ValueNoNewLCObjectL<CGlxThumbnailAttribute>(attrib);
|
|
291 |
CleanupStack::PushL(value);
|
|
292 |
value->iBitmap = thumbnail;
|
|
293 |
GLX_DEBUG3("CGlxCache::CopyNewAndModifiedL() TN Attrib w(%d) h(%d)",
|
|
294 |
thumbnail->SizeInPixels().iWidth, thumbnail->SizeInPixels().iHeight);
|
|
295 |
iCacheManager->SetTempThumbnailToNull();
|
|
296 |
aTarget.SetCObjectValueL(attrib, value);
|
|
297 |
CleanupStack::Pop(value);
|
|
298 |
}
|
|
299 |
}
|
|
300 |
else
|
|
301 |
{
|
|
302 |
__DEBUG_ONLY(Panic(EGlxPanicNotImplemented)); // Add support for the attribute here
|
|
303 |
}
|
|
304 |
}
|
|
305 |
else if (type == EMPXTypeTObject)
|
|
306 |
{
|
|
307 |
if (attrib == KMPXMediaGeneralThumbnail1)
|
|
308 |
{
|
|
309 |
// Old thumbnail attribute - ignore
|
|
310 |
}
|
|
311 |
else if (attrib == KMPXMediaGeneralDate)
|
|
312 |
{
|
|
313 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt64>(attrib));
|
|
314 |
}
|
|
315 |
else if (attrib == KGlxMediaGeneralLastModifiedDate)
|
|
316 |
{
|
|
317 |
TTime modified = aSource.ValueTObjectL<TInt64>(attrib);
|
|
318 |
TTimeIntervalSeconds utcOffset = User::UTCOffset();
|
|
319 |
modified += utcOffset;
|
|
320 |
aTarget.SetTObjectValueL(attrib, modified);
|
|
321 |
}
|
|
322 |
else if (attrib == KMPXMediaGeneralSize)
|
|
323 |
{
|
|
324 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TUint>(attrib));
|
|
325 |
}
|
|
326 |
else if (attrib == KMPXMediaColDetailSpaceId)
|
|
327 |
{
|
|
328 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TGlxIdSpaceId>(attrib));
|
|
329 |
}
|
|
330 |
else if (attrib == KMPXMediaGeneralType)
|
|
331 |
{
|
|
332 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
333 |
}
|
|
334 |
else if (attrib == KMPXMediaGeneralCategory)
|
|
335 |
{
|
|
336 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
337 |
}
|
|
338 |
else if (attrib == KMPXMediaGeneralCount)
|
|
339 |
{
|
|
340 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
341 |
}
|
|
342 |
else if (attrib == KGlxMediaGeneralDimensions)
|
|
343 |
{
|
|
344 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TSize>(attrib));
|
|
345 |
}
|
|
346 |
else if (attrib == KGlxMediaGeneralLocation)
|
|
347 |
{
|
|
348 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TCoordinate>(attrib));
|
|
349 |
}
|
|
350 |
else if (attrib == KMPXMediaGeneralDuration)
|
|
351 |
{
|
|
352 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
353 |
}
|
|
354 |
else if (attrib == KMPXMediaDrmProtected)
|
|
355 |
{
|
|
356 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TBool>(attrib));
|
|
357 |
}
|
|
358 |
else if (attrib == KGlxMediaGeneralDRMRightsValid)
|
|
359 |
{
|
|
360 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TBool>(attrib));
|
|
361 |
}
|
|
362 |
else if (attrib == KGlxMediaGeneralSystemItem)
|
|
363 |
{
|
|
364 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TBool>(attrib));
|
|
365 |
}
|
|
366 |
else if (attrib == KGlxMediaGeneralFramecount)
|
|
367 |
{
|
|
368 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
369 |
}
|
|
370 |
else if(attrib == KGlxMediaGeneralSlideshowableContent)
|
|
371 |
{
|
|
372 |
aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL<TInt>(attrib));
|
|
373 |
}
|
|
374 |
else
|
|
375 |
{
|
|
376 |
__DEBUG_ONLY(Panic(EGlxPanicNotImplemented)); // Add support for the attribute here
|
|
377 |
}
|
|
378 |
}
|
|
379 |
else
|
|
380 |
{
|
|
381 |
__DEBUG_ONLY(Panic(EGlxPanicNotImplemented));
|
|
382 |
}
|
|
383 |
|
|
384 |
aNewAttributes.AppendL(attrib);
|
|
385 |
}
|
|
386 |
}
|
|
387 |
}
|
|
388 |
CleanupStack::Pop(&aNewAttributes);
|
|
389 |
}
|
|
390 |
|
|
391 |
// -----------------------------------------------------------------------------
|
|
392 |
// Delete
|
|
393 |
// -----------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
void CGlxCache::Delete( TInt aIndex )
|
|
396 |
{
|
|
397 |
TRACER("CGlxCache::Delete");
|
|
398 |
|
|
399 |
GLX_ASSERT_DEBUG( 0 <= aIndex && aIndex < iItemPool.Count(),
|
|
400 |
Panic(EGlxPanicIllegalArgument), "deleting attribute out of bounds");
|
|
401 |
|
|
402 |
CGlxMedia* media = iItemPool[aIndex];
|
|
403 |
|
|
404 |
// Cleanup the media from all users, example texture manager
|
|
405 |
CleanupMedia(media->Id());
|
|
406 |
|
|
407 |
GLX_DEBUG2("MGallery - CGlxCache::Delete() for item id %d", media->Id().Value());
|
|
408 |
// notify users that the media object is about to be deleted. This allows
|
|
409 |
// users to remove their references
|
|
410 |
// (loop does not t iterate indexes, since the contents of the User array
|
|
411 |
// will change during calls to RemoveReferences, as users are removed)
|
|
412 |
|
|
413 |
// safety check that RemoveReference actually removed the reference
|
|
414 |
__DEBUG_ONLY( TInt _maxLoopCount = 1000 );
|
|
415 |
|
|
416 |
while ( media->UserCount() > 0 )
|
|
417 |
{
|
|
418 |
// The user must remove a reference and that will decrement the
|
|
419 |
// UserCount()
|
|
420 |
media->User( 0 ).RemoveReference( media->IndexInUser( 0 ) );
|
|
421 |
|
|
422 |
// protect against a bug that would cause hard-to-find infinite loop
|
|
423 |
__DEBUG_ONLY( _maxLoopCount-- );
|
|
424 |
GLX_ASSERT_DEBUG( _maxLoopCount != 0, Panic( EGlxPanicLogicError ),
|
|
425 |
"infinite loop when removing a media object" );
|
|
426 |
}
|
|
427 |
|
|
428 |
delete media;
|
|
429 |
iItemPool.Remove( aIndex );
|
|
430 |
}
|
|
431 |
|
|
432 |
// -----------------------------------------------------------------------------
|
|
433 |
// Reserve space for a number of users, for all items in the cache
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
void CGlxCache::ReserveUsersL(TInt aCount)
|
|
437 |
{
|
|
438 |
TRACER("CGlxCache::ReserveUsersL");
|
|
439 |
|
|
440 |
TInt count = iItemPool.Count();
|
|
441 |
for ( TInt i = 0; i < count ; ++i )
|
|
442 |
{
|
|
443 |
iItemPool[i]->ReserveUsersL( aCount );
|
|
444 |
}
|
|
445 |
}
|
|
446 |
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
// MediaItemOrderById
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
//
|
|
451 |
TInt CGlxCache::MediaItemOrderById(const CGlxMedia& aItem1, const CGlxMedia& aItem2)
|
|
452 |
{
|
|
453 |
TRACER("CGlxCache::MediaItemOrderById");
|
|
454 |
|
|
455 |
// Cannot do aItem1.Id() - aItem2.Id(), since Id().Value() returns an unsigned value
|
|
456 |
TGlxMediaId id1 = aItem1.Id();
|
|
457 |
return MediaItemOrderByKey( &id1, aItem2 );
|
|
458 |
}
|
|
459 |
|
|
460 |
// -----------------------------------------------------------------------------
|
|
461 |
// MediaItemOrderByKey
|
|
462 |
// -----------------------------------------------------------------------------
|
|
463 |
//
|
|
464 |
TInt CGlxCache::MediaItemOrderByKey(const TGlxMediaId* aMediaId, const CGlxMedia& aItem2)
|
|
465 |
{
|
|
466 |
TRACER("CGlxCache::MediaItemOrderByKey");
|
|
467 |
|
|
468 |
TGlxMediaId id2 = aItem2.Id();
|
|
469 |
if (*aMediaId < id2)
|
|
470 |
{
|
|
471 |
return -1;
|
|
472 |
}
|
|
473 |
|
|
474 |
if (*aMediaId > id2)
|
|
475 |
{
|
|
476 |
return 1;
|
|
477 |
}
|
|
478 |
|
|
479 |
return 0;
|
|
480 |
}
|
|
481 |
|
|
482 |
// -----------------------------------------------------------------------------
|
|
483 |
// Return count of media objects
|
|
484 |
// -----------------------------------------------------------------------------
|
|
485 |
//
|
|
486 |
TInt CGlxCache::Count()
|
|
487 |
{
|
|
488 |
TRACER("CGlxCache::Count");
|
|
489 |
|
|
490 |
return iItemPool.Count();
|
|
491 |
}
|
|
492 |
|
|
493 |
// -----------------------------------------------------------------------------
|
|
494 |
// Return media object by index
|
|
495 |
// -----------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
CGlxMedia& CGlxCache::Media( TInt aIndex )
|
|
498 |
{
|
|
499 |
TRACER("CGlxCache::Media");
|
|
500 |
|
|
501 |
return *iItemPool[aIndex];
|
|
502 |
}
|
|
503 |
|
|
504 |
// -----------------------------------------------------------------------------
|
|
505 |
// Return media index
|
|
506 |
// -----------------------------------------------------------------------------
|
|
507 |
//
|
|
508 |
TInt CGlxCache::FindMediaIndexInCache(TGlxMediaId aMediaId)
|
|
509 |
{
|
|
510 |
TRACER("CGlxCache::FindMediaIndexInCache");
|
|
511 |
|
|
512 |
return iItemPool.FindInOrder(aMediaId, (&MediaItemOrderByKey));
|
|
513 |
}
|
|
514 |
|