libgphoto2 photo camera library (libgphoto2) API  2.4.14
gphoto2-file.h
Go to the documentation of this file.
1 
25 #ifndef __GPHOTO2_FILE_H__
26 #define __GPHOTO2_FILE_H__
27 
28 #include <time.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33 
34 #define GP_MIME_WAV "audio/wav"
35 #define GP_MIME_RAW "image/x-raw"
36 #define GP_MIME_PNG "image/png"
37 #define GP_MIME_PGM "image/x-portable-graymap"
38 #define GP_MIME_PPM "image/x-portable-pixmap"
39 #define GP_MIME_PNM "image/x-portable-anymap"
40 #define GP_MIME_JPEG "image/jpeg"
41 #define GP_MIME_TIFF "image/tiff"
42 #define GP_MIME_BMP "image/bmp"
43 #define GP_MIME_QUICKTIME "video/quicktime"
44 #define GP_MIME_AVI "video/x-msvideo"
45 #define GP_MIME_CRW "image/x-canon-raw"
46 #define GP_MIME_CR2 "image/x-canon-cr2"
47 #define GP_MIME_UNKNOWN "application/octet-stream"
48 #define GP_MIME_EXIF "application/x-exif"
49 #define GP_MIME_MP3 "audio/mpeg"
50 #define GP_MIME_OGG "application/ogg"
51 #define GP_MIME_WMA "audio/x-wma"
52 #define GP_MIME_ASF "audio/x-asf"
53 #define GP_MIME_MPEG "video/mpeg"
54 #define GP_MIME_AVCHD "video/mp2t"
55 #define GP_MIME_RW2 "image/x-panasonic-raw2"
56 
67 typedef enum {
77 
84 typedef enum {
88 
95 typedef struct _CameraFile CameraFile;
96 
97 int gp_file_new (CameraFile **file);
98 int gp_file_new_from_fd (CameraFile **file, int fd);
99 int gp_file_ref (CameraFile *file);
100 int gp_file_unref (CameraFile *file);
101 int gp_file_free (CameraFile *file);
102 
103 /* "Do not use those"
104  *
105  * These functions probably were originally intended for internal use only.
106  * However, due to
107  * - the lack of good documentation
108  * - this being the obvious way to save a file
109  * - the fact that libgphoto2 has been exporting all its internal
110  * symbols for years (until 2005-06)
111  * - our in-house frontends gphoto2 and gtkam using them
112  * a number of external frontends started to use these functions, as
113  * of 2005-06:
114  * - digikam
115  * - f-spot
116  * - gthumb
117  * But a few frontends can live without it (and thus are likely to
118  * use the correct API):
119  * - flphoto
120  * - kamera
121  *
122  * So we're going to phase these functions out over the next year or
123  * so, going the GTK way of keeping the ABI but breaking the API. So
124  * we'll continue to export functionally equivalent functions, but the
125  * header files will not contain definitions for you to use any more.
126  */
127 int gp_file_open (CameraFile *file, const char *filename);
128 int gp_file_save (CameraFile *file, const char *filename);
129 int gp_file_clean (CameraFile *file);
130 int gp_file_copy (CameraFile *destination, CameraFile *source);
131 
132 int gp_file_set_name (CameraFile *file, const char *name);
133 int gp_file_get_name (CameraFile *file, const char **name);
134 
135 int gp_file_set_mime_type (CameraFile *file, const char *mime_type);
136 int gp_file_get_mime_type (CameraFile *file, const char **mime_type);
137 
138 int gp_file_set_type (CameraFile *file, CameraFileType type);
139 int gp_file_get_type (CameraFile *file, CameraFileType *type);
140 
141 int gp_file_set_mtime (CameraFile *file, time_t mtime);
142 int gp_file_get_mtime (CameraFile *file, time_t *mtime);
143 
146 
147 int gp_file_append (CameraFile*, const char *data,
148  unsigned long int size);
149 int gp_file_slurp (CameraFile*, char *data,
150  size_t size, size_t *readlen);
151 int gp_file_set_data_and_size (CameraFile*, char *data,
152  unsigned long int size);
153 int gp_file_get_data_and_size (CameraFile*, const char **data,
154  unsigned long int *size);
155 
156 #ifdef __cplusplus
157 }
158 #endif /* __cplusplus */
159 
160 #endif /* __GPHOTO2_FILE_H__ */