Home | History | Annotate | Download | only in src
      1 /**
      2  * \file libmtp.h
      3  * Interface to the Media Transfer Protocol library.
      4  *
      5  * Copyright (C) 2005-2013 Linus Walleij <triad (at) df.lth.se>
      6  * Copyright (C) 2005-2008 Richard A. Low <richard (at) wentnet.com>
      7  * Copyright (C) 2007 Ted Bullock <tbullock (at) canada.com>
      8  * Copyright (C) 2008 Florent Mertens <flomertens (at) gmail.com>
      9  *
     10  * This library is free software; you can redistribute it and/or
     11  * modify it under the terms of the GNU Lesser General Public
     12  * License as published by the Free Software Foundation; either
     13  * version 2 of the License, or (at your option) any later version.
     14  *
     15  * This library is distributed in the hope that it will be useful,
     16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18  * Lesser General Public License for more details.
     19  *
     20  * You should have received a copy of the GNU Lesser General Public
     21  * License along with this library; if not, write to the
     22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     23  * Boston, MA 02111-1307, USA.
     24  *
     25  * <code>
     26  * #include <libmtp.h>
     27  * </code>
     28  */
     29 #ifndef LIBMTP_H_INCLUSION_GUARD
     30 #define LIBMTP_H_INCLUSION_GUARD
     31 
     32 #define LIBMTP_VERSION @VERSION@
     33 #define LIBMTP_VERSION_STRING "@VERSION@"
     34 
     35 /* This handles MSVC pecularities */
     36 #ifdef _MSC_VER
     37 #include <windows.h>
     38 #define __WIN32__
     39 #define snprintf _snprintf
     40 #define ssize_t SSIZE_T
     41 /*
     42  * Types that do not exist in Windows
     43  * sys/types.h, but they exist in mingw32
     44  * sys/types.h.
     45  */
     46 typedef char int8_t;
     47 typedef unsigned char uint8_t;
     48 typedef __int16 int16_t;
     49 typedef unsigned __int16 uint16_t;
     50 typedef __int32 int32_t;
     51 typedef unsigned __int32 uint32_t;
     52 typedef unsigned __int64 uint64_t;
     53 #else
     54 #include <sys/time.h>
     55 #endif
     56 
     57 #include <stdio.h>
     58 #include <stdint.h>
     59 /* We use time_t */
     60 #include <time.h>
     61 #include <utime.h>
     62 
     63 /**
     64  * @defgroup types libmtp global type definitions
     65  * @{
     66  */
     67 
     68 /**
     69  * The debug flags defined here are the external flags used
     70  * by the libmtp library interface.
     71  *
     72  * Please keep this list in sync with libmtp.c.
     73  */
     74 #define LIBMTP_DEBUG_NONE		0x00
     75 #define LIBMTP_DEBUG_PTP		0x01
     76 #define LIBMTP_DEBUG_PLST		0x02
     77 #define LIBMTP_DEBUG_USB		0x04
     78 #define LIBMTP_DEBUG_DATA		0x08
     79 #define LIBMTP_DEBUG_ALL		0xFF
     80 
     81 
     82 /**
     83  * The filetypes defined here are the external types used
     84  * by the libmtp library interface. The types used internally
     85  * as PTP-defined enumerator types is something different.
     86  */
     87 typedef enum {
     88   LIBMTP_FILETYPE_FOLDER,
     89   LIBMTP_FILETYPE_WAV,
     90   LIBMTP_FILETYPE_MP3,
     91   LIBMTP_FILETYPE_WMA,
     92   LIBMTP_FILETYPE_OGG,
     93   LIBMTP_FILETYPE_AUDIBLE,
     94   LIBMTP_FILETYPE_MP4,
     95   LIBMTP_FILETYPE_UNDEF_AUDIO,
     96   LIBMTP_FILETYPE_WMV,
     97   LIBMTP_FILETYPE_AVI,
     98   LIBMTP_FILETYPE_MPEG,
     99   LIBMTP_FILETYPE_ASF,
    100   LIBMTP_FILETYPE_QT,
    101   LIBMTP_FILETYPE_UNDEF_VIDEO,
    102   LIBMTP_FILETYPE_JPEG,
    103   LIBMTP_FILETYPE_JFIF,
    104   LIBMTP_FILETYPE_TIFF,
    105   LIBMTP_FILETYPE_BMP,
    106   LIBMTP_FILETYPE_GIF,
    107   LIBMTP_FILETYPE_PICT,
    108   LIBMTP_FILETYPE_PNG,
    109   LIBMTP_FILETYPE_VCALENDAR1,
    110   LIBMTP_FILETYPE_VCALENDAR2,
    111   LIBMTP_FILETYPE_VCARD2,
    112   LIBMTP_FILETYPE_VCARD3,
    113   LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT,
    114   LIBMTP_FILETYPE_WINEXEC,
    115   LIBMTP_FILETYPE_TEXT,
    116   LIBMTP_FILETYPE_HTML,
    117   LIBMTP_FILETYPE_FIRMWARE,
    118   LIBMTP_FILETYPE_AAC,
    119   LIBMTP_FILETYPE_MEDIACARD,
    120   LIBMTP_FILETYPE_FLAC,
    121   LIBMTP_FILETYPE_MP2,
    122   LIBMTP_FILETYPE_M4A,
    123   LIBMTP_FILETYPE_DOC,
    124   LIBMTP_FILETYPE_XML,
    125   LIBMTP_FILETYPE_XLS,
    126   LIBMTP_FILETYPE_PPT,
    127   LIBMTP_FILETYPE_MHT,
    128   LIBMTP_FILETYPE_JP2,
    129   LIBMTP_FILETYPE_JPX,
    130   LIBMTP_FILETYPE_ALBUM,
    131   LIBMTP_FILETYPE_PLAYLIST,
    132   LIBMTP_FILETYPE_UNKNOWN
    133 } LIBMTP_filetype_t;
    134 
    135 /**
    136  * \def LIBMTP_FILETYPE_IS_AUDIO
    137  * Audio filetype test.
    138  *
    139  * For filetypes that can be either audio
    140  * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO
    141  */
    142 #define LIBMTP_FILETYPE_IS_AUDIO(a)\
    143 (a == LIBMTP_FILETYPE_WAV ||\
    144  a == LIBMTP_FILETYPE_MP3 ||\
    145  a == LIBMTP_FILETYPE_MP2 ||\
    146  a == LIBMTP_FILETYPE_WMA ||\
    147  a == LIBMTP_FILETYPE_OGG ||\
    148  a == LIBMTP_FILETYPE_FLAC ||\
    149  a == LIBMTP_FILETYPE_AAC ||\
    150  a == LIBMTP_FILETYPE_M4A ||\
    151  a == LIBMTP_FILETYPE_AUDIBLE ||\
    152  a == LIBMTP_FILETYPE_UNDEF_AUDIO)
    153 
    154 /**
    155  *  \def LIBMTP_FILETYPE_IS_VIDEO
    156  *  Video filetype test.
    157  *
    158  * For filetypes that can be either audio
    159  * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO
    160  */
    161 #define LIBMTP_FILETYPE_IS_VIDEO(a)\
    162 (a == LIBMTP_FILETYPE_WMV ||\
    163  a == LIBMTP_FILETYPE_AVI ||\
    164  a == LIBMTP_FILETYPE_MPEG ||\
    165  a == LIBMTP_FILETYPE_UNDEF_VIDEO)
    166 
    167 /**
    168  *  \def LIBMTP_FILETYPE_IS_AUDIOVIDEO
    169  *  Audio and&slash;or video filetype test.
    170  */
    171 #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\
    172 (a == LIBMTP_FILETYPE_MP4 ||\
    173  a == LIBMTP_FILETYPE_ASF ||\
    174  a == LIBMTP_FILETYPE_QT)
    175 
    176 /**
    177  *  \def LIBMTP_FILETYPE_IS_TRACK
    178  *  Test if filetype is a track.
    179  *  Use this to determine if the File API or Track API
    180  *  should be used to upload or download an object.
    181  */
    182 #define LIBMTP_FILETYPE_IS_TRACK(a)\
    183 (LIBMTP_FILETYPE_IS_AUDIO(a) ||\
    184  LIBMTP_FILETYPE_IS_VIDEO(a) ||\
    185  LIBMTP_FILETYPE_IS_AUDIOVIDEO(a))
    186 
    187 /**
    188  *  \def LIBMTP_FILETYPE_IS_IMAGE
    189  *  Image filetype test
    190  */
    191 #define LIBMTP_FILETYPE_IS_IMAGE(a)\
    192 (a == LIBMTP_FILETYPE_JPEG ||\
    193 a == LIBMTP_FILETYPE_JFIF ||\
    194 a == LIBMTP_FILETYPE_TIFF ||\
    195 a == LIBMTP_FILETYPE_BMP ||\
    196 a == LIBMTP_FILETYPE_GIF ||\
    197 a == LIBMTP_FILETYPE_PICT ||\
    198 a == LIBMTP_FILETYPE_PNG ||\
    199 a == LIBMTP_FILETYPE_JP2 ||\
    200 a == LIBMTP_FILETYPE_JPX ||\
    201 a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT)
    202 
    203 /**
    204  *  \def LIBMTP_FILETYPE_IS_ADDRESSBOOK
    205  *  Addressbook and Business card filetype test
    206  */
    207 #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\
    208 (a == LIBMTP_FILETYPE_VCARD2 ||\
    209 a == LIBMTP_FILETYPE_VCARD3)
    210 
    211 /**
    212  *  \def LIBMTP_FILETYPE_IS_CALENDAR
    213  *  Calendar and Appointment filetype test
    214  */
    215 #define LIBMTP_FILETYPE_IS_CALENDAR(a)\
    216 (a == LIBMTP_FILETYPE_VCALENDAR1 ||\
    217 a == LIBMTP_FILETYPE_VCALENDAR2)
    218 
    219 /**
    220  * The properties defined here are the external types used
    221  * by the libmtp library interface.
    222  */
    223 typedef enum {
    224   LIBMTP_PROPERTY_StorageID,
    225   LIBMTP_PROPERTY_ObjectFormat,
    226   LIBMTP_PROPERTY_ProtectionStatus,
    227   LIBMTP_PROPERTY_ObjectSize,
    228   LIBMTP_PROPERTY_AssociationType,
    229   LIBMTP_PROPERTY_AssociationDesc,
    230   LIBMTP_PROPERTY_ObjectFileName,
    231   LIBMTP_PROPERTY_DateCreated,
    232   LIBMTP_PROPERTY_DateModified,
    233   LIBMTP_PROPERTY_Keywords,
    234   LIBMTP_PROPERTY_ParentObject,
    235   LIBMTP_PROPERTY_AllowedFolderContents,
    236   LIBMTP_PROPERTY_Hidden,
    237   LIBMTP_PROPERTY_SystemObject,
    238   LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier,
    239   LIBMTP_PROPERTY_SyncID,
    240   LIBMTP_PROPERTY_PropertyBag,
    241   LIBMTP_PROPERTY_Name,
    242   LIBMTP_PROPERTY_CreatedBy,
    243   LIBMTP_PROPERTY_Artist,
    244   LIBMTP_PROPERTY_DateAuthored,
    245   LIBMTP_PROPERTY_Description,
    246   LIBMTP_PROPERTY_URLReference,
    247   LIBMTP_PROPERTY_LanguageLocale,
    248   LIBMTP_PROPERTY_CopyrightInformation,
    249   LIBMTP_PROPERTY_Source,
    250   LIBMTP_PROPERTY_OriginLocation,
    251   LIBMTP_PROPERTY_DateAdded,
    252   LIBMTP_PROPERTY_NonConsumable,
    253   LIBMTP_PROPERTY_CorruptOrUnplayable,
    254   LIBMTP_PROPERTY_ProducerSerialNumber,
    255   LIBMTP_PROPERTY_RepresentativeSampleFormat,
    256   LIBMTP_PROPERTY_RepresentativeSampleSize,
    257   LIBMTP_PROPERTY_RepresentativeSampleHeight,
    258   LIBMTP_PROPERTY_RepresentativeSampleWidth,
    259   LIBMTP_PROPERTY_RepresentativeSampleDuration,
    260   LIBMTP_PROPERTY_RepresentativeSampleData,
    261   LIBMTP_PROPERTY_Width,
    262   LIBMTP_PROPERTY_Height,
    263   LIBMTP_PROPERTY_Duration,
    264   LIBMTP_PROPERTY_Rating,
    265   LIBMTP_PROPERTY_Track,
    266   LIBMTP_PROPERTY_Genre,
    267   LIBMTP_PROPERTY_Credits,
    268   LIBMTP_PROPERTY_Lyrics,
    269   LIBMTP_PROPERTY_SubscriptionContentID,
    270   LIBMTP_PROPERTY_ProducedBy,
    271   LIBMTP_PROPERTY_UseCount,
    272   LIBMTP_PROPERTY_SkipCount,
    273   LIBMTP_PROPERTY_LastAccessed,
    274   LIBMTP_PROPERTY_ParentalRating,
    275   LIBMTP_PROPERTY_MetaGenre,
    276   LIBMTP_PROPERTY_Composer,
    277   LIBMTP_PROPERTY_EffectiveRating,
    278   LIBMTP_PROPERTY_Subtitle,
    279   LIBMTP_PROPERTY_OriginalReleaseDate,
    280   LIBMTP_PROPERTY_AlbumName,
    281   LIBMTP_PROPERTY_AlbumArtist,
    282   LIBMTP_PROPERTY_Mood,
    283   LIBMTP_PROPERTY_DRMStatus,
    284   LIBMTP_PROPERTY_SubDescription,
    285   LIBMTP_PROPERTY_IsCropped,
    286   LIBMTP_PROPERTY_IsColorCorrected,
    287   LIBMTP_PROPERTY_ImageBitDepth,
    288   LIBMTP_PROPERTY_Fnumber,
    289   LIBMTP_PROPERTY_ExposureTime,
    290   LIBMTP_PROPERTY_ExposureIndex,
    291   LIBMTP_PROPERTY_DisplayName,
    292   LIBMTP_PROPERTY_BodyText,
    293   LIBMTP_PROPERTY_Subject,
    294   LIBMTP_PROPERTY_Priority,
    295   LIBMTP_PROPERTY_GivenName,
    296   LIBMTP_PROPERTY_MiddleNames,
    297   LIBMTP_PROPERTY_FamilyName,
    298   LIBMTP_PROPERTY_Prefix,
    299   LIBMTP_PROPERTY_Suffix,
    300   LIBMTP_PROPERTY_PhoneticGivenName,
    301   LIBMTP_PROPERTY_PhoneticFamilyName,
    302   LIBMTP_PROPERTY_EmailPrimary,
    303   LIBMTP_PROPERTY_EmailPersonal1,
    304   LIBMTP_PROPERTY_EmailPersonal2,
    305   LIBMTP_PROPERTY_EmailBusiness1,
    306   LIBMTP_PROPERTY_EmailBusiness2,
    307   LIBMTP_PROPERTY_EmailOthers,
    308   LIBMTP_PROPERTY_PhoneNumberPrimary,
    309   LIBMTP_PROPERTY_PhoneNumberPersonal,
    310   LIBMTP_PROPERTY_PhoneNumberPersonal2,
    311   LIBMTP_PROPERTY_PhoneNumberBusiness,
    312   LIBMTP_PROPERTY_PhoneNumberBusiness2,
    313   LIBMTP_PROPERTY_PhoneNumberMobile,
    314   LIBMTP_PROPERTY_PhoneNumberMobile2,
    315   LIBMTP_PROPERTY_FaxNumberPrimary,
    316   LIBMTP_PROPERTY_FaxNumberPersonal,
    317   LIBMTP_PROPERTY_FaxNumberBusiness,
    318   LIBMTP_PROPERTY_PagerNumber,
    319   LIBMTP_PROPERTY_PhoneNumberOthers,
    320   LIBMTP_PROPERTY_PrimaryWebAddress,
    321   LIBMTP_PROPERTY_PersonalWebAddress,
    322   LIBMTP_PROPERTY_BusinessWebAddress,
    323   LIBMTP_PROPERTY_InstantMessengerAddress,
    324   LIBMTP_PROPERTY_InstantMessengerAddress2,
    325   LIBMTP_PROPERTY_InstantMessengerAddress3,
    326   LIBMTP_PROPERTY_PostalAddressPersonalFull,
    327   LIBMTP_PROPERTY_PostalAddressPersonalFullLine1,
    328   LIBMTP_PROPERTY_PostalAddressPersonalFullLine2,
    329   LIBMTP_PROPERTY_PostalAddressPersonalFullCity,
    330   LIBMTP_PROPERTY_PostalAddressPersonalFullRegion,
    331   LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode,
    332   LIBMTP_PROPERTY_PostalAddressPersonalFullCountry,
    333   LIBMTP_PROPERTY_PostalAddressBusinessFull,
    334   LIBMTP_PROPERTY_PostalAddressBusinessLine1,
    335   LIBMTP_PROPERTY_PostalAddressBusinessLine2,
    336   LIBMTP_PROPERTY_PostalAddressBusinessCity,
    337   LIBMTP_PROPERTY_PostalAddressBusinessRegion,
    338   LIBMTP_PROPERTY_PostalAddressBusinessPostalCode,
    339   LIBMTP_PROPERTY_PostalAddressBusinessCountry,
    340   LIBMTP_PROPERTY_PostalAddressOtherFull,
    341   LIBMTP_PROPERTY_PostalAddressOtherLine1,
    342   LIBMTP_PROPERTY_PostalAddressOtherLine2,
    343   LIBMTP_PROPERTY_PostalAddressOtherCity,
    344   LIBMTP_PROPERTY_PostalAddressOtherRegion,
    345   LIBMTP_PROPERTY_PostalAddressOtherPostalCode,
    346   LIBMTP_PROPERTY_PostalAddressOtherCountry,
    347   LIBMTP_PROPERTY_OrganizationName,
    348   LIBMTP_PROPERTY_PhoneticOrganizationName,
    349   LIBMTP_PROPERTY_Role,
    350   LIBMTP_PROPERTY_Birthdate,
    351   LIBMTP_PROPERTY_MessageTo,
    352   LIBMTP_PROPERTY_MessageCC,
    353   LIBMTP_PROPERTY_MessageBCC,
    354   LIBMTP_PROPERTY_MessageRead,
    355   LIBMTP_PROPERTY_MessageReceivedTime,
    356   LIBMTP_PROPERTY_MessageSender,
    357   LIBMTP_PROPERTY_ActivityBeginTime,
    358   LIBMTP_PROPERTY_ActivityEndTime,
    359   LIBMTP_PROPERTY_ActivityLocation,
    360   LIBMTP_PROPERTY_ActivityRequiredAttendees,
    361   LIBMTP_PROPERTY_ActivityOptionalAttendees,
    362   LIBMTP_PROPERTY_ActivityResources,
    363   LIBMTP_PROPERTY_ActivityAccepted,
    364   LIBMTP_PROPERTY_Owner,
    365   LIBMTP_PROPERTY_Editor,
    366   LIBMTP_PROPERTY_Webmaster,
    367   LIBMTP_PROPERTY_URLSource,
    368   LIBMTP_PROPERTY_URLDestination,
    369   LIBMTP_PROPERTY_TimeBookmark,
    370   LIBMTP_PROPERTY_ObjectBookmark,
    371   LIBMTP_PROPERTY_ByteBookmark,
    372   LIBMTP_PROPERTY_LastBuildDate,
    373   LIBMTP_PROPERTY_TimetoLive,
    374   LIBMTP_PROPERTY_MediaGUID,
    375   LIBMTP_PROPERTY_TotalBitRate,
    376   LIBMTP_PROPERTY_BitRateType,
    377   LIBMTP_PROPERTY_SampleRate,
    378   LIBMTP_PROPERTY_NumberOfChannels,
    379   LIBMTP_PROPERTY_AudioBitDepth,
    380   LIBMTP_PROPERTY_ScanDepth,
    381   LIBMTP_PROPERTY_AudioWAVECodec,
    382   LIBMTP_PROPERTY_AudioBitRate,
    383   LIBMTP_PROPERTY_VideoFourCCCodec,
    384   LIBMTP_PROPERTY_VideoBitRate,
    385   LIBMTP_PROPERTY_FramesPerThousandSeconds,
    386   LIBMTP_PROPERTY_KeyFrameDistance,
    387   LIBMTP_PROPERTY_BufferSize,
    388   LIBMTP_PROPERTY_EncodingQuality,
    389   LIBMTP_PROPERTY_EncodingProfile,
    390   LIBMTP_PROPERTY_BuyFlag,
    391   LIBMTP_PROPERTY_UNKNOWN
    392 } LIBMTP_property_t;
    393 
    394 /**
    395  * These are the data types
    396  */
    397 typedef enum {
    398   LIBMTP_DATATYPE_INT8,
    399   LIBMTP_DATATYPE_UINT8,
    400   LIBMTP_DATATYPE_INT16,
    401   LIBMTP_DATATYPE_UINT16,
    402   LIBMTP_DATATYPE_INT32,
    403   LIBMTP_DATATYPE_UINT32,
    404   LIBMTP_DATATYPE_INT64,
    405   LIBMTP_DATATYPE_UINT64,
    406 } LIBMTP_datatype_t;
    407 
    408 /**
    409  * These are device capabilities
    410  */
    411 typedef enum {
    412   /**
    413    * This capability tells whether you can call the funcion getting
    414    * partial objects, @see LIBMTP_GetPartialObject()
    415    */
    416   LIBMTP_DEVICECAP_GetPartialObject,
    417   /**
    418    * This capability tells whether you can call the function sending
    419    * partial objects. @see LIBMTP_SendPartialObject()
    420    */
    421   LIBMTP_DEVICECAP_SendPartialObject,
    422   /**
    423    * This capability tells whether you can call the functions editing
    424    * objects in-place on a device.
    425    * @see LIBMTP_BeginEditObject()
    426    * @see LIBMTP_EndEditObject()
    427    * @see LIBMTP_TruncateObject()
    428    */
    429   LIBMTP_DEVICECAP_EditObjects,
    430 } LIBMTP_devicecap_t;
    431 
    432 /**
    433  * These are the numbered error codes. You can also
    434  * get string representations for errors.
    435  */
    436 typedef enum {
    437   LIBMTP_ERROR_NONE,
    438   LIBMTP_ERROR_GENERAL,
    439   LIBMTP_ERROR_PTP_LAYER,
    440   LIBMTP_ERROR_USB_LAYER,
    441   LIBMTP_ERROR_MEMORY_ALLOCATION,
    442   LIBMTP_ERROR_NO_DEVICE_ATTACHED,
    443   LIBMTP_ERROR_STORAGE_FULL,
    444   LIBMTP_ERROR_CONNECTING,
    445   LIBMTP_ERROR_CANCELLED
    446 } LIBMTP_error_number_t;
    447 
    448 typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */
    449 typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t; /**< @see LIBMTP_raw_device_struct */
    450 typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_struct */
    451 typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t; /**< @see LIBMTP_allowed_values_struct */
    452 typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t; /** < @see LIBMTP_device_extension_struct */
    453 typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP_mtpdevice_struct */
    454 typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_struct */
    455 typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_struct */
    456 typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_playlist_struct */
    457 typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_struct */
    458 typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folder_t */
    459 typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_object_t */
    460 typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @see LIBMTP_filesample_t */
    461 typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @see LIBMTP_devicestorage_t */
    462 
    463 /**
    464  * The callback type definition. Notice that a progress percentage ratio
    465  * is easy to calculate by dividing <code>sent</code> by
    466  * <code>total</code>.
    467  * @param sent the number of bytes sent so far
    468  * @param total the total number of bytes to send
    469  * @param data a user-defined dereferencable pointer
    470  * @return if anything else than 0 is returned, the current transfer will be
    471  *         interrupted / cancelled.
    472  */
    473 typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total,
    474                 		void const * const data);
    475 
    476 /**
    477  * Callback function for get by handler function
    478  * @param params the device parameters
    479  * @param priv a user-defined dereferencable pointer
    480  * @param wantlen the number of bytes wanted
    481  * @param data a buffer to write the data to
    482  * @param gotlen pointer to the number of bytes actually written
    483  *        to data
    484  * @return LIBMTP_HANDLER_RETURN_OK if successful,
    485  *         LIBMTP_HANDLER_RETURN_ERROR on error or
    486  *         LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer
    487  */
    488 typedef uint16_t (* MTPDataGetFunc)	(void* params, void* priv,
    489 					uint32_t wantlen, unsigned char *data, uint32_t *gotlen);
    490 
    491 /**
    492  * Callback function for put by handler function
    493  * @param params the device parameters
    494  * @param priv a user-defined dereferencable pointer
    495  * @param sendlen the number of bytes available
    496  * @param data a buffer to read the data from
    497  * @param putlen pointer to the number of bytes actually read
    498  *        from data
    499  * @return LIBMTP_HANDLER_RETURN_OK if successful,
    500  *         LIBMTP_HANDLER_RETURN_ERROR on error or
    501  *         LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer
    502  */
    503 typedef uint16_t (* MTPDataPutFunc)	(void* params, void* priv,
    504 					uint32_t sendlen, unsigned char *data, uint32_t *putlen);
    505 
    506 /**
    507  * The return codes for the get/put functions
    508  */
    509 #define LIBMTP_HANDLER_RETURN_OK 0
    510 #define LIBMTP_HANDLER_RETURN_ERROR 1
    511 #define LIBMTP_HANDLER_RETURN_CANCEL 2
    512 
    513 /**
    514  * @}
    515  * @defgroup structar libmtp data structures
    516  * @{
    517  */
    518 
    519 /**
    520  * A data structure to hold MTP device entries.
    521  */
    522 struct LIBMTP_device_entry_struct {
    523   char *vendor; /**< The vendor of this device */
    524   uint16_t vendor_id; /**< Vendor ID for this device */
    525   char *product; /**< The product name of this device */
    526   uint16_t product_id; /**< Product ID for this device */
    527   uint32_t device_flags; /**< Bugs, device specifics etc */
    528 };
    529 
    530 /**
    531  * A data structure to hold a raw MTP device connected
    532  * to the bus.
    533  */
    534 struct LIBMTP_raw_device_struct {
    535   LIBMTP_device_entry_t device_entry; /**< The device entry for this raw device */
    536   uint32_t bus_location; /**< Location of the bus, if device available */
    537   uint8_t devnum; /**< Device number on the bus, if device available */
    538 };
    539 
    540 /**
    541  * A data structure to hold errors from the library.
    542  */
    543 struct LIBMTP_error_struct {
    544   LIBMTP_error_number_t errornumber;
    545   char *error_text;
    546   LIBMTP_error_t *next;
    547 };
    548 
    549 /**
    550  * A data structure to hold allowed ranges of values
    551  */
    552 struct LIBMTP_allowed_values_struct {
    553   uint8_t   u8max;
    554   uint8_t   u8min;
    555   uint8_t   u8step;
    556   uint8_t*  u8vals;
    557   int8_t    i8max;
    558   int8_t    i8min;
    559   int8_t    i8step;
    560   int8_t*   i8vals;
    561   uint16_t  u16max;
    562   uint16_t  u16min;
    563   uint16_t  u16step;
    564   uint16_t* u16vals;
    565   int16_t   i16max;
    566   int16_t   i16min;
    567   int16_t   i16step;
    568   int16_t*  i16vals;
    569   uint32_t  u32max;
    570   uint32_t  u32min;
    571   uint32_t  u32step;
    572   uint32_t* u32vals;
    573   int32_t   i32max;
    574   int32_t   i32min;
    575   int32_t   i32step;
    576   int32_t*  i32vals;
    577   uint64_t  u64max;
    578   uint64_t  u64min;
    579   uint64_t  u64step;
    580   uint64_t* u64vals;
    581   int64_t   i64max;
    582   int64_t   i64min;
    583   int64_t   i64step;
    584   int64_t*  i64vals;
    585   /**
    586    * Number of entries in the vals array
    587    */
    588   uint16_t  num_entries;
    589   /**
    590    * The datatype specifying which of the above is used
    591   */
    592   LIBMTP_datatype_t datatype;
    593   /**
    594    * Non zero for range, 0 for enum
    595   */
    596   int is_range;
    597 };
    598 
    599 /**
    600  * MTP device extension holder struct
    601  */
    602 struct LIBMTP_device_extension_struct {
    603   /**
    604    * Name of extension e.g. "foo.com"
    605    */
    606   char *name;
    607   /**
    608    * Major revision of extension
    609    */
    610   int major;
    611   /**
    612    * Minor revision of extension
    613    */
    614   int minor;
    615   /**
    616    * Pointer to the next extension or NULL if this is the
    617    * last extension.
    618    */
    619   LIBMTP_device_extension_t *next;
    620 };
    621 
    622 /**
    623  * Main MTP device object struct
    624  */
    625 struct LIBMTP_mtpdevice_struct {
    626   /**
    627    * Object bitsize, typically 32 or 64.
    628    */
    629   uint8_t object_bitsize;
    630   /**
    631    * Parameters for this device, must be cast into
    632    * \c (PTPParams*) before internal use.
    633    */
    634   void *params;
    635   /**
    636    * USB device for this device, must be cast into
    637    * \c (PTP_USB*) before internal use.
    638    */
    639   void *usbinfo;
    640   /**
    641    * The storage for this device, do not use strings in here without
    642    * copying them first, and beware that this list may be rebuilt at
    643    * any time.
    644    * @see LIBMTP_Get_Storage()
    645    */
    646   LIBMTP_devicestorage_t *storage;
    647   /**
    648    * The error stack. This shall be handled using the error getting
    649    * and clearing functions, not by dereferencing this list.
    650    */
    651   LIBMTP_error_t *errorstack;
    652   /** The maximum battery level for this device */
    653   uint8_t maximum_battery_level;
    654   /** Default music folder */
    655   uint32_t default_music_folder;
    656   /** Default playlist folder */
    657   uint32_t default_playlist_folder;
    658   /** Default picture folder */
    659   uint32_t default_picture_folder;
    660   /** Default video folder */
    661   uint32_t default_video_folder;
    662   /** Default organizer folder */
    663   uint32_t default_organizer_folder;
    664   /** Default ZENcast folder (only Creative devices...) */
    665   uint32_t default_zencast_folder;
    666   /** Default Album folder */
    667   uint32_t default_album_folder;
    668   /** Default Text folder */
    669   uint32_t default_text_folder;
    670   /** Per device iconv() converters, only used internally */
    671   void *cd;
    672   /** Extension list */
    673   LIBMTP_device_extension_t *extensions;
    674   /** Whether the device uses caching, only used internally */
    675   int cached;
    676 
    677   /** Pointer to next device in linked list; NULL if this is the last device */
    678   LIBMTP_mtpdevice_t *next;
    679 };
    680 
    681 /**
    682  * MTP file struct
    683  */
    684 struct LIBMTP_file_struct {
    685   uint32_t item_id; /**< Unique item ID */
    686   uint32_t parent_id; /**< ID of parent folder */
    687   uint32_t storage_id; /**< ID of storage holding this file */
    688   char *filename; /**< Filename of this file */
    689   uint64_t filesize; /**< Size of file in bytes */
    690   time_t modificationdate; /**< Date of last alteration of the file */
    691   LIBMTP_filetype_t filetype; /**< Filetype used for the current file */
    692   LIBMTP_file_t *next; /**< Next file in list or NULL if last file */
    693 };
    694 
    695 /**
    696  * MTP track struct
    697  */
    698 struct LIBMTP_track_struct {
    699   uint32_t item_id; /**< Unique item ID */
    700   uint32_t parent_id; /**< ID of parent folder */
    701   uint32_t storage_id; /**< ID of storage holding this track */
    702   char *title; /**< Track title */
    703   char *artist; /**< Name of recording artist */
    704   char *composer; /**< Name of recording composer */
    705   char *genre; /**< Genre name for track */
    706   char *album; /**< Album name for track */
    707   char *date; /**< Date of original recording as a string */
    708   char *filename; /**< Original filename of this track */
    709   uint16_t tracknumber; /**< Track number (in sequence on recording) */
    710   uint32_t duration; /**< Duration in milliseconds */
    711   uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0xbb80 */
    712   uint16_t nochannels; /**< Number of channels in this recording 0 = unknown, 1 or 2 */
    713   uint32_t wavecodec; /**< FourCC wave codec name */
    714   uint32_t bitrate; /**< (Average) bitrate for this file min=1 max=0x16e360 */
    715   uint16_t bitratetype; /**< 0 = unused, 1 = constant, 2 = VBR, 3 = free */
    716   uint16_t rating; /**< User rating 0-100 (0x00-0x64) */
    717   uint32_t usecount; /**< Number of times used/played */
    718   uint64_t filesize; /**< Size of track file in bytes */
    719   time_t modificationdate; /**< Date of last alteration of the track */
    720   LIBMTP_filetype_t filetype; /**< Filetype used for the current track */
    721   LIBMTP_track_t *next; /**< Next track in list or NULL if last track */
    722 };
    723 
    724 /**
    725  * MTP Playlist structure
    726  */
    727 struct LIBMTP_playlist_struct {
    728   uint32_t playlist_id; /**< Unique playlist ID */
    729   uint32_t parent_id; /**< ID of parent folder */
    730   uint32_t storage_id; /**< ID of storage holding this playlist */
    731   char *name; /**< Name of playlist */
    732   uint32_t *tracks; /**< The tracks in this playlist */
    733   uint32_t no_tracks; /**< The number of tracks in this playlist */
    734   LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */
    735 };
    736 
    737 /**
    738  * MTP Album structure
    739  */
    740 struct LIBMTP_album_struct {
    741   uint32_t album_id; /**< Unique playlist ID */
    742   uint32_t parent_id; /**< ID of parent folder */
    743   uint32_t storage_id; /**< ID of storage holding this album */
    744   char *name; /**< Name of album */
    745   char *artist; /**< Name of album artist */
    746   char *composer; /**< Name of recording composer */
    747   char *genre; /**< Genre of album */
    748   uint32_t *tracks; /**< The tracks in this album */
    749   uint32_t no_tracks; /**< The number of tracks in this album */
    750   LIBMTP_album_t *next; /**< Next album or NULL if last album */
    751 };
    752 
    753 /**
    754  * MTP Folder structure
    755  */
    756 struct LIBMTP_folder_struct {
    757   uint32_t folder_id; /**< Unique folder ID */
    758   uint32_t parent_id; /**< ID of parent folder */
    759   uint32_t storage_id; /**< ID of storage holding this folder */
    760   char *name; /**< Name of folder */
    761   LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no more */
    762   LIBMTP_folder_t *child; /**< Child folder or NULL if no children */
    763 };
    764 
    765 /**
    766  * LIBMTP Object RepresentativeSampleData Structure
    767  */
    768 struct LIBMTP_filesampledata_struct {
    769   uint32_t width; /**< Width of sample if it is an image */
    770   uint32_t height; /**< Height of sample if it is an image */
    771   uint32_t duration; /**< Duration in milliseconds if it is audio */
    772   LIBMTP_filetype_t filetype; /**< Filetype used for the sample */
    773   uint64_t size; /**< Size of sample data in bytes */
    774   char *data; /**< Sample data */
    775 };
    776 
    777 /**
    778  * LIBMTP Device Storage structure
    779  */
    780 struct LIBMTP_devicestorage_struct {
    781   uint32_t id; /**< Unique ID for this storage */
    782   uint16_t StorageType; /**< Storage type */
    783   uint16_t FilesystemType; /**< Filesystem type */
    784   uint16_t AccessCapability; /**< Access capability */
    785   uint64_t MaxCapacity; /**< Maximum capability */
    786   uint64_t FreeSpaceInBytes; /**< Free space in bytes */
    787   uint64_t FreeSpaceInObjects; /**< Free space in objects */
    788   char *StorageDescription; /**< A brief description of this storage */
    789   char *VolumeIdentifier; /**< A volume identifier */
    790   LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until NULL */
    791   LIBMTP_devicestorage_t *prev; /**< Previous storage */
    792 };
    793 
    794 /**
    795  * LIBMTP Event structure
    796  * TODO: add all externally visible events here
    797  */
    798 enum LIBMTP_event_enum {
    799   LIBMTP_EVENT_NONE,
    800   LIBMTP_EVENT_STORE_ADDED,
    801   LIBMTP_EVENT_STORE_REMOVED,
    802   LIBMTP_EVENT_OBJECT_ADDED,
    803   LIBMTP_EVENT_OBJECT_REMOVED,
    804 };
    805 typedef enum LIBMTP_event_enum LIBMTP_event_t;
    806 
    807 /** @} */
    808 
    809 /* Make functions available for C++ */
    810 #ifdef __cplusplus
    811 extern "C" {
    812 #endif
    813 
    814 extern int LIBMTP_debug;
    815 
    816 /**
    817  * @defgroup internals The libmtp internals API.
    818  * @{
    819  */
    820 void LIBMTP_Set_Debug(int);
    821 void LIBMTP_Init(void);
    822 int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const);
    823 /**
    824  * @}
    825  * @defgroup basic The basic device management API.
    826  * @{
    827  */
    828 LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *);
    829 int LIBMTP_Check_Specific_Device(int busno, int devno);
    830 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *);
    831 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *);
    832 /* Begin old, legacy interface */
    833 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
    834 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
    835 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
    836 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
    837 /* End old, legacy interface */
    838 void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
    839 void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
    840 int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
    841 char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
    842 char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
    843 char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
    844 char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
    845 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*);
    846 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const);
    847 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*);
    848 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const);
    849 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *,
    850 			    uint8_t * const,
    851 			    uint8_t * const);
    852 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const);
    853 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const);
    854 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const);
    855 int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t);
    856 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*);
    857 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
    858 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
    859 
    860 void LIBMTP_Set_Device_Timeout(LIBMTP_mtpdevice_t *device, int milliseconds);
    861 void LIBMTP_Get_Device_Timeout(LIBMTP_mtpdevice_t *device, int *milliseconds);
    862 
    863 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
    864 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
    865 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
    866 
    867 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
    868 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
    869 
    870 /**
    871  * Get/set arbitrary properties.  These do not update the cache; should only be used on
    872  * properties not stored in structs
    873  */
    874 char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const);
    875 uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    876       LIBMTP_property_t const, uint64_t const);
    877 uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    878       LIBMTP_property_t const, uint32_t const);
    879 uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    880       LIBMTP_property_t const, uint16_t const);
    881 uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    882       LIBMTP_property_t const, uint8_t const);
    883 int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const,
    884       LIBMTP_property_t const, char const * const);
    885 int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const,
    886       LIBMTP_property_t const, uint32_t const);
    887 int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const,
    888       LIBMTP_property_t const, uint16_t const);
    889 int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const,
    890       LIBMTP_property_t const, uint8_t const);
    891 char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty);
    892 int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    893             LIBMTP_filetype_t const);
    894 int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    895             LIBMTP_filetype_t const, LIBMTP_allowed_values_t*);
    896 void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*);
    897 
    898 /**
    899  * @}
    900  * @defgroup files The file management API.
    901  * @{
    902  */
    903 LIBMTP_file_t *LIBMTP_new_file_t(void);
    904 void LIBMTP_destroy_file_t(LIBMTP_file_t*);
    905 char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t);
    906 LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *);
    907 LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *,
    908       LIBMTP_progressfunc_t const, void const * const);
    909 
    910 #define LIBMTP_FILES_AND_FOLDERS_ROOT 0xffffffff
    911 
    912 LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *,
    913 					     uint32_t const,
    914 					     uint32_t const);
    915 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
    916 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    917 			LIBMTP_progressfunc_t const, void const * const);
    918 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*,
    919 				       uint32_t const,
    920 				       int const,
    921 				       LIBMTP_progressfunc_t const,
    922 				       void const * const);
    923 int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *,
    924 			       uint32_t const,
    925 			       MTPDataPutFunc,
    926 			       void *,
    927 			       LIBMTP_progressfunc_t const,
    928 			       void const * const);
    929 int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *,
    930 			       char const * const,
    931 			       LIBMTP_file_t * const,
    932 			       LIBMTP_progressfunc_t const,
    933 			       void const * const);
    934 int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    935 					  int const,
    936 					  LIBMTP_file_t * const,
    937 					  LIBMTP_progressfunc_t const,
    938 					  void const * const);
    939 int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *,
    940 				  MTPDataGetFunc, void *,
    941 				  LIBMTP_file_t * const,
    942 				  LIBMTP_progressfunc_t const,
    943 				  void const * const);
    944 int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *,
    945 			 LIBMTP_file_t *,
    946 			 const char *);
    947 LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void);
    948 void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *);
    949 int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *,
    950                         LIBMTP_filetype_t const,
    951                         LIBMTP_filesampledata_t **);
    952 int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    953                           LIBMTP_filesampledata_t *);
    954 int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    955                           LIBMTP_filesampledata_t *);
    956 int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const,
    957                          unsigned char **data, unsigned int *size);
    958 
    959 void LIBMTP_Set_Load_Cache_On_Demand(int flag);
    960 
    961 /**
    962  * @}
    963  * @defgroup tracks The track management API.
    964  * @{
    965  */
    966 LIBMTP_track_t *LIBMTP_new_track_t(void);
    967 void LIBMTP_destroy_track_t(LIBMTP_track_t*);
    968 LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*);
    969 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*,
    970       LIBMTP_progressfunc_t const, void const * const);
    971 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const,
    972       LIBMTP_progressfunc_t const, void const * const);
    973 LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const);
    974 int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    975 			LIBMTP_progressfunc_t const, void const * const);
    976 int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    977 			LIBMTP_progressfunc_t const, void const * const);
    978 int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc,
    979       void *, LIBMTP_progressfunc_t const, void const * const);
    980 int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *,
    981 			 char const * const, LIBMTP_track_t * const,
    982                          LIBMTP_progressfunc_t const,
    983 			 void const * const);
    984 int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    985 			 int const, LIBMTP_track_t * const,
    986                          LIBMTP_progressfunc_t const,
    987 			 void const * const);
    988 int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *,
    989 			 MTPDataGetFunc, void *, LIBMTP_track_t * const,
    990                          LIBMTP_progressfunc_t const,
    991 			 void const * const);
    992 int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *,
    993 			LIBMTP_track_t const * const);
    994 int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const);
    995 int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *);
    996 /** @} */
    997 
    998 /**
    999  * @}
   1000  * @defgroup folders The folder management API.
   1001  * @{
   1002  */
   1003 LIBMTP_folder_t *LIBMTP_new_folder_t(void);
   1004 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*);
   1005 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*);
   1006 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*,
   1007 						    uint32_t const);
   1008 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const);
   1009 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t);
   1010 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *);
   1011 /** @} */
   1012 
   1013 
   1014 /**
   1015  * @}
   1016  * @defgroup playlists The audio/video playlist management API.
   1017  * @{
   1018  */
   1019 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void);
   1020 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *);
   1021 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *);
   1022 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const);
   1023 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
   1024 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
   1025 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *);
   1026 
   1027 /**
   1028  * @}
   1029  * @defgroup albums The audio/video album management API.
   1030  * @{
   1031  */
   1032 LIBMTP_album_t *LIBMTP_new_album_t(void);
   1033 void LIBMTP_destroy_album_t(LIBMTP_album_t *);
   1034 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *);
   1035 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const);
   1036 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const);
   1037 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const);
   1038 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const);
   1039 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *);
   1040 
   1041 /**
   1042  * @}
   1043  * @defgroup objects The object management API.
   1044  * @{
   1045  */
   1046 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
   1047 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
   1048 int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const,
   1049                             uint64_t, uint32_t,
   1050                             unsigned char **, unsigned int *);
   1051 int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const,
   1052                              uint64_t, unsigned char *, unsigned int);
   1053 int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const);
   1054 int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const);
   1055 int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t);
   1056 
   1057 /**
   1058  * @}
   1059  * @defgroup files The events API.
   1060  * @{
   1061  */
   1062 typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *);
   1063 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *);
   1064 int LIBMTP_Read_Event_Async(LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *);
   1065 int LIBMTP_Handle_Events_Timeout_Completed(struct timeval *, int *);
   1066 
   1067 /**
   1068  * @}
   1069  * @defgroup custom Custom operations API.
   1070  * @{
   1071  */
   1072 int LIBMTP_Custom_Operation(LIBMTP_mtpdevice_t *, uint16_t, int, ...);
   1073 
   1074 /** @} */
   1075 
   1076 /* End of C++ exports */
   1077 #ifdef __cplusplus
   1078 }
   1079 #endif
   1080 
   1081 #endif /* LIBMTP_H_INCLUSION_GUARD */
   1082 
   1083