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: provide synchronized access to file systema and metadata source
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
* @internal reviewed 03/07/2007 by Rowland Cook
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include "glxcommandhandlerdrm.h"
|
|
26 |
|
|
27 |
#include <alf/alfvisual.h>
|
|
28 |
#include <alf/alfdisplay.h>
|
|
29 |
#include <mpxmediadrmdefs.h>
|
|
30 |
#include <mpxmediageneraldefs.h>
|
|
31 |
|
|
32 |
#include <glxattributecontext.h>
|
|
33 |
#include <glxcommandhandlers.hrh>
|
|
34 |
#include "glxdrmiconmanager.h"
|
|
35 |
#include <glxdrmutility.h>
|
|
36 |
#include <glxuiutility.h>
|
|
37 |
#include <glxtracer.h>
|
|
38 |
#include <glxlog.h>
|
|
39 |
#include <glxmediageneraldefs.h>
|
|
40 |
#include <glxthumbnailattributeinfo.h>
|
|
41 |
#include <glxthumbnailinfo.h>
|
|
42 |
#include <glxthumbnailutility.h>
|
|
43 |
#include <glxuistd.h>
|
|
44 |
#include <glxvisuallistmanager.h>
|
|
45 |
#include <mglxmedialist.h>
|
|
46 |
#include <mglxvisuallist.h>
|
|
47 |
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
// Two-phased constructor.
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
EXPORT_C CGlxCommandHandlerDrm* CGlxCommandHandlerDrm::NewL(
|
|
53 |
MGlxMediaListProvider* aMediaListProvider,
|
|
54 |
TBool aContainerList)
|
|
55 |
{
|
|
56 |
CGlxCommandHandlerDrm* self = new ( ELeave )
|
|
57 |
CGlxCommandHandlerDrm(aMediaListProvider);
|
|
58 |
CleanupStack::PushL( self );
|
|
59 |
self->ConstructL(aContainerList);
|
|
60 |
CleanupStack::Pop( self );
|
|
61 |
return self;
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// C++ default constructor can NOT contain any code, that
|
|
66 |
// might leave.
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CGlxCommandHandlerDrm::CGlxCommandHandlerDrm(MGlxMediaListProvider*
|
|
70 |
aMediaListProvider)
|
|
71 |
: CGlxMediaListCommandHandler(aMediaListProvider)
|
|
72 |
{
|
|
73 |
// Do nothing
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// Symbian 2nd phase constructor can leave.
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void CGlxCommandHandlerDrm::ConstructL(TBool aIsContainerList)
|
|
81 |
{
|
|
82 |
TRACER("CGlxCommandHandlerDrm::ConstructL");
|
|
83 |
iIsContainerList = aIsContainerList;
|
|
84 |
|
|
85 |
iDrmUtility = CGlxDRMUtility::InstanceL();
|
|
86 |
|
|
87 |
|
|
88 |
// Add supported commands
|
|
89 |
|
|
90 |
TCommandInfo info( EGlxCmdDRMOpen );
|
|
91 |
// Filter out static items
|
|
92 |
info.iMinSelectionLength = 1;
|
|
93 |
info.iDisallowSystemItems = aIsContainerList;
|
|
94 |
AddCommandL(info);
|
|
95 |
|
|
96 |
// Add view state dummy commands
|
|
97 |
TCommandInfo view( EGlxCmdStateView );
|
|
98 |
AddCommandL( view );
|
|
99 |
TCommandInfo browse( EGlxCmdStateBrowse );
|
|
100 |
AddCommandL( browse );
|
|
101 |
|
|
102 |
// create fetch context
|
|
103 |
iFetchContext = CGlxDefaultAttributeContext::NewL();
|
|
104 |
iFetchContext->AddAttributeL( KMPXMediaDrmProtected );
|
|
105 |
iFetchContext->AddAttributeL( KMPXMediaGeneralCategory );
|
|
106 |
iFetchContext->AddAttributeL( KMPXMediaGeneralUri );
|
|
107 |
iFetchContext->AddAttributeL( KGlxMediaGeneralDimensions );
|
|
108 |
|
|
109 |
iInFullScreen = EFalse;
|
|
110 |
|
|
111 |
// get pointer to HUI utility
|
|
112 |
iUiUtility = CGlxUiUtility::UtilityL();
|
|
113 |
|
|
114 |
// get pointer to visual list manager
|
|
115 |
iVisualListManager = CGlxVisualListManager::ManagerL();
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// Destructor
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
//
|
|
122 |
EXPORT_C CGlxCommandHandlerDrm::~CGlxCommandHandlerDrm()
|
|
123 |
{
|
|
124 |
iDrmUtility->Close();
|
|
125 |
|
|
126 |
if ( iUiUtility )
|
|
127 |
{
|
|
128 |
iUiUtility->Close();
|
|
129 |
}
|
|
130 |
|
|
131 |
if(iVisualListManager)
|
|
132 |
{
|
|
133 |
iVisualListManager->Close();
|
|
134 |
}
|
|
135 |
|
|
136 |
delete iFetchContext;
|
|
137 |
delete iUrl;
|
|
138 |
}
|
|
139 |
|
|
140 |
// ---------------------------------------------------------------------------
|
|
141 |
// ActivateL
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
void CGlxCommandHandlerDrm::DoActivateL(TInt /*aViewId*/)
|
|
145 |
{
|
|
146 |
TRACER("CGlxCommandHandlerDrm::DoActivateL");
|
|
147 |
MGlxMediaList& mediaList = MediaList();
|
|
148 |
mediaList.AddContextL(iFetchContext, KGlxFetchContextPriorityNormal );
|
|
149 |
|
|
150 |
mediaList.AddMediaListObserverL(this);
|
|
151 |
|
|
152 |
// get handle to visual list
|
|
153 |
iVisualList = iVisualListManager->ListL(mediaList,
|
|
154 |
*iUiUtility->Env(), *iUiUtility->Display());
|
|
155 |
|
|
156 |
iVisualList->AddObserverL(this);
|
|
157 |
|
|
158 |
// create DRM icon manager
|
|
159 |
iDrmIconManager = CGlxDrmIconManager::NewL(mediaList, *iVisualList);
|
|
160 |
}
|
|
161 |
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// Deactivate
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CGlxCommandHandlerDrm::Deactivate()
|
|
168 |
{
|
|
169 |
if( iDrmIconManager )
|
|
170 |
{
|
|
171 |
delete iDrmIconManager;
|
|
172 |
iDrmIconManager = NULL;
|
|
173 |
}
|
|
174 |
|
|
175 |
if( iVisualList )
|
|
176 |
{
|
|
177 |
iVisualList->RemoveObserver(this);
|
|
178 |
iVisualListManager->ReleaseList(iVisualList);
|
|
179 |
iVisualList = NULL;
|
|
180 |
}
|
|
181 |
|
|
182 |
MGlxMediaList& mediaList = MediaList();
|
|
183 |
mediaList.RemoveContext(iFetchContext);
|
|
184 |
mediaList.RemoveMediaListObserver(this);
|
|
185 |
}
|
|
186 |
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
// HandleItemAddedL
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void CGlxCommandHandlerDrm::HandleItemAddedL(TInt /*aStartIndex*/,
|
|
192 |
TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
|
|
193 |
{
|
|
194 |
// No implementation
|
|
195 |
}
|
|
196 |
|
|
197 |
// ---------------------------------------------------------------------------
|
|
198 |
// HandleMediaL
|
|
199 |
// ---------------------------------------------------------------------------
|
|
200 |
//
|
|
201 |
void CGlxCommandHandlerDrm::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/)
|
|
202 |
{
|
|
203 |
// No implementation
|
|
204 |
}
|
|
205 |
|
|
206 |
// ---------------------------------------------------------------------------
|
|
207 |
// HandleItemRemovedL
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CGlxCommandHandlerDrm::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/,
|
|
211 |
MGlxMediaList* /*aList*/)
|
|
212 |
{
|
|
213 |
// No implementation
|
|
214 |
}
|
|
215 |
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
// HandleItemModifiedL
|
|
218 |
// ---------------------------------------------------------------------------
|
|
219 |
//
|
|
220 |
void CGlxCommandHandlerDrm::HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/,
|
|
221 |
MGlxMediaList* /*aList*/)
|
|
222 |
{
|
|
223 |
// No implementation
|
|
224 |
}
|
|
225 |
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
// HandleAttributesAvailableL
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void CGlxCommandHandlerDrm::HandleAttributesAvailableL(TInt aItemIndex,
|
|
231 |
const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/)
|
|
232 |
{
|
|
233 |
// if in full-screen consume rights if necessary
|
|
234 |
// only if we have received a newer thumbnail
|
|
235 |
// do not consume rights if already consumed
|
|
236 |
if(iInFullScreen && aItemIndex == MediaList().FocusIndex())
|
|
237 |
{
|
|
238 |
if(!iDrmRightsChecked)
|
|
239 |
{
|
|
240 |
ConsumeDRMRightsL();
|
|
241 |
}
|
|
242 |
}
|
|
243 |
}
|
|
244 |
|
|
245 |
// ---------------------------------------------------------------------------
|
|
246 |
// HandleFocusChangedL
|
|
247 |
// ---------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
void CGlxCommandHandlerDrm::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/,
|
|
250 |
TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
|
|
251 |
{
|
|
252 |
// No implementation
|
|
253 |
}
|
|
254 |
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
// HandleItemSelectedL
|
|
257 |
// ---------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
void CGlxCommandHandlerDrm::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/,
|
|
260 |
MGlxMediaList* /*aList*/)
|
|
261 |
{
|
|
262 |
// No implementation
|
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// HandleMessageL
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CGlxCommandHandlerDrm::HandleMessageL(const CMPXMessage& /*aMessage*/,
|
|
270 |
MGlxMediaList* /*aList*/)
|
|
271 |
{
|
|
272 |
// No implementation
|
|
273 |
}
|
|
274 |
|
|
275 |
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
// HandleFocusChangedL
|
|
278 |
// ---------------------------------------------------------------------------
|
|
279 |
//
|
|
280 |
void CGlxCommandHandlerDrm::HandleFocusChangedL( TInt /*aFocusIndex*/,
|
|
281 |
TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/,
|
|
282 |
NGlxListDefs::TFocusChangeType /*aType*/ )
|
|
283 |
{
|
|
284 |
// if in full-screen consume rights if necessary
|
|
285 |
if(iInFullScreen)
|
|
286 |
{
|
|
287 |
// reset rights consumed flag as we're moving to
|
|
288 |
// newer item
|
|
289 |
iDrmRightsChecked = EFalse;
|
|
290 |
ConsumeDRMRightsL();
|
|
291 |
}
|
|
292 |
}
|
|
293 |
|
|
294 |
|
|
295 |
// ---------------------------------------------------------------------------
|
|
296 |
// ConsumeDRMRightsL
|
|
297 |
// ---------------------------------------------------------------------------
|
|
298 |
//
|
|
299 |
void CGlxCommandHandlerDrm::ConsumeDRMRightsL()
|
|
300 |
{
|
|
301 |
TRACER("CGlxCommandHandlerDrm::ConsumeDRMRightsL");
|
|
302 |
|
|
303 |
MGlxMediaList& mediaList = MediaList();
|
|
304 |
|
|
305 |
GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL have mlist");
|
|
306 |
|
|
307 |
TInt index = mediaList.FocusIndex();
|
|
308 |
User::LeaveIfError(index); // FocusIndex() can return KErrNotFound
|
|
309 |
|
|
310 |
const TGlxMedia& item = mediaList.Item(index);
|
|
311 |
const CGlxMedia* media = item.Properties();
|
|
312 |
|
|
313 |
if(media)
|
|
314 |
{
|
|
315 |
if(item.IsDrmProtected())
|
|
316 |
{
|
|
317 |
GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL drm item");
|
|
318 |
|
|
319 |
TMPXGeneralCategory cat = item.Category();
|
|
320 |
const TDesC& uri = item.Uri();
|
|
321 |
if( cat != EMPXNoCategory && uri.Length() > 0 )
|
|
322 |
{
|
|
323 |
GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL check rights");
|
|
324 |
|
|
325 |
// check if rights have expired
|
|
326 |
TBool expired = !iDrmUtility->ItemRightsValidityCheckL(uri, (cat == EMPXImage));
|
|
327 |
|
|
328 |
if(expired)
|
|
329 |
{
|
|
330 |
GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL show expiry note");
|
|
331 |
|
|
332 |
if( iDrmIconManager )
|
|
333 |
{
|
|
334 |
iDrmIconManager->RemoveOverlayIcon( index, ETrue );
|
|
335 |
}
|
|
336 |
|
|
337 |
// check if rights have expired
|
|
338 |
// show expiry note
|
|
339 |
iDrmUtility->ShowRightsInfoL(uri);
|
|
340 |
return;
|
|
341 |
}
|
|
342 |
|
|
343 |
if( iDrmIconManager )
|
|
344 |
{
|
|
345 |
iDrmIconManager->RemoveOverlayIcon( index, EFalse );
|
|
346 |
}
|
|
347 |
|
|
348 |
TSize size;
|
|
349 |
if(EMPXImage == cat && item.GetDimensions(size))
|
|
350 |
{
|
|
351 |
|
|
352 |
// check size
|
|
353 |
TSize bmpSize = ThumbnailSize(media);
|
|
354 |
|
|
355 |
if(ConsumeRightsBasedOnSize(index, size, bmpSize))
|
|
356 |
{
|
|
357 |
// pass URI to DRM utility
|
|
358 |
iDrmUtility->ConsumeRightsL(uri);
|
|
359 |
iDrmRightsChecked = ETrue;
|
|
360 |
}
|
|
361 |
}
|
|
362 |
}
|
|
363 |
}
|
|
364 |
else
|
|
365 |
{
|
|
366 |
// not an DRM'd item no need to check again
|
|
367 |
iDrmRightsChecked = ETrue;
|
|
368 |
}
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
// ---------------------------------------------------------------------------
|
|
373 |
// HandleSizeChanged
|
|
374 |
// ---------------------------------------------------------------------------
|
|
375 |
//
|
|
376 |
void CGlxCommandHandlerDrm::HandleSizeChanged( const TSize& /*aSize*/, MGlxVisualList* /*aList*/ )
|
|
377 |
{
|
|
378 |
// No implementation
|
|
379 |
}
|
|
380 |
|
|
381 |
// ---------------------------------------------------------------------------
|
|
382 |
// HandleVisualRemoved
|
|
383 |
// ---------------------------------------------------------------------------
|
|
384 |
//
|
|
385 |
void CGlxCommandHandlerDrm::HandleVisualRemoved( const CAlfVisual* /*aVisual*/, MGlxVisualList* /*aList*/ )
|
|
386 |
{
|
|
387 |
// No implementation
|
|
388 |
}
|
|
389 |
|
|
390 |
// ---------------------------------------------------------------------------
|
|
391 |
// HandleVisualAddedL
|
|
392 |
// ---------------------------------------------------------------------------
|
|
393 |
//
|
|
394 |
void CGlxCommandHandlerDrm::HandleVisualAddedL( CAlfVisual* /*aVisual*/, TInt /*aIndex*/, MGlxVisualList* /*aList*/ )
|
|
395 |
{
|
|
396 |
// No implementation
|
|
397 |
}
|
|
398 |
|
|
399 |
// -----------------------------------------------------------------------------
|
|
400 |
// DoExecute - the relevant action for the command id
|
|
401 |
// -----------------------------------------------------------------------------
|
|
402 |
//
|
|
403 |
TBool CGlxCommandHandlerDrm::DoExecuteL(TInt aCommandId,
|
|
404 |
MGlxMediaList& /*aList*/)
|
|
405 |
{
|
|
406 |
TRACER("CGlxCommandHandlerDrm::DoExecuteL");
|
|
407 |
TBool handledCommand = ETrue;
|
|
408 |
|
|
409 |
switch (aCommandId)
|
|
410 |
{
|
|
411 |
case EGlxCmdDRMOpen:
|
|
412 |
// newly opened item
|
|
413 |
// reset rights consumed flag
|
|
414 |
iDrmRightsChecked = EFalse;
|
|
415 |
|
|
416 |
// do not re-consume rights on return from UMP view
|
|
417 |
// only consume if navigation has been forwards
|
|
418 |
if ( iUiUtility->ViewNavigationDirection()
|
|
419 |
== EGlxNavigationForwards )
|
|
420 |
{
|
|
421 |
ConsumeDRMRightsL();
|
|
422 |
}
|
|
423 |
|
|
424 |
break;
|
|
425 |
|
|
426 |
case EGlxCmdStateView:
|
|
427 |
iInFullScreen = ETrue;
|
|
428 |
handledCommand = EFalse;
|
|
429 |
break;
|
|
430 |
|
|
431 |
case EGlxCmdStateBrowse:
|
|
432 |
iInFullScreen = EFalse;
|
|
433 |
handledCommand = EFalse;
|
|
434 |
if(iDrmIconManager)
|
|
435 |
{
|
|
436 |
iDrmIconManager->AddOverlayIconsL();
|
|
437 |
}
|
|
438 |
break;
|
|
439 |
default:
|
|
440 |
{
|
|
441 |
handledCommand = EFalse;
|
|
442 |
break;
|
|
443 |
}
|
|
444 |
}
|
|
445 |
|
|
446 |
return handledCommand;
|
|
447 |
}
|
|
448 |
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
// DoIsDisabled
|
|
451 |
// -----------------------------------------------------------------------------
|
|
452 |
//
|
|
453 |
TBool CGlxCommandHandlerDrm::DoIsDisabled(TInt /*aCommandId*/,
|
|
454 |
MGlxMediaList& /*aList*/) const
|
|
455 |
{
|
|
456 |
return EFalse;
|
|
457 |
}
|
|
458 |
|
|
459 |
// -----------------------------------------------------------------------------
|
|
460 |
// ConsumeRightsBasedOnSize - check if DRM rights should be consumed
|
|
461 |
// -----------------------------------------------------------------------------
|
|
462 |
//
|
|
463 |
TBool CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize(TInt aItemIndex,
|
|
464 |
TSize aImageSize, TSize aBitmapSize)
|
|
465 |
{
|
|
466 |
TRACER("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize");
|
|
467 |
|
|
468 |
// minimum size (120 x 90)
|
|
469 |
TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight;
|
|
470 |
|
|
471 |
// size of actual image
|
|
472 |
TInt imgSize = aImageSize.iWidth * aImageSize.iHeight;
|
|
473 |
|
|
474 |
// bitmap size
|
|
475 |
TInt bmpSize = aBitmapSize.iWidth * aBitmapSize.iHeight;
|
|
476 |
|
|
477 |
// size of HUI display
|
|
478 |
TSize dispSize = iUiUtility->DisplaySize();
|
|
479 |
|
|
480 |
// Get size of visual based on aspect ratio of image
|
|
481 |
TSize visImgSize;
|
|
482 |
if(iVisualList)
|
|
483 |
{
|
|
484 |
CAlfVisual* vis = iVisualList->Visual(aItemIndex);
|
|
485 |
if(vis)
|
|
486 |
{
|
|
487 |
if(dispSize.iWidth>0 && dispSize.iHeight>0)
|
|
488 |
{
|
|
489 |
TReal widthRatio = (TReal)aImageSize.iWidth/(TReal)dispSize.iWidth;
|
|
490 |
TReal heightRatio = (TReal)aImageSize.iHeight/(TReal)dispSize.iHeight;
|
|
491 |
|
|
492 |
if(widthRatio > heightRatio)
|
|
493 |
{
|
|
494 |
dispSize.iHeight = aImageSize.iHeight / widthRatio;
|
|
495 |
}
|
|
496 |
else
|
|
497 |
{
|
|
498 |
if(heightRatio>0)
|
|
499 |
{
|
|
500 |
dispSize.iWidth = aImageSize.iWidth / heightRatio;
|
|
501 |
}
|
|
502 |
}
|
|
503 |
}
|
|
504 |
|
|
505 |
}
|
|
506 |
}
|
|
507 |
|
|
508 |
TInt visSize2 = dispSize.iWidth * dispSize.iHeight;
|
|
509 |
|
|
510 |
// if thumbnail is smaller than visual use this for comparison
|
|
511 |
if(bmpSize < visSize2)
|
|
512 |
{
|
|
513 |
visSize2 = bmpSize;
|
|
514 |
}
|
|
515 |
|
|
516 |
// is bmp smaller than 1/4 of image size
|
|
517 |
if(imgSize/4 < minSize)
|
|
518 |
{
|
|
519 |
minSize = imgSize/4;
|
|
520 |
}
|
|
521 |
|
|
522 |
//
|
|
523 |
if(visSize2 >= minSize)
|
|
524 |
{
|
|
525 |
GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize true");
|
|
526 |
iDrmRightsChecked = ETrue;
|
|
527 |
}
|
|
528 |
|
|
529 |
return iDrmRightsChecked;
|
|
530 |
}
|
|
531 |
|
|
532 |
// -----------------------------------------------------------------------------
|
|
533 |
// ThumbnailSizeAndQuality - search for largest available thumbnail
|
|
534 |
// -----------------------------------------------------------------------------
|
|
535 |
//
|
|
536 |
TSize CGlxCommandHandlerDrm::ThumbnailSize(const CGlxMedia* aMedia)
|
|
537 |
{
|
|
538 |
TRACER("CGlxCommandHandlerDrm::ThumbnailSize");
|
|
539 |
TSize bmpSize(0,0);
|
|
540 |
|
|
541 |
TArray<TMPXAttribute> attr = aMedia->Attributes();
|
|
542 |
|
|
543 |
TInt selectedHeight = 0;
|
|
544 |
TInt selectedWidth = 0;
|
|
545 |
|
|
546 |
TInt count = attr.Count();
|
|
547 |
for(TInt i=0; i<count; i++)
|
|
548 |
{
|
|
549 |
|
|
550 |
if ( KGlxMediaIdThumbnail == attr[i].ContentId()
|
|
551 |
&& GlxIsFullThumbnailAttribute(attr[i].AttributeId()) )
|
|
552 |
{
|
|
553 |
// Get selected Quality, height and width from attribute
|
|
554 |
const CGlxThumbnailAttribute* thumbAtt =
|
|
555 |
static_cast<const CGlxThumbnailAttribute*>
|
|
556 |
(aMedia->ValueCObject( attr[i]));
|
|
557 |
|
|
558 |
if(thumbAtt)
|
|
559 |
{
|
|
560 |
|
|
561 |
selectedHeight = thumbAtt->iDimensions.iHeight;
|
|
562 |
selectedWidth = thumbAtt->iDimensions.iWidth;
|
|
563 |
|
|
564 |
if((selectedHeight * selectedWidth) >
|
|
565 |
(bmpSize.iHeight * bmpSize.iWidth))
|
|
566 |
{
|
|
567 |
bmpSize.iWidth = selectedWidth;
|
|
568 |
bmpSize.iHeight = selectedHeight;
|
|
569 |
}
|
|
570 |
}
|
|
571 |
}
|
|
572 |
}
|
|
573 |
return bmpSize;
|
|
574 |
}
|