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
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_UNKNOWN "application/octet-stream"
00047 #define GP_MIME_EXIF "application/x-exif"
00048 #define GP_MIME_MP3 "audio/mpeg"
00049 #define GP_MIME_OGG "application/ogg"
00050 #define GP_MIME_WMA "audio/x-wma"
00051 #define GP_MIME_ASF "audio/x-asf"
00052 #define GP_MIME_MPEG "video/mpeg"
00053
00064 typedef enum {
00065 GP_FILE_TYPE_PREVIEW,
00066 GP_FILE_TYPE_NORMAL,
00067 GP_FILE_TYPE_RAW,
00070 GP_FILE_TYPE_AUDIO,
00071 GP_FILE_TYPE_EXIF,
00072 GP_FILE_TYPE_METADATA
00073 } CameraFileType;
00074
00081 typedef enum {
00082 GP_FILE_ACCESSTYPE_MEMORY,
00083 GP_FILE_ACCESSTYPE_FD
00084 } CameraFileAccessType;
00085
00092 typedef struct _CameraFile CameraFile;
00093
00094 int gp_file_new (CameraFile **file);
00095 int gp_file_new_from_fd (CameraFile **file, int fd);
00096 int gp_file_ref (CameraFile *file);
00097 int gp_file_unref (CameraFile *file);
00098 int gp_file_free (CameraFile *file);
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 int gp_file_open (CameraFile *file, const char *filename);
00125 int gp_file_save (CameraFile *file, const char *filename);
00126 int gp_file_clean (CameraFile *file);
00127 int gp_file_copy (CameraFile *destination, CameraFile *source);
00128
00129 int gp_file_set_name (CameraFile *file, const char *name);
00130 int gp_file_get_name (CameraFile *file, const char **name);
00131
00132 int gp_file_set_mime_type (CameraFile *file, const char *mime_type);
00133 int gp_file_get_mime_type (CameraFile *file, const char **mime_type);
00134
00135 int gp_file_set_type (CameraFile *file, CameraFileType type);
00136 int gp_file_get_type (CameraFile *file, CameraFileType *type);
00137
00138 int gp_file_set_mtime (CameraFile *file, time_t mtime);
00139 int gp_file_get_mtime (CameraFile *file, time_t *mtime);
00140
00141 int gp_file_detect_mime_type (CameraFile *file);
00142 int gp_file_adjust_name_for_mime_type (CameraFile *file);
00143
00144 int gp_file_append (CameraFile*, const char *data,
00145 unsigned long int size);
00146 int gp_file_slurp (CameraFile*, char *data,
00147 size_t size, size_t *readlen);
00148 int gp_file_set_data_and_size (CameraFile*, char *data,
00149 unsigned long int size);
00150 int gp_file_get_data_and_size (CameraFile*, const char **data,
00151 unsigned long int *size);
00152
00153 #ifdef __cplusplus
00154 }
00155 #endif
00156
00157 #endif