diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2009-04-13 19:14:41 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2009-04-13 19:14:41 +0000 |
commit | e42642e6af2b81d5eadca0a70aed91af3ee2d8cd (patch) | |
tree | d0df053e0a3a6a12741f66d2326ec4b34aaad423 /gphoto2 | |
parent | 377e7b0d61b2141ed03b682ebbe8a546370be7ed (diff) | |
download | libgphoto2-e42642e6af2b81d5eadca0a70aed91af3ee2d8cd.tar.gz |
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
Diffstat (limited to 'gphoto2')
-rw-r--r-- | gphoto2/gphoto2-file.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gphoto2/gphoto2-file.h b/gphoto2/gphoto2-file.h index 4ee887fbd..51beb82fb 100644 --- a/gphoto2/gphoto2-file.h +++ b/gphoto2/gphoto2-file.h @@ -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); |