libmtp: /usr/obj/ports/libmtp-1.1.6/libmtp-1.1.6/src/libmtp.h Source File

libmtp 1.1.6

- Main Page
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

libmtp.h
Go to the documentation of this file.
1
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
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
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
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
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
168 #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\
169 (a == LIBMTP_FILETYPE_MP4 ||\
170 a == LIBMTP_FILETYPE_ASF ||\
171 a == LIBMTP_FILETYPE_QT)
172
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
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
204 #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\
205 (a == LIBMTP_FILETYPE_VCARD2 ||\
206 a == LIBMTP_FILETYPE_VCARD3)
207
212 #define LIBMTP_FILETYPE_IS_CALENDAR(a)\
213 (a == LIBMTP_FILETYPE_VCALENDAR1 ||\
214 a == LIBMTP_FILETYPE_VCALENDAR2)
215
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
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
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;
422 typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t;
423 typedef struct LIBMTP_error_struct LIBMTP_error_t;
424 typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t;
425 typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t;
426 typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t;
427 typedef struct LIBMTP_file_struct LIBMTP_file_t;
428 typedef struct LIBMTP_track_struct LIBMTP_track_t;
429 typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t;
430 typedef struct LIBMTP_album_struct LIBMTP_album_t;
431 typedef struct LIBMTP_folder_struct LIBMTP_folder_t;
432 typedef struct LIBMTP_object_struct LIBMTP_object_t;
433 typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t;
434 typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t;
446 typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total,
447 void const * const data);
448
461 typedef uint16_t (* MTPDataGetFunc) (void* params, void* priv,
462 uint32_t wantlen, unsigned char *data, uint32_t *gotlen);
463
476 typedef uint16_t (* MTPDataPutFunc) (void* params, void* priv,
477 uint32_t sendlen, unsigned char *data, uint32_t *putlen);
478
482 #define LIBMTP_HANDLER_RETURN_OK 0
483 #define LIBMTP_HANDLER_RETURN_ERROR 1
484 #define LIBMTP_HANDLER_RETURN_CANCEL 2
485
495 struct LIBMTP_device_entry_struct {
496 char *vendor;
497 uint16_t vendor_id;
498 char *product;
499 uint16_t product_id;
500 uint32_t device_flags;
501 };
502
507 struct LIBMTP_raw_device_struct {
508 LIBMTP_device_entry_t device_entry;
509 uint32_t bus_location;
510 uint8_t devnum;
511 };
512
516 struct LIBMTP_error_struct {
517 LIBMTP_error_number_t errornumber;
518 char *error_text;
519 LIBMTP_error_t *next;
520 };
521
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;
561 uint16_t num_entries;
565 LIBMTP_datatype_t datatype;
569 int is_range;
570 };
571
575 struct LIBMTP_device_extension_struct {
579 char *name;
583 int major;
587 int minor;
592 LIBMTP_device_extension_t *next;
593 };
594
598 struct LIBMTP_mtpdevice_struct {
602 uint8_t object_bitsize;
607 void *params;
612 void *usbinfo;
619 LIBMTP_devicestorage_t *storage;
624 LIBMTP_error_t *errorstack;
626 uint8_t maximum_battery_level;
628 uint32_t default_music_folder;
630 uint32_t default_playlist_folder;
632 uint32_t default_picture_folder;
634 uint32_t default_video_folder;
636 uint32_t default_organizer_folder;
638 uint32_t default_zencast_folder;
640 uint32_t default_album_folder;
642 uint32_t default_text_folder;
644 void *cd;
646 LIBMTP_device_extension_t *extensions;
648 int cached;
649
651 LIBMTP_mtpdevice_t *next;
652 };
653
657 struct LIBMTP_file_struct {
658 uint32_t item_id;
659 uint32_t parent_id;
660 uint32_t storage_id;
661 char *filename;
662 uint64_t filesize;
663 time_t modificationdate;
664 LIBMTP_filetype_t filetype;
665 LIBMTP_file_t *next;
666 };
667
671 struct LIBMTP_track_struct {
672 uint32_t item_id;
673 uint32_t parent_id;
674 uint32_t storage_id;
675 char *title;
676 char *artist;
677 char *composer;
678 char *genre;
679 char *album;
680 char *date;
681 char *filename;
682 uint16_t tracknumber;
683 uint32_t duration;
684 uint32_t samplerate;
685 uint16_t nochannels;
686 uint32_t wavecodec;
687 uint32_t bitrate;
688 uint16_t bitratetype;
689 uint16_t rating;
690 uint32_t usecount;
691 uint64_t filesize;
692 time_t modificationdate;
693 LIBMTP_filetype_t filetype;
694 LIBMTP_track_t *next;
695 };
696
700 struct LIBMTP_playlist_struct {
701 uint32_t playlist_id;
702 uint32_t parent_id;
703 uint32_t storage_id;
704 char *name;
705 uint32_t *tracks;
706 uint32_t no_tracks;
707 LIBMTP_playlist_t *next;
708 };
709
713 struct LIBMTP_album_struct {
714 uint32_t album_id;
715 uint32_t parent_id;
716 uint32_t storage_id;
717 char *name;
718 char *artist;
719 char *composer;
720 char *genre;
721 uint32_t *tracks;
722 uint32_t no_tracks;
723 LIBMTP_album_t *next;
724 };
725
729 struct LIBMTP_folder_struct {
730 uint32_t folder_id;
731 uint32_t parent_id;
732 uint32_t storage_id;
733 char *name;
734 LIBMTP_folder_t *sibling;
735 LIBMTP_folder_t *child;
736 };
737
741 struct LIBMTP_filesampledata_struct {
742 uint32_t width;
743 uint32_t height;
744 uint32_t duration;
745 LIBMTP_filetype_t filetype;
746 uint64_t size;
747 char *data;
748 };
749
753 struct LIBMTP_devicestorage_struct {
754 uint32_t id;
755 uint16_t StorageType;
756 uint16_t FilesystemType;
757 uint16_t AccessCapability;
758 uint64_t MaxCapacity;
759 uint64_t FreeSpaceInBytes;
760 uint64_t FreeSpaceInObjects;
761 char *StorageDescription;
762 char *VolumeIdentifier;
763 LIBMTP_devicestorage_t *next;
764 LIBMTP_devicestorage_t *prev;
765 };
766
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
782 /* Make functions available for C++ */
783 #ifdef __cplusplus
784 extern "C" {
785 #endif
786
787 extern int LIBMTP_debug;
788
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);
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
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
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
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 *);
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 *);
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
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
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
1026 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *);
1027
1030 /* End of C++ exports */
1031 #ifdef __cplusplus
1032 }
1033 #endif
1034
1035 #endif /* LIBMTP_H_INCLUSION_GUARD */
1036