Merge branch 'bug_617_default_favlist_handling_fix'
[enigma2.git] / lib / gdi / picexif.h
1 #ifndef __exif_h__
2 #define __exif_h__
3
4 #include <stdlib.h>
5 #include <memory.h>
6 #include <string.h>
7 #include <stdio.h>
8
9 #define MAX_COMMENT 1000
10 #define MAX_SECTIONS 20
11 #define THUMBNAILTMPFILE "/tmp/.thumbcache"
12
13 typedef struct tag_ExifInfo {
14         char  Version        [5];
15         char  CameraMake     [32];
16         char  CameraModel    [40];
17         char  DateTime       [20];
18         char  Orientation    [20];
19         char  MeteringMode   [30];
20         char  Comments[MAX_COMMENT];
21         char  FlashUsed      [20];
22         char  IsColor        [5];
23         char  ResolutionUnit [20];
24         char  ExposureProgram[30];
25         char  LightSource    [20];
26         float Xresolution;
27         float Yresolution;
28         float Brightness;
29         float ExposureTime;
30         float ExposureBias;
31         float Distance;
32         float CCDWidth;
33         float FocalplaneXRes;
34         float FocalplaneYRes;
35         float FocalplaneUnits;
36         float FocalLength;
37         float ApertureFNumber;
38         int   Height, Width;
39         int   CompressionLevel;
40         int   ISOequivalent;
41         int   Process;
42         int   Orient;
43         //unsigned char *ThumbnailPointer;
44         //unsigned ThumbnailSize;
45         bool  IsExif;
46         int Thumnailstate;
47 } EXIFINFO;
48
49 static const int BytesPerFormat[] = {0,1,1,2,4,8,1,1,2,4,8,4,8};
50
51 class Cexif
52 {
53         typedef struct tag_Section_t{
54         unsigned char* Data;
55         int Type;
56         unsigned Size;
57         } Section_t;
58 public:
59         EXIFINFO* m_exifinfo;
60         char m_szLastError[256];
61         Cexif();
62         ~Cexif();
63         bool DecodeExif(const char *filename, int Thumb=0);
64         void ClearExif();
65 protected:
66         bool process_EXIF(unsigned char * CharBuf, unsigned int length);
67         void process_COM (const unsigned char * Data, int length);
68         void process_SOFn (const unsigned char * Data, int marker);
69         int Get16u(void * Short);
70         int Get16m(void * Short);
71         long Get32s(void * Long);
72         unsigned long Get32u(void * Long);
73         double ConvertAnyFormat(void * ValuePtr, int Format);
74         bool ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, EXIFINFO * const pInfo, unsigned         char ** const LastExifRefdP);
75         int ExifImageWidth;
76         int MotorolaOrder;
77         Section_t Sections[MAX_SECTIONS];
78         int SectionsRead;
79         bool freeinfo;
80 };
81
82 #endif// __exif_h__