libgphoto2 photo camera library (libgphoto2) API 2.4.11

- Main Page
- Related Pages
- Data Structures
- Files
- Directories

- File List
- Globals

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_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/avchd"
    00055
    00066 typedef enum {
    00067         GP_FILE_TYPE_PREVIEW,
    00068         GP_FILE_TYPE_NORMAL,
    00069         GP_FILE_TYPE_RAW,
    00072         GP_FILE_TYPE_AUDIO,
    00073         GP_FILE_TYPE_EXIF,
    00074         GP_FILE_TYPE_METADATA
    00075 } CameraFileType;
    00076
    00083 typedef enum {
    00084         GP_FILE_ACCESSTYPE_MEMORY,
    00085         GP_FILE_ACCESSTYPE_FD
    00086 } CameraFileAccessType;
    00087
    00094 typedef struct _CameraFile CameraFile;
    00095
    00096 int gp_file_new            (CameraFile **file);
    00097 int gp_file_new_from_fd    (CameraFile **file, int fd);
    00098 int gp_file_ref            (CameraFile *file);
    00099 int gp_file_unref          (CameraFile *file);
    00100 int gp_file_free           (CameraFile *file);
    00101
    00102 /* "Do not use those"
    00103  *
    00104  * These functions probably were originally intended for internal use only.
    00105  * However, due to
    00106  *   - the lack of good documentation
    00107  *   - this being the obvious way to save a file
    00108  *   - the fact that libgphoto2 has been exporting all its internal
    00109  *     symbols for years (until 2005-06)
    00110  *   - our in-house frontends gphoto2 and gtkam using them
    00111  * a number of external frontends started to use these functions, as
    00112  * of 2005-06:
    00113  *    - digikam
    00114  *    - f-spot
    00115  *    - gthumb
    00116  * But a few frontends can live without it (and thus are likely to
    00117  * use the correct API):
    00118  *    - flphoto
    00119  *    - kamera
    00120  *
    00121  * So we're going to phase these functions out over the next year or
    00122  * so, going the GTK way of keeping the ABI but breaking the API. So
    00123  * we'll continue to export functionally equivalent functions, but the
    00124  * header files will not contain definitions for you to use any more.
    00125  */
    00126 int gp_file_open           (CameraFile *file, const char *filename);
    00127 int gp_file_save           (CameraFile *file, const char *filename);
    00128 int gp_file_clean          (CameraFile *file);
    00129 int gp_file_copy           (CameraFile *destination, CameraFile *source);
    00130
    00131 int gp_file_set_name       (CameraFile *file, const char  *name);
    00132 int gp_file_get_name       (CameraFile *file, const char **name);
    00133
    00134 int gp_file_set_mime_type  (CameraFile *file, const char  *mime_type);
    00135 int gp_file_get_mime_type  (CameraFile *file, const char **mime_type);
    00136
    00137 int gp_file_set_type       (CameraFile *file, CameraFileType  type);
    00138 int gp_file_get_type       (CameraFile *file, CameraFileType *type);
    00139
    00140 int gp_file_set_mtime   (CameraFile *file, time_t  mtime);
    00141 int gp_file_get_mtime   (CameraFile *file, time_t *mtime);
    00142
    00143 int gp_file_detect_mime_type          (CameraFile *file);
    00144 int gp_file_adjust_name_for_mime_type (CameraFile *file);
    00145
    00146 int gp_file_append            (CameraFile*, const char *data,
    00147                                unsigned long int size);
    00148 int gp_file_slurp             (CameraFile*, char *data,
    00149                                size_t size, size_t *readlen);
    00150 int gp_file_set_data_and_size (CameraFile*,       char *data,
    00151                                unsigned long int size);
    00152 int gp_file_get_data_and_size (CameraFile*, const char **data,
    00153                                unsigned long int *size);
    00154
    00155 #ifdef __cplusplus
    00156 }
    00157 #endif /* __cplusplus */
    00158
    00159 #endif /* __GPHOTO2_FILE_H__ */