|
1 // Copyright (c) 2004-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This is the public client API for EXIF-enabled ICL modules |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CEXIFICL_H__ |
|
19 #define __CEXIFICL_H__ |
|
20 |
|
21 |
|
22 #include <imageconversion.h> |
|
23 #include <icl/imagetransformpluginext.h> |
|
24 #include <icl/imageplugin.h> |
|
25 |
|
26 /** |
|
27 @publishedAll |
|
28 @released |
|
29 |
|
30 IFD number representing Exif IFD 0. |
|
31 |
|
32 For use in MExifMetadata methods when reading or writing IFD 0 tags other than GPS tags. |
|
33 In other words, for reading or writing any of the following tags: |
|
34 - IFD 0 TIFF tags (i.e. IFD 0 tags) |
|
35 - IFD 0 Exif tags (i.e. Exif sub-IFD tags) |
|
36 - Interoperability IFD tags |
|
37 |
|
38 Note: To read or write GPS tags, use the IFD constant KExifGpsIfd instead. |
|
39 */ |
|
40 const TUint KExifIfdZero = 0; |
|
41 |
|
42 /** |
|
43 @publishedAll |
|
44 @released |
|
45 |
|
46 IFD number representing Exif IFD 1. |
|
47 |
|
48 For use in MExifMetadata methods when reading or writing tags related to thumbnail (i.e. IFD 1 tags). |
|
49 */ |
|
50 const TUint KExifIfdOne = 1; |
|
51 |
|
52 /** |
|
53 @publishedAll |
|
54 @released |
|
55 |
|
56 IFD number representing the IFD 0 sub-IFD for GPS (i.e. the GPS IFD). |
|
57 |
|
58 For use in MExifMetadata methods when reading or writing GPS tags. |
|
59 */ |
|
60 const TUint KExifGpsIfd = 0x00040000; |
|
61 |
|
62 /** |
|
63 @publishedAll |
|
64 @released |
|
65 |
|
66 describes a rational value |
|
67 */ |
|
68 struct TRational |
|
69 { |
|
70 /** numerator of the rational |
|
71 */ |
|
72 union |
|
73 { |
|
74 TInt iNumerator; |
|
75 TUint iUNumerator; |
|
76 }; |
|
77 /** denominator of the rational. No checking is processed to know if this is null or not |
|
78 */ |
|
79 union |
|
80 { |
|
81 TInt iDenominator; |
|
82 TUint iUDenominator; |
|
83 }; |
|
84 }; |
|
85 |
|
86 |
|
87 /** |
|
88 @publishedAll |
|
89 @released |
|
90 |
|
91 generic accessor to read the tags from exif metadata. |
|
92 |
|
93 Note: The aIfd argument in MExifMetadataReader methods should be set as follows: |
|
94 - When reading an IFD 0 tag that is not a GPS tag, use KExifIfdZero. |
|
95 - When reading a tag related to thumbnail, use KExifIfdOne. |
|
96 - When reading a GPS tag, use KExifGpsIfd. |
|
97 |
|
98 The TExifReaderUtility class offers a friendlier interface to access these tags. |
|
99 |
|
100 @see TExifReaderUtility |
|
101 */ |
|
102 class MExifMetadataReader |
|
103 { |
|
104 public: |
|
105 /** |
|
106 Get the data associated with a signed or unsigned 32-bit integer EXIF/DCF tag/IFD. |
|
107 If used to get unsigned data, it is up to the caller to do the appropriate typecast of aParam. |
|
108 |
|
109 @param aTag |
|
110 the tag id where the data is stored |
|
111 @param aIfd |
|
112 the ifd section in which the tag is stored. |
|
113 @param aParam |
|
114 on return, the value of the tag |
|
115 |
|
116 @return error code |
|
117 KErrArgument if the requested data type does not match with the tag. |
|
118 KErrNotSupported if called on an encoding module. |
|
119 KErrNotFound if the tag cannot be found. |
|
120 */ |
|
121 virtual TInt GetIntegerParam(TUint aTag, TUint aIfd, TInt& aParam) const = 0; |
|
122 |
|
123 /** |
|
124 Get the data associated with an unsigned short (16-bit) integer EXIF/DCF tag/IFD. |
|
125 |
|
126 @param aTag |
|
127 the tag id where the data is stored |
|
128 @param aIfd |
|
129 the ifd section in which the tag is stored. |
|
130 @param aParam |
|
131 on return, the value of the tag |
|
132 |
|
133 @return error code |
|
134 KErrArgument if the requested data type does not match with the tag. |
|
135 KErrNotSupported if called on an encoding module. |
|
136 KErrNotFound if the tag cannot be found. |
|
137 */ |
|
138 virtual TInt GetShortParam(TUint aTag, TUint aIfd, TUint16& aParam) const = 0; |
|
139 |
|
140 /** |
|
141 Get the data associated with a signed or unsigned rational EXIF/DCF tag/IFD. |
|
142 If used to get an unsigned rational, it is up to the caller to typecast aNumer & aDenom as appropriate. |
|
143 |
|
144 @param aTag |
|
145 the tag id where the data is stored |
|
146 @param aIfd |
|
147 the ifd section in which the tag is stored. |
|
148 @param aNumer |
|
149 on return, the numerator value of the tag |
|
150 @param aDenom |
|
151 on return, the denominator value of the tag |
|
152 |
|
153 @return error code |
|
154 KErrArgument if the requested data type does not match with the tag. |
|
155 KErrNotSupported if called on an encoding module. |
|
156 KErrNotFound if the tag cannot be found. |
|
157 */ |
|
158 virtual TInt GetRationalParam(TUint aTag, TUint aIfd, TInt& aNumer, TInt& aDenom) const = 0; |
|
159 /** |
|
160 Get the data associated with an 8-bit (e.g. ASCII, Undefined or Byte) EXIF/DCF tag/IFD. |
|
161 |
|
162 Ownership of the buffer pointed to by aParam transfers to the client, which is therefore responsible for deleting the buffer when required. |
|
163 |
|
164 Note: The client should always initialise aParam to NULL, and the plugin should only assign to this parameter when ready to transfer ownership. |
|
165 |
|
166 Note: If using this method to retrieve ASCII data, the returned data will not be NULL terminated. |
|
167 |
|
168 Note: If using this method to retrieve Undefined data, the raw data will be returned, exactly as it appears in the tag value. Thus if the tag |
|
169 is one that includes a character code prefix, then this prefix will be included in the returned data. See table 6 of the Exif 2.2 specification for a list of character code prefixes. |
|
170 |
|
171 @param aTag |
|
172 the tag id where the data is stored |
|
173 @param aIfd |
|
174 the ifd section in which the tag is stored. |
|
175 @param aParam |
|
176 on return, the value of the tag |
|
177 |
|
178 @return error code |
|
179 KErrArgument if the requested data type does not match with the tag. |
|
180 KErrNotSupported if called on an encoding module. |
|
181 KErrNotFound if the tag cannot be found. |
|
182 */ |
|
183 virtual TInt GetParam8(TUint aTag, TUint aIfd, HBufC8*& aParam) const = 0; |
|
184 |
|
185 /** |
|
186 Get the data associated with a 16-bit EXIF/DCF tag/IFD. |
|
187 |
|
188 Ownership of the buffer pointed to by aParam transfers to the client, which is therefore responsible for deleting the buffer when required. |
|
189 |
|
190 Note: The client should always initialise aParam to NULL, and the plugin should only assign to this parameter when ready to transfer ownership. |
|
191 |
|
192 Note: This method is not recommended. To get 16-bit data from a tag of undefined type, it is recommended that GetParam8() be used instead. The HBufC8* returned by GetParam8() can then be converted into an HBufC16* as needed. |
|
193 |
|
194 If this method is used, please be aware of the following: |
|
195 - It may only be used with the tags 0x9286 (UserComment), 0x001B (GpsProcessingMethod) & 0x001C (GpsAreaInformation). |
|
196 - The supported tags might not contain 16-bit data. Only use this method if you are certain that the tag contain 16-bit data. If used on a tag containing 8-bit data, the 8-bit |
|
197 data will be returned in the HBufC16* which will have to be manually converted to an HBufC8*. |
|
198 - The first 8 bytes of the returned HBufC16* may contain a Character Code prefix. See table 6 of the Exif 2.2 specification for a list of Character Code prefixes. |
|
199 - The length of the returned HBufC16* will include the length of the character code prefix if present. |
|
200 |
|
201 @param aTag |
|
202 the tag id where the data is stored |
|
203 @param aIfd |
|
204 the ifd section in which the tag is stored. |
|
205 @param aParam |
|
206 on return, the value of the tag |
|
207 |
|
208 @return error code |
|
209 KErrArgument if the requested data type does not match with the tag. |
|
210 KErrNotSupported if called on an encoding module. |
|
211 KErrNotFound if the tag cannot be found. |
|
212 */ |
|
213 virtual TInt GetParam16(TUint aTag, TUint aIfd, HBufC16*& aParam) const = 0; |
|
214 |
|
215 /** |
|
216 Get the data associated with an array of signed or unsigned 32-bit integers EXIF/DCF tag/IFD. |
|
217 If being used to get unsigned integers, it is up to the caller to typecast them as appropriate. |
|
218 |
|
219 @param aTag |
|
220 the tag id where the data is stored |
|
221 @param aIfd |
|
222 the ifd section in which the tag is stored. |
|
223 @param aParam |
|
224 on return, the array is filled with the list of values in this tag |
|
225 |
|
226 Note: aParam will be resized to fit the number of data elements read. |
|
227 |
|
228 @return error code |
|
229 KErrArgument if the requested data type does not match with the tag. |
|
230 KErrNotSupported if called on an encoding module. |
|
231 KErrNotFound if the tag cannot be found. |
|
232 */ |
|
233 virtual TInt GetIntegerArrayParam(TUint aTag, TUint aIfd, CArrayFix<TInt>& aParam) const = 0; |
|
234 |
|
235 /** |
|
236 Get the data associated with an array of unsigned short (16-bit) integers EXIF/DCF tag/IFD. |
|
237 |
|
238 @param aTag |
|
239 the tag id where the data is stored |
|
240 @param aIfd |
|
241 the ifd section in which the tag is stored. |
|
242 @param aParam |
|
243 on return, the array is filled with the list of values in this tag |
|
244 |
|
245 Note: aParam will be resized to fit the number of data elements read. |
|
246 |
|
247 @return error code |
|
248 KErrArgument if the requested data type does not match with the tag. |
|
249 KErrNotSupported if called on an encoding module. |
|
250 KErrNotFound if the tag cannot be found. |
|
251 */ |
|
252 virtual TInt GetShortArrayParam(TUint aTag, TUint aIfd, CArrayFix<TUint16>& aParam) const = 0; |
|
253 |
|
254 /** |
|
255 Get the data associated with an array of signed or unsigned rationals EXIF/DCF tag/IFD. |
|
256 If used to get unsigned rational data, it is up to the client to typecast the components as appropriate. |
|
257 |
|
258 @param aTag |
|
259 the tag id where the data is stored |
|
260 @param aIfd |
|
261 the ifd section in which the tag is stored. |
|
262 @param aParam |
|
263 on return, the array is filled with the list of values in this tag |
|
264 |
|
265 Note: aParam will be resized to fit the number of data elements read. |
|
266 |
|
267 @return error code |
|
268 KErrArgument if the requested data type does not match with the tag. |
|
269 KErrNotSupported if called on an encoding module. |
|
270 KErrNotFound if the tag cannot be found. |
|
271 */ |
|
272 virtual TInt GetRationalArrayParam(TUint aTag, TUint aIfd, CArrayFix<TRational>& aParam) const = 0; |
|
273 }; |
|
274 |
|
275 |
|
276 /** |
|
277 @publishedAll |
|
278 @released |
|
279 |
|
280 generic accessor to write the tags from exif metadata. |
|
281 |
|
282 Note: The aIfd argument in MExifMetadataWriter methods should be set as follows: |
|
283 - When writing to an IFD 0 tag that is not a GPS tag, use KExifIfdZero. |
|
284 - When writing to a tag related to thumbnail, use KExifIfdOne. |
|
285 - When writing to a GPS tag, use KExifGpsIfd. |
|
286 |
|
287 The TExifWriterUtility class offers a friendlier interface to access these tags. |
|
288 |
|
289 @see TExifWriterUtility |
|
290 */ |
|
291 class MExifMetadataWriter |
|
292 { |
|
293 public: |
|
294 // Setters |
|
295 /** |
|
296 Set the data associated with an 8-bit (e.g. ASCII, Undefined or Byte) EXIF/DCF tag/IFD. |
|
297 |
|
298 Note: If setting non-NULL terminated ASCII data, this method will add a NULL terminator to it provided that doing so will not cause the length of the tag value to be exceeded. If the length would be exceeded KErrArgument will be returned. |
|
299 |
|
300 Note: This method will set other (non-ASCII) 8-bit data exactly as-is. |
|
301 |
|
302 @param aTag |
|
303 the tag id where the data is stored |
|
304 @param aIfd |
|
305 the ifd section in which the tag is stored. |
|
306 @param aParam |
|
307 the value of the tag |
|
308 |
|
309 @return error code |
|
310 KErrNotSupported if called on a decoding module. |
|
311 KErrNotSupported if the plugin does not support the specified tag. |
|
312 KErrArgument if the requested data type does not match with the tag. |
|
313 */ |
|
314 virtual TInt SetParam8(TUint aTag, TUint aIfd, HBufC8* aParam) = 0; |
|
315 |
|
316 /** |
|
317 Set 16-bit Unicode data into EXIF/DCF tag/IFDs that support it (e.g.0x9286 (UserComment), 0x001B (GpsProcessingMethod) or 0x001C (GpsAreaInformation) ). |
|
318 |
|
319 Note: This method will add the 8-byte prefix "UNICODE/0" to aParam before setting the tag value in the metadata. It may only be used to set Unicode data. |
|
320 |
|
321 @param aTag |
|
322 the tag id where the data is stored |
|
323 @param aIfd |
|
324 the ifd section in which the tag is stored. |
|
325 @param aParam |
|
326 the value of the tag |
|
327 |
|
328 |
|
329 @return error code |
|
330 KErrNotSupported if called on a decoding module. |
|
331 KErrNotSupported if the plugin does not support the specified tag. |
|
332 KErrArgument if the requested data type does not match with the tag. |
|
333 */ |
|
334 virtual TInt SetParam16(TUint aTag, TUint aIfd, HBufC16* aParam) = 0; |
|
335 |
|
336 /** |
|
337 Sets the data associated with a signed or unsigned 32-bit integer EXIF/DCF tag/IFD. |
|
338 |
|
339 @param aTag |
|
340 the tag id where the data is stored |
|
341 @param aIfd |
|
342 the ifd section in which the tag is stored. |
|
343 @param aParam |
|
344 the value of the tag |
|
345 |
|
346 @return error code |
|
347 KErrNotSupported if called on a decoding module. |
|
348 KErrNotSupported if the plugin does not support the specified tag. |
|
349 KErrArgument if the requested data type does not match with the tag. |
|
350 */ |
|
351 virtual TInt SetIntegerParam(TUint aTag, TUint aIfd, TInt aParam) = 0; |
|
352 |
|
353 /** |
|
354 Sets the data associated with an unsigned short (16-bit) EXIF/DCF tag/IFD. |
|
355 |
|
356 @param aTag |
|
357 the tag id where the data is stored |
|
358 @param aIfd |
|
359 the ifd section in which the tag is stored. |
|
360 @param aParam |
|
361 the value of the tag |
|
362 |
|
363 @return error code |
|
364 KErrNotSupported if called on a decoding module. |
|
365 KErrNotSupported if the plugin does not support the specified tag. |
|
366 KErrArgument if the requested data type does not match with the tag. |
|
367 */ |
|
368 virtual TInt SetShortParam(TUint aTag, TUint aIfd, TUint16 aParam) = 0; |
|
369 |
|
370 /** |
|
371 Sets the data associated with a signed or unsigned rational EXIF/DCF tag/IFD. |
|
372 |
|
373 @param aTag |
|
374 the tag id where the data is stored |
|
375 @param aIfd |
|
376 the ifd section in which the tag is stored. |
|
377 @param aNumerator |
|
378 the numerator value of the rational tag |
|
379 @param aDenominator |
|
380 the denominator value of the rational tag |
|
381 |
|
382 @return error code |
|
383 KErrNotSupported if called on a decoding module. |
|
384 KErrNotSupported if the plugin does not support the specified tag. |
|
385 KErrArgument if the requested data type does not match with the tag. |
|
386 */ |
|
387 virtual TInt SetRationalParam(TUint aTag, TUint aIfd, TInt aNumerator, TInt aDenominator) = 0; |
|
388 |
|
389 /** |
|
390 Sets the data associated with an array of signed or unsigned 32-bit integers EXIF/DCF tag/IFD. |
|
391 |
|
392 @param aTag |
|
393 the tag id where the data is stored |
|
394 @param aIfd |
|
395 the ifd section in which the tag is stored. |
|
396 @param aParam |
|
397 the list of values value for the tag |
|
398 |
|
399 @return error code |
|
400 KErrNotSupported if called on a decoding module. |
|
401 KErrNotSupported if the plugin does not support the specified tag. |
|
402 KErrArgument if the requested data type does not match with the tag. |
|
403 */ |
|
404 virtual TInt SetIntegerArrayParam(TUint aTag, TUint aIfd, CArrayFix<TInt>& aParam) = 0; |
|
405 |
|
406 /** |
|
407 Sets the data associated with an array of unsigned short (16-bit) EXIF/DCF tag/IFD. |
|
408 |
|
409 @param aTag |
|
410 the tag id where the data is stored |
|
411 @param aIfd |
|
412 the ifd section in which the tag is stored. |
|
413 @param aParam |
|
414 the list of values value for the tag |
|
415 |
|
416 @return error code |
|
417 KErrNotSupported if called on a decoding module. |
|
418 KErrNotSupported if the plugin does not support the specified tag. |
|
419 KErrArgument if the requested data type does not match with the tag. |
|
420 */ |
|
421 virtual TInt SetShortArrayParam(TUint aTag, TUint aIfd, CArrayFix<TUint16>& aParam) = 0; |
|
422 |
|
423 /** |
|
424 Sets the data associated with an array of signed or unsigned rationals EXIF/DCF tag/IFD. |
|
425 |
|
426 @param aTag |
|
427 the tag id where the data is stored |
|
428 @param aIfd |
|
429 the ifd section in which the tag is stored. |
|
430 @param aParam |
|
431 the list of values value for the tag |
|
432 |
|
433 @return error code |
|
434 KErrNotSupported if called on a decoding module. |
|
435 KErrNotSupported if the plugin does not support the specified tag. |
|
436 KErrArgument if the requested data type does not match with the tag. |
|
437 */ |
|
438 virtual TInt SetRationalArrayParam(TUint aTag, TUint aIfd, CArrayFix<TRational>& aParam) = 0; |
|
439 }; |
|
440 |
|
441 |
|
442 /** |
|
443 @publishedAll |
|
444 @released |
|
445 |
|
446 generic accessor to access the tags from exif metadata. |
|
447 The TExifWriterUtility & TExifReaderUtility classes offer friendlier interfaces to access these tags. |
|
448 */ |
|
449 class MExifMetadata: public MExifMetadataReader, public MExifMetadataWriter |
|
450 { |
|
451 public: |
|
452 }; |
|
453 |
|
454 |
|
455 /** |
|
456 @publishedAll |
|
457 @released |
|
458 |
|
459 Provides access to the exif jpeg decoder. |
|
460 |
|
461 This class provides functions to decode jpeg images held in files or descriptors. |
|
462 */ |
|
463 class CJPEGExifDecoder : public CImageDecoder |
|
464 { |
|
465 public: |
|
466 class CBody; |
|
467 friend class CBody; |
|
468 |
|
469 IMPORT_C static CJPEGExifDecoder* NewL(); |
|
470 IMPORT_C ~CJPEGExifDecoder(); |
|
471 |
|
472 IMPORT_C MExifMetadata* ExifMetadata(); |
|
473 |
|
474 protected: |
|
475 IMPORT_C CJPEGExifDecoder(); |
|
476 IMPORT_C void ConstructL(); |
|
477 |
|
478 private: |
|
479 CBody* iBody; |
|
480 }; |
|
481 |
|
482 /** |
|
483 @publishedAll |
|
484 @released |
|
485 |
|
486 Provides access to the exif jpeg encoder. |
|
487 |
|
488 This class provides functions to encode jpeg images held in files or descriptors. |
|
489 */ |
|
490 class CJPEGExifEncoder : public CImageEncoder |
|
491 { |
|
492 public: |
|
493 class CBody; |
|
494 friend class CBody; |
|
495 |
|
496 IMPORT_C static CJPEGExifEncoder* NewL(); |
|
497 IMPORT_C ~CJPEGExifEncoder(); |
|
498 |
|
499 IMPORT_C MExifMetadata* ExifMetadata(); |
|
500 |
|
501 protected: |
|
502 IMPORT_C CJPEGExifEncoder(); |
|
503 IMPORT_C void ConstructL(); |
|
504 |
|
505 private: |
|
506 CBody* iBody; |
|
507 }; |
|
508 |
|
509 /** |
|
510 @publishedAll |
|
511 @released |
|
512 |
|
513 The plugin API for Image Converter Library EXIF decoder plugins. |
|
514 */ |
|
515 class CJPEGExifDecoderPlugin : public CImageDecoderPlugin |
|
516 { |
|
517 public: |
|
518 /** |
|
519 Returns the EXIF metadata associated with the image being decoded. |
|
520 This is a pure virtual function that each individual plugin must implement. |
|
521 |
|
522 @return A pointer to the metadata. NULL if there is no metadata available. |
|
523 */ |
|
524 IMPORT_C virtual MExifMetadata* ExifMetadata() = 0; |
|
525 }; |
|
526 |
|
527 /** |
|
528 @publishedAll |
|
529 @released |
|
530 |
|
531 The plugin API for Image Converter Library EXIF encoder plugins. |
|
532 */ |
|
533 class CJPEGExifEncoderPlugin : public CImageEncoderPlugin |
|
534 { |
|
535 public: |
|
536 /** |
|
537 Returns the EXIF metadata associated with the image being encoded. |
|
538 This is a pure virtual function that each individual plugin must implement. |
|
539 |
|
540 @return A pointer to the metadata. NULL if there is no metadata available. |
|
541 */ |
|
542 IMPORT_C virtual MExifMetadata* ExifMetadata() = 0; |
|
543 }; |
|
544 |
|
545 /** |
|
546 @publishedAll |
|
547 @released |
|
548 |
|
549 extension for exif Image Transform |
|
550 |
|
551 This class gives access to the exif metadata in a jpeg image during the transform operation |
|
552 |
|
553 @see CImageTranform |
|
554 */ |
|
555 class CJPEGExifTransformExtension : public CImageTransformPluginExtension |
|
556 { |
|
557 public: |
|
558 IMPORT_C virtual MExifMetadata* ExifMetadata(); |
|
559 }; |
|
560 |
|
561 #endif // __CEXIFICL_H__ |
|
562 |