# gphoto2-file.h

Go to the documentation of this file.

    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_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 /* "Do not use those"
    00101  *
    00102  * These functions probably were originally intended for internal use only.
    00103  * However, due to
    00104  *   - the lack of good documentation
    00105  *   - this being the obvious way to save a file
    00106  *   - the fact that libgphoto2 has been exporting all its internal
    00107  *     symbols for years (until 2005-06)
    00108  *   - our in-house frontends gphoto2 and gtkam using them
    00109  * a number of external frontends started to use these functions, as
    00110  * of 2005-06:
    00111  *    - digikam
    00112  *    - f-spot
    00113  *    - gthumb
    00114  * But a few frontends can live without it (and thus are likely to
    00115  * use the correct API):
    00116  *    - flphoto
    00117  *    - kamera
    00118  *
    00119  * So we're going to phase these functions out over the next year or
    00120  * so, going the GTK way of keeping the ABI but breaking the API. So
    00121  * we'll continue to export functionally equivalent functions, but the
    00122  * header files will not contain definitions for you to use any more.
    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 /* __cplusplus */
    00156
    00157 #endif /* __GPHOTO2_FILE_H__ */