Index: apps/recorder/radio.c =================================================================== --- apps/recorder/radio.c (revision 25992) +++ apps/recorder/radio.c (working copy) @@ -69,6 +69,7 @@ #include "viewport.h" #include "skin_engine/skin_engine.h" #include "statusbar-skinned.h" +#include "buffering.h" #if CONFIG_TUNER @@ -199,10 +200,18 @@ return ret; } +#ifdef HAVE_RECORDING +static void recording_started_handler(void *data); +static void recording_stopped_handler(void *data); +#endif void radio_init(void) { tuner_init(); radio_off(); +#ifdef HAVE_RECORDING + add_event(RECORDING_EVENT_START, false, recording_started_handler); + add_event(RECORDING_EVENT_STOP, false, recording_stopped_handler); +#endif } int get_radio_status(void) @@ -504,7 +513,121 @@ static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false }; +#ifdef HAVE_ALBUMART +#define MAX_RADIOART_IMAGES 10 +struct radioart { + int handle; + long last_tick; + struct dim dim; + char name[MAX_FMPRESET_LEN+1]; +}; +static struct radioart radioart[MAX_RADIOART_IMAGES]; +#ifdef HAVE_RECORDING +static bool allow_buffer_access = true; /* If we are recording dont touch the buffers! */ +#endif +static int find_oldest_image(void) +{ + int i; + long oldest_tick = radioart[0].last_tick; + int oldest_idx = 0; + for(i=1;iname, preset_name, MAX_FMPRESET_LEN+1); + ra->dim.height = dim->height; + ra->dim.width = dim->width; + ra->last_tick = current_tick; + ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); + if (ra->handle == ERR_BUFFER_FULL) + { + int i = find_oldest_image(); + bufclose(i); + ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); + } + return ra->handle; +} +int radio_get_art_hid(struct dim *requested_dim) +{ + int preset = radio_current_preset(); + int i, free_idx = -1; + if ((radio_mode != RADIO_PRESET_MODE) || preset < 0) + return -1; +#ifdef HAVE_RECORDING + if (!allow_buffer_access) + return -1; +#endif + for(i=0;iwidth && + radioart[i].dim.height == requested_dim->height) + { + radioart[i].last_tick = current_tick; + return radioart[i].handle; + } + } + if (free_idx >= 0) + { + return load_radioart_image(&radioart[free_idx], + presets[preset].name, requested_dim); + } + else + { + int i = find_oldest_image(); + bufclose(radioart[i].handle); + return load_radioart_image(&radioart[i], + presets[preset].name, requested_dim); + } + + return -1; +} +static void playback_restarting_handler(void *data) +{ + (void)data; + int i; + for(i=0;i= 0) + bufclose(radioart[i].handle); + radioart[i].handle = -1; + radioart[i].name[0] = '\0'; + } +} +#ifdef HAVE_RECORDING +static void recording_started_handler(void *data) +{ + (void)data; + allow_buffer_access = false; + playback_restarting_handler(NULL); +} +static void recording_stopped_handler(void *data) +{ + (void)data; + allow_buffer_access = true; +} +#endif +#endif + void fms_data_load(enum screen_type screen, const char *buf, bool isfile) { struct wps_data *data = fms_skin[screen].data; @@ -613,9 +736,17 @@ { radio_load_presets(global_settings.fmr_file); } + + for(i=0;ialbumart) { - if (playback_current_aa_hid(data->playback_aa_slot) >= 0) + if (data->albumart) + { + int handle = -1; + handle = playback_current_aa_hid(data->playback_aa_slot); +#if CONFIG_TUNER + if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF)) + { + struct dim dim = {data->albumart->width, data->albumart->height}; + handle = radio_get_art_hid(&dim); + } +#endif + if (handle >= 0) return "C"; } return NULL; Index: apps/gui/skin_engine/skin_display.c =================================================================== --- apps/gui/skin_engine/skin_display.c (revision 25992) +++ apps/gui/skin_engine/skin_display.c (working copy) @@ -443,8 +443,15 @@ if (data->albumart && data->albumart->vp == vp && data->albumart->draw) { - draw_album_art(gwps, playback_current_aa_hid(data->playback_aa_slot), - false); + int handle = playback_current_aa_hid(data->playback_aa_slot); +#if CONFIG_TUNER + if (in_radio_screen()) + { + struct dim dim = {data->albumart->width, data->albumart->height}; + handle = radio_get_art_hid(&dim); + } +#endif + draw_album_art(gwps, handle, false); data->albumart->draw = false; } #endif Index: apps/appevents.h =================================================================== --- apps/appevents.h (revision 25992) +++ apps/appevents.h (working copy) @@ -31,7 +31,8 @@ /** Playback events **/ enum { - PLAYBACK_EVENT_TRACK_BUFFER = (EVENT_CLASS_PLAYBACK|1), + PLAYBACK_EVENT_START_PLAYBACK = (EVENT_CLASS_PLAYBACK|1), + PLAYBACK_EVENT_TRACK_BUFFER, PLAYBACK_EVENT_TRACK_FINISH, PLAYBACK_EVENT_TRACK_CHANGE, PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, @@ -53,6 +54,11 @@ GUI_EVENT_THEME_CHANGED, }; +/** Recording events **/ +enum { + RECORDING_EVENT_START = (EVENT_CLASS_RECORDING|1), + RECORDING_EVENT_STOP, +}; #endif Index: apps/playback.c =================================================================== --- apps/playback.c (revision 25992) +++ apps/playback.c (working copy) @@ -1709,6 +1709,7 @@ { int i; + send_event(PLAYBACK_EVENT_START_PLAYBACK, NULL); #if INPUT_SRC_CAPS != 0 audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); audio_set_output_source(AUDIO_SRC_PLAYBACK); Index: apps/buffering.c =================================================================== --- apps/buffering.c (revision 25992) +++ apps/buffering.c (working copy) @@ -1007,7 +1007,6 @@ } /* Other cases: there is a little more work. */ - int fd = open(file, O_RDONLY); if (fd < 0) return ERR_FILE_ERROR; Index: firmware/export/events.h =================================================================== --- firmware/export/events.h (revision 25992) +++ firmware/export/events.h (working copy) @@ -37,6 +37,7 @@ #define EVENT_CLASS_PLAYBACK 0x0200 #define EVENT_CLASS_BUFFERING 0x0400 #define EVENT_CLASS_GUI 0x0800 +#define EVENT_CLASS_RECORDING 0x1000 #define EVENT_CLASS_LCD 0xf000 bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data));