diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index cdfea80fd4..d0d46da837 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1176,6 +1176,12 @@ static char *get_token_value(struct gui_wps *gwps, return buf; #if (CONFIG_CODEC == SWCODEC) + case WPS_TOKEN_CROSSFADE: + if (intval) + *intval = global_settings.crossfade + 1; + snprintf(buf, buf_size, "%d", global_settings.crossfade); + return buf; + case WPS_TOKEN_REPLAYGAIN: { int val; @@ -1216,7 +1222,7 @@ static char *get_token_value(struct gui_wps *gwps, } return buf; } -#endif +#endif /* (CONFIG_CODEC == SWCODEC) */ #if (CONFIG_CODEC != MAS3507D) case WPS_TOKEN_SOUND_PITCH: diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 1d58f64768..7d20bc94cf 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -125,6 +125,7 @@ enum wps_token_type { #endif #if (CONFIG_CODEC == SWCODEC) WPS_TOKEN_REPLAYGAIN, + WPS_TOKEN_CROSSFADE, #endif #if CONFIG_RTC diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c index 4a8153d591..96f3e57038 100644 --- a/apps/gui/wps_debug.c +++ b/apps/gui/wps_debug.c @@ -188,6 +188,16 @@ void dump_wps_tokens(struct wps_data *data) break; #endif +#if (CONFIG_CODEC == SWCODEC) + case WPS_TOKEN_CROSSFADE: + snprintf(buf, sizeof(buf), "crossfade"); + break; + + case WPS_TOKEN_REPLAYGAIN: + snprintf(buf, sizeof(buf), "replaygain"); + break; +#endif + #ifdef HAVE_LCD_BITMAP case WPS_TOKEN_IMAGE_BACKDROP: snprintf(buf, sizeof(buf), "backdrop image"); diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index b25fe24ba2..8e726f1b9d 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -234,6 +234,7 @@ static const struct wps_tag all_tags[] = { { WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL }, #if CONFIG_CODEC == SWCODEC { WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL }, + { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, #endif { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, @@ -378,51 +379,52 @@ static int parse_image_load(const char *wps_bufptr, ptr = strchr(ptr, '|') + 1; pos = strchr(ptr, '|'); - if (pos) + + if (!pos) + return 0; + + /* get the image ID */ + n = get_image_id(*ptr); + + /* check the image number and load state */ + if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded) { - /* get the image ID */ - n = get_image_id(*ptr); - - /* check the image number and load state */ - if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded) - { - /* Skip the rest of the line */ - return skip_end_of_line(wps_bufptr); - } - - ptr = pos + 1; - - /* get image name */ - bmp_names[n] = ptr; - - pos = strchr(ptr, '|'); - ptr = pos + 1; - - /* get x-position */ - pos = strchr(ptr, '|'); - if (pos) - wps_data->img[n].x = atoi(ptr); - else - { - /* weird syntax, bail out */ - return skip_end_of_line(wps_bufptr); - } - - /* get y-position */ - ptr = pos + 1; - pos = strchr(ptr, '|'); - if (pos) - wps_data->img[n].y = atoi(ptr); - else - { - /* weird syntax, bail out */ - return skip_end_of_line(wps_bufptr); - } - - if (token->type == WPS_TOKEN_IMAGE_DISPLAY) - wps_data->img[n].always_display = true; + /* Skip the rest of the line */ + return 0; } + ptr = pos + 1; + + /* get image name */ + bmp_names[n] = ptr; + + pos = strchr(ptr, '|'); + ptr = pos + 1; + + /* get x-position */ + pos = strchr(ptr, '|'); + if (pos) + wps_data->img[n].x = atoi(ptr); + else + { + /* weird syntax, bail out */ + return 0; + } + + /* get y-position */ + ptr = pos + 1; + pos = strchr(ptr, '|'); + if (pos) + wps_data->img[n].y = atoi(ptr); + else + { + /* weird syntax, bail out */ + return 0; + } + + if (token->type == WPS_TOKEN_IMAGE_DISPLAY) + wps_data->img[n].always_display = true; + /* Skip the rest of the line */ return skip_end_of_line(wps_bufptr); }