libgphoto2 photo camera library (libgphoto2) API 2.4.12
|
00001 00025 #ifndef __GPHOTO2_FILE_H__ 00026 #define __GPHOTO2_FILE_H__ 00027 00028 #include <time.h> 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif /* __cplusplus */ 00033 00034 #define GP_MIME_WAV "audio/wav" 00035 #define GP_MIME_RAW "image/x-raw" 00036 #define GP_MIME_PNG "image/png" 00037 #define GP_MIME_PGM "image/x-portable-graymap" 00038 #define GP_MIME_PPM "image/x-portable-pixmap" 00039 #define GP_MIME_PNM "image/x-portable-anymap" 00040 #define GP_MIME_JPEG "image/jpeg" 00041 #define GP_MIME_TIFF "image/tiff" 00042 #define GP_MIME_BMP "image/bmp" 00043 #define GP_MIME_QUICKTIME "video/quicktime" 00044 #define GP_MIME_AVI "video/x-msvideo" 00045 #define GP_MIME_CRW "image/x-canon-raw" 00046 #define GP_MIME_CR2 "image/x-canon-cr2" 00047 #define GP_MIME_UNKNOWN "application/octet-stream" 00048 #define GP_MIME_EXIF "application/x-exif" 00049 #define GP_MIME_MP3 "audio/mpeg" 00050 #define GP_MIME_OGG "application/ogg" 00051 #define GP_MIME_WMA "audio/x-wma" 00052 #define GP_MIME_ASF "audio/x-asf" 00053 #define GP_MIME_MPEG "video/mpeg" 00054 #define GP_MIME_AVCHD "video/mp2t" 00055 #define GP_MIME_RW2 "image/x-panasonic-raw2" 00056 00067 typedef enum { 00068 GP_FILE_TYPE_PREVIEW, 00069 GP_FILE_TYPE_NORMAL, 00070 GP_FILE_TYPE_RAW, 00073 GP_FILE_TYPE_AUDIO, 00074 GP_FILE_TYPE_EXIF, 00075 GP_FILE_TYPE_METADATA 00076 } CameraFileType; 00077 00084 typedef enum { 00085 GP_FILE_ACCESSTYPE_MEMORY, 00086 GP_FILE_ACCESSTYPE_FD 00087 } CameraFileAccessType; 00088 00095 typedef struct _CameraFile CameraFile; 00096 00097 int gp_file_new (CameraFile **file); 00098 int gp_file_new_from_fd (CameraFile **file, int fd); 00099 int gp_file_ref (CameraFile *file); 00100 int gp_file_unref (CameraFile *file); 00101 int gp_file_free (CameraFile *file); 00102 00103 /* "Do not use those" 00104 * 00105 * These functions probably were originally intended for internal use only. 00106 * However, due to 00107 * - the lack of good documentation 00108 * - this being the obvious way to save a file 00109 * - the fact that libgphoto2 has been exporting all its internal 00110 * symbols for years (until 2005-06) 00111 * - our in-house frontends gphoto2 and gtkam using them 00112 * a number of external frontends started to use these functions, as 00113 * of 2005-06: 00114 * - digikam 00115 * - f-spot 00116 * - gthumb 00117 * But a few frontends can live without it (and thus are likely to 00118 * use the correct API): 00119 * - flphoto 00120 * - kamera 00121 * 00122 * So we're going to phase these functions out over the next year or 00123 * so, going the GTK way of keeping the ABI but breaking the API. So 00124 * we'll continue to export functionally equivalent functions, but the 00125 * header files will not contain definitions for you to use any more. 00126 */ 00127 int gp_file_open (CameraFile *file, const char *filename); 00128 int gp_file_save (CameraFile *file, const char *filename); 00129 int gp_file_clean (CameraFile *file); 00130 int gp_file_copy (CameraFile *destination, CameraFile *source); 00131 00132 int gp_file_set_name (CameraFile *file, const char *name); 00133 int gp_file_get_name (CameraFile *file, const char **name); 00134 00135 int gp_file_set_mime_type (CameraFile *file, const char *mime_type); 00136 int gp_file_get_mime_type (CameraFile *file, const char **mime_type); 00137 00138 int gp_file_set_type (CameraFile *file, CameraFileType type); 00139 int gp_file_get_type (CameraFile *file, CameraFileType *type); 00140 00141 int gp_file_set_mtime (CameraFile *file, time_t mtime); 00142 int gp_file_get_mtime (CameraFile *file, time_t *mtime); 00143 00144 int gp_file_detect_mime_type (CameraFile *file); 00145 int gp_file_adjust_name_for_mime_type (CameraFile *file); 00146 00147 int gp_file_append (CameraFile*, const char *data, 00148 unsigned long int size); 00149 int gp_file_slurp (CameraFile*, char *data, 00150 size_t size, size_t *readlen); 00151 int gp_file_set_data_and_size (CameraFile*, char *data, 00152 unsigned long int size); 00153 int gp_file_get_data_and_size (CameraFile*, const char **data, 00154 unsigned long int *size); 00155 00156 #ifdef __cplusplus 00157 } 00158 #endif /* __cplusplus */ 00159 00160 #endif /* __GPHOTO2_FILE_H__ */