imaging/imagingfws/ExifUtility/inc/ExifGeneralConsts.h
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     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 //
       
    15 
       
    16 #ifndef __EXIFGENERALCONSTS_H__
       
    17 #define __EXIFGENERALCONSTS_H__
       
    18 
       
    19 #include <gdi.h>
       
    20 #include <iclexif.h>
       
    21 
       
    22 // Header file containing general constants used by the Exif Encoder and Decoder.
       
    23 
       
    24 // Constants for size.
       
    25 const TUint K32BitIntegerByteCount = 4;
       
    26 const TUint K16BitIntegerByteCount = 2;
       
    27 const TUint K8BitIntegerByteCount = 1;
       
    28 
       
    29 const TUint16 KApp1Marker = 0xE1FF; // The Application 1 marker (APP1).
       
    30 const TUint16 KApp1MarkerByteCount = K16BitIntegerByteCount; // Number of bytes in the APP1 marker.
       
    31 const TUint16 KBlockEndMarker = 0xD9FF; // The Application 1 marker (APP1).
       
    32 const TUint16 KBlockEndMarkerByteCount = K16BitIntegerByteCount; // Number of bytes in the APP1 marker.
       
    33 
       
    34 const TUint KOffsetToApp1Size = K16BitIntegerByteCount; // Two bytes in from the start of the Exif header.
       
    35 const TUint16 KApp1SizeLength = K16BitIntegerByteCount; // The byte count of the APP1 header length field.
       
    36 
       
    37 const TUint KExifMarker = 0x66697845; // 'Exif' string.
       
    38 const TUint16 KExifMarkerByteCount = K32BitIntegerByteCount; // i.e. number of bytes of 'Exif'
       
    39 const TUint16 KExifMarkerEnd = 0x0000; // Always follows 'Exif'.
       
    40 const TUint16 KExifMarkerEndByteCount = K16BitIntegerByteCount;
       
    41 const TInt KExifHeaderLength = K32BitIntegerByteCount + K16BitIntegerByteCount;
       
    42 
       
    43 const TUint16 KIntelByteAlignment = 0x4949; // Indicates little-endian byte alignment.
       
    44 const TUint16 KMotorolaByteAlignment = 0x4D4D;
       
    45 const TUint16 KByteAlignmentByteCount = K16BitIntegerByteCount;
       
    46 const TUint KByteCountToByteAlignment = KApp1MarkerByteCount +
       
    47 										KApp1SizeLength +
       
    48 										KExifHeaderLength; // Number of bytes from KApp1Marker through to KIntel.
       
    49 const TInt KOffsetFromExifHeaderToByteAlignment = KExifHeaderLength;
       
    50 
       
    51 const TUint16 KFortyTwo = 0x002A;
       
    52 const TUint16 KFortyTwoByteCount = K16BitIntegerByteCount;
       
    53 
       
    54 const TUint KIfdOffset = 0x00000008; // Offset to 0th IFD.
       
    55 const TUint16 KIfdOffsetByteCount = K32BitIntegerByteCount;
       
    56 const TUint KOffsetToFirstIfdSize = K32BitIntegerByteCount; // A 4 byte field containing an offset to the 1st Ifd.
       
    57 
       
    58 const TUint16 KMaxApp1Size = 0xFFFF; // Maximum size of the APP1 header.
       
    59 
       
    60 const TUint KSizeOfEntryCount = K16BitIntegerByteCount; // Each Ifd has an entry count of 2 bytes.
       
    61 
       
    62 const TInt KJPEGEncodedThumbnail = 6; //
       
    63 
       
    64 // External user will call functions using either of these two constants as the Ifd argument.
       
    65 const TInt16 KExternalZerothIfd = 0;
       
    66 const TInt16 KExternalFirstIfd = 1;
       
    67 
       
    68 const TInt KOffsetToZerothOffset = 	KByteAlignmentByteCount +
       
    69 									KFortyTwoByteCount +
       
    70 									KIfdOffsetByteCount +
       
    71 									KSizeOfEntryCount; // Number of bytes from byte alignment to the offset to the 0th Ifd.
       
    72 
       
    73 const TUint16 KExifFileHeaderLength = 	KApp1MarkerByteCount +
       
    74 										KApp1SizeLength +
       
    75 										KExifMarkerByteCount +
       
    76 										KExifMarkerEndByteCount +
       
    77 										KByteAlignmentByteCount + 
       
    78 										KFortyTwoByteCount + 
       
    79 										KIfdOffsetByteCount; // Length of the standard Exif Header.
       
    80 
       
    81 // Literals used in the encoder/decoder.										
       
    82 _LIT8(KUnicode, "UNICODE\0"); // The first 8 bytes of the User Comment tag, if using Unicode.
       
    83 _LIT8(KExifHeader, "Exif\0\0");
       
    84 
       
    85 const TInt KThumbnailHeight = 120;
       
    86 const TInt KThumbnailWidth = 160;
       
    87 const TDisplayMode KThumbnailDisplayMode= EColor256;
       
    88 const TInt KIOBlockSize=4096;	// size of blocks used for IO operations
       
    89 
       
    90 enum TIfd
       
    91 	{
       
    92 	EZeroth, // Main image.	
       
    93 	EExifSub, // Main image.
       
    94 	EInterop, // Main image.
       
    95 	EFirst, // Thumbnail.
       
    96 	EGpsSub = KExifGpsIfd >> 16 // (==4) Main image.		
       
    97 	};
       
    98 
       
    99 enum TTagValueIndexes
       
   100 	{
       
   101 	ETagValue,
       
   102 	EFormatValue,
       
   103 	EComponentCountValue,
       
   104 	EValueOffsetValue,
       
   105 	EIfdValue,
       
   106 	ESupportLevelValue
       
   107 	};
       
   108 	
       
   109 // Is the tag Mandatory, Optional or 
       
   110 enum TSupportLevel
       
   111 	{
       
   112 	EOptional,
       
   113 	EConditionallyMandatory,
       
   114 	EMandatory
       
   115 	};
       
   116 	
       
   117 // The format field in the Ifd entry is a two byte field, with an identifying short.
       
   118 enum TFormat
       
   119 	{
       
   120 	EByte = 1,
       
   121 	EAscii = 2,
       
   122 	EUnsignedShort = 3,
       
   123 	EUnsignedLong = 4,
       
   124 	EUnsignedRational = 5,
       
   125 	EUndefined = 7,
       
   126 	ESignedLong = 9,
       
   127 	ESignedRational = 10
       
   128 	};
       
   129 	
       
   130 // Related to TFormat. Stores size (in bytes) of each enumeration, i.e. EByte size is 1 byte, 
       
   131 // EUnsignedRational size is 8 bytes etc etc.
       
   132 const TInt KDataFormatSize[] = {0,1,1,2,4,8, 0,1, 0,4,8};
       
   133 const TUint KDataFormatSizeLength = sizeof(KDataFormatSize)/sizeof(KDataFormatSize[0]); // The length of the KDataFormatsize array.
       
   134 
       
   135 // Used by Ifd entry
       
   136 const TUint KMinimumIfdEntrySize = 12; // The number of bytes in a standard ifd entry.
       
   137 const TInt KSizeOfTagField = 2; // The number of bytes in the tag field.
       
   138 const TInt KSizeOfFormatField = 2; // The number of bytes in format field.
       
   139 const TInt KSizeOfComponentCountField = 4; // The number of bytes in the component count field.
       
   140 const TUint KSizeOfValueOffsetField = 4; // The number of bytes in the value/offset field.
       
   141 const TInt KSizeOfRational = 8; // The number of bytes in a rational number.
       
   142 const TInt KTagFieldPosition = 0;
       
   143 const TInt KFormatFieldPosition = 2; // The start position of the format field.
       
   144 const TInt KComponentCountFieldPosition = 4; // The start position of the component count field.
       
   145 const TInt KValueOffsetFieldPosition = 8; // The start position of the value/offset field.
       
   146 const TUint8 KThreeBytes = 3;
       
   147 
       
   148 #endif // __EXIFGENERALCONSTS_H__