libgphoto2 (libgphoto2): libgphoto2/gphoto2-file.h Source File

Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# gphoto2-file.h

Go to the documentation of this file.

    00001
    00021 #ifndef __GPHOTO2_FILE_H__
    00022 #define __GPHOTO2_FILE_H__
    00023
    00024 #include <time.h>
    00025
    00026 #ifdef __cplusplus
    00027 extern "C" {
    00028 #endif /* __cplusplus */
    00029
    00030 #define GP_MIME_WAV       "audio/wav"
    00031 #define GP_MIME_RAW       "image/x-raw"
    00032 #define GP_MIME_PNG       "image/png"
    00033 #define GP_MIME_PGM       "image/x-portable-graymap"
    00034 #define GP_MIME_PPM       "image/x-portable-pixmap"
    00035 #define GP_MIME_PNM       "image/x-portable-anymap"
    00036 #define GP_MIME_JPEG      "image/jpeg"
    00037 #define GP_MIME_TIFF      "image/tiff"
    00038 #define GP_MIME_BMP       "image/bmp"
    00039 #define GP_MIME_QUICKTIME "video/quicktime"
    00040 #define GP_MIME_AVI       "video/x-msvideo"
    00041 #define GP_MIME_CRW       "image/x-canon-raw"
    00042 #define GP_MIME_UNKNOWN   "application/octet-stream"
    00043 #define GP_MIME_EXIF      "application/x-exif"
    00044 #define GP_MIME_MP3       "audio/mpeg"
    00045 #define GP_MIME_OGG       "application/ogg"
    00046 #define GP_MIME_WMA       "audio/x-wma"
    00047 #define GP_MIME_ASF       "audio/x-asf"
    00048 #define GP_MIME_MPEG      "video/mpeg"
    00049
    00050 typedef enum {
    00051         GP_FILE_TYPE_PREVIEW,
    00052         GP_FILE_TYPE_NORMAL,
    00053         GP_FILE_TYPE_RAW,
    00054         GP_FILE_TYPE_AUDIO,
    00055         GP_FILE_TYPE_EXIF,
    00056         GP_FILE_TYPE_METADATA
    00057 } CameraFileType;
    00058
    00064 typedef struct _CameraFile CameraFile;
    00065
    00066 int gp_file_new            (CameraFile **file);
    00067 int gp_file_ref            (CameraFile *file);
    00068 int gp_file_unref          (CameraFile *file);
    00069 int gp_file_free           (CameraFile *file);
    00070
    00071 /* "Do not use those"
    00072  *
    00073  * These functions probably were originally intended for internal use only.
    00074  * However, due to
    00075  *   - the lack of good documentation
    00076  *   - this being the obvious way to save a file
    00077  *   - the fact that libgphoto2 has been exporting all its internal
    00078  *     symbols for years (until 2005-06)
    00079  *   - our in-house frontends gphoto2 and gtkam using them
    00080  * a number of external frontends started to use these functions, as
    00081  * of 2005-06:
    00082  *    - digikam
    00083  *    - f-spot
    00084  *    - gthumb
    00085  * But a few frontends can live without it (and thus are likely to
    00086  * use the correct API):
    00087  *    - flphoto
    00088  *    - kamera
    00089  *
    00090  * So we're going to phase these functions out over the next year or
    00091  * so, going the GTK way of keeping the ABI but breaking the API. So
    00092  * we'll continue to export functionally equivalent functions, but the
    00093  * header files will not contain definitions for you to use any more.
    00094  */
    00095 int gp_file_open           (CameraFile *file, const char *filename);
    00096 int gp_file_save           (CameraFile *file, const char *filename);
    00097 int gp_file_clean          (CameraFile *file);
    00098 int gp_file_copy           (CameraFile *destination, CameraFile *source);
    00099
    00100 int gp_file_set_name       (CameraFile *file, const char  *name);
    00101 int gp_file_get_name       (CameraFile *file, const char **name);
    00102
    00103 int gp_file_set_mime_type  (CameraFile *file, const char  *mime_type);
    00104 int gp_file_get_mime_type  (CameraFile *file, const char **mime_type);
    00105
    00106 int gp_file_set_type       (CameraFile *file, CameraFileType  type);
    00107 int gp_file_get_type       (CameraFile *file, CameraFileType *type);
    00108
    00109 int gp_file_set_mtime   (CameraFile *file, time_t  mtime);
    00110 int gp_file_get_mtime   (CameraFile *file, time_t *mtime);
    00111
    00112 int gp_file_detect_mime_type          (CameraFile *file);
    00113 int gp_file_adjust_name_for_mime_type (CameraFile *file);
    00114
    00115 int gp_file_append            (CameraFile*, const char *data,
    00116                                unsigned long int size);
    00117 int gp_file_set_data_and_size (CameraFile*,       char *data,
    00118                                unsigned long int size);
    00119 int gp_file_get_data_and_size (CameraFile*, const char **data,
    00120                                unsigned long int *size);
    00121
    00122 /* Conversion */
    00123
    00124 /*
    00125  * Please don't use the following in front-ends and camera drivers that are
    00126  * not in gphoto CVS. We need to do some more work here, and this part of
    00127  * the API is subject to change.
    00128  *
    00129  * If you like to do some work on conversion raw -> image/ *, please
    00130  * step forward and write to gphoto-devel@lists.sourceforge.net.
    00131  */
    00132 typedef enum {
    00133         GP_FILE_CONVERSION_METHOD_CHUCK
    00134 } CameraFileConversionMethod;
    00135
    00136 int gp_file_set_color_table  (CameraFile *file,
    00137                               const unsigned char *red_table,   int red_size,
    00138                               const unsigned char *green_table, int green_size,
    00139                               const unsigned char *blue_table,  int blue_size);
    00140 int gp_file_set_width_and_height  (CameraFile *file, int width, int height);
    00141 int gp_file_set_header            (CameraFile *file, const char *header);
    00142 int gp_file_set_conversion_method (CameraFile *file,
    00143                                    CameraFileConversionMethod method);
    00144
    00145 int gp_file_convert (CameraFile *file, const char *mime_type);
    00146
    00147 #ifdef __cplusplus
    00148 }
    00149 #endif /* __cplusplus */
    00150
    00151 #endif /* __GPHOTO2_FILE_H__ */