1
0
Fork 0
forked from len0rd/rockbox

* Add the crossfade (%xf) WPS tag

* Avoid eating the whole line when unsuccessfully parsing a %x or %xl tag. This will prevent unknown tags starting with %x from making the line disappear.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13127 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-04-12 16:15:34 +00:00
parent f9fb49284e
commit 27cbf6bcea
4 changed files with 62 additions and 43 deletions

View file

@ -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:

View file

@ -125,6 +125,7 @@ enum wps_token_type {
#endif
#if (CONFIG_CODEC == SWCODEC)
WPS_TOKEN_REPLAYGAIN,
WPS_TOKEN_CROSSFADE,
#endif
#if CONFIG_RTC

View file

@ -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");

View file

@ -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,8 +379,10 @@ 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);
@ -387,7 +390,7 @@ static int parse_image_load(const char *wps_bufptr,
if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded)
{
/* Skip the rest of the line */
return skip_end_of_line(wps_bufptr);
return 0;
}
ptr = pos + 1;
@ -405,7 +408,7 @@ static int parse_image_load(const char *wps_bufptr,
else
{
/* weird syntax, bail out */
return skip_end_of_line(wps_bufptr);
return 0;
}
/* get y-position */
@ -416,12 +419,11 @@ static int parse_image_load(const char *wps_bufptr,
else
{
/* weird syntax, bail out */
return skip_end_of_line(wps_bufptr);
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);