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

# 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.1.3
    00033 #define LIBMTP_VERSION_STRING "1.1.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 <stdint.h>
    00057 /* We use time_t */
    00058 #include <time.h>
    00059
    00069 #define LIBMTP_DEBUG_NONE               0x00
    00070 #define LIBMTP_DEBUG_PTP                0x01
    00071 #define LIBMTP_DEBUG_PLST               0x02
    00072 #define LIBMTP_DEBUG_USB                0x04
    00073 #define LIBMTP_DEBUG_DATA               0x08
    00074 #define LIBMTP_DEBUG_ALL                0xFF
    00075
    00076
    00082 typedef enum {
    00083   LIBMTP_FILETYPE_FOLDER,
    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
    00419 typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t;
    00420 typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t;
    00421 typedef struct LIBMTP_error_struct LIBMTP_error_t;
    00422 typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t;
    00423 typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t;
    00424 typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t;
    00425 typedef struct LIBMTP_file_struct LIBMTP_file_t;
    00426 typedef struct LIBMTP_track_struct LIBMTP_track_t;
    00427 typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t;
    00428 typedef struct LIBMTP_album_struct LIBMTP_album_t;
    00429 typedef struct LIBMTP_folder_struct LIBMTP_folder_t;
    00430 typedef struct LIBMTP_object_struct LIBMTP_object_t;
    00431 typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t;
    00432 typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t;
    00444 typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total,
    00445                                 void const * const data);
    00446
    00459 typedef uint16_t (* MTPDataGetFunc)     (void* params, void* priv,
    00460                                         uint32_t wantlen, unsigned char *data, uint32_t *gotlen);
    00461
    00474 typedef uint16_t (* MTPDataPutFunc)     (void* params, void* priv,
    00475                                         uint32_t sendlen, unsigned char *data, uint32_t *putlen);
    00476
    00480 #define LIBMTP_HANDLER_RETURN_OK 0
    00481 #define LIBMTP_HANDLER_RETURN_ERROR 1
    00482 #define LIBMTP_HANDLER_RETURN_CANCEL 2
    00483
    00493 struct LIBMTP_device_entry_struct {
    00494   char *vendor;
    00495   uint16_t vendor_id;
    00496   char *product;
    00497   uint16_t product_id;
    00498   uint32_t device_flags;
    00499 };
    00500
    00505 struct LIBMTP_raw_device_struct {
    00506   LIBMTP_device_entry_t device_entry;
    00507   uint32_t bus_location;
    00508   uint8_t devnum;
    00509 };
    00510
    00514 struct LIBMTP_error_struct {
    00515   LIBMTP_error_number_t errornumber;
    00516   char *error_text;
    00517   LIBMTP_error_t *next;
    00518 };
    00519
    00523 struct LIBMTP_allowed_values_struct {
    00524   uint8_t   u8max;
    00525   uint8_t   u8min;
    00526   uint8_t   u8step;
    00527   uint8_t*  u8vals;
    00528   int8_t    i8max;
    00529   int8_t    i8min;
    00530   int8_t    i8step;
    00531   int8_t*   i8vals;
    00532   uint16_t  u16max;
    00533   uint16_t  u16min;
    00534   uint16_t  u16step;
    00535   uint16_t* u16vals;
    00536   int16_t   i16max;
    00537   int16_t   i16min;
    00538   int16_t   i16step;
    00539   int16_t*  i16vals;
    00540   uint32_t  u32max;
    00541   uint32_t  u32min;
    00542   uint32_t  u32step;
    00543   uint32_t* u32vals;
    00544   int32_t   i32max;
    00545   int32_t   i32min;
    00546   int32_t   i32step;
    00547   int32_t*  i32vals;
    00548   uint64_t  u64max;
    00549   uint64_t  u64min;
    00550   uint64_t  u64step;
    00551   uint64_t* u64vals;
    00552   int64_t   i64max;
    00553   int64_t   i64min;
    00554   int64_t   i64step;
    00555   int64_t*  i64vals;
    00559   uint16_t  num_entries;
    00563   LIBMTP_datatype_t datatype;
    00567   int is_range;
    00568 };
    00569
    00573 struct LIBMTP_device_extension_struct {
    00577   char *name;
    00581   int major;
    00585   int minor;
    00590   LIBMTP_device_extension_t *next;
    00591 };
    00592
    00596 struct LIBMTP_mtpdevice_struct {
    00600   uint8_t object_bitsize;
    00605   void *params;
    00610   void *usbinfo;
    00617   LIBMTP_devicestorage_t *storage;
    00622   LIBMTP_error_t *errorstack;
    00624   uint8_t maximum_battery_level;
    00626   uint32_t default_music_folder;
    00628   uint32_t default_playlist_folder;
    00630   uint32_t default_picture_folder;
    00632   uint32_t default_video_folder;
    00634   uint32_t default_organizer_folder;
    00636   uint32_t default_zencast_folder;
    00638   uint32_t default_album_folder;
    00640   uint32_t default_text_folder;
    00642   void *cd;
    00644   LIBMTP_device_extension_t *extensions;
    00646   int cached;
    00647
    00649   LIBMTP_mtpdevice_t *next;
    00650 };
    00651
    00655 struct LIBMTP_file_struct {
    00656   uint32_t item_id;
    00657   uint32_t parent_id;
    00658   uint32_t storage_id;
    00659   char *filename;
    00660   uint64_t filesize;
    00661   time_t modificationdate;
    00662   LIBMTP_filetype_t filetype;
    00663   LIBMTP_file_t *next;
    00664 };
    00665
    00669 struct LIBMTP_track_struct {
    00670   uint32_t item_id;
    00671   uint32_t parent_id;
    00672   uint32_t storage_id;
    00673   char *title;
    00674   char *artist;
    00675   char *composer;
    00676   char *genre;
    00677   char *album;
    00678   char *date;
    00679   char *filename;
    00680   uint16_t tracknumber;
    00681   uint32_t duration;
    00682   uint32_t samplerate;
    00683   uint16_t nochannels;
    00684   uint32_t wavecodec;
    00685   uint32_t bitrate;
    00686   uint16_t bitratetype;
    00687   uint16_t rating;
    00688   uint32_t usecount;
    00689   uint64_t filesize;
    00690   time_t modificationdate;
    00691   LIBMTP_filetype_t filetype;
    00692   LIBMTP_track_t *next;
    00693 };
    00694
    00698 struct LIBMTP_playlist_struct {
    00699   uint32_t playlist_id;
    00700   uint32_t parent_id;
    00701   uint32_t storage_id;
    00702   char *name;
    00703   uint32_t *tracks;
    00704   uint32_t no_tracks;
    00705   LIBMTP_playlist_t *next;
    00706 };
    00707
    00711 struct LIBMTP_album_struct {
    00712   uint32_t album_id;
    00713   uint32_t parent_id;
    00714   uint32_t storage_id;
    00715   char *name;
    00716   char *artist;
    00717   char *composer;
    00718   char *genre;
    00719   uint32_t *tracks;
    00720   uint32_t no_tracks;
    00721   LIBMTP_album_t *next;
    00722 };
    00723
    00727 struct LIBMTP_folder_struct {
    00728   uint32_t folder_id;
    00729   uint32_t parent_id;
    00730   uint32_t storage_id;
    00731   char *name;
    00732   LIBMTP_folder_t *sibling;
    00733   LIBMTP_folder_t *child;
    00734 };
    00735
    00739 struct LIBMTP_filesampledata_struct {
    00740   uint32_t width;
    00741   uint32_t height;
    00742   uint32_t duration;
    00743   LIBMTP_filetype_t filetype;
    00744   uint64_t size;
    00745   char *data;
    00746 };
    00747
    00751 struct LIBMTP_devicestorage_struct {
    00752   uint32_t id;
    00753   uint16_t StorageType;
    00754   uint16_t FilesystemType;
    00755   uint16_t AccessCapability;
    00756   uint64_t MaxCapacity;
    00757   uint64_t FreeSpaceInBytes;
    00758   uint64_t FreeSpaceInObjects;
    00759   char *StorageDescription;
    00760   char *VolumeIdentifier;
    00761   LIBMTP_devicestorage_t *next;
    00762   LIBMTP_devicestorage_t *prev;
    00763 };
    00764
    00769 enum LIBMTP_event_enum {
    00770   LIBMTP_EVENT_NONE,
    00771 };
    00772 typedef enum LIBMTP_event_enum LIBMTP_event_t;
    00773
    00776 /* Make functions available for C++ */
    00777 #ifdef __cplusplus
    00778 extern "C" {
    00779 #endif
    00780
    00781 extern int LIBMTP_debug;
    00782
    00787 void LIBMTP_Set_Debug(int);
    00788 void LIBMTP_Init(void);
    00789 int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const);
    00795 LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *);
    00796 int LIBMTP_Check_Specific_Device(int busno, int devno);
    00797 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *);
    00798 LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *);
    00799 /* Begin old, legacy interface */
    00800 LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void);
    00801 LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **);
    00802 uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *);
    00803 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*);
    00804 /* End old, legacy interface */
    00805 void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*);
    00806 void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*);
    00807 int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*);
    00808 char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*);
    00809 char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*);
    00810 char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*);
    00811 char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*);
    00812 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*);
    00813 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const);
    00814 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*);
    00815 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const);
    00816 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *,
    00817                             uint8_t * const,
    00818                             uint8_t * const);
    00819 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const);
    00820 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const);
    00821 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const);
    00822 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*);
    00823 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
    00824 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
    00825
    00826 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
    00827 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1
    00828 #define LIBMTP_STORAGE_SORTBY_MAXSPACE  2
    00829
    00830 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
    00831 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
    00832
    00837 char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const);
    00838 uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00839       LIBMTP_property_t const, uint64_t const);
    00840 uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00841       LIBMTP_property_t const, uint32_t const);
    00842 uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00843       LIBMTP_property_t const, uint16_t const);
    00844 uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const,
    00845       LIBMTP_property_t const, uint8_t const);
    00846 int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const,
    00847       LIBMTP_property_t const, char const * const);
    00848 int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const,
    00849       LIBMTP_property_t const, uint32_t const);
    00850 int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const,
    00851       LIBMTP_property_t const, uint16_t const);
    00852 int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const,
    00853       LIBMTP_property_t const, uint8_t const);
    00854 char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty);
    00855 int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00856             LIBMTP_filetype_t const);
    00857 int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const,
    00858             LIBMTP_filetype_t const, LIBMTP_allowed_values_t*);
    00859 void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*);
    00860
    00866 LIBMTP_file_t *LIBMTP_new_file_t(void);
    00867 void LIBMTP_destroy_file_t(LIBMTP_file_t*);
    00868 char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t);
    00869 LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *);
    00870 LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *,
    00871       LIBMTP_progressfunc_t const, void const * const);
    00872 LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *,
    00873                                              uint32_t const,
    00874                                              uint32_t const);
    00875 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
    00876 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00877                         LIBMTP_progressfunc_t const, void const * const);
    00878 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*,
    00879                                        uint32_t const,
    00880                                        int const,
    00881                                        LIBMTP_progressfunc_t const,
    00882                                        void const * const);
    00883 int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *,
    00884                                uint32_t const,
    00885                                MTPDataPutFunc,
    00886                                void *,
    00887                                LIBMTP_progressfunc_t const,
    00888                                void const * const);
    00889 int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *,
    00890                                char const * const,
    00891                                LIBMTP_file_t * const,
    00892                                LIBMTP_progressfunc_t const,
    00893                                void const * const);
    00894 int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    00895                                           int const,
    00896                                           LIBMTP_file_t * const,
    00897                                           LIBMTP_progressfunc_t const,
    00898                                           void const * const);
    00899 int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *,
    00900                                   MTPDataGetFunc, void *,
    00901                                   LIBMTP_file_t * const,
    00902                                   LIBMTP_progressfunc_t const,
    00903                                   void const * const);
    00904 int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *,
    00905                          LIBMTP_file_t *,
    00906                          const char *);
    00907 LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void);
    00908 void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *);
    00909 int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *,
    00910                         LIBMTP_filetype_t const,
    00911                         LIBMTP_filesampledata_t **);
    00912 int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00913                           LIBMTP_filesampledata_t *);
    00914 int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
    00915                           LIBMTP_filesampledata_t *);
    00916
    00922 LIBMTP_track_t *LIBMTP_new_track_t(void);
    00923 void LIBMTP_destroy_track_t(LIBMTP_track_t*);
    00924 LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*);
    00925 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*,
    00926       LIBMTP_progressfunc_t const, void const * const);
    00927 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const,
    00928       LIBMTP_progressfunc_t const, void const * const);
    00929 LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const);
    00930 int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,
    00931                         LIBMTP_progressfunc_t const, void const * const);
    00932 int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const,
    00933                         LIBMTP_progressfunc_t const, void const * const);
    00934 int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc,
    00935       void *, LIBMTP_progressfunc_t const, void const * const);
    00936 int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *,
    00937                          char const * const, LIBMTP_track_t * const,
    00938                          LIBMTP_progressfunc_t const,
    00939                          void const * const);
    00940 int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *,
    00941                          int const, LIBMTP_track_t * const,
    00942                          LIBMTP_progressfunc_t const,
    00943                          void const * const);
    00944 int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *,
    00945                          MTPDataGetFunc, void *, LIBMTP_track_t * const,
    00946                          LIBMTP_progressfunc_t const,
    00947                          void const * const);
    00948 int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *,
    00949                         LIBMTP_track_t const * const);
    00950 int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const);
    00951 int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *);
    00959 LIBMTP_folder_t *LIBMTP_new_folder_t(void);
    00960 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*);
    00961 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*);
    00962 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*,
    00963                                                     uint32_t const);
    00964 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const);
    00965 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t);
    00966 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *);
    00975 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void);
    00976 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *);
    00977 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *);
    00978 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const);
    00979 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00980 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const);
    00981 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *);
    00982
    00988 LIBMTP_album_t *LIBMTP_new_album_t(void);
    00989 void LIBMTP_destroy_album_t(LIBMTP_album_t *);
    00990 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *);
    00991 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const);
    00992 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const);
    00993 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const);
    00994 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const);
    00995 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *);
    00996
    01002 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t);
    01003 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *);
    01004
    01010 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *);
    01011
    01012
    01015 /* End of C++ exports */
    01016 #ifdef __cplusplus
    01017 }
    01018 #endif
    01019
    01020 #endif /* LIBMTP_H_INCLUSION_GUARD */
    01021