|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: CVcxHgMyVideosVideoDataUpdater implementation* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <mpxmediaarray.h> |
|
22 #include <mpxmedia.h> |
|
23 #include <mpxmediageneraldefs.h> |
|
24 |
|
25 #include <ganes/HgScroller.h> |
|
26 #include <ganes/HgItem.h> |
|
27 |
|
28 #include <thumbnailmanager.h> |
|
29 #include <thumbnailmanagerobserver.h> |
|
30 #include <thumbnailobjectsource.h> |
|
31 #include <thumbnaildata.h> |
|
32 #include <DRMCommon.h> // DRM |
|
33 #include <gulicon.h> |
|
34 |
|
35 #include "IptvDebug.h" |
|
36 #include <vcxmyvideosdefs.h> |
|
37 #include "vcxhgmyvideosmodel.h" |
|
38 #include "vcxhgmyvideosmainview.h" |
|
39 #include "vcxhgmyvideosvideolist.h" |
|
40 #include "vcxhgmyvideosvideodataupdater.h" |
|
41 #include "vcxhgmyvideosindicatorhelper.h" |
|
42 |
|
43 const TInt KRefreshTimerInterval( 1000000 ); // 1 second |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CVcxHgMyVideosVideoDataUpdater::NewL() |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CVcxHgMyVideosVideoDataUpdater* CVcxHgMyVideosVideoDataUpdater::NewL( |
|
52 CVcxHgMyVideosModel& aModel, |
|
53 CHgScroller& aScroller, |
|
54 CVcxHgMyVideosVideoList& aVideoArray ) |
|
55 { |
|
56 CVcxHgMyVideosVideoDataUpdater* self = |
|
57 CVcxHgMyVideosVideoDataUpdater::NewLC( aModel, |
|
58 aScroller, |
|
59 aVideoArray ); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CVcxHgMyVideosVideoDataUpdater::NewLC() |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CVcxHgMyVideosVideoDataUpdater* CVcxHgMyVideosVideoDataUpdater::NewLC( |
|
69 CVcxHgMyVideosModel& aModel, |
|
70 CHgScroller& aScroller, |
|
71 CVcxHgMyVideosVideoList& aVideoArray ) |
|
72 { |
|
73 CVcxHgMyVideosVideoDataUpdater* self = |
|
74 new (ELeave) CVcxHgMyVideosVideoDataUpdater( aModel, |
|
75 aScroller, |
|
76 aVideoArray ); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 return self; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CVcxHgMyVideosVideoDataUpdater::CVcxHgMyVideosVideoDataUpdater() |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CVcxHgMyVideosVideoDataUpdater::CVcxHgMyVideosVideoDataUpdater( |
|
87 CVcxHgMyVideosModel& aModel, |
|
88 CHgScroller& aScroller, |
|
89 CVcxHgMyVideosVideoList& aVideoArray ) |
|
90 : CActive( EPriorityStandard ), |
|
91 iModel( aModel ), |
|
92 iScroller( aScroller ), |
|
93 iVideoArray( aVideoArray ), |
|
94 iPaused( EFalse ) |
|
95 { |
|
96 CActiveScheduler::Add( this ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CVcxHgMyVideosVideoDataUpdater::ConstructL() |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CVcxHgMyVideosVideoDataUpdater::ConstructL() |
|
104 { |
|
105 iRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CVcxHgMyVideosVideoDataUpdater::InfoArrayChanged() |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CVcxHgMyVideosVideoDataUpdater::InfoArrayChanged() |
|
113 { |
|
114 // Can we optimise this? Many times new video list contains lot of items |
|
115 // from the old one. But how to make sure there isn't any radical changes... |
|
116 |
|
117 CancelAndDeleteFetchArray(); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CVcxHgMyVideosVideoDataUpdater::~CVcxHgMyVideosVideoDataUpdater() |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 CVcxHgMyVideosVideoDataUpdater::~CVcxHgMyVideosVideoDataUpdater() |
|
125 { |
|
126 if ( iRefreshTimer ) |
|
127 { |
|
128 // Calling cancel without checking if the timer is active is safe. |
|
129 iRefreshTimer->Cancel(); |
|
130 delete iRefreshTimer; |
|
131 } |
|
132 |
|
133 CancelAndDeleteFetchArray(); |
|
134 delete iTnEngine; |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CVcxHgMyVideosVideoDataUpdater::SetPausedL() |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void CVcxHgMyVideosVideoDataUpdater::SetPausedL( TBool aPaused ) |
|
142 { |
|
143 iPaused = aPaused; |
|
144 |
|
145 if ( ! iPaused ) |
|
146 { |
|
147 ContinueVideoDataFetchingL(); |
|
148 } |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CVcxHgMyVideosVideoDataUpdater::RequestDataL() |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CVcxHgMyVideosVideoDataUpdater::RequestDataL( TMPXItemId aMPXItemId ) |
|
156 { |
|
157 AddItemToFetchArrayL( aMPXItemId ); |
|
158 ContinueVideoDataFetchingL(); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CVcxHgMyVideosVideoDataUpdater::ReleaseData() |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CVcxHgMyVideosVideoDataUpdater::ReleaseData( TMPXItemId aMPXItemId ) |
|
166 { |
|
167 RemoveItem( IndexByMPXItemId( aMPXItemId ) ); |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CVcxHgMyVideosVideoDataUpdater::RemoveItem() |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CVcxHgMyVideosVideoDataUpdater::RemoveItem( TInt aIndex ) |
|
175 { |
|
176 if ( aIndex >= 0 && aIndex < iFetchArray.Count() ) |
|
177 { |
|
178 CancelActivities( aIndex ); |
|
179 |
|
180 delete iFetchArray[aIndex]; |
|
181 iFetchArray[aIndex] = NULL; |
|
182 iFetchArray.Remove( aIndex ); |
|
183 } |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CVcxHgMyVideosVideoDataUpdater::AddItemToFetchArrayL() |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CVcxHgMyVideosVideoDataUpdater::AddItemToFetchArrayL( TMPXItemId aMPXItemId ) |
|
191 { |
|
192 CVcxHgMyVideosVideoData* newItem = CVcxHgMyVideosVideoData::NewLC(); |
|
193 newItem->SetMPXItemId( aMPXItemId ); |
|
194 iFetchArray.AppendL( newItem ); |
|
195 |
|
196 CleanupStack::Pop( newItem ); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CVcxHgMyVideosVideoDataUpdater::CancelActivities() |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CVcxHgMyVideosVideoDataUpdater::CancelActivities( TInt aIndex ) |
|
204 { |
|
205 if ( aIndex >= 0 && aIndex < iFetchArray.Count() ) |
|
206 { |
|
207 CVcxHgMyVideosVideoData::TVideoDataState state = iFetchArray[aIndex]->State(); |
|
208 |
|
209 if ( state == CVcxHgMyVideosVideoData::EVideoDataStateThumbnailStarted ) |
|
210 { |
|
211 // Cancel thumbnail generation. Safe to ignore leave, as the ThumbnailManagerL |
|
212 // can only leave if iTnEngine is not created yet, so there cannot be |
|
213 // any outstanding requests either. |
|
214 TRAP_IGNORE( ThumbnailManagerL()->CancelRequest( |
|
215 iFetchArray[aIndex]->ThumbnailConversionId() ) ); |
|
216 } |
|
217 else if ( state == CVcxHgMyVideosVideoData::EVideoDataStateDrmStarted ) |
|
218 { |
|
219 // Cancel DRM checking. |
|
220 Cancel(); |
|
221 } |
|
222 } |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CVcxHgMyVideosVideoDataUpdater::CancelAndDeleteFetchArray() |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 void CVcxHgMyVideosVideoDataUpdater::CancelAndDeleteFetchArray() |
|
230 { |
|
231 for ( TInt i = 0; i < iFetchArray.Count(); i++ ) |
|
232 { |
|
233 RemoveItem( i ); |
|
234 } |
|
235 iFetchArray.ResetAndDestroy(); |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CVcxHgMyVideosVideoDataUpdater::ContinueVideoDataFetchingL() |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CVcxHgMyVideosVideoDataUpdater::ContinueVideoDataFetchingL() |
|
243 { |
|
244 if ( iFetchArray.Count() >= 1 && ! iPaused && iVideoArray.VideoCount() > 0 ) |
|
245 { |
|
246 TBool go = EFalse; |
|
247 |
|
248 // If first item is in idle state, we need to start new operation. |
|
249 if ( iFetchArray[0]->State() == CVcxHgMyVideosVideoData::EVideoDataStateNone ) |
|
250 { |
|
251 // It's safe to ignore leave here, because in that case we just use the first index |
|
252 // of fetch array. |
|
253 TRAP_IGNORE( SelectNextIndexL() ); |
|
254 go = ETrue; |
|
255 } |
|
256 // If thumbnail generation has finished, start DRM checking. |
|
257 else if ( iFetchArray[0]->State() == CVcxHgMyVideosVideoData::EVideoDataStateThumbnailFinished ) |
|
258 { |
|
259 go = ETrue; |
|
260 } |
|
261 // If first item has completed all operations, remove it and start with second one. |
|
262 else if ( iFetchArray[0]->State() == CVcxHgMyVideosVideoData::EVideoDataStateDrmFinished ) |
|
263 { |
|
264 UpdateVideoDataToUiL( *( iFetchArray[0] ) ); |
|
265 RemoveItem( 0 ); |
|
266 |
|
267 if ( iFetchArray.Count() >= 1 ) |
|
268 { |
|
269 TRAP_IGNORE( SelectNextIndexL() ); |
|
270 go = ETrue; |
|
271 } |
|
272 } |
|
273 |
|
274 if ( go ) |
|
275 { |
|
276 if ( iFetchArray[0]->State() == CVcxHgMyVideosVideoData::EVideoDataStateNone ) |
|
277 { |
|
278 CMPXMedia* media = iVideoArray.MPXMediaByMPXItemId( iFetchArray[0]->MPXItemId() ); |
|
279 |
|
280 if ( media && media->IsSupported( KMPXMediaGeneralUri ) ) |
|
281 { |
|
282 HBufC* mimeType = NULL; |
|
283 if ( media->IsSupported( KMPXMediaGeneralMimeType ) ) |
|
284 { |
|
285 mimeType = media->ValueText( KMPXMediaGeneralMimeType ).AllocLC(); |
|
286 } |
|
287 else |
|
288 { |
|
289 mimeType = HBufC::NewLC( 1 ); |
|
290 } |
|
291 |
|
292 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
293 media->ValueText( KMPXMediaGeneralUri ), |
|
294 *mimeType ); |
|
295 iFetchArray[0]->SetThumbnailConversionId( |
|
296 ThumbnailManagerL()->GetThumbnailL( *source ) ); |
|
297 CleanupStack::PopAndDestroy( source ); |
|
298 CleanupStack::PopAndDestroy( mimeType ); |
|
299 |
|
300 IPTVLOGSTRING3_LOW_LEVEL( |
|
301 "MPX My Videos UI # GetThumbnailL() called thumbID %d for %S.", |
|
302 iFetchArray[0]->ThumbnailConversionId(), |
|
303 &media->ValueText( KMPXMediaGeneralUri ) ); |
|
304 |
|
305 iRefreshTimer->Cancel(); |
|
306 iRefreshTimer->Start( KRefreshTimerInterval, |
|
307 KRefreshTimerInterval, |
|
308 TCallBack( RefreshTimerCallBack, this ) ); |
|
309 |
|
310 iFetchArray[0]->SetState( |
|
311 CVcxHgMyVideosVideoData::EVideoDataStateThumbnailStarted ); |
|
312 } |
|
313 } |
|
314 else if ( iFetchArray[0]->State() == |
|
315 CVcxHgMyVideosVideoData::EVideoDataStateThumbnailFinished ) |
|
316 { |
|
317 if ( ! IsActive() ) |
|
318 { |
|
319 SetActive(); |
|
320 iStatus = KRequestPending; |
|
321 TRequestStatus* stat = &iStatus; |
|
322 User::RequestComplete(stat, KErrNone); |
|
323 |
|
324 iFetchArray[0]->SetState( |
|
325 CVcxHgMyVideosVideoData::EVideoDataStateDrmStarted ); |
|
326 } |
|
327 } |
|
328 } |
|
329 } |
|
330 } |
|
331 |
|
332 // ----------------------------------------------------------------------------- |
|
333 // CVcxHgMyVideosVideoDataUpdater::UpdateVideoDataToUiL() |
|
334 // ----------------------------------------------------------------------------- |
|
335 // |
|
336 void CVcxHgMyVideosVideoDataUpdater::UpdateVideoDataToUiL( CVcxHgMyVideosVideoData& videoData ) |
|
337 { |
|
338 TInt index = iVideoArray.IndexByMPXItemId( videoData.MPXItemId() ); |
|
339 |
|
340 if ( index >= 0 && index < iScroller.ItemCount() ) |
|
341 { |
|
342 TBool drmUpdate = videoData.DrmProtected(); |
|
343 CHgItem& listItem = iScroller.ItemL( index ); |
|
344 |
|
345 if ( videoData.Thumbnail() ) |
|
346 { |
|
347 CGulIcon* thumbnail = CGulIcon::NewL( videoData.Thumbnail( ETrue ) ); |
|
348 listItem.SetIcon( thumbnail ); |
|
349 } |
|
350 |
|
351 if ( drmUpdate ) |
|
352 { |
|
353 TVcxHgMyVideosIndicatorHelper::TIndicatorDrmStatus drmStatus; |
|
354 CMPXMedia* media = iVideoArray.MPXMedia( index ); |
|
355 |
|
356 if ( media ) |
|
357 { |
|
358 TVcxHgMyVideosIndicatorHelper indicatorHelper; |
|
359 TInt indicator1( 0 ); |
|
360 TInt indicator2( 0 ); |
|
361 |
|
362 if ( videoData.ValidDrmRights() ) |
|
363 { |
|
364 drmStatus = TVcxHgMyVideosIndicatorHelper::EIndicatorDrmStatusValid; |
|
365 } |
|
366 else |
|
367 { |
|
368 drmStatus = TVcxHgMyVideosIndicatorHelper::EIndicatorDrmStatusExpired; |
|
369 } |
|
370 |
|
371 TBool isNewVideo( EFalse ); |
|
372 if ( media->IsSupported( KMPXMediaGeneralFlags ) ) |
|
373 { |
|
374 if ( media->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ) & |
|
375 EVcxMyVideosVideoNew ) |
|
376 { |
|
377 isNewVideo = ETrue; |
|
378 } |
|
379 } |
|
380 |
|
381 indicatorHelper.GetIndicatorsForVideoL( |
|
382 iModel, |
|
383 isNewVideo, |
|
384 EFalse, // *Recordings* |
|
385 media->ValueText( KMPXMediaGeneralUri ), |
|
386 drmStatus, |
|
387 indicator1, |
|
388 indicator2 ); |
|
389 |
|
390 if ( indicator1 ) |
|
391 { |
|
392 listItem.SetFlags( indicator1 ); |
|
393 } |
|
394 if ( indicator2 ) |
|
395 { |
|
396 listItem.SetFlags( indicator2 ); |
|
397 } |
|
398 } |
|
399 } |
|
400 |
|
401 if ( ListRefreshNeeded( index ) ) |
|
402 { |
|
403 RefreshScreen(); |
|
404 } |
|
405 } |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CVcxHgMyVideosVideoDataUpdater::IndexByMPXItemId() |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 TInt CVcxHgMyVideosVideoDataUpdater::IndexByMPXItemId( TMPXItemId aMPXItemId ) |
|
413 { |
|
414 for ( TInt i = 0; i < iFetchArray.Count(); i++ ) |
|
415 { |
|
416 if ( iFetchArray[i]->MPXItemId() == aMPXItemId ) |
|
417 { |
|
418 return i; |
|
419 } |
|
420 } |
|
421 return KErrNotFound; |
|
422 } |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // CVcxHgMyVideosVideoDataUpdater::SelectNextIndexL() |
|
426 // ----------------------------------------------------------------------------- |
|
427 // |
|
428 void CVcxHgMyVideosVideoDataUpdater::SelectNextIndexL() |
|
429 { |
|
430 TInt firstIndexOnScreen = iScroller.FirstIndexOnScreen(); |
|
431 |
|
432 if ( firstIndexOnScreen < 0 ) |
|
433 { |
|
434 firstIndexOnScreen = 0; |
|
435 } |
|
436 |
|
437 TInt lastIndexOnScreen = firstIndexOnScreen + iScroller.ItemsOnScreen(); |
|
438 |
|
439 if ( lastIndexOnScreen >= iScroller.ItemCount() ) |
|
440 { |
|
441 lastIndexOnScreen = iScroller.ItemCount() - 1; |
|
442 } |
|
443 |
|
444 // If visible items not found, updater takes object from 0 index. |
|
445 for ( TInt i = firstIndexOnScreen; i <= lastIndexOnScreen; i++ ) |
|
446 { |
|
447 TInt index( KErrNotFound ); |
|
448 TMPXItemId mpxItemId; |
|
449 CGulIcon* icon( NULL ); |
|
450 |
|
451 // Skip if list item already have a thumbnail. |
|
452 icon = iScroller.ItemL( i ).Icon(); |
|
453 if ( !icon ) |
|
454 { |
|
455 mpxItemId = iVideoArray.ArrayIndexToMpxItemIdL( i ); |
|
456 index = IndexByMPXItemId( mpxItemId ); |
|
457 |
|
458 if ( index > 0 ) |
|
459 { |
|
460 // Move selected index to first index of the fetch array. |
|
461 iFetchArray.Insert( iFetchArray[index], 0 ); |
|
462 iFetchArray.Remove( index + 1 ); |
|
463 break; |
|
464 } |
|
465 } |
|
466 } |
|
467 } |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // CVcxHgMyVideosVideoDataUpdater::RefreshTimerCallBack() |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 TInt CVcxHgMyVideosVideoDataUpdater::RefreshTimerCallBack( TAny* aAny ) |
|
474 { |
|
475 CVcxHgMyVideosVideoDataUpdater* self = static_cast<CVcxHgMyVideosVideoDataUpdater*>( aAny ); |
|
476 self->iRefreshTimer->Cancel(); |
|
477 if ( self->iListRefreshIsDelayed ) |
|
478 { |
|
479 self->iListRefreshIsDelayed = EFalse; |
|
480 if ( !self->iPaused ) |
|
481 { |
|
482 self->RefreshScreen(); |
|
483 } |
|
484 } |
|
485 return KErrNone; |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CVcxHgMyVideosVideoDataUpdater::RefreshScreen() |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 void CVcxHgMyVideosVideoDataUpdater::RefreshScreen() |
|
493 { |
|
494 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoDataUpdater::RefreshScreen()" ); |
|
495 iScroller.DrawDeferred(); |
|
496 } |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // CVcxHgMyVideosVideoDataUpdater::ListRefreshNeeded() |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 TBool CVcxHgMyVideosVideoDataUpdater::ListRefreshNeeded( TInt aIndex ) |
|
503 { |
|
504 TBool modifiedIndexOnScreen( EFalse ); |
|
505 TInt firstIndexOnScreen( iScroller.FirstIndexOnScreen() ); |
|
506 |
|
507 if ( firstIndexOnScreen < 0 ) |
|
508 { |
|
509 firstIndexOnScreen = 0; |
|
510 } |
|
511 |
|
512 TInt lastIndexOnScreen = firstIndexOnScreen + iScroller.ItemsOnScreen(); |
|
513 |
|
514 if ( lastIndexOnScreen >= iScroller.ItemCount() ) |
|
515 { |
|
516 lastIndexOnScreen = iScroller.ItemCount() - 1; |
|
517 } |
|
518 |
|
519 if ( aIndex >= firstIndexOnScreen && aIndex <= lastIndexOnScreen ) |
|
520 { |
|
521 modifiedIndexOnScreen = ETrue; |
|
522 } |
|
523 |
|
524 TBool timerHasExpired( ! iRefreshTimer->IsActive() ); |
|
525 TBool refreshNeeded( EFalse ); |
|
526 |
|
527 if ( ( iListRefreshIsDelayed && !modifiedIndexOnScreen ) |
|
528 || iFetchArray.Count() <= 1 || timerHasExpired ) |
|
529 { |
|
530 iListRefreshIsDelayed = EFalse; |
|
531 refreshNeeded = ETrue; |
|
532 } |
|
533 else if ( modifiedIndexOnScreen ) |
|
534 { |
|
535 iListRefreshIsDelayed = ETrue; |
|
536 } |
|
537 |
|
538 return refreshNeeded; |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CVcxHgMyVideosVideoDataUpdater::ThumbnailManagerL() |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 CThumbnailManager* CVcxHgMyVideosVideoDataUpdater::ThumbnailManagerL() |
|
546 { |
|
547 if ( !iTnEngine ) |
|
548 { |
|
549 IPTVLOGSTRING_LOW_LEVEL( |
|
550 "MPX My Videos UI # CVcxHgMyVideosVideoDataUpdater::ThumbnailManagerL: Creating thumbnail manager." ); |
|
551 |
|
552 iTnEngine = CThumbnailManager::NewL( *this ); |
|
553 iTnEngine->SetThumbnailSizeL( EVideoListThumbnailSize ); |
|
554 iTnEngine->SetDisplayModeL( EColor16M ); |
|
555 } |
|
556 |
|
557 return iTnEngine; |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CVcxHgMyVideosVideoDataUpdater::ThumbnailPreviewReady() |
|
562 // From MThumbnailManagerObserver, not used in Video Center. |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 void CVcxHgMyVideosVideoDataUpdater::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, |
|
566 TThumbnailRequestId /*aId*/ ) |
|
567 { |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // CVcxHgMyVideosVideoDataUpdater::ThumbnailReady() |
|
572 // From MThumbnailManagerObserver |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 void CVcxHgMyVideosVideoDataUpdater::ThumbnailReady( TInt aError, |
|
576 MThumbnailData& aThumbnail, |
|
577 TThumbnailRequestId aId ) |
|
578 { |
|
579 IPTVLOGSTRING3_LOW_LEVEL( |
|
580 "MPX My Videos UI # ThumbnailReady(error=%d, thumbID=%d)", aError, aId ); |
|
581 |
|
582 if ( iFetchArray.Count() > 0 ) |
|
583 { |
|
584 if ( aError == KErrNone |
|
585 && aId == iFetchArray[0]->ThumbnailConversionId() ) |
|
586 { |
|
587 // Never delete this, ownership gone to Ganes list |
|
588 iFetchArray[0]->SetThumbnail( aThumbnail.DetachBitmap() ); |
|
589 } |
|
590 else |
|
591 { |
|
592 iFetchArray[0]->SetThumbnail( NULL ); |
|
593 } |
|
594 |
|
595 iFetchArray[0]->SetState( CVcxHgMyVideosVideoData::EVideoDataStateThumbnailFinished ); |
|
596 } |
|
597 |
|
598 TRAP_IGNORE( ContinueVideoDataFetchingL() ); |
|
599 } |
|
600 |
|
601 // ----------------------------------------------------------------------------- |
|
602 // CVcxHgMyVideosVideoDataUpdater::RunL() |
|
603 // From CActive |
|
604 // ----------------------------------------------------------------------------- |
|
605 // |
|
606 void CVcxHgMyVideosVideoDataUpdater::RunL() |
|
607 { |
|
608 if ( iFetchArray.Count() > 0 ) |
|
609 { |
|
610 CMPXMedia* media = iVideoArray.MPXMediaByMPXItemId( iFetchArray[0]->MPXItemId() ); |
|
611 |
|
612 if ( media ) |
|
613 { |
|
614 if ( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
615 { |
|
616 TUint32 flags = 0; |
|
617 if ( media->IsSupported( KMPXMediaGeneralFlags ) ) |
|
618 { |
|
619 flags = media->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
|
620 } |
|
621 |
|
622 if ( flags & EVcxMyVideosVideoDrmProtected ) |
|
623 { |
|
624 ContentAccess::CData* cData = NULL; |
|
625 |
|
626 iFetchArray[0]->SetDrmProtected( ETrue ); |
|
627 iFetchArray[0]->SetValidDrmRights( EFalse ); |
|
628 |
|
629 TRAPD( trapError, |
|
630 cData = CData::NewL( |
|
631 (TVirtualPathPtr) media->ValueText( KMPXMediaGeneralUri ), |
|
632 EPeek, |
|
633 EContentShareReadWrite ) ); |
|
634 |
|
635 if ( cData ) |
|
636 { |
|
637 if ( trapError == KErrNone ) |
|
638 { |
|
639 TInt intentResult = cData->EvaluateIntent( ContentAccess::EPlay ); |
|
640 |
|
641 // Not valid rights should return KErrCANoRights, KErrCANoPermission, |
|
642 // or in rare cases KErrCAPendingRights. But we don't trust those and |
|
643 // just compare against KErrNone. |
|
644 if ( intentResult == KErrNone ) |
|
645 { |
|
646 iFetchArray[0]->SetValidDrmRights( ETrue ); |
|
647 } |
|
648 } |
|
649 delete cData; |
|
650 } |
|
651 } |
|
652 } |
|
653 } |
|
654 |
|
655 iFetchArray[0]->SetState( CVcxHgMyVideosVideoData::EVideoDataStateDrmFinished ); |
|
656 } |
|
657 |
|
658 ContinueVideoDataFetchingL(); |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CVcxHgMyVideosVideoDataUpdater::RunError() |
|
663 // From CActive |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 TInt CVcxHgMyVideosVideoDataUpdater::RunError( TInt aError ) |
|
667 { |
|
668 IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoDataUpdater::RunError, aError = %d", aError ); |
|
669 |
|
670 if ( aError != KErrNone ) |
|
671 { |
|
672 // Remove current item from fetch array |
|
673 RemoveItem( 0 ); |
|
674 } |
|
675 return KErrNone; |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CVcxHgMyVideosVideoDataUpdater::DoCancel() |
|
680 // From CActive |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 void CVcxHgMyVideosVideoDataUpdater::DoCancel() |
|
684 { |
|
685 } |