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@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.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 IMAGECONVERSIONEXTENSION_H
|
williamr@2
|
17 |
#define IMAGECONVERSIONEXTENSION_H
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32base.h>
|
williamr@2
|
20 |
class MImageConvExtension;
|
williamr@2
|
21 |
class MImageConvOperation;
|
williamr@2
|
22 |
class MImageConvScaler;
|
williamr@2
|
23 |
class MImageConvStreamedDecode;
|
williamr@2
|
24 |
class MImageConvStreamedEncode;
|
williamr@2
|
25 |
class TFrameLayout;
|
williamr@2
|
26 |
class CImageFrame;
|
williamr@2
|
27 |
class CFrameImageData;
|
williamr@2
|
28 |
|
williamr@2
|
29 |
/**
|
williamr@2
|
30 |
@file
|
williamr@2
|
31 |
@publishedAll
|
williamr@2
|
32 |
@released
|
williamr@2
|
33 |
*/
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
Image Conversion Library extensions. When applied together there is an implicit order for operations:
|
williamr@2
|
37 |
1. Crop or clip.
|
williamr@2
|
38 |
2. Scale
|
williamr@2
|
39 |
3. Rotate / mirror over axis.
|
williamr@2
|
40 |
*/
|
williamr@2
|
41 |
|
williamr@2
|
42 |
/**
|
williamr@2
|
43 |
Operation extension for Image Conversion Library. Allows rotation and mirror over axis.
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
class TImageConvOperation
|
williamr@2
|
46 |
{
|
williamr@2
|
47 |
friend class CImageDecoder;
|
williamr@2
|
48 |
friend class CImageEncoder;
|
williamr@2
|
49 |
|
williamr@2
|
50 |
public:
|
williamr@2
|
51 |
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
Operations or transforms on an image.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
enum TOperation
|
williamr@2
|
57 |
{
|
williamr@2
|
58 |
/** Rotate source 90 degrees clockwise.
|
williamr@2
|
59 |
*/
|
williamr@2
|
60 |
ERotation90DegreesClockwise = 0x01,
|
williamr@2
|
61 |
/** Rotate source 180 degrees clockwise.
|
williamr@2
|
62 |
*/
|
williamr@2
|
63 |
ERotation180DegreesClockwise = 0x02,
|
williamr@2
|
64 |
/** Rotate source 270 degrees clockwise.
|
williamr@2
|
65 |
*/
|
williamr@2
|
66 |
ERotation270DegreesClockwise = 0x04,
|
williamr@2
|
67 |
/** Mirror source about the horizontal axis.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
EMirrorHorizontalAxis = 0x08,
|
williamr@2
|
70 |
/** Mirror source about the vertical axis.
|
williamr@2
|
71 |
*/
|
williamr@2
|
72 |
EMirrorVerticalAxis = 0x10
|
williamr@2
|
73 |
};
|
williamr@2
|
74 |
|
williamr@2
|
75 |
/**
|
williamr@2
|
76 |
Get the codec plugin's capabilities.
|
williamr@2
|
77 |
|
williamr@2
|
78 |
@return Bitmask combination of TOperation. Bit is set if decoder plugin supports the operation.
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
IMPORT_C TUint Capabilities() const;
|
williamr@2
|
81 |
|
williamr@2
|
82 |
/**
|
williamr@2
|
83 |
Set up an operation be applied to the source. May be called more than once
|
williamr@2
|
84 |
to set up a stack of operations, but it is not possible to add more than one
|
williamr@2
|
85 |
operation in a single call.
|
williamr@2
|
86 |
The operations are applied to the image in the same order as they are added.
|
williamr@2
|
87 |
|
williamr@2
|
88 |
@param aOperation The operation to add to the current stack of operations.
|
williamr@2
|
89 |
|
williamr@2
|
90 |
@leave if more than one TOperation enum is passed for each individual call
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
IMPORT_C void AddOperationL(TOperation aOperation);
|
williamr@2
|
93 |
|
williamr@2
|
94 |
/**
|
williamr@2
|
95 |
Remove all operations previously set.
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
IMPORT_C void ClearOperationStack();
|
williamr@2
|
98 |
|
williamr@2
|
99 |
private:
|
williamr@2
|
100 |
|
williamr@2
|
101 |
IMPORT_C TImageConvOperation();
|
williamr@2
|
102 |
void SetExtension(MImageConvExtension* aExtension);
|
williamr@2
|
103 |
|
williamr@2
|
104 |
private:
|
williamr@2
|
105 |
MImageConvOperation* iExtension;
|
williamr@2
|
106 |
TInt iReserved; // future proof
|
williamr@2
|
107 |
};
|
williamr@2
|
108 |
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
Represents scaling capabilities of the code plugin.
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
class TScalerCaps
|
williamr@2
|
114 |
{
|
williamr@2
|
115 |
public:
|
williamr@2
|
116 |
/**
|
williamr@2
|
117 |
Constructor
|
williamr@2
|
118 |
*/
|
williamr@2
|
119 |
IMPORT_C TScalerCaps();
|
williamr@2
|
120 |
|
williamr@2
|
121 |
/**
|
williamr@2
|
122 |
Constructor
|
williamr@2
|
123 |
|
williamr@2
|
124 |
@param aMaxUpscaleLimit Maximum upscaling possible.
|
williamr@2
|
125 |
@param aMaxDownscaleLimit Maximum downscaling possible.
|
williamr@2
|
126 |
@param aPreserveAspectRatioIsNeeded ETrue if only support preservation of aspect ratio.
|
williamr@2
|
127 |
*/
|
williamr@2
|
128 |
IMPORT_C TScalerCaps(TInt aMaxUpscaleLimit,TInt aMaxDownscaleLimit,TBool aPreserveAspectRatioIsNeeded);
|
williamr@2
|
129 |
|
williamr@2
|
130 |
/**
|
williamr@2
|
131 |
Maximum upscaling possible.
|
williamr@2
|
132 |
@return value >= 1 : 1 means cannot upscale, 2 means twice original size
|
williamr@2
|
133 |
*/
|
williamr@2
|
134 |
IMPORT_C TInt MaxUpscaleLimit() const;
|
williamr@2
|
135 |
|
williamr@2
|
136 |
/**
|
williamr@2
|
137 |
Maximum downscaling possible.
|
williamr@2
|
138 |
@return value <= -1 : -1 means cannot downscale, -2 means half original size
|
williamr@2
|
139 |
*/
|
williamr@2
|
140 |
IMPORT_C TInt MaxDownscaleLimit() const;
|
williamr@2
|
141 |
|
williamr@2
|
142 |
/**
|
williamr@2
|
143 |
Type of scaling which is supported.
|
williamr@2
|
144 |
|
williamr@2
|
145 |
@return ETrue if can only do 1/2, 1/4, 1/8 etc downscale (limit depends on iMaxDownscaleLimit)
|
williamr@2
|
146 |
2, 4, 8 etc upscale (limit depends on iMaxUpscaleLimit)
|
williamr@2
|
147 |
EFalse if can do arbitrary scaling between iMaxDownscaleLimit and iMaxUpscaleLimit
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C TBool PowerOfTwoScalingOnly() const;
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
Returns ETrue if the codec must preserve aspect ratio during scaling.
|
williamr@2
|
153 |
|
williamr@2
|
154 |
@return ETrue if scaling is only possible if preservation of aspect ratio is requested.
|
williamr@2
|
155 |
EFalse if scaling without preserving aspect ratio is possible.
|
williamr@2
|
156 |
*/
|
williamr@2
|
157 |
IMPORT_C TBool MustPreserveAspectRatio() const;
|
williamr@2
|
158 |
|
williamr@2
|
159 |
/**
|
williamr@2
|
160 |
Compatibility - internal use only
|
williamr@2
|
161 |
@internalComponent
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
IMPORT_C TUint Size() const;
|
williamr@2
|
164 |
|
williamr@2
|
165 |
/**
|
williamr@2
|
166 |
Compatibility - internal use only
|
williamr@2
|
167 |
@internalComponent
|
williamr@2
|
168 |
*/
|
williamr@2
|
169 |
IMPORT_C TUint Version() const;
|
williamr@2
|
170 |
|
williamr@2
|
171 |
private:
|
williamr@2
|
172 |
TInt iMaxUpscaleLimit; // >= 1 : 2 means twice original size
|
williamr@2
|
173 |
TBool iMustPreserveAspectRatio; // If ETrue then can only do scaling whilst preserving aspect ratio
|
williamr@2
|
174 |
TInt iMaxDownscaleLimit; // <= -1 : -2 means 1/2 original size
|
williamr@2
|
175 |
TBool iPowerOfTwoScalingOnly;
|
williamr@2
|
176 |
TUint iSizeVersion; // bits 31 to 8 size, 7 to 0 contain version
|
williamr@2
|
177 |
TInt iReserved; // future proof
|
williamr@2
|
178 |
};
|
williamr@2
|
179 |
|
williamr@2
|
180 |
|
williamr@2
|
181 |
/**
|
williamr@2
|
182 |
Scaling extension for Image Conversion Library. Supports both arbitrary or 'power of two' 1/2, 1/4, 1/8 scaling
|
williamr@2
|
183 |
*/
|
williamr@2
|
184 |
class TImageConvScaler
|
williamr@2
|
185 |
{
|
williamr@2
|
186 |
friend class CImageDecoder;
|
williamr@2
|
187 |
|
williamr@2
|
188 |
public:
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/**
|
williamr@2
|
191 |
Quality used during scaling.
|
williamr@2
|
192 |
*/
|
williamr@2
|
193 |
enum TScalerQuality
|
williamr@2
|
194 |
{
|
williamr@2
|
195 |
EMinimumQuality, // = 0
|
williamr@2
|
196 |
EMediumQuality,
|
williamr@2
|
197 |
EMaximumQuality
|
williamr@2
|
198 |
};
|
williamr@2
|
199 |
|
williamr@2
|
200 |
/**
|
williamr@2
|
201 |
Get the codec plugin's capabilities.
|
williamr@2
|
202 |
|
williamr@2
|
203 |
@param aCaps Returns scaling capabilities of the codec plugin.
|
williamr@2
|
204 |
*/
|
williamr@2
|
205 |
IMPORT_C void GetCapabilities(TScalerCaps& aCaps) const;
|
williamr@2
|
206 |
|
williamr@2
|
207 |
/**
|
williamr@2
|
208 |
Request scaling to the desired size using the quality specified and specifying if the aspect ratio is to
|
williamr@2
|
209 |
be preserved.
|
williamr@2
|
210 |
Ensure that CImageDecoder::GetDestinationSize is used to obtain the size of destination bitmap passed
|
williamr@2
|
211 |
to CImageDecoder::Convert if scaling is set up by calling this method.
|
williamr@2
|
212 |
|
williamr@2
|
213 |
@param aDesiredSize Proposed size of the scaled image. Note that this may not necessarily be the size
|
williamr@2
|
214 |
returned by a subsequent call to CImageDecoder::GetDestinationSize and is dependant upon the operations
|
williamr@2
|
215 |
(such as scaling, cropping and rotation) requested and also the capabilities of the plugin (which can be
|
williamr@2
|
216 |
queried using TImageConvScaler::GetCapabilities).
|
williamr@2
|
217 |
|
williamr@2
|
218 |
Example: If a plugin is only capable of power of two scaling, with an original image size of 600x400,
|
williamr@2
|
219 |
then calling this SetScalingL function with a desired size of 500x300 will result in a subsequent call to
|
williamr@2
|
220 |
CImageDecoder::GetDestinationSize returning a size of 300x200 (that is, a scaling coefficient of -2).
|
williamr@2
|
221 |
|
williamr@2
|
222 |
@param aQuality Desired quality of the image. Allows codec to lower quality targets to
|
williamr@2
|
223 |
improve performance.
|
williamr@2
|
224 |
|
williamr@2
|
225 |
@param aLockAspectRatio Set to ETrue if the aspect ratio of the original image is to be preserved.
|
williamr@2
|
226 |
|
williamr@2
|
227 |
@leave KErrNotSupported if an invalid size is passed.
|
williamr@2
|
228 |
@leave KErrNotSupported if aLockAspectRatio is EFalse and codec only supports preservation of aspect ratio.
|
williamr@2
|
229 |
|
williamr@2
|
230 |
@see CImageDecoder::Convert
|
williamr@2
|
231 |
@see CImageDecoder::GetDestinationSize
|
williamr@2
|
232 |
@see TImageConvScaler::GetCapabilities
|
williamr@2
|
233 |
*/
|
williamr@2
|
234 |
IMPORT_C void SetScalingL(const TSize& aDesiredSize, TImageConvScaler::TScalerQuality aQuality, TBool aLockAspectRatio);
|
williamr@2
|
235 |
|
williamr@2
|
236 |
/**
|
williamr@2
|
237 |
Define the scaling to be applied to the image according to the given coefficient at the requested quality.
|
williamr@2
|
238 |
Ensure that CImageDecoder::GetDestinationSize is used to obtain the size of destination bitmap to be passed
|
williamr@2
|
239 |
to CImageDecoder::Convert.
|
williamr@2
|
240 |
|
williamr@2
|
241 |
@param aScalingCoeff Scale to apply to the source. 2 means twice the original size, -2 half the size.
|
williamr@2
|
242 |
Do not confuse this with ReductionFactor where 2 indicates 1/2 size.
|
williamr@2
|
243 |
|
williamr@2
|
244 |
@param aScalingQuality Desired quality of the image. Allows codec to lower quality targets to
|
williamr@2
|
245 |
improve performance.
|
williamr@2
|
246 |
|
williamr@2
|
247 |
@leave KErrNotSupported if codec cannot perform the requested scale.
|
williamr@2
|
248 |
|
williamr@2
|
249 |
@see CImageDecoder::Convert
|
williamr@2
|
250 |
*/
|
williamr@2
|
251 |
IMPORT_C void SetScalingL(TInt aScalingCoeff, TImageConvScaler::TScalerQuality aScalingQuality);
|
williamr@2
|
252 |
|
williamr@2
|
253 |
private:
|
williamr@2
|
254 |
IMPORT_C TImageConvScaler();
|
williamr@2
|
255 |
void SetExtension(MImageConvExtension* aExtension);
|
williamr@2
|
256 |
|
williamr@2
|
257 |
private:
|
williamr@2
|
258 |
MImageConvScaler* iExtension;
|
williamr@2
|
259 |
TInt iReserved; // future proof
|
williamr@2
|
260 |
};
|
williamr@2
|
261 |
|
williamr@2
|
262 |
/**
|
williamr@2
|
263 |
'Block' streaming extension capabilities.
|
williamr@2
|
264 |
*/
|
williamr@2
|
265 |
class TDecodeStreamCaps
|
williamr@2
|
266 |
{
|
williamr@2
|
267 |
public:
|
williamr@2
|
268 |
/** Navigation possibilities within stream.
|
williamr@2
|
269 |
*/
|
williamr@2
|
270 |
enum TNavigation
|
williamr@2
|
271 |
{
|
williamr@2
|
272 |
/** Blocks are returned from first to last */
|
williamr@2
|
273 |
ENavigationSequentialForward = 0x01,
|
williamr@2
|
274 |
|
williamr@2
|
275 |
/** Blocks are returned in a random order but moving only from first to last e.g. 1, 5, 18...*/
|
williamr@2
|
276 |
ENavigationRandomForward = 0x02,
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/** Blocks are returned in a random order but moving only from last to first e.g. 18, 5, 1...*/
|
williamr@2
|
279 |
ENavigationRandomBackwards = 0x04,
|
williamr@2
|
280 |
|
williamr@2
|
281 |
/** Blocks are returned randomly e.g. 18, 5, 20, ...*/
|
williamr@2
|
282 |
ENavigationRandom = 0x08,
|
williamr@2
|
283 |
|
williamr@2
|
284 |
/** Blocks are returned from last to first */
|
williamr@2
|
285 |
ENavigationSequentialBackwards = 0x10
|
williamr@2
|
286 |
};
|
williamr@2
|
287 |
|
williamr@2
|
288 |
/**
|
williamr@2
|
289 |
Constructor.
|
williamr@2
|
290 |
*/
|
williamr@2
|
291 |
IMPORT_C TDecodeStreamCaps();
|
williamr@2
|
292 |
|
williamr@2
|
293 |
/**
|
williamr@2
|
294 |
Constructor.
|
williamr@2
|
295 |
|
williamr@2
|
296 |
@param aMaxBlocksPerRequest Maximum number of blocks that can be returned from the stream to client in a
|
williamr@2
|
297 |
single request.
|
williamr@2
|
298 |
@param aMinBlockSizeInPixels Minimum size in pixels of a block returned from the stream to the client in
|
williamr@2
|
299 |
a single request.
|
williamr@2
|
300 |
@param aOptimalBlocksPerRequest Optimum number of blocks returned from the stream to the client in
|
williamr@2
|
301 |
a single request to get maximum performance benefit.
|
williamr@2
|
302 |
@param aStreamSizeInBlocks Number of blocks of size MinBlockSizeInPixels() in the stream.
|
williamr@2
|
303 |
@param aNavigation Navigation capabilities.
|
williamr@2
|
304 |
*/
|
williamr@2
|
305 |
IMPORT_C TDecodeStreamCaps(TInt aMaxBlocksPerRequest, const TSize& aMinBlockSizeInPixels,
|
williamr@2
|
306 |
TInt aOptimalBlocksPerRequest, TInt aStreamSizeInBlocks,
|
williamr@2
|
307 |
TDecodeStreamCaps::TNavigation aNavigation);
|
williamr@2
|
308 |
|
williamr@2
|
309 |
/**
|
williamr@2
|
310 |
The maximum number of blocks that can be returned from the stream to client in a
|
williamr@2
|
311 |
single request.
|
williamr@2
|
312 |
|
williamr@2
|
313 |
@return Maximum number of blocks that can be returned from the stream to client in a
|
williamr@2
|
314 |
single request.
|
williamr@2
|
315 |
*/
|
williamr@2
|
316 |
IMPORT_C TInt MaxBlocksPerRequest() const;
|
williamr@2
|
317 |
|
williamr@2
|
318 |
/**
|
williamr@2
|
319 |
The Minimum size in pixels of a block returned from the stream to the client in
|
williamr@2
|
320 |
a single request.
|
williamr@2
|
321 |
|
williamr@2
|
322 |
@return Minimum size in pixels of a block returned from the stream to the client in
|
williamr@2
|
323 |
a single request. Sequence numbers and StreamSizeInBlocks() refer to this size of block.
|
williamr@2
|
324 |
*/
|
williamr@2
|
325 |
IMPORT_C const TSize& MinBlockSizeInPixels() const;
|
williamr@2
|
326 |
|
williamr@2
|
327 |
/**
|
williamr@2
|
328 |
Optimum number of blocks returned from the stream to the client in
|
williamr@2
|
329 |
a single request to get maximum performance benefit.
|
williamr@2
|
330 |
|
williamr@2
|
331 |
@return Optimum number of blocks returned from the stream to the client in
|
williamr@2
|
332 |
a single request to get maximum performance benefit.
|
williamr@2
|
333 |
This can be used to determine the optimum value of the number of blocks of min block size per request.
|
williamr@2
|
334 |
*/
|
williamr@2
|
335 |
IMPORT_C TInt OptimalBlocksPerRequest() const;
|
williamr@2
|
336 |
|
williamr@2
|
337 |
/**
|
williamr@2
|
338 |
Number of blocks of size MinBlockSizeInPixels() in the stream.
|
williamr@2
|
339 |
|
williamr@2
|
340 |
@return Number of blocks of size MinBlockSizeInPixels() in the stream.
|
williamr@2
|
341 |
*/
|
williamr@2
|
342 |
IMPORT_C TInt StreamSizeInBlocks() const;
|
williamr@2
|
343 |
|
williamr@2
|
344 |
/**
|
williamr@2
|
345 |
Navigation capabilities.
|
williamr@2
|
346 |
|
williamr@2
|
347 |
@return Navigation capabilities.
|
williamr@2
|
348 |
|
williamr@2
|
349 |
Full random access to the stream if Navigation() returns
|
williamr@2
|
350 |
ENavigationSequentialForward | ENavigationRandomForward | ENavigationRandomBackwards
|
williamr@2
|
351 |
*/
|
williamr@2
|
352 |
IMPORT_C TDecodeStreamCaps::TNavigation Navigation() const;
|
williamr@2
|
353 |
|
williamr@2
|
354 |
/**
|
williamr@2
|
355 |
Compatibility - internal use only
|
williamr@2
|
356 |
@internalComponent
|
williamr@2
|
357 |
*/
|
williamr@2
|
358 |
IMPORT_C TUint Size() const;
|
williamr@2
|
359 |
|
williamr@2
|
360 |
/**
|
williamr@2
|
361 |
Compatibility - internal use only
|
williamr@2
|
362 |
@internalComponent
|
williamr@2
|
363 |
*/
|
williamr@2
|
364 |
IMPORT_C TUint Version() const;
|
williamr@2
|
365 |
|
williamr@2
|
366 |
private:
|
williamr@2
|
367 |
TInt iMaxBlocksPerRequest;
|
williamr@2
|
368 |
TSize iMinBlockSizeInPixels;
|
williamr@2
|
369 |
TInt iOptimalBlocksPerRequest;
|
williamr@2
|
370 |
TInt iStreamSizeInBlocks;
|
williamr@2
|
371 |
TNavigation iNavigation;
|
williamr@2
|
372 |
TUint iSizeVersion; // bits 31 to 8 size, 7 to 0 contain version
|
williamr@2
|
373 |
TInt iReserved; // future proof
|
williamr@2
|
374 |
};
|
williamr@2
|
375 |
|
williamr@2
|
376 |
/**
|
williamr@2
|
377 |
'Block' streaming extension for Image Conversion Library decoder.
|
williamr@2
|
378 |
*/
|
williamr@2
|
379 |
class TImageConvStreamedDecode
|
williamr@2
|
380 |
{
|
williamr@2
|
381 |
friend class CImageDecoder;
|
williamr@2
|
382 |
|
williamr@2
|
383 |
public:
|
williamr@2
|
384 |
/**
|
williamr@2
|
385 |
Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
|
williamr@2
|
386 |
for a list of format uids.
|
williamr@2
|
387 |
@param aFormats Returns an array of format uids
|
williamr@2
|
388 |
@param aOptimalFormat The 'best' uid to use.
|
williamr@2
|
389 |
*/
|
williamr@2
|
390 |
IMPORT_C void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const;
|
williamr@2
|
391 |
|
williamr@2
|
392 |
/**
|
williamr@2
|
393 |
Returns the capabilities of the codec plugin for a specific format and for a specific frame.
|
williamr@2
|
394 |
@param aFormat The format.
|
williamr@2
|
395 |
@param aFrameNumber frame to stream
|
williamr@2
|
396 |
@param aCaps The capabilities for the format given.
|
williamr@2
|
397 |
*/
|
williamr@2
|
398 |
IMPORT_C void GetCapabilities(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps& aCaps) const;
|
williamr@2
|
399 |
|
williamr@2
|
400 |
/**
|
williamr@2
|
401 |
Get the size of the memory buffer to hold the returned data.
|
williamr@2
|
402 |
|
williamr@2
|
403 |
@param aFormat the required format
|
williamr@2
|
404 |
@param aBlockSizeInPixels returns the size in pixels of the block returned from the stream when aNumBlocks of minimum block size are requested.
|
williamr@2
|
405 |
@param aNumBlocks the number of blocks of size TDecodeStreamCaps::MinBlockSizeInPixels() to be returned by one request
|
williamr@2
|
406 |
|
williamr@2
|
407 |
@return The memory buffer size in bytes to hold the requested blocks. System wide error if for example
|
williamr@2
|
408 |
the format is not supported.
|
williamr@2
|
409 |
*/
|
williamr@2
|
410 |
IMPORT_C TInt GetBufferSize(TUid aFormat, TSize& aBlockSizeInPixels, TInt aNumBlocks) const;
|
williamr@2
|
411 |
|
williamr@2
|
412 |
|
williamr@2
|
413 |
/**
|
williamr@2
|
414 |
Initialise the stream.
|
williamr@2
|
415 |
|
williamr@2
|
416 |
@param aFormat the format to use
|
williamr@2
|
417 |
@param aFrameNumber frame to stream
|
williamr@2
|
418 |
@param aNavigation indication to stream of the way that the stream will be navigated. Allows
|
williamr@2
|
419 |
codec to optimise it's behaviour.
|
williamr@2
|
420 |
@leave System wide error if for example the format is not supported.
|
williamr@2
|
421 |
|
williamr@2
|
422 |
@note must call InitFrameL before GetBlocks or GetNextBlocks. Failure to do so completes request with
|
williamr@2
|
423 |
KErrNotReady
|
williamr@2
|
424 |
*/
|
williamr@2
|
425 |
IMPORT_C void InitFrameL(TUid aFormat, TInt aFrameNumber, TDecodeStreamCaps::TNavigation aNavigation);
|
williamr@2
|
426 |
|
williamr@2
|
427 |
/**
|
williamr@2
|
428 |
Start asynchronous call to return random blocks from the stream
|
williamr@2
|
429 |
|
williamr@2
|
430 |
@param aStatus request status
|
williamr@2
|
431 |
@param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of
|
williamr@2
|
432 |
pixel data. This can be 'uninitialised' or given specific format which must match that
|
williamr@2
|
433 |
specified in the InitFrameL call.
|
williamr@2
|
434 |
@param aSeqPosition block number starting at top left 0 ... TDecodeStreamCaps::StreamSizeInBlocks()
|
williamr@2
|
435 |
@param aNumBlocksToGet number of blocks requested
|
williamr@2
|
436 |
@param aNumBlocksRead number of blocks which will be returned when the request completes
|
williamr@2
|
437 |
|
williamr@2
|
438 |
@note use CImageDecoder::Cancel() to cancel this request.
|
williamr@2
|
439 |
*/
|
williamr@2
|
440 |
IMPORT_C void GetBlocks(TRequestStatus& aStatus, CImageFrame& aFrame, TInt aSeqPosition, TInt aNumBlocksToGet, TInt& aNumBlocksRead);
|
williamr@2
|
441 |
|
williamr@2
|
442 |
/**
|
williamr@2
|
443 |
Start asynchronous call to return blocks sequentially from the stream. Blocks are returned
|
williamr@2
|
444 |
from the first block until the last in the stream.
|
williamr@2
|
445 |
|
williamr@2
|
446 |
@param aStatus request status
|
williamr@2
|
447 |
@param aFrame An image frame wrapper a memory buffer to hold the returned block(s) of
|
williamr@2
|
448 |
pixel data. This can be 'uninitialised' or given specific format which must match that
|
williamr@2
|
449 |
specified in the InitFrameL call.
|
williamr@2
|
450 |
@param aNumBlocksToGet number of blocks requested
|
williamr@2
|
451 |
@param aNumBlocksRead number of blocks which will be returned when the request completes
|
williamr@2
|
452 |
|
williamr@2
|
453 |
@note use CImageDecoder::Cancel() to cancel this request.
|
williamr@2
|
454 |
*/
|
williamr@2
|
455 |
IMPORT_C void GetNextBlocks(TRequestStatus& aStatus, CImageFrame& aFrame, TInt aNumBlocksToGet, TInt& aNumBlocksRead, TBool& aHaveMoreBlocks);
|
williamr@2
|
456 |
|
williamr@2
|
457 |
private:
|
williamr@2
|
458 |
IMPORT_C TImageConvStreamedDecode();
|
williamr@2
|
459 |
void SetExtension(MImageConvExtension* aExtension);
|
williamr@2
|
460 |
|
williamr@2
|
461 |
private:
|
williamr@2
|
462 |
MImageConvStreamedDecode* iExtension;
|
williamr@2
|
463 |
TInt iReserved; // future proof
|
williamr@2
|
464 |
};
|
williamr@2
|
465 |
|
williamr@2
|
466 |
/**
|
williamr@2
|
467 |
'Block' streaming extension for Image Conversion Library encoder.
|
williamr@2
|
468 |
*/
|
williamr@2
|
469 |
/**
|
williamr@2
|
470 |
'Block' streaming extension for Image Conversion Library encoder.
|
williamr@2
|
471 |
*/
|
williamr@2
|
472 |
class TEncodeStreamCaps
|
williamr@2
|
473 |
{
|
williamr@2
|
474 |
public:
|
williamr@2
|
475 |
/** Navigation possibilities within the stream.
|
williamr@2
|
476 |
*/
|
williamr@2
|
477 |
enum TNavigation
|
williamr@2
|
478 |
{
|
williamr@2
|
479 |
/** Blocks can be returned from first to last */
|
williamr@2
|
480 |
ENavigationSequentialForward = 0x01,
|
williamr@2
|
481 |
|
williamr@2
|
482 |
/** Blocks can be returned in a random order but moving only from first to last e.g. 1, 5, 18...*/
|
williamr@2
|
483 |
ENavigationRandomForward = 0x02,
|
williamr@2
|
484 |
|
williamr@2
|
485 |
/** Blocks can be returned in a random order but moving only from last to first e.g. 1, 5, 18...*/
|
williamr@2
|
486 |
ENavigationRandomBackwards = 0x04
|
williamr@2
|
487 |
};
|
williamr@2
|
488 |
|
williamr@2
|
489 |
/**
|
williamr@2
|
490 |
Constructor.
|
williamr@2
|
491 |
*/
|
williamr@2
|
492 |
IMPORT_C TEncodeStreamCaps();
|
williamr@2
|
493 |
|
williamr@2
|
494 |
/**
|
williamr@2
|
495 |
Constructor.
|
williamr@2
|
496 |
|
williamr@2
|
497 |
@param aMaxBlocksPerRequest Maximum number of blocks that can be sent from the stream to client in a
|
williamr@2
|
498 |
single request.
|
williamr@2
|
499 |
@param aMinBlockSizeInPixels Minimum size in pixels of a block sent to the stream from the client in
|
williamr@2
|
500 |
a single request.
|
williamr@2
|
501 |
@param aOptimalBlocksPerRequest Optimum number of blocks sent to the stream from the client in
|
williamr@2
|
502 |
a single request to get maximum performance benefit.
|
williamr@2
|
503 |
@param aNavigation Navigation capabilities.
|
williamr@2
|
504 |
*/
|
williamr@2
|
505 |
IMPORT_C TEncodeStreamCaps(TInt aMaxBlocksPerRequest, const TSize& aMinBlockSizeInPixels,
|
williamr@2
|
506 |
TInt aOptimalBlocksPerRequest,
|
williamr@2
|
507 |
TEncodeStreamCaps::TNavigation aNavigation);
|
williamr@2
|
508 |
/**
|
williamr@2
|
509 |
Maximum number of blocks that can be sent from the stream to client in a
|
williamr@2
|
510 |
single request.
|
williamr@2
|
511 |
|
williamr@2
|
512 |
@return Maximum number of blocks that can be sent from the stream to client in a
|
williamr@2
|
513 |
single request.
|
williamr@2
|
514 |
*/
|
williamr@2
|
515 |
IMPORT_C TInt MaxBlocksPerRequest() const;
|
williamr@2
|
516 |
|
williamr@2
|
517 |
/**
|
williamr@2
|
518 |
Minimum size in pixels of a block sent to the stream from the client in
|
williamr@2
|
519 |
a single request.
|
williamr@2
|
520 |
|
williamr@2
|
521 |
@return Minimum size in pixels of a block sent to the stream from the client in
|
williamr@2
|
522 |
a single request.
|
williamr@2
|
523 |
*/
|
williamr@2
|
524 |
IMPORT_C const TSize& MinBlockSizeInPixels() const;
|
williamr@2
|
525 |
|
williamr@2
|
526 |
/**
|
williamr@2
|
527 |
Optimum number of blocks sent to the stream from the client in
|
williamr@2
|
528 |
a single request to get maximum performance benefit.
|
williamr@2
|
529 |
|
williamr@2
|
530 |
@return Optimum number of blocks sent to the stream from the client in
|
williamr@2
|
531 |
a single request to get maximum performance benefit.
|
williamr@2
|
532 |
*/
|
williamr@2
|
533 |
IMPORT_C TInt OptimalBlocksPerRequest() const;
|
williamr@2
|
534 |
|
williamr@2
|
535 |
|
williamr@2
|
536 |
/**
|
williamr@2
|
537 |
Navigation capabilities.
|
williamr@2
|
538 |
|
williamr@2
|
539 |
@return navigation capabilities.
|
williamr@2
|
540 |
|
williamr@2
|
541 |
Full random access to the stream if Navigation() returns
|
williamr@2
|
542 |
ENavigationSequentialForward | ENavigationRandomForward |ENavigationRandomBackwards
|
williamr@2
|
543 |
*/
|
williamr@2
|
544 |
IMPORT_C TEncodeStreamCaps::TNavigation Navigation() const;
|
williamr@2
|
545 |
|
williamr@2
|
546 |
/**
|
williamr@2
|
547 |
Compatibility - internal use only
|
williamr@2
|
548 |
@internalComponent
|
williamr@2
|
549 |
*/
|
williamr@2
|
550 |
IMPORT_C TUint Size() const;
|
williamr@2
|
551 |
|
williamr@2
|
552 |
/**
|
williamr@2
|
553 |
Compatibility - internal use only
|
williamr@2
|
554 |
@internalComponent
|
williamr@2
|
555 |
*/
|
williamr@2
|
556 |
IMPORT_C TUint Version() const;
|
williamr@2
|
557 |
|
williamr@2
|
558 |
private:
|
williamr@2
|
559 |
TInt iMaxBlocksPerRequest;
|
williamr@2
|
560 |
TSize iMinBlockSizeInPixels;
|
williamr@2
|
561 |
TInt iOptimalBlocksPerRequest;
|
williamr@2
|
562 |
TNavigation iNavigation;
|
williamr@2
|
563 |
TUint iSizeVersion; // bits 31 to 8 size, 7 to 0 contain version
|
williamr@2
|
564 |
TInt iReserved; // future proof
|
williamr@2
|
565 |
};
|
williamr@2
|
566 |
|
williamr@2
|
567 |
class TImageConvStreamedEncode
|
williamr@2
|
568 |
{
|
williamr@2
|
569 |
friend class CImageEncoder;
|
williamr@2
|
570 |
|
williamr@2
|
571 |
public:
|
williamr@2
|
572 |
/**
|
williamr@2
|
573 |
Returns a list of supported formats and the optimal format to be used. @see imageframeconst.h
|
williamr@2
|
574 |
for a list of format uids.
|
williamr@2
|
575 |
@param aFormats Returns an array of format uids
|
williamr@2
|
576 |
@param aOptimalFormat The 'best' uid to use.
|
williamr@2
|
577 |
*/
|
williamr@2
|
578 |
IMPORT_C void GetSupportedFormatsL(RArray<TUid>& aFormats, TUid& aOptimalFormat) const;
|
williamr@2
|
579 |
|
williamr@2
|
580 |
/**
|
williamr@2
|
581 |
Returns the capabilities of the codec plugin for a specific format.
|
williamr@2
|
582 |
@param aFormat The format.
|
williamr@2
|
583 |
@param aCaps The capabilities for the format given.
|
williamr@2
|
584 |
*/
|
williamr@2
|
585 |
IMPORT_C void GetCapabilities(TUid aFormat, TEncodeStreamCaps& aCaps) const;
|
williamr@2
|
586 |
|
williamr@2
|
587 |
/**
|
williamr@2
|
588 |
Initialise the stream.
|
williamr@2
|
589 |
|
williamr@2
|
590 |
@param aFormat the format to use
|
williamr@2
|
591 |
@param aFrameNumber frame to stream
|
williamr@2
|
592 |
@param aFrameSizeInPixels Size of this frame in pixels
|
williamr@2
|
593 |
@param aBlockSizeInPixels Size of block to be added / appended.
|
williamr@2
|
594 |
@param aNavigation indication to stream of the way that the stream will be navigated. Allows
|
williamr@2
|
595 |
codec to optimise it's behaviour.
|
williamr@2
|
596 |
@param aFrameImageData The frame image data (optional pass NULL if not required).
|
williamr@2
|
597 |
There are format-specific image data variants that are used by encoders to obtain image specific
|
williamr@2
|
598 |
data. This behaviour is invoked by specifying aFrameImageData. Otherwise, encoder specific defaults
|
williamr@2
|
599 |
are invoked. @see TJpegImageData
|
williamr@2
|
600 |
|
williamr@2
|
601 |
@leave System wide error if for example the format is not supported.
|
williamr@2
|
602 |
|
williamr@2
|
603 |
@note must call InitFrameL before AppendBlocks or AddBlocks. Failure to do so completes request with
|
williamr@2
|
604 |
KErrNotReady
|
williamr@2
|
605 |
|
williamr@2
|
606 |
@note can either specify format through aFormat or aImageFrameData. Conflicts cause a leave with KErrArgument.
|
williamr@2
|
607 |
*/
|
williamr@2
|
608 |
IMPORT_C void InitFrameL(TUid aFormat, TInt aFrameNumber, const TSize& aFrameSizeInPixels, const TSize& aBlockSizeInPixels, TEncodeStreamCaps::TNavigation aNavigation, const CFrameImageData* aFrameImageData);
|
williamr@2
|
609 |
|
williamr@2
|
610 |
/**
|
williamr@2
|
611 |
Append blocks to the stream.
|
williamr@2
|
612 |
@param aStatus request status
|
williamr@2
|
613 |
@param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
|
williamr@2
|
614 |
@param aNumBlocksToAdd number of blocks of size TEncodeStreamCaps::MinBlockSizeInPixels to add to the stream
|
williamr@2
|
615 |
*/
|
williamr@2
|
616 |
IMPORT_C void AppendBlocks(TRequestStatus& aStatus, const CImageFrame& aBlocks, TInt aNumBlocksToAdd);
|
williamr@2
|
617 |
|
williamr@2
|
618 |
/**
|
williamr@2
|
619 |
Add blocks to the stream at a random position.
|
williamr@2
|
620 |
@param aStatus request status
|
williamr@2
|
621 |
@param aBlocks wraps a memory buffer containing the pixel data to be added to the stream
|
williamr@2
|
622 |
@param aSeqPosition position of block in stream starting at 0
|
williamr@2
|
623 |
*/
|
williamr@2
|
624 |
IMPORT_C void AddBlocks(TRequestStatus& aStatus, const CImageFrame& aBlocks, const TInt& aSeqPosition);
|
williamr@2
|
625 |
|
williamr@2
|
626 |
/**
|
williamr@2
|
627 |
Signal completion of writing the stream
|
williamr@2
|
628 |
@param aStatus request status
|
williamr@2
|
629 |
*/
|
williamr@2
|
630 |
IMPORT_C void Complete(TRequestStatus& aStatus);
|
williamr@2
|
631 |
|
williamr@2
|
632 |
private:
|
williamr@2
|
633 |
|
williamr@2
|
634 |
IMPORT_C TImageConvStreamedEncode();
|
williamr@2
|
635 |
void SetExtension(MImageConvExtension* aExtension);
|
williamr@2
|
636 |
|
williamr@2
|
637 |
MImageConvStreamedEncode* iExtension;
|
williamr@2
|
638 |
TInt iReserved; // future proof
|
williamr@2
|
639 |
};
|
williamr@2
|
640 |
|
williamr@2
|
641 |
#endif // IMAGECONVERSIONEXTENSION_H
|