OLD | NEW |
1 /** | 1 /** |
2 * \file libmtp.c | 2 * \file libmtp.c |
3 * | 3 * |
4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> | 4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> |
5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> | 5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> |
6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> | 6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> |
7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com> | 7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com> |
8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> | 8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 8944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8955 PTPParams *params = (PTPParams *) device->params; | 8955 PTPParams *params = (PTPParams *) device->params; |
8956 uint16_t ret; | 8956 uint16_t ret; |
8957 | 8957 |
8958 ret = ptp_getthumb(params, id, data, size); | 8958 ret = ptp_getthumb(params, id, data, size); |
8959 if (ret == PTP_RC_OK) | 8959 if (ret == PTP_RC_OK) |
8960 return 0; | 8960 return 0; |
8961 return -1; | 8961 return -1; |
8962 } | 8962 } |
8963 | 8963 |
8964 /** | 8964 /** |
| 8965 * Get thumbnail format of a file. |
| 8966 * @param device a pointer to the device to get thumbnail format of. |
| 8967 * @param id the object ID of the file to get thumbnail format of. |
| 8968 * @return 0 on success, any other value means failure. |
| 8969 */ |
| 8970 int LIBMTP_Get_Thumbnail_Format(LIBMTP_mtpdevice_t *device, uint32_t const id, |
| 8971 uint16_t *format) |
| 8972 { |
| 8973 PTPParams *params = (PTPParams *) device->params; |
| 8974 uint16_t ret; |
| 8975 |
| 8976 PTPObjectInfo object_info; |
| 8977 ret = ptp_getobjectinfo(params, id, &object_info); |
| 8978 if (ret != PTP_RC_OK) |
| 8979 return -1; |
| 8980 |
| 8981 *format = object_info.ThumbFormat; |
| 8982 return 0; |
| 8983 } |
| 8984 |
| 8985 /** |
8965 * This routine updates an album based on the metadata | 8986 * This routine updates an album based on the metadata |
8966 * supplied. If the <code>tracks</code> field of the metadata | 8987 * supplied. If the <code>tracks</code> field of the metadata |
8967 * contains a track listing, these tracks will be added to the | 8988 * contains a track listing, these tracks will be added to the |
8968 * album in place of those already present, i.e. the | 8989 * album in place of those already present, i.e. the |
8969 * previous track listing will be deleted. | 8990 * previous track listing will be deleted. |
8970 * @param device a pointer to the device to create the new album on. | 8991 * @param device a pointer to the device to create the new album on. |
8971 * @param metadata the metadata for the album to be updated. | 8992 * @param metadata the metadata for the album to be updated. |
8972 * notice that the field <code>album_id</code> | 8993 * notice that the field <code>album_id</code> |
8973 * must contain the apropriate album ID. | 8994 * must contain the apropriate album ID. |
8974 * @return 0 on success, any other value means failure. | 8995 * @return 0 on success, any other value means failure. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9019 * @param device the device which may have a cache to which the object should be
updated. | 9040 * @param device the device which may have a cache to which the object should be
updated. |
9020 * @param object_id the object to update. | 9041 * @param object_id the object to update. |
9021 */ | 9042 */ |
9022 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id
) | 9043 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id
) |
9023 { | 9044 { |
9024 PTPParams *params = (PTPParams *)device->params; | 9045 PTPParams *params = (PTPParams *)device->params; |
9025 | 9046 |
9026 ptp_remove_object_from_cache(params, object_id); | 9047 ptp_remove_object_from_cache(params, object_id); |
9027 add_object_to_cache(device, object_id); | 9048 add_object_to_cache(device, object_id); |
9028 } | 9049 } |
OLD | NEW |