libmtp.h | libmtp.h | |||
---|---|---|---|---|
/** | /** | |||
* \file libmtp.h | * \file libmtp.h | |||
* Interface to the Media Transfer Protocol library. | * Interface to the Media Transfer Protocol library. | |||
* | * | |||
* Copyright (C) 2005-2009 Linus Walleij <triad@df.lth.se> | * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> | |||
* Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> | * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> | |||
* Copyright (C) 2007 Ted Bullock <tbullock@canada.com> | * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> | |||
* Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> | * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> | |||
* | * | |||
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | * modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | * License as published by the Free Software Foundation; either | |||
* version 2 of the License, or (at your option) any later version. | * version 2 of the License, or (at your option) any later version. | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
skipping to change at line 32 | skipping to change at line 32 | |||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |||
* Boston, MA 02111-1307, USA. | * Boston, MA 02111-1307, USA. | |||
* | * | |||
* <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 1.0.6 | #define LIBMTP_VERSION 1.1.0 | |||
#define LIBMTP_VERSION_STRING "1.0.6" | #define LIBMTP_VERSION_STRING "1.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 | |||
/* | /* | |||
* Types that do not exist in Windows | * Types that do not exist in Windows | |||
* sys/types.h, but they exist in mingw32 | * sys/types.h, but they exist in mingw32 | |||
skipping to change at line 83 | skipping to change at line 83 | |||
#define LIBMTP_DEBUG_USB 0x04 | #define LIBMTP_DEBUG_USB 0x04 | |||
#define LIBMTP_DEBUG_DATA 0x08 | #define LIBMTP_DEBUG_DATA 0x08 | |||
#define LIBMTP_DEBUG_ALL 0xFF | #define LIBMTP_DEBUG_ALL 0xFF | |||
/** | /** | |||
* The filetypes defined here are the external types used | * The filetypes defined here are the external types used | |||
* by the libmtp library interface. The types used internally | * by the libmtp library interface. The types used internally | |||
* as PTP-defined enumerator types is something different. | * as PTP-defined enumerator types is something different. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
LIBMTP_FILETYPE_FOLDER, | ||||
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_AUDIBLE, | LIBMTP_FILETYPE_AUDIBLE, | |||
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, | |||
skipping to change at line 644 | skipping to change at line 645 | |||
/** 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 */ | /** Default Text folder */ | |||
uint32_t 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; | |||
/** Extension list */ | /** Extension list */ | |||
LIBMTP_device_extension_t *extensions; | LIBMTP_device_extension_t *extensions; | |||
/** Whether the device uses caching, only used internally */ | ||||
int cached; | ||||
/** Pointer to next device in linked list; NULL if this is the last devic e */ | /** Pointer to next device in linked list; NULL if this is the last devic e */ | |||
LIBMTP_mtpdevice_t *next; | LIBMTP_mtpdevice_t *next; | |||
}; | }; | |||
/** | /** | |||
* 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 */ | |||
skipping to change at line 762 | skipping to change at line 765 | |||
uint16_t AccessCapability; /**< Access capability */ | uint16_t AccessCapability; /**< Access capability */ | |||
uint64_t MaxCapacity; /**< Maximum capability */ | uint64_t MaxCapacity; /**< Maximum capability */ | |||
uint64_t FreeSpaceInBytes; /**< Free space in bytes */ | uint64_t FreeSpaceInBytes; /**< Free space in bytes */ | |||
uint64_t FreeSpaceInObjects; /**< Free space in objects */ | uint64_t FreeSpaceInObjects; /**< Free space in objects */ | |||
char *StorageDescription; /**< A brief description of this storage */ | char *StorageDescription; /**< A brief description of this storage */ | |||
char *VolumeIdentifier; /**< A volume identifier */ | char *VolumeIdentifier; /**< A volume identifier */ | |||
LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until N ULL */ | LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until N ULL */ | |||
LIBMTP_devicestorage_t *prev; /**< Previous storage */ | LIBMTP_devicestorage_t *prev; /**< Previous storage */ | |||
}; | }; | |||
/** | ||||
* LIBMTP Event structure | ||||
* TODO: add all externally visible events here | ||||
*/ | ||||
enum LIBMTP_event_enum { | ||||
LIBMTP_EVENT_NONE, | ||||
}; | ||||
typedef enum LIBMTP_event_enum LIBMTP_event_t; | ||||
/** @} */ | /** @} */ | |||
/* Make functions available for C++ */ | /* Make functions available for C++ */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
extern int LIBMTP_debug; | extern int LIBMTP_debug; | |||
/** | /** | |||
skipping to change at line 786 | skipping to change at line 798 | |||
void LIBMTP_Init(void); | void LIBMTP_Init(void); | |||
int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); | int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup basic The basic device management API. | * @defgroup basic The basic device management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); | LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); | |||
int LIBMTP_Check_Specific_Device(int busno, int devno); | int LIBMTP_Check_Specific_Device(int busno, int devno); | |||
LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); | LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); | |||
LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *); | ||||
/* Begin old, legacy interface */ | /* Begin old, legacy interface */ | |||
LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | |||
LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); | LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); | |||
uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); | uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); | |||
void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); | void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); | |||
/* End old, legacy interface */ | /* End old, legacy interface */ | |||
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*); | |||
int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); | int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); | |||
skipping to change at line 859 | skipping to change at line 872 | |||
* @} | * @} | |||
* @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 *, | |||
LIBMTP_progressfunc_t const, void const * const); | LIBMTP_progressfunc_t const, void const * const); | |||
LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *, | ||||
uint32_t const, | ||||
uint32_t 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 LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, | |||
int const, | uint32_t const, | |||
LIBMTP_progressfunc_t const, void const * const); | int const, | |||
int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDat | LIBMTP_progressfunc_t const, | |||
aPutFunc, void *, | void const * const); | |||
LIBMTP_progressfunc_t const, void const * const); | int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, | |||
int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const, | uint32_t const, | |||
LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | MTPDataPutFunc, | |||
void const * const); | void *, | |||
int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, | LIBMTP_progressfunc_t const, | |||
LIBMTP_file_t * const, LIBMTP_progressfunc_t const, | void const * const); | |||
void const * const); | int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, | |||
int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, voi | char const * const, | |||
d *, | LIBMTP_file_t * const, | |||
LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * cons | LIBMTP_progressfunc_t const, | |||
t); | void const * const); | |||
int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char | int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, | |||
*); | int const, | |||
LIBMTP_file_t * const, | ||||
LIBMTP_progressfunc_t const, | ||||
void const * const); | ||||
int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, | ||||
MTPDataGetFunc, void *, | ||||
LIBMTP_file_t * const, | ||||
LIBMTP_progressfunc_t const, | ||||
void const * const); | ||||
int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, | ||||
LIBMTP_file_t *, | ||||
const char *); | ||||
LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); | LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); | |||
void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); | void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); | |||
int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, | int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, | |||
LIBMTP_filetype_t const, | LIBMTP_filetype_t const, | |||
LIBMTP_filesampledata_t **); | LIBMTP_filesampledata_t **); | |||
int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, | int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, | |||
LIBMTP_filesampledata_t *); | LIBMTP_filesampledata_t *); | |||
int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, | int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, | |||
LIBMTP_filesampledata_t *); | LIBMTP_filesampledata_t *); | |||
skipping to change at line 918 | skipping to change at line 950 | |||
int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, | int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, | |||
int const, LIBMTP_track_t * const, | int const, LIBMTP_track_t * const, | |||
LIBMTP_progressfunc_t const, | LIBMTP_progressfunc_t const, | |||
void const * const); | void const * const); | |||
int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, | int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, | |||
MTPDataGetFunc, void *, LIBMTP_track_t * const, | MTPDataGetFunc, void *, LIBMTP_track_t * const, | |||
LIBMTP_progressfunc_t const, | LIBMTP_progressfunc_t const, | |||
void const * const); | void const * const); | |||
int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, | int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, | |||
LIBMTP_track_t const * const); | LIBMTP_track_t const * const); | |||
int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t); | int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const); | |||
int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const cha r *); | int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const cha r *); | |||
/** @} */ | /** @} */ | |||
/** | /** | |||
* @} | * @} | |||
* @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_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, | ||||
uint32_t const); | ||||
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); | uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32 _t); | |||
int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const c har *); | int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const c har *); | |||
/** @} */ | /** @} */ | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup playlists The audio/video playlist management API. | * @defgroup playlists The audio/video playlist management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
skipping to change at line 970 | skipping to change at line 1004 | |||
int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const cha r *); | int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const cha r *); | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup objects The object management API. | * @defgroup objects The object management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | |||
int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); | int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); | |||
/** | ||||
* @} | ||||
* @defgroup files The events API. | ||||
* @{ | ||||
*/ | ||||
int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *); | ||||
/** @} */ | /** @} */ | |||
/* 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. 11 change blocks. | ||||
22 lines changed or deleted | 58 lines changed or added | |||