libmtp.h(3)

πŸ‘‘ libmtp.h πŸ‘‘

okay bestie, sit down, hydrate, because this is libmtp.h(3) β€” a Library Functions Manual page, aka the header of libmtp, the library that lets you talk to MTP devices (yes, like those devices, the music-player-shaped ones, iykyk). It's long, it's got lore, it's got structs, and we're doing it in four parts. Part 1 is the map: the data structures, the macros, and the typedefs. Fr fr, this is the whole cast list before the drama starts. ✨


🌸 NAME 🌸

libmtp β€”

and that's literally it. The NAME section says libmtp, then a dash, then absolutely nothing. The description said "nah." Respect, honestly. Main character energy. πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

First, the vibes β€” these are the headers you pull in before you even think about touching this library:

#include <sys/time.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>

That's the pregame. Now the actual contents of the header, in three categories. Let's go. πŸ’…


✨ Data Structures ✨

Meet the cast. Every single one of these is a struct you're gonna be holding hands with:

  • struct LIBMTP_device_entry_struct
  • struct LIBMTP_raw_device_struct
  • struct LIBMTP_error_struct
  • struct LIBMTP_allowed_values_struct
  • struct LIBMTP_device_extension_struct
  • struct LIBMTP_mtpdevice_struct
  • struct LIBMTP_file_struct
  • struct LIBMTP_track_struct
  • struct LIBMTP_playlist_struct
  • struct LIBMTP_album_struct
  • struct LIBMTP_folder_struct
  • struct LIBMTP_filesampledata_struct
  • struct LIBMTP_devicestorage_struct

Thirteen structs. Not me counting them. Okay I counted them. πŸ“


πŸ’– Macros πŸ’–

okay so this is the constants-and-helpers section and it ate. Let's do them in order because alphabetical chaos is not the vibe:

  • #define LIBMTP_VERSION 1.1.23 β€” the version number, the numbers say what they say.
  • #define LIBMTP_VERSION_STRING '1.1.23' β€” same energy, but as a string this time.
  • #define LIBMTP_DEBUG_NONE 0x00 β€” no debug output, peace and quiet.
  • #define LIBMTP_DEBUG_PTP 0x01 β€” debug flag for the PTP layer.
  • #define LIBMTP_DEBUG_PLST 0x02 β€” debug flag for the playlist layer.
  • #define LIBMTP_DEBUG_USB 0x04 β€” debug flag for the USB layer.
  • #define LIBMTP_DEBUG_DATA 0x08 β€” debug flag for the data layer.
  • #define LIBMTP_DEBUG_ALL 0xFF β€” ALL the debug. everything. no filter.
  • #define LIBMTP_FILETYPE_IS_AUDIO(a) β€” macro that checks whether a filetype is audio.
  • #define LIBMTP_FILETYPE_IS_VIDEO(a) β€” checks whether it's video.
  • #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a) β€” checks whether it's audiovisual.
  • #define LIBMTP_FILETYPE_IS_TRACK(a) β€” checks whether it's a track.
  • #define LIBMTP_FILETYPE_IS_IMAGE(a) β€” checks whether it's an image.
  • #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a) β€” checks whether it's an addressbook.
  • #define LIBMTP_FILETYPE_IS_CALENDAR(a) β€” checks whether it's a calendar.
  • #define LIBMTP_HANDLER_RETURN_OK 0 β€” handler says: all good, slay.
  • #define LIBMTP_HANDLER_RETURN_ERROR 1 β€” handler says: something went wrong. 😭
  • #define LIBMTP_HANDLER_RETURN_CANCEL 2 β€” handler says: cancel that, we're done here.
  • #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 β€” don't sort the storage, leave it as-is.
  • #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 β€” sort storage by free space.
  • #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 β€” sort storage by maximum space.
  • #define LIBMTP_FILES_AND_FOLDERS_ROOT 0xffffffff β€” the value that means "the root of files and folders."

πŸ’œ Typedefs πŸ’œ

Now the nicknames, because typing struct Whatever_struct every time is exhausting and we do not have the energy bestie.

Struct typedefs β€” the glow-ups:

  • typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t
  • typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t
  • typedef struct LIBMTP_error_struct LIBMTP_error_t
  • typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t
  • typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t
  • typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t
  • typedef struct LIBMTP_file_struct LIBMTP_file_t
  • typedef struct LIBMTP_track_struct LIBMTP_track_t
  • typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t
  • typedef struct LIBMTP_album_struct LIBMTP_album_t
  • typedef struct LIBMTP_folder_struct LIBMTP_folder_t
  • typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t
  • typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t

Function-pointer typedefs β€” the callback crew (these are the ones you actually gotta get right, no cap):

  • typedef int(* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, void const *const data) β€” a progress callback. it gets handed sent and total counts plus a data pointer, and returns an int.
  • typedef uint16_t(* MTPDataGetFunc) (void *params, void *priv, uint32_t wantlen, unsigned char *data, uint32_t *gotlen) β€” a get-a-chunk-of-data callback. it takes params, priv, wantlen, a data buffer and a gotlen out-pointer, and returns a uint16_t.
  • typedef uint16_t(* MTPDataPutFunc) (void *params, void *priv, uint32_t sendlen, unsigned char *data, uint32_t *putlen) β€” the put-a-chunk-of-data twin. it takes params, priv, sendlen, data and a putlen out-pointer, and returns a uint16_t.
  • typedef enum LIBMTP_event_enum LIBMTP_event_t β€” the event enum, wearing its _t name tag.
  • typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *) β€” the event callback. it receives an int, an LIBMTP_event_t, a uint32_t, and a void *, and returns nothing. it's giving "I'll just react, not reply" and honestly? iconic. πŸ’…

lowkey that was just the setup bestie β€” the structs, macros and typedefs. the rest of this page is coming in part 2, so don't you dare close the tab. 🫢

🌈✨ Enumerations ✨🌈

okay bestie, this is the big pile of enums πŸ’… β€” every list of named constants this library hands you. Cute little vibes-only words that stand in for numbers, so you never have to remember what 7 means. iconic honestly.


πŸŽ€ enum LIBMTP_filetype_t

enum LIBMTP_filetype_t { LIBMTP_FILETYPE_FOLDER, LIBMTP_FILETYPE_WAV,
    LIBMTP_FILETYPE_MP3, LIBMTP_FILETYPE_WMA, LIBMTP_FILETYPE_OGG,
    LIBMTP_FILETYPE_AUDIBLE, LIBMTP_FILETYPE_MP4,
    LIBMTP_FILETYPE_UNDEF_AUDIO, LIBMTP_FILETYPE_WMV,
    LIBMTP_FILETYPE_AVI, LIBMTP_FILETYPE_MPEG, LIBMTP_FILETYPE_ASF,
    LIBMTP_FILETYPE_QT, LIBMTP_FILETYPE_UNDEF_VIDEO,
    LIBMTP_FILETYPE_JPEG, LIBMTP_FILETYPE_JFIF, LIBMTP_FILETYPE_TIFF,
    LIBMTP_FILETYPE_BMP, LIBMTP_FILETYPE_GIF, LIBMTP_FILETYPE_PICT,
    LIBMTP_FILETYPE_PNG, LIBMTP_FILETYPE_VCALENDAR1,
    LIBMTP_FILETYPE_VCALENDAR2, LIBMTP_FILETYPE_VCARD2,
    LIBMTP_FILETYPE_VCARD3, LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT,
    LIBMTP_FILETYPE_WINEXEC, LIBMTP_FILETYPE_TEXT, LIBMTP_FILETYPE_HTML,
    LIBMTP_FILETYPE_FIRMWARE, LIBMTP_FILETYPE_AAC,
    LIBMTP_FILETYPE_MEDIACARD, LIBMTP_FILETYPE_FLAC,
    LIBMTP_FILETYPE_MP2, LIBMTP_FILETYPE_M4A, LIBMTP_FILETYPE_DOC,
    LIBMTP_FILETYPE_XML, LIBMTP_FILETYPE_XLS, LIBMTP_FILETYPE_PPT,
    LIBMTP_FILETYPE_MHT, LIBMTP_FILETYPE_JP2, LIBMTP_FILETYPE_JPX,
    LIBMTP_FILETYPE_ALBUM, LIBMTP_FILETYPE_PLAYLIST,
    LIBMTP_FILETYPE_UNKNOWN }

this is the ✨what even is this file✨ list. audio coded as LIBMTP_FILETYPE_WAV, LIBMTP_FILETYPE_MP3, LIBMTP_FILETYPE_WMA, LIBMTP_FILETYPE_OGG, LIBMTP_FILETYPE_AUDIBLE, LIBMTP_FILETYPE_MP4, LIBMTP_FILETYPE_AAC, LIBMTP_FILETYPE_FLAC, LIBMTP_FILETYPE_MP2, LIBMTP_FILETYPE_M4A. video coded as LIBMTP_FILETYPE_WMV, LIBMTP_FILETYPE_AVI, LIBMTP_FILETYPE_MPEG, LIBMTP_FILETYPE_ASF, LIBMTP_FILETYPE_QT. pics coded as LIBMTP_FILETYPE_JPEG, LIBMTP_FILETYPE_JFIF, LIBMTP_FILETYPE_TIFF, LIBMTP_FILETYPE_BMP, LIBMTP_FILETYPE_GIF, LIBMTP_FILETYPE_PICT, LIBMTP_FILETYPE_PNG, LIBMTP_FILETYPE_JP2, LIBMTP_FILETYPE_JPX, plus LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT. and then the little miscellaneous icons doing their own thing: LIBMTP_FILETYPE_FOLDER, LIBMTP_FILETYPE_TEXT, LIBMTP_FILETYPE_HTML, LIBMTP_FILETYPE_FIRMWARE, LIBMTP_FILETYPE_WINEXEC, LIBMTP_FILETYPE_MEDIACARD, LIBMTP_FILETYPE_DOC, LIBMTP_FILETYPE_XML, LIBMTP_FILETYPE_XLS, LIBMTP_FILETYPE_PPT, LIBMTP_FILETYPE_MHT, LIBMTP_FILETYPE_ALBUM, LIBMTP_FILETYPE_PLAYLIST.

and the calendar/contact girlies stay booked: LIBMTP_FILETYPE_VCALENDAR1, LIBMTP_FILETYPE_VCALENDAR2, LIBMTP_FILETYPE_VCARD2, LIBMTP_FILETYPE_VCARD3.

then the two "we genuinely don't know her" entries: LIBMTP_FILETYPE_UNDEF_AUDIO, LIBMTP_FILETYPE_UNDEF_VIDEO πŸ’€ and finally LIBMTP_FILETYPE_UNKNOWN, which is exactly what it sounds like bestie.


πŸ¦‹ enum LIBMTP_property_t

enum LIBMTP_property_t { LIBMTP_PROPERTY_StorageID,
    LIBMTP_PROPERTY_ObjectFormat, LIBMTP_PROPERTY_ProtectionStatus,
    LIBMTP_PROPERTY_ObjectSize, LIBMTP_PROPERTY_AssociationType,
    LIBMTP_PROPERTY_AssociationDesc, LIBMTP_PROPERTY_ObjectFileName,
    LIBMTP_PROPERTY_DateCreated, LIBMTP_PROPERTY_DateModified,
    LIBMTP_PROPERTY_Keywords, LIBMTP_PROPERTY_ParentObject,
    LIBMTP_PROPERTY_AllowedFolderContents, LIBMTP_PROPERTY_Hidden,
    LIBMTP_PROPERTY_SystemObject,
    LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier,
    LIBMTP_PROPERTY_SyncID, LIBMTP_PROPERTY_PropertyBag,
    LIBMTP_PROPERTY_Name, LIBMTP_PROPERTY_CreatedBy,
    LIBMTP_PROPERTY_Artist, LIBMTP_PROPERTY_DateAuthored,
    LIBMTP_PROPERTY_Description, LIBMTP_PROPERTY_URLReference,
    LIBMTP_PROPERTY_LanguageLocale,
    LIBMTP_PROPERTY_CopyrightInformation, LIBMTP_PROPERTY_Source,
    LIBMTP_PROPERTY_OriginLocation, LIBMTP_PROPERTY_DateAdded,
    LIBMTP_PROPERTY_NonConsumable, LIBMTP_PROPERTY_CorruptOrUnplayable,
    LIBMTP_PROPERTY_ProducerSerialNumber,
    LIBMTP_PROPERTY_RepresentativeSampleFormat,
    LIBMTP_PROPERTY_RepresentativeSampleSize,
    LIBMTP_PROPERTY_RepresentativeSampleHeight,
    LIBMTP_PROPERTY_RepresentativeSampleWidth,
    LIBMTP_PROPERTY_RepresentativeSampleDuration,
    LIBMTP_PROPERTY_RepresentativeSampleData, LIBMTP_PROPERTY_Width,
    LIBMTP_PROPERTY_Height, LIBMTP_PROPERTY_Duration,
    LIBMTP_PROPERTY_Rating, LIBMTP_PROPERTY_Track,
    LIBMTP_PROPERTY_Genre, LIBMTP_PROPERTY_Credits,
    LIBMTP_PROPERTY_Lyrics, LIBMTP_PROPERTY_SubscriptionContentID,
    LIBMTP_PROPERTY_ProducedBy, LIBMTP_PROPERTY_UseCount,
    LIBMTP_PROPERTY_SkipCount, LIBMTP_PROPERTY_LastAccessed,
    LIBMTP_PROPERTY_ParentalRating, LIBMTP_PROPERTY_MetaGenre,
    LIBMTP_PROPERTY_Composer, LIBMTP_PROPERTY_EffectiveRating,
    LIBMTP_PROPERTY_Subtitle, LIBMTP_PROPERTY_OriginalReleaseDate,
    LIBMTP_PROPERTY_AlbumName, LIBMTP_PROPERTY_AlbumArtist,
    LIBMTP_PROPERTY_Mood, LIBMTP_PROPERTY_DRMStatus,
    LIBMTP_PROPERTY_SubDescription, LIBMTP_PROPERTY_IsCropped,
    LIBMTP_PROPERTY_IsColorCorrected, LIBMTP_PROPERTY_ImageBitDepth,
    LIBMTP_PROPERTY_Fnumber, LIBMTP_PROPERTY_ExposureTime,
    LIBMTP_PROPERTY_ExposureIndex, LIBMTP_PROPERTY_DisplayName,
    LIBMTP_PROPERTY_BodyText, LIBMTP_PROPERTY_Subject,
    LIBMTP_PROPERTY_Priority, LIBMTP_PROPERTY_GivenName,
    LIBMTP_PROPERTY_MiddleNames, LIBMTP_PROPERTY_FamilyName,
    LIBMTP_PROPERTY_Prefix, LIBMTP_PROPERTY_Suffix,
    LIBMTP_PROPERTY_PhoneticGivenName,
    LIBMTP_PROPERTY_PhoneticFamilyName, LIBMTP_PROPERTY_EmailPrimary,
    LIBMTP_PROPERTY_EmailPersonal1, LIBMTP_PROPERTY_EmailPersonal2,
    LIBMTP_PROPERTY_EmailBusiness1, LIBMTP_PROPERTY_EmailBusiness2,
    LIBMTP_PROPERTY_EmailOthers, LIBMTP_PROPERTY_PhoneNumberPrimary,
    LIBMTP_PROPERTY_PhoneNumberPersonal,
    LIBMTP_PROPERTY_PhoneNumberPersonal2,
    LIBMTP_PROPERTY_PhoneNumberBusiness,
    LIBMTP_PROPERTY_PhoneNumberBusiness2,
    LIBMTP_PROPERTY_PhoneNumberMobile,
    LIBMTP_PROPERTY_PhoneNumberMobile2,
    LIBMTP_PROPERTY_FaxNumberPrimary, LIBMTP_PROPERTY_FaxNumberPersonal,
    LIBMTP_PROPERTY_FaxNumberBusiness, LIBMTP_PROPERTY_PagerNumber,
    LIBMTP_PROPERTY_PhoneNumberOthers,
    LIBMTP_PROPERTY_PrimaryWebAddress,
    LIBMTP_PROPERTY_PersonalWebAddress,
    LIBMTP_PROPERTY_BusinessWebAddress,
    LIBMTP_PROPERTY_InstantMessengerAddress,
    LIBMTP_PROPERTY_InstantMessengerAddress2,
    LIBMTP_PROPERTY_InstantMessengerAddress3,
    LIBMTP_PROPERTY_PostalAddressPersonalFull,
    LIBMTP_PROPERTY_PostalAddressPersonalFullLine1,
    LIBMTP_PROPERTY_PostalAddressPersonalFullLine2,
    LIBMTP_PROPERTY_PostalAddressPersonalFullCity,
    LIBMTP_PROPERTY_PostalAddressPersonalFullRegion,
    LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode,
    LIBMTP_PROPERTY_PostalAddressPersonalFullCountry,
    LIBMTP_PROPERTY_PostalAddressBusinessFull,
    LIBMTP_PROPERTY_PostalAddressBusinessLine1,
    LIBMTP_PROPERTY_PostalAddressBusinessLine2,
    LIBMTP_PROPERTY_PostalAddressBusinessCity,
    LIBMTP_PROPERTY_PostalAddressBusinessRegion,
    LIBMTP_PROPERTY_PostalAddressBusinessPostalCode,
    LIBMTP_PROPERTY_PostalAddressBusinessCountry,
    LIBMTP_PROPERTY_PostalAddressOtherFull,
    LIBMTP_PROPERTY_PostalAddressOtherLine1,
    LIBMTP_PROPERTY_PostalAddressOtherLine2,
    LIBMTP_PROPERTY_PostalAddressOtherCity,
    LIBMTP_PROPERTY_PostalAddressOtherRegion,
    LIBMTP_PROPERTY_PostalAddressOtherPostalCode,
    LIBMTP_PROPERTY_PostalAddressOtherCountry,
    LIBMTP_PROPERTY_OrganizationName,
    LIBMTP_PROPERTY_PhoneticOrganizationName, LIBMTP_PROPERTY_Role,
    LIBMTP_PROPERTY_Birthdate, LIBMTP_PROPERTY_MessageTo,
    LIBMTP_PROPERTY_MessageCC, LIBMTP_PROPERTY_MessageBCC,
    LIBMTP_PROPERTY_MessageRead, LIBMTP_PROPERTY_MessageReceivedTime,
    LIBMTP_PROPERTY_MessageSender, LIBMTP_PROPERTY_ActivityBeginTime,
    LIBMTP_PROPERTY_ActivityEndTime, LIBMTP_PROPERTY_ActivityLocation,
    LIBMTP_PROPERTY_ActivityRequiredAttendees,
    LIBMTP_PROPERTY_ActivityOptionalAttendees,
    LIBMTP_PROPERTY_ActivityResources, LIBMTP_PROPERTY_ActivityAccepted,
    LIBMTP_PROPERTY_Owner, LIBMTP_PROPERTY_Editor,
    LIBMTP_PROPERTY_Webmaster, LIBMTP_PROPERTY_URLSource,
    LIBMTP_PROPERTY_URLDestination, LIBMTP_PROPERTY_TimeBookmark,
    LIBMTP_PROPERTY_ObjectBookmark, LIBMTP_PROPERTY_ByteBookmark,
    LIBMTP_PROPERTY_LastBuildDate, LIBMTP_PROPERTY_TimetoLive,
    LIBMTP_PROPERTY_MediaGUID, LIBMTP_PROPERTY_TotalBitRate,
    LIBMTP_PROPERTY_BitRateType, LIBMTP_PROPERTY_SampleRate,
    LIBMTP_PROPERTY_NumberOfChannels, LIBMTP_PROPERTY_AudioBitDepth,
    LIBMTP_PROPERTY_ScanDepth, LIBMTP_PROPERTY_AudioWAVECodec,
    LIBMTP_PROPERTY_AudioBitRate, LIBMTP_PROPERTY_VideoFourCCCodec,
    LIBMTP_PROPERTY_VideoBitRate,
    LIBMTP_PROPERTY_FramesPerThousandSeconds,
    LIBMTP_PROPERTY_KeyFrameDistance, LIBMTP_PROPERTY_BufferSize,
    LIBMTP_PROPERTY_EncodingQuality, LIBMTP_PROPERTY_EncodingProfile,
    LIBMTP_PROPERTY_BuyFlag, LIBMTP_PROPERTY_UNKNOWN }

okay so THIS one, bestie, is the absolute mother of all lists 😭 it's the full catalogue of object properties β€” every "field" an object on your device could possibly carry around with it. it starts off all structural: LIBMTP_PROPERTY_StorageID, LIBMTP_PROPERTY_ObjectFormat, LIBMTP_PROPERTY_ProtectionStatus, LIBMTP_PROPERTY_ObjectSize, LIBMTP_PROPERTY_AssociationType, LIBMTP_PROPERTY_AssociationDesc, LIBMTP_PROPERTY_ObjectFileName, LIBMTP_PROPERTY_DateCreated, LIBMTP_PROPERTY_DateModified, LIBMTP_PROPERTY_Keywords, LIBMTP_PROPERTY_ParentObject, LIBMTP_PROPERTY_AllowedFolderContents, LIBMTP_PROPERTY_Hidden, LIBMTP_PROPERTY_SystemObject, LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier, LIBMTP_PROPERTY_SyncID, LIBMTP_PROPERTY_PropertyBag.

then it goes full music-critic: LIBMTP_PROPERTY_Name, LIBMTP_PROPERTY_CreatedBy, LIBMTP_PROPERTY_Artist, LIBMTP_PROPERTY_DateAuthored, LIBMTP_PROPERTY_Description, LIBMTP_PROPERTY_URLReference, LIBMTP_PROPERTY_LanguageLocale, LIBMTP_PROPERTY_CopyrightInformation, LIBMTP_PROPERTY_Source, LIBMTP_PROPERTY_OriginLocation, LIBMTP_PROPERTY_DateAdded, LIBMTP_PROPERTY_NonConsumable, LIBMTP_PROPERTY_CorruptOrUnplayable, LIBMTP_PROPERTY_ProducerSerialNumber.

and then the representative-sample squad 🫢: LIBMTP_PROPERTY_RepresentativeSampleFormat, LIBMTP_PROPERTY_RepresentativeSampleSize, LIBMTP_PROPERTY_RepresentativeSampleHeight, LIBMTP_PROPERTY_RepresentativeSampleWidth, LIBMTP_PROPERTY_RepresentativeSampleDuration, LIBMTP_PROPERTY_RepresentativeSampleData β€” followed by the classic measurements LIBMTP_PROPERTY_Width, LIBMTP_PROPERTY_Height, LIBMTP_PROPERTY_Duration, plus LIBMTP_PROPERTY_Rating, LIBMTP_PROPERTY_Track, LIBMTP_PROPERTY_Genre, LIBMTP_PROPERTY_Credits, LIBMTP_PROPERTY_Lyrics, LIBMTP_PROPERTY_SubscriptionContentID, LIBMTP_PROPERTY_ProducedBy, LIBMTP_PROPERTY_UseCount, LIBMTP_PROPERTY_SkipCount, LIBMTP_PROPERTY_LastAccessed, LIBMTP_PROPERTY_ParentalRating, LIBMTP_PROPERTY_MetaGenre, LIBMTP_PROPERTY_Composer, LIBMTP_PROPERTY_EffectiveRating, LIBMTP_PROPERTY_Subtitle, LIBMTP_PROPERTY_OriginalReleaseDate, LIBMTP_PROPERTY_AlbumName, LIBMTP_PROPERTY_AlbumArtist, LIBMTP_PROPERTY_Mood, LIBMTP_PROPERTY_DRMStatus, LIBMTP_PROPERTY_SubDescription.

photo-girlie corner πŸ“Έ: LIBMTP_PROPERTY_IsCropped, LIBMTP_PROPERTY_IsColorCorrected, LIBMTP_PROPERTY_ImageBitDepth, LIBMTP_PROPERTY_Fnumber, LIBMTP_PROPERTY_ExposureTime, LIBMTP_PROPERTY_ExposureIndex.

then it's giving adress-book-core: LIBMTP_PROPERTY_DisplayName, LIBMTP_PROPERTY_BodyText, LIBMTP_PROPERTY_Subject, LIBMTP_PROPERTY_Priority, LIBMTP_PROPERTY_GivenName, LIBMTP_PROPERTY_MiddleNames, LIBMTP_PROPERTY_FamilyName, LIBMTP_PROPERTY_Prefix, LIBMTP_PROPERTY_Suffix, LIBMTP_PROPERTY_PhoneticGivenName, LIBMTP_PROPERTY_PhoneticFamilyName, then ALL the emails LIBMTP_PROPERTY_EmailPrimary, LIBMTP_PROPERTY_EmailPersonal1, LIBMTP_PROPERTY_EmailPersonal2, LIBMTP_PROPERTY_EmailBusiness1, LIBMTP_PROPERTY_EmailBusiness2, LIBMTP_PROPERTY_EmailOthers, then the entire phone roster LIBMTP_PROPERTY_PhoneNumberPrimary, LIBMTP_PROPERTY_PhoneNumberPersonal, LIBMTP_PROPERTY_PhoneNumberPersonal2, LIBMTP_PROPERTY_PhoneNumberBusiness, LIBMTP_PROPERTY_PhoneNumberBusiness2, LIBMTP_PROPERTY_PhoneNumberMobile, LIBMTP_PROPERTY_PhoneNumberMobile2, then fax LIBMTP_PROPERTY_FaxNumberPrimary, LIBMTP_PROPERTY_FaxNumberPersonal, LIBMTP_PROPERTY_FaxNumberBusiness, LIBMTP_PROPERTY_PagerNumber, LIBMTP_PROPERTY_PhoneNumberOthers, then web links LIBMTP_PROPERTY_PrimaryWebAddress, LIBMTP_PROPERTY_PersonalWebAddress, LIBMTP_PROPERTY_BusinessWebAddress, then the IMs LIBMTP_PROPERTY_InstantMessengerAddress, LIBMTP_PROPERTY_InstantMessengerAddress2, LIBMTP_PROPERTY_InstantMessengerAddress3.

and because the contacts section wasn't done terrorising us yet, there's a FULL postal-address trilogy 😭<br>personal: LIBMTP_PROPERTY_PostalAddressPersonalFull, LIBMTP_PROPERTY_PostalAddressPersonalFullLine1, LIBMTP_PROPERTY_PostalAddressPersonalFullLine2, LIBMTP_PROPERTY_PostalAddressPersonalFullCity, LIBMTP_PROPERTY_PostalAddressPersonalFullRegion, LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode, LIBMTP_PROPERTY_PostalAddressPersonalFullCountry.<br>business: LIBMTP_PROPERTY_PostalAddressBusinessFull, LIBMTP_PROPERTY_PostalAddressBusinessLine1, LIBMTP_PROPERTY_PostalAddressBusinessLine2, LIBMTP_PROPERTY_PostalAddressBusinessCity, LIBMTP_PROPERTY_PostalAddressBusinessRegion, LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, LIBMTP_PROPERTY_PostalAddressBusinessCountry.<br>other: LIBMTP_PROPERTY_PostalAddressOtherFull, LIBMTP_PROPERTY_PostalAddressOtherLine1, LIBMTP_PROPERTY_PostalAddressOtherLine2, LIBMTP_PROPERTY_PostalAddressOtherCity, LIBMTP_PROPERTY_PostalAddressOtherRegion, LIBMTP_PROPERTY_PostalAddressOtherPostalCode, LIBMTP_PROPERTY_PostalAddressOtherCountry.

then LIBMTP_PROPERTY_OrganizationName, LIBMTP_PROPERTY_PhoneticOrganizationName, LIBMTP_PROPERTY_Role, LIBMTP_PROPERTY_Birthdate, then message stuff LIBMTP_PROPERTY_MessageTo, LIBMTP_PROPERTY_MessageCC, LIBMTP_PROPERTY_MessageBCC, LIBMTP_PROPERTY_MessageRead, LIBMTP_PROPERTY_MessageReceivedTime, LIBMTP_PROPERTY_MessageSender, then activity stuff LIBMTP_PROPERTY_ActivityBeginTime, LIBMTP_PROPERTY_ActivityEndTime, LIBMTP_PROPERTY_ActivityLocation, LIBMTP_PROPERTY_ActivityRequiredAttendees, LIBMTP_PROPERTY_ActivityOptionalAttendees, LIBMTP_PROPERTY_ActivityResources, LIBMTP_PROPERTY_ActivityAccepted.

and it just keeps going fr: LIBMTP_PROPERTY_Owner, LIBMTP_PROPERTY_Editor, LIBMTP_PROPERTY_Webmaster, LIBMTP_PROPERTY_URLSource, LIBMTP_PROPERTY_URLDestination, LIBMTP_PROPERTY_TimeBookmark, LIBMTP_PROPERTY_ObjectBookmark, LIBMTP_PROPERTY_ByteBookmark, LIBMTP_PROPERTY_LastBuildDate, LIBMTP_PROPERTY_TimetoLive, LIBMTP_PROPERTY_MediaGUID, then the bitrate/audio-nerd block LIBMTP_PROPERTY_TotalBitRate, LIBMTP_PROPERTY_BitRateType, LIBMTP_PROPERTY_SampleRate, LIBMTP_PROPERTY_NumberOfChannels, LIBMTP_PROPERTY_AudioBitDepth, LIBMTP_PROPERTY_ScanDepth, LIBMTP_PROPERTY_AudioWAVECodec, LIBMTP_PROPERTY_AudioBitRate, LIBMTP_PROPERTY_VideoFourCCCodec, LIBMTP_PROPERTY_VideoBitRate, LIBMTP_PROPERTY_FramesPerThousandSeconds, LIBMTP_PROPERTY_KeyFrameDistance, LIBMTP_PROPERTY_BufferSize, LIBMTP_PROPERTY_EncodingQuality, LIBMTP_PROPERTY_EncodingProfile, LIBMTP_PROPERTY_BuyFlag.

and she closes the set, as always, with LIBMTP_PROPERTY_UNKNOWN. periodt πŸ’…


🌸 enum LIBMTP_datatype_t

enum LIBMTP_datatype_t { LIBMTP_DATATYPE_INT8, LIBMTP_DATATYPE_UINT8,
    LIBMTP_DATATYPE_INT16, LIBMTP_DATATYPE_UINT16,
    LIBMTP_DATATYPE_INT32, LIBMTP_DATATYPE_UINT32,
    LIBMTP_DATATYPE_INT64, LIBMTP_DATATYPE_UINT64 }

the little family of data types, from smallest to biggest, tiny baby to big tall: LIBMTP_DATATYPE_INT8, LIBMTP_DATATYPE_UINT8, LIBMTP_DATATYPE_INT16, LIBMTP_DATATYPE_UINT16, LIBMTP_DATATYPE_INT32, LIBMTP_DATATYPE_UINT32, LIBMTP_DATATYPE_INT64, LIBMTP_DATATYPE_UINT64. yes the U ones are unsigned, yes that means no negatives, no we're not elaborating πŸ’–


🌈 enum LIBMTP_devicecap_t

enum LIBMTP_devicecap_t { LIBMTP_DEVICECAP_GetPartialObject,
    LIBMTP_DEVICECAP_SendPartialObject, LIBMTP_DEVICECAP_EditObjects,
    LIBMTP_DEVICECAP_MoveObject, LIBMTP_DEVICECAP_CopyObject }

this is the "what can this device actually do though" checklist, aka the capability flags: LIBMTP_DEVICECAP_GetPartialObject, LIBMTP_DEVICECAP_SendPartialObject, LIBMTP_DEVICECAP_EditObjects, LIBMTP_DEVICECAP_MoveObject, LIBMTP_DEVICECAP_CopyObject. five ways to be a capable king πŸ‘‘


πŸ“ enum LIBMTP_error_number_t

enum LIBMTP_error_number_t { LIBMTP_ERROR_NONE, LIBMTP_ERROR_GENERAL,
    LIBMTP_ERROR_PTP_LAYER, LIBMTP_ERROR_USB_LAYER,
    LIBMTP_ERROR_MEMORY_ALLOCATION, LIBMTP_ERROR_NO_DEVICE_ATTACHED,
    LIBMTP_ERROR_STORAGE_FULL, LIBMTP_ERROR_CONNECTING,
    LIBMTP_ERROR_CANCELLED }

the error girls πŸ’€ every possible flavour of "something went wrong bestie": LIBMTP_ERROR_NONE (the good one, the slay one, nothing is wrong), LIBMTP_ERROR_GENERAL (vague, mysterious, no notes), LIBMTP_ERROR_PTP_LAYER, LIBMTP_ERROR_USB_LAYER, LIBMTP_ERROR_MEMORY_ALLOCATION, LIBMTP_ERROR_NO_DEVICE_ATTACHED (plug it in 😭), LIBMTP_ERROR_STORAGE_FULL, LIBMTP_ERROR_CONNECTING, LIBMTP_ERROR_CANCELLED.


✨ enum LIBMTP_event_enum

enum LIBMTP_event_enum { LIBMTP_EVENT_NONE, LIBMTP_EVENT_STORE_ADDED,
    LIBMTP_EVENT_STORE_REMOVED, LIBMTP_EVENT_OBJECT_ADDED,
    LIBMTP_EVENT_OBJECT_REMOVED, LIBMTP_EVENT_DEVICE_PROPERTY_CHANGED }

the "drama is happening live" list, for when the device is out here doing things and you want to know: LIBMTP_EVENT_NONE (quiet, peaceful, no chaos rn), LIBMTP_EVENT_STORE_ADDED, LIBMTP_EVENT_STORE_REMOVED, LIBMTP_EVENT_OBJECT_ADDED, LIBMTP_EVENT_OBJECT_REMOVED, LIBMTP_EVENT_DEVICE_PROPERTY_CHANGED. main character energy fr fr πŸŽ€

🫢 Functions 🫢

okay bestie, here's the full roster of functions this library hands you, in the exact order the manpage lists them, every signature copied character-for-character (yes, all the consts, yes, even the ones that look like they're just there to vibe). Signatures stay in backticks. My commentary is not the API. Let's go πŸ¦‹

  • void LIBMTP_Set_Debug (int) β€” one lonely int walks in, nothing comes back out. The debug dial-turner. 🌸
  • void LIBMTP_Init (void) β€” takes void, returns void. Literally cannot do less. Iconic minimalism. πŸ‘‘
  • int LIBMTP_Get_Supported_Devices_List (LIBMTP_device_entry_t **const, int *const) β€” two pointer params (a LIBMTP_device_entry_t **const and an int *const), int back. πŸ“‹
  • LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices (LIBMTP_raw_device_t **, int *) β€” LIBMTP_raw_device_t ** and an int * in, LIBMTP_error_number_t out. The raw-device detector πŸ”
  • int LIBMTP_Check_Specific_Device (int busno, int devno) β€” the rare ✨gorgeous✨ function whose params actually have names: busno and devno, both int, int back. 🚌

  • LIBMTP_mtpdevice_t * LIBMTP_Open_Raw_Device (LIBMTP_raw_device_t *) β€” raw device goes in, LIBMTP_mtpdevice_t * comes out.
  • LIBMTP_mtpdevice_t * LIBMTP_Open_Raw_Device_Uncached (LIBMTP_raw_device_t *) β€” same shape as its sibling up there, but the name is wearing the Uncached badge. 🧊
  • LIBMTP_mtpdevice_t * LIBMTP_Get_Device (int) β€” one int, one device pointer. no notes.
  • LIBMTP_mtpdevice_t * LIBMTP_Get_First_Device (void) β€” nothing in, device pointer out. The "first" one. πŸ₯‡
  • LIBMTP_mtpdevice_t * LIBMTP_Get_Device_By_SerialNumber (char *) β€” a char * goes in (it's a serial number, per the name), device pointer out. πŸ”’
  • LIBMTP_mtpdevice_t * LIBMTP_Get_Device_By_ID (char *) β€” same deal but the char * is an ID this time. πŸ’…
  • LIBMTP_error_number_t LIBMTP_Get_Connected_Devices (LIBMTP_mtpdevice_t **) β€” one LIBMTP_mtpdevice_t ** param, LIBMTP_error_number_t back. πŸ”Œ
  • uint32_t LIBMTP_Number_Devices_In_List (LIBMTP_mtpdevice_t *) β€” takes a device-list pointer, hands you a uint32_t. It counts. That's the whole bit. πŸ”’
  • void LIBMTP_Release_Device_List (LIBMTP_mtpdevice_t *) β€” in goes the list pointer, out goes… nothing. void. bye bestie 🫑
  • void LIBMTP_Release_Device (LIBMTP_mtpdevice_t *) β€” the solo version of the above. Still void. Still goodbye. πŸŽ€
  • void LIBMTP_Dump_Device_Info (LIBMTP_mtpdevice_t *) β€” device pointer in, void out. It dumps info. The name tells you everything and I respect that. πŸ—‘οΈ
  • int LIBMTP_Reset_Device (LIBMTP_mtpdevice_t *) β€” int back. Reset button energy. πŸ”„
  • char * LIBMTP_Get_Manufacturername (LIBMTP_mtpdevice_t *) β€” device in, char * out. The name of the manufacturer. Spelling is exactly as the manpage has it, do not @ me. 🏭
  • char * LIBMTP_Get_Modelname (LIBMTP_mtpdevice_t *) β€” char * out again. Model name. πŸ“±
  • char * LIBMTP_Get_Serialnumber (LIBMTP_mtpdevice_t *) β€” yes another char *, this one's the serial number. πŸ”–
  • char * LIBMTP_Get_Deviceversion (LIBMTP_mtpdevice_t *) β€” char *, device version. βš™οΈ
  • char * LIBMTP_Get_Friendlyname (LIBMTP_mtpdevice_t *) β€” char *, and this one is the friendly name. Precious. πŸ₯°
  • int LIBMTP_Set_Friendlyname (LIBMTP_mtpdevice_t *, char const *const) β€” device pointer plus a char const *const, int back. The setter to its getter, they're a matched set. πŸ’ž
  • char * LIBMTP_Get_Syncpartner (LIBMTP_mtpdevice_t *) β€” char * back, sync partner. 🀝
  • int LIBMTP_Set_Syncpartner (LIBMTP_mtpdevice_t *, char const *const) β€” int back, char const *const in. Same silhouette, different verb. ✨
  • int LIBMTP_Get_Batterylevel (LIBMTP_mtpdevice_t *, uint8_t *const, uint8_t *const) β€” device pointer plus two uint8_t *consts, int back. Battery levels πŸ”‹
  • int LIBMTP_Get_Secure_Time (LIBMTP_mtpdevice_t *, char **const) β€” char **const in, int out. πŸ•°οΈ
  • int LIBMTP_Get_Device_Certificate (LIBMTP_mtpdevice_t *, char **const) β€” char **const in, int out. Certificate 🎫
  • int LIBMTP_Get_Supported_Filetypes (LIBMTP_mtpdevice_t *, uint16_t **const, uint16_t *const) β€” a uint16_t **const and a uint16_t *const in, int back. πŸ—‚οΈ
  • int LIBMTP_Check_Capability (LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t) β€” device pointer and an LIBMTP_devicecap_t, int back. 🧠

  • LIBMTP_error_t * LIBMTP_Get_Errorstack (LIBMTP_mtpdevice_t *) β€” device in, LIBMTP_error_t * out. The error stack 😭
  • void LIBMTP_Clear_Errorstack (LIBMTP_mtpdevice_t *) β€” void. Poof. gone. 🧹
  • void LIBMTP_Dump_Errorstack (LIBMTP_mtpdevice_t *) β€” also void, but the dumping flavour. πŸ—‘οΈ
  • void LIBMTP_FreeMemory (void *) β€” literally just a void * and a void. Free your memory, bestie, both kinds. 🧚
  • int LIBMTP_Get_Storage (LIBMTP_mtpdevice_t *, int const) β€” device pointer plus an int const, int back. πŸ’Ύ
  • int LIBMTP_Format_Storage (LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *) β€” device pointer plus a LIBMTP_devicestorage_t *, int back. ⚠️ it's format β€” the name said it, not me.
  • char * LIBMTP_Get_String_From_Object (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const) β€” device pointer, uint32_t const, LIBMTP_property_t const in; char * out. 🧡
  • uint64_t LIBMTP_Get_u64_From_Object (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint64_t const) β€” same front half, plus a uint64_t const, and a uint64_t comes back. 6️⃣4️⃣
  • uint32_t LIBMTP_Get_u32_From_Object (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const) β€” you see the pattern, right? uint32_t in, uint32_t out. πŸ”
  • uint16_t LIBMTP_Get_u16_From_Object (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const) β€” uint16_t flavour. Same shape. ✨
  • uint8_t LIBMTP_Get_u8_From_Object (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const) β€” the smallest one, uint8_t in and out. lil guy πŸ“
  • int LIBMTP_Set_Object_String (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, char const *const) β€” four params, int back. The setter twin. πŸ’…
  • int LIBMTP_Set_Object_u32 (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const) β€” device pointer, uint32_t const, LIBMTP_property_t const, uint32_t const; int back. πŸ”’
  • int LIBMTP_Set_Object_u16 (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const) β€” same but uint16_t. πŸ”’
  • int LIBMTP_Set_Object_u8 (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const) β€” and the uint8_t one, still int back. πŸ”’
  • char const * LIBMTP_Get_Property_Description (LIBMTP_property_t inproperty) β€” one param, adorably named inproperty, and a char const * comes back. 🏷️
  • int LIBMTP_Is_Property_Supported (LIBMTP_mtpdevice_t *, LIBMTP_property_t const, LIBMTP_filetype_t const) β€” device pointer, an LIBMTP_property_t const, an LIBMTP_filetype_t const; int back. βœ…
  • int LIBMTP_Get_Allowed_Property_Values (LIBMTP_mtpdevice_t *, LIBMTP_property_t const, LIBMTP_filetype_t const, LIBMTP_allowed_values_t *) β€” four params ending in LIBMTP_allowed_values_t *, int back. 🎯
  • void LIBMTP_destroy_allowed_values_t (LIBMTP_allowed_values_t *) β€” void, lowercase d, exactly as written. Cleanup crew 🧼

  • LIBMTP_file_t * LIBMTP_new_file_t (void) β€” nothing in, LIBMTP_file_t * out. The new-and-destroy pattern starts here, lowercase and all. 🐣
  • void LIBMTP_destroy_file_t (LIBMTP_file_t *) β€” void, LIBMTP_file_t * in.
  • char const * LIBMTP_Get_Filetype_Description (LIBMTP_filetype_t) β€” LIBMTP_filetype_t in, char const * out. πŸ“
  • LIBMTP_file_t * LIBMTP_Get_Filelisting (LIBMTP_mtpdevice_t *) β€” device in, LIBMTP_file_t * out. πŸ“‚
  • LIBMTP_file_t * LIBMTP_Get_Filelisting_With_Callback (LIBMTP_mtpdevice_t *, LIBMTP_progressfunc_t const, void const *const) β€” plus a LIBMTP_progressfunc_t const and a void const *const. πŸŽ›οΈ
  • LIBMTP_file_t * LIBMTP_Get_Files_And_Folders (LIBMTP_mtpdevice_t *, uint32_t const, uint32_t const) β€” device pointer and two uint32_t consts, LIBMTP_file_t * back. πŸ“
  • int LIBMTP_Get_Children (LIBMTP_mtpdevice_t *, uint32_t const, uint32_t const, uint32_t **) β€” device pointer, two uint32_t consts, a uint32_t **; int back. πŸ‘Ά
  • LIBMTP_file_t * LIBMTP_Get_Filemetadata (LIBMTP_mtpdevice_t *, uint32_t const) β€” device pointer and a uint32_t const, LIBMTP_file_t * out. πŸ”Ž
  • int LIBMTP_Get_File_To_File (LIBMTP_mtpdevice_t *, uint32_t, char const *const, LIBMTP_progressfunc_t const, void const *const) β€” five params, int back. Note this uint32_t has no const, and neither does the one in _Descriptor below, and yes that's on purpose, the manpage said so. πŸ™ˆ
  • int LIBMTP_Get_File_To_File_Descriptor (LIBMTP_mtpdevice_t *, uint32_t const, int const, LIBMTP_progressfunc_t const, void const *const) β€” here the uint32_t does have const, plus an int const. int back. 🧾
  • int LIBMTP_Get_File_To_Handler (LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const *const) β€” includes an MTPDataPutFunc and a void *. int back. πŸͺ„
  • int LIBMTP_Send_File_From_File (LIBMTP_mtpdevice_t *, char const *const, LIBMTP_file_t *const, LIBMTP_progressfunc_t const, void const *const) β€” char const *const plus LIBMTP_file_t *const plus the usual progress duo. int back. πŸ“€
  • int LIBMTP_Send_File_From_File_Descriptor (LIBMTP_mtpdevice_t *, int const, LIBMTP_file_t *const, LIBMTP_progressfunc_t const, void const *const) β€” an int const file descriptor in that second slot. int back. 🧾
  • int LIBMTP_Send_File_From_Handler (LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_file_t *const, LIBMTP_progressfunc_t const, void const *const) β€” MTPDataGetFunc this time (Get, not Put, they are different), plus void * and LIBMTP_file_t *const. int back. πŸͺ„
  • int LIBMTP_Set_File_Name (LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char *) β€” note this one writes const char * the other way round from the setters above. Do not "fix" it, it's canon. πŸ“›
  • LIBMTP_filesampledata_t * LIBMTP_new_filesampledata_t (void) β€” void in, LIBMTP_filesampledata_t * out. 🐣
  • void LIBMTP_destroy_filesampledata_t (LIBMTP_filesampledata_t *) β€” void out. 🧼
  • int LIBMTP_Get_Representative_Sample_Format (LIBMTP_mtpdevice_t *, LIBMTP_filetype_t const, LIBMTP_filesampledata_t **) β€” device pointer, LIBMTP_filetype_t const, LIBMTP_filesampledata_t **; int back. πŸ–ΌοΈ
  • int LIBMTP_Send_Representative_Sample (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *) β€” device pointer, uint32_t const, LIBMTP_filesampledata_t *; int back. ✈️
  • int LIBMTP_Get_Representative_Sample (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *) β€” same shape, opposite direction. πŸ”„
  • int LIBMTP_Get_Thumbnail (LIBMTP_mtpdevice_t *, uint32_t const, unsigned char **data, unsigned int *size) β€” named params!! data and size, and they're unsigned. int back. πŸ–ΌοΈ

  • LIBMTP_track_t * LIBMTP_new_track_t (void) β€” void in, LIBMTP_track_t * out. 🎡
  • void LIBMTP_destroy_track_t (LIBMTP_track_t *) β€” void out. 🧼
  • LIBMTP_track_t * LIBMTP_Get_Tracklisting (LIBMTP_mtpdevice_t *) β€” device in, track pointer out. πŸ“œ
  • LIBMTP_track_t * LIBMTP_Get_Tracklisting_With_Callback (LIBMTP_mtpdevice_t *, LIBMTP_progressfunc_t const, void const *const) β€” the callback edition. πŸŽ›οΈ
  • LIBMTP_track_t * LIBMTP_Get_Tracklisting_With_Callback_For_Storage (LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_progressfunc_t const, void const *const) β€” the longest name in the lineup and honestly it earned it: plus uint32_t const. πŸ†
  • LIBMTP_track_t * LIBMTP_Get_Trackmetadata (LIBMTP_mtpdevice_t *, uint32_t const) β€” device pointer plus uint32_t const. πŸ”Ž
  • int LIBMTP_Get_Track_To_File (LIBMTP_mtpdevice_t *, uint32_t, char const *const, LIBMTP_progressfunc_t const, void const *const) β€” bare uint32_t again, just like the file one. int back. 🎧
  • int LIBMTP_Get_Track_To_File_Descriptor (LIBMTP_mtpdevice_t *, uint32_t const, int const, LIBMTP_progressfunc_t const, void const *const) β€” uint32_t const, int const, int back. 🧾
  • int LIBMTP_Get_Track_To_Handler (LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const *const) β€” MTPDataPutFunc plus void *. int back. πŸͺ„
  • int LIBMTP_Send_Track_From_File (LIBMTP_mtpdevice_t *, char const *const, LIBMTP_track_t *const, LIBMTP_progressfunc_t const, void const *const) β€” int back. πŸ“€
  • int LIBMTP_Send_Track_From_File_Descriptor (LIBMTP_mtpdevice_t *, int const, LIBMTP_track_t *const, LIBMTP_progressfunc_t const, void const *const) β€” int const descriptor, LIBMTP_track_t *const. πŸ“€
  • int LIBMTP_Send_Track_From_Handler (LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_track_t *const, LIBMTP_progressfunc_t const, void const *const) β€” MTPDataGetFunc + void * + LIBMTP_track_t *const. πŸ“€
  • int LIBMTP_Update_Track_Metadata (LIBMTP_mtpdevice_t *, LIBMTP_track_t const *const) β€” LIBMTP_track_t const *const, note the const on both sides. int back. πŸ”„
  • int LIBMTP_Track_Exists (LIBMTP_mtpdevice_t *, uint32_t const) β€” int back, and the name is a yes/no question. πŸ‘€
  • int LIBMTP_Set_Track_Name (LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *) β€” const char *, written that way round. int back. πŸ“›

  • LIBMTP_folder_t * LIBMTP_new_folder_t (void) β€” void in, LIBMTP_folder_t * out. 🐣
  • void LIBMTP_destroy_folder_t (LIBMTP_folder_t *) β€” void out. 🧼
  • LIBMTP_folder_t * LIBMTP_Get_Folder_List (LIBMTP_mtpdevice_t *) β€” device in, folder pointer out. πŸ“
  • LIBMTP_folder_t * LIBMTP_Get_Folder_List_For_Storage (LIBMTP_mtpdevice_t *, uint32_t const) β€” plus uint32_t const. πŸ’Ύ
  • LIBMTP_folder_t * LIBMTP_Find_Folder (LIBMTP_folder_t *, uint32_t const) β€” takes a folder pointer and a uint32_t const, hands back an LIBMTP_folder_t *. Finder energy, no Get in the name, we love a rebel. πŸ”
  • uint32_t LIBMTP_Create_Folder (LIBMTP_mtpdevice_t *, char *, uint32_t, uint32_t) β€” note: plain char * (no const!) and two bare uint32_ts, and it hands you a uint32_t. ✨
  • int LIBMTP_Set_Folder_Name (LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *) β€” const char *, same style as its file and track cousins. int back. πŸ“›
  • LIBMTP_playlist_t * LIBMTP_new_playlist_t (void) β€” void in, LIBMTP_playlist_t * out. 🐣
  • void LIBMTP_destroy_playlist_t (LIBMTP_playlist_t *) β€” void out. 🧼
  • LIBMTP_playlist_t * LIBMTP_Get_Playlist_List (LIBMTP_mtpdevice_t *) β€” device in, playlist pointer out. 🎢
  • LIBMTP_playlist_t * LIBMTP_Get_Playlist (LIBMTP_mtpdevice_t *, uint32_t const) β€” singular this time. ✨
  • int LIBMTP_Create_New_Playlist (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *const) β€” both words in the name, iconic. int back. βž•
  • int LIBMTP_Update_Playlist (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *const) β€” LIBMTP_playlist_t *const, int back. πŸ”„
  • int LIBMTP_Set_Playlist_Name (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *) β€” const char *. int back. πŸ“›
  • LIBMTP_album_t * LIBMTP_new_album_t (void) β€” void in, LIBMTP_album_t * out. 🐣
  • void LIBMTP_destroy_album_t (LIBMTP_album_t *) β€” void out. 🧼
  • LIBMTP_album_t * LIBMTP_Get_Album_List (LIBMTP_mtpdevice_t *) β€” device in, album pointer out. πŸ’Ώ
  • LIBMTP_album_t * LIBMTP_Get_Album_List_For_Storage (LIBMTP_mtpdevice_t *, uint32_t const) β€” plus uint32_t const. πŸ’Ύ
  • LIBMTP_album_t * LIBMTP_Get_Album (LIBMTP_mtpdevice_t *, uint32_t const) β€” the singular one. πŸŽ€
  • int LIBMTP_Create_New_Album (LIBMTP_mtpdevice_t *, LIBMTP_album_t *const) β€” int back. βž•
  • int LIBMTP_Update_Album (LIBMTP_mtpdevice_t *, LIBMTP_album_t const *const) β€” careful here: LIBMTP_album_t const *const, which is not how LIBMTP_Update_Playlist wrote it. Different functions, different signatures, that's the whole lesson. int back. πŸ”„
  • int LIBMTP_Set_Album_Name (LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *) β€” const char *. int back. πŸ“›

  • int LIBMTP_Delete_Object (LIBMTP_mtpdevice_t *, uint32_t) β€” device pointer plus a bare uint32_t, int back. πŸ—‘οΈ
  • int LIBMTP_Move_Object (LIBMTP_mtpdevice_t *, uint32_t, uint32_t, uint32_t) β€” three bare uint32_ts and an int. πŸ“¦
  • int LIBMTP_Copy_Object (LIBMTP_mtpdevice_t *, uint32_t, uint32_t, uint32_t) β€” identical silhouette, different verb. πŸ“‹
  • int LIBMTP_Set_Object_Filename (LIBMTP_mtpdevice_t *, uint32_t, char *) β€” a plain char *, no const in sight. int back. 🏷️
  • int LIBMTP_GetPartialObject (LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, uint32_t, unsigned char **, unsigned int *) β€” six params, including an unsigned char ** and an unsigned int *. int back. 🍰
  • int LIBMTP_SendPartialObject (LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, unsigned char *, unsigned int) β€” note: single unsigned char * and a plain unsigned int, not double pointers like the Get. int back. 🍰
  • int LIBMTP_BeginEditObject (LIBMTP_mtpdevice_t *, uint32_t const) β€” int back. ✏️
  • int LIBMTP_EndEditObject (LIBMTP_mtpdevice_t *, uint32_t const) β€” the other half of that pair. int back. ✏️
  • int LIBMTP_TruncateObject (LIBMTP_mtpdevice_t *, uint32_t const, uint64_t) β€” device pointer, uint32_t const, uint64_t. int back. βœ‚οΈ

  • int LIBMTP_Read_Event (LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *) β€” an LIBMTP_event_t * and a uint32_t * in, int back. πŸ“¬
  • int LIBMTP_Read_Event_Async (LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *) β€” takes an LIBMTP_event_cb_fn and a void *, no uint32_t * here. int back. ⚑
  • int LIBMTP_Handle_Events_Timeout_Completed (struct timeval *, int *) β€” no device pointer at all!! Just struct timeval * and int *, and an int comes back. Main character behaviour. πŸ‘‘
  • int LIBMTP_Custom_Operation (LIBMTP_mtpdevice_t *, uint16_t, int,...) β€” variadic! uint16_t, an int, then ... and whatever you feel like passing, int back. Format it exactly like that, comma and all. πŸ’…

πŸŽ€ Variables πŸŽ€

  • int LIBMTP_debug β€” one lone int, sitting out here on its own like it owns the place. It does. ⭐

✨ DETAILED DESCRIPTION ✨

Okay bestie, deep breath, because this is the whole vibe of the page: this header is the interface to the Media Transfer Protocol library. That's it, that's the thesis. πŸ’…


Like, legally we gotta say it, so here it is, every single name and address, no skipping:

Copyright (C) 2005-2013 Linus Walleij <triad@df.lth.se> Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> Copyright (C) 2007 Ted Bullock <tbullock@canada.com> Copyright (C) 2008 Florent Mertens <flomertens@gmail.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

ngl bestie, "WITHOUT ANY WARRANTY" is not a suggestion, it's giving capital letters for a reason. It means it. 😭

And here's how you actually pull the whole thing in:

#include <libmtp.h>

πŸŽ€ VARIABLE DOCUMENTATION πŸŽ€

⭐ int LIBMTP_debug [extern] ⭐

Global debug level, bestie!! πŸ¦‹ This is the big one. We use a flag system to enable a part of logs β€” not all of them, a part, so you get to pick and choose which little logs you wanna see. Main character energy, honestly.

🌸 How the debug level gets set

The LIBMTP_DEBUG environment variable sets the debug flags for any binary that uses libmtp and calls LIBMTP_Init. So like, if the program calls LIBMTP_Init, your env var is heard. 🫢

The value can be given in:

  • decimal β€” but it must not start with "0" or it will be interpreted in octal. Not me getting jumpscared by octal again πŸ™ˆ
  • hexadecimal β€” must start with 0x

And the special one, the πŸ’€ icon:

  • The value "-1" enables all debug flags. Everything. All of it. The whole feed. Be ready.

🧚 The -d flag in examples/

Some of the utilities in examples/ also take a command-line flag "-d" that enables LIBMTP_DEBUG_PTP and LIBMTP_DEBUG_DATA β€” same as setting LIBMTP_DEBUG=9. Slay, one keystroke for two vibes. ✨

πŸ‘‘ The flags (combine by adding the hex values)

  • 0x00 [0000 0000] : LIBMTP_DEBUG_NONE : no debug (default)
  • 0x01 [0000 0001] : LIBMTP_DEBUG_PTP : PTP debug
  • 0x02 [0000 0010] : LIBMTP_DEBUG_PLST : Playlist debug
  • 0x04 [0000 0100] : LIBMTP_DEBUG_USB : USB debug
  • 0x08 [0000 1000] : LIBMTP_DEBUG_DATA : USB data debug
(Please keep this list in sync with libmtp.h.) β€” literally a note to the maintainers, but now you know too, and knowing is half the battle πŸ’–

Referenced by LIBMTP_Set_Debug().


πŸ’œ AUTHOR πŸ’œ

Generated automatically by Doxygen for libmtp from the source code. So technically the robot wrote this page, and technically I just made it cute. We contain multitudes. πŸ¦‹


and that's the whole page, bestie!! πŸŽ‰ this was libmtp, Version 1.1.23, page libmtp.h(3) β€” read it, love it, set your LIBMTP_DEBUG responsibly, and go transfer some media. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from