added new file -> programmatic handler defines and types

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11974 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2009-04-13 19:14:41 +00:00
parent 377e7b0d61
commit e42642e6af

View File

@@ -27,6 +27,7 @@
#define __GPHOTO2_FILE_H__
#include <time.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -81,9 +82,19 @@ typedef enum {
*/
typedef enum {
GP_FILE_ACCESSTYPE_MEMORY, /**< File is in system memory. */
GP_FILE_ACCESSTYPE_FD /**< File is associated with a UNIX filedescriptor. */
GP_FILE_ACCESSTYPE_FD, /**< File is associated with a UNIX filedescriptor. */
GP_FILE_ACCESSTYPE_HANDLER /**< File is associated with a programmatic handler. */
} CameraFileAccessType;
/* FIXME: api might be unstable. function return gphoto results codes. */
typedef struct _CameraFileHandler {
int (*size) (void*priv, uint64_t *size); /* only for read? */
int (*read) (void*priv, unsigned char *data, uint64_t *len);
int (*write) (void*priv, unsigned char *data, uint64_t *len);
/* FIXME: should we have both read/write methods? */
/* FIXME: how to finish method, due to LRU it might be longlived. */
} CameraFileHandler;
/*! \struct CameraFile
* \brief File structure.
*
@@ -94,6 +105,7 @@ typedef struct _CameraFile CameraFile;
int gp_file_new (CameraFile **file);
int gp_file_new_from_fd (CameraFile **file, int fd);
int gp_file_new_from_handler (CameraFile **file, CameraFileHandler *handler, void*priv);
int gp_file_ref (CameraFile *file);
int gp_file_unref (CameraFile *file);
int gp_file_free (CameraFile *file);