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 
00045 typedef enum {
00046         GP_FILE_TYPE_PREVIEW,
00047         GP_FILE_TYPE_NORMAL,
00048         GP_FILE_TYPE_RAW,
00049         GP_FILE_TYPE_AUDIO,
00050         GP_FILE_TYPE_EXIF
00051 } CameraFileType;
00052 
00058 typedef struct _CameraFile CameraFile;
00059 
00060 int gp_file_new            (CameraFile **file);
00061 int gp_file_ref            (CameraFile *file);
00062 int gp_file_unref          (CameraFile *file);
00063 int gp_file_free           (CameraFile *file);
00064 
00065 /* "Do not use those"
00066  *
00067  * These functions probably were originally intended for internal use only.
00068  * However, due to
00069  *   - the lack of good documentation
00070  *   - this being the obvious way to save a file
00071  *   - the fact that libgphoto2 has been exporting all its internal
00072  *     symbols for years (until 2005-06)
00073  *   - our in-house frontends gphoto2 and gtkam using them
00074  * a number of external frontends started to use these functions, as
00075  * of 2005-06:
00076  *    - digikam
00077  *    - f-spot
00078  *    - gthumb
00079  * But a few frontends can live without it (and thus are likely to
00080  * use the correct API):
00081  *    - flphoto
00082  *    - kamera
00083  *
00084  * So we're going to phase these functions out over the next year or
00085  * so, going the GTK way of keeping the ABI but breaking the API. So
00086  * we'll continue to export functionally equivalent functions, but the
00087  * header files will not contain definitions for you to use any more.
00088  */
00089 int gp_file_open           (CameraFile *file, const char *filename);
00090 int gp_file_save           (CameraFile *file, const char *filename);
00091 int gp_file_clean          (CameraFile *file);
00092 int gp_file_copy           (CameraFile *destination, CameraFile *source);
00093 
00094 int gp_file_set_name       (CameraFile *file, const char  *name);
00095 int gp_file_get_name       (CameraFile *file, const char **name);
00096 
00097 int gp_file_set_mime_type  (CameraFile *file, const char  *mime_type);
00098 int gp_file_get_mime_type  (CameraFile *file, const char **mime_type);
00099 
00100 int gp_file_set_type       (CameraFile *file, CameraFileType  type);
00101 int gp_file_get_type       (CameraFile *file, CameraFileType *type);
00102 
00103 int gp_file_set_mtime   (CameraFile *file, time_t  mtime);
00104 int gp_file_get_mtime   (CameraFile *file, time_t *mtime);
00105 
00106 int gp_file_detect_mime_type          (CameraFile *file);
00107 int gp_file_adjust_name_for_mime_type (CameraFile *file);
00108 
00109 int gp_file_append            (CameraFile*, const char *data,
00110                                unsigned long int size);
00111 int gp_file_set_data_and_size (CameraFile*,       char *data,
00112                                unsigned long int size);
00113 int gp_file_get_data_and_size (CameraFile*, const char **data,
00114                                unsigned long int *size);
00115 
00116 /* Conversion */
00117 
00118 /*
00119  * Please don't use the following in front-ends and camera drivers that are
00120  * not in gphoto CVS. We need to do some more work here, and this part of
00121  * the API is subject to change.
00122  *
00123  * If you like to do some work on conversion raw -> image/ *, please
00124  * step forward and write to gphoto-devel@lists.sourceforge.net.
00125  */
00126 typedef enum {
00127         GP_FILE_CONVERSION_METHOD_CHUCK
00128 } CameraFileConversionMethod;
00129 
00130 int gp_file_set_color_table  (CameraFile *file,
00131                               const unsigned char *red_table,   int red_size,
00132                               const unsigned char *green_table, int green_size,
00133                               const unsigned char *blue_table,  int blue_size);
00134 int gp_file_set_width_and_height  (CameraFile *file, int width, int height);
00135 int gp_file_set_header            (CameraFile *file, const char *header);
00136 int gp_file_set_conversion_method (CameraFile *file,
00137                                    CameraFileConversionMethod method);
00138 
00139 int gp_file_convert (CameraFile *file, const char *mime_type);
00140 
00141 #ifdef __cplusplus
00142 }
00143 #endif /* __cplusplus */
00144 
00145 #endif /* __GPHOTO2_FILE_H__ */

Generated on Wed Mar 8 19:02:41 2006 for libgphoto2 (libgphoto2) by  doxygen 1.4.6