Photo_if.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. #include "time.h"
  2. #ifndef NULL
  3. #define NULL (void *)0
  4. #endif
  5. #ifndef bool
  6. #define bool char
  7. #endif
  8. #define EXIF_STR_MAX_LEN (256)
  9. #define EXIF_PHOTO_TIME_STR_LEN (20)
  10. typedef enum
  11. {
  12. Source_DTV = 0,
  13. Source_USB,
  14. }PhotoAPI_SourceType;
  15. typedef enum
  16. {
  17. PHOTO_STREAM_FILE = 0,
  18. PHOTO_STREAM_BUFFER,
  19. }PhotoAPI_StreamMdoe;
  20. typedef enum
  21. {
  22. PHOTO_DECODE_FAIL = 0,
  23. PHOTO_DECODE_SUCCESS,
  24. PHOTO_DECODE_FORCESTOP,
  25. PHOTO_DECODE_DECODING,
  26. }PhotoAPI_DecodeStatus;
  27. typedef enum
  28. {
  29. OSD_ROT_DIRECTION_CLOCKWISE = 1, //Left
  30. OSD_ROT_DIRECTION_COUNTERCLOCKWISE, //Right
  31. }PhotoAPI_OSD_ROT_DIRECTION;
  32. typedef enum
  33. {
  34. PAN_DIRECTION_UP,
  35. PAN_DIRECTION_DOWN,
  36. PAN_DIRECTION_LEFT,
  37. PAN_DIRECTION_RIGHT,
  38. PAN_DIRECTION_TOTAL,
  39. }PhotoAPI_VIP_PAN_MODE;
  40. typedef enum
  41. {
  42. PHOTO_DISPLAY_DISABLE = 0,
  43. PHOTO_DISPLAY_ENABLE,
  44. }PhotoAPI_PicDisplay_show;
  45. typedef enum
  46. {
  47. PHOTO_DISPLAY_RGB = 0,
  48. PHOTO_DISPLAY_YUV = 4,
  49. }PhotoAPI_PicDisplay_DataFMT;
  50. typedef enum
  51. {
  52. PHOTO_NO_EFFECT = 0,
  53. PHOTO_MOVING_EFFECT,
  54. PHOTO_SPECIAL_EFFECT,
  55. }PhotoAPI_Effect_Mode;
  56. typedef enum
  57. {
  58. PHOTO_MOVING_NONE = 0,
  59. PHOTO_MOVING_LEFT,
  60. PHOTO_MOVING_RIGHT,
  61. PHOTO_MOVING_DOWN,
  62. PHOTO_MOVING_UP,
  63. } PhotoAPIMovingType_t;
  64. typedef enum
  65. {
  66. PHOTO_ROT_CLOCKWISE = 0,
  67. PHOTO_ROT_COUNTERCLOCKWISE,
  68. PHOTO_ROT_180_ANGLE,
  69. }PhotoAPI_Rotation_Mode;
  70. typedef enum
  71. {
  72. PHOTO_EFFECT_NONE = 0,
  73. PHOTO_EFFECT_UP,
  74. PHOTO_EFFECT_DOWN,
  75. PHOTO_EFFECT_GRID_BOTTEM_RIGHT,
  76. PHOTO_EFFECT_GRID_BOTTEM_LEFT,
  77. PHOTO_EFFECT_GRID_UPPER_RIGHT,
  78. PHOTO_EFFECT_GRID_UPPER_LEFT,
  79. PHOTO_EFFECT_SPIRAL,
  80. PHOTO_EFFECT_SHUTTERS,
  81. PHOTO_EFFECT_RAMDOM_GRID,
  82. PHOTO_EFFECT_HORIZONTALOPEN,
  83. PHOTO_EFFECT_VERTICALOPEN,
  84. PHOTO_EFFECT_RIGHT_SHUTTERS,
  85. PHOTO_EFFECT_DOWN_SHUTTERS,
  86. PHOTO_EFFECT_SQUARE_BLOCKS,
  87. PHOTO_EFFECT_STRIP_DOWN,
  88. PHOTO_EFFECT_STRIP_LEFT,
  89. PHOTO_EFFECT_CROSS,
  90. PHOTO_EFFECT_TURNOVER_DOWN,
  91. PHOTO_EFFECT_RAMDOM_LINE_VERTICAL,
  92. PHOTO_EFFECT_RAMDOM_LINE_HORIZONTAL,
  93. PHOTO_EFFECT_SQUARE_IN,
  94. PHOTO_EFFECT_BLOCKS_SHUTTERS,
  95. PHOTO_EFFECT_DIGITAL_BLOCKS_DOWN,
  96. PHOTO_EFFECT_DIGITAL_BLOCKS_RIGHT,
  97. PHOTO_EFFECT_STRIP_HORIZONTAL_IN,
  98. PHOTO_EFFECT_STRIP_VERTICAL_IN,
  99. PHOTO_EFFECT_DIGITAL_BLOCKS_UP,
  100. PHOTO_EFFECT_DIGITAL_BLOCKS_LEFT,
  101. PHOTO_EFFECT_SEQ,
  102. } PhotoAPIEffectType_t;
  103. typedef enum
  104. {
  105. PHOTO_PIC_ROTATION_0 = 0, /*!< Photo Rotation Angle = 0*/
  106. PHOTO_PIC_ROTATION_90, /*!< Photo Rotation Angle = 90*/
  107. PHOTO_PIC_ROTATION_180, /*!< Photo Rotation Angle = 180*/
  108. PHOTO_PIC_ROTATION_270, /*!< Photo Rotation Angle = 270*/
  109. } PhotoAPI_Exif_Rotation_Info_t;
  110. typedef enum
  111. {
  112. PHOTO_UNKNOW_FORMAT = 0,
  113. PHOTO_JPEG_FORMAT,
  114. PHOTO_PNG_FORMAT,
  115. PHOTO_BMP_FORMAT,
  116. PHOTO_GIF_FORMAT,
  117. PHOTO_TIFF_FORMAT,
  118. } PhotoAPI_PhotoType_t;
  119. /*struct tm
  120. {
  121. int tm_sec;
  122. int tm_min;
  123. int tm_hour;
  124. int tm_mday;
  125. int tm_mon;
  126. int tm_year;
  127. int tm_wday;
  128. int tm_yday;
  129. int tm_isdst;
  130. };*/
  131. typedef struct
  132. {
  133. struct tm UTC_time; //Last file status change time
  134. struct tm UTM_time; //Last data modification time
  135. long long Size; //file size
  136. } PhotoAPI_File_Details_t;
  137. typedef struct
  138. {
  139. char Make[EXIF_STR_MAX_LEN]; /*!< Exif Make Tag, Manufacturing company, eg. SONY*/
  140. char Model[EXIF_STR_MAX_LEN]; /*!< Exif Model Tag, Model Name, eg. TX1, NEX5...*/
  141. unsigned int ISO_Speedrating; /*!< Exof IsoSpeedrating Tag, ISO, eg. 125*/
  142. PhotoAPI_Exif_Rotation_Info_t Rotation;
  143. float F_Number;
  144. unsigned int Shutter_Speed_Denominator;
  145. unsigned char Datetimeoriginal[EXIF_PHOTO_TIME_STR_LEN];
  146. } PhotoAPI_Exif_Info_t, *PPhotoAPI_Exif_Info_t;
  147. typedef struct _PhotoAPI_PicInfo
  148. {
  149. PhotoAPI_File_Details_t FileSystem_Info; //file informations
  150. bool Is_File_Support; //lib support this picture
  151. bool Is_Thumbnail_Support; //lib support this picture thumbnail
  152. unsigned int Width; //picture width
  153. unsigned int Height; //picture height
  154. unsigned int Thumbnail_Width; //thumbnail width
  155. unsigned int Thumbnail_Height; //thumbnail height
  156. unsigned int isProgressiveJPEG; //progressive JPEG
  157. PhotoAPI_PhotoType_t Photo_Format; //picture file format , jpeg / png / bmp
  158. PhotoAPI_Exif_Info_t Exif; //Exif infomations
  159. } PhotoAPI_PicInfo, *PPhotoAPI_PicInfo;
  160. typedef struct _PhotoAPI_PicFrmInfo
  161. {
  162. unsigned int scale_width;
  163. unsigned int scale_height;
  164. unsigned int x_onFrame;
  165. unsigned int y_onFrame;
  166. } PhotoAPI_PicFrmInfo, *PPhotoAPI_PicFrmInfo;
  167. typedef struct _PhotoAPI_WinFrmInfo
  168. {
  169. unsigned int x_onFrame;
  170. unsigned int y_onFrame;
  171. unsigned int Width;
  172. unsigned int WinWidth;
  173. unsigned int Height;
  174. unsigned int WinHeight;
  175. }PhotoAPI_WinFrmInfo, *PPhotoAPI_WinFrmInfo;
  176. typedef struct _PhotoAPI_Resolution
  177. {
  178. unsigned int Width;
  179. unsigned int Height;
  180. }PhotoAPI_Resolution, *PPhotoAPI_Resolution;
  181. typedef struct _PhotoAPI_THUMB_InitInfo
  182. {
  183. unsigned char Is_thumb_decode;
  184. unsigned char Force_thumb_decode;
  185. unsigned short thumb_Width;
  186. unsigned short thumb_Height;
  187. unsigned short pos_X;
  188. unsigned short pos_Y;
  189. }PhotoAPI_THUMB_InitInfo, *PPhotoAPI_THUMB_InitInfo;
  190. typedef struct _PhotoAPI_StreamInfo
  191. {
  192. PhotoAPI_StreamMdoe StreamMode;
  193. PhotoAPI_Effect_Mode EffectMode;
  194. int EffectIdx;
  195. char *FilePath;
  196. char *DataBufAddr;
  197. unsigned int DataSize;
  198. }PhotoAPI_StreamInfo, *PPhotoAPI_StreamInfo;
  199. int Photo_Init(int Photo_MsgQid, PhotoAPI_SourceType SourceType);
  200. int Photo_OpenFile_Init(PPhotoAPI_StreamInfo StreamInfo, PPhotoAPI_THUMB_InitInfo pthumb_InitInfo);
  201. int Photo_Decode(void);
  202. void Photo_Stop(void);
  203. void Photo_CloseFile_Exit(void);
  204. void Photo_Exit (void);
  205. int Photo_SetFadeEffect (char ucStartVal, char ucEndVal, char ucIncVal);
  206. void Photo_Rotate (PhotoAPI_Rotation_Mode Mode);
  207. int Photo_Zoom (char zoom_size);
  208. int Photo_Zoom_out(char ZoomNum, char ZoomDenom);
  209. int Photo_Pan(char mode, unsigned int movePixel);
  210. int Photo_GetWinOnFrameInfo(PPhotoAPI_WinFrmInfo pWinFrame_Info);
  211. void Photo_GetPanelSize(PPhotoAPI_Resolution pPanelSize);
  212. void Photo_GetPicDisplaySize(PPhotoAPI_Resolution pDisplaySize);
  213. void Photo_GetPicOnFrameInfo(PPhotoAPI_PicFrmInfo pPicFrm_Info);
  214. void Photo_SetPicDisplay(PhotoAPI_PicDisplay_show cShow, PhotoAPI_PicDisplay_DataFMT DataFormat);
  215. void Photo_ResetVipAddr(void);
  216. void Photo_ClearDisplayBuffer(void);
  217. void Photo_SetBGColor(UINT32 bg_color);
  218. void Photo_SetSourceType(PhotoAPI_SourceType SourceType);
  219. int Photo_GetPicInfo(char *FilePath, PPhotoAPI_PicInfo pPic_Info);
  220. int Photo_GetFileInfo(char *FilePath, PPhotoAPI_PicInfo pPic_Info);
  221. int Photo_Encode_JPG(char * filename,int encode_quality);
  222. int Photo_SetAspPercent(UINT8 HPercent,UINT8 VPercent,UINT32 mode);