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