1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef IMAGECONVERSIONEXTENSIONINTF_H
17 #define IMAGECONVERSIONEXTENSIONINTF_H
19 #include <icl/imageconversionextension.h>
22 class CFrameImageData;
31 Image Conversion Library extensions. When applied together there is an implicit order for operations:
36 In order to support an extension the codec plugin must implement the interface and return this interface
37 through a call to CImageDecoderPlugin::GetExtensionL.
43 class MImageConvExtension
47 Uid of extension interface.
49 virtual TUid Uid() const = 0;
52 Increment the reference count.
54 virtual void IncrementRef() = 0;
57 Called when the client has finished with this interface allowing the codec to clean up.
59 virtual void Release() = 0;
63 Operation extension for Image Conversion Library. Allows rotation and mirror/flip.
65 class MImageConvOperation : public MImageConvExtension
69 Capabilities of the code plugin.
71 @return Bitmask combination of TOperation. Bit is set if decoder plugin supports the operation.
73 virtual TUint Capabilities() const = 0;
76 Set up an operation be applied to the source. May be called more than once
77 to set up a stack of operations, but it is not possible to add more than one
78 operation in a single call.
80 @param aOperation An operation to be added to the current operation stack.
82 @leave if more than one TOperation enum is passed for each individual call
84 virtual void AddOperationL(TImageConvOperation::TOperation aOperation) = 0;
87 Remove all operations previously set.
89 virtual void ClearOperationStack() = 0;
93 Scaling extension for Image Conversion Library
95 class MImageConvScaler : public MImageConvExtension
99 Gets the scaling capabilities.
101 @param aCaps Returns scaling capabilities of the codec plugin.
103 virtual void GetCapabilities(TScalerCaps& aCaps) const = 0;
106 Request scaling to the desired size using the quality specified and specifying if the aspect ratio is to
108 @param aDesiredSize Proposed size of the scaled image.
109 @param aQuality Desired quality of the image. Allows codec to lower quality targets to
111 @param aLockAspectRatio Set to ETrue if the aspect ratio of the original image is to be preserved.
112 @leave KErrNotSupported if an invalid size is passed.
113 @leave KErrNotSupported if aLockAspectRatio is EFalse and codec only supports preservation of aspect ratio.
115 virtual void SetScalingL(const TSize& aDesiredSize, TImageConvScaler::TScalerQuality aQuality, TBool aLockAspectRatio) = 0;
118 Define the scaling to be applied to the image according to the given coefficient at the requested quality.
120 @param aScalingCoeff Scale to apply to the source. 2 means twice the original size, -2 half the size.
121 Do not confuse this with ReductionFactor where 2 indicates 1/2 size.
122 @param aScalingQuality Desired quality of the image. Allows codec to lower quality targets to
124 @leave KErrNotSupported if codec cannot perform the requested scale.
126 virtual void SetScalingL(TInt aScalingCoeff, TImageConvScaler::TScalerQuality aScalingQuality) = 0;
130 Block Streaming extension for decoder plugins.
132 class MImageConvStreamedDecode : public MImageConvExtension
136 Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
137 for a list of format uids.
138 @param aFormats Returns an array of format uids
139 @param aOptimalFormat The 'best' uid to use.
141 virtual void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const = 0;
144 Returns the capabilities of the codec plugin for a specific format.
145 @param aFormat The format.
146 @param aFrameNumber frame to stream
147 @param aCaps The capabilities for the format given.
149 virtual void GetCapabilities(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps& aCaps) const = 0;
152 Get the size of the memory buffer to hold the returned data.
154 @param aFormat the required format
155 @param aBlockSizeInPixels size of a single block to be returned
156 @param aNumBlocks the number of blocks of size TDecodeStreamCaps::MinBlockSizeInPixels() to be returned by one request
157 @return The memory buffer size in bytes to hold the requested blocks.
159 virtual TInt GetBufferSize(TUid aFormat, TSize& aBlockSizeInPixels, TInt aNumBlocks) const = 0;
162 Initialise the stream.
163 @param aFormat the format to use
164 @param aFrameNumber frame to stream
165 @param aNavigation indication to stream of the way that the stream will be navigated. Allows
166 codec to optimise it's behaviour.
168 @note TO DO Do we need to specify where the source is held e.g. in memory, on flash card etc?
170 @note must call InitFrameL before GetBlocks or GetNextBlocks. Failure to do so completes request with
173 virtual void InitFrameL(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps::TNavigation aNavigation) = 0;
176 Start asynchronous call to return random blocks from the stream
178 @param aStatus request status
179 @param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of
180 pixel data. This can be 'uninitialised' or given specific format which must match that
181 specified in the InitFrameL call.
182 @param aSeqPosition block number starting at 0 ...
183 @param aNumBlocksToGet number of blocks requested
184 @param aNumBlocksRead number of blocks which will be returned when the request completes
186 @note use CImageDecoder::Cancel() to cancel this request.
188 virtual void GetBlocks(TRequestStatus* aStatus, CImageFrame* aFrame, TInt aSeqPosition, TInt aNumBlocksToGet, TInt* aNumBlocksRead) = 0;
191 Start asynchronous call to return blocks sequentially from the stream. Blocks are returned
192 from the first block until the last in the stream.
194 @param aStatus request status
195 @param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of
196 pixel data. This can be 'uninitialised' or given specific format which must match that
197 specified in the InitFrameL call.
198 @param aNumBlocksToGet number of blocks requested
199 @param aNumBlocksRead number of blocks which will be returned when the request completes
201 @note use CImageDecoder::Cancel() to cancel this request.
203 virtual void GetNextBlocks(TRequestStatus* aStatus, CImageFrame* aFrame, TInt aNumBlocksToGet, TInt* aNumBlocksRead, TBool* aHaveMoreBlocks) = 0;
207 Block Streaming extension for encoder plugins.
209 class MImageConvStreamedEncode : public MImageConvExtension
213 Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
214 for a list of format uids.
215 @param aFormats Returns an array of format uids
216 @param aOptimalFormat The 'best' uid to use.
218 virtual void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const = 0;
221 Returns the capabilities of the codec plugin for a specific format.
222 @param aFormat The format.
223 @param aCaps The capabilities for the format given.
225 virtual void GetCapabilities(TUid aFormat, TEncodeStreamCaps& aCaps) const = 0;
228 Initialise the stream.
229 @param aFormat the format to use
230 @param aFrameNumber frame to stream
231 @param aFrameSizeInPixels Size of this frame in pixels
232 @param aBlockSizeInPixels Size of block to be added / appended. ??? do we want to support multiple blocks being added
233 in which case InitFrameL needs an extra parameter
234 @param aNavigation indication to stream of the way that the stream will be navigated. Allows
235 codec to optimise it's behaviour.
236 @param aFrameImageData The frame image data. Optional.
237 There exists format-specific image data variants that are used by
238 encoders to obtain image specific data. This behaviour is invoked by specifying
239 aFrameImageData. Otherwise, if set to NULL, encoder specific defaults are invoked. @see TJpegImageData
241 @note TO DO Do we need to specify where the destination is held e.g. in memory, on flash card etc?
243 @note must call InitFrameL before AppendBlocks or AddBlocks. Failure to do so completes request with
246 @note can either specify format through aFormat or aImageFrameData. Conflicts should leave with KErrArgument.
248 virtual void InitFrameL(TUid aFormat, TInt aFrameNumber, const TSize& aFrameSizeInPixels, const TSize& aBlockSizeInPixels, TEncodeStreamCaps::TNavigation aNavigation, const CFrameImageData* aFrameImageData) = 0;
250 /** Append blocks to the stream.
251 @param aStatus request status
252 @param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
253 @param aNumBlocksToAdd number of blocks of size TEncodeStreamCaps::MinBlockSizeInPixels to add to the stream
255 virtual void AppendBlocks(TRequestStatus* aStatus, const CImageFrame& aBlocks, TInt aNumBlocksToAdd) = 0 ;
257 /** Add blocks to the stream at a random position.
258 @param aStatus request status
259 @param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
260 @param aSeqPosition position of block in stream starting at 0
262 virtual void AddBlocks(TRequestStatus* aStatus, const CImageFrame& aBlocks, const TInt& aSeqPosition) = 0;
264 /** Signal completion of writing the stream
265 @param aStatus request status
267 virtual void Complete(TRequestStatus* aStatus) = 0;
269 TInt iReserved; // future proof
274 Extension for Prepare (analyse image in advance of conversion)
276 class MImageConvPrepare : public MImageConvExtension
280 Call to allow analysis of image prior to calling Convert.
283 Request status. On completion this contains an error code. This is KErrNone if the frame
284 was analyzed successfully, KErrNotSupported if the codec does not support analysis, or a
285 system-wide error code.
287 virtual void Prepare(TRequestStatus* aStatus) = 0;
290 TInt iReserved; // future proof
295 #endif // IMAGECONVERSIONEXTENSIONINF_H