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