1 | /** |
2 | * \file libmtp.h |
3 | * Interface to the Media Transfer Protocol library. |
4 | * |
5 | * Copyright (C) 2005-2012 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.6 |
33 | #define LIBMTP_VERSION_STRING "1.1.6" |
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 | , |
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 the numbered error codes. You can also |
407 | * get string representations for errors. |
408 | */ |
409 | typedef enum { |
410 | LIBMTP_ERROR_NONE, |
411 | LIBMTP_ERROR_GENERAL, |
412 | LIBMTP_ERROR_PTP_LAYER, |
413 | LIBMTP_ERROR_USB_LAYER, |
414 | LIBMTP_ERROR_MEMORY_ALLOCATION, |
415 | LIBMTP_ERROR_NO_DEVICE_ATTACHED, |
416 | LIBMTP_ERROR_STORAGE_FULL, |
417 | LIBMTP_ERROR_CONNECTING, |
418 | LIBMTP_ERROR_CANCELLED |
419 | } LIBMTP_error_number_t; |
420 | |
421 | typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ |
422 | typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t; /**< @see LIBMTP_raw_device_struct */ |
423 | typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_struct */ |
424 | typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t; /**< @see LIBMTP_allowed_values_struct */ |
425 | typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t; /** < @see LIBMTP_device_extension_struct */ |
426 | typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP_mtpdevice_struct */ |
427 | typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_struct */ |
428 | typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_struct */ |
429 | typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_playlist_struct */ |
430 | typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_struct */ |
431 | typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folder_t */ |
432 | typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_object_t */ |
433 | typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @see LIBMTP_filesample_t */ |
434 | typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @see LIBMTP_devicestorage_t */ |
435 | |
436 | /** |
437 | * The callback type definition. Notice that a progress percentage ratio |
438 | * is easy to calculate by dividing <code>sent</code> by |
439 | * <code>total</code>. |
440 | * @param sent the number of bytes sent so far |
441 | * @param total the total number of bytes to send |
442 | * @param data a user-defined dereferencable pointer |
443 | * @return if anything else than 0 is returned, the current transfer will be |
444 | * interrupted / cancelled. |
445 | */ |
446 | typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, |
447 | void const * const data); |
448 | |
449 | /** |
450 | * Callback function for get by handler function |
451 | * @param params the device parameters |
452 | * @param priv a user-defined dereferencable pointer |
453 | * @param wantlen the number of bytes wanted |
454 | * @param data a buffer to write the data to |
455 | * @param gotlen pointer to the number of bytes actually written |
456 | * to data |
457 | * @return LIBMTP_HANDLER_RETURN_OK if successful, |
458 | * LIBMTP_HANDLER_RETURN_ERROR on error or |
459 | * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer |
460 | */ |
461 | typedef uint16_t (* MTPDataGetFunc) (void* params, void* priv, |
462 | uint32_t wantlen, unsigned char *data, uint32_t *gotlen); |
463 | |
464 | /** |
465 | * Callback function for put by handler function |
466 | * @param params the device parameters |
467 | * @param priv a user-defined dereferencable pointer |
468 | * @param sendlen the number of bytes available |
469 | * @param data a buffer to read the data from |
470 | * @param putlen pointer to the number of bytes actually read |
471 | * from data |
472 | * @return LIBMTP_HANDLER_RETURN_OK if successful, |
473 | * LIBMTP_HANDLER_RETURN_ERROR on error or |
474 | * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer |
475 | */ |
476 | typedef uint16_t (* MTPDataPutFunc) (void* params, void* priv, |
477 | uint32_t sendlen, unsigned char *data, uint32_t *putlen); |
478 | |
479 | /** |
480 | * The return codes for the get/put functions |
481 | */ |
482 | #define LIBMTP_HANDLER_RETURN_OK 0 |
483 | #define LIBMTP_HANDLER_RETURN_ERROR 1 |
484 | #define LIBMTP_HANDLER_RETURN_CANCEL 2 |
485 | |
486 | /** |
487 | * @} |
488 | * @defgroup structar libmtp data structures |
489 | * @{ |
490 | */ |
491 | |
492 | /** |
493 | * A data structure to hold MTP device entries. |
494 | */ |
495 | struct LIBMTP_device_entry_struct { |
496 | char *vendor; /**< The vendor of this device */ |
497 | uint16_t vendor_id; /**< Vendor ID for this device */ |
498 | char *product; /**< The product name of this device */ |
499 | uint16_t product_id; /**< Product ID for this device */ |
500 | uint32_t device_flags; /**< Bugs, device specifics etc */ |
501 | }; |
502 | |
503 | /** |
504 | * A data structure to hold a raw MTP device connected |
505 | * to the bus. |
506 | */ |
507 | struct LIBMTP_raw_device_struct { |
508 | LIBMTP_device_entry_t device_entry; /**< The device entry for this raw device */ |
509 | uint32_t bus_location; /**< Location of the bus, if device available */ |
510 | uint8_t devnum; /**< Device number on the bus, if device available */ |
511 | }; |
512 | |
513 | /** |
514 | * A data structure to hold errors from the library. |
515 | */ |
516 | struct LIBMTP_error_struct { |
517 | LIBMTP_error_number_t errornumber; |
518 | char *error_text; |
519 | LIBMTP_error_t *next; |
520 | }; |
521 | |
522 | /** |
523 | * A data structure to hold allowed ranges of values |
524 | */ |
525 | struct LIBMTP_allowed_values_struct { |
526 | uint8_t u8max; |
527 | uint8_t u8min; |
528 | uint8_t u8step; |
529 | uint8_t* u8vals; |
530 | int8_t i8max; |
531 | int8_t i8min; |
532 | int8_t i8step; |
533 | int8_t* i8vals; |
534 | uint16_t u16max; |
535 | uint16_t u16min; |
536 | uint16_t u16step; |
537 | uint16_t* u16vals; |
538 | int16_t i16max; |
539 | int16_t i16min; |
540 | int16_t i16step; |
541 | int16_t* i16vals; |
542 | uint32_t u32max; |
543 | uint32_t u32min; |
544 | uint32_t u32step; |
545 | uint32_t* u32vals; |
546 | int32_t i32max; |
547 | int32_t i32min; |
548 | int32_t i32step; |
549 | int32_t* i32vals; |
550 | uint64_t u64max; |
551 | uint64_t u64min; |
552 | uint64_t u64step; |
553 | uint64_t* u64vals; |
554 | int64_t i64max; |
555 | int64_t i64min; |
556 | int64_t i64step; |
557 | int64_t* i64vals; |
558 | /** |
559 | * Number of entries in the vals array |
560 | */ |
561 | uint16_t num_entries; |
562 | /** |
563 | * The datatype specifying which of the above is used |
564 | */ |
565 | LIBMTP_datatype_t datatype; |
566 | /** |
567 | * Non zero for range, 0 for enum |
568 | */ |
569 | int is_range; |
570 | }; |
571 | |
572 | /** |
573 | * MTP device extension holder struct |
574 | */ |
575 | struct LIBMTP_device_extension_struct { |
576 | /** |
577 | * Name of extension e.g. "foo.com" |
578 | */ |
579 | char *name; |
580 | /** |
581 | * Major revision of extension |
582 | */ |
583 | int major; |
584 | /** |
585 | * Minor revision of extension |
586 | */ |
587 | int minor; |
588 | /** |
589 | * Pointer to the next extension or NULL if this is the |
590 | * last extension. |
591 | */ |
592 | LIBMTP_device_extension_t *next; |
593 | }; |
594 | |
595 | /** |
596 | * Main MTP device object struct |
597 | */ |
598 | struct LIBMTP_mtpdevice_struct { |
599 | /** |
600 | * Object bitsize, typically 32 or 64. |
601 | */ |
602 | uint8_t object_bitsize; |
603 | /** |
604 | * Parameters for this device, must be cast into |
605 | * \c (PTPParams*) before internal use. |
606 | */ |
607 | void *params; |
608 | /** |
609 | * USB device for this device, must be cast into |
610 | * \c (PTP_USB*) before internal use. |
611 | */ |
612 | void *usbinfo; |
613 | /** |
614 | * The storage for this device, do not use strings in here without |
615 | * copying them first, and beware that this list may be rebuilt at |
616 | * any time. |
617 | * @see LIBMTP_Get_Storage() |
618 | */ |
619 | LIBMTP_devicestorage_t *storage; |
620 | /** |
621 | * The error stack. This shall be handled using the error getting |
622 | * and clearing functions, not by dereferencing this list. |
623 | */ |
624 | LIBMTP_error_t *errorstack; |
625 | /** The maximum battery level for this device */ |
626 | uint8_t maximum_battery_level; |
627 | /** Default music folder */ |
628 | uint32_t default_music_folder; |
629 | /** Default playlist folder */ |
630 | uint32_t default_playlist_folder; |
631 | /** Default picture folder */ |
632 | uint32_t default_picture_folder; |
633 | /** Default video folder */ |
634 | uint32_t default_video_folder; |
635 | /** Default organizer folder */ |
636 | uint32_t default_organizer_folder; |
637 | /** Default ZENcast folder (only Creative devices...) */ |
638 | uint32_t default_zencast_folder; |
639 | /** Default Album folder */ |
640 | uint32_t default_album_folder; |
641 | /** Default Text folder */ |
642 | uint32_t default_text_folder; |
643 | /** Per device iconv() converters, only used internally */ |
644 | void *cd; |
645 | /** Extension list */ |
646 | LIBMTP_device_extension_t *extensions; |
647 | /** Whether the device uses caching, only used internally */ |
648 | int cached; |
649 | |
650 | /** Pointer to next device in linked list; NULL if this is the last device */ |
651 | LIBMTP_mtpdevice_t *next; |
652 | }; |
653 | |
654 | /** |
655 | * MTP file struct |
656 | */ |
657 | struct LIBMTP_file_struct { |
658 | uint32_t item_id; /**< Unique item ID */ |
659 | uint32_t parent_id; /**< ID of parent folder */ |
660 | uint32_t storage_id; /**< ID of storage holding this file */ |
661 | char *filename; /**< Filename of this file */ |
662 | uint64_t filesize; /**< Size of file in bytes */ |
663 | time_t modificationdate; /**< Date of last alteration of the file */ |
664 | LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ |
665 | LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ |
666 | }; |
667 | |
668 | /** |
669 | * MTP track struct |
670 | */ |
671 | struct LIBMTP_track_struct { |
672 | uint32_t item_id; /**< Unique item ID */ |
673 | uint32_t parent_id; /**< ID of parent folder */ |
674 | uint32_t storage_id; /**< ID of storage holding this track */ |
675 | char *title; /**< Track title */ |
676 | char *artist; /**< Name of recording artist */ |
677 | char *composer; /**< Name of recording composer */ |
678 | char *genre; /**< Genre name for track */ |
679 | char *album; /**< Album name for track */ |
680 | char *date; /**< Date of original recording as a string */ |
681 | char *filename; /**< Original filename of this track */ |
682 | uint16_t tracknumber; /**< Track number (in sequence on recording) */ |
683 | uint32_t duration; /**< Duration in milliseconds */ |
684 | uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0xbb80 */ |
685 | uint16_t nochannels; /**< Number of channels in this recording 0 = unknown, 1 or 2 */ |
686 | uint32_t wavecodec; /**< FourCC wave codec name */ |
687 | uint32_t bitrate; /**< (Average) bitrate for this file min=1 max=0x16e360 */ |
688 | uint16_t bitratetype; /**< 0 = unused, 1 = constant, 2 = VBR, 3 = free */ |
689 | uint16_t rating; /**< User rating 0-100 (0x00-0x64) */ |
690 | uint32_t usecount; /**< Number of times used/played */ |
691 | uint64_t filesize; /**< Size of track file in bytes */ |
692 | time_t modificationdate; /**< Date of last alteration of the track */ |
693 | LIBMTP_filetype_t filetype; /**< Filetype used for the current track */ |
694 | LIBMTP_track_t *next; /**< Next track in list or NULL if last track */ |
695 | }; |
696 | |
697 | /** |
698 | * MTP Playlist structure |
699 | */ |
700 | struct LIBMTP_playlist_struct { |
701 | uint32_t playlist_id; /**< Unique playlist ID */ |
702 | uint32_t parent_id; /**< ID of parent folder */ |
703 | uint32_t storage_id; /**< ID of storage holding this playlist */ |
704 | char *name; /**< Name of playlist */ |
705 | uint32_t *tracks; /**< The tracks in this playlist */ |
706 | uint32_t no_tracks; /**< The number of tracks in this playlist */ |
707 | LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ |
708 | }; |
709 | |
710 | /** |
711 | * MTP Album structure |
712 | */ |
713 | struct LIBMTP_album_struct { |
714 | uint32_t album_id; /**< Unique playlist ID */ |
715 | uint32_t parent_id; /**< ID of parent folder */ |
716 | uint32_t storage_id; /**< ID of storage holding this album */ |
717 | char *name; /**< Name of album */ |
718 | char *artist; /**< Name of album artist */ |
719 | char *composer; /**< Name of recording composer */ |
720 | char *genre; /**< Genre of album */ |
721 | uint32_t *tracks; /**< The tracks in this album */ |
722 | uint32_t no_tracks; /**< The number of tracks in this album */ |
723 | LIBMTP_album_t *next; /**< Next album or NULL if last album */ |
724 | }; |
725 | |
726 | /** |
727 | * MTP Folder structure |
728 | */ |
729 | struct LIBMTP_folder_struct { |
730 | uint32_t folder_id; /**< Unique folder ID */ |
731 | uint32_t parent_id; /**< ID of parent folder */ |
732 | uint32_t storage_id; /**< ID of storage holding this folder */ |
733 | char *name; /**< Name of folder */ |
734 | LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no more */ |
735 | LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ |
736 | }; |
737 | |
738 | /** |
739 | * LIBMTP Object RepresentativeSampleData Structure |
740 | */ |
741 | struct LIBMTP_filesampledata_struct { |
742 | uint32_t width; /**< Width of sample if it is an image */ |
743 | uint32_t height; /**< Height of sample if it is an image */ |
744 | uint32_t duration; /**< Duration in milliseconds if it is audio */ |
745 | LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ |
746 | uint64_t size; /**< Size of sample data in bytes */ |
747 | char *data; /**< Sample data */ |
748 | }; |
749 | |
750 | /** |
751 | * LIBMTP Device Storage structure |
752 | */ |
753 | struct LIBMTP_devicestorage_struct { |
754 | uint32_t id; /**< Unique ID for this storage */ |
755 | uint16_t StorageType; /**< Storage type */ |
756 | uint16_t FilesystemType; /**< Filesystem type */ |
757 | uint16_t AccessCapability; /**< Access capability */ |
758 | uint64_t MaxCapacity; /**< Maximum capability */ |
759 | uint64_t FreeSpaceInBytes; /**< Free space in bytes */ |
760 | uint64_t FreeSpaceInObjects; /**< Free space in objects */ |
761 | char *StorageDescription; /**< A brief description of this storage */ |
762 | char *VolumeIdentifier; /**< A volume identifier */ |
763 | LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until NULL */ |
764 | LIBMTP_devicestorage_t *prev; /**< Previous storage */ |
765 | }; |
766 | |
767 | /** |
768 | * LIBMTP Event structure |
769 | * TODO: add all externally visible events here |
770 | */ |
771 | enum LIBMTP_event_enum { |
772 | LIBMTP_EVENT_NONE, |
773 | LIBMTP_EVENT_STORE_ADDED, |
774 | LIBMTP_EVENT_STORE_REMOVED, |
775 | LIBMTP_EVENT_OBJECT_ADDED, |
776 | LIBMTP_EVENT_OBJECT_REMOVED, |
777 | }; |
778 | typedef enum LIBMTP_event_enum LIBMTP_event_t; |
779 | |
780 | /** @} */ |
781 | |
782 | /* Make functions available for C++ */ |
783 | #ifdef __cplusplus |
784 | extern "C" { |
785 | #endif |
786 | |
787 | extern int LIBMTP_debug; |
788 | |
789 | /** |
790 | * @defgroup internals The libmtp internals API. |
791 | * @{ |
792 | */ |
793 | void LIBMTP_Set_Debug(int); |
794 | void LIBMTP_Init(void); |
795 | int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); |
796 | /** |
797 | * @} |
798 | * @defgroup basic The basic device management API. |
799 | * @{ |
800 | */ |
801 | LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); |
802 | int LIBMTP_Check_Specific_Device(int busno, int devno); |
803 | LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); |
804 | LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *); |
805 | /* Begin old, legacy interface */ |
806 | LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); |
807 | LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); |
808 | uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); |
809 | void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); |
810 | /* End old, legacy interface */ |
811 | void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); |
812 | void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); |
813 | int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); |
814 | char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); |
815 | char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); |
816 | char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); |
817 | char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); |
818 | char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); |
819 | int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); |
820 | char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); |
821 | int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); |
822 | int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, |
823 | uint8_t * const, |
824 | uint8_t * const); |
825 | int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); |
826 | int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); |
827 | int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); |
828 | LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); |
829 | void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); |
830 | void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); |
831 | |
832 | #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 |
833 | #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 |
834 | #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 |
835 | |
836 | int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); |
837 | int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); |
838 | |
839 | /** |
840 | * Get/set arbitrary properties. These do not update the cache; should only be used on |
841 | * properties not stored in structs |
842 | */ |
843 | char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const); |
844 | uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
845 | LIBMTP_property_t const, uint64_t const); |
846 | uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
847 | LIBMTP_property_t const, uint32_t const); |
848 | uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
849 | LIBMTP_property_t const, uint16_t const); |
850 | uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
851 | LIBMTP_property_t const, uint8_t const); |
852 | int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const, |
853 | LIBMTP_property_t const, char const * const); |
854 | int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const, |
855 | LIBMTP_property_t const, uint32_t const); |
856 | int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const, |
857 | LIBMTP_property_t const, uint16_t const); |
858 | int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const, |
859 | LIBMTP_property_t const, uint8_t const); |
860 | char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty); |
861 | int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, |
862 | LIBMTP_filetype_t const); |
863 | int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, |
864 | LIBMTP_filetype_t const, LIBMTP_allowed_values_t*); |
865 | void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*); |
866 | |
867 | /** |
868 | * @} |
869 | * @defgroup files The file management API. |
870 | * @{ |
871 | */ |
872 | LIBMTP_file_t *LIBMTP_new_file_t(void); |
873 | void LIBMTP_destroy_file_t(LIBMTP_file_t*); |
874 | char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); |
875 | LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); |
876 | LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, |
877 | LIBMTP_progressfunc_t const, void const * const); |
878 | LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *, |
879 | uint32_t const, |
880 | uint32_t const); |
881 | LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const); |
882 | int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, |
883 | LIBMTP_progressfunc_t const, void const * const); |
884 | int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, |
885 | uint32_t const, |
886 | int const, |
887 | LIBMTP_progressfunc_t const, |
888 | void const * const); |
889 | int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, |
890 | uint32_t const, |
891 | MTPDataPutFunc, |
892 | void *, |
893 | LIBMTP_progressfunc_t const, |
894 | void const * const); |
895 | int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, |
896 | char const * const, |
897 | LIBMTP_file_t * const, |
898 | LIBMTP_progressfunc_t const, |
899 | void const * const); |
900 | int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, |
901 | int const, |
902 | LIBMTP_file_t * const, |
903 | LIBMTP_progressfunc_t const, |
904 | void const * const); |
905 | int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, |
906 | MTPDataGetFunc, void *, |
907 | LIBMTP_file_t * const, |
908 | LIBMTP_progressfunc_t const, |
909 | void const * const); |
910 | int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, |
911 | LIBMTP_file_t *, |
912 | const char *); |
913 | LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); |
914 | void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); |
915 | int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, |
916 | LIBMTP_filetype_t const, |
917 | LIBMTP_filesampledata_t **); |
918 | int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, |
919 | LIBMTP_filesampledata_t *); |
920 | int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, |
921 | LIBMTP_filesampledata_t *); |
922 | int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, |
923 | unsigned char **data, unsigned int *size); |
924 | |
925 | /** |
926 | * @} |
927 | * @defgroup tracks The track management API. |
928 | * @{ |
929 | */ |
930 | LIBMTP_track_t *LIBMTP_new_track_t(void); |
931 | void LIBMTP_destroy_track_t(LIBMTP_track_t*); |
932 | LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); |
933 | LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*, |
934 | LIBMTP_progressfunc_t const, void const * const); |
935 | LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const, |
936 | LIBMTP_progressfunc_t const, void const * const); |
937 | LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const); |
938 | int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, |
939 | LIBMTP_progressfunc_t const, void const * const); |
940 | int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, |
941 | LIBMTP_progressfunc_t const, void const * const); |
942 | int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, |
943 | void *, LIBMTP_progressfunc_t const, void const * const); |
944 | int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, |
945 | char const * const, LIBMTP_track_t * const, |
946 | LIBMTP_progressfunc_t const, |
947 | void const * const); |
948 | int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, |
949 | int const, LIBMTP_track_t * const, |
950 | LIBMTP_progressfunc_t const, |
951 | void const * const); |
952 | int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, |
953 | MTPDataGetFunc, void *, LIBMTP_track_t * const, |
954 | LIBMTP_progressfunc_t const, |
955 | void const * const); |
956 | int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, |
957 | LIBMTP_track_t const * const); |
958 | int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const); |
959 | int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *); |
960 | /** @} */ |
961 | |
962 | /** |
963 | * @} |
964 | * @defgroup folders The folder management API. |
965 | * @{ |
966 | */ |
967 | LIBMTP_folder_t *LIBMTP_new_folder_t(void); |
968 | void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); |
969 | LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); |
970 | LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, |
971 | uint32_t const); |
972 | LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); |
973 | uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); |
974 | int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *); |
975 | /** @} */ |
976 | |
977 | |
978 | /** |
979 | * @} |
980 | * @defgroup playlists The audio/video playlist management API. |
981 | * @{ |
982 | */ |
983 | LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); |
984 | void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); |
985 | LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); |
986 | LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); |
987 | int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
988 | int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
989 | int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *); |
990 | |
991 | /** |
992 | * @} |
993 | * @defgroup albums The audio/video album management API. |
994 | * @{ |
995 | */ |
996 | LIBMTP_album_t *LIBMTP_new_album_t(void); |
997 | void LIBMTP_destroy_album_t(LIBMTP_album_t *); |
998 | LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); |
999 | LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const); |
1000 | LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); |
1001 | int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); |
1002 | int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); |
1003 | int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); |
1004 | |
1005 | /** |
1006 | * @} |
1007 | * @defgroup objects The object management API. |
1008 | * @{ |
1009 | */ |
1010 | int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); |
1011 | int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); |
1012 | int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, |
1013 | uint64_t, uint32_t, |
1014 | unsigned char **, unsigned int *); |
1015 | int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, |
1016 | uint64_t, unsigned char *, unsigned int); |
1017 | int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const); |
1018 | int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const); |
1019 | int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t); |
1020 | |
1021 | /** |
1022 | * @} |
1023 | * @defgroup files The events API. |
1024 | * @{ |
1025 | */ |
1026 | int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); |
1027 | |
1028 | /** @} */ |
1029 | |
1030 | /* End of C++ exports */ |
1031 | #ifdef __cplusplus |
1032 | } |
1033 | #endif |
1034 | |
1035 | #endif /* LIBMTP_H_INCLUSION_GUARD */ |
1036 | |
1037 | |