diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-16 19:14:41 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-16 19:14:41 +0000 |
commit | e9c10189e93fe53cff74ae8fa15d19b1c522d5e4 (patch) | |
tree | e3c39a41ff160194dfd9ce617893e0367a6fdcc8 /apps/recorder | |
parent | a72ffe7bb533302dbf4e6c7c4f1e4bd4078d3ed6 (diff) | |
download | rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.tar.gz rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.zip |
Rework albumart buffering internally to allow for mutliple albumart sizes.
Playback now has a few albumart slots. Anything (most importantly: skins) can obtain such a slot.
The slot has fields for the size which is passed to bufopen then to image_load to buffer the albumart with the proper size.
Currently there's 1 slot. We can increase it for remotes if we want. Custom statusbar will increase it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23209 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/albumart.c | 23 | ||||
-rw-r--r-- | apps/recorder/albumart.h | 4 |
2 files changed, 6 insertions, 21 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index bb2fae4af7..b668bf4eba 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c | |||
@@ -274,22 +274,18 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
274 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. | 274 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. |
275 | * Stores the found filename in the buf parameter. | 275 | * Stores the found filename in the buf parameter. |
276 | * Returns true if a bitmap was found, false otherwise */ | 276 | * Returns true if a bitmap was found, false otherwise */ |
277 | bool find_albumart(const struct mp3entry *id3, char *buf, int buflen) | 277 | bool find_albumart(const struct mp3entry *id3, char *buf, int buflen, |
278 | struct dim *dim) | ||
278 | { | 279 | { |
279 | if (!id3 || !buf) | 280 | if (!id3 || !buf) |
280 | return false; | 281 | return false; |
281 | 282 | ||
282 | char size_string[9]; | 283 | char size_string[9]; |
283 | int width = 0, height = 0; | ||
284 | |||
285 | if (!wps_uses_albumart(&width, &height)) | ||
286 | return false; | ||
287 | |||
288 | logf("Looking for album art for %s", id3->path); | 284 | logf("Looking for album art for %s", id3->path); |
289 | 285 | ||
290 | /* Write the size string, e.g. ".100x100". */ | 286 | /* Write the size string, e.g. ".100x100". */ |
291 | snprintf(size_string, sizeof(size_string), ".%dx%d", | 287 | snprintf(size_string, sizeof(size_string), ".%dx%d", |
292 | width, height); | 288 | dim->width, dim->height); |
293 | 289 | ||
294 | /* First we look for a bitmap of the right size */ | 290 | /* First we look for a bitmap of the right size */ |
295 | if (search_albumart_files(id3, size_string, buf, buflen)) | 291 | if (search_albumart_files(id3, size_string, buf, buflen)) |
@@ -376,17 +372,4 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear) | |||
376 | } | 372 | } |
377 | } | 373 | } |
378 | 374 | ||
379 | void get_albumart_size(struct bitmap *bmp) | ||
380 | { | ||
381 | /* FIXME: What should we do with albumart on remote? */ | ||
382 | int width, height; | ||
383 | |||
384 | if (!wps_uses_albumart(&width, &height)) | ||
385 | { | ||
386 | width = 0; height = 0; | ||
387 | } | ||
388 | |||
389 | bmp->width = width; | ||
390 | bmp->height = height; | ||
391 | } | ||
392 | #endif /* PLUGIN */ | 375 | #endif /* PLUGIN */ |
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h index d1c2dfa7bd..51f456d175 100644 --- a/apps/recorder/albumart.h +++ b/apps/recorder/albumart.h | |||
@@ -29,9 +29,11 @@ | |||
29 | #include "skin_engine/skin_engine.h" | 29 | #include "skin_engine/skin_engine.h" |
30 | 30 | ||
31 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. | 31 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. |
32 | * Calls size_func to get the dimensions to look for | ||
32 | * Stores the found filename in the buf parameter. | 33 | * Stores the found filename in the buf parameter. |
33 | * Returns true if a bitmap was found, false otherwise */ | 34 | * Returns true if a bitmap was found, false otherwise */ |
34 | bool find_albumart(const struct mp3entry *id3, char *buf, int buflen); | 35 | bool find_albumart(const struct mp3entry *id3, char *buf, int buflen, |
36 | struct dim *dim); | ||
35 | 37 | ||
36 | /* Draw the album art bitmap from the given handle ID onto the given WPS. | 38 | /* Draw the album art bitmap from the given handle ID onto the given WPS. |
37 | Call with clear = true to clear the bitmap instead of drawing it. */ | 39 | Call with clear = true to clear the bitmap instead of drawing it. */ |