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/gui | |
| parent | a72ffe7bb533302dbf4e6c7c4f1e4bd4078d3ed6 (diff) | |
| download | rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.zip rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.tar.gz rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.tar.bz2 rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.tar.xz | |
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/gui')
| -rw-r--r-- | apps/gui/skin_engine/skin_display.c | 6 | ||||
| -rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 21 | ||||
| -rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 5 | ||||
| -rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 1 | ||||
| -rw-r--r-- | apps/gui/wps.c | 22 | ||||
| -rw-r--r-- | apps/gui/wps.h | 10 |
6 files changed, 31 insertions, 34 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 67984cd..a5ea286 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -259,7 +259,8 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp) if (data->albumart && data->albumart->vp == vp && data->albumart->draw) { - draw_album_art(gwps, audio_current_aa_hid(), false); + draw_album_art(gwps, playback_current_aa_hid(data->playback_aa_slot), + false); data->albumart->draw = false; } #endif @@ -486,7 +487,8 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) #ifdef HAVE_ALBUMART if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) { - draw_album_art(gwps, audio_current_aa_hid(), true); + draw_album_art(gwps, + playback_current_aa_hid(data->playback_aa_slot), true); data->albumart->draw = false; } #endif diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 016126b..fa35ed9 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -56,6 +56,10 @@ #include "bmp.h" #endif +#ifdef HAVE_ALBUMART +#include "playback.h" +#endif + #include "backdrop.h" #define WPS_ERROR_INVALID_PARAM -1 @@ -985,6 +989,8 @@ static int parse_albumart_load(const char *wps_bufptr, { const char *_pos, *newline; bool parsing; + struct dim dimensions; + int albumart_slot; struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart)); (void)token; /* silence warning */ if (!aa) @@ -1125,6 +1131,16 @@ static int parse_albumart_load(const char *wps_bufptr, aa->draw = false; wps_data->albumart = aa; + dimensions.width = aa->width; + dimensions.height = aa->height; + + albumart_slot = playback_claim_aa_slot(&dimensions); + + if (albumart_slot < 0) /* didn't get a slot ? */ + return skip_end_of_line(wps_bufptr); + else + wps_data->playback_aa_slot = albumart_slot; + /* Skip the rest of the line */ return skip_end_of_line(wps_bufptr); } @@ -1601,6 +1617,11 @@ void skin_data_reset(struct wps_data *wps_data) wps_data->strings = NULL; #ifdef HAVE_ALBUMART wps_data->albumart = NULL; + if (wps_data->playback_aa_slot >= 0) + { + playback_release_aa_slot(wps_data->playback_aa_slot); + wps_data->playback_aa_slot = -1; + } #endif wps_data->tokens = NULL; wps_data->num_tokens = 0; diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index d607538..6b29091 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -368,8 +368,9 @@ const char *get_token_value(struct gui_wps *gwps, #ifdef HAVE_ALBUMART case WPS_TOKEN_ALBUMART_FOUND: - if (data->albumart && audio_current_aa_hid() >= 0) { - return "C"; + if (data->albumart) { + if (playback_current_aa_hid(data->playback_aa_slot) >= 0) + return "C"; } return NULL; diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 7a4fddd..638fb0a 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -255,6 +255,7 @@ struct wps_data struct skin_token_list *strings; #ifdef HAVE_ALBUMART struct skin_albumart *albumart; + int playback_aa_slot; #endif struct wps_token *tokens; /* Total number of tokens in the WPS. During WPS parsing, this is diff --git a/apps/gui/wps.c b/apps/gui/wps.c index d4a2893..342ebde 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -1278,6 +1278,7 @@ static void statusbar_toggle_handler(void *data) } #endif + void gui_sync_wps_init(void) { int i; @@ -1285,6 +1286,7 @@ void gui_sync_wps_init(void) { #ifdef HAVE_ALBUMART wps_datas[i].albumart = NULL; + wps_datas[i].playback_aa_slot = -1; #endif #ifdef HAVE_REMOTE_LCD wps_datas[i].remote_wps = (i == SCREEN_REMOTE); @@ -1304,26 +1306,6 @@ void gui_sync_wps_init(void) #endif } -#ifdef HAVE_ALBUMART -bool wps_uses_albumart(int *width, int *height) -{ - int i; - FOR_NB_SCREENS(i) { - struct gui_wps *gwps = &gui_wps[i]; - struct skin_albumart *aa = gwps->data->albumart; - if (aa && (aa->state != WPS_ALBUMART_NONE)) - { - if (width) - *width = aa->width; - if (height) - *height = aa->height; - return true; - } - } - return false; -} -#endif - #ifdef IPOD_ACCESSORY_PROTOCOL int wps_get_ff_rewind_count(void) diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 6affcee..8c6de9e 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h @@ -38,16 +38,6 @@ void display_keylock_text(bool locked); bool is_wps_fading(void); - -#ifdef HAVE_ALBUMART -/* - * Returns true if at least one of the gui_wps screens has an album art - * tag in its wps structure and writes the width and height into the passed - * pointers - */ -bool wps_uses_albumart(int*, int*); -#endif - #ifdef IPOD_ACCESSORY_PROTOCOL /* return length of the current ff or rewin action, IAP needs this */ int wps_get_ff_rewind_count(void); |