summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-05-21 13:41:43 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-05-21 13:41:43 +0000
commit5cc98efddcef4cb9c4a2a9c0a3ad72bd86bebd61 (patch)
treef802e543b4ff09c1161ff82f57f74cf5b83d29c3 /apps/gui
parent9d5e376fc37caae42816f5603fc480380574bce5 (diff)
Add %fk and %Fk WPS tags : (next) file audio frequency in KHz (rewrite of FS#6393 to adapt it to the tokenizer).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13455 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/gwps-common.c10
-rw-r--r--apps/gui/gwps.h1
-rw-r--r--apps/gui/wps_debug.c7
-rw-r--r--apps/gui/wps_parser.c2
4 files changed, 19 insertions, 1 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 2429d74b86..5524c1490e 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -943,6 +943,16 @@ static char *get_token_value(struct gui_wps *gwps,
snprintf(buf, buf_size, "%ld", id3->frequency);
return buf;
+ case WPS_TOKEN_FILE_FREQUENCY_KHZ:
+ /* ignore remainders < 100, so 22050 Hz becomes just 22k */
+ if ((id3->frequency % 1000) < 100)
+ snprintf(buf, buf_size, "%ld", id3->frequency / 1000);
+ else
+ snprintf(buf, buf_size, "%ld.%d",
+ id3->frequency / 1000,
+ (id3->frequency % 1000) / 100);
+ return buf;
+
case WPS_TOKEN_FILE_NAME:
if (get_dir(buf, buf_size, id3->path, 0)) {
/* Remove extension */
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 5fa2acfea9..26a800cbbd 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -172,6 +172,7 @@ enum wps_token_type {
WPS_TOKEN_FILE_BITRATE,
WPS_TOKEN_FILE_CODEC,
WPS_TOKEN_FILE_FREQUENCY,
+ WPS_TOKEN_FILE_FREQUENCY_KHZ,
WPS_TOKEN_FILE_NAME,
WPS_TOKEN_FILE_NAME_WITH_EXTENSION,
WPS_TOKEN_FILE_PATH,
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 767f296cdd..8ba4b6f000 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -340,7 +340,12 @@ static void dump_wps_tokens(struct wps_data *data)
break;
case WPS_TOKEN_FILE_FREQUENCY:
- snprintf(buf, sizeof(buf), "%sfile audio frequency",
+ snprintf(buf, sizeof(buf), "%sfile audio frequency in Hz",
+ next_str(next));
+ break;
+
+ case WPS_TOKEN_FILE_FREQUENCY_KHZ:
+ snprintf(buf, sizeof(buf), "%sfile audio frequency in KHz",
next_str(next));
break;
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index b053cee109..5c72f7c90a 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -159,6 +159,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_FILE_BITRATE, "fb", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_CODEC, "fc", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_FREQUENCY, "ff", WPS_REFRESH_STATIC, NULL },
+ { WPS_TOKEN_FILE_FREQUENCY_KHZ, "fk", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_NAME_WITH_EXTENSION, "fm", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_NAME, "fn", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_PATH, "fp", WPS_REFRESH_STATIC, NULL },
@@ -171,6 +172,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_FILE_BITRATE, "Fb", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_FILE_CODEC, "Fc", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_FILE_FREQUENCY, "Ff", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_FILE_FREQUENCY_KHZ, "Fk", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_FILE_NAME_WITH_EXTENSION, "Fm", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_FILE_NAME, "Fn", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_FILE_PATH, "Fp", WPS_REFRESH_DYNAMIC, NULL },