Functions | |
char * | LIBMTP_Get_String_From_Object (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t) |
uint32_t | LIBMTP_Get_U32_From_Object (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t, const uint32_t) |
uint16_t | LIBMTP_Get_U16_From_Object (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t, const uint16_t) |
int | LIBMTP_Set_Object_String (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t, char const *const) |
int | LIBMTP_Set_Object_U32 (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t, const uint32_t) |
int | LIBMTP_Set_Object_U16 (LIBMTP_mtpdevice_t *, const uint32_t, const uint32_t, const uint16_t) |
int | LIBMTP_Get_Object_References (LIBMTP_mtpdevice_t *, const uint32_t, uint32_t **, uint32_t *) |
int | LIBMTP_Set_Object_References (LIBMTP_mtpdevice_t *, const uint32_t, uint32_t const *const, const uint32_t) |
LIBMTP_object_t * | LIBMTP_Make_List (LIBMTP_mtpdevice_t *, uint32_t *, uint32_t, uint32_t *, uint32_t) |
LIBMTP_object_t * | LIBMTP_Find_Object (LIBMTP_object_t *, const uint32_t) |
void | LIBMTP_Dump_List (LIBMTP_object_t *) |
LIBMTP_object_t * | LIBMTP_new_object_t (void) |
void | LIBMTP_destroy_object_t (LIBMTP_object_t *, uint32_t) |
int | LIBMTP_Delete_Object (LIBMTP_mtpdevice_t *, uint32_t) |
int LIBMTP_Delete_Object | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t | object_id | |||
) |
This function deletes a single file, track, playlist or any other object off the MTP device, identified by an object ID.
device | a pointer to the device to delete the file or track from. | |
item_id | the item to delete. |
void LIBMTP_destroy_object_t | ( | LIBMTP_object_t * | object, | |
uint32_t | recursive | |||
) |
This deletes the memory for an object structure and makes use of the registered destructor for the object type data.
object | object structure to destroy | |
recurse | indicate if the call should recursively delete the object. Specify 1 for recursion. |
void LIBMTP_Dump_List | ( | LIBMTP_object_t * | list | ) |
Debug function that dumps out some textual representation of an object list.
list | object list returned from LIBMTP_Make_List |
LIBMTP_object_t* LIBMTP_Find_Object | ( | LIBMTP_object_t * | objectlist, | |
uint32_t | id | |||
) |
Helper function. Returns a folder structure for a specified id.
objectlist | list of objects to search id of object to look for |
int LIBMTP_Get_Object_References | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t ** | items, | |||
uint32_t * | len | |||
) |
Gets an array of object ids associated with a specified object
device | a pointer to an MTP device. | |
object_id | Object reference | |
items | array of unsigned 32-bit integers | |
len | length of array |
char* LIBMTP_Get_String_From_Object | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id | |||
) |
Retrieves a string from an object
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID |
free()
:ed by the caller after use. uint16_t LIBMTP_Get_U16_From_Object | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id, | |||
uint16_t const | value_default | |||
) |
Retrieves an unsigned 16-bit integer from an object attribute
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID | |
value_default | Default value to return on failure |
uint32_t LIBMTP_Get_U32_From_Object | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id, | |||
uint32_t const | value_default | |||
) |
Retrieves an unsigned 32-bit integer from an object attribute
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID | |
value_default | Default value to return on failure |
LIBMTP_object_t* LIBMTP_Make_List | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t * | filter, | |||
uint32_t | filter_len, | |||
uint32_t * | exclusions, | |||
uint32_t | exclusion_len | |||
) |
This returns a list of objects on the current MTP device, selected by a filter based on PTP object ID:s.
device | a pointer to the device to get the object listing for. | |
filter | array of unsigned 32-bit integers specifying which types to include in the list | |
filter_len | length of filter array in 32-bit words | |
exclusions | array of unsigned 32-bit integers specifying which types to exclude from the list | |
exclusion_len | length of exclusion array |
LIBMTP_object_t* LIBMTP_new_object_t | ( | void | ) |
This creates a new MTP object structure and allocates memory for it. Notice that if you add strings to this structure they will be freed by the corresponding LIBMTP_destroy_object_t
operation later, so be careful of using strdup() when assigning strings, e.g.:
LIBMTP_object_t *object = LIBMTP_new_object_t(); object->name = strdup(namestr); .... LIBMTP_destroy_object_t(file);
int LIBMTP_Set_Object_References | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const *const | items, | |||
uint32_t const | len | |||
) |
Sets an array of object ids associated with a specified object
device | a pointer to an MTP device. | |
object_id | Object reference | |
items | array of unsigned 32-bit integers | |
len | length of array |
int LIBMTP_Set_Object_String | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id, | |||
char const *const | string | |||
) |
Sets an object attribute from a string
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID | |
string | string value to set |
int LIBMTP_Set_Object_U16 | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id, | |||
uint16_t const | value | |||
) |
Sets an object attribute from an unsigned 16-bit integer
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID | |
value | 16-bit unsigned integer to set |
int LIBMTP_Set_Object_U32 | ( | LIBMTP_mtpdevice_t * | device, | |
uint32_t const | object_id, | |||
uint32_t const | attribute_id, | |||
uint32_t const | value | |||
) |
Sets an object attribute from an unsigned 32-bit integer
device | a pointer to an MTP device. | |
object_id | Object reference | |
attribute_id | PTP attribute ID | |
value | 32-bit unsigned integer to set |