libmtp.h | libmtp.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* | * | |||
* Interface to the Media Transfer Protocol library. | * Interface to the Media Transfer Protocol library. | |||
* | * | |||
* <code> | * <code> | |||
* #include <libmtp.h> | * #include <libmtp.h> | |||
* </code> | * </code> | |||
*/ | */ | |||
#ifndef LIBMTP_H_INCLUSION_GUARD | #ifndef LIBMTP_H_INCLUSION_GUARD | |||
#define LIBMTP_H_INCLUSION_GUARD | #define LIBMTP_H_INCLUSION_GUARD | |||
#define LIBMTP_VERSION 0.1.0 | #define LIBMTP_VERSION 0.1.1 | |||
/* This handles MSVC pecularities */ | /* This handles MSVC pecularities */ | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <windows.h> | #include <windows.h> | |||
#define __WIN32__ | #define __WIN32__ | |||
#define snprintf _snprintf | #define snprintf _snprintf | |||
#define ssize_t SSIZE_T | #define ssize_t SSIZE_T | |||
#endif | #endif | |||
#include <stdio.h> | #include <stdio.h> | |||
skipping to change at line 77 | skipping to change at line 77 | |||
LIBMTP_FILETYPE_PICT, | LIBMTP_FILETYPE_PICT, | |||
LIBMTP_FILETYPE_PNG, | LIBMTP_FILETYPE_PNG, | |||
LIBMTP_FILETYPE_VCALENDAR1, | LIBMTP_FILETYPE_VCALENDAR1, | |||
LIBMTP_FILETYPE_VCALENDAR2, | LIBMTP_FILETYPE_VCALENDAR2, | |||
LIBMTP_FILETYPE_VCARD2, | LIBMTP_FILETYPE_VCARD2, | |||
LIBMTP_FILETYPE_VCARD3, | LIBMTP_FILETYPE_VCARD3, | |||
LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, | LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, | |||
LIBMTP_FILETYPE_WINEXEC, | LIBMTP_FILETYPE_WINEXEC, | |||
LIBMTP_FILETYPE_TEXT, | LIBMTP_FILETYPE_TEXT, | |||
LIBMTP_FILETYPE_HTML, | LIBMTP_FILETYPE_HTML, | |||
LIBMTP_FILETYPE_FIRMWARE, | ||||
LIBMTP_FILETYPE_UNKNOWN | LIBMTP_FILETYPE_UNKNOWN | |||
} LIBMTP_filetype_t; | } LIBMTP_filetype_t; | |||
typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ | typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ | |||
typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP _mtpdevice_struct */ | typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP _mtpdevice_struct */ | |||
typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_stru ct */ | typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_stru ct */ | |||
typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_s truct */ | typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_s truct */ | |||
typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_p laylist_struct */ | typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_p laylist_struct */ | |||
typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_s truct */ | typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_s truct */ | |||
typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folde r_t */ | typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folde r_t */ | |||
typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_objec t_t */ | typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_objec t_t */ | |||
typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @ see LIBMTP_filesample_t */ | typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @ see LIBMTP_filesample_t */ | |||
typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @se e LIBMTP_devicestorage_t */ | ||||
/** | /** | |||
* The callback type definition. Notice that a progress percentage ratio | * The callback type definition. Notice that a progress percentage ratio | |||
* is easy to calculate by dividing <code>sent</code> by | * is easy to calculate by dividing <code>sent</code> by | |||
* <code>total</code>. | * <code>total</code>. | |||
* @param sent the number of bytes sent so far | * @param sent the number of bytes sent so far | |||
* @param total the total number of bytes to send | * @param total the total number of bytes to send | |||
* @param data a user-defined dereferencable pointer | * @param data a user-defined dereferencable pointer | |||
* @return if anything else than 0 is returned, the current transfer will b e | * @return if anything else than 0 is returned, the current transfer will b e | |||
* interrupted / cancelled. | * interrupted / cancelled. | |||
skipping to change at line 134 | skipping to change at line 136 | |||
/** | /** | |||
* Parameters for this device, must be cast into | * Parameters for this device, must be cast into | |||
* \c (PTPParams*) before internal use. | * \c (PTPParams*) before internal use. | |||
*/ | */ | |||
void *params; | void *params; | |||
/** | /** | |||
* USB device for this device, must be cast into | * USB device for this device, must be cast into | |||
* \c (PTP_USB*) before internal use. | * \c (PTP_USB*) before internal use. | |||
*/ | */ | |||
void *usbinfo; | void *usbinfo; | |||
/** The storage ID for this device */ | /** | |||
uint32_t storage_id; | * The storage for this device, do not use strings in here without | |||
* copying them first, and beware that this list may be rebuilt at | ||||
* any time. | ||||
*/ | ||||
LIBMTP_devicestorage_t *storage; | ||||
/** The maximum battery level for this device */ | /** The maximum battery level for this device */ | |||
uint8_t maximum_battery_level; | uint8_t maximum_battery_level; | |||
/** Default music folder */ | /** Default music folder */ | |||
uint32_t default_music_folder; | uint32_t default_music_folder; | |||
/** Default playlist folder */ | /** Default playlist folder */ | |||
uint32_t default_playlist_folder; | uint32_t default_playlist_folder; | |||
/** Default picture folder */ | /** Default picture folder */ | |||
uint32_t default_picture_folder; | uint32_t default_picture_folder; | |||
/** Default video folder */ | /** Default video folder */ | |||
uint32_t default_video_folder; | uint32_t default_video_folder; | |||
/** Default organizer folder */ | /** Default organizer folder */ | |||
uint32_t default_organizer_folder; | uint32_t default_organizer_folder; | |||
/** Default ZENcast folder (only Creative devices...) */ | /** Default ZENcast folder (only Creative devices...) */ | |||
uint32_t default_zencast_folder; | uint32_t default_zencast_folder; | |||
/** Default Album folder */ | /** Default Album folder */ | |||
uint32_t default_album_folder; | uint32_t default_album_folder; | |||
/** Default Text folder */ | ||||
uint32_t default_text_folder; | ||||
/** Per device iconv() converters, only used internally */ | /** Per device iconv() converters, only used internally */ | |||
void *cd; | void *cd; | |||
}; | }; | |||
/** | /** | |||
* MTP file struct | * MTP file struct | |||
*/ | */ | |||
struct LIBMTP_file_struct { | struct LIBMTP_file_struct { | |||
uint32_t item_id; /**< Unique item ID */ | uint32_t item_id; /**< Unique item ID */ | |||
uint32_t parent_id; /**< ID of parent folder */ | uint32_t parent_id; /**< ID of parent folder */ | |||
skipping to change at line 239 | skipping to change at line 247 | |||
*/ | */ | |||
struct LIBMTP_filesampledata_struct { | struct LIBMTP_filesampledata_struct { | |||
uint32_t width; /**< Width of sample if it is an image */ | uint32_t width; /**< Width of sample if it is an image */ | |||
uint32_t height; /**< Height of sample if it is an image */ | uint32_t height; /**< Height of sample if it is an image */ | |||
uint32_t duration; /**< Duration in milliseconds if it is audio */ | uint32_t duration; /**< Duration in milliseconds if it is audio */ | |||
LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ | LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ | |||
uint64_t size; /**< Size of sample data in bytes */ | uint64_t size; /**< Size of sample data in bytes */ | |||
char *data; /**< Sample data */ | char *data; /**< Sample data */ | |||
}; | }; | |||
/** | ||||
* LIBMTP Device Storage structure | ||||
*/ | ||||
struct LIBMTP_devicestorage_struct { | ||||
uint32_t id; /**< Unique ID for this storage */ | ||||
uint16_t StorageType; /**< Storage type */ | ||||
uint16_t FilesystemType; /**< Filesystem type */ | ||||
uint16_t AccessCapability; /**< Access capability */ | ||||
uint64_t MaxCapacity; /**< Maximum capability */ | ||||
uint64_t FreeSpaceInBytes; /**< Free space in bytes */ | ||||
uint64_t FreeSpaceInObjects; /**< Free space in objects */ | ||||
char *StorageDescription; /**< A brief description of this storage */ | ||||
char *VolumeIdentifier; /**< A volume identifier */ | ||||
LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until N | ||||
ULL */ | ||||
LIBMTP_devicestorage_t *prev; /**< Previous storage */ | ||||
}; | ||||
/** @} */ | /** @} */ | |||
/* Make functions available for C++ */ | /* Make functions available for C++ */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* @defgroup internals The libmtp internals API. | * @defgroup internals The libmtp internals API. | |||
* @{ | * @{ | |||
skipping to change at line 268 | skipping to change at line 293 | |||
LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | |||
void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); | void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); | |||
void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); | void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | |||
int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | |||
char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | |||
int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | |||
int LIBMTP_Get_Storageinfo(LIBMTP_mtpdevice_t *, uint64_t * const, | ||||
uint64_t * const, char ** const storage_description, | ||||
char ** const volume_label); | ||||
int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *); | ||||
int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | |||
uint8_t * const, | uint8_t * const, | |||
uint8_t * const); | uint8_t * const); | |||
int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | |||
int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | |||
int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); | int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); | |||
#define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 | ||||
#define LIBMTP_STORAGE_SORTBY_FREESPACE 1 | ||||
#define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 | ||||
int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); | ||||
int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); | ||||
/** | /** | |||
* @} | * @} | |||
* @defgroup files The file management API. | * @defgroup files The file management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
LIBMTP_file_t *LIBMTP_new_file_t(void); | LIBMTP_file_t *LIBMTP_new_file_t(void); | |||
void LIBMTP_destroy_file_t(LIBMTP_file_t*); | void LIBMTP_destroy_file_t(LIBMTP_file_t*); | |||
char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); | char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); | |||
LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); | LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); | |||
LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, | LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, | |||
End of changes. 8 change blocks. | ||||
7 lines changed or deleted | 36 lines changed or added | |||