gphoto2-file.h
Go to the documentation of this file.
#ifndef __GPHOTO2_FILE_H__
#define __GPHOTO2_FILE_H__
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GP_MIME_WAV "audio/wav"
#define GP_MIME_RAW "image/x-raw"
#define GP_MIME_PNG "image/png"
#define GP_MIME_PGM "image/x-portable-graymap"
#define GP_MIME_PPM "image/x-portable-pixmap"
#define GP_MIME_PNM "image/x-portable-anymap"
#define GP_MIME_JPEG "image/jpeg"
#define GP_MIME_TIFF "image/tiff"
#define GP_MIME_BMP "image/bmp"
#define GP_MIME_QUICKTIME "video/quicktime"
#define GP_MIME_AVI "video/x-msvideo"
#define GP_MIME_CRW "image/x-canon-raw"
#define GP_MIME_CR2 "image/x-canon-cr2"
#define GP_MIME_UNKNOWN "application/octet-stream"
#define GP_MIME_EXIF "application/x-exif"
#define GP_MIME_MP3 "audio/mpeg"
#define GP_MIME_OGG "application/ogg"
#define GP_MIME_WMA "audio/x-wma"
#define GP_MIME_ASF "audio/x-asf"
#define GP_MIME_MPEG "video/mpeg"
#define GP_MIME_AVCHD "video/avchd"
typedef enum {
GP_FILE_TYPE_PREVIEW,
GP_FILE_TYPE_NORMAL,
GP_FILE_TYPE_RAW,
GP_FILE_TYPE_AUDIO,
GP_FILE_TYPE_EXIF,
GP_FILE_TYPE_METADATA
} CameraFileType;
typedef enum {
GP_FILE_ACCESSTYPE_MEMORY,
GP_FILE_ACCESSTYPE_FD
} CameraFileAccessType;
typedef struct _CameraFile CameraFile;
int gp_file_new (CameraFile **file);
int gp_file_new_from_fd (CameraFile **file, int fd);
int gp_file_ref (CameraFile *file);
int gp_file_unref (CameraFile *file);
int gp_file_free (CameraFile *file);
/* "Do not use those"
*
* These functions probably were originally intended for internal use only.
* However, due to
* - the lack of good documentation
* - this being the obvious way to save a file
* - the fact that libgphoto2 has been exporting all its internal
* symbols for years (until 2005-06)
* - our in-house frontends gphoto2 and gtkam using them
* a number of external frontends started to use these functions, as
* of 2005-06:
* - digikam
* - f-spot
* - gthumb
* But a few frontends can live without it (and thus are likely to
* use the correct API):
* - flphoto
* - kamera
*
* So we're going to phase these functions out over the next year or
* so, going the GTK way of keeping the ABI but breaking the API. So
* we'll continue to export functionally equivalent functions, but the
* header files will not contain definitions for you to use any more.
*/
int gp_file_open (CameraFile *file, const char *filename);
int gp_file_save (CameraFile *file, const char *filename);
int gp_file_clean (CameraFile *file);
int gp_file_copy (CameraFile *destination, CameraFile *source);
int gp_file_set_name (CameraFile *file, const char *name);
int gp_file_get_name (CameraFile *file, const char **name);
int gp_file_set_mime_type (CameraFile *file, const char *mime_type);
int gp_file_get_mime_type (CameraFile *file, const char **mime_type);
int gp_file_set_type (CameraFile *file, CameraFileType type);
int gp_file_get_type (CameraFile *file, CameraFileType *type);
int gp_file_set_mtime (CameraFile *file, time_t mtime);
int gp_file_get_mtime (CameraFile *file, time_t *mtime);
int gp_file_detect_mime_type (CameraFile *file);
int gp_file_adjust_name_for_mime_type (CameraFile *file);
int gp_file_append (CameraFile*, const char *data,
unsigned long int size);
int gp_file_slurp (CameraFile*, char *data,
size_t size, size_t *readlen);
int gp_file_set_data_and_size (CameraFile*, char *data,
unsigned long int size);
int gp_file_get_data_and_size (CameraFile*, const char **data,
unsigned long int *size);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GPHOTO2_FILE_H__ */
gp_file_set_mtime
int gp_file_set_mtime(CameraFile *file, time_t mtime)
Definition: gphoto2-file.c:1012
GP_FILE_TYPE_NORMAL
Definition: gphoto2-file.h:68
GP_FILE_ACCESSTYPE_FD
Definition: gphoto2-file.h:85
gp_file_get_mtime
int gp_file_get_mtime(CameraFile *file, time_t *mtime)
Definition: gphoto2-file.c:995
gp_file_get_name
int gp_file_get_name(CameraFile *file, const char **name)
Definition: gphoto2-file.c:793
GP_FILE_TYPE_PREVIEW
Definition: gphoto2-file.h:67
GP_FILE_TYPE_EXIF
Definition: gphoto2-file.h:73
gp_file_set_mime_type
int gp_file_set_mime_type(CameraFile *file, const char *mime_type)
Definition: gphoto2-file.c:844
gp_file_unref
int gp_file_unref(CameraFile *file)
Decrease reference counter for CameraFile object.
Definition: gphoto2-file.c:167
gp_file_detect_mime_type
int gp_file_detect_mime_type(CameraFile *file)
Definition: gphoto2-file.c:860
gp_file_append
int gp_file_append(CameraFile *file, const char *data, unsigned long int size)
Definition: gphoto2-file.c:188
gp_file_copy
int gp_file_copy(CameraFile *destination, CameraFile *source)
Definition: gphoto2-file.c:661
gp_file_set_name
int gp_file_set_name(CameraFile *file, const char *name)
Definition: gphoto2-file.c:827
GP_FILE_TYPE_METADATA
Definition: gphoto2-file.h:74
GP_FILE_TYPE_RAW
Definition: gphoto2-file.h:69
CameraFile
File structure.
gp_file_save
int gp_file_save(CameraFile *file, const char *filename)
Definition: gphoto2-file.c:418
gp_file_clean
int gp_file_clean(CameraFile *file)
Definition: gphoto2-file.c:630
gp_file_get_mime_type
int gp_file_get_mime_type(CameraFile *file, const char **mime_type)
Definition: gphoto2-file.c:810
gp_file_get_data_and_size
int gp_file_get_data_and_size(CameraFile *file, const char **data, unsigned long int *size)
Definition: gphoto2-file.c:350
gp_file_get_type
int gp_file_get_type(CameraFile *file, CameraFileType *type)
Definition: gphoto2-file.c:978
GP_FILE_TYPE_AUDIO
Definition: gphoto2-file.h:72
gp_file_slurp
int gp_file_slurp(CameraFile *file, char *data, size_t size, size_t *readlen)
Definition: gphoto2-file.c:240
gp_file_new_from_fd
int gp_file_new_from_fd(CameraFile **file, int fd)
Definition: gphoto2-file.c:107
gp_file_ref
int gp_file_ref(CameraFile *file)
Increase reference counter for CameraFile object.
Definition: gphoto2-file.c:150
gp_file_set_type
int gp_file_set_type(CameraFile *file, CameraFileType type)
Definition: gphoto2-file.c:961
GP_FILE_ACCESSTYPE_MEMORY
Definition: gphoto2-file.h:84
gp_file_free
int gp_file_free(CameraFile *file)
descruct a CameraFile object.
Definition: gphoto2-file.c:130
gp_file_new
int gp_file_new(CameraFile **file)
Definition: gphoto2-file.c:83
gp_file_set_data_and_size
int gp_file_set_data_and_size(CameraFile *file, char *data, unsigned long int size)
Definition: gphoto2-file.c:288
CameraFileAccessType
CameraFileAccessType
File storage type.
Definition: gphoto2-file.h:83
gp_file_adjust_name_for_mime_type
int gp_file_adjust_name_for_mime_type(CameraFile *file)
Definition: gphoto2-file.c:914
CameraFileType
CameraFileType
The type of view on the specified file.
Definition: gphoto2-file.h:66
gp_file_open
int gp_file_open(CameraFile *file, const char *filename)
Definition: gphoto2-file.c:511
_CameraFile
Definition: gphoto2-file.c:58