videofeeds/utils/inc/CIptvThumbnailImpl.h
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2006-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 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:    Thumbnail generation implementation*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CIPTVTHUMBNAILIMPL_H
       
    21 #define CIPTVTHUMBNAILIMPL_H
       
    22 
       
    23 #include <TNEVideoClipInfo.h>
       
    24 #include <f32file.h>
       
    25 #include "CIptvThumbnailGenerator.h"
       
    26 #include "MIptvRtpTo3gpObserver.h"
       
    27 
       
    28 class CImageEncoder;
       
    29 class CFbsBitmap;
       
    30 class CIptvRtpTo3gpConverter;
       
    31 
       
    32 /**
       
    33  * Thumbnail generation implementation using VideoEditorEngine
       
    34  * or S60 Thumbnail Engine.
       
    35  *
       
    36  * @lib IptvUtil.lib
       
    37  * @since Video Center 1.0
       
    38  */
       
    39 class CIptvThumbnailImpl : public CIptvThumbnailGenerator,
       
    40                            public MIptvRtpTo3gpObserver,
       
    41                            public MTNEVideoClipInfoObserver,
       
    42                            public MTNEVideoClipThumbObserver
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      *
       
    49      * @param aObserver
       
    50      * @param aPriority
       
    51      */
       
    52     static CIptvThumbnailImpl* NewLC( MIptvThumbnailObserver& aObserver, TInt aPriority );
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */     
       
    57     virtual ~CIptvThumbnailImpl();
       
    58 
       
    59     /**
       
    60      * Request thumbnail generation.
       
    61      *
       
    62      * @param aClipFilename
       
    63      * @param aThumbFilename
       
    64      * @param aResolution
       
    65      */     
       
    66     void GenerateThumbnailL( const TDesC& aClipFilename, const TDesC& aThumbFilename, const TSize aResolution );
       
    67 
       
    68     /**
       
    69      * Cancel ongoing thumbnail generation.
       
    70      */     
       
    71     void CancelThumbnail();
       
    72 
       
    73 private:
       
    74 
       
    75     /**
       
    76      * Default C++ construct
       
    77      *
       
    78      * @param aObserver
       
    79      * @param aPriority
       
    80      */
       
    81     CIptvThumbnailImpl( MIptvThumbnailObserver& aObserver, TInt aPriority );
       
    82 
       
    83     /**
       
    84      * 2nd phase constructor
       
    85      */
       
    86     void ConstructL();
       
    87 
       
    88     /**
       
    89      * from MIptvRtpTo3gpObserver
       
    90      *
       
    91      * @param aConverter
       
    92      * @param aError
       
    93      */
       
    94     void RtpTo3gpConversionReady( CIptvRtpTo3gpConverter& aConverter, TInt aError );
       
    95 
       
    96     /**
       
    97      * From MTNEVideoClipInfoObserver
       
    98      *
       
    99      * @param aInfo
       
   100      * @param aError
       
   101      */     
       
   102     void NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, TInt aError );
       
   103 
       
   104     /**
       
   105      * From MTNEVideoClipThumbObserver
       
   106      *
       
   107      * @param aInfo
       
   108      * @param aError
       
   109      * @param aThumbBitmap
       
   110      */     
       
   111     void NotifyVideoClipThumbCompleted( CTNEVideoClipInfo& aInfo, TInt aError, CFbsBitmap* aThumbBitmap );
       
   112 
       
   113     /**
       
   114      * From CActive, image encoding is ready
       
   115      */
       
   116     void RunL();
       
   117 
       
   118     /**
       
   119      * From CActive, cancel image encoding
       
   120      */
       
   121     void DoCancel();
       
   122 
       
   123     /**
       
   124      * Cleanup results from previous generations
       
   125      */     
       
   126     void DoCleanup();
       
   127 
       
   128     /**
       
   129      * Start actual thumbnail generation
       
   130      *
       
   131      * @param aClipFilename
       
   132      */     
       
   133     void DoStartThumbnailL( const TDesC& aClipFilename );
       
   134 
       
   135 private:
       
   136 
       
   137     /**
       
   138      * Observer for generation completed notifications.
       
   139      */     
       
   140     MIptvThumbnailObserver& iObserver;
       
   141     
       
   142     /**
       
   143      * Priority for actual thumbnail generation.
       
   144      */     
       
   145     TInt iPriority;
       
   146     
       
   147     /**
       
   148      * File system handle.
       
   149      */     
       
   150     RFs iFs;
       
   151     
       
   152     /**
       
   153      * Cache for thumbnail filename.
       
   154      * Own.
       
   155      */     
       
   156     HBufC* iThumbFilename;
       
   157     
       
   158     /**
       
   159      * Cache for thumbnail resolution.
       
   160      */     
       
   161     TSize iResolution;
       
   162     
       
   163     /**
       
   164      * Memory bitmap to .jpg image encoder.
       
   165      * Own.
       
   166      */     
       
   167     CImageEncoder* iImageEncoder;
       
   168     
       
   169     /**
       
   170      * Memory bitmap.
       
   171      * Own.
       
   172      */     
       
   173     CFbsBitmap* iThumbBitmap;
       
   174     
       
   175     /**
       
   176      * .rtp to .3gp file converter.
       
   177      * Own.
       
   178      */     
       
   179     CIptvRtpTo3gpConverter* iRtpConverter;
       
   180     
       
   181     /**
       
   182      * File name for temporary .3gp clip used in .rtp generation.
       
   183      */
       
   184     TFileName iTempClipFilename;
       
   185 
       
   186     /**
       
   187      * Cache for clip info (underlying generator)
       
   188      * Own.     
       
   189      */     
       
   190     CTNEVideoClipInfo* iClipInfo;
       
   191     };
       
   192 
       
   193 #endif // CIPTVTHUMBNAILIMPL_H