imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp
branchRCL_3
changeset 5 82749d516180
parent 0 2014ca87e772
child 9 2eb74cf6572e
equal deleted inserted replaced
1:235a7fc86938 5:82749d516180
   196     {
   196     {
   197     delete iDecoder;
   197     delete iDecoder;
   198     iDecoder = NULL;
   198     iDecoder = NULL;
   199 	
   199 	
   200     CImageDecoder::TOptions options = ( CImageDecoder::TOptions )( 
   200     CImageDecoder::TOptions options = ( CImageDecoder::TOptions )( 
   201             CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode );
   201             CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
   202  
   202  
   203     TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   203     TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   204             CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
   204             CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
   205     
   205     
   206     if ( decErr != KErrNone )
   206     if ( decErr != KErrNone )
   207         {
   207         {
       
   208         TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
       
   209         
       
   210         LeaveIfCorruptL( decErr );
       
   211         
   208         TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   212         TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   209                 CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
   213                 CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
   210         
   214         
   211         if ( decErr != KErrNone )
   215         if ( decErr != KErrNone )
   212             {                                              
   216             {                             
       
   217             TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
       
   218             
       
   219             LeaveIfCorruptL( decErr );
   213             // don't force any mime type
   220             // don't force any mime type
   214             TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   221             TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   215             if ( decErr != KErrNone )
   222             if ( decErr != KErrNone )
   216                 {
   223                 {
   217                 delete iBuffer;
   224                 delete iBuffer;
   218                 iBuffer = NULL;
   225                 iBuffer = NULL;
   219                 
   226                 
   220                 TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - error" );
   227                 TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder error %d", decErr );
   221                 
   228                 
   222                 User::Leave( decErr );
   229                 User::Leave( decErr );
   223                 }     
   230                 }     
   224             
   231             
   225             TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder created" );
   232             TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder created" );
   244 const TSize& CThumbnailImageDecoderv3::OriginalSize()const
   251 const TSize& CThumbnailImageDecoderv3::OriginalSize()const
   245     {
   252     {
   246     return iOriginalSize;
   253     return iOriginalSize;
   247     }
   254     }
   248 
   255 
       
   256 // -----------------------------------------------------------------------------
       
   257 // CThumbnailImageDecoder3::LeaveIfCorruptL()
       
   258 // Leave is image is corrupted
       
   259 // -----------------------------------------------------------------------------
       
   260 //
       
   261 void CThumbnailImageDecoderv3::LeaveIfCorruptL(const TInt aError )
       
   262     {
       
   263     //no sense to try other codecs if image is corrupted
       
   264     if( aError == KErrCorrupt || aError == KErrUnderflow)
       
   265         {
       
   266         User::Leave( aError );
       
   267         }
       
   268     }
       
   269 
   249 //End of file
   270 //End of file