|
libgphoto2 photo camera library (libgphoto2) API
2.5.22
|
#include "config.h"#include <gphoto2/gphoto2-file.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <string.h>#include <sys/stat.h>#include <utime.h>#include <gphoto2/gphoto2-port-log.h>#include <gphoto2/gphoto2-port-portability.h>#include <gphoto2/gphoto2-result.h>
Data Structures | |
| struct | _CameraFile |
Macros | |
| #define | _POSIX_SOURCE |
| #define | _DEFAULT_SOURCE |
| #define | CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);} |
| #define | MAX_PATH 256 |
Functions | |
| 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 *private) |
| int | gp_file_free (CameraFile *file) |
| descruct a CameraFile object. More... | |
| int | gp_file_ref (CameraFile *file) |
| Increase reference counter for CameraFile object. More... | |
| int | gp_file_unref (CameraFile *file) |
| Decrease reference counter for CameraFile object. More... | |
| int | gp_file_append (CameraFile *file, const char *data, unsigned long int size) |
| int | gp_file_slurp (CameraFile *file, char *data, size_t size, size_t *readlen) |
| int | gp_file_set_data_and_size (CameraFile *file, char *data, unsigned long int size) |
| int | gp_file_get_data_and_size (CameraFile *file, const char **data, unsigned long int *size) |
| int | gp_file_save (CameraFile *file, const char *filename) |
| int | gp_file_open (CameraFile *file, const char *filename) |
| int | gp_file_clean (CameraFile *file) |
| int | gp_file_copy (CameraFile *destination, CameraFile *source) |
| int | gp_file_get_name (CameraFile *file, const char **name) |
| int | gp_file_get_name_by_type (CameraFile *file, const char *basename, CameraFileType type, char **newname) |
| int | gp_file_get_mime_type (CameraFile *file, const char **mime_type) |
| int | gp_file_set_name (CameraFile *file, const char *name) |
| int | gp_file_set_mime_type (CameraFile *file, const char *mime_type) |
| int | gp_file_detect_mime_type (CameraFile *file) |
| int | gp_file_adjust_name_for_mime_type (CameraFile *file) |
| int | gp_file_get_mtime (CameraFile *file, time_t *mtime) |
| int | gp_file_set_mtime (CameraFile *file, time_t mtime) |
| int gp_file_adjust_name_for_mime_type | ( | CameraFile * | file | ) |
| file | a CameraFile |
| int gp_file_append | ( | CameraFile * | file, |
| const char * | data, | ||
| unsigned long int | size | ||
| ) |
| file | a CameraFile |
| data | |
| size |
References GP_ERROR, GP_ERROR_IO_WRITE, GP_FILE_ACCESSTYPE_FD, GP_FILE_ACCESSTYPE_HANDLER, GP_FILE_ACCESSTYPE_MEMORY, and GP_OK.
| int gp_file_clean | ( | CameraFile * | file | ) |
| file | a CameraFile |
References GP_FILE_ACCESSTYPE_FD, GP_FILE_ACCESSTYPE_MEMORY, and GP_OK.
| int gp_file_copy | ( | CameraFile * | destination, |
| CameraFile * | source | ||
| ) |
| destination | a CameraFile |
| source | a CameraFile |
References GP_ERROR, GP_ERROR_IO, GP_ERROR_IO_READ, GP_ERROR_IO_WRITE, GP_FILE_ACCESSTYPE_FD, GP_FILE_ACCESSTYPE_HANDLER, GP_FILE_ACCESSTYPE_MEMORY, and GP_OK.
| int gp_file_detect_mime_type | ( | CameraFile * | file | ) |
| int gp_file_free | ( | CameraFile * | file | ) |
| int gp_file_get_data_and_size | ( | CameraFile * | file, |
| const char ** | data, | ||
| unsigned long int * | size | ||
| ) |
Get a pointer to the data and the file's size.
| file | a CameraFile |
| data | |
| size |
Both data and size can be NULL and will then be ignored.
For regular CameraFiles, the pointer to data that is returned is still owned by libgphoto2 and its lifetime is the same as the #file.
For filedescriptor or handler based CameraFile types, the returned data pointer is owned by the caller and needs to be free()d to avoid memory leaks.
References GP_ERROR, GP_ERROR_IO, GP_ERROR_IO_READ, GP_FILE_ACCESSTYPE_FD, GP_FILE_ACCESSTYPE_HANDLER, GP_FILE_ACCESSTYPE_MEMORY, and GP_OK.
| int gp_file_get_mime_type | ( | CameraFile * | file, |
| const char ** | mime_type | ||
| ) |
| file | a CameraFile |
| mime_type | a pointer to a MIME type string |
References GP_OK.
| int gp_file_get_mtime | ( | CameraFile * | file, |
| time_t * | mtime | ||
| ) |
| int gp_file_get_name | ( | CameraFile * | file, |
| const char ** | name | ||
| ) |
| file | a CameraFile |
| name | a pointer to a name string |
References GP_OK.
| int gp_file_get_name_by_type | ( | CameraFile * | file, |
| const char * | basename, | ||
| CameraFileType | type, | ||
| char ** | newname | ||
| ) | < |