OLD | NEW |
(Empty) | |
| 1 diff --git a/src/libmtp.c b/src/libmtp.c |
| 2 index bbe2642..b8f856b 100644 |
| 3 --- a/src/libmtp.c |
| 4 +++ b/src/libmtp.c |
| 5 @@ -8962,6 +8962,27 @@ int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *device, uint
32_t const id, |
| 6 } |
| 7 |
| 8 /** |
| 9 + * Get thumbnail format of a file. |
| 10 + * @param device a pointer to the device to get thumbnail format of. |
| 11 + * @param id the object ID of the file to get thumbnail format of. |
| 12 + * @return 0 on success, any other value means failure. |
| 13 + */ |
| 14 +int LIBMTP_Get_Thumbnail_Format(LIBMTP_mtpdevice_t *device, uint32_t const id, |
| 15 + uint16_t *format) |
| 16 +{ |
| 17 + PTPParams *params = (PTPParams *) device->params; |
| 18 + uint16_t ret; |
| 19 + |
| 20 + PTPObjectInfo object_info; |
| 21 + ret = ptp_getobjectinfo(params, id, &object_info); |
| 22 + if (ret != PTP_RC_OK) |
| 23 + return -1; |
| 24 + |
| 25 + *format = object_info.ThumbFormat; |
| 26 + return 0; |
| 27 +} |
| 28 + |
| 29 +/** |
| 30 * This routine updates an album based on the metadata |
| 31 * supplied. If the <code>tracks</code> field of the metadata |
| 32 * contains a track listing, these tracks will be added to the |
| 33 diff --git a/src/libmtp.h b/src/libmtp.h |
| 34 index f923cc1..07aa273 100644 |
| 35 --- a/src/libmtp.h |
| 36 +++ b/src/libmtp.h |
| 37 @@ -924,6 +924,8 @@ int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, u
int32_t const, |
| 38 LIBMTP_filesampledata_t *); |
| 39 int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, |
| 40 unsigned char **data, unsigned int *size); |
| 41 +int LIBMTP_Get_Thumbnail_Format(LIBMTP_mtpdevice_t *device, uint32_t const id, |
| 42 + uint16_t *format); |
| 43 |
| 44 /** |
| 45 * @} |
| 46 diff --git a/src/libmtp.h.in b/src/libmtp.h.in |
| 47 index 2b2f0bb..49edd3c 100644 |
| 48 --- a/src/libmtp.h.in |
| 49 +++ b/src/libmtp.h.in |
| 50 @@ -924,6 +924,8 @@ int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, u
int32_t const, |
| 51 LIBMTP_filesampledata_t *); |
| 52 int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, |
| 53 unsigned char **data, unsigned int *size); |
| 54 +int LIBMTP_Get_Thumbnail_Format(LIBMTP_mtpdevice_t *device, uint32_t const id, |
| 55 + uint16_t *format); |
| 56 |
| 57 /** |
| 58 * @} |
| 59 diff --git a/src/libmtp.sym b/src/libmtp.sym |
| 60 index 4130fe8..1148edd 100644 |
| 61 --- a/src/libmtp.sym |
| 62 +++ b/src/libmtp.sym |
| 63 @@ -103,4 +103,5 @@ LIBMTP_Set_Playlist_Name |
| 64 LIBMTP_Set_Album_Name |
| 65 LIBMTP_Set_Object_Filename |
| 66 LIBMTP_Get_Thumbnail |
| 67 +LIBMTP_Get_Thumbnail_Format |
| 68 LIBMTP_Read_Event |
OLD | NEW |