libmtp 1.0.3

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

- File List
- Globals

# 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.3
    00033 #define LIBMTP_VERSION_STRING "1.0.3"
    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 /* We use time_t */
    00059 #include <time.h>
    00060
    00070 #define LIBMTP_DEBUG_NONE               0x00
    00071 #define LIBMTP_DEBUG_PTP                0x01
    00072 #define LIBMTP_DEBUG_PLST               0x02
    00073 #define LIBMTP_DEBUG_USB                0x04
    00074 #define LIBMTP_DEBUG_DATA               0x08
    00075 #define LIBMTP_DEBUG_ALL                0xFF
    00076
    00077
    00083 typedef enum {
    00084   LIBMTP_FILETYPE_WAV,
    00085   LIBMTP_FILETYPE_MP3,
    00086   LIBMTP_FILETYPE_WMA,
    00087   LIBMTP_FILETYPE_OGG,
    00088   LIBMTP_FILETYPE_AUDIBLE,
    00089   LIBMTP_FILETYPE_MP4,
    00090   LIBMTP_FILETYPE_UNDEF_AUDIO,
    00091   LIBMTP_FILETYPE_WMV,
    00092   LIBMTP_FILETYPE_AVI,
    00093   LIBMTP_FILETYPE_MPEG,
    00094   LIBMTP_FILETYPE_ASF,
    00095   LIBMTP_FILETYPE_QT,
    00096   LIBMTP_FILETYPE_UNDEF_VIDEO,
    00097   LIBMTP_FILETYPE_JPEG,
    00098   LIBMTP_FILETYPE_JFIF,
    00099   LIBMTP_FILETYPE_TIFF,
    00100   LIBMTP_FILETYPE_BMP,
    00101   LIBMTP_FILETYPE_GIF,
    00102   LIBMTP_FILETYPE_PICT,
    00103   LIBMTP_FILETYPE_PNG,
    00104   LIBMTP_FILETYPE_VCALENDAR1,
    00105   LIBMTP_FILETYPE_VCALENDAR2,
    00106   LIBMTP_FILETYPE_VCARD2,
    00107   LIBMTP_FILETYPE_VCARD3,
    00108   LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT,
    00109   LIBMTP_FILETYPE_WINEXEC,
    00110   LIBMTP_FILETYPE_TEXT,
    00111   LIBMTP_FILETYPE_HTML,
    00112   LIBMTP_FILETYPE_FIRMWARE,
    00113   LIBMTP_FILETYPE_AAC,
    00114   LIBMTP_FILETYPE_MEDIACARD,
    00115   LIBMTP_FILETYPE_FLAC,
    00116   LIBMTP_FILETYPE_MP2,
    00117   LIBMTP_FILETYPE_M4A,
    00118   LIBMTP_FILETYPE_DOC,
    00119   LIBMTP_FILETYPE_XML,
    00120   LIBMTP_FILETYPE_XLS,
    00121   LIBMTP_FILETYPE_PPT,
    00122   LIBMTP_FILETYPE_MHT,
    00123   LIBMTP_FILETYPE_JP2,
    00124   LIBMTP_FILETYPE_JPX,
    00125   LIBMTP_FILETYPE_ALBUM,
    00126   LIBMTP_FILETYPE_PLAYLIST,
    00127   LIBMTP_FILETYPE_UNKNOWN
    00128 } LIBMTP_filetype_t;
    00129
    00137 #define LIBMTP_FILETYPE_IS_AUDIO(a)\
    00138 (a == LIBMTP_FILETYPE_WAV ||\
    00139  a == LIBMTP_FILETYPE_MP3 ||\
    00140  a == LIBMTP_FILETYPE_MP2 ||\
    00141  a == LIBMTP_FILETYPE_WMA ||\
    00142  a == LIBMTP_FILETYPE_OGG ||\
    00143  a == LIBMTP_FILETYPE_FLAC ||\
    00144  a == LIBMTP_FILETYPE_AAC ||\
    00145  a == LIBMTP_FILETYPE_M4A ||\
    00146  a == LIBMTP_FILETYPE_AUDIBLE ||\
    00147  a == LIBMTP_FILETYPE_UNDEF_AUDIO)
    00148
    00156 #define LIBMTP_FILETYPE_IS_VIDEO(a)\
    00157 (a == LIBMTP_FILETYPE_WMV ||\
    00158  a == LIBMTP_FILETYPE_AVI ||\
    00159  a == LIBMTP_FILETYPE_MPEG ||\
    00160  a == LIBMTP_FILETYPE_UNDEF_VIDEO)
    00161
    00166 #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\
    00167 (a == LIBMTP_FILETYPE_MP4 ||\
    00168  a == LIBMTP_FILETYPE_ASF ||\
    00169  a == LIBMTP_FILETYPE_QT)
    00170
    00177 #define LIBMTP_FILETYPE_IS_TRACK(a)\
    00178 (LIBMTP_FILETYPE_IS_AUDIO(a) ||\
    00179  LIBMTP_FILETYPE_IS_VIDEO(a) ||\
    00180  LIBMTP_FILETYPE_IS_AUDIOVIDEO(a))
    00181
    00186 #define LIBMTP_FILETYPE_IS_IMAGE(a)\
    00187 (a == LIBMTP_FILETYPE_JPEG ||\
    00188 a == LIBMTP_FILETYPE_JFIF ||\
    00189 a == LIBMTP_FILETYPE_TIFF ||\
    00190 a == LIBMTP_FILETYPE_BMP ||\
    00191 a == LIBMTP_FILETYPE_GIF ||\
    00192 a == LIBMTP_FILETYPE_PICT ||\
    00193 a == LIBMTP_FILETYPE_PNG ||\
    00194 a == LIBMTP_FILETYPE_JP2 ||\
    00195 a == LIBMTP_FILETYPE_JPX ||\
    00196 a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT)
    00197
    00202 #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\
    00203 (a == LIBMTP_FILETYPE_VCARD2 ||\
    00204 a == LIBMTP_FILETYPE_VCARD2)
    00205
    00210 #define LIBMTP_FILETYPE_IS_CALENDAR(a)\
    00211 (a == LIBMTP_FILETYPE_VCALENDAR1 ||\
    00212 a == LIBMTP_FILETYPE_VCALENDAR2)
    00213
    00218 typedef enum {
    00219   LIBMTP_PROPERTY_StorageID,
    00220   LIBMTP_PROPERTY_ObjectFormat,
    00221   LIBMTP_PROPERTY_ProtectionStatus,
    00222   LIBMTP_PROPERTY_ObjectSize,
    00223   LIBMTP_PROPERTY_AssociationType,
    00224   LIBMTP_PROPERTY_AssociationDesc,
    00225   LIBMTP_PROPERTY_ObjectFileName,
    00226   LIBMTP_PROPERTY_DateCreated,
    00227   LIBMTP_PROPERTY_DateModified,
    00228   LIBMTP_PROPERTY_Keywords,
    00229   LIBMTP_PROPERTY_ParentObject,
    00230   LIBMTP_PROPERTY_AllowedFolderContents,
    00231   LIBMTP_PROPERTY_Hidden,
    00232   LIBMTP_PROPERTY_SystemObject,
    00233   LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier,
    00234   LIBMTP_PROPERTY_SyncID,
    00235   LIBMTP_PROPERTY_PropertyBag,
    00236   LIBMTP_PROPERTY_Name,
    00237   LIBMTP_PROPERTY_CreatedBy,
    00238   LIBMTP_PROPERTY_Artist,
    00239   LIBMTP_PROPERTY_DateAuthored,
    00240   LIBMTP_PROPERTY_Description,
    00241   LIBMTP_PROPERTY_URLReference,
    00242   LIBMTP_PROPERTY_LanguageLocale,
    00243   LIBMTP_PROPERTY_CopyrightInformation,
    00244   LIBMTP_PROPERTY_Source,
    00245   LIBMTP_PROPERTY_OriginLocation,
    00246   LIBMTP_PROPERTY_DateAdded,
    00247   LIBMTP_PROPERTY_NonConsumable,
    00248   LIBMTP_PROPERTY_CorruptOrUnplayable,
    00249   LIBMTP_PROPERTY_ProducerSerialNumber,
    00250   LIBMTP_PROPERTY_RepresentativeSampleFormat,
    00251   LIBMTP_PROPERTY_RepresentativeSampleSize,
    00252   LIBMTP_PROPERTY_RepresentativeSampleHeight,
    00253   LIBMTP_PROPERTY_RepresentativeSampleWidth,
    00254   LIBMTP_PROPERTY_RepresentativeSampleDuration,
    00255   LIBMTP_PROPERTY_RepresentativeSampleData,
    00256   LIBMTP_PROPERTY_Width,
    00257   LIBMTP_PROPERTY_Height,
    00258   LIBMTP_PROPERTY_Duration,
    00259   LIBMTP_PROPERTY_Rating,
    00260   LIBMTP_PROPERTY_Track,
    00261   LIBMTP_PROPERTY_Genre,
    00262   LIBMTP_PROPERTY_Credits,
    00263   LIBMTP_PROPERTY_Lyrics,
    00264   LIBMTP_PROPERTY_SubscriptionContentID,
    00265   LIBMTP_PROPERTY_ProducedBy,
    00266   LIBMTP_PROPERTY_UseCount,
    00267   LIBMTP_PROPERTY_SkipCount,
    00268   LIBMTP_PROPERTY_LastAccessed,
    00269   LIBMTP_PROPERTY_ParentalRating,
    00270   LIBMTP_PROPERTY_MetaGenre,
    00271   LIBMTP_PROPERTY_Composer,
    00272   LIBMTP_PROPERTY_EffectiveRating,
    00273   LIBMTP_PROPERTY_Subtitle,
    00274   LIBMTP_PROPERTY_OriginalReleaseDate,
    00275   LIBMTP_PROPERTY_AlbumName,
    00276   LIBMTP_PROPERTY_AlbumArtist,
    00277   LIBMTP_PROPERTY_Mood,
    00278   LIBMTP_PROPERTY_DRMStatus,
    00279   LIBMTP_PROPERTY_SubDescription,
    00280   LIBMTP_PROPERTY_IsCropped,
    00281   LIBMTP_PROPERTY_IsColorCorrected,
    00282   LIBMTP_PROPERTY_ImageBitDepth,
    00283   LIBMTP_PROPERTY_Fnumber,
    00284   LIBMTP_PROPERTY_ExposureTime,
    00285   LIBMTP_PROPERTY_ExposureIndex,
    00286   LIBMTP_PROPERTY_DisplayName,
    00287   LIBMTP_PROPERTY_BodyText,
    00288   LIBMTP_PROPERTY_Subject,
    00289   LIBMTP_PROPERTY_Priority,
    00290   LIBMTP_PROPERTY_GivenName,
    00291   LIBMTP_PROPERTY_MiddleNames,
    00292   LIBMTP_PROPERTY_FamilyName,
    00293   LIBMTP_PROPERTY_Prefix,
    00294   LIBMTP_PROPERTY_Suffix,
    00295   LIBMTP_PROPERTY_PhoneticGivenName,
    00296   LIBMTP_PROPERTY_PhoneticFamilyName,
    00297   LIBMTP_PROPERTY_EmailPrimary,
    00298   LIBMTP_PROPERTY_EmailPersonal1,
    00299   LIBMTP_PROPERTY_EmailPersonal2,
    00300   LIBMTP_PROPERTY_EmailBusiness1,
    00301   LIBMTP_PROPERTY_EmailBusiness2,
    00302   LIBMTP_PROPERTY_EmailOthers,
    00303   LIBMTP_PROPERTY_PhoneNumberPrimary,
    00304   LIBMTP_PROPERTY_PhoneNumberPersonal,
    00305   LIBMTP_PROPERTY_PhoneNumberPersonal2,
    00306   LIBMTP_PROPERTY_PhoneNumberBusiness,
    00307   LIBMTP_PROPERTY_PhoneNumberBusiness2,
    00308   LIBMTP_PROPERTY_PhoneNumberMobile,
    00309   LIBMTP_PROPERTY_PhoneNumberMobile2,
    00310   LIBMTP_PROPERTY_FaxNumberPrimary,
    00311   LIBMTP_PROPERTY_FaxNumberPersonal,
    00312   LIBMTP_PROPERTY_FaxNumberBusiness,
    00313   LIBMTP_PROPERTY_PagerNumber,
    00314   LIBMTP_PROPERTY_PhoneNumberOthers,
    00315   LIBMTP_PROPERTY_PrimaryWebAddress,
    00316   LIBMTP_PROPERTY_PersonalWebAddress,
    00317   LIBMTP_PROPERTY_BusinessWebAddress,
    00318   LIBMTP_PROPERTY_InstantMessengerAddress,
    00319   LIBMTP_PROPERTY_InstantMessengerAddress2,
    00320   LIBMTP_PROPERTY_InstantMessengerAddress3,
    00321   LIBMTP_PROPERTY_PostalAddressPersonalFull,
    00322   LIBMTP_PROPERTY_PostalAddressPersonalFullLine1,
    00323   LIBMTP_PROPERTY_PostalAddressPersonalFullLine2,
    00324   LIBMTP_PROPERTY_PostalAddressPersonalFullCity,
    00325   LIBMTP_PROPERTY_PostalAddressPersonalFullRegion,
    00326   LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode,
    00327   LIBMTP_PROPERTY_PostalAddressPersonalFullCountry,
    00328   LIBMTP_PROPERTY_PostalAddressBusinessFull,
    00329   LIBMTP_PROPERTY_PostalAddressBusinessLine1,
    00330   LIBMTP_PROPERTY_PostalAddressBusinessLine2,
    00331   LIBMTP_PROPERTY_PostalAddressBusinessCity,
    00332   LIBMTP_PROPERTY_PostalAddressBusinessRegion,
    00333   LIBMTP_PROPERTY_PostalAddressBusinessPostalCode,
    00334   LIBMTP_PROPERTY_PostalAddressBusinessCountry,
    00335   LIBMTP_PROPERTY_PostalAddressOtherFull,
    00336   LIBMTP_PROPERTY_PostalAddressOtherLine1,
    00337   LIBMTP_PROPERTY_PostalAddressOtherLine2,
    00338   LIBMTP_PROPERTY_PostalAddressOtherCity,
    00339   LIBMTP_PROPERTY_PostalAddressOtherRegion,
    00340   LIBMTP_PROPERTY_PostalAddressOtherPostalCode,
    00341   LIBMTP_PROPERTY_PostalAddressOtherCountry,
    00342   LIBMTP_PROPERTY_OrganizationName,
    00343   LIBMTP_PROPERTY_PhoneticOrganizationName,
    00344   LIBMTP_PROPERTY_Role,
    00345   LIBMTP_PROPERTY_Birthdate,
    00346   LIBMTP_PROPERTY_MessageTo,
    00347   LIBMTP_PROPERTY_MessageCC,
    00348   LIBMTP_PROPERTY_MessageBCC,
    00349   LIBMTP_PROPERTY_MessageRead,
    00350   LIBMTP_PROPERTY_MessageReceivedTime,
    00351   LIBMTP_PROPERTY_MessageSender,
    00352   LIBMTP_PROPERTY_ActivityBeginTime,
    00353   LIBMTP_PROPERTY_ActivityEndTime,
    00354   LIBMTP_PROPERTY_ActivityLocation,
    00355   LIBMTP_PROPERTY_ActivityRequiredAttendees,
    00356   LIBMTP_PROPERTY_ActivityOptionalAttendees,
    00357   LIBMTP_PROPERTY_ActivityResources,
    00358   LIBMTP_PROPERTY_ActivityAccepted,
    00359   LIBMTP_PROPERTY_Owner,
    00360   LIBMTP_PROPERTY_Editor,
    00361   LIBMTP_PROPERTY_Webmaster,
    00362   LIBMTP_PROPERTY_URLSource,
    00363   LIBMTP_PROPERTY_URLDestination,
    00364   LIBMTP_PROPERTY_TimeBookmark,
    00365   LIBMTP_PROPERTY_ObjectBookmark,
    00366   LIBMTP_PROPERTY_ByteBookmark,
    00367   LIBMTP_PROPERTY_LastBuildDate,
    00368   LIBMTP_PROPERTY_TimetoLive,
    00369   LIBMTP_PROPERTY_MediaGUID,
    00370   LIBMTP_PROPERTY_TotalBitRate,
    00371   LIBMTP_PROPERTY_BitRateType,
    00372   LIBMTP_PROPERTY_SampleRate,
    00373   LIBMTP_PROPERTY_NumberOfChannels,
    00374   LIBMTP_PROPERTY_AudioBitDepth,
    00375   LIBMTP_PROPERTY_ScanDepth,
    00376   LIBMTP_PROPERTY_AudioWAVECodec,
    00377   LIBMTP_PROPERTY_AudioBitRate,
    00378   LIBMTP_PROPERTY_VideoFourCCCodec,
    00379   LIBMTP_PROPERTY_VideoBitRate,
    00380   LIBMTP_PROPERTY_FramesPerThousandSeconds,
    00381   LIBMTP_PROPERTY_KeyFrameDistance,
    00382   LIBMTP_PROPERTY_BufferSize,
    00383   LIBMTP_PROPERTY_EncodingQuality,
    00384   LIBMTP_PROPERTY_EncodingProfile,
    00385   LIBMTP_PROPERTY_BuyFlag,
    00386   LIBMTP_PROPERTY_UNKNOWN
    00387 } LIBMTP_property_t;
    00388
    00392 typedef enum {
    00393   LIBMTP_DATATYPE_INT8,
    00394   LIBMTP_DATATYPE_UINT8,
    00395   LIBMTP_DATATYPE_INT16,
    00396   LIBMTP_DATATYPE_UINT16,
    00397   LIBMTP_DATATYPE_INT32,
    00398   LIBMTP_DATATYPE_UINT32,
    00399   LIBMTP_DATATYPE_INT64,
    00400   LIBMTP_DATATYPE_UINT64,
    00401 } LIBMTP_datatype_t;
    00402
    00407 typedef enum {
    00408   LIBMTP_ERROR_NONE,
    00409   LIBMTP_ERROR_GENERAL,
    00410   LIBMTP_ERROR_PTP_LAYER,
    00411   LIBMTP_ERROR_USB_LAYER,
    00412   LIBMTP_ERROR_MEMORY_ALLOCATION,
    00413   LIBMTP_ERROR_NO_DEVICE_ATTACHED,
    00414   LIBMTP_ERROR_STORAGE_FULL,
    00415   LIBMTP_ERROR_CONNECTING,
    00416   LIBMTP_ERROR_CANCELLED
    00417 } LIBMTP_error_number_t;
    00418 typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t;
    00419 typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t;
    00420 typedef struct LIBMTP_error_struct LIBMTP_error_t;
    00421 typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t;
    00422 typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t;
    00423 typedef struct LIBMTP_file_struct LIBMTP_file_t;
    00424 typedef struct LIBMTP_track_struct LIBMTP_track_t;
    00425 typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t;
    00426 typedef struct LIBMTP_album_struct LIBMTP_album_t;
    00427 typedef struct LIBMTP_folder_struct LIBMTP_folder_t;
    00428 typedef struct LIBMTP_object_struct LIBMTP_object_t;
    00429 typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t;
    00430 typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t;
    00442 typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total,
    00443                                 void const * const data);
    00444
    00457 typedef uint16_t (* MTPDataGetFunc)     (void* params, void* priv,
    00458                                         uint32_t wantlen, unsigned char *data, uint32_t *gotlen);
    00459
    00472 typedef uint16_t (* MTPDataPutFunc)     (void* params, void* priv,
    00473                                         uint32_t sendlen, unsigned char *data, uint32_t *putlen);
    00474
    00478 #define LIBMTP_HANDLER_RETURN_OK 0
    00479 #define LIBMTP_HANDLER_RETURN_ERROR 1
    00480 #define LIBMTP_HANDLER_RETURN_CANCEL 2
    00481
    00491 struct LIBMTP_device_entry_struct {
    00492   char *vendor;
    00493   uint16_t vendor_id;
    00494   char *product;
    00495   uint16_t product_id;
    00496   uint32_t device_flags;
    00497 };
    00498
    00503 struct LIBMTP_raw_device_struct {
    00504   LIBMTP_device_entry_t device_entry;
    00505   uint32_t bus_location;
    00506   uint8_t devnum;
    00507 };
    00508
    00512 struct LIBMTP_error_struct {
    00513   LIBMTP_error_number_t errornumber;
    00514   char *error_text;
    00515   LIBMTP_error_t *next;
    00516 };
    00517
    00521 struct LIBMTP_allowed_values_struct {
    00522   uint8_t   u8max;
    00523   uint8_t   u8min;
    00524   uint8_t   u8step;
    00525   uint8_t*  u8vals;
    00526   int8_t    i8max;
    00527   int8_t    i8min;
    00528   int8_t    i8step;
    00529   int8_t*   i8vals;
    00530   uint16_t  u16max;
    00531   uint16_t  u16min;
    00532   uint16_t  u16step;
    00533   uint16_t* u16vals;
    00534   int16_t   i16max;
    00535   int16_t   i16min;
    00536   int16_t   i16step;
    00537   int16_t*  i16vals;
    00538   uint32_t  u32max;
    00539   uint32_t  u32min;
    00540   uint32_t  u32step;
    00541   uint32_t* u32vals;
    00542   int32_t   i32max;
    00543   int32_t   i32min;
    00544   int32_t   i32step;
    00545   int32_t*  i32vals;
    00546   uint64_t  u64max;
    00547   uint64_t  u64min;
    00548   uint64_t  u64step;
    00549   uint64_t* u64vals;
    00550   int64_t   i64max;
    00551   int64_t   i64min;
    00552   int64_t   i64step;
    00553   int64_t*  i64vals;
    00557   uint16_t  num_entries;
    00561   LIBMTP_datatype_t datatype;
    00565   int is_range;
    00566 };
    00567
    00571 struct LIBMTP_mtpdevice_struct {
    00575   uint8_t object_bitsize;
    00580   void *params;
    00585   void *usbinfo;
    00592   LIBMTP_devicestorage_t *storage;
    00597   LIBMTP_error_t *errorstack;
    00599   uint8_t maximum_battery_level;
    00601   uint32_t default_music_folder;
    00603   uint32_t default_playlist_folder;
    00605   uint32_t default_picture_folder;
    00607   uint32_t default_video_folder;
    00609   uint32_t default_organizer_folder;
    00611   uint32_t default_zencast_folder;
    00613   uint32_t default_album_folder;
    00615   uint32_t default_text_folder;
    00617   void *cd;
    00618
    00620   LIBMTP_mtpdevice_t *next;
    00621 };
    00622
    00626 struct LIBMTP_file_struct {
    00627   uint32_t item_id;
    00628   uint32_t parent_id;
    00629   uint32_t storage_id;
    00630   char *filename;
    00631   uint64_t filesize;
    00632   time_t modificationdate;
    00633   LIBMTP_filetype_t filetype;
    00634   LIBMTP_file_t *next;
    00635 };
    00636
    00640 struct LIBMTP_track_struct {
    00641   uint32_t item_id;
    00642   uint32_t parent_id;
    00643   uint32_t storage_id;
    00644   char *title;
    00645   char *artist;
    00646   char *composer;
    00647   char *genre;
    00648   char *album;
    00649   char *date;
    00650   char *filename;
    00651   uint16_t tracknumber;
    00652   uint32_t duration;
    00653   uint32_t samplerate;
    00654   uint16_t nochannels;
    00655   uint32_t wavecodec;
    00656   uint32_t bitrate;
    00657   uint16_t bitratetype;
    00658   uint16_t rating;
    00659   uint32_t usecount;
    00660   uint64_t filesize;
    00661   time_t modificationdate;
    00662   LIBMTP_filetype_t filetype;
    00663   LIBMTP_track_t *next;
    00664 };
    00665
    00669 struct LIBMTP_playlist_struct {
    00670   uint32_t playlist_id;
    00671   uint32_t parent_id;
    00672   uint32_t storage_id;
    00673   char *name;
    00674   uint32_t *tracks;
    00675   uint32_t no_tracks;
    00676   LIBMTP_playlist_t *next;
    00677 };
    00678
    00682 struct LIBMTP_album_struct {
    00683   uint32_t album_id;
    00684   uint32_t parent_id;
    00685   uint32_t storage_id;
    00686   char *name;
    00687   char *artist;
    00688   char *composer;
    00689   char *genre;
    00690   uint32_t *tracks;
    00691   uint32_t no_tracks;
    00692   LIBMTP_album_t *next;
    00693 };
    00694
    00698 struct LIBMTP_folder_struct {
    00699   uint32_t folder_id;
    00700   uint32_t parent_id;
    00701   uint32_t storage_id;
    00702   char *name;
    00703   LIBMTP_folder_t *sibling;
    00704   LIBMTP_folder_t *child;
    00705 };
    00706
    00710 struct LIBMTP_filesampledata_struct {
    00711   uint32_t width;
    00712   uint32_t height;
    00713   uint32_t duration;
    00714   LIBMTP_filetype_t filetype;
    00715   uint64_t size;
    00716   char *data;
    00717 };
    00718
    00722 struct LIBMTP_devicestorage_struct {
    00723   uint32_t id;
    00724   uint16_t StorageType;
    00725   uint16_t FilesystemType;
    00726   uint16_t AccessCapability;
    00727   uint64_t MaxCapacity;
    00728   uint64_t FreeSpaceInBytes;
    00729   uint64_t FreeSpaceInObjects;
    00730   char *StorageDescription;
    00731   char *VolumeIdentifier;
    00732   LIBMTP_devicestorage_t *next;
    00733   LIBMTP_devicestorage_t *prev;
    00734 };
    00735
    00736
    00739 /* Make functions available for C++ */
    00740 #ifdef __cplusplus
    00741 extern "C" {
    00742 #endif
    00743
    00744 extern int LIBMTP_debug;
    00745
    00750 void LIBMTP_Set_Debug(int);
    00751 void LIBMTP_Init(void);
    00752 int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const);
    00758 LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *);
    00759 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *);
    00760 /* Begin old, legacy interface */
    00761 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
    00762 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
    00763 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
    00764 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
    00765 /* End old, legacy interface */
    00766 void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
    00767 void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
    00768 int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
    00769 char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
    00770 char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
    00771 char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
    00772 char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
    00773 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*);
    00774 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const);
    00775 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*);
    00776 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const);
    00777 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *,
    00778                             uint8_t * const,
    00779                             uint8_t * const);
    00780 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const);
    00781 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const);
    00782 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const);
    00783 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*);
    00784 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
    00785 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
    00786
    00787 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
    00788 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
    00789 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
    00790
    00791 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
    00792 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
    00793
    00798 char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const);
    00799 uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00800       LIBMTP_property_t const, uint64_t const);
    00801 uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00802       LIBMTP_property_t const, uint32_t const);
    00803 uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00804       LIBMTP_property_t const, uint16_t const);
    00805 uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00806       LIBMTP_property_t const, uint8_t const);
    00807 int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const,
    00808       LIBMTP_property_t const, char const * const);
    00809 int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const,
    00810       LIBMTP_property_t const, uint32_t const);
    00811 int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const,
    00812       LIBMTP_property_t const, uint16_t const);
    00813 int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const,
    00814       LIBMTP_property_t const, uint8_t const);
    00815 char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty);
    00816 int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00817             LIBMTP_filetype_t const);
    00818 int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00819             LIBMTP_filetype_t const, LIBMTP_allowed_values_t*);
    00820 void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*);
    00821
    00827 LIBMTP_file_t *LIBMTP_new_file_t(void);
    00828 void LIBMTP_destroy_file_t(LIBMTP_file_t*);
    00829 char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t);
    00830 LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *);
    00831 LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *,
    00832       LIBMTP_progressfunc_t const, void const * const);
    00833 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
    00834 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00835                         LIBMTP_progressfunc_t const, void const * const);
    00836 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    00837                         LIBMTP_progressfunc_t const, void const * const);
    00838 int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *,
    00839                    LIBMTP_progressfunc_t const, void const * const);
    00840 int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const,
    00841                          LIBMTP_file_t * const, LIBMTP_progressfunc_t const,
    00842                          void const * const);
    00843 int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const,
    00844                         LIBMTP_file_t * const, LIBMTP_progressfunc_t const,
    00845                         void const * const);
    00846 int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *,
    00847       LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const);
    00848 int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char *);
    00849 LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void);
    00850 void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *);
    00851 int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *,
    00852                         LIBMTP_filetype_t const,
    00853                         LIBMTP_filesampledata_t **);
    00854 int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00855                           LIBMTP_filesampledata_t *);
    00856 int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00857                           LIBMTP_filesampledata_t *);
    00858
    00864 LIBMTP_track_t *LIBMTP_new_track_t(void);
    00865 void LIBMTP_destroy_track_t(LIBMTP_track_t*);
    00866 LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*);
    00867 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*,
    00868       LIBMTP_progressfunc_t const, void const * const);
    00869 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const,
    00870       LIBMTP_progressfunc_t const, void const * const);
    00871 LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const);
    00872 int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00873                         LIBMTP_progressfunc_t const, void const * const);
    00874 int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    00875                         LIBMTP_progressfunc_t const, void const * const);
    00876 int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc,
    00877       void *, LIBMTP_progressfunc_t const, void const * const);
    00878 int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *,
    00879                          char const * const, LIBMTP_track_t * const,
    00880                          LIBMTP_progressfunc_t const,
    00881                          void const * const);
    00882 int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    00883                          int const, LIBMTP_track_t * const,
    00884                          LIBMTP_progressfunc_t const,
    00885                          void const * const);
    00886 int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *,
    00887                          MTPDataGetFunc, void *, LIBMTP_track_t * const,
    00888                          LIBMTP_progressfunc_t const,
    00889                          void const * const);
    00890 int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *,
    00891                         LIBMTP_track_t const * const);
    00892 int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t);
    00893 int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *);
    00901 LIBMTP_folder_t *LIBMTP_new_folder_t(void);
    00902 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*);
    00903 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*);
    00904 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const);
    00905 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t);
    00906 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *);
    00915 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void);
    00916 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *);
    00917 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *);
    00918 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const);
    00919 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00920 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00921 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *);
    00922
    00928 LIBMTP_album_t *LIBMTP_new_album_t(void);
    00929 void LIBMTP_destroy_album_t(LIBMTP_album_t *);
    00930 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *);
    00931 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const);
    00932 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const);
    00933 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const);
    00934 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const);
    00935 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *);
    00936
    00942 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
    00943 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
    00944
    00947 /* End of C++ exports */
    00948 #ifdef __cplusplus
    00949 }
    00950 #endif
    00951
    00952 #endif /* LIBMTP_H_INCLUSION_GUARD */
    00953