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