types(3)
π NAME π
libmtp β types π
okay so welcome to types(3) from the Library Functions Manual, and bestie, this page is literally the whole type system of libmtp. macros, typedefs, enums β everything that makes the compiler go brrr. it's giving β¨foundationβ¨. no cap.
heads up: this page is long (shocking, ik), so it comes in multiple parts. this is part 1, so don't go anywhere π
β¨ SYNOPSIS β¨
grab ur emotional support beverage, because we're about to list everything. π
π§΅ Macros
first up, the macros. these are the little compile-time besties:
#define LIBMTP_DEBUG_NONE 0x00
#define LIBMTP_DEBUG_PTP 0x01
#define LIBMTP_DEBUG_PLST 0x02
#define LIBMTP_DEBUG_USB 0x04
#define LIBMTP_DEBUG_DATA 0x08
#define LIBMTP_DEBUG_ALL 0xFF
#define LIBMTP_FILETYPE_IS_AUDIO(a)
#define LIBMTP_FILETYPE_IS_VIDEO(a)
#define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)
#define LIBMTP_FILETYPE_IS_TRACK(a)
#define LIBMTP_FILETYPE_IS_IMAGE(a)
#define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)
#define LIBMTP_FILETYPE_IS_CALENDAR(a)
#define LIBMTP_HANDLER_RETURN_OK 0
#define LIBMTP_HANDLER_RETURN_ERROR 1
#define LIBMTP_HANDLER_RETURN_CANCEL 2
the way those debug values go 0x00, 0x01, 0x02, 0x04, 0x08, 0xFF β iconic. and then you've got the whole LIBMTP_FILETYPE_IS_* family, which each take an a argument btw: LIBMTP_FILETYPE_IS_AUDIO(a), LIBMTP_FILETYPE_IS_VIDEO(a), LIBMTP_FILETYPE_IS_AUDIOVIDEO(a), LIBMTP_FILETYPE_IS_TRACK(a), LIBMTP_FILETYPE_IS_IMAGE(a), LIBMTP_FILETYPE_IS_ADDRESSBOOK(a), LIBMTP_FILETYPE_IS_CALENDAR(a). and finally the handler returns, which are just LIBMTP_HANDLER_RETURN_OK = 0, LIBMTP_HANDLER_RETURN_ERROR = 1, LIBMTP_HANDLER_RETURN_CANCEL = 2. cute, tidy, done. π
π¦ Typedefs
now the typedefs, aka every struct getting its own little _t nickname situation:
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
typedef int(* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, void const *const data)
typedef uint16_t(* MTPDataGetFunc) (void *params, void *priv, uint32_t wantlen, unsigned char *data, uint32_t *gotlen)
typedef uint16_t(* MTPDataPutFunc) (void *params, void *priv, uint32_t sendlen, unsigned char *data, uint32_t *putlen)
first 13 are the glow-ups: struct with a _struct surname gets a _t nickname. LIBMTP_device_entry_struct β LIBMTP_device_entry_t, LIBMTP_raw_device_struct β LIBMTP_raw_device_t, LIBMTP_error_struct β LIBMTP_error_t, LIBMTP_allowed_values_struct β LIBMTP_allowed_values_t, LIBMTP_device_extension_struct β LIBMTP_device_extension_t, LIBMTP_mtpdevice_struct β LIBMTP_mtpdevice_t, LIBMTP_file_struct β LIBMTP_file_t, LIBMTP_track_struct β LIBMTP_track_t, LIBMTP_playlist_struct β LIBMTP_playlist_t, LIBMTP_album_struct β LIBMTP_album_t, LIBMTP_folder_struct β LIBMTP_folder_t, LIBMTP_filesampledata_struct β LIBMTP_filesampledata_t, LIBMTP_devicestorage_struct β LIBMTP_devicestorage_t. obsessed, fr fr.
and then the last three are function pointers, which are the main characters of callbackville π:
LIBMTP_progressfunc_tβ takesuint64_t const sent,uint64_t const total,void const *const data, and hands u back anint. it's literally a progress bar for ur soul.MTPDataGetFuncβ takesvoid *params,void *priv,uint32_t wantlen,unsigned char *data,uint32_t *gotlen, and returns auint16_t.MTPDataPutFuncβ takesvoid *params,void *priv,uint32_t sendlen,unsigned char *data,uint32_t *putlen, and also returns auint16_t.
see how MTPDataGetFunc has wantlen and gotlen while MTPDataPutFunc has sendlen and putlen? not me noticing the parallel structure π slay.
π§ Enumerations
okay here comes the big one. the enums. there are five of them and they are highkey doing the most. sit down. π«Ά
π enum LIBMTP_filetype_t
every file type this library knows how to vibe with, literally all of them:
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 }
so we start at LIBMTP_FILETYPE_FOLDER, run through all the audio-ish ones (LIBMTP_FILETYPE_WAV, LIBMTP_FILETYPE_MP3, LIBMTP_FILETYPE_WMA, LIBMTP_FILETYPE_OGG, LIBMTP_FILETYPE_AUDIBLE, LIBMTP_FILETYPE_MP4, LIBMTP_FILETYPE_UNDEF_AUDIO), then the video squad (LIBMTP_FILETYPE_WMV, LIBMTP_FILETYPE_AVI, LIBMTP_FILETYPE_MPEG, LIBMTP_FILETYPE_ASF, LIBMTP_FILETYPE_QT, LIBMTP_FILETYPE_UNDEF_VIDEO), then the images (LIBMTP_FILETYPE_JPEG, LIBMTP_FILETYPE_JFIF, LIBMTP_FILETYPE_TIFF, LIBMTP_FILETYPE_BMP, LIBMTP_FILETYPE_GIF, LIBMTP_FILETYPE_PICT, LIBMTP_FILETYPE_PNG), then contacts and calendars (LIBMTP_FILETYPE_VCALENDAR1, LIBMTP_FILETYPE_VCALENDAR2, LIBMTP_FILETYPE_VCARD2, LIBMTP_FILETYPE_VCARD3), then the document/exec crowd (LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, LIBMTP_FILETYPE_WINEXEC, LIBMTP_FILETYPE_TEXT, LIBMTP_FILETYPE_HTML, LIBMTP_FILETYPE_FIRMWARE), then more audio (LIBMTP_FILETYPE_AAC, LIBMTP_FILETYPE_MEDIACARD, LIBMTP_FILETYPE_FLAC, LIBMTP_FILETYPE_MP2, LIBMTP_FILETYPE_M4A), then more docs (LIBMTP_FILETYPE_DOC, LIBMTP_FILETYPE_XML, LIBMTP_FILETYPE_XLS, LIBMTP_FILETYPE_PPT, LIBMTP_FILETYPE_MHT, LIBMTP_FILETYPE_JP2, LIBMTP_FILETYPE_JPX), then LIBMTP_FILETYPE_ALBUM and LIBMTP_FILETYPE_PLAYLIST (container queens π), and it all wraps up at LIBMTP_FILETYPE_UNKNOWN. periodt.
π enum LIBMTP_property_t
bestie. this one is the long one. every property that can exist, and it is giving "i contain multitudes". deep breath:
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 }
things i am personally yelling about: LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier (yes, spelled Persistant, we do not touch it, we respect it π«‘), LIBMTP_PROPERTY_Fnumber, LIBMTP_PROPERTY_TimetoLive (lowercase t in to? iconic), LIBMTP_PROPERTY_UseCount and LIBMTP_PROPERTY_SkipCount sitting right next to each other, LIBMTP_PROPERTY_CorruptOrUnplayable (mood π), and the absolute trilogy of postal addresses: personal (LIBMTP_PROPERTY_PostalAddressPersonalFull and its FullLine1, FullLine2, FullCity, FullRegion, FullPostalCode, FullCountry), business (LIBMTP_PROPERTY_PostalAddressBusinessFull, then LIBMTP_PROPERTY_PostalAddressBusinessLine1, LIBMTP_PROPERTY_PostalAddressBusinessLine2, LIBMTP_PROPERTY_PostalAddressBusinessCity, LIBMTP_PROPERTY_PostalAddressBusinessRegion, LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, LIBMTP_PROPERTY_PostalAddressBusinessCountry), and other (LIBMTP_PROPERTY_PostalAddressOtherFull, LIBMTP_PROPERTY_PostalAddressOtherLine1, LIBMTP_PROPERTY_PostalAddressOtherLine2, LIBMTP_PROPERTY_PostalAddressOtherCity, LIBMTP_PROPERTY_PostalAddressOtherRegion, LIBMTP_PROPERTY_PostalAddressOtherPostalCode, LIBMTP_PROPERTY_PostalAddressOtherCountry). three whole address philosophies and honestly? valid. and it ends on LIBMTP_PROPERTY_UNKNOWN, as all things must. π¦
π enum LIBMTP_datatype_t
the smallest one, and it's basically a goldilocks situation β every width in both signed and unsigned:
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 }
LIBMTP_DATATYPE_INT8, LIBMTP_DATATYPE_UINT8, LIBMTP_DATATYPE_INT16, LIBMTP_DATATYPE_UINT16, LIBMTP_DATATYPE_INT32, LIBMTP_DATATYPE_UINT32, LIBMTP_DATATYPE_INT64, LIBMTP_DATATYPE_UINT64. 8 β 64, signed then unsigned, over and over. it's giving pattern recognition. π―
β enum LIBMTP_devicecap_t
five lil capabilities, no more, no less:
enum LIBMTP_devicecap_t { LIBMTP_DEVICECAP_GetPartialObject, LIBMTP_DEVICECAP_SendPartialObject, LIBMTP_DEVICECAP_EditObjects, LIBMTP_DEVICECAP_MoveObject, LIBMTP_DEVICECAP_CopyObject }
so ur device might LIBMTP_DEVICECAP_GetPartialObject, or LIBMTP_DEVICECAP_SendPartialObject, or LIBMTP_DEVICECAP_EditObjects, or LIBMTP_DEVICECAP_MoveObject, or LIBMTP_DEVICECAP_CopyObject. get/send/edit/move/copy. a whole little verbs-only to-do list, love that for them. π
π₯ enum LIBMTP_error_number_t
and the errors. because every romance has its red flags:
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 }
we got LIBMTP_ERROR_NONE (the dream β¨), LIBMTP_ERROR_GENERAL, LIBMTP_ERROR_PTP_LAYER, LIBMTP_ERROR_USB_LAYER, LIBMTP_ERROR_MEMORY_ALLOCATION, LIBMTP_ERROR_NO_DEVICE_ATTACHED (the betrayal π), LIBMTP_ERROR_STORAGE_FULL, LIBMTP_ERROR_CONNECTING, and LIBMTP_ERROR_CANCELLED. nine whole feelings. π
π Detailed Description π
and this is exactly where part 1 runs out of runway β the actual detailed description kicks off right here, and it's a whole other saga. onto the next part, bestie π«Ά
π Macro Definition Documentation π
LIBMTP_DEBUG_NONE = 0x00
okay bestie, the debug flags down here? they're the external flags that the libmtp library interface hands out. π
and like β please keep this list in sync with libmtp.c. that's the whole ask. reciprocal behaviour, it's giving teamwork. π«Ά
LIBMTP_FILETYPE_IS_ADDRESSBOOK( a )
Value:
(a == LIBMTP_FILETYPE_VCARD2 ||\
a == LIBMTP_FILETYPE_VCARD3)
the addressbook and business card filetype test. your little contact-y files, detected. slay. β¨
LIBMTP_FILETYPE_IS_AUDIO( a )
Value:
(a == LIBMTP_FILETYPE_WAV ||\
a == LIBMTP_FILETYPE_MP3 ||\
a == LIBMTP_FILETYPE_MP2 ||\
a == LIBMTP_FILETYPE_WMA ||\
a == LIBMTP_FILETYPE_OGG ||\
a == LIBMTP_FILETYPE_FLAC ||\
a == LIBMTP_FILETYPE_AAC ||\
a == LIBMTP_FILETYPE_M4A ||\
a == LIBMTP_FILETYPE_AUDIBLE ||\
a == LIBMTP_FILETYPE_UNDEF_AUDIO)
the audio filetype test π§
heads up babes: for filetypes that can be either audio or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO instead, okay? don't be out here guessing. π
LIBMTP_FILETYPE_IS_AUDIOVIDEO( a )
Value:
(a == LIBMTP_FILETYPE_MP4 ||\
a == LIBMTP_FILETYPE_ASF ||\
a == LIBMTP_FILETYPE_QT)
the audio and/or video filetype test. the ones that won't pick a lane, and honestly? iconic behaviour. π
LIBMTP_FILETYPE_IS_CALENDAR( a )
Value:
(a == LIBMTP_FILETYPE_VCALENDAR1 ||\
a == LIBMTP_FILETYPE_VCALENDAR2)
the calendar and appointment filetype test π
LIBMTP_FILETYPE_IS_IMAGE( a )
Value:
(a == LIBMTP_FILETYPE_JPEG ||\
a == LIBMTP_FILETYPE_JFIF ||\
a == LIBMTP_FILETYPE_TIFF ||\
a == LIBMTP_FILETYPE_BMP ||\
a == LIBMTP_FILETYPE_GIF ||\
a == LIBMTP_FILETYPE_PICT ||\
a == LIBMTP_FILETYPE_PNG ||\
a == LIBMTP_FILETYPE_JP2 ||\
a == LIBMTP_FILETYPE_JPX ||\
a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT)
the image filetype test π¦ pics detected, main character energy confirmed.
LIBMTP_FILETYPE_IS_TRACK( a )
Value:
(LIBMTP_FILETYPE_IS_AUDIO(a) ||\
LIBMTP_FILETYPE_IS_VIDEO(a) ||\
LIBMTP_FILETYPE_IS_AUDIOVIDEO(a))
this one right here? she's the vibe check. Use this to determine if the File API or Track API should be used to upload or download an object. β
Examples: sendtr.c, and tracks.c.
Referenced by LIBMTP_Get_Tracklisting_With_Callback_For_Storage(), LIBMTP_Get_Trackmetadata(), LIBMTP_Send_Track_From_File_Descriptor(), and LIBMTP_Send_Track_From_Handler().
LIBMTP_FILETYPE_IS_VIDEO( a )
Value:
(a == LIBMTP_FILETYPE_WMV ||\
a == LIBMTP_FILETYPE_AVI ||\
a == LIBMTP_FILETYPE_MPEG ||\
a == LIBMTP_FILETYPE_UNDEF_VIDEO)
the video filetype test π¬
same reminder as audio, bestie: for filetypes that can be either audio or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO. no cap. π
LIBMTP_HANDLER_RETURN_OK = 0
The return codes for the get/put functions. π yes that's the whole description, she's a woman of few words.
β¨ Typedef Documentation β¨
LIBMTP_album_t
typedef struct LIBMTP_album_struct LIBMTP_album_t β your album girlie πΏ
See also: LIBMTP_album_struct
Examples: sendtr.c.
LIBMTP_allowed_values_t
typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t
See also: LIBMTP_allowed_values_struct
LIBMTP_device_entry_t
typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t
See also: LIBMTP_device_entry_struct
LIBMTP_devicestorage_t
typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t
See also: LIBMTP_devicestorage_t β yeah she references herself, self-love honestly πΈ
Examples: detect.c, files.c, folders.c, sendtr.c, and tracks.c.
LIBMTP_error_t
typedef struct LIBMTP_error_struct LIBMTP_error_t
See also: LIBMTP_error_struct
LIBMTP_file_t
typedef struct LIBMTP_file_struct LIBMTP_file_t
See also: LIBMTP_file_struct
Examples: delfile.c, detect.c, files.c, getfile.c, newfolder.c, sendfile.c, sendtr.c, and tracks.c.
LIBMTP_filesampledata_t
typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t
See also: LIBMTP_filesample_t
LIBMTP_folder_t
typedef struct LIBMTP_folder_struct LIBMTP_folder_t
See also: LIBMTP_folder_t
Examples: delfile.c, folders.c, getfile.c, newfolder.c, sendfile.c, and sendtr.c.
LIBMTP_mtpdevice_t
typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t
yes there's a stray < sitting in the source right after this one and we do not know her π she's just vibing. not me including her so nothing gets lost.
See also: LIBMTP_device_extension_struct, LIBMTP_mtpdevice_struct
Examples: delfile.c, detect.c, files.c, folders.c, getfile.c, getplaylist.c, newfolder.c, playlists.c, sendfile.c, sendtr.c, tracks.c, and trexist.c. she's in everything π
LIBMTP_playlist_t
typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t
See also: LIBMTP_playlist_struct
Examples: getplaylist.c, and playlists.c.
LIBMTP_progressfunc_t
typedef int(* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const
total, void const *const data)
The callback type definition. π£ Notice that a progress percentage ratio is easy to calculate by dividing sent by total. maths but make it cute.
Parameters:
sentβ the number of bytes sent so fartotalβ the total number of bytes to senddataβ a user-defined dereferencable pointer
Returns: if anything else than 0 is returned, the current transfer will be interrupted / cancelled. π
LIBMTP_raw_device_t
typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t
See also: LIBMTP_raw_device_struct
Examples: detect.c, files.c, folders.c, and tracks.c.
LIBMTP_track_t
typedef struct LIBMTP_track_struct LIBMTP_track_t
See also: LIBMTP_track_struct
Examples: getplaylist.c, playlists.c, sendtr.c, and tracks.c.
MTPDataGetFunc
typedef uint16_t(* MTPDataGetFunc) (void *params, void *priv, uint32_t
wantlen, unsigned char *data, uint32_t *gotlen)
Callback function for get by handler function. π«‘
Parameters:
paramsβ the device parametersprivβ a user-defined dereferencable pointerwantlenβ the number of bytes wanteddataβ a buffer to write the data togotlenβ pointer to the number of bytes actually written todata
Returns: LIBMTP_HANDLER_RETURN_OK if successful, LIBMTP_HANDLER_RETURN_ERROR on error or LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer.
MTPDataPutFunc
typedef uint16_t(* MTPDataPutFunc) (void *params, void *priv, uint32_t
sendlen, unsigned char *data, uint32_t *putlen)
Callback function for put by handler function. π«‘ the other half of the duo.
Parameters:
paramsβ the device parametersprivβ a user-defined dereferencable pointersendlenβ the number of bytes availabledataβ a buffer to read the data fromputlenβ pointer to the number of bytes actually read fromdata
Returns: LIBMTP_HANDLER_RETURN_OK if successful, LIBMTP_HANDLER_RETURN_ERROR on error or LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer.
π₯ Enumeration Type Documentation π₯
enum LIBMTP_datatype_t
These are the data types. that's it. that's the tweet. π
enum LIBMTP_devicecap_t
These are device capabilities. π here's the lineup:
Enumerator
LIBMTP_DEVICECAP_GetPartialObjectβ This capability tells whether you can call the function getting partial objects,- See also:
LIBMTP_GetPartialObject()
- See also:
LIBMTP_DEVICECAP_SendPartialObjectβ This capability tells whether you can call the function sending partial objects.- See also:
LIBMTP_SendPartialObject()
- See also:
LIBMTP_DEVICECAP_EditObjectsβ This capability tells whether you can call the functions editing objects in-place on a device.- See also:
LIBMTP_BeginEditObject() LIBMTP_EndEditObject()LIBMTP_TruncateObject()
- See also:
LIBMTP_DEVICECAP_MoveObjectβ This capability tells whether you can call the function to move an object,- See also:
LIBMTP_MoveObject()
- See also:
LIBMTP_DEVICECAP_CopyObjectβ This capability tells whether you can call the function to copy an object,- See also:
LIBMTP_CopyObject()
- See also:
enum LIBMTP_error_number_t
These are the numbered error codes. You can also get string representations for errors. π handy when the numbers alone are giving unreadable.
Examples: detect.c, files.c, and tracks.c.
enum LIBMTP_filetype_t
The filetypes defined here are the external types used by the libmtp library interface. The types used internally as PTP-defined enumerator types is something different. π don't mix them up bestie, they are NOT the same girl.
enum LIBMTP_property_t
The properties defined here are the external types used by the libmtp library interface. π
πΈ Author πΈ
Generated automatically by Doxygen for libmtp from the source code. (so technically not a human author β she was built different, literally π§)
and that's a wrap on types(3), bestie!! π this whole page shipped with libmtp version 1.1.23, dated the way Doxygen dates things, and if you made it all the way down here you are genuinely the moment. π go forth and check your filetypes responsibly. mwah. π«Άβ¨
π¦ where this page comes from
- ubuntu stonking: libmtp-doc 1.1.23-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms