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.21 | #define LIBMTP_VERSION 0.1.0 | |||
/* 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 84 | skipping to change at line 84 | |||
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_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_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 */ | ||||
/** | /** | |||
* 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 148 | skipping to change at line 150 | |||
/** 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 */ | ||||
uint32_t default_album_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 169 | skipping to change at line 173 | |||
uint64_t filesize; /**< Size of file in bytes */ | uint64_t filesize; /**< Size of file in bytes */ | |||
LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ | LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ | |||
LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ | LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ | |||
}; | }; | |||
/** | /** | |||
* MTP track struct | * MTP track struct | |||
*/ | */ | |||
struct LIBMTP_track_struct { | struct LIBMTP_track_struct { | |||
uint32_t item_id; /**< Unique item ID */ | uint32_t item_id; /**< Unique item ID */ | |||
uint32_t parent_id; /**< ID of parent folder */ | ||||
char *title; /**< Track title */ | char *title; /**< Track title */ | |||
char *artist; /**< Name of recording artist */ | char *artist; /**< Name of recording artist */ | |||
char *genre; /**< Genre name for track */ | char *genre; /**< Genre name for track */ | |||
char *album; /**< Album name for track */ | char *album; /**< Album name for track */ | |||
char *date; /**< Date of original recording as a string */ | char *date; /**< Date of original recording as a string */ | |||
char *filename; /**< Original filename of this track */ | char *filename; /**< Original filename of this track */ | |||
uint16_t tracknumber; /**< Track number (in sequence on recording) */ | uint16_t tracknumber; /**< Track number (in sequence on recording) */ | |||
uint32_t duration; /**< Duration in milliseconds */ | uint32_t duration; /**< Duration in milliseconds */ | |||
uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0x bb80 */ | uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0x bb80 */ | |||
uint16_t nochannels; /**< Number of channels in this recording 0 = unknow n, 1 or 2 */ | uint16_t nochannels; /**< Number of channels in this recording 0 = unknow n, 1 or 2 */ | |||
skipping to change at line 201 | skipping to change at line 206 | |||
*/ | */ | |||
struct LIBMTP_playlist_struct { | struct LIBMTP_playlist_struct { | |||
uint32_t playlist_id; /**< Unique playlist ID */ | uint32_t playlist_id; /**< Unique playlist ID */ | |||
char *name; /**< Name of playlist */ | char *name; /**< Name of playlist */ | |||
uint32_t *tracks; /**< The tracks in this playlist */ | uint32_t *tracks; /**< The tracks in this playlist */ | |||
uint32_t no_tracks; /**< The number of tracks in this playlist */ | uint32_t no_tracks; /**< The number of tracks in this playlist */ | |||
LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ | LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ | |||
}; | }; | |||
/** | /** | |||
* MTP Album structure | ||||
*/ | ||||
struct LIBMTP_album_struct { | ||||
uint32_t album_id; /**< Unique playlist ID */ | ||||
char *name; /**< Name of album */ | ||||
uint32_t *tracks; /**< The tracks in this album */ | ||||
uint32_t no_tracks; /**< The number of tracks in this album */ | ||||
LIBMTP_album_t *next; /**< Next album or NULL if last album */ | ||||
}; | ||||
/** | ||||
* 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 | * LIBMTP Object RepresentativeSampleData Structure | |||
*/ | */ | |||
struct LIBMTP_object_struct { | struct LIBMTP_filesampledata_struct { | |||
uint32_t id; | uint32_t width; /**< Width of sample if it is an image */ | |||
uint32_t parent; | uint32_t height; /**< Height of sample if it is an image */ | |||
uint32_t type; | uint32_t duration; /**< Duration in milliseconds if it is audio */ | |||
uint32_t size; | LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ | |||
char *name; | uint64_t size; /**< Size of sample data in bytes */ | |||
void *data; | char *data; /**< Sample 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 | |||
/** | /** | |||
skipping to change at line 274 | skipping to change at line 288 | |||
/** | /** | |||
* @} | * @} | |||
* @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_progressfunc_t const, void const * const); | ||||
LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const ); | LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const ); | |||
int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * con st, | int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * con st, | |||
LIBMTP_progressfunc_t const, void const * const); | LIBMTP_progressfunc_t const, void const * const); | |||
int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, | int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, | |||
LIBMTP_progressfunc_t const, void const * const); | LIBMTP_progressfunc_t const, void const * const); | |||
int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const, | int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const, | |||
LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | |||
void const * const, uint32_t const); | void const * const, uint32_t const); | |||
int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, | int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, | |||
LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | |||
void const * const, uint32_t const); | void const * const, uint32_t const); | |||
LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); | ||||
void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); | ||||
int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, | ||||
LIBMTP_filetype_t const, | ||||
LIBMTP_filesampledata_t **); | ||||
int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, | ||||
LIBMTP_filesampledata_t *); | ||||
/** | /** | |||
* @} | * @} | |||
* @defgroup tracks The track management API. | * @defgroup tracks The track management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
LIBMTP_track_t *LIBMTP_new_track_t(void); | LIBMTP_track_t *LIBMTP_new_track_t(void); | |||
void LIBMTP_destroy_track_t(LIBMTP_track_t*); | void LIBMTP_destroy_track_t(LIBMTP_track_t*); | |||
LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); | LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); | |||
LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*, | ||||
LIBMTP_progressfunc_t const, void const * const); | ||||
LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t cons t); | LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t cons t); | |||
int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * co nst, | int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * co nst, | |||
LIBMTP_progressfunc_t const, void const * const); | LIBMTP_progressfunc_t const, void const * const); | |||
int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const , int const, | int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const , int const, | |||
LIBMTP_progressfunc_t const, void const * const); | LIBMTP_progressfunc_t const, void const * const); | |||
int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, | int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, | |||
char const * const, LIBMTP_track_t * const, | char const * const, LIBMTP_track_t * const, | |||
LIBMTP_progressfunc_t const, | LIBMTP_progressfunc_t const, | |||
void const * const, uint32_t const); | void const * const, uint32_t const); | |||
int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, | int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, | |||
skipping to change at line 337 | skipping to change at line 363 | |||
*/ | */ | |||
LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); | LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); | |||
void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); | void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); | |||
LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); | LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); | |||
LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const ); | LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const ); | |||
int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * co nst, uint32_t const); | int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * co nst, uint32_t const); | |||
int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t const * const); | int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t const * const); | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup objects The object management API. | * @defgroup albums The audio/video album management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *,const uint32_t, co | LIBMTP_album_t *LIBMTP_new_album_t(void); | |||
nst uint16_t); | void LIBMTP_destroy_album_t(LIBMTP_album_t *); | |||
uint32_t LIBMTP_Get_U32_From_Object(LIBMTP_mtpdevice_t *,const uint32_t, co | LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); | |||
nst uint16_t, const uint32_t); | LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); | |||
uint16_t LIBMTP_Get_U16_From_Object(LIBMTP_mtpdevice_t *,const uint32_t, co | int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const, u | |||
nst uint16_t, const uint16_t); | int32_t const); | |||
int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *,const uint32_t,const uint | int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const) | |||
16_t, | ; | |||
char const * const); | ||||
int LIBMTP_Set_Object_U32(LIBMTP_mtpdevice_t *,const uint32_t, const uint16 | ||||
_t, const uint32_t); | ||||
int LIBMTP_Set_Object_U16(LIBMTP_mtpdevice_t *,const uint32_t, const uint16 | ||||
_t, const uint16_t); | ||||
int LIBMTP_Get_Object_References(LIBMTP_mtpdevice_t *, const uint32_t, uint | ||||
32_t **, uint32_t *); | ||||
int LIBMTP_Set_Object_References(LIBMTP_mtpdevice_t *, const uint32_t, uint | ||||
32_t const * const, const 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 *, const 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); | ||||
int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | ||||
/** @} */ | ||||
/** | /** | |||
* @} | * @} | |||
* @defgroup File mapping The file mapping API | * @defgroup objects The object management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
int LIBMTP_Register_Filetype(char const * const, LIBMTP_filetype_t const, | int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | |||
uint16_t const, void const * const, | ||||
void const * const, void const * const); | ||||
int LIBMTP_Set_Filetype_Description(LIBMTP_filetype_t, char const * const); | ||||
int LIBMTP_Set_Constructor(LIBMTP_filetype_t, void const * const); | ||||
int LIBMTP_Set_Destructor(LIBMTP_filetype_t, void const * const); | ||||
int LIBMTP_Set_Datafunc(LIBMTP_filetype_t, void const * const); | ||||
/** @} */ | /** @} */ | |||
/* 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. 15 change blocks. | ||||
45 lines changed or deleted | 49 lines changed or added | |||