diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-12 16:15:34 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-12 16:15:34 +0000 |
commit | 27cbf6bcea0d0280a2f5d46ccf460edb08187b17 (patch) | |
tree | e81ec5f1276174d394e1fd877272f428c1e9016d | |
parent | f9fb49284ef3c9ba03d33f3555f61ab5a1be9143 (diff) | |
download | rockbox-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
-rw-r--r-- | apps/gui/gwps-common.c | 8 | ||||
-rw-r--r-- | apps/gui/gwps.h | 1 | ||||
-rw-r--r-- | apps/gui/wps_debug.c | 10 | ||||
-rw-r--r-- | apps/gui/wps_parser.c | 74 |
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, | |||
1176 | return buf; | 1176 | return buf; |
1177 | 1177 | ||
1178 | #if (CONFIG_CODEC == SWCODEC) | 1178 | #if (CONFIG_CODEC == SWCODEC) |
1179 | case WPS_TOKEN_CROSSFADE: | ||
1180 | if (intval) | ||
1181 | *intval = global_settings.crossfade + 1; | ||
1182 | snprintf(buf, buf_size, "%d", global_settings.crossfade); | ||
1183 | return buf; | ||
1184 | |||
1179 | case WPS_TOKEN_REPLAYGAIN: | 1185 | case WPS_TOKEN_REPLAYGAIN: |
1180 | { | 1186 | { |
1181 | int val; | 1187 | int val; |
@@ -1216,7 +1222,7 @@ static char *get_token_value(struct gui_wps *gwps, | |||
1216 | } | 1222 | } |
1217 | return buf; | 1223 | return buf; |
1218 | } | 1224 | } |
1219 | #endif | 1225 | #endif /* (CONFIG_CODEC == SWCODEC) */ |
1220 | 1226 | ||
1221 | #if (CONFIG_CODEC != MAS3507D) | 1227 | #if (CONFIG_CODEC != MAS3507D) |
1222 | case WPS_TOKEN_SOUND_PITCH: | 1228 | 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 { | |||
125 | #endif | 125 | #endif |
126 | #if (CONFIG_CODEC == SWCODEC) | 126 | #if (CONFIG_CODEC == SWCODEC) |
127 | WPS_TOKEN_REPLAYGAIN, | 127 | WPS_TOKEN_REPLAYGAIN, |
128 | WPS_TOKEN_CROSSFADE, | ||
128 | #endif | 129 | #endif |
129 | 130 | ||
130 | #if CONFIG_RTC | 131 | #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) | |||
188 | break; | 188 | break; |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | #if (CONFIG_CODEC == SWCODEC) | ||
192 | case WPS_TOKEN_CROSSFADE: | ||
193 | snprintf(buf, sizeof(buf), "crossfade"); | ||
194 | break; | ||
195 | |||
196 | case WPS_TOKEN_REPLAYGAIN: | ||
197 | snprintf(buf, sizeof(buf), "replaygain"); | ||
198 | break; | ||
199 | #endif | ||
200 | |||
191 | #ifdef HAVE_LCD_BITMAP | 201 | #ifdef HAVE_LCD_BITMAP |
192 | case WPS_TOKEN_IMAGE_BACKDROP: | 202 | case WPS_TOKEN_IMAGE_BACKDROP: |
193 | snprintf(buf, sizeof(buf), "backdrop image"); | 203 | 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[] = { | |||
234 | { WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL }, | 234 | { WPS_TOKEN_DATABASE_RATING, "rr", WPS_REFRESH_DYNAMIC, NULL }, |
235 | #if CONFIG_CODEC == SWCODEC | 235 | #if CONFIG_CODEC == SWCODEC |
236 | { WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL }, | 236 | { WPS_TOKEN_REPLAYGAIN, "rg", WPS_REFRESH_STATIC, NULL }, |
237 | { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, | ||
237 | #endif | 238 | #endif |
238 | 239 | ||
239 | { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, | 240 | { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, |
@@ -378,51 +379,52 @@ static int parse_image_load(const char *wps_bufptr, | |||
378 | 379 | ||
379 | ptr = strchr(ptr, '|') + 1; | 380 | ptr = strchr(ptr, '|') + 1; |
380 | pos = strchr(ptr, '|'); | 381 | pos = strchr(ptr, '|'); |
381 | if (pos) | ||
382 | { | ||
383 | /* get the image ID */ | ||
384 | n = get_image_id(*ptr); | ||
385 | 382 | ||
386 | /* check the image number and load state */ | 383 | if (!pos) |
387 | if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded) | 384 | return 0; |
388 | { | ||
389 | /* Skip the rest of the line */ | ||
390 | return skip_end_of_line(wps_bufptr); | ||
391 | } | ||
392 | 385 | ||
393 | ptr = pos + 1; | 386 | /* get the image ID */ |
387 | n = get_image_id(*ptr); | ||
394 | 388 | ||
395 | /* get image name */ | 389 | /* check the image number and load state */ |
396 | bmp_names[n] = ptr; | 390 | if(n < 0 || n >= MAX_IMAGES || wps_data->img[n].loaded) |
391 | { | ||
392 | /* Skip the rest of the line */ | ||
393 | return 0; | ||
394 | } | ||
397 | 395 | ||
398 | pos = strchr(ptr, '|'); | 396 | ptr = pos + 1; |
399 | ptr = pos + 1; | ||
400 | 397 | ||
401 | /* get x-position */ | 398 | /* get image name */ |
402 | pos = strchr(ptr, '|'); | 399 | bmp_names[n] = ptr; |
403 | if (pos) | ||
404 | wps_data->img[n].x = atoi(ptr); | ||
405 | else | ||
406 | { | ||
407 | /* weird syntax, bail out */ | ||
408 | return skip_end_of_line(wps_bufptr); | ||
409 | } | ||
410 | 400 | ||
411 | /* get y-position */ | 401 | pos = strchr(ptr, '|'); |
412 | ptr = pos + 1; | 402 | ptr = pos + 1; |
413 | pos = strchr(ptr, '|'); | 403 | |
414 | if (pos) | 404 | /* get x-position */ |
415 | wps_data->img[n].y = atoi(ptr); | 405 | pos = strchr(ptr, '|'); |
416 | else | 406 | if (pos) |
417 | { | 407 | wps_data->img[n].x = atoi(ptr); |
418 | /* weird syntax, bail out */ | 408 | else |
419 | return skip_end_of_line(wps_bufptr); | 409 | { |
420 | } | 410 | /* weird syntax, bail out */ |
411 | return 0; | ||
412 | } | ||
421 | 413 | ||
422 | if (token->type == WPS_TOKEN_IMAGE_DISPLAY) | 414 | /* get y-position */ |
423 | wps_data->img[n].always_display = true; | 415 | ptr = pos + 1; |
416 | pos = strchr(ptr, '|'); | ||
417 | if (pos) | ||
418 | wps_data->img[n].y = atoi(ptr); | ||
419 | else | ||
420 | { | ||
421 | /* weird syntax, bail out */ | ||
422 | return 0; | ||
424 | } | 423 | } |
425 | 424 | ||
425 | if (token->type == WPS_TOKEN_IMAGE_DISPLAY) | ||
426 | wps_data->img[n].always_display = true; | ||
427 | |||
426 | /* Skip the rest of the line */ | 428 | /* Skip the rest of the line */ |
427 | return skip_end_of_line(wps_bufptr); | 429 | return skip_end_of_line(wps_bufptr); |
428 | } | 430 | } |