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.0.5 | #define LIBMTP_VERSION 0.0.6 | |||
/* 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 44 | skipping to change at line 44 | |||
typedef __int16 int16_t; | typedef __int16 int16_t; | |||
typedef unsigned __int16 uint16_t; | typedef unsigned __int16 uint16_t; | |||
typedef __int32 int32_t; | typedef __int32 int32_t; | |||
typedef unsigned __int32 uint32_t; | typedef unsigned __int32 uint32_t; | |||
typedef unsigned __int64 uint64_t; | typedef unsigned __int64 uint64_t; | |||
#endif | #endif | |||
/** | /** | |||
* @defgroup types libnjb global type definitions | * @defgroup types libnjb global type definitions | |||
* @{ | * @{ | |||
* The filetypes defined here are the external types used | ||||
* by the libmtp library interface. The types used internally | ||||
* as PTP-defined enumerator types is something different. | ||||
*/ | */ | |||
typedef enum { | typedef enum { | |||
LIBMTP_FILETYPE_WAV, | LIBMTP_FILETYPE_WAV, | |||
LIBMTP_FILETYPE_MP3, | LIBMTP_FILETYPE_MP3, | |||
LIBMTP_FILETYPE_WMA, | LIBMTP_FILETYPE_WMA, | |||
LIBMTP_FILETYPE_OGG, | LIBMTP_FILETYPE_OGG, | |||
LIBMTP_FILETYPE_MP4, | LIBMTP_FILETYPE_MP4, | |||
LIBMTP_FILETYPE_UNDEF_AUDIO, | LIBMTP_FILETYPE_UNDEF_AUDIO, | |||
LIBMTP_FILETYPE_WMV, | LIBMTP_FILETYPE_WMV, | |||
LIBMTP_FILETYPE_AVI, | LIBMTP_FILETYPE_AVI, | |||
LIBMTP_FILETYPE_MPEG, | LIBMTP_FILETYPE_MPEG, | |||
LIBMTP_FILETYPE_ASF, | LIBMTP_FILETYPE_ASF, | |||
LIBMTP_FILETYPE_QT, | LIBMTP_FILETYPE_QT, | |||
LIBMTP_FILETYPE_UNDEF_VIDEO, | LIBMTP_FILETYPE_UNDEF_VIDEO, | |||
LIBMTP_FILETYPE_JPEG, | ||||
LIBMTP_FILETYPE_JFIF, | LIBMTP_FILETYPE_JFIF, | |||
LIBMTP_FILETYPE_TIFF, | LIBMTP_FILETYPE_TIFF, | |||
LIBMTP_FILETYPE_BMP, | LIBMTP_FILETYPE_BMP, | |||
LIBMTP_FILETYPE_GIF, | LIBMTP_FILETYPE_GIF, | |||
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_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_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_mtpfo | typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folde | |||
lder_t */ | r_t */ | |||
typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_objec | ||||
t_t */ | ||||
/** @} */ | /** @} */ | |||
/** | /** | |||
* A data structure to hold MTP device entries | * A data structure to hold MTP device entries | |||
*/ | */ | |||
struct LIBMTP_device_entry_struct { | struct LIBMTP_device_entry_struct { | |||
char *name; /**< The descriptive name of this device */ | char *name; /**< The descriptive name of this device */ | |||
uint16_t vendor_id; /**< Vendor ID for this device */ | uint16_t vendor_id; /**< Vendor ID for this device */ | |||
uint16_t product_id; /**< Product ID for this device */ | uint16_t product_id; /**< Product ID for this device */ | |||
}; | }; | |||
skipping to change at line 153 | skipping to change at line 158 | |||
* MTP Folder structure | * MTP Folder structure | |||
*/ | */ | |||
struct LIBMTP_folder_struct { | struct LIBMTP_folder_struct { | |||
uint32_t folder_id; /**< Unique folder ID */ | uint32_t folder_id; /**< Unique folder ID */ | |||
uint32_t parent_id; /**< ID of parent folder */ | uint32_t parent_id; /**< ID of parent folder */ | |||
char *name; /**< Name of folder */ | char *name; /**< Name of folder */ | |||
LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no mo re */ | LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no mo re */ | |||
LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ | LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ | |||
}; | }; | |||
/** | ||||
* LIBMTP Object Structure | ||||
*/ | ||||
struct LIBMTP_object_struct { | ||||
uint32_t id; | ||||
uint32_t parent; | ||||
uint32_t type; | ||||
uint32_t size; | ||||
char *name; | ||||
void *data; | ||||
LIBMTP_object_t *sibling; | ||||
LIBMTP_object_t *child; | ||||
}; | ||||
/* Make functions available for C++ */ | /* Make functions available for C++ */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* 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 | |||
skipping to change at line 254 | skipping to change at line 273 | |||
* @defgroup folders The folder management API. | * @defgroup folders The folder management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
LIBMTP_folder_t *LIBMTP_new_folder_t(void); | LIBMTP_folder_t *LIBMTP_new_folder_t(void); | |||
void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); | void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); | |||
LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); | LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); | |||
LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); | LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); | |||
uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char * , uint32_t); | uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char * , uint32_t); | |||
/** @} */ | /** @} */ | |||
/** | ||||
* @} | ||||
* @defgroup objects The object management API. | ||||
* @{ | ||||
*/ | ||||
char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *,uint32_t, uint32_t | ||||
, char); | ||||
uint32_t LIBMTP_Get_U32_From_Object(LIBMTP_mtpdevice_t *,uint32_t, uint32_t | ||||
, uint32_t); | ||||
uint16_t LIBMTP_Get_U16_From_Object(LIBMTP_mtpdevice_t *,uint32_t, uint32_t | ||||
, uint16_t); | ||||
int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *,uint32_t, uint32_t, char | ||||
*, int); | ||||
int LIBMTP_Set_Object_U32(LIBMTP_mtpdevice_t *,uint32_t, uint32_t, uint32_t | ||||
); | ||||
int LIBMTP_Set_Object_U16(LIBMTP_mtpdevice_t *,uint32_t, uint32_t, uint16_t | ||||
); | ||||
int LIBMTP_Get_Object_References(LIBMTP_mtpdevice_t *, uint32_t, uint32_t * | ||||
*, uint32_t *); | ||||
int LIBMTP_Set_Object_References(LIBMTP_mtpdevice_t *, uint32_t, uint32_t * | ||||
, uint32_t); | ||||
LIBMTP_object_t *LIBMTP_Make_List(LIBMTP_mtpdevice_t *, uint32_t *, uint32_ | ||||
t, uint32_t *, uint32_t); | ||||
LIBMTP_object_t *LIBMTP_Find_Object(LIBMTP_object_t *, uint32_t); | ||||
void LIBMTP_Dump_List(LIBMTP_object_t *); | ||||
LIBMTP_object_t *LIBMTP_new_object_t(void); | ||||
void LIBMTP_destroy_object_t(LIBMTP_object_t *, uint32_t); | ||||
/** @} */ | ||||
/** | ||||
* @} | ||||
* @defgroup File mapping The file mapping API | ||||
* @{ | ||||
*/ | ||||
int LIBMTP_Register_Filetype(char *, LIBMTP_filetype_t, uint16_t, void *, v | ||||
oid *, void *); | ||||
int LIBMTP_Set_Description(LIBMTP_filetype_t, char *); | ||||
int LIBMTP_Set_Constructor(LIBMTP_filetype_t, void *); | ||||
int LIBMTP_Set_Destructor(LIBMTP_filetype_t, void *); | ||||
int LIBMTP_Set_Datafunc(LIBMTP_filetype_t, void *); | ||||
/** @} */ | ||||
/* End of C++ exports */ | /* End of C++ exports */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* LIBMTP_H_INCLUSION_GUARD */ | #endif /* LIBMTP_H_INCLUSION_GUARD */ | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 65 lines changed or added | |||