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:
parent
f9fb49284e
commit
27cbf6bcea
4 changed files with 62 additions and 43 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ enum wps_token_type {
|
|||
#endif
|
||||
#if (CONFIG_CODEC == SWCODEC)
|
||||
WPS_TOKEN_REPLAYGAIN,
|
||||
WPS_TOKEN_CROSSFADE,
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTC
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue