# libmtp.h

Go to the documentation of this file.

    00001
    00029 #ifndef LIBMTP_H_INCLUSION_GUARD
    00030 #define LIBMTP_H_INCLUSION_GUARD
    00031
    00032 #define LIBMTP_VERSION 1.0.1
    00033 #define LIBMTP_VERSION_STRING "1.0.1"
    00034
    00035 /* This handles MSVC pecularities */
    00036 #ifdef _MSC_VER
    00037 #include <windows.h>
    00038 #define __WIN32__
    00039 #define snprintf _snprintf
    00040 #define ssize_t SSIZE_T
    00041 /*
    00042  * Types that do not exist in Windows
    00043  * sys/types.h, but they exist in mingw32
    00044  * sys/types.h.
    00045  */
    00046 typedef char int8_t;
    00047 typedef unsigned char uint8_t;
    00048 typedef __int16 int16_t;
    00049 typedef unsigned __int16 uint16_t;
    00050 typedef __int32 int32_t;
    00051 typedef unsigned __int32 uint32_t;
    00052 typedef unsigned __int64 uint64_t;
    00053 #endif
    00054
    00055 #include <stdio.h>
    00056 #include <usb.h>
    00057 #include <stdint.h>
    00058
    00066 typedef enum {
    00067   LIBMTP_FILETYPE_WAV,
    00068   LIBMTP_FILETYPE_MP3,
    00069   LIBMTP_FILETYPE_WMA,
    00070   LIBMTP_FILETYPE_OGG,
    00071   LIBMTP_FILETYPE_AUDIBLE,
    00072   LIBMTP_FILETYPE_MP4,
    00073   LIBMTP_FILETYPE_UNDEF_AUDIO,
    00074   LIBMTP_FILETYPE_WMV,
    00075   LIBMTP_FILETYPE_AVI,
    00076   LIBMTP_FILETYPE_MPEG,
    00077   LIBMTP_FILETYPE_ASF,
    00078   LIBMTP_FILETYPE_QT,
    00079   LIBMTP_FILETYPE_UNDEF_VIDEO,
    00080   LIBMTP_FILETYPE_JPEG,
    00081   LIBMTP_FILETYPE_JFIF,
    00082   LIBMTP_FILETYPE_TIFF,
    00083   LIBMTP_FILETYPE_BMP,
    00084   LIBMTP_FILETYPE_GIF,
    00085   LIBMTP_FILETYPE_PICT,
    00086   LIBMTP_FILETYPE_PNG,
    00087   LIBMTP_FILETYPE_VCALENDAR1,
    00088   LIBMTP_FILETYPE_VCALENDAR2,
    00089   LIBMTP_FILETYPE_VCARD2,
    00090   LIBMTP_FILETYPE_VCARD3,
    00091   LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT,
    00092   LIBMTP_FILETYPE_WINEXEC,
    00093   LIBMTP_FILETYPE_TEXT,
    00094   LIBMTP_FILETYPE_HTML,
    00095   LIBMTP_FILETYPE_FIRMWARE,
    00096   LIBMTP_FILETYPE_AAC,
    00097   LIBMTP_FILETYPE_MEDIACARD,
    00098   LIBMTP_FILETYPE_FLAC,
    00099   LIBMTP_FILETYPE_MP2,
    00100   LIBMTP_FILETYPE_M4A,
    00101   LIBMTP_FILETYPE_DOC,
    00102   LIBMTP_FILETYPE_XML,
    00103   LIBMTP_FILETYPE_XLS,
    00104   LIBMTP_FILETYPE_PPT,
    00105   LIBMTP_FILETYPE_MHT,
    00106   LIBMTP_FILETYPE_JP2,
    00107   LIBMTP_FILETYPE_JPX,
    00108   LIBMTP_FILETYPE_ALBUM,
    00109   LIBMTP_FILETYPE_PLAYLIST,
    00110   LIBMTP_FILETYPE_UNKNOWN
    00111 } LIBMTP_filetype_t;
    00112
    00120 #define LIBMTP_FILETYPE_IS_AUDIO(a)\
    00121 (a == LIBMTP_FILETYPE_WAV ||\
    00122  a == LIBMTP_FILETYPE_MP3 ||\
    00123  a == LIBMTP_FILETYPE_MP2 ||\
    00124  a == LIBMTP_FILETYPE_WMA ||\
    00125  a == LIBMTP_FILETYPE_OGG ||\
    00126  a == LIBMTP_FILETYPE_FLAC ||\
    00127  a == LIBMTP_FILETYPE_AAC ||\
    00128  a == LIBMTP_FILETYPE_M4A ||\
    00129  a == LIBMTP_FILETYPE_AUDIBLE ||\
    00130  a == LIBMTP_FILETYPE_UNDEF_AUDIO)
    00131
    00139 #define LIBMTP_FILETYPE_IS_VIDEO(a)\
    00140 (a == LIBMTP_FILETYPE_WMV ||\
    00141  a == LIBMTP_FILETYPE_AVI ||\
    00142  a == LIBMTP_FILETYPE_MPEG ||\
    00143  a == LIBMTP_FILETYPE_UNDEF_VIDEO)
    00144
    00149 #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\
    00150 (a == LIBMTP_FILETYPE_MP4 ||\
    00151  a == LIBMTP_FILETYPE_ASF ||\
    00152  a == LIBMTP_FILETYPE_QT)
    00153
    00160 #define LIBMTP_FILETYPE_IS_TRACK(a)\
    00161 (LIBMTP_FILETYPE_IS_AUDIO(a) ||\
    00162  LIBMTP_FILETYPE_IS_VIDEO(a) ||\
    00163  LIBMTP_FILETYPE_IS_AUDIOVIDEO(a))
    00164
    00169 #define LIBMTP_FILETYPE_IS_IMAGE(a)\
    00170 (a == LIBMTP_FILETYPE_JPEG ||\
    00171 a == LIBMTP_FILETYPE_JFIF ||\
    00172 a == LIBMTP_FILETYPE_TIFF ||\
    00173 a == LIBMTP_FILETYPE_BMP ||\
    00174 a == LIBMTP_FILETYPE_GIF ||\
    00175 a == LIBMTP_FILETYPE_PICT ||\
    00176 a == LIBMTP_FILETYPE_PNG ||\
    00177 a == LIBMTP_FILETYPE_JP2 ||\
    00178 a == LIBMTP_FILETYPE_JPX ||\
    00179 a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT)
    00180
    00185 #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\
    00186 (a == LIBMTP_FILETYPE_VCARD2 ||\
    00187 a == LIBMTP_FILETYPE_VCARD2)
    00188
    00193 #define LIBMTP_FILETYPE_IS_CALENDAR(a)\
    00194 (a == LIBMTP_FILETYPE_VCALENDAR1 ||\
    00195 a == LIBMTP_FILETYPE_VCALENDAR2)
    00196
    00201 typedef enum {
    00202   LIBMTP_PROPERTY_StorageID,
    00203   LIBMTP_PROPERTY_ObjectFormat,
    00204   LIBMTP_PROPERTY_ProtectionStatus,
    00205   LIBMTP_PROPERTY_ObjectSize,
    00206   LIBMTP_PROPERTY_AssociationType,
    00207   LIBMTP_PROPERTY_AssociationDesc,
    00208   LIBMTP_PROPERTY_ObjectFileName,
    00209   LIBMTP_PROPERTY_DateCreated,
    00210   LIBMTP_PROPERTY_DateModified,
    00211   LIBMTP_PROPERTY_Keywords,
    00212   LIBMTP_PROPERTY_ParentObject,
    00213   LIBMTP_PROPERTY_AllowedFolderContents,
    00214   LIBMTP_PROPERTY_Hidden,
    00215   LIBMTP_PROPERTY_SystemObject,
    00216   LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier,
    00217   LIBMTP_PROPERTY_SyncID,
    00218   LIBMTP_PROPERTY_PropertyBag,
    00219   LIBMTP_PROPERTY_Name,
    00220   LIBMTP_PROPERTY_CreatedBy,
    00221   LIBMTP_PROPERTY_Artist,
    00222   LIBMTP_PROPERTY_DateAuthored,
    00223   LIBMTP_PROPERTY_Description,
    00224   LIBMTP_PROPERTY_URLReference,
    00225   LIBMTP_PROPERTY_LanguageLocale,
    00226   LIBMTP_PROPERTY_CopyrightInformation,
    00227   LIBMTP_PROPERTY_Source,
    00228   LIBMTP_PROPERTY_OriginLocation,
    00229   LIBMTP_PROPERTY_DateAdded,
    00230   LIBMTP_PROPERTY_NonConsumable,
    00231   LIBMTP_PROPERTY_CorruptOrUnplayable,
    00232   LIBMTP_PROPERTY_ProducerSerialNumber,
    00233   LIBMTP_PROPERTY_RepresentativeSampleFormat,
    00234   LIBMTP_PROPERTY_RepresentativeSampleSize,
    00235   LIBMTP_PROPERTY_RepresentativeSampleHeight,
    00236   LIBMTP_PROPERTY_RepresentativeSampleWidth,
    00237   LIBMTP_PROPERTY_RepresentativeSampleDuration,
    00238   LIBMTP_PROPERTY_RepresentativeSampleData,
    00239   LIBMTP_PROPERTY_Width,
    00240   LIBMTP_PROPERTY_Height,
    00241   LIBMTP_PROPERTY_Duration,
    00242   LIBMTP_PROPERTY_Rating,
    00243   LIBMTP_PROPERTY_Track,
    00244   LIBMTP_PROPERTY_Genre,
    00245   LIBMTP_PROPERTY_Credits,
    00246   LIBMTP_PROPERTY_Lyrics,
    00247   LIBMTP_PROPERTY_SubscriptionContentID,
    00248   LIBMTP_PROPERTY_ProducedBy,
    00249   LIBMTP_PROPERTY_UseCount,
    00250   LIBMTP_PROPERTY_SkipCount,
    00251   LIBMTP_PROPERTY_LastAccessed,
    00252   LIBMTP_PROPERTY_ParentalRating,
    00253   LIBMTP_PROPERTY_MetaGenre,
    00254   LIBMTP_PROPERTY_Composer,
    00255   LIBMTP_PROPERTY_EffectiveRating,
    00256   LIBMTP_PROPERTY_Subtitle,
    00257   LIBMTP_PROPERTY_OriginalReleaseDate,
    00258   LIBMTP_PROPERTY_AlbumName,
    00259   LIBMTP_PROPERTY_AlbumArtist,
    00260   LIBMTP_PROPERTY_Mood,
    00261   LIBMTP_PROPERTY_DRMStatus,
    00262   LIBMTP_PROPERTY_SubDescription,
    00263   LIBMTP_PROPERTY_IsCropped,
    00264   LIBMTP_PROPERTY_IsColorCorrected,
    00265   LIBMTP_PROPERTY_ImageBitDepth,
    00266   LIBMTP_PROPERTY_Fnumber,
    00267   LIBMTP_PROPERTY_ExposureTime,
    00268   LIBMTP_PROPERTY_ExposureIndex,
    00269   LIBMTP_PROPERTY_DisplayName,
    00270   LIBMTP_PROPERTY_BodyText,
    00271   LIBMTP_PROPERTY_Subject,
    00272   LIBMTP_PROPERTY_Priority,
    00273   LIBMTP_PROPERTY_GivenName,
    00274   LIBMTP_PROPERTY_MiddleNames,
    00275   LIBMTP_PROPERTY_FamilyName,
    00276   LIBMTP_PROPERTY_Prefix,
    00277   LIBMTP_PROPERTY_Suffix,
    00278   LIBMTP_PROPERTY_PhoneticGivenName,
    00279   LIBMTP_PROPERTY_PhoneticFamilyName,
    00280   LIBMTP_PROPERTY_EmailPrimary,
    00281   LIBMTP_PROPERTY_EmailPersonal1,
    00282   LIBMTP_PROPERTY_EmailPersonal2,
    00283   LIBMTP_PROPERTY_EmailBusiness1,
    00284   LIBMTP_PROPERTY_EmailBusiness2,
    00285   LIBMTP_PROPERTY_EmailOthers,
    00286   LIBMTP_PROPERTY_PhoneNumberPrimary,
    00287   LIBMTP_PROPERTY_PhoneNumberPersonal,
    00288   LIBMTP_PROPERTY_PhoneNumberPersonal2,
    00289   LIBMTP_PROPERTY_PhoneNumberBusiness,
    00290   LIBMTP_PROPERTY_PhoneNumberBusiness2,
    00291   LIBMTP_PROPERTY_PhoneNumberMobile,
    00292   LIBMTP_PROPERTY_PhoneNumberMobile2,
    00293   LIBMTP_PROPERTY_FaxNumberPrimary,
    00294   LIBMTP_PROPERTY_FaxNumberPersonal,
    00295   LIBMTP_PROPERTY_FaxNumberBusiness,
    00296   LIBMTP_PROPERTY_PagerNumber,
    00297   LIBMTP_PROPERTY_PhoneNumberOthers,
    00298   LIBMTP_PROPERTY_PrimaryWebAddress,
    00299   LIBMTP_PROPERTY_PersonalWebAddress,
    00300   LIBMTP_PROPERTY_BusinessWebAddress,
    00301   LIBMTP_PROPERTY_InstantMessengerAddress,
    00302   LIBMTP_PROPERTY_InstantMessengerAddress2,
    00303   LIBMTP_PROPERTY_InstantMessengerAddress3,
    00304   LIBMTP_PROPERTY_PostalAddressPersonalFull,
    00305   LIBMTP_PROPERTY_PostalAddressPersonalFullLine1,
    00306   LIBMTP_PROPERTY_PostalAddressPersonalFullLine2,
    00307   LIBMTP_PROPERTY_PostalAddressPersonalFullCity,
    00308   LIBMTP_PROPERTY_PostalAddressPersonalFullRegion,
    00309   LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode,
    00310   LIBMTP_PROPERTY_PostalAddressPersonalFullCountry,
    00311   LIBMTP_PROPERTY_PostalAddressBusinessFull,
    00312   LIBMTP_PROPERTY_PostalAddressBusinessLine1,
    00313   LIBMTP_PROPERTY_PostalAddressBusinessLine2,
    00314   LIBMTP_PROPERTY_PostalAddressBusinessCity,
    00315   LIBMTP_PROPERTY_PostalAddressBusinessRegion,
    00316   LIBMTP_PROPERTY_PostalAddressBusinessPostalCode,
    00317   LIBMTP_PROPERTY_PostalAddressBusinessCountry,
    00318   LIBMTP_PROPERTY_PostalAddressOtherFull,
    00319   LIBMTP_PROPERTY_PostalAddressOtherLine1,
    00320   LIBMTP_PROPERTY_PostalAddressOtherLine2,
    00321   LIBMTP_PROPERTY_PostalAddressOtherCity,
    00322   LIBMTP_PROPERTY_PostalAddressOtherRegion,
    00323   LIBMTP_PROPERTY_PostalAddressOtherPostalCode,
    00324   LIBMTP_PROPERTY_PostalAddressOtherCountry,
    00325   LIBMTP_PROPERTY_OrganizationName,
    00326   LIBMTP_PROPERTY_PhoneticOrganizationName,
    00327   LIBMTP_PROPERTY_Role,
    00328   LIBMTP_PROPERTY_Birthdate,
    00329   LIBMTP_PROPERTY_MessageTo,
    00330   LIBMTP_PROPERTY_MessageCC,
    00331   LIBMTP_PROPERTY_MessageBCC,
    00332   LIBMTP_PROPERTY_MessageRead,
    00333   LIBMTP_PROPERTY_MessageReceivedTime,
    00334   LIBMTP_PROPERTY_MessageSender,
    00335   LIBMTP_PROPERTY_ActivityBeginTime,
    00336   LIBMTP_PROPERTY_ActivityEndTime,
    00337   LIBMTP_PROPERTY_ActivityLocation,
    00338   LIBMTP_PROPERTY_ActivityRequiredAttendees,
    00339   LIBMTP_PROPERTY_ActivityOptionalAttendees,
    00340   LIBMTP_PROPERTY_ActivityResources,
    00341   LIBMTP_PROPERTY_ActivityAccepted,
    00342   LIBMTP_PROPERTY_Owner,
    00343   LIBMTP_PROPERTY_Editor,
    00344   LIBMTP_PROPERTY_Webmaster,
    00345   LIBMTP_PROPERTY_URLSource,
    00346   LIBMTP_PROPERTY_URLDestination,
    00347   LIBMTP_PROPERTY_TimeBookmark,
    00348   LIBMTP_PROPERTY_ObjectBookmark,
    00349   LIBMTP_PROPERTY_ByteBookmark,
    00350   LIBMTP_PROPERTY_LastBuildDate,
    00351   LIBMTP_PROPERTY_TimetoLive,
    00352   LIBMTP_PROPERTY_MediaGUID,
    00353   LIBMTP_PROPERTY_TotalBitRate,
    00354   LIBMTP_PROPERTY_BitRateType,
    00355   LIBMTP_PROPERTY_SampleRate,
    00356   LIBMTP_PROPERTY_NumberOfChannels,
    00357   LIBMTP_PROPERTY_AudioBitDepth,
    00358   LIBMTP_PROPERTY_ScanDepth,
    00359   LIBMTP_PROPERTY_AudioWAVECodec,
    00360   LIBMTP_PROPERTY_AudioBitRate,
    00361   LIBMTP_PROPERTY_VideoFourCCCodec,
    00362   LIBMTP_PROPERTY_VideoBitRate,
    00363   LIBMTP_PROPERTY_FramesPerThousandSeconds,
    00364   LIBMTP_PROPERTY_KeyFrameDistance,
    00365   LIBMTP_PROPERTY_BufferSize,
    00366   LIBMTP_PROPERTY_EncodingQuality,
    00367   LIBMTP_PROPERTY_EncodingProfile,
    00368   LIBMTP_PROPERTY_BuyFlag,
    00369   LIBMTP_PROPERTY_UNKNOWN
    00370 } LIBMTP_property_t;
    00371
    00375 typedef enum {
    00376   LIBMTP_DATATYPE_INT8,
    00377   LIBMTP_DATATYPE_UINT8,
    00378   LIBMTP_DATATYPE_INT16,
    00379   LIBMTP_DATATYPE_UINT16,
    00380   LIBMTP_DATATYPE_INT32,
    00381   LIBMTP_DATATYPE_UINT32,
    00382   LIBMTP_DATATYPE_INT64,
    00383   LIBMTP_DATATYPE_UINT64,
    00384 } LIBMTP_datatype_t;
    00385
    00390 typedef enum {
    00391   LIBMTP_ERROR_NONE,
    00392   LIBMTP_ERROR_GENERAL,
    00393   LIBMTP_ERROR_PTP_LAYER,
    00394   LIBMTP_ERROR_USB_LAYER,
    00395   LIBMTP_ERROR_MEMORY_ALLOCATION,
    00396   LIBMTP_ERROR_NO_DEVICE_ATTACHED,
    00397   LIBMTP_ERROR_STORAGE_FULL,
    00398   LIBMTP_ERROR_CONNECTING,
    00399   LIBMTP_ERROR_CANCELLED
    00400 } LIBMTP_error_number_t;
    00401 typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t;
    00402 typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t;
    00403 typedef struct LIBMTP_error_struct LIBMTP_error_t;
    00404 typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t;
    00405 typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t;
    00406 typedef struct LIBMTP_file_struct LIBMTP_file_t;
    00407 typedef struct LIBMTP_track_struct LIBMTP_track_t;
    00408 typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t;
    00409 typedef struct LIBMTP_album_struct LIBMTP_album_t;
    00410 typedef struct LIBMTP_folder_struct LIBMTP_folder_t;
    00411 typedef struct LIBMTP_object_struct LIBMTP_object_t;
    00412 typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t;
    00413 typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t;
    00425 typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total,
    00426                                 void const * const data);
    00427
    00440 typedef uint16_t (* MTPDataGetFunc)     (void* params, void* priv,
    00441                                         uint32_t wantlen, unsigned char *data, uint32_t *gotlen);
    00442
    00455 typedef uint16_t (* MTPDataPutFunc)     (void* params, void* priv,
    00456                                         uint32_t sendlen, unsigned char *data, uint32_t *putlen);
    00457
    00461 #define LIBMTP_HANDLER_RETURN_OK 0
    00462 #define LIBMTP_HANDLER_RETURN_ERROR 1
    00463 #define LIBMTP_HANDLER_RETURN_CANCEL 2
    00464
    00474 struct LIBMTP_device_entry_struct {
    00475   char *vendor;
    00476   uint16_t vendor_id;
    00477   char *product;
    00478   uint16_t product_id;
    00479   uint32_t device_flags;
    00480 };
    00481
    00486 struct LIBMTP_raw_device_struct {
    00487   LIBMTP_device_entry_t device_entry;
    00488   uint32_t bus_location;
    00489   uint8_t devnum;
    00490 };
    00491
    00495 struct LIBMTP_error_struct {
    00496   LIBMTP_error_number_t errornumber;
    00497   char *error_text;
    00498   LIBMTP_error_t *next;
    00499 };
    00500
    00504 struct LIBMTP_allowed_values_struct {
    00505   uint8_t   u8max;
    00506   uint8_t   u8min;
    00507   uint8_t   u8step;
    00508   uint8_t*  u8vals;
    00509   int8_t    i8max;
    00510   int8_t    i8min;
    00511   int8_t    i8step;
    00512   int8_t*   i8vals;
    00513   uint16_t  u16max;
    00514   uint16_t  u16min;
    00515   uint16_t  u16step;
    00516   uint16_t* u16vals;
    00517   int16_t   i16max;
    00518   int16_t   i16min;
    00519   int16_t   i16step;
    00520   int16_t*  i16vals;
    00521   uint32_t  u32max;
    00522   uint32_t  u32min;
    00523   uint32_t  u32step;
    00524   uint32_t* u32vals;
    00525   int32_t   i32max;
    00526   int32_t   i32min;
    00527   int32_t   i32step;
    00528   int32_t*  i32vals;
    00529   uint64_t  u64max;
    00530   uint64_t  u64min;
    00531   uint64_t  u64step;
    00532   uint64_t* u64vals;
    00533   int64_t   i64max;
    00534   int64_t   i64min;
    00535   int64_t   i64step;
    00536   int64_t*  i64vals;
    00540   uint16_t  num_entries;
    00544   LIBMTP_datatype_t datatype;
    00548   int is_range;
    00549 };
    00550
    00554 struct LIBMTP_mtpdevice_struct {
    00558   uint8_t object_bitsize;
    00563   void *params;
    00568   void *usbinfo;
    00575   LIBMTP_devicestorage_t *storage;
    00580   LIBMTP_error_t *errorstack;
    00582   uint8_t maximum_battery_level;
    00584   uint32_t default_music_folder;
    00586   uint32_t default_playlist_folder;
    00588   uint32_t default_picture_folder;
    00590   uint32_t default_video_folder;
    00592   uint32_t default_organizer_folder;
    00594   uint32_t default_zencast_folder;
    00596   uint32_t default_album_folder;
    00598   uint32_t default_text_folder;
    00600   void *cd;
    00601
    00603   LIBMTP_mtpdevice_t *next;
    00604 };
    00605
    00609 struct LIBMTP_file_struct {
    00610   uint32_t item_id;
    00611   uint32_t parent_id;
    00612   uint32_t storage_id;
    00613   char *filename;
    00614   uint64_t filesize;
    00615   time_t modificationdate;
    00616   LIBMTP_filetype_t filetype;
    00617   LIBMTP_file_t *next;
    00618 };
    00619
    00623 struct LIBMTP_track_struct {
    00624   uint32_t item_id;
    00625   uint32_t parent_id;
    00626   uint32_t storage_id;
    00627   char *title;
    00628   char *artist;
    00629   char *composer;
    00630   char *genre;
    00631   char *album;
    00632   char *date;
    00633   char *filename;
    00634   uint16_t tracknumber;
    00635   uint32_t duration;
    00636   uint32_t samplerate;
    00637   uint16_t nochannels;
    00638   uint32_t wavecodec;
    00639   uint32_t bitrate;
    00640   uint16_t bitratetype;
    00641   uint16_t rating;
    00642   uint32_t usecount;
    00643   uint64_t filesize;
    00644   time_t modificationdate;
    00645   LIBMTP_filetype_t filetype;
    00646   LIBMTP_track_t *next;
    00647 };
    00648
    00652 struct LIBMTP_playlist_struct {
    00653   uint32_t playlist_id;
    00654   uint32_t parent_id;
    00655   uint32_t storage_id;
    00656   char *name;
    00657   uint32_t *tracks;
    00658   uint32_t no_tracks;
    00659   LIBMTP_playlist_t *next;
    00660 };
    00661
    00665 struct LIBMTP_album_struct {
    00666   uint32_t album_id;
    00667   uint32_t parent_id;
    00668   uint32_t storage_id;
    00669   char *name;
    00670   char *artist;
    00671   char *composer;
    00672   char *genre;
    00673   uint32_t *tracks;
    00674   uint32_t no_tracks;
    00675   LIBMTP_album_t *next;
    00676 };
    00677
    00681 struct LIBMTP_folder_struct {
    00682   uint32_t folder_id;
    00683   uint32_t parent_id;
    00684   uint32_t storage_id;
    00685   char *name;
    00686   LIBMTP_folder_t *sibling;
    00687   LIBMTP_folder_t *child;
    00688 };
    00689
    00693 struct LIBMTP_filesampledata_struct {
    00694   uint32_t width;
    00695   uint32_t height;
    00696   uint32_t duration;
    00697   LIBMTP_filetype_t filetype;
    00698   uint64_t size;
    00699   char *data;
    00700 };
    00701
    00705 struct LIBMTP_devicestorage_struct {
    00706   uint32_t id;
    00707   uint16_t StorageType;
    00708   uint16_t FilesystemType;
    00709   uint16_t AccessCapability;
    00710   uint64_t MaxCapacity;
    00711   uint64_t FreeSpaceInBytes;
    00712   uint64_t FreeSpaceInObjects;
    00713   char *StorageDescription;
    00714   char *VolumeIdentifier;
    00715   LIBMTP_devicestorage_t *next;
    00716   LIBMTP_devicestorage_t *prev;
    00717 };
    00718
    00719
    00722 /* Make functions available for C++ */
    00723 #ifdef __cplusplus
    00724 extern "C" {
    00725 #endif
    00726
    00731 void LIBMTP_Init(void);
    00732 int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const);
    00738 LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *);
    00739 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *);
    00740 /* Begin old, legacy interface */
    00741 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
    00742 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
    00743 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
    00744 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
    00745 /* End old, legacy interface */
    00746 void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
    00747 void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
    00748 int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
    00749 char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
    00750 char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
    00751 char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
    00752 char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
    00753 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*);
    00754 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const);
    00755 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*);
    00756 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const);
    00757 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *,
    00758                             uint8_t * const,
    00759                             uint8_t * const);
    00760 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const);
    00761 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const);
    00762 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const);
    00763 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*);
    00764 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
    00765 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
    00766
    00767 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
    00768 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
    00769 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
    00770
    00771 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
    00772 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
    00773
    00778 char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const);
    00779 uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00780       LIBMTP_property_t const, uint64_t const);
    00781 uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00782       LIBMTP_property_t const, uint32_t const);
    00783 uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00784       LIBMTP_property_t const, uint16_t const);
    00785 uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00786       LIBMTP_property_t const, uint8_t const);
    00787 int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const,
    00788       LIBMTP_property_t const, char const * const);
    00789 int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const,
    00790       LIBMTP_property_t const, uint32_t const);
    00791 int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const,
    00792       LIBMTP_property_t const, uint16_t const);
    00793 int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const,
    00794       LIBMTP_property_t const, uint8_t const);
    00795 char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty);
    00796 int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00797             LIBMTP_filetype_t const);
    00798 int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00799             LIBMTP_filetype_t const, LIBMTP_allowed_values_t*);
    00800 void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*);
    00801
    00807 LIBMTP_file_t *LIBMTP_new_file_t(void);
    00808 void LIBMTP_destroy_file_t(LIBMTP_file_t*);
    00809 char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t);
    00810 LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *);
    00811 LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *,
    00812       LIBMTP_progressfunc_t const, void const * const);
    00813 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
    00814 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00815                         LIBMTP_progressfunc_t const, void const * const);
    00816 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    00817                         LIBMTP_progressfunc_t const, void const * const);
    00818 int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *,
    00819                    LIBMTP_progressfunc_t const, void const * const);
    00820 int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const,
    00821                          LIBMTP_file_t * const, LIBMTP_progressfunc_t const,
    00822                          void const * const);
    00823 int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const,
    00824                         LIBMTP_file_t * const, LIBMTP_progressfunc_t const,
    00825                         void const * const);
    00826 int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *,
    00827       LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const);
    00828 int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char *);
    00829 LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void);
    00830 void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *);
    00831 int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *,
    00832                         LIBMTP_filetype_t const,
    00833                         LIBMTP_filesampledata_t **);
    00834 int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00835                           LIBMTP_filesampledata_t *);
    00836 int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00837                           LIBMTP_filesampledata_t *);
    00838
    00844 LIBMTP_track_t *LIBMTP_new_track_t(void);
    00845 void LIBMTP_destroy_track_t(LIBMTP_track_t*);
    00846 LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*);
    00847 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*,
    00848       LIBMTP_progressfunc_t const, void const * const);
    00849 LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const);
    00850 int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00851                         LIBMTP_progressfunc_t const, void const * const);
    00852 int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    00853                         LIBMTP_progressfunc_t const, void const * const);
    00854 int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc,
    00855       void *, LIBMTP_progressfunc_t const, void const * const);
    00856 int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *,
    00857                          char const * const, LIBMTP_track_t * const,
    00858                          LIBMTP_progressfunc_t const,
    00859                          void const * const);
    00860 int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    00861                          int const, LIBMTP_track_t * const,
    00862                          LIBMTP_progressfunc_t const,
    00863                          void const * const);
    00864 int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *,
    00865                          MTPDataGetFunc, void *, LIBMTP_track_t * const,
    00866                          LIBMTP_progressfunc_t const,
    00867                          void const * const);
    00868 int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *,
    00869                         LIBMTP_track_t const * const);
    00870 int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t);
    00871 int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *);
    00879 LIBMTP_folder_t *LIBMTP_new_folder_t(void);
    00880 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*);
    00881 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*);
    00882 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const);
    00883 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t);
    00884 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *);
    00893 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void);
    00894 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *);
    00895 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *);
    00896 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const);
    00897 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00898 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00899 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *);
    00900
    00906 LIBMTP_album_t *LIBMTP_new_album_t(void);
    00907 void LIBMTP_destroy_album_t(LIBMTP_album_t *);
    00908 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *);
    00909 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const);
    00910 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const);
    00911 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const);
    00912 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *);
    00913
    00919 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
    00920 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
    00921
    00924 /* End of C++ exports */
    00925 #ifdef __cplusplus
    00926 }
    00927 #endif
    00928
    00929 #endif /* LIBMTP_H_INCLUSION_GUARD */
    00930