summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-12 16:15:34 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-12 16:15:34 +0000
commit27cbf6bcea0d0280a2f5d46ccf460edb08187b17 (patch)
treee81ec5f1276174d394e1fd877272f428c1e9016d /apps
parentf9fb49284ef3c9ba03d33f3555f61ab5a1be9143 (diff)
downloadrockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.tar.gz
rockbox-27cbf6bcea0d0280a2f5d46ccf460edb08187b17.zip
* 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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c8
-rw-r--r--apps/gui/gwps.h1
-rw-r--r--apps/gui/wps_debug.c10
-rw-r--r--apps/gui/wps_parser.c74
4 files changed, 56 insertions, 37 deletions
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)
- {
- /* 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);
- }
+ if (!pos)
+ return 0;
- ptr = pos + 1;
+ /* get the image ID */
+ n = get_image_id(*ptr);
- /* get image name */
- bmp_names[n] = 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 0;
+ }
- pos = strchr(ptr, '|');
- ptr = pos + 1;
+ 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 image name */
+ bmp_names[n] = ptr;
- /* 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);
- }
+ 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;
+ }
- if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
- wps_data->img[n].always_display = true;
+ /* 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);
}