summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-08-08 16:49:16 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-08-13 17:07:07 +0200
commit22c63269749aa6471235f9547e53bc9d6f8ce41b (patch)
tree124f52e0a3341a88b44ac7bc6c4ca6731f49f1a7 /apps
parentc46147c6b2a70068e71f4baa34e4ca0892ca4f92 (diff)
downloadrockbox-22c63269749aa6471235f9547e53bc9d6f8ce41b.tar.gz
rockbox-22c63269749aa6471235f9547e53bc9d6f8ce41b.zip
Improvements for vbrfix plugin:
* Properly account for ID3v1 tags * Play time computation fixes * Add speech feedback Patch by Igor Poretsky Change-Id: Ia6df8fb171882a88527cfa9d3b76b705f09becdd
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang28
-rw-r--r--apps/plugins/vbrfix.c22
2 files changed, 43 insertions, 7 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 23b5fa62a1..5b04b13bfa 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -16390,3 +16390,31 @@ id: VOICE_BAT_BENCH_KEYS
lcd_bitmap: "Error writing config"
</voice>
</phrase>
+<phrase>
+ id: LANG_NOT_A_VBR_FILE
+ desc: in vbrfix plugin
+ user: core
+ <source>
+ *: "Not a VBR file"
+ </source>
+ <dest>
+ *: "Not a VBR file"
+ </dest>
+ <voice>
+ *: "Not a VBR file"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_FILE_ERROR
+ desc: in vbrfix plugin
+ user: core
+ <source>
+ *: "File error: %d"
+ </source>
+ <dest>
+ *: "File error: %d"
+ </dest>
+ <voice>
+ *: "File error"
+ </voice>
+</phrase>
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index af7b817002..768ec9d99f 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -26,11 +26,21 @@ static char *audiobuf;
static size_t audiobuflen;
unsigned char xingbuf[1500];
char tmpname[MAX_PATH];
+static long last_talk = 0;
static void xingupdate(int percent)
{
rb->lcd_putsf(0, 1, "%d%%", percent);
rb->lcd_update();
+ if (rb->global_settings->talk_menu)
+ {
+ long now = *(rb->current_tick) / HZ;
+ if (now - last_talk >= 5)
+ {
+ rb->talk_value(percent, UNIT_PERCENT, false);
+ last_talk = now;
+ }
+ }
}
static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_bytes)
@@ -114,7 +124,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
static void fileerror(int rc)
{
- rb->splashf(HZ*2, "File error: %d", rc);
+ rb->splashf(HZ*2, ID2P(LANG_FILE_ERROR), rc);
}
static const unsigned char empty_id3_header[] =
@@ -128,7 +138,6 @@ static bool vbr_fix(const char *selected_file)
struct mp3entry entry;
int fd;
int rc;
- int flen;
int num_frames;
int numbytes;
int framelen;
@@ -152,18 +161,16 @@ static bool vbr_fix(const char *selected_file)
return true;
}
- flen = rb->lseek(fd, 0, SEEK_END);
-
xingupdate(0);
num_frames = rb->count_mp3_frames(fd, entry.first_frame_offset,
- flen, xingupdate, audiobuf, audiobuflen);
+ entry.filesize, xingupdate, audiobuf, audiobuflen);
if(num_frames) {
/* Note: We don't need to pass a template header because it will be
taken from the mpeg stream */
framelen = rb->create_xing_header(fd, entry.first_frame_offset,
- flen, xingbuf, num_frames, 0,
+ entry.filesize, xingbuf, num_frames, 0,
0, xingupdate, true,
audiobuf, audiobuflen);
@@ -253,7 +260,7 @@ static bool vbr_fix(const char *selected_file)
{
/* Not a VBR file */
DEBUGF("Not a VBR file\n");
- rb->splash(HZ*2, "Not a VBR file");
+ rb->splash(HZ*2, ID2P(LANG_NOT_A_VBR_FILE));
}
return false;
@@ -261,6 +268,7 @@ static bool vbr_fix(const char *selected_file)
enum plugin_status plugin_start(const void *parameter)
{
+ last_talk = *(rb->current_tick) / HZ;
if (!parameter)
return PLUGIN_ERROR;