imagingextensions/imageadaptationextensions/iclextjpegapi/inc_plat/IclExtJpegApi.h
changeset 3 08469e5bb63e
equal deleted inserted replaced
0:5752a19fdefe 3:08469e5bb63e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Definition of CVisualFrame, CExtJpegDecoder and CExtJpegEncoder
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef _ICLEXTJPEGAPI_
       
    19 #define _ICLEXTJPEGAPI_
       
    20 
       
    21 #include "imageconversion.h"
       
    22 #include <icl/icl_uids.hrh>
       
    23 
       
    24 #include "iclexifimageframe.h"
       
    25 const TInt KMaxNumberOfPlanes = KMaxPlanesInFrame;
       
    26 const TUid KUidExtFormatJpeg = { 0 };
       
    27 const TUid KUidExtIclApiSupport = { 0 };
       
    28 const TInt KExtensionUID = 0x01010101;
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVisualFrameImpl;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 * CVisualFrame
       
    37 * @lib IclExtJpegApi.lib
       
    38 * @since 3.2
       
    39 */
       
    40 class CVisualFrame : public CBase
       
    41     {
       
    42     public:
       
    43 
       
    44         // TFrameLayout contains the scan line lengths and offsets for each component in planar YUV case
       
    45         class TFrameLayout
       
    46             {
       
    47             public:
       
    48                 TInt iNumberOfPlanes;
       
    49                 TInt iScanLineLength[KMaxNumberOfPlanes];
       
    50                 TInt iOffset[KMaxNumberOfPlanes];
       
    51                 TInt iLength[KMaxNumberOfPlanes];
       
    52                 TInt iMaxLength[KMaxNumberOfPlanes];                
       
    53             };
       
    54 
       
    55         enum TDataContainer
       
    56             {
       
    57             EInChunk,
       
    58             EInDescriptor
       
    59             };
       
    60             
       
    61         enum TDataFormat
       
    62             {
       
    63             /* Copied from CCamera::TFormat: */
       
    64             
       
    65             /** 8 bit greyscale values, 0=black, 255=white. */
       
    66             EFormatMonochrome            = 0x0001,//+
       
    67             /** Packed RGB triplets, 4 bits per pixel with red in the least significant bits
       
    68             and the 4 most significant bits unused. */
       
    69             EFormat16bitRGB444            = 0x0002,//+
       
    70             /** Packed RGB triplets, 5 bits per pixel for red and blue and 6 bits for green,
       
    71             with red in the least significant bits. */
       
    72             EFormat16BitRGB565            = 0x0004,//+
       
    73             /** Packed RGB triplets, 8 bits per pixel with red in the least significant bits
       
    74             and the 8 most significant bits unused. */
       
    75             EFormat32BitRGB888            = 0x0008,//+
       
    76             /** JFIF JPEG. */
       
    77             EFormatJpeg                    = 0x0010,
       
    78             /** EXIF JPEG */
       
    79             EFormatExif                    = 0x0020,
       
    80             /** CFbsBitmap object with display mode EColor4K. */
       
    81             EFormatFbsBitmapColor4K        = 0x0040,
       
    82             /** CFbsBitmap object with display mode EColor64K. */
       
    83             EFormatFbsBitmapColor64K    = 0x0080,
       
    84             /** CFbsBitmap object with display mode EColor16M. */
       
    85             EFormatFbsBitmapColor16M    = 0x0100,
       
    86             /** Implementation dependent. */
       
    87             EFormatUserDefined            = 0x0200,
       
    88             /** 4:2:0 format, 8 bits per sample, Y00Y01Y10Y11UV. */
       
    89             EFormatYUV420Interleaved    = 0x0400,//+
       
    90             /** 4:2:0 format, 8 bits per sample, Y00Y01Y02Y03...U0...V0... */
       
    91             EFormatYUV420Planar            = 0x0800,//+
       
    92             /** 4:2:2 format, 8 bits per sample, UY0VY1. */
       
    93             EFormatYUV422                = 0x1000,//+
       
    94             /** 4:2:2 format, 8 bits per sample, Y1VY0U. */
       
    95             EFormatYUV422Reversed        = 0x2000,//+
       
    96             /** 4:4:4 format, 8 bits per sample, Y00U00V00 Y01U01V01... */
       
    97             EFormatYUV444                = 0x4000,//+
       
    98             /** 4:2:0 format, 8 bits per sample, Y00Y01Y02Y03...U0V0... */
       
    99             EFormatYUV420SemiPlanar        = 0x8000,//+
       
   100 
       
   101             /* Other formats: */
       
   102             
       
   103             /** 4:2:2 format, 8 bits per sample, Y0Y1UV. */
       
   104             EFormatExtYUV422Interleaved = 0x00100000,
       
   105             /** 4:2:2 format, 8 bits per sample, Y0Y1Y2...U0U1...V0V1. */
       
   106             EFormatExtYUV422Planar      = 0x00200000,
       
   107             /** 4:4:4 format, 8 bits per sample, Y0U0V0Y1U1V1. */
       
   108             EFormatExtYUV444Planar = 0x00400000,
       
   109             /** DCT coefficients */
       
   110             EFormatExtDctCoeff = 0x00800000,            
       
   111                         
       
   112             };
       
   113     
       
   114     public: // New functions
       
   115 
       
   116         /**
       
   117         * Symbian C++ Two-phased constructor.
       
   118         * @since 3.2
       
   119         * @param aBuffer        A descriptor reference to buffer containing the image data.
       
   120         * @param aDimension     The dimensions of the corresponding image data.
       
   121         * @param aFrameFormat	The frame format of the corresponding image data.
       
   122         * @return CVisualFrame* A pointer to frame object.
       
   123         */
       
   124         IMPORT_C static CVisualFrame* NewL( 
       
   125                                     TDes8& aBuffer, 
       
   126                                     const TSize& aDimension,
       
   127                                     TInt aFrameFormat );
       
   128 
       
   129         /**
       
   130         * Symbian C++ Two-phased constructor.
       
   131         * @since 3.2
       
   132         * @param aChunk         An RChunk reference to buffer containing the image data.
       
   133         * @param aSize          The amount of image data in bytes.
       
   134         * @param amaxSize       The maximum size of the memory reserved in the chunk.
       
   135         * @param aDataOffset    The offset value specifying the location of the image 
       
   136         *                       data in the chunk.
       
   137         * @param aDimension     The dimensions of the corresponding image data.
       
   138         * @param aFrameFormat   The frame format of the corresponding image data.
       
   139         * @return CVisualFrame* A pointer to frame object.
       
   140         */
       
   141         IMPORT_C static CVisualFrame* NewL( 
       
   142                                     RChunk& aChunk, 
       
   143                                     TInt aSize,
       
   144                                     TInt aMaxSize, 
       
   145                                     TInt aDataOffset,
       
   146                                     const TSize& aDimension, 
       
   147                                     TInt aFrameFormat );
       
   148 
       
   149         /**
       
   150         * Symbian C++ Two-phased constructor.
       
   151         * @since 3.2
       
   152         * @param aBuffer        A descriptor reference to buffer containing the image data.
       
   153         * @param aDimension     The dimensions of the corresponding image data.
       
   154         * @param aFrameLayout   The layout of the image color components.
       
   155         * @return CVisualFrame* A pointer to frame object.
       
   156         */
       
   157         IMPORT_C static CVisualFrame* NewL( 
       
   158                                     TDes8& aBuffer, 
       
   159                                     const TSize& aDimension, 
       
   160                                     TInt aFrameFormat, 
       
   161                                     const TFrameLayout& aFrameLayout ); 
       
   162 
       
   163         /**
       
   164         * Symbian C++ Two-phased constructor.
       
   165         * @since 3.2
       
   166         * @param aChunk         An RChunk reference to buffer containing the image data.
       
   167         * @param aSize          The amount of image data in bytes.
       
   168         * @param aMaxSize       The maximum size of the memory reserved in the chunk for 
       
   169         *                       the image data.
       
   170         * @param aDimension     The dimensions of the corresponding image data.
       
   171         * @param aFrameFormat   The frame format of the corresponding image data.
       
   172         * @param aFrameLayout   The layout of the image color components. TFrameLayout 
       
   173         * 						contains the scan line lengths and offsets for each component 
       
   174         *						in planar YUV case
       
   175         * @return CVisualFrame* A pointer to frame object.
       
   176         */
       
   177         IMPORT_C static CVisualFrame* NewL( 
       
   178                                     RChunk& aChunk, 
       
   179                                     TInt aSize, 
       
   180                                     TInt aMaxSize,
       
   181                                     const TSize& aDimension, 
       
   182                                     TInt aFrameFormat, 
       
   183                                     const TFrameLayout& aFrameLayout );        
       
   184        
       
   185        
       
   186         /**
       
   187         * Returns a constant reference to the chunk containing 
       
   188         * the image data, if exists.
       
   189         * @since 3.2
       
   190         * @return RChunk
       
   191         */
       
   192         IMPORT_C const RChunk& DataChunkL() const;
       
   193         
       
   194         /**
       
   195         * Returns a descriptor pointer to the image data location, if exists
       
   196         * @since 3.2
       
   197         * @return TPtr8
       
   198         */        
       
   199         IMPORT_C TPtr8 DataPtrL() const;
       
   200 
       
   201         /**
       
   202         * Returns the dimensions of the image.
       
   203         * @since 3.2
       
   204         * @return TSize
       
   205         */        
       
   206         IMPORT_C TSize Dimension() const;
       
   207 
       
   208         /**
       
   209         * Return the image data format.
       
   210         * @since 3.2
       
   211         * @return TInt
       
   212         */        
       
   213         IMPORT_C TInt FrameFormat() const;
       
   214         
       
   215         /**
       
   216         * Returns the offset of the image data for non-planar, 
       
   217         * single-component or compressed images. 
       
   218         * @since 3.2
       
   219         * @return TInt
       
   220         */        
       
   221         IMPORT_C TInt DataOffset() const;
       
   222 
       
   223         /**
       
   224         * Returns the amount of stored image data in bytes.
       
   225         * @since 3.2
       
   226         * @return TInt
       
   227         */        
       
   228         IMPORT_C TInt Size() const;
       
   229 
       
   230         /**
       
   231         * Sets the amount of image data to the given value. 
       
   232         * Should be called when the image data amount is modified explicitly.
       
   233         * @since 3.2
       
   234         * @return void
       
   235         */
       
   236         IMPORT_C void SetSizeL( TInt aSize );
       
   237 
       
   238         /**
       
   239         * Returns the maximum size of the memory space reserved for image data
       
   240         * @since 3.2
       
   241         * @return TInt
       
   242         */
       
   243         IMPORT_C TInt MaxSize() const;
       
   244 
       
   245         /**
       
   246         * Returns the storage type of the image data.
       
   247         * @since 3.2
       
   248         * @return TDataContainer
       
   249         */        
       
   250         IMPORT_C TDataContainer DataContainer() const;
       
   251 
       
   252         /**
       
   253         * Returns the layout of the image data for planar compressed images.
       
   254         * @since 3.2
       
   255         * @return TFrameLayout
       
   256         */        
       
   257         IMPORT_C const TFrameLayout& FrameLayout() const;    
       
   258 
       
   259         /**
       
   260         * Destructor
       
   261         */
       
   262         IMPORT_C virtual ~CVisualFrame();
       
   263 
       
   264         /**
       
   265         * Symbian C++ Two-phased constructor.
       
   266         */        
       
   267         IMPORT_C static CVisualFrame* NewL( const CImageFrame* aImageFrame );
       
   268 
       
   269         /**
       
   270         * Get image frame
       
   271         * @since 3.2
       
   272         * @return CImageFrame
       
   273         */
       
   274         IMPORT_C CImageFrame* GetImageFrameL();
       
   275        
       
   276         
       
   277     private:
       
   278     
       
   279         CVisualFrameImpl* iVisualFrameImpl;
       
   280 
       
   281     };
       
   282     
       
   283 
       
   284 // CLASS DECLARATION
       
   285 
       
   286 /**
       
   287 * CExtJpegDecoder
       
   288 * @lib IclExtJpegApi.lib
       
   289 * @since 3.2
       
   290 */
       
   291 class CExtJpegDecoder : public CJPEGImageFrameDecoder
       
   292     {
       
   293     public:
       
   294 
       
   295         enum TDecoderCapability
       
   296             {
       
   297             ECapNone = 0x0000,
       
   298             ECapCropping = 0x0001,
       
   299             ECapStreaming = 0x0002,
       
   300             ECapRotation = 0x0004,
       
   301             ECapFlipping = 0x0008,
       
   302             ECapMirroring = 0x0010,
       
   303             ECapDctDecoding = 0x0020,
       
   304             ECapExifData = 0x0040
       
   305             };
       
   306             
       
   307         enum TDecoderOperations
       
   308             {
       
   309             EEnd = 0x00010000,
       
   310             ESupportedFormats = 0x00020000,
       
   311             ECapabilities = 0x00040000,
       
   312             EReadyForAsync = 0x00080000,
       
   313             EConvert = 0x00100000,
       
   314             EContinueConvert = 0x00200000
       
   315             };            
       
   316             
       
   317         enum TDecoderType
       
   318             {
       
   319             ESwImplementation = 0,
       
   320             EHwImplementation
       
   321             };
       
   322             
       
   323     public:
       
   324 
       
   325         /**
       
   326         * Symbian C++ Two-phased constructor.
       
   327         * @since 3.2
       
   328         */
       
   329         IMPORT_C static CExtJpegDecoder* NewL();
       
   330 
       
   331         
       
   332         /**
       
   333         * Creates and initializes CExtJpegDecoder
       
   334         * @since 3.2
       
   335         * @param aFs                A reference to a file server session to use.
       
   336         * @param aSourceFilename    The name of the Jpeg file to decode.
       
   337         * @param aMIMEType          The Jpeg MIME type for matching the decoder plugin.
       
   338         * @param aOptions           Decoder options defined in ICL.
       
   339         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   340         */
       
   341         IMPORT_C static CExtJpegDecoder* FileNewL( 
       
   342                                     RFs& aFs, 
       
   343                                     const TDesC& aSourceFilename, 
       
   344                                     const TDesC8& aMIMEType, 
       
   345                                     const TOptions aOptions = EOptionNone );
       
   346 
       
   347         /**
       
   348         * Creates and initializes CExtJpegDecoder
       
   349         * @since 3.2
       
   350         * @param aFs                A reference to a file server session to use.
       
   351         * @param aSourceFilename    The name of the Jpeg file to decode.
       
   352         * @param aOptions           Decoder options defined in ICL.
       
   353         * @param aImageType         The Jpeg image type.    
       
   354         * @param aImageSubType      The Jpeg image subtype (Null UID).  
       
   355         * @param aDecoderUid        The decoder plugin UID.
       
   356         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   357         */      
       
   358         IMPORT_C static CExtJpegDecoder* FileNewL( 
       
   359                                     RFs& aFs, 
       
   360                                     const TDesC& aSourceFilename, 
       
   361                                     const TOptions aOptions = EOptionNone, 
       
   362                                     const TUid aImageType = KNullUid, 
       
   363                                     const TUid aImageSubType = KNullUid, 
       
   364                                     const TUid aDecoderUid = KNullUid );
       
   365 
       
   366         /**
       
   367         * Creates and initializes CExtJpegDecoder
       
   368         * @since 3.2
       
   369         * @param aFs                A reference to a file server session to use.
       
   370         * @param aSourceData        The descriptor reference for the Jpeg image data to decode.
       
   371         * @param aMIMEType          The Jpeg MIME type for matching the decoder plugin.
       
   372         * @param aOptions           Decoder options defined in ICL.
       
   373         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   374         */      
       
   375         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   376                                     RFs& aFs,
       
   377                                     const TDesC8& aSourceData,
       
   378                                     const TDesC8& aMIMEType,
       
   379                                     const TOptions aOptions = EOptionNone );
       
   380         /**
       
   381         * Creates and initializes CExtJpegDecoder
       
   382         * @since 3.2
       
   383         * @param aFs                A reference to a file server session to use.
       
   384         * @param aSourceData        The descriptor reference for the Jpeg image data to decode.
       
   385         * @param aOptions           Decoder options defined in ICL.
       
   386         * @param aImageType         The Jpeg image type.
       
   387         * @param aImageSubType      The Jpeg image subtype (Null UID).
       
   388         * @param aDecoderUid        The decoder plugin UID.
       
   389         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   390         */        
       
   391         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   392                                     RFs& aFs, 
       
   393                                     const TDesC8& aSourceData,
       
   394                                     const TOptions aOptions = EOptionNone,
       
   395                                     const TUid aImageType  = KNullUid,
       
   396                                     const TUid aImageSubType = KNullUid,
       
   397                                     const TUid aDecoderUid = KNullUid );
       
   398 
       
   399         /**
       
   400         * Creates and initializes CExtJpegDecoder
       
   401         * @since 3.2
       
   402         * @param aFs                A reference to a file server session to use.    
       
   403         * @param aSourceData        Pointer to the visual frame structure keeping 
       
   404         *                           the Jpeg image data to decode.
       
   405         * @param aMIMEType          The Jpeg MIME type for matching the decoder plugin.
       
   406         * @param aOptions           Decoder options defined in ICL.
       
   407         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   408         */
       
   409         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   410                                     RFs& aFs, 
       
   411                                     const CVisualFrame* aSourceData,
       
   412                                     const TDesC8& aMIMEType,
       
   413                                     const TOptions aOptions = EOptionNone );
       
   414 
       
   415         /**
       
   416         * Creates and initializes CExtJpegDecoder
       
   417         * @since 3.2
       
   418         * @param aFs                A reference to a file server session to use.    
       
   419         * @param aSourceData        Pointer to the visual frame structure keeping 
       
   420         *                           the Jpeg image data to decode.  
       
   421         * @param aOptions           Decoder options defined in ICL.
       
   422         * @param aImageType         The Jpeg image type.
       
   423         * @param aImageSubType      The Jpeg image subtype (Null UID).
       
   424         * @param aDecoderUid        The decoder plugin UID.
       
   425         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   426         */        
       
   427         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   428                                     RFs& aFs,
       
   429                                     const CVisualFrame* aSourceData,
       
   430                                     const TOptions aOptions = EOptionNone,
       
   431                                     const TUid aImageType  = KNullUid,
       
   432                                     const TUid aImageSubType = KNullUid,
       
   433                                     const TUid aDecoderUid = KNullUid );
       
   434 
       
   435         /**
       
   436         * Destructor.
       
   437         */
       
   438         IMPORT_C virtual ~CExtJpegDecoder();
       
   439     
       
   440         /**
       
   441         * Enables the use of cropping feature and specifies the cropping region. 
       
   442         * @since 3.2
       
   443         * @param aCropRect  The rectangular cropping region that will be decoded.
       
   444         * @return void
       
   445         */
       
   446         IMPORT_C void SetCroppingL( TRect aCropRect );
       
   447 
       
   448         /**
       
   449         * Enables the use of streaming feature and retrieves the macroblock 
       
   450         * dimensions in the Jpeg data.
       
   451         * @since 3.2
       
   452         * @param aMacroBlockSize    The macroblock dimensions in the 
       
   453         *                           Jpeg image that is set by the decoder
       
   454         * @return void
       
   455         */
       
   456         IMPORT_C void SetStreamingL( TSize& aMacroBlockSize );
       
   457 
       
   458         /**
       
   459         * Enables the use of rotation feature and specifies the rotating degree. 
       
   460         * @since 3.2
       
   461         * @param aDegree    The rotation degree. Can take any values between 1 and 359.
       
   462         * @return void
       
   463         */
       
   464         IMPORT_C void SetRotationL( TInt aDegree );
       
   465 
       
   466         /**
       
   467         * Enables the use of flipping feature.
       
   468         * @since 3.2
       
   469         * @return void
       
   470         */
       
   471         IMPORT_C void SetFlippingL();
       
   472 
       
   473         /**
       
   474         * Enables the use of mirroring feature.
       
   475         * @since 3.2
       
   476         * @return void
       
   477         */
       
   478         IMPORT_C void SetMirroringL();
       
   479         
       
   480         /**
       
   481         * SEnables the use of DCT decoding feature.
       
   482         * @since 3.2
       
   483         * @return void
       
   484         */        
       
   485         IMPORT_C void SetDctDecodingL();
       
   486 
       
   487         /**
       
   488         * Asynchronous function for initiating the decoding
       
   489         * @since 3.2
       
   490         * @param aRequestStatus         The pointer to the status of the operation 
       
   491         *                               that is set by the decoder after it is completed.
       
   492         *                               After a complete successful operation, the status 
       
   493         *                               is KErrNone.
       
   494         * @param aDestinationFrame      Pointer to the visual frame structure that is keeping 
       
   495         *                               the destination image data. The client should do the 
       
   496         *                               proper allocation of the destination location.
       
   497         * @param aNoOfDecodedMBlocks    Reference to the number of decoded macroblocks that is 
       
   498         *                               set by the decoder after the decoding is completed.
       
   499         * @param aFrameNumber           The frame index in the Jpeg image.
       
   500         * @return void
       
   501         */
       
   502         IMPORT_C void ConvertL( 
       
   503                         TRequestStatus* aRequestStatus, 
       
   504                         const CVisualFrame* aDestinationFrame, 
       
   505                         TInt& aNoOfDecodedMBlocks,
       
   506                         TInt aFrameNumber = 0 );
       
   507 
       
   508         /**
       
   509         * Asynchronous function for initiating one of the iterations of streamed decoding.
       
   510         * @since 3.2
       
   511         * @param aRequestStatus         The pointer to the status of the operation 
       
   512         *                               that is set by the decoder after it is completed.
       
   513         *                               After a complete successful operation, the status 
       
   514         *                               is KErrNone.
       
   515         * @param aDestinationFrame      Pointer to the visual frame structure that is keeping 
       
   516         *                               the destination image data. The client should do the 
       
   517         *                               proper allocation of the destination location.
       
   518         * @param aNoOfDecodedMBlocks    Reference to the number of decoded macroblocks that is 
       
   519         *                               set by the decoder after the decoding is completed.
       
   520         * @param aFrameNumber           The frame index in the Jpeg image.
       
   521         * @return void
       
   522         */
       
   523         IMPORT_C void ContinueConvertL( 
       
   524                         TRequestStatus* aRequestStatus, 
       
   525                         const CVisualFrame* aDestinationFrame, 
       
   526                         TInt& aNoOfDecodedMBlocks,
       
   527                         TInt aFrameNumber = 0 );
       
   528 
       
   529         /**
       
   530         * Returns the destination (uncompressed) data formats that are supported by the decoder
       
   531         * @since 3.2
       
   532         * @return TInt  The supported destination (uncompressed) data formats. 
       
   533         *               The value is a combination of the flags defined in 
       
   534         *               CVisualFrame::TDataFormat.
       
   535         */
       
   536         IMPORT_C TInt SupportedFormatsL();
       
   537 
       
   538         /**
       
   539         * Returns the Extended API features (capabilities) that are supported by the decoder.
       
   540         * @since 3.2
       
   541         * @return TInt  The supported Extended API features. 
       
   542         *               The value is a combination of the flags defined in TDecoderCapabilities.
       
   543         */
       
   544         IMPORT_C TInt CapabilitiesL();
       
   545 
       
   546         /**
       
   547         * Creates and initializes CExtJpegDecoder
       
   548         * @since 3.2
       
   549         * @param aDecoderType       Decoder implementation type: HW or SW.  
       
   550         * @param aFs                A reference to a file server session to use.
       
   551         * @param aSourceFilename    The name of the Jpeg file to decode.
       
   552         * @param aOptions           Decoder options defined in ICL.
       
   553         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   554         */        
       
   555         IMPORT_C static CExtJpegDecoder* FileNewL( 
       
   556                                     const TDecoderType aDecoderType,
       
   557                                     RFs& aFs, 
       
   558                                     const TDesC& aSourceFilename, 
       
   559                                     const TOptions aOptions = EOptionNone );
       
   560                   
       
   561         /**
       
   562         * Creates and initializes CExtJpegDecoder
       
   563         * @since 3.2
       
   564         * @param aDecoderType       Decoder implementation type: HW or SW.
       
   565         * @param aFs                A reference to a file server session to use.
       
   566         * @param aSourceData        The descriptor reference for the Jpeg image data to decode.
       
   567         * @param aOptions           Decoder options defined in ICL.
       
   568         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   569         */                                            
       
   570         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   571                                     const TDecoderType aDecoderType,
       
   572                                     RFs& aFs, 
       
   573                                     const TDesC8& aSourceData, 
       
   574                                     const TOptions aOptions = EOptionNone );
       
   575 
       
   576         /**
       
   577         * Creates and initializes CExtJpegDecoder
       
   578         * @since 3.2
       
   579         * @param aDecoderType       Decoder implementation type: HW or SW.
       
   580         * @param aFs                A reference to a file server session to use.
       
   581         * @param aSourceData        Pointer to the visual frame structure keeping 
       
   582         *                           the Jpeg image data to decode.
       
   583         * @param aOptions           Decoder options defined in ICL.
       
   584         * @return CExtJpegDecoder*  A pointer to decoder object.
       
   585         */                                            
       
   586         IMPORT_C static CExtJpegDecoder* DataNewL( 
       
   587                                     const TDecoderType aDecoderType, 
       
   588                                     RFs& aFs, 
       
   589                                     const CVisualFrame* aSourceData, 
       
   590                                     const TOptions aOptions = EOptionNone );
       
   591                       
       
   592         /**
       
   593         * Convert
       
   594         * @since 3.2
       
   595         * @param aRequestStatus     The pointer to the status of the operation 
       
   596         *                           that is set by the decoder after it is completed.
       
   597         *                           After a complete successful operation, the status 
       
   598         *                           is KErrNone.
       
   599         * @param aDestination       
       
   600         * @param aFrameNumber       The frame index in the Jpeg image.
       
   601         * @return void
       
   602         */                            
       
   603         IMPORT_C void Convert(  TRequestStatus* aRequestStatus, 
       
   604                                 CFbsBitmap& aDestination, TInt aFrameNumber = 0);
       
   605                                 
       
   606         /**
       
   607         * Convert
       
   608         * @since 3.2
       
   609         * @param aRequestStatus     The pointer to the status of the operation 
       
   610         *                           that is set by the decoder after it is completed.
       
   611         *                           After a complete successful operation, the status 
       
   612         *                           is KErrNone.
       
   613         * @param aDestination       Bitmap destination
       
   614         * @param aDestinationMask   Bitmap destination mask
       
   615         * @param aFrameNumber       The frame index in the Jpeg image.
       
   616         * @return void
       
   617         */                              
       
   618         IMPORT_C void Convert(  TRequestStatus* aRequestStatus, 
       
   619                                 CFbsBitmap& aDestination, 
       
   620                                 CFbsBitmap& aDestinationMask, 
       
   621                                 TInt aFrameNumber = 0 );
       
   622                                 
       
   623         /**
       
   624         * Continue convert
       
   625         * @since 3.2
       
   626         * @param aRequestStatus     The pointer to the status of the operation 
       
   627         *                           that is set by the decoder after it is completed.
       
   628         *                           After a complete successful operation, the status 
       
   629         *                           is KErrNone.
       
   630         * @return void
       
   631         */
       
   632         IMPORT_C void ContinueConvert( TRequestStatus* aRequestStatus );
       
   633 
       
   634     private:
       
   635 
       
   636         /**
       
   637         * C++ default constructor.
       
   638         */
       
   639         CExtJpegDecoder();
       
   640         
       
   641         /**
       
   642         * Get an uid by version range
       
   643         * @since 3.2
       
   644         * @param aMinVersion
       
   645         * @param aMaxVersion
       
   646         * @return TUid
       
   647         */
       
   648         static TUid GetUidByVersionRangeL( TInt aMinVersion, TInt aMaxVersion );
       
   649         
       
   650         TBool iIsExtConvert;
       
   651 
       
   652     };
       
   653 
       
   654 
       
   655 // CLASS DECLARATION
       
   656 
       
   657 /**
       
   658 * CExtJpegEncoder
       
   659 * @lib IclExtJpegApi.lib
       
   660 * @since 3.2
       
   661 */
       
   662 class CExtJpegEncoder : public CJPEGImageFrameEncoder
       
   663     {
       
   664     public:
       
   665 
       
   666         enum TEncoderCapability
       
   667             {
       
   668             ECapNone = 0x0000,
       
   669             ECapStreaming = 0x0001,
       
   670             ECapBitmapOverlay = 0x0002,
       
   671             ECapImageReplacing = 0x0004,
       
   672             ECapBitmapReplacing = 0x0008,
       
   673             ECapLosslessRotation = 0x0010,
       
   674             ECapLosslessFlipping = 0x0020,
       
   675             ECapLosslessMirroring = 0x0040,
       
   676             ECapDctEncoding = 0x0080
       
   677             };
       
   678             
       
   679         enum TEncoderOperations
       
   680             {
       
   681             EEnd = 0x00010000,
       
   682             ESupportedFormats = 0x00020000,
       
   683             ECapabilities = 0x00040000,
       
   684             EReadyForAsync = 0x00080000,
       
   685             EConvert = 0x00100000,
       
   686             EContinueConvert = 0x00200000,
       
   687             EDestVisualFrame = 0x00400000,
       
   688             ENewDestData = 0x00800000,
       
   689             EDestDataSize = 0x01000000
       
   690             };
       
   691                  
       
   692         enum TEncoderType
       
   693             {
       
   694             ESwImplementation = 0,
       
   695             EHwImplementation
       
   696             };                   
       
   697 
       
   698     public:
       
   699     
       
   700 
       
   701         /**
       
   702         * Symbian C++ Two-phased constructor.
       
   703         */      
       
   704         IMPORT_C static CExtJpegEncoder* NewL();
       
   705         
       
   706         /**
       
   707         * Creates and initializes CExtJpegEncoder
       
   708         * @since 3.2
       
   709         * @param aFs                    A reference to a file server session to use.
       
   710         * @param aDestinationFilename   The name of the destination Jpeg file.
       
   711         * @param aMIMEType              The Jpeg MIME type for matching the encoder plugin.
       
   712         * @param aOptions               Encoder options defined in ICL.
       
   713         * @return CExtJpegEncoder*      A pointer to encoder object.
       
   714         */
       
   715         IMPORT_C static CExtJpegEncoder* FileNewL( 
       
   716                                     RFs& aFs, 
       
   717                                     const TDesC& aDestinationFilename, 
       
   718                                     const TDesC8& aMIMEType, 
       
   719                                     const TOptions aOptions = EOptionNone );
       
   720 
       
   721         /**
       
   722         * Creates and initializes CExtJpegEncoder
       
   723         * @param aFs                    A reference to a file server session to use.
       
   724         * @param aDestinationFilename   The name of the destination Jpeg file.
       
   725         * @param aOptions               Encoder options defined in ICL.
       
   726         * @param aImageT                The Jpeg image type.
       
   727         * @param aImageSubType          The Jpeg image subtype (Null UID).
       
   728         * @param aEncoderUid            The encoder plugin UID.
       
   729         * @return CExtJpegEncoder*      A pointer to encoder object.
       
   730         */      
       
   731         IMPORT_C static CExtJpegEncoder* FileNewL( 
       
   732                                     RFs& aFs, 
       
   733                                     const TDesC& aDestinationFilename, 
       
   734                                     const TOptions aOptions = EOptionNone, 
       
   735                                     const TUid aImageType = KNullUid, 
       
   736                                     const TUid aImageSubType = KNullUid, 
       
   737                                     const TUid aEncoderUid = KNullUid );
       
   738 
       
   739         /**
       
   740         * Creates and initializes CExtJpegEncoder
       
   741         * @param aDestinationData   Pointer reference to the destination 
       
   742         *                           Jpeg data location that will be allocated by the encoder.
       
   743         * @param aMIMEType          The Jpeg MIME type for matching the encoder plugin.
       
   744         * @param aOptions           Encoder options defined in ICL.
       
   745         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   746         */  
       
   747         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   748                                     HBufC8*& aDestinationData,
       
   749                                     const TDesC8& aMIMEType,
       
   750                                     const TOptions aOptions = EOptionNone);
       
   751         /**
       
   752         * Creates and initializes CExtJpegEncoder
       
   753         * @param aDestinationData   Pointer reference to the destination 
       
   754         *                           Jpeg data location that will be allocated by the encoder.
       
   755         * @param aOptions           Encoder options defined in ICL.
       
   756         * @param aImageType         The Jpeg image type.
       
   757         * @param aImageSubType      The Jpeg image subtype (Null UID).
       
   758         * @param aEncoderUid        The encoder plugin UID.
       
   759         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   760         */  
       
   761         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   762                                     HBufC8*& aDestinationData,
       
   763                                     const TOptions aOptions = EOptionNone,
       
   764                                     const TUid aImageType = KNullUid,
       
   765                                     const TUid aImageSubType = KNullUid,
       
   766                                     const TUid aEncoderUid = KNullUid);
       
   767         /**
       
   768         * Creates and initializes CExtJpegEncoder
       
   769         * @param aDestinationData   Pointer to the visual frame structure keeping the destination 
       
   770         *                           Jpeg data allocated with maximum size by the client.
       
   771         * @param aMIMEType          The Jpeg MIME type for matching the encoder plugin.
       
   772         * @param aOptions           Encoder options defined in ICL.
       
   773         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   774         */  
       
   775         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   776                                     const CVisualFrame* aDestinationData,
       
   777                                     const TDesC8& aMIMEType,
       
   778                                     const TOptions aOptions = EOptionNone);
       
   779         /**
       
   780         * Creates and initializes CExtJpegEncoder
       
   781         * @param aDestinationData   Pointer to the visual frame structure keeping the destination 
       
   782         *                           Jpeg data allocated with maximum size by the client.
       
   783         * @param aOptions           Encoder options defined in ICL.
       
   784         * @param aImageType         The Jpeg image type.
       
   785         * @param aImageSubType      The Jpeg image subtype (Null UID).
       
   786         * @param aEncoderUid        The encoder plugin UID.
       
   787         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   788         */  
       
   789         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   790                                     const CVisualFrame* aDestinationData,
       
   791                                     const TOptions aOptions = EOptionNone,
       
   792                                     const TUid aImageType = KNullUid,
       
   793                                     const TUid aImageSubType = KNullUid,
       
   794                                     const TUid aEncoderUid = KNullUid);
       
   795 
       
   796         /**
       
   797         * Destructor.
       
   798         */
       
   799         IMPORT_C virtual ~CExtJpegEncoder();
       
   800 
       
   801         /**
       
   802         * Enables the use of streaming feature and retrieves the
       
   803         * macroblock dimensions in the Jpeg data. 
       
   804         * @since 3.2
       
   805         * @param aMacroBlockSize    The macroblock dimensions in the Jpeg 
       
   806         *                           image that is set by the encoder.
       
   807         * @param aFrameImageData    The pointer to the destination Jpeg image data structure.
       
   808         * @return void
       
   809         */
       
   810         IMPORT_C void SetStreamingL( TSize& aMacroBlockSize, 
       
   811                                      const CFrameImageData* aFrameImageData= NULL );
       
   812 
       
   813         /**
       
   814         * Enables the use of replacing feature, where the given image 
       
   815         * is replaced starting from the specified up-left corner point.
       
   816         * @since 3.2
       
   817         * @param aReplaceImage      The image data that will be replaced.
       
   818         * @param aReplacePoint      The up-left corner point of the replacing region.
       
   819         * @return void
       
   820         */
       
   821         IMPORT_C void SetImageReplaceL( const CVisualFrame* aReplaceImage, TPoint aReplacePoint );
       
   822 
       
   823         /**
       
   824         * Enables the use of replacing feature, where the given bitmap 
       
   825         * is replaced starting from the specified up-left corner point.
       
   826         * @since 3.2
       
   827         * @param aReplaceBitmap     The bitmap that will be replaced.
       
   828         * @param aReplacePoint      The up-left corner point of the replacing region.
       
   829         * @return void
       
   830         */
       
   831         IMPORT_C void SetBitmapReplaceL( const CFbsBitmap& aReplaceBitmap, TPoint aReplacePoint );
       
   832 
       
   833         /**
       
   834         * Enables the use of overlay feature, where the given bitmap
       
   835         * is overlayed transparently based on the given alpha value
       
   836         * starting from the specified up-left corner point.
       
   837         * @since 3.2
       
   838         * @param aOverlayBitmap     The bitmap that will be overlayed.
       
   839         * @param aAlphaValue        The alpha value for the transparency of the overlayed bitmap.
       
   840         * @param aOverlayPoint      The up-left corner point of the overlay region.
       
   841         * @return void
       
   842         */
       
   843         IMPORT_C void SetBitmapOverlayL( const CFbsBitmap& aOverlayBitmap, 
       
   844                                          TUint aAlphaValue, TPoint aOverlayPoint );
       
   845 
       
   846         /**
       
   847         * Enables the use of lossless rotation feature and specifies the rotating degree.
       
   848         * @since 3.2
       
   849         * @param aDegree    The rotation degree. Can take any values between 1 and 359.
       
   850         * @return void
       
   851         */
       
   852         IMPORT_C void SetLosslessRotationL( TInt aDegree );
       
   853 
       
   854         /**
       
   855         * Enables the use of lossless flipping feature.
       
   856         * @since 3.2
       
   857         * @return void
       
   858         */
       
   859         IMPORT_C void SetLosslessFlippingL();
       
   860 
       
   861         /**
       
   862         * SEnables the use of lossless mirroring feature.
       
   863         * @since 3.2
       
   864         * @return void
       
   865         */
       
   866         IMPORT_C void SetLosslessMirroringL();
       
   867 
       
   868         /**
       
   869         * Enables the use of DCT encoding feature.
       
   870         * @since 3.2
       
   871         * @return void
       
   872         */        
       
   873         IMPORT_C void SetDctEncodingL();
       
   874 
       
   875         /**
       
   876         * Provides a new visual frame structure for the 
       
   877         * destination data replacing any previously delivered ones.
       
   878         * All the operations coming after this function call should
       
   879         * use the provided structure.
       
   880         * @since 3.2
       
   881         * @param aDestinationData   The new visual frame structure for the destination data.
       
   882         * @return void
       
   883         */        
       
   884         IMPORT_C void ProvideNewDestDataL( const CVisualFrame* aDestinationData );
       
   885 
       
   886         /**
       
   887         * Asynchronous function for initiating the encoding. 
       
   888         * @since 3.2
       
   889         * @param aRequestStatus         The pointer to the status of the operation 
       
   890         *                               that is set by the encoder after it is completed.
       
   891         *                               After a complete successful operation, the status 
       
   892         *                               is KErrNone.
       
   893         * @param aSourceFrame           Pointer to the visual frame structure that is keeping 
       
   894         *                               the source image data. In streaming case, contains a 
       
   895         *                               part of the uncompressed image data at the beginning.
       
   896         * @param aNoOfEncodedMBlocks    Reference to the number of encoded macroblocks that is 
       
   897         *                               set by the encoder after the encoding is completed.
       
   898         * @param aFrameImageData        Pointer to optional frame image data structure defined in ICL.
       
   899         * @return void
       
   900         */
       
   901         IMPORT_C void ConvertL( 
       
   902                         TRequestStatus* aRequestStatus, 
       
   903                         const CVisualFrame* aSourceFrame, 
       
   904                         TInt& aNoOfEncodedMBlocks,
       
   905                         const CFrameImageData* aFrameImageData = NULL );
       
   906 
       
   907         /**
       
   908         * Asynchronous function for initiating one of the iterations of streamed encoding.
       
   909         * @since 3.2
       
   910         * @param aRequestStatus         The pointer to the status of the operation 
       
   911         *                               that is set by the encoder after it is completed.
       
   912         *                               After a complete successful operation, the status 
       
   913         *                               is KErrNone.
       
   914         * @param aSourceFrame           Pointer to the visual frame structure that is keeping 
       
   915         *                               the source image data. In streaming case, contains a 
       
   916         *                               part of the uncompressed image data at the beginning.
       
   917         * @param aNoOfEncodedMBlocks    Reference to the number of encoded macroblocks that is 
       
   918         *                               set by the encoder after the encoding is completed.
       
   919         * @return
       
   920         */
       
   921         IMPORT_C void ContinueConvertL( 
       
   922                         TRequestStatus* aRequestStatus, 
       
   923                         const CVisualFrame* aSourceFrame,
       
   924                         TInt& aNoOfEncodedMBlocks );
       
   925 
       
   926         /**
       
   927         * Returns the source (uncompressed) data formats that are supported by the encoder.
       
   928         * @since 3.2
       
   929         * @return TInt  The supported source (uncompressed) data formats. 
       
   930         *               The value is a combination of the flags defined
       
   931         *               in CVisualFrame::TDataFormat.
       
   932         */
       
   933         IMPORT_C TInt SupportedFormatsL();
       
   934 
       
   935         /**
       
   936         * Returns the Extended API features (capabilities) that are supported by the encoder.
       
   937         * @since 3.2
       
   938         * @return TInt  The supported Extended API features. 
       
   939         *               The value is a combination of the flags defined 
       
   940         *               in TEncoderCapabilities.
       
   941         */
       
   942         IMPORT_C TInt CapabilitiesL();
       
   943 
       
   944         /**
       
   945         * Creates and initializes CExtJpegEncoder
       
   946         * @since 3.2
       
   947         * @param aEncoderType           Encoder implementation type: HW or SW.
       
   948         * @param aFs                    A reference to a file server session to use.
       
   949         * @param aDestinationFilename   The name of the destination Jpeg file.
       
   950         * @param aOptions               Encoder options defined in ICL.
       
   951         * @return CExtJpegEncoder*      A pointer to encoder object.
       
   952         */        
       
   953         IMPORT_C static CExtJpegEncoder* FileNewL( 
       
   954                                     const TEncoderType aEncoderType,
       
   955                                     RFs& aFs, 
       
   956                                     const TDesC& aDestinationFilename, 
       
   957                                     const TOptions aOptions = EOptionNone );
       
   958                 
       
   959         /**
       
   960         * Creates and initializes CExtJpegEncoder
       
   961         * @since 3.2
       
   962         * @param aEncoderType       Encoder implementation type: HW or SW.
       
   963         * @param aDestinationData   Pointer reference to the destination Jpeg
       
   964         *                           data location that will be allocated by the encoder.
       
   965         * @param aOptions           Encoder options defined in ICL.
       
   966         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   967         */                                    
       
   968         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   969                                     const TEncoderType aEncoderType,
       
   970                                     HBufC8*& aDestinationData, 
       
   971                                     const TOptions aOptions = EOptionNone );
       
   972         /**
       
   973         * Creates and initializes CExtJpegEncoder
       
   974         * @since 3.2
       
   975         * @param aEncoderType       Encoder implementation type: HW or SW.
       
   976         * @param aDestinationData   Pointer to the visual frame structure keeping the 
       
   977         *                           destination Jpeg data allocated with maximum size by the client.
       
   978         * @param aOptions           Encoder options defined in ICL.
       
   979         * @return CExtJpegEncoder*  A pointer to encoder object.
       
   980         */                                    
       
   981         IMPORT_C static CExtJpegEncoder* DataNewL( 
       
   982                                     const TEncoderType aEncoderType, 
       
   983                                     const CVisualFrame* aDestinationData, 
       
   984                                     const TOptions aOptions = EOptionNone );        
       
   985         
       
   986         /**
       
   987         * Returns the actual destination buffer size
       
   988         * @since 3.2
       
   989         * @return TInt  The actual destination buffer size required. 
       
   990         *               -1 means the codec is not able to determine the required buffer size.
       
   991         */                                    
       
   992         IMPORT_C TInt GetDestinationDataSizeL();                                    
       
   993 
       
   994 
       
   995     private:
       
   996         
       
   997         /**
       
   998         * C++ default constructor.
       
   999         */
       
  1000         CExtJpegEncoder();
       
  1001         
       
  1002         /**
       
  1003         * Get an uid by version range
       
  1004         * @since 3.2
       
  1005         * @param aMinVersion
       
  1006         * @param aMaxVersion
       
  1007         * @return TUid
       
  1008         */
       
  1009         static TUid GetUidByVersionRangeL( TInt aMinVersion, TInt aMaxVersion );
       
  1010     
       
  1011     };
       
  1012 
       
  1013 #endif  // _ICLEXTJPEGAPI_
       
  1014 
       
  1015 // End of File