Lines Matching refs:device

104 static void add_error_to_errorstack(LIBMTP_mtpdevice_t *device,
107 static void add_ptp_error_to_errorstack(LIBMTP_mtpdevice_t *device,
110 static void flush_handles(LIBMTP_mtpdevice_t *device);
111 static void get_handles_recursively(LIBMTP_mtpdevice_t *device,
115 static void free_storage_list(LIBMTP_mtpdevice_t *device);
116 static int sort_storage_by(LIBMTP_mtpdevice_t *device, int const sortby);
117 static uint32_t get_writeable_storageid(LIBMTP_mtpdevice_t *device, uint64_t fitsize);
118 static int get_storage_freespace(LIBMTP_mtpdevice_t *device,
121 static int check_if_file_fits(LIBMTP_mtpdevice_t *device,
128 static int get_device_unicode_property(LIBMTP_mtpdevice_t *device,
133 static char *get_string_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
135 static uint64_t get_u64_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id,
137 static uint32_t get_u32_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id,
139 static uint16_t get_u16_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
141 static uint8_t get_u8_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
143 static int set_object_string(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
145 static int set_object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
147 static int set_object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
149 static int set_object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id,
151 static void get_track_metadata(LIBMTP_mtpdevice_t *device, uint16_t objectformat,
154 static int create_new_abstract_list(LIBMTP_mtpdevice_t *device,
166 static int update_abstract_list(LIBMTP_mtpdevice_t *device,
175 static int send_file_object_info(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *filedata);
176 static void add_object_to_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id);
177 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id);
178 static int set_object_filename(LIBMTP_mtpdevice_t *device,
886 int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t *device, LIBMTP_property_t const property, in LIBMTP_Get_Allowed_Property_Values() argument
892 …ret = ptp_mtp_getobjectpropdesc(device->params, map_libmtp_property_to_ptp_property(property), map… in LIBMTP_Get_Allowed_Property_Values()
894 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Allowed_Property_Values(): could not get prop… in LIBMTP_Get_Allowed_Property_Values()
1083 int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t *device, LIBMTP_property_t const property, in LIBMTP_Is_Property_Supported() argument
1093 …ret = ptp_mtp_getobjectpropssupported(device->params, map_libmtp_type_to_ptp_type(filetype), &prop… in LIBMTP_Is_Property_Supported()
1095 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Is_Property_Supported(): could not get properties… in LIBMTP_Is_Property_Supported()
1121 char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Get_String_From_Object() argument
1124 return get_string_from_object(device, object_id, attribute_id); in LIBMTP_Get_String_From_Object()
1136 uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, in LIBMTP_Get_u64_From_Object() argument
1139 …return get_u64_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), v… in LIBMTP_Get_u64_From_Object()
1151 uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, in LIBMTP_Get_u32_From_Object() argument
1154 …return get_u32_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), v… in LIBMTP_Get_u32_From_Object()
1166 uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Get_u16_From_Object() argument
1169 …return get_u16_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), v… in LIBMTP_Get_u16_From_Object()
1181 uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Get_u8_From_Object() argument
1184 …return get_u8_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), va… in LIBMTP_Get_u8_From_Object()
1196 int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Set_Object_String() argument
1199 …return set_object_string(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), str… in LIBMTP_Set_Object_String()
1212 int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Set_Object_u32() argument
1215 …return set_object_u32(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); in LIBMTP_Set_Object_u32()
1227 int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Set_Object_u16() argument
1230 …return set_object_u16(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); in LIBMTP_Set_Object_u16()
1242 int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in LIBMTP_Set_Object_u8() argument
1245 return set_object_u8(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); in LIBMTP_Set_Object_u8()
1258 static char *get_string_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in get_string_from_object() argument
1263 PTPParams *params = (PTPParams *) device->params; in get_string_from_object()
1267 if ( device == NULL || object_id == 0) { in get_string_from_object()
1286 …add_ptp_error_to_errorstack(device, ret, "get_string_from_object(): could not get object string."); in get_string_from_object()
1301 static uint64_t get_u64_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, in get_u64_from_object() argument
1306 PTPParams *params = (PTPParams *) device->params; in get_u64_from_object()
1310 if ( device == NULL ) { in get_u64_from_object()
1325 …add_ptp_error_to_errorstack(device, ret, "get_u64_from_object(): could not get unsigned 64bit inte… in get_u64_from_object()
1340 static uint32_t get_u32_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, in get_u32_from_object() argument
1345 PTPParams *params = (PTPParams *) device->params; in get_u32_from_object()
1349 if ( device == NULL ) { in get_u32_from_object()
1364 …add_ptp_error_to_errorstack(device, ret, "get_u32_from_object(): could not get unsigned 32bit inte… in get_u32_from_object()
1378 static uint16_t get_u16_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in get_u16_from_object() argument
1383 PTPParams *params = (PTPParams *) device->params; in get_u16_from_object()
1387 if ( device == NULL ) { in get_u16_from_object()
1404 …add_ptp_error_to_errorstack(device, ret, "get_u16_from_object(): could not get unsigned 16bit inte… in get_u16_from_object()
1419 static uint8_t get_u8_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in get_u8_from_object() argument
1424 PTPParams *params = (PTPParams *) device->params; in get_u8_from_object()
1428 if ( device == NULL ) { in get_u8_from_object()
1445 …add_ptp_error_to_errorstack(device, ret, "get_u8_from_object(): could not get unsigned 8bit intege… in get_u8_from_object()
1460 static int set_object_string(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in set_object_string() argument
1464 PTPParams *params = (PTPParams *) device->params; in set_object_string()
1467 if (device == NULL || string == NULL) { in set_object_string()
1472 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_string(): could not set object s… in set_object_string()
1479 add_ptp_error_to_errorstack(device, ret, "set_object_string(): could not set object string."); in set_object_string()
1496 static int set_object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in set_object_u32() argument
1500 PTPParams *params = (PTPParams *) device->params; in set_object_u32()
1503 if (device == NULL) { in set_object_u32()
1508 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u32(): could not set unsigned 32… in set_object_u32()
1516 …add_ptp_error_to_errorstack(device, ret, "set_object_u32(): could not set unsigned 32bit integer p… in set_object_u32()
1532 static int set_object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in set_object_u16() argument
1536 PTPParams *params = (PTPParams *) device->params; in set_object_u16()
1539 if (device == NULL) { in set_object_u16()
1544 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u16(): could not set unsigned 16… in set_object_u16()
1551 …add_ptp_error_to_errorstack(device, ret, "set_object_u16(): could not set unsigned 16bit integer p… in set_object_u16()
1567 static int set_object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id, in set_object_u8() argument
1571 PTPParams *params = (PTPParams *) device->params; in set_object_u8()
1574 if (device == NULL) { in set_object_u8()
1579 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u8(): could not set unsigned 8bi… in set_object_u8()
1586 …add_ptp_error_to_errorstack(device, ret, "set_object_u8(): could not set unsigned 8bit integer pro… in set_object_u8()
1952 void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t *device) in LIBMTP_Release_Device_List() argument
1954 if(device != NULL) in LIBMTP_Release_Device_List()
1956 if(device->next != NULL) in LIBMTP_Release_Device_List()
1958 LIBMTP_Release_Device_List(device->next); in LIBMTP_Release_Device_List()
1961 LIBMTP_Release_Device(device); in LIBMTP_Release_Device_List()
1969 void LIBMTP_Release_Device(LIBMTP_mtpdevice_t *device) in LIBMTP_Release_Device() argument
1971 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Release_Device()
1972 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Release_Device()
1976 LIBMTP_Clear_Errorstack(device); in LIBMTP_Release_Device()
1982 free_storage_list(device); in LIBMTP_Release_Device()
1983 free(device); in LIBMTP_Release_Device()
1993 static void add_error_to_errorstack(LIBMTP_mtpdevice_t *device, in add_error_to_errorstack() argument
1999 if (device == NULL) { in add_error_to_errorstack()
2007 if (device->errorstack == NULL) { in add_error_to_errorstack()
2008 device->errorstack = newerror; in add_error_to_errorstack()
2010 LIBMTP_error_t *tmp = device->errorstack; in add_error_to_errorstack()
2022 static void add_ptp_error_to_errorstack(LIBMTP_mtpdevice_t *device, in add_ptp_error_to_errorstack() argument
2026 if (device == NULL) { in add_ptp_error_to_errorstack()
2033 add_error_to_errorstack(device, LIBMTP_ERROR_PTP_LAYER, outstr); in add_ptp_error_to_errorstack()
2034 …add_error_to_errorstack(device, LIBMTP_ERROR_PTP_LAYER, "(Look this up in ptp.h for an explanation… in add_ptp_error_to_errorstack()
2053 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Errorstack() argument
2055 if (device == NULL) { in LIBMTP_Get_Errorstack()
2059 return device->errorstack; in LIBMTP_Get_Errorstack()
2069 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t *device) in LIBMTP_Clear_Errorstack() argument
2071 if (device == NULL) { in LIBMTP_Clear_Errorstack()
2074 LIBMTP_error_t *tmp = device->errorstack; in LIBMTP_Clear_Errorstack()
2086 device->errorstack = NULL; in LIBMTP_Clear_Errorstack()
2096 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t *device) in LIBMTP_Dump_Errorstack() argument
2098 if (device == NULL) { in LIBMTP_Dump_Errorstack()
2101 LIBMTP_error_t *tmp = device->errorstack; in LIBMTP_Dump_Errorstack()
2114 void LIBMTP_Set_Device_Timeout(LIBMTP_mtpdevice_t *device, int milliseconds) in LIBMTP_Set_Device_Timeout() argument
2116 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Set_Device_Timeout()
2120 void LIBMTP_Get_Device_Timeout(LIBMTP_mtpdevice_t *device, int * milliseconds) in LIBMTP_Get_Device_Timeout() argument
2122 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Device_Timeout()
2135 static int get_all_metadata_fast(LIBMTP_mtpdevice_t *device, in get_all_metadata_fast() argument
2138 PTPParams *params = (PTPParams *) device->params; in get_all_metadata_fast()
2146 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in get_all_metadata_fast()
2170 add_ptp_error_to_errorstack(device, ret, "get_all_metadata_fast(): " in get_all_metadata_fast()
2175 add_ptp_error_to_errorstack(device, ret, "get_all_metadata_fast(): " in get_all_metadata_fast()
2180 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, in get_all_metadata_fast()
2228 if (device->object_bitsize == 64) { in get_all_metadata_fast()
2276 static void get_handles_recursively(LIBMTP_mtpdevice_t *device, in get_handles_recursively() argument
2290 …add_ptp_error_to_errorstack(device, ret, "get_handles_recursively(): could not get object handles.… in get_handles_recursively()
2303 get_handles_recursively(device, params, storageid, currentHandles.Handler[i]); in get_handles_recursively()
2305 add_error_to_errorstack(device, in get_handles_recursively()
2314 LIBMTP_file_t * obj2file(LIBMTP_mtpdevice_t *device, PTPObject *ob) in obj2file() argument
2316 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in obj2file()
2317 PTPParams *params = (PTPParams *) device->params; in obj2file()
2382 if (device->object_bitsize == 64) { in obj2file()
2398 …add_ptp_error_to_errorstack(device, ret, "obj2file(): call to ptp_mtp_getobjectpropssupported() fa… in obj2file()
2410 if (device->object_bitsize == 64) { in obj2file()
2411 file->filesize = get_u64_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in obj2file()
2413 file->filesize = get_u32_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in obj2file()
2429 static LIBMTP_file_t * get_files(LIBMTP_mtpdevice_t *device, in get_files() argument
2447 add_ptp_error_to_errorstack(device, ret, "get_files(): could not get object handles."); in get_files()
2462 file = obj2file(device, ob); in get_files()
2507 LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *device, uint32_t storageId, uint32… in LIBMTP_Get_Files_And_Folders() argument
2510 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Files_And_Folders()
2511 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Files_And_Folders()
2521 ret = get_all_metadata_fast(device, PTP_GOH_ALL_STORAGE); in LIBMTP_Get_Files_And_Folders()
2526 retfiles = get_files(device, params, storageId, parentId); in LIBMTP_Get_Files_And_Folders()
2538 static void flush_handles(LIBMTP_mtpdevice_t *device) in flush_handles() argument
2540 PTPParams *params = (PTPParams *) device->params; in flush_handles()
2541 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in flush_handles()
2561 ret = get_all_metadata_fast(device, PTP_GOH_ALL_STORAGE); in flush_handles()
2568 if (device->storage == NULL) { in flush_handles()
2569 get_handles_recursively(device, params, in flush_handles()
2574 LIBMTP_devicestorage_t *storage = device->storage; in flush_handles()
2576 get_handles_recursively(device, params, in flush_handles()
2609 if (device->storage != NULL && ob->oi.StorageID != device->storage->id) in flush_handles()
2616 device->default_music_folder = ob->oid; in flush_handles()
2620 device->default_playlist_folder = ob->oid; in flush_handles()
2624 device->default_picture_folder = ob->oid; in flush_handles()
2628 device->default_video_folder = ob->oid; in flush_handles()
2631 device->default_organizer_folder = ob->oid; in flush_handles()
2635 device->default_zencast_folder = ob->oid; in flush_handles()
2639 device->default_album_folder = ob->oid; in flush_handles()
2643 device->default_text_folder = ob->oid; in flush_handles()
2654 static void free_storage_list(LIBMTP_mtpdevice_t *device) in free_storage_list() argument
2659 storage = device->storage; in free_storage_list()
2671 device->storage = NULL; in free_storage_list()
2682 static int sort_storage_by(LIBMTP_mtpdevice_t *device,int const sortby) in sort_storage_by() argument
2686 if (device->storage == NULL) in sort_storage_by()
2691 oldhead = ptr1 = ptr2 = device->storage; in sort_storage_by()
2741 device->storage = newlist; in sort_storage_by()
2754 static uint32_t get_writeable_storageid(LIBMTP_mtpdevice_t *device, uint64_t fitsize) in get_writeable_storageid() argument
2761 storage = device->storage; in get_writeable_storageid()
2784 subcall_ret = check_if_file_fits(device, storage, fitsize); in get_writeable_storageid()
2793 …add_error_to_errorstack(device, LIBMTP_ERROR_STORAGE_FULL, "LIBMTP_Send_File_From_File_Descriptor(… in get_writeable_storageid()
2813 static int get_storage_freespace(LIBMTP_mtpdevice_t *device, in get_storage_freespace() argument
2817 PTPParams *params = (PTPParams *) device->params; in get_storage_freespace()
2827 …add_ptp_error_to_errorstack(device, ret, "get_first_storage_freespace(): could not get storage inf… in get_storage_freespace()
2857 void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t *device) in LIBMTP_Dump_Device_Info() argument
2860 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Dump_Device_Info()
2861 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Dump_Device_Info()
2862 LIBMTP_devicestorage_t *storage = device->storage; in LIBMTP_Dump_Device_Info()
2874 printf(" Detected object size: %d bits\n", device->object_bitsize); in LIBMTP_Dump_Device_Info()
2916 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Dump_Device_Info(): error on query for object pro… in LIBMTP_Dump_Device_Info()
2926 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Dump_Device_Info(): " in LIBMTP_Dump_Device_Info()
3210 printf(" Default music folder: 0x%08x\n", device->default_music_folder); in LIBMTP_Dump_Device_Info()
3211 printf(" Default playlist folder: 0x%08x\n", device->default_playlist_folder); in LIBMTP_Dump_Device_Info()
3212 printf(" Default picture folder: 0x%08x\n", device->default_picture_folder); in LIBMTP_Dump_Device_Info()
3213 printf(" Default video folder: 0x%08x\n", device->default_video_folder); in LIBMTP_Dump_Device_Info()
3214 printf(" Default organizer folder: 0x%08x\n", device->default_organizer_folder); in LIBMTP_Dump_Device_Info()
3215 printf(" Default zencast folder: 0x%08x\n", device->default_zencast_folder); in LIBMTP_Dump_Device_Info()
3216 printf(" Default album folder: 0x%08x\n", device->default_album_folder); in LIBMTP_Dump_Device_Info()
3217 printf(" Default text folder: 0x%08x\n", device->default_text_folder); in LIBMTP_Dump_Device_Info()
3226 int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t *device) in LIBMTP_Reset_Device() argument
3228 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Reset_Device()
3232 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, in LIBMTP_Reset_Device()
3238 add_ptp_error_to_errorstack(device, ret, "Error resetting."); in LIBMTP_Reset_Device()
3251 char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Manufacturername() argument
3254 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Manufacturername()
3270 char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Modelname() argument
3273 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Modelname()
3288 char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Serialnumber() argument
3291 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Serialnumber()
3307 char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Deviceversion() argument
3310 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Deviceversion()
3329 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Friendlyname() argument
3333 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Friendlyname()
3345 add_ptp_error_to_errorstack(device, ret, "Error getting friendlyname."); in LIBMTP_Get_Friendlyname()
3362 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t *device, in LIBMTP_Set_Friendlyname() argument
3366 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Set_Friendlyname()
3378 add_ptp_error_to_errorstack(device, ret, "Error setting friendlyname."); in LIBMTP_Set_Friendlyname()
3392 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Syncpartner() argument
3396 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Syncpartner()
3408 add_ptp_error_to_errorstack(device, ret, "Error getting syncpartner."); in LIBMTP_Get_Syncpartner()
3430 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t *device, in LIBMTP_Set_Syncpartner() argument
3434 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Set_Syncpartner()
3446 add_ptp_error_to_errorstack(device, ret, "Error setting syncpartner."); in LIBMTP_Set_Syncpartner()
3460 static int check_if_file_fits(LIBMTP_mtpdevice_t *device, in check_if_file_fits() argument
3463 PTPParams *params = (PTPParams *) device->params; in check_if_file_fits()
3472 ret = get_storage_freespace(device, storage, &freebytes); in check_if_file_fits()
3474 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, in check_if_file_fits()
3499 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *device, in LIBMTP_Get_Batterylevel() argument
3505 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Batterylevel()
3506 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Batterylevel()
3518 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Batterylevel(): could not get device property… in LIBMTP_Get_Batterylevel()
3522 *maximum_level = device->maximum_battery_level; in LIBMTP_Get_Batterylevel()
3538 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage) in LIBMTP_Format_Storage() argument
3541 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Format_Storage()
3544 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, in LIBMTP_Format_Storage()
3550 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Format_Storage(): failed to format storage."); in LIBMTP_Format_Storage()
3566 static int get_device_unicode_property(LIBMTP_mtpdevice_t *device, in get_device_unicode_property() argument
3570 PTPParams *params = (PTPParams *) device->params; in get_device_unicode_property()
3587 …add_ptp_error_to_errorstack(device, ret, "get_device_unicode_property(): failed to get unicode pro… in get_device_unicode_property()
3601 *unicstring = utf16_to_utf8(device, tmp); in get_device_unicode_property()
3617 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *device, char ** const sectime) in LIBMTP_Get_Secure_Time() argument
3619 return get_device_unicode_property(device, sectime, PTP_DPC_MTP_SecureTime); in LIBMTP_Get_Secure_Time()
3631 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *device, char ** const devcert) in LIBMTP_Get_Device_Certificate() argument
3633 return get_device_unicode_property(device, devcert, PTP_DPC_MTP_DeviceCertificate); in LIBMTP_Get_Device_Certificate()
3651 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *device, uint16_t ** const filetypes, in LIBMTP_Get_Supported_Filetypes() argument
3654 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Supported_Filetypes()
3655 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Supported_Filetypes()
3715 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *device, int const sortby) in LIBMTP_Get_Storage() argument
3719 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Storage()
3724 if (device->storage != NULL) in LIBMTP_Get_Storage()
3725 free_storage_list(device); in LIBMTP_Get_Storage()
3741 if (device->storage == NULL) in LIBMTP_Get_Storage()
3742 device->storage = storage; in LIBMTP_Get_Storage()
3764 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Storage(): Could not get storage info."); in LIBMTP_Get_Storage()
3765 if (device->storage != NULL) { in LIBMTP_Get_Storage()
3766 free_storage_list(device); in LIBMTP_Get_Storage()
3775 if (device->storage == NULL) in LIBMTP_Get_Storage()
3776 device->storage = storage; in LIBMTP_Get_Storage()
3795 sort_storage_by(device,sortby); in LIBMTP_Get_Storage()
3858 LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Filelisting() argument
3862 return LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); in LIBMTP_Get_Filelisting()
3906 LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *device, in LIBMTP_Get_Filelisting_With_Callback() argument
3913 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Filelisting_With_Callback()
3914 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Filelisting_With_Callback()
3919 flush_handles(device); in LIBMTP_Get_Filelisting_With_Callback()
3989 if (device->object_bitsize == 64) { in LIBMTP_Get_Filelisting_With_Callback()
4005 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Filelisting_With_Callback(): call to ptp_mtp_… in LIBMTP_Get_Filelisting_With_Callback()
4012 if (device->object_bitsize == 64) { in LIBMTP_Get_Filelisting_With_Callback()
4013 file->filesize = get_u64_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in LIBMTP_Get_Filelisting_With_Callback()
4015 file->filesize = get_u32_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in LIBMTP_Get_Filelisting_With_Callback()
4060 LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *device, uint32_t const fileid) in LIBMTP_Get_Filemetadata() argument
4063 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Filemetadata()
4070 flush_handles(device); in LIBMTP_Get_Filemetadata()
4108 if (device->object_bitsize == 64) { in LIBMTP_Get_Filemetadata()
4123 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Filemetadata(): call to ptp_mtp_getobjectprop… in LIBMTP_Get_Filemetadata()
4129 if (device->object_bitsize == 64) { in LIBMTP_Get_Filemetadata()
4130 file->filesize = get_u64_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in LIBMTP_Get_Filemetadata()
4132 file->filesize = get_u32_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); in LIBMTP_Get_Filemetadata()
4228 static void pick_property_to_track_metadata(LIBMTP_mtpdevice_t *device, MTPProperties *prop, LIBMTP… in pick_property_to_track_metadata() argument
4296 if (device->object_bitsize == 64) { in pick_property_to_track_metadata()
4315 static void get_track_metadata(LIBMTP_mtpdevice_t *device, uint16_t objectformat, in get_track_metadata() argument
4319 PTPParams *params = (PTPParams *) device->params; in get_track_metadata()
4331 pick_property_to_track_metadata(device, prop, track); in get_track_metadata()
4339 …add_ptp_error_to_errorstack(device, ret, "get_track_metadata(): call to ptp_mtp_getobjectpropssupp… in get_track_metadata()
4346 track->title = get_string_from_object(device, track->item_id, PTP_OPC_Name); in get_track_metadata()
4349 track->artist = get_string_from_object(device, track->item_id, PTP_OPC_Artist); in get_track_metadata()
4352 track->composer = get_string_from_object(device, track->item_id, PTP_OPC_Composer); in get_track_metadata()
4355 track->duration = get_u32_from_object(device, track->item_id, PTP_OPC_Duration, 0); in get_track_metadata()
4358 track->tracknumber = get_u16_from_object(device, track->item_id, PTP_OPC_Track, 0); in get_track_metadata()
4361 track->genre = get_string_from_object(device, track->item_id, PTP_OPC_Genre); in get_track_metadata()
4364 track->album = get_string_from_object(device, track->item_id, PTP_OPC_AlbumName); in get_track_metadata()
4367 track->date = get_string_from_object(device, track->item_id, PTP_OPC_OriginalReleaseDate); in get_track_metadata()
4371 track->samplerate = get_u32_from_object(device, track->item_id, PTP_OPC_SampleRate, 0); in get_track_metadata()
4374 track->nochannels = get_u16_from_object(device, track->item_id, PTP_OPC_NumberOfChannels, 0); in get_track_metadata()
4377 track->wavecodec = get_u32_from_object(device, track->item_id, PTP_OPC_AudioWAVECodec, 0); in get_track_metadata()
4380 track->bitrate = get_u32_from_object(device, track->item_id, PTP_OPC_AudioBitRate, 0); in get_track_metadata()
4383 track->bitratetype = get_u16_from_object(device, track->item_id, PTP_OPC_BitRateType, 0); in get_track_metadata()
4386 track->rating = get_u16_from_object(device, track->item_id, PTP_OPC_Rating, 0); in get_track_metadata()
4389 track->usecount = get_u32_from_object(device, track->item_id, PTP_OPC_UseCount, 0); in get_track_metadata()
4392 if (device->object_bitsize == 64) { in get_track_metadata()
4393 track->filesize = get_u64_from_object(device, track->item_id, PTP_OPC_ObjectSize, 0); in get_track_metadata()
4395 … track->filesize = (uint64_t) get_u32_from_object(device, track->item_id, PTP_OPC_ObjectSize, 0); in get_track_metadata()
4410 LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t *device) in LIBMTP_Get_Tracklisting() argument
4414 return LIBMTP_Get_Tracklisting_With_Callback(device, NULL, NULL); in LIBMTP_Get_Tracklisting()
4458 LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t *device, in LIBMTP_Get_Tracklisting_With_Callback() argument
4465 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Tracklisting_With_Callback()
4466 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Tracklisting_With_Callback()
4470 flush_handles(device); in LIBMTP_Get_Tracklisting_With_Callback()
4516 get_track_metadata(device, ob->oi.ObjectFormat, track); in LIBMTP_Get_Tracklisting_With_Callback()
4573 LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t *device, uint32_t const trackid) in LIBMTP_Get_Trackmetadata() argument
4575 PTPParams *params = (PTPParams *) device->params; in LIBMTP_Get_Trackmetadata()
4576 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; in LIBMTP_Get_Trackmetadata()
4584 flush_handles(device); in LIBMTP_Get_Trackmetadata()
4647 get_track_metadata(device, ob->oi.ObjectFormat, track); in LIBMTP_Get_Trackmetadata()
4714 int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t *device, uint32_t const id, argument
4724 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File(): Bad arguments, p…
4738 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File(): Could not create…
4742 ret = LIBMTP_Get_File_To_File_Descriptor(device, id, fd, callback, data, &mtime);
4778 int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t *device, argument
4786 PTPParams *params = (PTPParams *) device->params;
4787 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
4792 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Could…
4796 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Bad o…
4820 …add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Get_File_From_File_Descriptor(): C…
4824 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_File_To_File_Descriptor(): Could not get file…
4848 int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *device, argument
4857 PTPParams *params = (PTPParams *) device->params;
4858 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
4862 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Could…
4866 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Bad o…
4895 …add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Get_File_From_File_Descriptor(): C…
4899 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_File_To_File_Descriptor(): Could not get file…
4923 int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t *device, uint32_t const id, argument
4928 return LIBMTP_Get_File_To_File(device, id, path, callback, data);
4949 int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t *device, argument
4957 return LIBMTP_Get_File_To_File_Descriptor(device, id, fd, callback, data, mtime);
4977 int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *device, argument
4985 return LIBMTP_Get_File_To_Handler(device, id, put_func, priv, callback, data);
5025 int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *device, argument
5035 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_File(): Bad argument…
5053 ret = LIBMTP_Send_Track_From_File_Descriptor(device, fd, metadata, callback, data);
5101 int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *device, argument
5111 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5125 subcall_ret = LIBMTP_Send_File_From_File_Descriptor(device,
5132 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5146 subcall_ret = LIBMTP_Update_Track_Metadata(device, metadata);
5198 int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *device, argument
5208 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5222 subcall_ret = LIBMTP_Send_File_From_Handler(device,
5230 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5244 subcall_ret = LIBMTP_Update_Track_Metadata(device, metadata);
5290 int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *device, argument
5300 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_File(): Bad arguments…
5314 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_File(): Could not ope…
5318 ret = LIBMTP_Send_File_From_File_Descriptor(device, fd, filedata, callback, data);
5368 int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *device, argument
5374 PTPParams *params = (PTPParams *) device->params;
5375 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
5378 if (send_file_object_info(device, filedata))
5400 …add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Send_File_From_File_Descriptor(): …
5404 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_File_From_File_Descriptor(): "
5409 add_object_to_cache(device, filedata->item_id);
5417 newfilemeta = LIBMTP_Get_Filemetadata(device, filedata->item_id);
5423 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5472 int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *device, argument
5477 PTPParams *params = (PTPParams *) device->params;
5478 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
5481 if (send_file_object_info(device, filedata))
5513 …add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Send_File_From_Handler(): Cancelle…
5517 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_File_From_Handler(): "
5522 add_object_to_cache(device, filedata->item_id);
5530 newfilemeta = LIBMTP_Get_Filemetadata(device, filedata->item_id);
5536 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
5552 static int send_file_object_info(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *filedata) argument
5554 PTPParams *params = (PTPParams *) device->params;
5555 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
5573 store = get_writeable_storageid(device, filedata->filesize);
5576 storage = device->storage;
5594 localph = device->default_music_folder;
5596 localph = device->default_video_folder;
5608 localph = device->default_picture_folder;
5615 localph = device->default_organizer_folder;
5617 localph = device->default_text_folder;
5712 add_ptp_error_to_errorstack(device, ret, "send_file_object_info(): "
5774 add_ptp_error_to_errorstack(device, ret, "send_file_object_info():"
5777 add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED.");
5801 add_ptp_error_to_errorstack(device, ret, "send_file_object_info(): "
5804 add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED.");
5835 int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *device, argument
5839 PTPParams *params = (PTPParams *) device->params;
5840 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
5850 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
5865 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6015 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6027 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6033 ret = set_object_string(device, metadata->item_id, PTP_OPC_Name, metadata->title);
6035 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6041 ret = set_object_string(device, metadata->item_id, PTP_OPC_AlbumName, metadata->album);
6043 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6049 ret = set_object_string(device, metadata->item_id, PTP_OPC_Artist, metadata->artist);
6051 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6057 ret = set_object_string(device, metadata->item_id, PTP_OPC_Composer, metadata->composer);
6059 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6065 ret = set_object_string(device, metadata->item_id, PTP_OPC_Genre, metadata->genre);
6067 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6074 …ret = set_object_u32(device, metadata->item_id, PTP_OPC_Duration, adjust_u32(metadata->duration, &…
6076 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6084 …ret = set_object_u16(device, metadata->item_id, PTP_OPC_Track, adjust_u16(metadata->tracknumber, &…
6086 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6093 ret = set_object_string(device, metadata->item_id, PTP_OPC_OriginalReleaseDate, metadata->date);
6095 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6103 …ret = set_object_u32(device, metadata->item_id, PTP_OPC_SampleRate, adjust_u32(metadata->samplerat…
6105 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6113 …ret = set_object_u16(device, metadata->item_id, PTP_OPC_NumberOfChannels, adjust_u16(metadata->noc…
6115 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6123 …ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioWAVECodec, adjust_u32(metadata->wavec…
6125 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6133 …ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioBitRate, adjust_u32(metadata->bitrate…
6135 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6143 …ret = set_object_u16(device, metadata->item_id, PTP_OPC_BitRateType, adjust_u16(metadata->bitratet…
6145 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6154 …ret = set_object_u16(device, metadata->item_id, PTP_OPC_Rating, adjust_u16(metadata->rating, &opd)…
6156 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6163 …ret = set_object_u32(device, metadata->item_id, PTP_OPC_UseCount, adjust_u32(metadata->usecount, &…
6165 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6173 ret = set_object_string(device, metadata->item_id, PTP_OPC_DateModified, tmpstamp);
6175 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6191 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): "
6198 update_metadata_cache(device, metadata->item_id);
6220 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *device, argument
6224 PTPParams *params = (PTPParams *) device->params;
6228 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Delete_Object(): could not delete object.");
6238 static int set_object_filename(LIBMTP_mtpdevice_t *device, argument
6242 PTPParams *params = (PTPParams *) device->params;
6243 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
6251 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): "
6258 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): "
6288 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): "
6294 ret = set_object_string(device, object_id, PTP_OPC_ObjectFileName, newname);
6296 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): "
6303 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): "
6312 update_metadata_cache(device, object_id);
6329 int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *device, argument
6334 ret = set_object_filename(device, file->item_id,
6359 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *device, argument
6364 ret = set_object_filename(device, folder->folder_id,
6389 int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *device, argument
6394 ret = set_object_filename(device, track->item_id,
6426 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *device, argument
6431 ret = set_object_filename(device, playlist->playlist_id,
6463 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *device, argument
6468 ret = set_object_filename(device, album->album_id,
6491 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *device, argument
6497 file = LIBMTP_Get_Filemetadata(device, object_id);
6500 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Object_Filename(): "
6505 …ret = set_object_filename(device, object_id, map_libmtp_type_to_ptp_type(file->filetype), (const c…
6518 int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *device, argument
6521 PTPParams *params = (PTPParams *) device->params;
6662 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t *device) argument
6664 PTPParams *params = (PTPParams *) device->params;
6670 flush_handles(device);
6764 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t *device, char *name, argument
6767 PTPParams *params = (PTPParams *) device->params;
6768 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
6777 store = get_writeable_storageid(device, 512);
6804 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Create_Folder: Could not send object info.");
6806 add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED.");
6813 add_object_to_cache(device, new_id);
6883 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *device) argument
6885 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
6887 PTPParams *params = (PTPParams *) device->params;
6894 flush_handles(device);
6911 spl_to_playlist_t(device, &ob->oi, ob->oid, pl);
6921 pl->name = get_string_from_object(device, ob->oid, PTP_OPC_Name);
6932 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist_List(): "
6961 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *device, uint32_t const plid) argument
6963 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
6965 PTPParams *params = (PTPParams *) device->params;
6972 flush_handles(device);
6984 spl_to_playlist_t(device, &ob->oi, ob->oid, pl);
6996 pl->name = get_string_from_object(device, ob->oid, PTP_OPC_Name);
7007 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist(): Could not get object references."…
7035 static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, argument
7057 PTPParams *params = (PTPParams *) device->params;
7058 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
7064 store = get_writeable_storageid(device, 512);
7077 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): player does not…
7113 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): "
7209 …add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send object proper…
7211 add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED.");
7219 …add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send blank object …
7236 …add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send object info (…
7238 add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED.");
7252 …add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send blank object …
7264 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): "
7270 ret = set_object_string(device, *newid, PTP_OPC_Name, name);
7272 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set e…
7279 ret = set_object_string(device, *newid, PTP_OPC_AlbumArtist, artist);
7281 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set e…
7288 ret = set_object_string(device, *newid, PTP_OPC_Artist, artist);
7290 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set e…
7297 ret = set_object_string(device, *newid, PTP_OPC_Composer, composer);
7299 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set e…
7306 ret = set_object_string(device, *newid, PTP_OPC_Genre, genre);
7308 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set e…
7315 ret = set_object_string(device, *newid, PTP_OPC_DateModified, get_iso8601_stamp());
7317 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): could not set d…
7333 …add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): could not add tracks as obje…
7338 add_object_to_cache(device, *newid);
7357 static int update_abstract_list(LIBMTP_mtpdevice_t *device, argument
7368 PTPParams *params = (PTPParams *) device->params;
7369 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
7379 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7394 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7467 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7479 ret = set_object_string(device, objecthandle, PTP_OPC_Name, name);
7481 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7487 ret = set_object_string(device, objecthandle, PTP_OPC_AlbumArtist, artist);
7489 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7495 ret = set_object_string(device, objecthandle, PTP_OPC_Artist, artist);
7497 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7502 ret = set_object_string(device, objecthandle, PTP_OPC_Composer, composer);
7504 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7510 ret = set_object_string(device, objecthandle, PTP_OPC_Genre, genre);
7512 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7520 ret = set_object_string(device, objecthandle, PTP_OPC_DateModified, tmpdate);
7522 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7532 add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): "
7541 …add_ptp_error_to_errorstack(device, ret, "update_abstract_list(): could not add tracks as object r…
7548 update_metadata_cache(device, objecthandle);
7580 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *device, argument
7583 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
7588 if (device->default_playlist_folder != 0)
7589 localph = device->default_playlist_folder;
7591 localph = device->default_music_folder;
7597 return playlist_t_to_spl(device, metadata);
7601 return create_new_abstract_list(device,
7632 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *device, argument
7637 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
7639 return update_spl_playlist(device, metadata);
7642 return update_abstract_list(device,
7710 static void pick_property_to_album_metadata(LIBMTP_mtpdevice_t *device, argument
7758 static void get_album_metadata(LIBMTP_mtpdevice_t *device, argument
7762 PTPParams *params = (PTPParams *) device->params;
7774 pick_property_to_album_metadata(device, prop, alb);
7782 …add_ptp_error_to_errorstack(device, ret, "get_album_metadata(): call to ptp_mtp_getobjectpropssupp…
7789 alb->name = get_string_from_object(device, ob->oid, PTP_OPC_Name);
7794 alb->artist = get_string_from_object(device, ob->oid, PTP_OPC_AlbumArtist);
7798 alb->artist = get_string_from_object(device, ob->oid, PTP_OPC_Artist);
7801 alb->composer = get_string_from_object(device, ob->oid, PTP_OPC_Composer);
7804 alb->genre = get_string_from_object(device, ob->oid, PTP_OPC_Genre);
7824 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *device) argument
7826 PTPParams *params = (PTPParams *) device->params;
7833 flush_handles(device);
7853 get_album_metadata(device, alb);
7858 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Album_List(): Could not get object references…
7883 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *device, uint32_t const albid) argument
7885 PTPParams *params = (PTPParams *) device->params;
7892 flush_handles(device);
7909 get_album_metadata(device, alb);
7914 add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Album: Could not get object references.");
7948 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *device, argument
7955 if (device->default_album_folder != 0)
7956 localph = device->default_album_folder;
7958 localph = device->default_music_folder;
7963 return create_new_abstract_list(device,
8039 int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *device, argument
8044 PTPParams *params = (PTPParams *) device->params;
8067 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample_Format(): could not get…
8172 int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *device, argument
8177 PTPParams *params = (PTPParams *) device->params;
8178 PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
8189 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Representative_Sample(): could …
8196 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_Representative_Sample(): could not get objec…
8208 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Representative_Sample(): object…
8223 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_Representative_Sample(): could not send samp…
8241 set_object_u32(device, id, PTP_OPC_RepresentativeSampleHeight, sampledata->height);
8242 set_object_u32(device, id, PTP_OPC_RepresentativeSampleWidth, sampledata->width);
8247 set_object_u32(device, id, PTP_OPC_RepresentativeSampleDuration, sampledata->duration);
8248 set_object_u32(device, id, PTP_OPC_RepresentativeSampleSize, sampledata->size);
8267 int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *device, argument
8272 PTPParams *params = (PTPParams *) device->params;
8283 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): could n…
8290 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get object…
8302 …add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): object …
8311 …add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get sample…
8324 sampledata->width = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleWidth, 0);
8325 sampledata->height = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleHeight, 0);
8326 sampledata->duration = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleDuration, 0);
8328 … get_u16_from_object(device, id, PTP_OPC_RepresentativeSampleFormat, LIBMTP_FILETYPE_UNKNOWN));
8347 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *device, argument
8350 return update_abstract_list(device,
8374 static void add_object_to_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id) argument
8376 PTPParams *params = (PTPParams *)device->params;
8381 add_ptp_error_to_errorstack(device, ret, "add_object_to_cache(): couldn't add object to cache");
8391 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id) argument
8393 PTPParams *params = (PTPParams *)device->params;
8396 add_object_to_cache(device, object_id);