epoc32/include/icl/imageconversionextensionintf.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef IMAGECONVERSIONEXTENSIONINTF_H
williamr@2
    17
#define IMAGECONVERSIONEXTENSIONINTF_H
williamr@2
    18
williamr@2
    19
#include <icl/imageconversionextension.h>
williamr@2
    20
williamr@2
    21
class CImageFrame;
williamr@2
    22
class CFrameImageData;
williamr@2
    23
williamr@2
    24
/**
williamr@2
    25
@file
williamr@2
    26
@publishedAll
williamr@2
    27
@released
williamr@2
    28
*/
williamr@2
    29
williamr@2
    30
/**
williamr@2
    31
 Image Conversion Library extensions. When applied together there is an implicit order for operations:
williamr@2
    32
 	1. Crop or clip.
williamr@2
    33
 	2. Scale
williamr@2
    34
 	3. Rotate / flip.
williamr@2
    35
williamr@2
    36
In order to support an extension the codec plugin must implement the interface and return this interface 
williamr@2
    37
through a call to CImageDecoderPlugin::GetExtensionL.
williamr@2
    38
*/
williamr@2
    39
 
williamr@2
    40
/**
williamr@2
    41
Extension base class
williamr@2
    42
*/
williamr@2
    43
class MImageConvExtension
williamr@2
    44
	{
williamr@2
    45
public:
williamr@2
    46
	/** 
williamr@2
    47
	Uid of extension interface.
williamr@2
    48
	*/
williamr@2
    49
	virtual TUid Uid() const = 0; 
williamr@2
    50
williamr@2
    51
	/**
williamr@2
    52
	Increment the reference count.
williamr@2
    53
	*/
williamr@2
    54
	virtual void IncrementRef() = 0;
williamr@2
    55
	
williamr@2
    56
	/**
williamr@2
    57
	Called when the client has finished with this interface allowing the codec to clean up.
williamr@2
    58
	*/
williamr@2
    59
	virtual void Release() = 0; 
williamr@2
    60
	};
williamr@2
    61
williamr@2
    62
/**
williamr@2
    63
Operation extension for Image Conversion Library. Allows rotation and mirror/flip. 
williamr@2
    64
*/
williamr@2
    65
class MImageConvOperation : public MImageConvExtension
williamr@2
    66
	{
williamr@2
    67
public:	
williamr@2
    68
	/**
williamr@2
    69
	 Capabilities of the code plugin.
williamr@2
    70
	 
williamr@2
    71
	 @return Bitmask combination of TOperation. Bit is set if decoder plugin supports the operation.
williamr@2
    72
	 */
williamr@2
    73
	virtual TUint Capabilities() const = 0;
williamr@2
    74
	
williamr@2
    75
	/**
williamr@2
    76
	 Set up an operation be applied to the source. May be called more than once 
williamr@2
    77
	 to set up a stack of operations, but it is not possible to add more than one
williamr@2
    78
	 operation in a single call.
williamr@2
    79
	 
williamr@2
    80
	 @param aOperation An operation to be added to the current operation stack.
williamr@2
    81
	 
williamr@2
    82
	 @leave if more than one TOperation enum is passed for each individual call
williamr@2
    83
	 */
williamr@2
    84
	virtual void AddOperationL(TImageConvOperation::TOperation aOperation) = 0;
williamr@2
    85
	
williamr@2
    86
	/**
williamr@2
    87
	 Remove all operations previously set. 
williamr@2
    88
	*/
williamr@2
    89
	virtual void ClearOperationStack() = 0;
williamr@2
    90
	};
williamr@2
    91
williamr@2
    92
/**
williamr@2
    93
Scaling extension for Image Conversion Library
williamr@2
    94
*/
williamr@2
    95
class MImageConvScaler : public MImageConvExtension
williamr@2
    96
	{
williamr@2
    97
public:
williamr@2
    98
	/**
williamr@2
    99
	 Gets the scaling capabilities.
williamr@2
   100
	 
williamr@2
   101
	 @param aCaps Returns scaling capabilities of the codec plugin.
williamr@2
   102
	 */
williamr@2
   103
	virtual void GetCapabilities(TScalerCaps& aCaps) const = 0;
williamr@2
   104
williamr@2
   105
    /** 
williamr@2
   106
     Request scaling to the desired size using the quality specified and specifying if the aspect ratio is to
williamr@2
   107
     be preserved.
williamr@2
   108
	 @param aDesiredSize  Proposed size of the scaled image.
williamr@2
   109
	 @param aQuality Desired quality of the image. Allows codec to lower quality targets to
williamr@2
   110
     improve performance.
williamr@2
   111
	 @param aLockAspectRatio Set to ETrue if the aspect ratio of the original image is to be preserved.
williamr@2
   112
	 @leave KErrNotSupported if an invalid size is passed.
williamr@2
   113
	 @leave KErrNotSupported if aLockAspectRatio is EFalse and codec only supports preservation of aspect ratio.
williamr@2
   114
	 */ 
williamr@2
   115
	virtual void SetScalingL(const TSize& aDesiredSize, TImageConvScaler::TScalerQuality aQuality, TBool aLockAspectRatio) = 0;
williamr@2
   116
williamr@2
   117
	/**
williamr@2
   118
	 Define the scaling to be applied to the image according to the given coefficient at the requested quality.
williamr@2
   119
	 
williamr@2
   120
	 @param aScalingCoeff Scale to apply to the source. 2 means twice the original size, -2 half the size. 
williamr@2
   121
	                      Do not confuse this with ReductionFactor where 2 indicates 1/2 size.
williamr@2
   122
     @param aScalingQuality Desired quality of the image. Allows codec to lower quality targets to
williamr@2
   123
     improve performance.
williamr@2
   124
	 @leave KErrNotSupported if codec cannot perform the requested scale.
williamr@2
   125
	 */
williamr@2
   126
	virtual void SetScalingL(TInt aScalingCoeff, TImageConvScaler::TScalerQuality aScalingQuality) = 0;
williamr@2
   127
	};
williamr@2
   128
williamr@2
   129
/**
williamr@2
   130
Block Streaming extension for decoder plugins.
williamr@2
   131
*/
williamr@2
   132
class MImageConvStreamedDecode : public MImageConvExtension
williamr@2
   133
	{	
williamr@2
   134
public:
williamr@2
   135
    /**
williamr@2
   136
     Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
williamr@2
   137
     for a list of format uids.
williamr@2
   138
     @param aFormats Returns an array of format uids 
williamr@2
   139
     @param aOptimalFormat The 'best' uid to use. 
williamr@2
   140
     */
williamr@2
   141
	virtual void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const = 0;
williamr@2
   142
williamr@2
   143
	/**
williamr@2
   144
	 Returns the capabilities of the codec plugin for a specific format.
williamr@2
   145
	 @param aFormat The format.
williamr@2
   146
	 @param aFrameNumber frame to stream
williamr@2
   147
	 @param aCaps The capabilities for the format given.
williamr@2
   148
	 */     
williamr@2
   149
	virtual void GetCapabilities(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps& aCaps) const = 0;
williamr@2
   150
	
williamr@2
   151
	/**
williamr@2
   152
	 Get the size of the memory buffer to hold the returned data.
williamr@2
   153
	 
williamr@2
   154
	 @param aFormat the required format
williamr@2
   155
	 @param aBlockSizeInPixels size of a single block to be returned
williamr@2
   156
	 @param aNumBlocks the number of blocks of size TDecodeStreamCaps::MinBlockSizeInPixels() to be returned by one request
williamr@2
   157
	 @return The memory buffer size in bytes to hold the requested blocks.
williamr@2
   158
	 */
williamr@2
   159
	virtual TInt GetBufferSize(TUid aFormat, TSize& aBlockSizeInPixels, TInt aNumBlocks) const = 0;
williamr@2
   160
williamr@2
   161
	/**
williamr@2
   162
	 Initialise the stream.
williamr@2
   163
	 @param aFormat the format to use
williamr@2
   164
	 @param aFrameNumber frame to stream
williamr@2
   165
	 @param aNavigation indication to stream of the way that the stream will be navigated. Allows 
williamr@2
   166
	 codec to optimise it's behaviour.
williamr@2
   167
	 
williamr@2
   168
	 @note TO DO Do we need to specify where the source is held e.g. in memory, on flash card etc?
williamr@2
   169
	 
williamr@2
   170
	 @note must call InitFrameL before GetBlocks or GetNextBlocks. Failure to do so completes request with
williamr@2
   171
	 KErrNotReady
williamr@2
   172
	 */
williamr@2
   173
	virtual void InitFrameL(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps::TNavigation aNavigation) = 0;
williamr@2
   174
williamr@2
   175
	/**
williamr@2
   176
	 Start asynchronous call to return random blocks from the stream
williamr@2
   177
	 
williamr@2
   178
	 @param aStatus request status
williamr@2
   179
	 @param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of 
williamr@2
   180
	 pixel data. This can be 'uninitialised' or given specific format which must match that
williamr@2
   181
	 specified in the InitFrameL call.
williamr@2
   182
	 @param aSeqPosition block number starting at 0 ...
williamr@2
   183
	 @param aNumBlocksToGet number of blocks requested
williamr@2
   184
	 @param aNumBlocksRead number of blocks which will be returned when the request completes
williamr@2
   185
	 
williamr@2
   186
     @note use CImageDecoder::Cancel() to cancel this request.
williamr@2
   187
	 */
williamr@2
   188
	virtual void GetBlocks(TRequestStatus* aStatus, CImageFrame* aFrame, TInt aSeqPosition, TInt aNumBlocksToGet, TInt* aNumBlocksRead) = 0;
williamr@2
   189
williamr@2
   190
	/**
williamr@2
   191
	 Start asynchronous call to return blocks sequentially from the stream. Blocks are returned 
williamr@2
   192
	 from the first block until the last in the stream.
williamr@2
   193
	 
williamr@2
   194
	 @param aStatus request status
williamr@2
   195
	 @param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of 
williamr@2
   196
	 pixel data. This can be 'uninitialised' or given specific format which must match that
williamr@2
   197
	 specified in the InitFrameL call.
williamr@2
   198
	 @param aNumBlocksToGet number of blocks requested
williamr@2
   199
	 @param aNumBlocksRead number of blocks which will be returned when the request completes
williamr@2
   200
	 
williamr@2
   201
     @note use CImageDecoder::Cancel() to cancel this request.
williamr@2
   202
	 */
williamr@2
   203
	virtual void GetNextBlocks(TRequestStatus* aStatus, CImageFrame* aFrame, TInt aNumBlocksToGet, TInt* aNumBlocksRead, TBool* aHaveMoreBlocks) = 0;
williamr@2
   204
	};
williamr@2
   205
williamr@2
   206
/**
williamr@2
   207
Block Streaming extension for encoder plugins.
williamr@2
   208
*/
williamr@2
   209
class MImageConvStreamedEncode : public MImageConvExtension
williamr@2
   210
	{
williamr@2
   211
public:
williamr@2
   212
    /**
williamr@2
   213
     Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
williamr@2
   214
     for a list of format uids.
williamr@2
   215
     @param aFormats Returns an array of format uids 
williamr@2
   216
     @param aOptimalFormat The 'best' uid to use. 
williamr@2
   217
     */
williamr@2
   218
	virtual void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const = 0;
williamr@2
   219
williamr@2
   220
	/**
williamr@2
   221
	 Returns the capabilities of the codec plugin for a specific format.
williamr@2
   222
	 @param aFormat The format.
williamr@2
   223
	 @param aCaps The capabilities for the format given.
williamr@2
   224
	 */     
williamr@2
   225
	virtual void GetCapabilities(TUid aFormat, TEncodeStreamCaps& aCaps) const = 0;
williamr@2
   226
williamr@2
   227
	/**
williamr@2
   228
	 Initialise the stream.
williamr@2
   229
	 @param aFormat the format to use
williamr@2
   230
	 @param aFrameNumber frame to stream
williamr@2
   231
	 @param aFrameSizeInPixels Size of this frame in pixels
williamr@2
   232
	 @param aBlockSizeInPixels Size of block to be added / appended. ??? do we want to support multiple blocks being added
williamr@2
   233
	 in which case InitFrameL needs an extra parameter
williamr@2
   234
	 @param aNavigation indication to stream of the way that the stream will be navigated. Allows 
williamr@2
   235
	 codec to optimise it's behaviour.
williamr@2
   236
	 @param aFrameImageData The frame image data. Optional.
williamr@2
   237
	 There exists format-specific image data variants that are used by 
williamr@2
   238
	 encoders to obtain image specific data. This behaviour is invoked by specifying 
williamr@2
   239
	 aFrameImageData. Otherwise, if set to NULL, encoder specific defaults are invoked. @see TJpegImageData
williamr@2
   240
	 
williamr@2
   241
	 @note TO DO Do we need to specify where the destination is held e.g. in memory, on flash card etc?
williamr@2
   242
	 
williamr@2
   243
	 @note must call InitFrameL before AppendBlocks or AddBlocks. Failure to do so completes request with
williamr@2
   244
	 KErrNotReady
williamr@2
   245
williamr@2
   246
	 @note can either specify format through aFormat or aImageFrameData. Conflicts should leave with KErrArgument. 
williamr@2
   247
	 */
williamr@2
   248
	virtual void InitFrameL(TUid aFormat, TInt aFrameNumber, const TSize& aFrameSizeInPixels, const TSize& aBlockSizeInPixels, TEncodeStreamCaps::TNavigation aNavigation, const CFrameImageData* aFrameImageData) = 0;
williamr@2
   249
	
williamr@2
   250
	/** Append blocks to the stream.
williamr@2
   251
	 @param aStatus request status	
williamr@2
   252
	 @param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
williamr@2
   253
	 @param aNumBlocksToAdd number of blocks of size TEncodeStreamCaps::MinBlockSizeInPixels to add to the stream
williamr@2
   254
	 */
williamr@2
   255
	virtual void AppendBlocks(TRequestStatus* aStatus, const CImageFrame& aBlocks, TInt aNumBlocksToAdd) = 0 ;
williamr@2
   256
	
williamr@2
   257
	/** Add blocks to the stream at a random position.
williamr@2
   258
	 @param aStatus request status	
williamr@2
   259
	 @param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
williamr@2
   260
	 @param aSeqPosition position of block in stream starting at 0
williamr@2
   261
	 */
williamr@2
   262
	virtual void AddBlocks(TRequestStatus* aStatus, const CImageFrame& aBlocks, const TInt& aSeqPosition) = 0;
williamr@2
   263
	
williamr@2
   264
	/** Signal completion of writing the stream
williamr@2
   265
	 @param aStatus request status	
williamr@2
   266
	*/
williamr@2
   267
	virtual void Complete(TRequestStatus* aStatus) = 0; 
williamr@2
   268
private:
williamr@2
   269
	TInt iReserved; // future proof
williamr@2
   270
	};
williamr@2
   271
williamr@2
   272
williamr@2
   273
/**
williamr@2
   274
Extension for Prepare (analyse image in advance of conversion)
williamr@2
   275
*/
williamr@2
   276
class MImageConvPrepare : public MImageConvExtension
williamr@2
   277
	{
williamr@2
   278
public:
williamr@2
   279
	/**
williamr@2
   280
	Call to allow analysis of image prior to calling Convert.
williamr@2
   281
williamr@2
   282
	@param	aStatus
williamr@2
   283
			Request status. On completion this contains an error code. This is KErrNone if the frame
williamr@2
   284
			was analyzed successfully, KErrNotSupported if the codec does not support analysis, or a 
williamr@2
   285
			system-wide error code.
williamr@2
   286
	*/
williamr@2
   287
	virtual void Prepare(TRequestStatus* aStatus) = 0;
williamr@2
   288
williamr@2
   289
private:
williamr@2
   290
	TInt iReserved; // future proof
williamr@2
   291
	};
williamr@2
   292
	
williamr@2
   293
williamr@2
   294
williamr@2
   295
#endif // IMAGECONVERSIONEXTENSIONINF_H