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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This is the public client API for EXIF-enabled ICL modules
18 #ifndef __CEXIFICL_H__
19 #define __CEXIFICL_H__
22 #include <imageconversion.h>
23 #include <icl/imagetransformpluginext.h>
24 #include <icl/imageplugin.h>
30 IFD number representing Exif IFD 0.
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
38 Note: To read or write GPS tags, use the IFD constant KExifGpsIfd instead.
40 const TUint KExifIfdZero = 0;
46 IFD number representing Exif IFD 1.
48 For use in MExifMetadata methods when reading or writing tags related to thumbnail (i.e. IFD 1 tags).
50 const TUint KExifIfdOne = 1;
56 IFD number representing the IFD 0 sub-IFD for GPS (i.e. the GPS IFD).
58 For use in MExifMetadata methods when reading or writing GPS tags.
60 const TUint KExifGpsIfd = 0x00040000;
66 describes a rational value
70 /** numerator of the rational
77 /** denominator of the rational. No checking is processed to know if this is null or not
91 generic accessor to read the tags from exif metadata.
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.
98 The TExifReaderUtility class offers a friendlier interface to access these tags.
100 @see TExifReaderUtility
102 class MExifMetadataReader
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.
110 the tag id where the data is stored
112 the ifd section in which the tag is stored.
114 on return, the value of the tag
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.
121 virtual TInt GetIntegerParam(TUint aTag, TUint aIfd, TInt& aParam) const = 0;
124 Get the data associated with an unsigned short (16-bit) integer EXIF/DCF tag/IFD.
127 the tag id where the data is stored
129 the ifd section in which the tag is stored.
131 on return, the value of the tag
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.
138 virtual TInt GetShortParam(TUint aTag, TUint aIfd, TUint16& aParam) const = 0;
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.
145 the tag id where the data is stored
147 the ifd section in which the tag is stored.
149 on return, the numerator value of the tag
151 on return, the denominator value of the tag
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.
158 virtual TInt GetRationalParam(TUint aTag, TUint aIfd, TInt& aNumer, TInt& aDenom) const = 0;
160 Get the data associated with an 8-bit (e.g. ASCII, Undefined or Byte) EXIF/DCF tag/IFD.
162 Ownership of the buffer pointed to by aParam transfers to the client, which is therefore responsible for deleting the buffer when required.
164 Note: The client should always initialise aParam to NULL, and the plugin should only assign to this parameter when ready to transfer ownership.
166 Note: If using this method to retrieve ASCII data, the returned data will not be NULL terminated.
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.
172 the tag id where the data is stored
174 the ifd section in which the tag is stored.
176 on return, the value of the tag
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.
183 virtual TInt GetParam8(TUint aTag, TUint aIfd, HBufC8*& aParam) const = 0;
186 Get the data associated with a 16-bit EXIF/DCF tag/IFD.
188 Ownership of the buffer pointed to by aParam transfers to the client, which is therefore responsible for deleting the buffer when required.
190 Note: The client should always initialise aParam to NULL, and the plugin should only assign to this parameter when ready to transfer ownership.
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.
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.
202 the tag id where the data is stored
204 the ifd section in which the tag is stored.
206 on return, the value of the tag
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.
213 virtual TInt GetParam16(TUint aTag, TUint aIfd, HBufC16*& aParam) const = 0;
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.
220 the tag id where the data is stored
222 the ifd section in which the tag is stored.
224 on return, the array is filled with the list of values in this tag
226 Note: aParam will be resized to fit the number of data elements read.
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.
233 virtual TInt GetIntegerArrayParam(TUint aTag, TUint aIfd, CArrayFix<TInt>& aParam) const = 0;
236 Get the data associated with an array of unsigned short (16-bit) integers EXIF/DCF tag/IFD.
239 the tag id where the data is stored
241 the ifd section in which the tag is stored.
243 on return, the array is filled with the list of values in this tag
245 Note: aParam will be resized to fit the number of data elements read.
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.
252 virtual TInt GetShortArrayParam(TUint aTag, TUint aIfd, CArrayFix<TUint16>& aParam) const = 0;
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.
259 the tag id where the data is stored
261 the ifd section in which the tag is stored.
263 on return, the array is filled with the list of values in this tag
265 Note: aParam will be resized to fit the number of data elements read.
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.
272 virtual TInt GetRationalArrayParam(TUint aTag, TUint aIfd, CArrayFix<TRational>& aParam) const = 0;
280 generic accessor to write the tags from exif metadata.
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.
287 The TExifWriterUtility class offers a friendlier interface to access these tags.
289 @see TExifWriterUtility
291 class MExifMetadataWriter
296 Set the data associated with an 8-bit (e.g. ASCII, Undefined or Byte) EXIF/DCF tag/IFD.
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.
300 Note: This method will set other (non-ASCII) 8-bit data exactly as-is.
303 the tag id where the data is stored
305 the ifd section in which the tag is stored.
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.
314 virtual TInt SetParam8(TUint aTag, TUint aIfd, HBufC8* aParam) = 0;
317 Set 16-bit Unicode data into EXIF/DCF tag/IFDs that support it (e.g.0x9286 (UserComment), 0x001B (GpsProcessingMethod) or 0x001C (GpsAreaInformation) ).
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.
322 the tag id where the data is stored
324 the ifd section in which the tag is stored.
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.
334 virtual TInt SetParam16(TUint aTag, TUint aIfd, HBufC16* aParam) = 0;
337 Sets the data associated with a signed or unsigned 32-bit integer EXIF/DCF tag/IFD.
340 the tag id where the data is stored
342 the ifd section in which the tag is stored.
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.
351 virtual TInt SetIntegerParam(TUint aTag, TUint aIfd, TInt aParam) = 0;
354 Sets the data associated with an unsigned short (16-bit) EXIF/DCF tag/IFD.
357 the tag id where the data is stored
359 the ifd section in which the tag is stored.
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.
368 virtual TInt SetShortParam(TUint aTag, TUint aIfd, TUint16 aParam) = 0;
371 Sets the data associated with a signed or unsigned rational EXIF/DCF tag/IFD.
374 the tag id where the data is stored
376 the ifd section in which the tag is stored.
378 the numerator value of the rational tag
380 the denominator value of the rational tag
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.
387 virtual TInt SetRationalParam(TUint aTag, TUint aIfd, TInt aNumerator, TInt aDenominator) = 0;
390 Sets the data associated with an array of signed or unsigned 32-bit integers EXIF/DCF tag/IFD.
393 the tag id where the data is stored
395 the ifd section in which the tag is stored.
397 the list of values value for the tag
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.
404 virtual TInt SetIntegerArrayParam(TUint aTag, TUint aIfd, CArrayFix<TInt>& aParam) = 0;
407 Sets the data associated with an array of unsigned short (16-bit) EXIF/DCF tag/IFD.
410 the tag id where the data is stored
412 the ifd section in which the tag is stored.
414 the list of values value for the tag
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.
421 virtual TInt SetShortArrayParam(TUint aTag, TUint aIfd, CArrayFix<TUint16>& aParam) = 0;
424 Sets the data associated with an array of signed or unsigned rationals EXIF/DCF tag/IFD.
427 the tag id where the data is stored
429 the ifd section in which the tag is stored.
431 the list of values value for the tag
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.
438 virtual TInt SetRationalArrayParam(TUint aTag, TUint aIfd, CArrayFix<TRational>& aParam) = 0;
446 generic accessor to access the tags from exif metadata.
447 The TExifWriterUtility & TExifReaderUtility classes offer friendlier interfaces to access these tags.
449 class MExifMetadata: public MExifMetadataReader, public MExifMetadataWriter
459 Provides access to the exif jpeg decoder.
461 This class provides functions to decode jpeg images held in files or descriptors.
463 class CJPEGExifDecoder : public CImageDecoder
469 IMPORT_C static CJPEGExifDecoder* NewL();
470 IMPORT_C ~CJPEGExifDecoder();
472 IMPORT_C MExifMetadata* ExifMetadata();
475 IMPORT_C CJPEGExifDecoder();
476 IMPORT_C void ConstructL();
486 Provides access to the exif jpeg encoder.
488 This class provides functions to encode jpeg images held in files or descriptors.
490 class CJPEGExifEncoder : public CImageEncoder
496 IMPORT_C static CJPEGExifEncoder* NewL();
497 IMPORT_C ~CJPEGExifEncoder();
499 IMPORT_C MExifMetadata* ExifMetadata();
502 IMPORT_C CJPEGExifEncoder();
503 IMPORT_C void ConstructL();
513 The plugin API for Image Converter Library EXIF decoder plugins.
515 class CJPEGExifDecoderPlugin : public CImageDecoderPlugin
519 Returns the EXIF metadata associated with the image being decoded.
520 This is a pure virtual function that each individual plugin must implement.
522 @return A pointer to the metadata. NULL if there is no metadata available.
524 IMPORT_C virtual MExifMetadata* ExifMetadata() = 0;
531 The plugin API for Image Converter Library EXIF encoder plugins.
533 class CJPEGExifEncoderPlugin : public CImageEncoderPlugin
537 Returns the EXIF metadata associated with the image being encoded.
538 This is a pure virtual function that each individual plugin must implement.
540 @return A pointer to the metadata. NULL if there is no metadata available.
542 IMPORT_C virtual MExifMetadata* ExifMetadata() = 0;
549 extension for exif Image Transform
551 This class gives access to the exif metadata in a jpeg image during the transform operation
555 class CJPEGExifTransformExtension : public CImageTransformPluginExtension
558 IMPORT_C virtual MExifMetadata* ExifMetadata();
561 #endif // __CEXIFICL_H__