photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnprendererimpl.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     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:    Implements rendering of the Image/Video
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "glxupnprendererimpl.h"
       
    22 
       
    23 #include <glxattributecontext.h>         // CGlxAttributeContext
       
    24 #include <glxattributeretriever.h>  	 // CGlxAttributeRetriever
       
    25 #include <glxuiutility.h>				 // CGlxUiUtility
       
    26 #include <glxtracer.h>                      
       
    27 #include <glxlog.h>                      // GLX_LOG 
       
    28 #include <glxmedialist.h>                // CGlxMediaList
       
    29 #include <glxthumbnailattributeinfo.h>   // KGlxMediaIdThumbnail
       
    30 #include <glxthumbnailcontext.h>         // CGlxThumbnailContext
       
    31 #include <glxuistd.h>                    // Fetch context priority def'ns
       
    32 #include <glxerrormanager.h>             // GlxErrorManager
       
    33 #include <glxmedia.h>                    // TGlxMedia
       
    34 #include "glxupnprenderer.h"    
       
    35 // CONSTANTS
       
    36 const TInt KVideoIconThumbnailWidth = 640;
       
    37 const TInt KVideoIconThumbnailHeight = 480;
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Two-phased constructor.
       
    41 // ---------------------------------------------------------------------------
       
    42 CGlxUpnpRendererImpl* CGlxUpnpRendererImpl::NewL()
       
    43     {
       
    44     TRACER("CGlxUpnpRendererImpl::NewL()");  
       
    45     
       
    46     CGlxUpnpRendererImpl* self = new(ELeave) CGlxUpnpRendererImpl;
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL();
       
    49     CleanupStack::Pop( self );
       
    50     return self;
       
    51     }
       
    52 
       
    53 //---------------------------------------------------------------------------------	
       
    54 //	Defalut Constructor
       
    55 //---------------------------------------------------------------------------------	
       
    56 CGlxUpnpRendererImpl::CGlxUpnpRendererImpl()
       
    57     {    
       
    58     //Do Nothing
       
    59     }
       
    60      
       
    61 //---------------------------------------------------------------------------------	
       
    62 //	2nd phase Constructor
       
    63 //---------------------------------------------------------------------------------	
       
    64 void CGlxUpnpRendererImpl::ConstructL()
       
    65     {    
       
    66     TRACER("CGlxUpnpRendererImpl::ConstructL()");        
       
    67     
       
    68     // Create the asynchronous callback for focus changes
       
    69     iHandleFocusChangeCallback = new ( ELeave )
       
    70         CAsyncCallBack( TCallBack( DoFocusChanged, this ),
       
    71                 CActive::EPriorityStandard );
       
    72 
       
    73     //Create the showcommand to query the upnpframework 
       
    74     iUpnpShowCommand = CUpnpShowCommand::NewL(this);   
       
    75      
       
    76 
       
    77     if(iUpnpShowCommand)
       
    78 	    {
       
    79 	    iUpnpSupported = ETrue;	    
       
    80 	    }
       
    81     //Allocate the UPNP resources to show the Image/Video	    
       
    82 	if(iUpnpSupported)
       
    83 		{
       
    84 	    iUpnpShowCommand->StartShowingL();	
       
    85 	    }    	
       
    86     
       
    87     iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrNone;    
       
    88     PrepareMediaListL(); 
       
    89         
       
    90     }
       
    91     
       
    92 //---------------------------------------------------------------------------------	
       
    93 //	Destructor
       
    94 //---------------------------------------------------------------------------------	
       
    95 CGlxUpnpRendererImpl::~CGlxUpnpRendererImpl()
       
    96     {
       
    97     TRACER("CGlxUpnpRendererImpl::~CGlxUpnpRendererImpl()");    
       
    98 
       
    99     // delete also cancels the callback
       
   100     delete iHandleFocusChangeCallback;
       
   101               
       
   102     if ( iActiveMediaList )                             //cleanup the current list 
       
   103         {
       
   104         iActiveMediaList->RemoveMediaListObserver(this);
       
   105         iActiveMediaList->RemoveContext( iAttributeContext );	
       
   106         iActiveMediaList->RemoveContext( iThumbnailContext );	        
       
   107         }        
       
   108     if (iActiveMediaListResolver)
       
   109         {
       
   110         iActiveMediaListResolver->Close( this );
       
   111         }        
       
   112     delete iAttributeContext;    
       
   113         
       
   114     delete iThumbnailContext;   
       
   115         
       
   116     delete iThumbnailSaver; 
       
   117     
       
   118     if( iUpnpShowCommand ) 
       
   119         {
       
   120         //To check if we can delete the showcommand without StopShowing
       
   121         TRAP_IGNORE(iUpnpShowCommand->StopShowingL ( ) );       
       
   122         delete iUpnpShowCommand;      
       
   123         }
       
   124     }	
       
   125 
       
   126 
       
   127 //---------------------------------------------------------------------------------	
       
   128 // If the access point is defined
       
   129 //---------------------------------------------------------------------------------	
       
   130 TBool CGlxUpnpRendererImpl::IsSupported()
       
   131     {
       
   132     TRACER("CGlxUpnpRendererImpl::IsSupported()");    
       
   133     
       
   134     TInt isSupported = EFalse;
       
   135     //need to trap as we cannot leave
       
   136     
       
   137     TRAP_IGNORE( isSupported = CUpnpShowCommand::IsAvailableL ( ) );
       
   138     
       
   139     return isSupported;
       
   140     }
       
   141 //---------------------------------------------------------------------------------	
       
   142 // Error Status when Show Image/Video
       
   143 //---------------------------------------------------------------------------------		    
       
   144 NGlxUpnpRenderer::TErrorStatus CGlxUpnpRendererImpl::UpnpErrorStatus()
       
   145 	{
       
   146 	TRACER("CGlxUpnpRendererImpl::UpnpErrorStatus()");
       
   147 	
       
   148 	//The UPnP Show Image/Video error status after the Show request to UPnP Framework
       
   149 	return iUpnpErrorStatus;		
       
   150 	}
       
   151 
       
   152 //---------------------------------------------------------------------------------	
       
   153 // Show the Video after a user action
       
   154 //---------------------------------------------------------------------------------		
       
   155 void CGlxUpnpRendererImpl::UpnpShowVideoL()
       
   156     {
       
   157     TRACER("CGlxUpnpRendererImpl::UpnpShowVideoL");
       
   158     User::LeaveIfError( GlxAttributeRetriever::RetrieveL ( *iAttributeContext,*iActiveMediaList ) );
       
   159     
       
   160     if(iUpnpSupported)
       
   161 	    {
       
   162     	const TDesC& videoUri = iActiveMediaList->Item( iActiveMediaList->FocusIndex() ).Uri();
       
   163     	iUpnpShowCommand->ShowVideoL( videoUri );
       
   164 	    }
       
   165     
       
   166     iIsVideoShow = ETrue;  
       
   167     //Hiding the HUI display,so that the UPnPFw will take the
       
   168     //view control and update the view for a video
       
   169     CGlxUiUtility::HideAlfDisplayL();
       
   170     }
       
   171 
       
   172 //---------------------------------------------------------------------------------	
       
   173 //	Preare the media list
       
   174 //---------------------------------------------------------------------------------	
       
   175 
       
   176 void CGlxUpnpRendererImpl::PrepareMediaListL()
       
   177     {
       
   178     TRACER("CGlxUpnpRendererImpl::PrepareMediaListL");
       
   179 
       
   180     if ( !iActiveMediaListResolver ) //get the singleton instance for the resolver	
       
   181         {
       
   182         iActiveMediaListResolver= MGlxActiveMediaListResolver::InstanceL( this );
       
   183         }
       
   184     iActiveMediaList= iActiveMediaListResolver->ActiveMediaList();   //get the currently active medialist
       
   185 
       
   186     if ( iActiveMediaList )
       
   187         {
       
   188         CreateContextL();
       
   189         iActiveMediaList->AddContextL( iAttributeContext, 
       
   190                                             KGlxFetchContextPriorityNormal );
       
   191         iActiveMediaList->AddContextL( iThumbnailContext, 
       
   192                                             KGlxFetchContextPriorityNormal );
       
   193         iActiveMediaList->AddMediaListObserverL(this);
       
   194         }
       
   195     }
       
   196 
       
   197 
       
   198 //---------------------------------------------------------------------------------	
       
   199 // Create the context for the medialist
       
   200 //---------------------------------------------------------------------------------	
       
   201 
       
   202 void CGlxUpnpRendererImpl::CreateContextL()
       
   203     {
       
   204     TRACER("CGlxUpnpRendererImpl::CreateContextL");
       
   205 
       
   206     iAttributeContext = CGlxDefaultAttributeContext::NewL( );
       
   207     iAttributeContext->AddAttributeL( KMPXMediaGeneralUri );
       
   208     
       
   209     iThumbnailContext = CGlxDefaultThumbnailContext::NewL( );          // set the thumbnail context
       
   210     iThumbnailContext->SetDefaultSpec( KVideoIconThumbnailWidth, KVideoIconThumbnailHeight );  // 640 pixels wide and 480 pixel height-VGA.
       
   211     }
       
   212 
       
   213 //---------------------------------------------------------------------------------	
       
   214 //	media object item added	     
       
   215 //---------------------------------------------------------------------------------	
       
   216 
       
   217 void CGlxUpnpRendererImpl::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/,MGlxMediaList* /*aList*/)
       
   218     {
       
   219     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   220     }
       
   221 	
       
   222 //---------------------------------------------------------------------------------	
       
   223 //	media object is now available for an item 
       
   224 //---------------------------------------------------------------------------------	
       
   225 
       
   226 void CGlxUpnpRendererImpl::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/)
       
   227     {
       
   228     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   229     }
       
   230     
       
   231 //---------------------------------------------------------------------------------	
       
   232 //	media item was removed from the list
       
   233 //---------------------------------------------------------------------------------	
       
   234 
       
   235 void CGlxUpnpRendererImpl::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/,MGlxMediaList* /*aList*/)
       
   236     {
       
   237     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   238     }
       
   239     
       
   240 //---------------------------------------------------------------------------------	
       
   241 //	Media item was changed
       
   242 //---------------------------------------------------------------------------------	
       
   243 
       
   244 void CGlxUpnpRendererImpl::HandleItemModifiedL(const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/) 
       
   245     {
       
   246     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   247     }
       
   248 
       
   249 //---------------------------------------------------------------------------------	
       
   250 //	Attribute is available	     
       
   251 //---------------------------------------------------------------------------------	
       
   252 
       
   253 void CGlxUpnpRendererImpl::HandleAttributesAvailableL(TInt aItemIndex,const RArray<TMPXAttribute>& aAttributes,
       
   254                                                 MGlxMediaList* /*aList*/)
       
   255     {
       
   256     TRACER("CGlxUpnpRendererImpl::HandleAttributesAvailableL");	
       
   257     
       
   258     if ( aItemIndex == iActiveMediaList->FocusIndex() )
       
   259         {
       
   260         SendFocusedItemL(aItemIndex,aAttributes);   
       
   261         }
       
   262     }
       
   263 	
       
   264 //---------------------------------------------------------------------------------	
       
   265 //	 Focus has moved
       
   266 //---------------------------------------------------------------------------------	
       
   267 void CGlxUpnpRendererImpl::HandleFocusChangedL(
       
   268     NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/,
       
   269         TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
       
   270     {
       
   271     TRACER("CGlxUpnpRendererImpl::HandleFocusChangedL");
       
   272     // fix for ERBS-7CFCJE, make focus change handling asynchronous to prevent 
       
   273     // UPnP from blocking our garbage collection if the UPnP framework
       
   274     // displays a dialog (e.g. when showing a DRM-protected item).
       
   275     if ( iHandleFocusChangeCallback->IsActive() )
       
   276         {
       
   277         iHandleFocusChangeCallback->Cancel();
       
   278         }
       
   279     iHandleFocusChangeCallback->CallBack();
       
   280     } 
       
   281     
       
   282 //---------------------------------------------------------------------------------	
       
   283 //  Item has been selected
       
   284 //---------------------------------------------------------------------------------	
       
   285 
       
   286 void CGlxUpnpRendererImpl::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/)
       
   287     {
       
   288     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   289     }
       
   290     
       
   291 //---------------------------------------------------------------------------------	
       
   292 //	Notification from the collection
       
   293 //---------------------------------------------------------------------------------		
       
   294 void CGlxUpnpRendererImpl::HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/)
       
   295     {
       
   296     TRACER("CGlxUpnpRendererImpl::HandleItemAddedL");	
       
   297     }
       
   298 
       
   299 
       
   300 //From MGlxActiveMediaListChangeObserver	
       
   301 //---------------------------------------------------------------------------------	
       
   302 //	Active media list pointer has changed.
       
   303 //---------------------------------------------------------------------------------	
       
   304 
       
   305 void CGlxUpnpRendererImpl::HandleActiveMediaListChanged()
       
   306     {
       
   307     TRACER("CGlxUpnpRendererImpl::HandleActiveMediaListChanged()");
       
   308     
       
   309     if ( iActiveMediaList )                             //cleanup the current list 
       
   310         {
       
   311         iActiveMediaList->RemoveMediaListObserver( this );
       
   312         iActiveMediaList->RemoveContext( iAttributeContext );
       
   313         iActiveMediaList->RemoveContext( iThumbnailContext );	        
       
   314         }    
       
   315     TRAP_IGNORE(PrepareMediaListL());  // will give a new list 	
       
   316     }
       
   317 
       
   318 	
       
   319 //From MUpnpCommandObserver	
       
   320 //---------------------------------------------------------------------------------	
       
   321 // Show Command has been completed.
       
   322 //---------------------------------------------------------------------------------	
       
   323 
       
   324 void CGlxUpnpRendererImpl::CommandComplete( TInt aStatusCode ) 
       
   325     {
       
   326     TRACER("CGlxUpnpRendererImpl::CommandComplete");  
       
   327     
       
   328     TRAP_IGNORE( CommandCompleteL(aStatusCode) );
       
   329     }
       
   330   
       
   331  	
       
   332 //---------------------------------------------------------------------------------	
       
   333 // Show Command has been completed.
       
   334 //---------------------------------------------------------------------------------	
       
   335 //    
       
   336 void CGlxUpnpRendererImpl::CommandCompleteL( TInt aStatusCode )   
       
   337     {
       
   338     TRACER("CGlxUpnpRendererImpl::CommandCompleteL");   
       
   339    
       
   340     if( KErrNone == aStatusCode )
       
   341         {
       
   342         GLX_LOG_INFO("Error code is KErrNone");        
       
   343         iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrNone;        
       
   344         }
       
   345 
       
   346     else if( KErrDisconnected == aStatusCode )   
       
   347         {
       
   348         GLX_LOG_INFO("Error code is KErrDisconnected");
       
   349         iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrDisconnected;  
       
   350            		
       
   351         iIsVideoShow = EFalse; 
       
   352 
       
   353         //Show the HUI display   
       
   354         CGlxUiUtility::ShowAlfDisplayL();
       
   355       	   	     	
       
   356         // Send state changed command
       
   357         GlxUpnpRenderer::ChangeCommandStateL(); 
       
   358         } 
       
   359 	 
       
   360 	 if(iUpnpSupported)
       
   361 		 {
       
   362 		 if( KUpnpCommandStatusStartPlayVideo  == aStatusCode )
       
   363 	        {
       
   364 	        GLX_LOG_INFO("KUpnpCommandStatusStartPlayVideo");
       
   365 	        // Photos hiding their UI
       
   366 	        CGlxUiUtility::HideAlfDisplayL();
       
   367 	        }	
       
   368 		 }
       
   369         
       
   370     //Check if the show on the rendering device was a video	        
       
   371     else if( ( iIsVideoShow ) && ( GlxUpnpRenderer::Status() == NGlxUpnpRenderer::EActive ) )
       
   372         {
       
   373         GLX_LOG_INFO("Video play is complete");        
       
   374         //Need to trap as we cannot leave
       
   375         ShowImageAfterVideoL();
       
   376         }             
       
   377     }
       
   378  
       
   379 //---------------------------------------------------------------------------------	
       
   380 // Display the Image after the Video play is Complete
       
   381 //---------------------------------------------------------------------------------	    
       
   382   void CGlxUpnpRendererImpl::ShowImageAfterVideoL()
       
   383   	{
       
   384   	TRACER("CGlxUpnpRendererImpl::ShowVideoComplete");
       
   385   	
       
   386   	//Show the HUI display once the video play is completed    
       
   387     CGlxUiUtility::ShowAlfDisplayL();
       
   388      
       
   389     if(iUpnpSupported)
       
   390 	     {
       
   391 	     iUpnpShowCommand->ShowImageL( iVideoThumbnail );        	
       
   392 	     }
       
   393 	     
       
   394     iIsVideoShow = EFalse;  	
       
   395     }
       
   396 
       
   397 
       
   398 //From MGlxThumbnailSaveComplete	
       
   399 //---------------------------------------------------------------------------------	
       
   400 // Call back for thumbnail save completion
       
   401 //---------------------------------------------------------------------------------	
       
   402 void CGlxUpnpRendererImpl::HandleFileSaveCompleteL(const TDesC& aPath)
       
   403     {
       
   404     TRACER("CGlxUpnpRendererImpl::HandleFileSaveCompleteL");
       
   405     
       
   406     iVideoThumbnail.Copy( aPath );
       
   407     
       
   408     if(iUpnpSupported)
       
   409 	    {
       
   410 	    iUpnpShowCommand->ShowImageL( iVideoThumbnail );	
       
   411 	    }    
       
   412     }
       
   413 
       
   414 //---------------------------------------------------------------------------------	
       
   415 // Send the focussed item to the device
       
   416 //---------------------------------------------------------------------------------	
       
   417 
       
   418 void  CGlxUpnpRendererImpl::SendFocusedItemL(TInt aNewIndex)	
       
   419     {
       
   420     TRACER("CGlxUpnpRendererImpl::SendFocusedItemL");
       
   421     
       
   422     if(KErrNotFound!=aNewIndex)
       
   423         {
       
   424         const TGlxMedia& item = iActiveMediaList->Item(aNewIndex);       
       
   425         TMPXAttribute attrThumb(KGlxMediaIdThumbnail, 
       
   426         GlxFullThumbnailAttributeId(ETrue, KVideoIconThumbnailWidth, KVideoIconThumbnailHeight));
       
   427         if ( (iActiveMediaList) && (!item.IsStatic()) )
       
   428             {
       
   429             if( item.Uri().Length() > 0)
       
   430                 {
       
   431                 GetImageL(item);
       
   432                 GetVideoL(item,attrThumb);
       
   433                 }                
       
   434             }            
       
   435         }
       
   436     }
       
   437         
       
   438 //---------------------------------------------------------------------------------	
       
   439 // Send the focussed item to the device
       
   440 //---------------------------------------------------------------------------------	
       
   441 void  CGlxUpnpRendererImpl::SendFocusedItemL(TInt aNewIndex,const RArray<TMPXAttribute>& aAttributes)	
       
   442     {
       
   443     TRACER("CGlxUpnpRendererImpl::SendFocusedItemL");
       
   444 
       
   445     if( KErrNotFound != aNewIndex )
       
   446         {
       
   447         const TGlxMedia& item = iActiveMediaList->Item(aNewIndex);
       
   448         TMPXAttribute attrThumb(KGlxMediaIdThumbnail, 
       
   449         GlxFullThumbnailAttributeId(ETrue, KVideoIconThumbnailWidth, KVideoIconThumbnailHeight));
       
   450 
       
   451         // Loop untill it checks for all the avialable attributes
       
   452         for ( TInt i = aAttributes.Count() - 1; i >= 0 ; i-- )
       
   453             {
       
   454             if ( (iActiveMediaList) && (!item.IsStatic()) )
       
   455                 {
       
   456                 if( item.Uri().Length() > 0)               
       
   457                     {
       
   458                     //retrive the attribute for showing image                       
       
   459                     if( EMPXImage == item.Category())
       
   460                         {                    
       
   461                         GetImageL(item);
       
   462                         }
       
   463                     //retrive the attribute for showing Video                    
       
   464                     else if ( EMPXVideo == item.Category() )
       
   465                         {                  
       
   466                         GetVideoL(item,attrThumb);
       
   467                         }
       
   468                     }
       
   469                 }
       
   470             }
       
   471         }
       
   472     }
       
   473 
       
   474 //---------------------------------------------------------------------------------	
       
   475 // Get the image attribute
       
   476 //---------------------------------------------------------------------------------	
       
   477 void  CGlxUpnpRendererImpl::GetImageL(const TGlxMedia& aMedia)
       
   478     {
       
   479     TRACER("CGlxUpnpRendererImpl::GetImageL");
       
   480     //retrive the attribute for showing image 
       
   481     const CGlxMedia* item = aMedia.Properties();
       
   482     if(EMPXImage == aMedia.Category())
       
   483     {
       
   484     if (!iThumbnailSaver)
       
   485         {
       
   486         iThumbnailSaver=CGlxThumbnailSaver::NewL( this );
       
   487         }
       
   488     if((GlxErrorManager::HasAttributeErrorL(item, KGlxMediaIdThumbnail) != KErrNone))
       
   489    		{
       
   490      	iThumbnailSaver->CreateDefaultImageIconL();
       
   491     	}
       
   492     if  ((iPreviouslySentMediaId != aMedia.Id( ) ) )
       
   493         {
       
   494         iPreviouslySentMediaId=aMedia.Id();        
       
   495         //show the image Via upnp device
       
   496         if(iUpnpSupported)
       
   497 	        {
       
   498 	        const TDesC& imageUri = aMedia.Uri();
       
   499 	        iUpnpShowCommand->ShowImageL( imageUri );
       
   500 	        }        
       
   501         }
       
   502     }
       
   503     }
       
   504     
       
   505 //---------------------------------------------------------------------------------	
       
   506 // Get the video attribute
       
   507 //---------------------------------------------------------------------------------	  
       
   508 void  CGlxUpnpRendererImpl::GetVideoL(const TGlxMedia& aMedia,TMPXAttribute& aAttrThumbnail)
       
   509     {
       
   510     TRACER("CGlxUpnpRendererImpl::GetVideoL");
       
   511     const CGlxMedia* item = aMedia.Properties();
       
   512     if(EMPXVideo == aMedia.Category())
       
   513     { 
       
   514     if (!iThumbnailSaver)
       
   515         {
       
   516         iThumbnailSaver=CGlxThumbnailSaver::NewL( this );
       
   517         }
       
   518 
       
   519     if ( ( aMedia.ThumbnailAttribute( aAttrThumbnail ) ) 
       
   520         &&  ( iPreviouslySentMediaId!=aMedia.Id( )) )
       
   521         { 
       
   522         iPreviouslySentMediaId=aMedia.Id();
       
   523         //get the thumbnail image
       
   524         const CGlxThumbnailAttribute* value = aMedia.ThumbnailAttribute( aAttrThumbnail );
       
   525         iThumbnailSaver->CreateVideoIconL( value->iBitmap );
       
   526         }
       
   527         else if ((GlxErrorManager::HasAttributeErrorL(item, KGlxMediaIdThumbnail) != KErrNone))
       
   528         {
       
   529           // send the default thumbnail
       
   530           iThumbnailSaver->CreateDefaultVideoIconL();
       
   531         }
       
   532     }
       
   533     }
       
   534 
       
   535 //---------------------------------------------------------------------------------	
       
   536 // DoFocusChanged callback
       
   537 //---------------------------------------------------------------------------------	 
       
   538 TInt CGlxUpnpRendererImpl::DoFocusChanged( TAny* aPtr )
       
   539     {
       
   540     TRACER("CGlxUpnpRendererImpl::DoFocusChanged");
       
   541 
       
   542     CGlxUpnpRendererImpl* self
       
   543                     = reinterpret_cast< CGlxUpnpRendererImpl* >( aPtr );
       
   544     TRAP_IGNORE( self->DoFocusChangedL() );
       
   545     
       
   546     return 0;
       
   547     }
       
   548 
       
   549 //---------------------------------------------------------------------------------	
       
   550 // DoFocusChangedL
       
   551 //---------------------------------------------------------------------------------	 
       
   552 void CGlxUpnpRendererImpl::DoFocusChangedL()
       
   553     {
       
   554     // SendFocusedItemL validates the index so no need to do it here too
       
   555     TInt index = iActiveMediaList->FocusIndex();
       
   556     SendFocusedItemL( index );
       
   557     }