forked from len0rd/rockbox
voice: Correct all uses of spashf() with an ID2P() argument
...Instead voice the string and all of the arguments manually. Change-Id: Ic030b2f00c90cb372ff5b781a8de4bcb19375d5d
This commit is contained in:
parent
dfe409c993
commit
62da4ad84b
3 changed files with 40 additions and 23 deletions
|
@ -95,7 +95,12 @@ static int initialize_catalog_buf(char* dirbuf, size_t dirbuf_sz)
|
||||||
if (!dir_exists(dirbuf))
|
if (!dir_exists(dirbuf))
|
||||||
{
|
{
|
||||||
if (mkdir(dirbuf) < 0) {
|
if (mkdir(dirbuf) < 0) {
|
||||||
splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), dirbuf);
|
if (global_settings.talk_menu) {
|
||||||
|
talk_id(LANG_CATALOG_NO_DIRECTORY, true);
|
||||||
|
talk_dir_or_spell(dirbuf, NULL, true);
|
||||||
|
talk_force_enqueue_next();
|
||||||
|
}
|
||||||
|
splashf(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), dirbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -469,7 +474,7 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strmemccpy(playlist, m3u8name, sizeof(playlist));
|
strmemccpy(playlist, m3u8name, sizeof(playlist));
|
||||||
|
|
||||||
if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL))
|
if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
|
||||||
int readlen;
|
int readlen;
|
||||||
int rc;
|
int rc;
|
||||||
int orig_fd, fd;
|
int orig_fd, fd;
|
||||||
|
|
||||||
rb->snprintf(tmpname, MAX_PATH, "%s.tmp", fname);
|
rb->snprintf(tmpname, MAX_PATH, "%s.tmp", fname);
|
||||||
|
|
||||||
orig_fd = rb->open(fname, O_RDONLY);
|
orig_fd = rb->open(fname, O_RDONLY);
|
||||||
|
@ -70,7 +70,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
|
||||||
rb->close(orig_fd);
|
rb->close(orig_fd);
|
||||||
return 10*readlen - 3;
|
return 10*readlen - 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = rb->write(fd, audiobuf, readlen);
|
rc = rb->write(fd, audiobuf, readlen);
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
|
@ -78,7 +78,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
|
||||||
return 10*rc - 4;
|
return 10*rc - 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now insert the data into the file */
|
/* Now insert the data into the file */
|
||||||
rc = rb->write(fd, buf, num_bytes);
|
rc = rb->write(fd, buf, num_bytes);
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
|
@ -103,7 +103,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
|
||||||
return 10*rc - 8;
|
return 10*rc - 8;
|
||||||
}
|
}
|
||||||
} while(readlen > 0);
|
} while(readlen > 0);
|
||||||
|
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
rb->close(orig_fd);
|
rb->close(orig_fd);
|
||||||
|
|
||||||
|
@ -118,13 +118,19 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
return 10*rc - 9;
|
return 10*rc - 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fileerror(int rc)
|
static void fileerror(int rc)
|
||||||
{
|
{
|
||||||
rb->splashf(HZ*2, ID2P(LANG_FILE_ERROR), rc);
|
if (rb->global_settings->talk_menu) {
|
||||||
|
rb->talk_id(LANG_FILE_ERROR, true);
|
||||||
|
rb->talk_value_decimal(rc, UNIT_INT, 0, true);
|
||||||
|
rb->talk_force_enqueue_next();
|
||||||
|
}
|
||||||
|
|
||||||
|
rb->splashf(HZ*2, rb->str(LANG_FILE_ERROR), rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char empty_id3_header[] =
|
static const unsigned char empty_id3_header[] =
|
||||||
|
@ -154,7 +160,7 @@ static bool vbr_fix(const char *selected_file)
|
||||||
fileerror(rc);
|
fileerror(rc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = rb->open(selected_file, O_RDWR);
|
fd = rb->open(selected_file, O_RDWR);
|
||||||
if(fd < 0) {
|
if(fd < 0) {
|
||||||
fileerror(fd);
|
fileerror(fd);
|
||||||
|
@ -173,7 +179,7 @@ static bool vbr_fix(const char *selected_file)
|
||||||
entry.filesize, xingbuf, num_frames, 0,
|
entry.filesize, xingbuf, num_frames, 0,
|
||||||
0, xingupdate, true,
|
0, xingupdate, true,
|
||||||
audiobuf, audiobuflen);
|
audiobuf, audiobuflen);
|
||||||
|
|
||||||
/* Try to fit the Xing header first in the stream. Replace the existing
|
/* Try to fit the Xing header first in the stream. Replace the existing
|
||||||
VBR header if there is one, else see if there is room between the
|
VBR header if there is one, else see if there is room between the
|
||||||
ID3 tag and the first MP3 frame. */
|
ID3 tag and the first MP3 frame. */
|
||||||
|
@ -191,7 +197,7 @@ static bool vbr_fix(const char *selected_file)
|
||||||
|
|
||||||
unused_space =
|
unused_space =
|
||||||
entry.first_frame_offset - entry.id3v2len - framelen;
|
entry.first_frame_offset - entry.id3v2len - framelen;
|
||||||
|
|
||||||
/* Fill the unused space with 0's (using the MP3 buffer)
|
/* Fill the unused space with 0's (using the MP3 buffer)
|
||||||
and write it to the file */
|
and write it to the file */
|
||||||
if(unused_space)
|
if(unused_space)
|
||||||
|
@ -212,48 +218,48 @@ static bool vbr_fix(const char *selected_file)
|
||||||
fileerror(rc);
|
fileerror(rc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
} else {
|
} else {
|
||||||
/* If not, insert some space. If there is an ID3 tag in the
|
/* If not, insert some space. If there is an ID3 tag in the
|
||||||
file we only insert just enough to squeeze the Xing header
|
file we only insert just enough to squeeze the Xing header
|
||||||
in. If not, we insert an additional empty ID3 tag of 4K. */
|
in. If not, we insert an additional empty ID3 tag of 4K. */
|
||||||
|
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
|
|
||||||
/* Nasty trick alert! The insert_data_in_file() function
|
/* Nasty trick alert! The insert_data_in_file() function
|
||||||
uses the MP3 buffer when copying the data. We assume
|
uses the MP3 buffer when copying the data. We assume
|
||||||
that the ID3 tag isn't longer than 1MB so the xing
|
that the ID3 tag isn't longer than 1MB so the xing
|
||||||
buffer won't be overwritten. */
|
buffer won't be overwritten. */
|
||||||
|
|
||||||
if(entry.first_frame_offset) {
|
if(entry.first_frame_offset) {
|
||||||
DEBUGF("Inserting %d bytes\n", framelen);
|
DEBUGF("Inserting %d bytes\n", framelen);
|
||||||
numbytes = framelen;
|
numbytes = framelen;
|
||||||
} else {
|
} else {
|
||||||
DEBUGF("Inserting 4096+%d bytes\n", framelen);
|
DEBUGF("Inserting 4096+%d bytes\n", framelen);
|
||||||
numbytes = 4096 + framelen;
|
numbytes = 4096 + framelen;
|
||||||
|
|
||||||
rb->memset(audiobuf + 0x100000, 0, numbytes);
|
rb->memset(audiobuf + 0x100000, 0, numbytes);
|
||||||
|
|
||||||
/* Insert the ID3 header */
|
/* Insert the ID3 header */
|
||||||
rb->memcpy(audiobuf + 0x100000, empty_id3_header,
|
rb->memcpy(audiobuf + 0x100000, empty_id3_header,
|
||||||
sizeof(empty_id3_header));
|
sizeof(empty_id3_header));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the Xing header */
|
/* Copy the Xing header */
|
||||||
rb->memcpy(audiobuf + 0x100000 + numbytes - framelen,
|
rb->memcpy(audiobuf + 0x100000 + numbytes - framelen,
|
||||||
xingbuf, framelen);
|
xingbuf, framelen);
|
||||||
|
|
||||||
rc = insert_data_in_file(selected_file,
|
rc = insert_data_in_file(selected_file,
|
||||||
entry.first_frame_offset,
|
entry.first_frame_offset,
|
||||||
audiobuf + 0x100000, numbytes);
|
audiobuf + 0x100000, numbytes);
|
||||||
|
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
fileerror(rc);
|
fileerror(rc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xingupdate(100);
|
xingupdate(100);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -276,7 +282,7 @@ enum plugin_status plugin_start(const void *parameter)
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
|
|
||||||
audiobuf = rb->plugin_get_audio_buffer(&audiobuflen);
|
audiobuf = rb->plugin_get_audio_buffer(&audiobuflen);
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(true);
|
rb->cpu_boost(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "tagtree.h"
|
#include "tagtree.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
|
#include "talk.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "gui/list.h"
|
#include "gui/list.h"
|
||||||
|
@ -1744,7 +1745,12 @@ entry_skip_formatter:
|
||||||
|
|
||||||
if (!sort && (sort_inverse || sort_limit))
|
if (!sort && (sort_inverse || sort_limit))
|
||||||
{
|
{
|
||||||
splashf(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count);
|
if (global_settings.talk_menu) {
|
||||||
|
talk_id(LANG_SHOWDIR_BUFFER_FULL, true);
|
||||||
|
talk_value(total_count, UNIT_INT, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
splashf(HZ*4, str(LANG_SHOWDIR_BUFFER_FULL), total_count);
|
||||||
logf("Too small dir buffer");
|
logf("Too small dir buffer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue