williamr@2
|
1 |
// Copyright (c) 2001-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 ImageConversionPlugin_h
|
williamr@2
|
17 |
#define ImageConversionPlugin_h
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <icl/imagedata.h>
|
williamr@2
|
20 |
#include <icl/imagecodec.h>
|
williamr@2
|
21 |
#include <imageconversion.h>
|
williamr@2
|
22 |
#include <icl/imageconversionextension.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
class CImageDecoderPriv;
|
williamr@2
|
25 |
class CImageEncoderPriv;
|
williamr@2
|
26 |
class CImageReadCodec;
|
williamr@2
|
27 |
class CImageWriteCodec;
|
williamr@2
|
28 |
class TBufPtr8;
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
@publishedAll
|
williamr@2
|
32 |
@released
|
williamr@2
|
33 |
|
williamr@2
|
34 |
The PluginAPI for Image Converter Library decoder plugins.
|
williamr@2
|
35 |
|
williamr@2
|
36 |
Intended for use by plugin writers only.
|
williamr@2
|
37 |
*/
|
williamr@2
|
38 |
class CImageDecoderPlugin : public CBase
|
williamr@2
|
39 |
{
|
williamr@2
|
40 |
friend class CImageDecoderPriv;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
public:
|
williamr@2
|
43 |
IMPORT_C ~CImageDecoderPlugin();
|
williamr@2
|
44 |
|
williamr@2
|
45 |
IMPORT_C virtual TInt NumberOfImageComments() const;
|
williamr@2
|
46 |
IMPORT_C virtual HBufC* ImageCommentL(TInt aCommentNumber) const;
|
williamr@2
|
47 |
IMPORT_C virtual TInt NumberOfFrameComments(TInt aFrameNumber) const;
|
williamr@2
|
48 |
IMPORT_C virtual HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
Returns the image type and sub-type for a given frame of the image that
|
williamr@2
|
52 |
has just been opened.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
This is a virtual function that each individual plugin must implement.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
@param aFrameNumber
|
williamr@2
|
57 |
The frame index for type and sub-type information should be returned.
|
williamr@2
|
58 |
@param aImageType
|
williamr@2
|
59 |
On return contains the image type UID for the specified frame.
|
williamr@2
|
60 |
@param aImageSubType
|
williamr@2
|
61 |
On return contains the image sub-type UID for the specified frame. If the sub-type does
|
williamr@2
|
62 |
not exist KNullUid is returned.
|
williamr@2
|
63 |
*/
|
williamr@2
|
64 |
virtual void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const = 0;
|
williamr@2
|
65 |
|
williamr@2
|
66 |
protected:
|
williamr@2
|
67 |
IMPORT_C CImageDecoderPlugin();
|
williamr@2
|
68 |
IMPORT_C virtual void Cleanup();
|
williamr@2
|
69 |
IMPORT_C virtual void ReadFrameHeadersL();
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/**
|
williamr@2
|
72 |
Invokes the ReadFrameHeadersL() method of the supplied plugin.
|
williamr@2
|
73 |
|
williamr@2
|
74 |
The plugin's version of ReadFrameHeadersL() should read the image header information, create
|
williamr@2
|
75 |
the required codec and read the frame headers.
|
williamr@2
|
76 |
|
williamr@2
|
77 |
This is a virtual function that each individual plugin must implement.
|
williamr@2
|
78 |
*/
|
williamr@2
|
79 |
virtual void ScanDataL() = 0;
|
williamr@2
|
80 |
|
williamr@2
|
81 |
|
williamr@2
|
82 |
IMPORT_C virtual TInt FrameHeaderBlockSize(TInt aFrameNumber) const;
|
williamr@2
|
83 |
IMPORT_C virtual TInt FrameBlockSize(TInt aFrameNumber) const;
|
williamr@2
|
84 |
|
williamr@2
|
85 |
/**
|
williamr@2
|
86 |
Returns the codec specific frame information stored in resource files.
|
williamr@2
|
87 |
|
williamr@2
|
88 |
This is a virtual function that each individual plugin must implement.
|
williamr@2
|
89 |
|
williamr@2
|
90 |
@param aFs
|
williamr@2
|
91 |
A handle to a file server session.
|
williamr@2
|
92 |
@param aFrameNumber
|
williamr@2
|
93 |
The frame number to which the codec specific frame information
|
williamr@2
|
94 |
applies (optional, defaults to zero).
|
williamr@2
|
95 |
|
williamr@2
|
96 |
@return A pointer to a newly allocated CFrameInfoStrings object.
|
williamr@2
|
97 |
Ownership is transferred to the caller.
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
IMPORT_C virtual CFrameInfoStrings* FrameInfoStringsL(RFs& aFs, TInt aFrameNumber = 0) = 0;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
IMPORT_C void OpenExtraResourceFileLC(RFs& aFs, const TUid aUid, RResourceFile& aResourceFile) const;
|
williamr@2
|
102 |
IMPORT_C void ReadDataL(TInt aPosition, TPtrC8& aReadBuffer, TInt aLength);
|
williamr@2
|
103 |
IMPORT_C virtual void InitConvertL();
|
williamr@2
|
104 |
|
williamr@2
|
105 |
IMPORT_C void RequestInitL(TInt aFrameNumber);
|
williamr@2
|
106 |
|
williamr@2
|
107 |
IMPORT_C virtual void DoConvert();
|
williamr@2
|
108 |
IMPORT_C void PrepareForProcessFrameL();
|
williamr@2
|
109 |
IMPORT_C void HandleProcessFrameResult(TInt aErrCode, TFrameState aCodecState);
|
williamr@2
|
110 |
IMPORT_C TBufPtr8& SourceData();
|
williamr@2
|
111 |
|
williamr@2
|
112 |
IMPORT_C void RequestComplete(TInt aReason);
|
williamr@2
|
113 |
IMPORT_C void SelfComplete(TInt aReason);
|
williamr@2
|
114 |
IMPORT_C void SetSelfPending();
|
williamr@2
|
115 |
|
williamr@2
|
116 |
IMPORT_C TBool IsImageHeaderProcessingComplete() const;
|
williamr@2
|
117 |
|
williamr@2
|
118 |
IMPORT_C CImageReadCodec* ImageReadCodec() const;
|
williamr@2
|
119 |
IMPORT_C void SetImageReadCodec(CImageReadCodec* aImageReadCodec);
|
williamr@2
|
120 |
|
williamr@2
|
121 |
IMPORT_C const TFrameInfo& ImageInfo() const;
|
williamr@2
|
122 |
IMPORT_C void SetImageInfo(const TFrameInfo& aImageInfo);
|
williamr@2
|
123 |
|
williamr@2
|
124 |
IMPORT_C TInt NumberOfFrames() const;
|
williamr@2
|
125 |
|
williamr@2
|
126 |
IMPORT_C const TImageDataBlock* ImageData(TInt aIndex) const;
|
williamr@2
|
127 |
IMPORT_C TInt InsertImageData(const TImageDataBlock* aEntry, TInt aPos);
|
williamr@2
|
128 |
IMPORT_C TInt AppendImageData(const TImageDataBlock* aEntry);
|
williamr@2
|
129 |
IMPORT_C void RemoveImageData(TInt aPos);
|
williamr@2
|
130 |
IMPORT_C TInt ImageDataCount() const;
|
williamr@2
|
131 |
IMPORT_C TInt AppendImageDataBuffer(const HBufC8* aImageBuffer);
|
williamr@2
|
132 |
|
williamr@2
|
133 |
IMPORT_C TInt DataLength() const;
|
williamr@2
|
134 |
IMPORT_C void SetDataLength(TInt aDataLength);
|
williamr@2
|
135 |
IMPORT_C TInt Position() const;
|
williamr@2
|
136 |
IMPORT_C void SetPosition(const TInt aPosition);
|
williamr@2
|
137 |
IMPORT_C TInt StartPosition() const;
|
williamr@2
|
138 |
IMPORT_C void SetStartPosition(TInt aDataLength);
|
williamr@2
|
139 |
|
williamr@2
|
140 |
IMPORT_C const CFbsBitmap& Destination() const;
|
williamr@2
|
141 |
IMPORT_C TBool ValidDestination() const;
|
williamr@2
|
142 |
IMPORT_C const CFbsBitmap& DestinationMask() const;
|
williamr@2
|
143 |
IMPORT_C TBool ValidDestinationMask() const;
|
williamr@2
|
144 |
|
williamr@2
|
145 |
IMPORT_C const TFrameInfo& FrameInfo(TInt aFrameNumber = 0) const;
|
williamr@2
|
146 |
IMPORT_C const CFrameImageData& FrameData(TInt aFrameNumber = 0) const;
|
williamr@2
|
147 |
|
williamr@2
|
148 |
IMPORT_C TInt SourceLength() const;
|
williamr@2
|
149 |
|
williamr@2
|
150 |
IMPORT_C virtual void HandleCustomSyncL(TInt aParam);
|
williamr@2
|
151 |
IMPORT_C virtual void InitCustomAsyncL(TInt aParam);
|
williamr@2
|
152 |
IMPORT_C virtual void NotifyComplete();
|
williamr@2
|
153 |
IMPORT_C TBool AmInThread() const;
|
williamr@2
|
154 |
IMPORT_C TBool ShouldAbort() const;
|
williamr@2
|
155 |
IMPORT_C void SetThumbnailData(HBufC8* aThumbnailData);
|
williamr@2
|
156 |
|
williamr@2
|
157 |
IMPORT_C CImageDecoder::TOptions DecoderOptions() const;
|
williamr@2
|
158 |
|
williamr@2
|
159 |
private:
|
williamr@2
|
160 |
TBool ValidProperties() const;
|
williamr@2
|
161 |
|
williamr@2
|
162 |
IMPORT_C virtual void EnableMaskGeneration();
|
williamr@2
|
163 |
IMPORT_C virtual void NotifyImageTypeChangeL(TInt aImageType);
|
williamr@2
|
164 |
|
williamr@2
|
165 |
// Future proofing
|
williamr@2
|
166 |
IMPORT_C virtual void ReservedVirtual1();
|
williamr@2
|
167 |
|
williamr@2
|
168 |
public:
|
williamr@2
|
169 |
/**
|
williamr@2
|
170 |
@publishedAll
|
williamr@2
|
171 |
@released
|
williamr@4
|
172 |
|
williamr@2
|
173 |
Called by the framework to obtain a pointer to a codec implemented extension.
|
williamr@2
|
174 |
|
williamr@2
|
175 |
@param aExtUid Extension UID normally prefixed KUidImageConv. @see icl_uids.hrh .
|
williamr@2
|
176 |
@param aExtPtr Returns a ptr to the extension implemented by the codec plugin.
|
williamr@2
|
177 |
*/
|
williamr@2
|
178 |
IMPORT_C virtual void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr);
|
williamr@2
|
179 |
/**
|
williamr@2
|
180 |
@publishedAll
|
williamr@2
|
181 |
@released
|
williamr@4
|
182 |
|
williamr@2
|
183 |
Called by the framework on the plugin to apply a clipping rectangle to the image.
|
williamr@2
|
184 |
|
williamr@2
|
185 |
Sets the area of interest of the image to be decoded.
|
williamr@2
|
186 |
|
williamr@2
|
187 |
@param aClipRect A pointer to a TRect that specifies the
|
williamr@2
|
188 |
location and size of the region to be decoded. This
|
williamr@2
|
189 |
rectangle must have positive width and height values as
|
williamr@2
|
190 |
per TRect::IsNormalized() and TRect::Normalize().
|
williamr@2
|
191 |
Passing in a NULL value will clear the clipping rectangle.
|
williamr@2
|
192 |
Note that a clipping rectangle may not be valid for all frames of an image.
|
williamr@2
|
193 |
|
williamr@2
|
194 |
@leave KErrNotSupported if clipping is not supported by the codec plugin.
|
williamr@2
|
195 |
@leave Other system-wide error codes.
|
williamr@2
|
196 |
*/
|
williamr@2
|
197 |
IMPORT_C virtual void SetClippingRectL(const TRect* aClipRect);
|
williamr@2
|
198 |
/**
|
williamr@2
|
199 |
@publishedAll
|
williamr@2
|
200 |
@released
|
williamr@4
|
201 |
|
williamr@2
|
202 |
Called by framework on plugin to get the size of decoded image.
|
williamr@2
|
203 |
|
williamr@2
|
204 |
Get the size of the decoded image for the given frame. The calculation will account for any clipping rectangle set,
|
williamr@2
|
205 |
scaling applied through the TImageConvScaler extension and any operation applied through TImageConvOperation.
|
williamr@2
|
206 |
If TImageConvScaler::SetScalingL(.. has been called then the size of the bitmap passed to CImageDecoder::Convert must match the size returned from
|
williamr@2
|
207 |
this function.
|
williamr@2
|
208 |
|
williamr@2
|
209 |
@param aSize
|
williamr@2
|
210 |
Returns the size of the decoded image.
|
williamr@2
|
211 |
@param aFrameNumber
|
williamr@2
|
212 |
The frame number.
|
williamr@2
|
213 |
|
williamr@2
|
214 |
@return KErrArgument if an error in calculation is detected e.g. if clipping rectangle is outside of the overall frame boundary.
|
williamr@2
|
215 |
@return Other system wide errors.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C virtual TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber = 0);
|
williamr@2
|
218 |
|
williamr@2
|
219 |
private:
|
williamr@2
|
220 |
CImageDecoderPriv* iProperties; // not owned
|
williamr@2
|
221 |
|
williamr@2
|
222 |
friend class RCImageDecoderPrivTestBase;
|
williamr@2
|
223 |
};
|
williamr@2
|
224 |
|
williamr@2
|
225 |
/**
|
williamr@2
|
226 |
@publishedAll
|
williamr@2
|
227 |
@released
|
williamr@2
|
228 |
|
williamr@2
|
229 |
The plugin API for Image Converter Library encoder plugins.
|
williamr@2
|
230 |
|
williamr@2
|
231 |
Intended for use by plugin writers only.
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
class CImageEncoderPlugin : public CBase
|
williamr@2
|
234 |
{
|
williamr@2
|
235 |
friend class CImageEncoderPriv;
|
williamr@2
|
236 |
|
williamr@2
|
237 |
public:
|
williamr@2
|
238 |
IMPORT_C ~CImageEncoderPlugin();
|
williamr@2
|
239 |
|
williamr@2
|
240 |
protected:
|
williamr@2
|
241 |
IMPORT_C CImageEncoderPlugin();
|
williamr@2
|
242 |
IMPORT_C virtual void Cleanup();
|
williamr@2
|
243 |
IMPORT_C virtual void InitConvertL();
|
williamr@2
|
244 |
IMPORT_C void RequestInitL();
|
williamr@2
|
245 |
IMPORT_C virtual void DoConvert();
|
williamr@2
|
246 |
IMPORT_C void HandleProcessFrameResult(TInt aErrCode, TFrameState aCodecState);
|
williamr@2
|
247 |
IMPORT_C TBufPtr8& DestinationData();
|
williamr@2
|
248 |
IMPORT_C void FinishConvertL();
|
williamr@2
|
249 |
IMPORT_C void WriteDataL(TInt aPosition,const TDesC8& aDes);
|
williamr@2
|
250 |
IMPORT_C void WriteDataPositionIncL(TInt aPosition,const TDesC8& aDes);
|
williamr@2
|
251 |
IMPORT_C const CFbsBitmap& Source() const;
|
williamr@2
|
252 |
IMPORT_C TBool ValidSource() const;
|
williamr@2
|
253 |
|
williamr@2
|
254 |
IMPORT_C CImageWriteCodec* ImageWriteCodec() const;
|
williamr@2
|
255 |
IMPORT_C void SetImageWriteCodec(CImageWriteCodec* aImageWriteCodec) const;
|
williamr@2
|
256 |
IMPORT_C TInt& StartPosition() const;
|
williamr@2
|
257 |
IMPORT_C TInt& Position() const;
|
williamr@2
|
258 |
IMPORT_C const TSize& FrameInfoOverallSizeInPixels() const;
|
williamr@2
|
259 |
|
williamr@2
|
260 |
/**
|
williamr@2
|
261 |
Allocates the specific codec used for the encoding and passes
|
williamr@2
|
262 |
ownership to the plugin.
|
williamr@2
|
263 |
|
williamr@2
|
264 |
This is a pure virtual function that each individual plugin must implement.
|
williamr@2
|
265 |
|
williamr@2
|
266 |
@param aFrameImageData
|
williamr@2
|
267 |
The parameters which can be passed on to the encoding algorithm.
|
williamr@2
|
268 |
This data might be used to determine the exact codec created.
|
williamr@2
|
269 |
|
williamr@2
|
270 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
271 |
another of the system-wide error codes.
|
williamr@2
|
272 |
*/
|
williamr@2
|
273 |
virtual void PrepareEncoderL(const CFrameImageData* aFrameImageData) = 0;
|
williamr@2
|
274 |
|
williamr@2
|
275 |
/**
|
williamr@2
|
276 |
May be used to fill in additional fields at the end of the encoding
|
williamr@2
|
277 |
process, which it may not have been possible to do earlier.
|
williamr@2
|
278 |
|
williamr@2
|
279 |
This is a pure virtual function that each individual plugin must implement.
|
williamr@2
|
280 |
*/
|
williamr@2
|
281 |
virtual void UpdateHeaderL() = 0;
|
williamr@2
|
282 |
|
williamr@2
|
283 |
IMPORT_C TInt CurrentImageSizeL() const;
|
williamr@2
|
284 |
|
williamr@2
|
285 |
IMPORT_C void RequestComplete(TInt aReason);
|
williamr@2
|
286 |
IMPORT_C void SelfComplete(TInt aReason);
|
williamr@2
|
287 |
IMPORT_C void SetSelfPending();
|
williamr@2
|
288 |
|
williamr@2
|
289 |
IMPORT_C virtual void HandleCustomSyncL(TInt aParam);
|
williamr@2
|
290 |
IMPORT_C virtual void InitCustomAsyncL(TInt aParam);
|
williamr@2
|
291 |
IMPORT_C virtual void NotifyComplete();
|
williamr@2
|
292 |
IMPORT_C TBool AmInThread() const;
|
williamr@2
|
293 |
IMPORT_C TBool ShouldAbort() const;
|
williamr@2
|
294 |
|
williamr@2
|
295 |
IMPORT_C CImageEncoder::TOptions EncoderOptions() const;
|
williamr@2
|
296 |
|
williamr@2
|
297 |
private:
|
williamr@2
|
298 |
TBool ValidProperties() const;
|
williamr@2
|
299 |
|
williamr@2
|
300 |
IMPORT_C virtual void WriteThumbnailL();
|
williamr@2
|
301 |
|
williamr@2
|
302 |
/**
|
williamr@2
|
303 |
Originally only used by the jpeg codec, but now in use as a generic pre-convert async step
|
williamr@2
|
304 |
*/
|
williamr@2
|
305 |
IMPORT_C virtual void WriteExifDataL(TRequestStatus*& aScaleCompletionStatus);
|
williamr@2
|
306 |
|
williamr@2
|
307 |
IMPORT_C virtual void SetThumbnail(TBool aDoGenerateThumbnail);
|
williamr@2
|
308 |
IMPORT_C virtual void ReservedVirtual1();
|
williamr@2
|
309 |
IMPORT_C virtual void ReservedVirtual2();
|
williamr@2
|
310 |
IMPORT_C virtual void ReservedVirtual3();
|
williamr@2
|
311 |
|
williamr@2
|
312 |
public:
|
williamr@2
|
313 |
/**
|
williamr@2
|
314 |
@publishedAll
|
williamr@2
|
315 |
@released
|
williamr@4
|
316 |
|
williamr@2
|
317 |
Called by the framework to obtain a pointer to a codec implemented extension.
|
williamr@2
|
318 |
|
williamr@2
|
319 |
@param aExtUid Extension UID normally prefixed KUidImageConv. @see icl_uids.hrh .
|
williamr@2
|
320 |
@param aExtPtr. Returns a ptr to the extension implemented by the codec plugin.
|
williamr@2
|
321 |
*/
|
williamr@2
|
322 |
IMPORT_C virtual void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr);
|
williamr@2
|
323 |
|
williamr@2
|
324 |
private:
|
williamr@2
|
325 |
CImageEncoderPriv* iProperties; // not owned
|
williamr@2
|
326 |
};
|
williamr@2
|
327 |
|
williamr@2
|
328 |
|
williamr@2
|
329 |
#endif //ImageConversionPlugin_h
|
williamr@4
|
330 |
|