summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playlist_catalog.c9
-rw-r--r--apps/plugins/vbrfix.c46
-rw-r--r--apps/tagtree.c8
3 files changed, 40 insertions, 23 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index 69bcc54209..877f037387 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -95,7 +95,12 @@ static int initialize_catalog_buf(char* dirbuf, size_t dirbuf_sz)
95 if (!dir_exists(dirbuf)) 95 if (!dir_exists(dirbuf))
96 { 96 {
97 if (mkdir(dirbuf) < 0) { 97 if (mkdir(dirbuf) < 0) {
98 splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), dirbuf); 98 if (global_settings.talk_menu) {
99 talk_id(LANG_CATALOG_NO_DIRECTORY, true);
100 talk_dir_or_spell(dirbuf, NULL, true);
101 talk_force_enqueue_next();
102 }
103 splashf(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), dirbuf);
99 return -1; 104 return -1;
100 } 105 }
101 else { 106 else {
@@ -469,7 +474,7 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr,
469 } 474 }
470 else 475 else
471 strmemccpy(playlist, m3u8name, sizeof(playlist)); 476 strmemccpy(playlist, m3u8name, sizeof(playlist));
472 477
473 if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL)) 478 if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL))
474 return false; 479 return false;
475 } 480 }
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index 79fa134499..5aaf2ffada 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -48,7 +48,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
48 int readlen; 48 int readlen;
49 int rc; 49 int rc;
50 int orig_fd, fd; 50 int orig_fd, fd;
51 51
52 rb->snprintf(tmpname, MAX_PATH, "%s.tmp", fname); 52 rb->snprintf(tmpname, MAX_PATH, "%s.tmp", fname);
53 53
54 orig_fd = rb->open(fname, O_RDONLY); 54 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
70 rb->close(orig_fd); 70 rb->close(orig_fd);
71 return 10*readlen - 3; 71 return 10*readlen - 3;
72 } 72 }
73 73
74 rc = rb->write(fd, audiobuf, readlen); 74 rc = rb->write(fd, audiobuf, readlen);
75 if(rc < 0) { 75 if(rc < 0) {
76 rb->close(fd); 76 rb->close(fd);
@@ -78,7 +78,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
78 return 10*rc - 4; 78 return 10*rc - 4;
79 } 79 }
80 } 80 }
81 81
82 /* Now insert the data into the file */ 82 /* Now insert the data into the file */
83 rc = rb->write(fd, buf, num_bytes); 83 rc = rb->write(fd, buf, num_bytes);
84 if(rc < 0) { 84 if(rc < 0) {
@@ -103,7 +103,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
103 return 10*rc - 8; 103 return 10*rc - 8;
104 } 104 }
105 } while(readlen > 0); 105 } while(readlen > 0);
106 106
107 rb->close(fd); 107 rb->close(fd);
108 rb->close(orig_fd); 108 rb->close(orig_fd);
109 109
@@ -118,13 +118,19 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b
118 if(rc < 0) { 118 if(rc < 0) {
119 return 10*rc - 9; 119 return 10*rc - 9;
120 } 120 }
121 121
122 return 0; 122 return 0;
123} 123}
124 124
125static void fileerror(int rc) 125static void fileerror(int rc)
126{ 126{
127 rb->splashf(HZ*2, ID2P(LANG_FILE_ERROR), rc); 127 if (rb->global_settings->talk_menu) {
128 rb->talk_id(LANG_FILE_ERROR, true);
129 rb->talk_value_decimal(rc, UNIT_INT, 0, true);
130 rb->talk_force_enqueue_next();
131 }
132
133 rb->splashf(HZ*2, rb->str(LANG_FILE_ERROR), rc);
128} 134}
129 135
130static const unsigned char empty_id3_header[] = 136static const unsigned char empty_id3_header[] =
@@ -154,7 +160,7 @@ static bool vbr_fix(const char *selected_file)
154 fileerror(rc); 160 fileerror(rc);
155 return true; 161 return true;
156 } 162 }
157 163
158 fd = rb->open(selected_file, O_RDWR); 164 fd = rb->open(selected_file, O_RDWR);
159 if(fd < 0) { 165 if(fd < 0) {
160 fileerror(fd); 166 fileerror(fd);
@@ -173,7 +179,7 @@ static bool vbr_fix(const char *selected_file)
173 entry.filesize, xingbuf, num_frames, 0, 179 entry.filesize, xingbuf, num_frames, 0,
174 0, xingupdate, true, 180 0, xingupdate, true,
175 audiobuf, audiobuflen); 181 audiobuf, audiobuflen);
176 182
177 /* Try to fit the Xing header first in the stream. Replace the existing 183 /* Try to fit the Xing header first in the stream. Replace the existing
178 VBR header if there is one, else see if there is room between the 184 VBR header if there is one, else see if there is room between the
179 ID3 tag and the first MP3 frame. */ 185 ID3 tag and the first MP3 frame. */
@@ -191,7 +197,7 @@ static bool vbr_fix(const char *selected_file)
191 197
192 unused_space = 198 unused_space =
193 entry.first_frame_offset - entry.id3v2len - framelen; 199 entry.first_frame_offset - entry.id3v2len - framelen;
194 200
195 /* Fill the unused space with 0's (using the MP3 buffer) 201 /* Fill the unused space with 0's (using the MP3 buffer)
196 and write it to the file */ 202 and write it to the file */
197 if(unused_space) 203 if(unused_space)
@@ -212,48 +218,48 @@ static bool vbr_fix(const char *selected_file)
212 fileerror(rc); 218 fileerror(rc);
213 return true; 219 return true;
214 } 220 }
215 221
216 rb->close(fd); 222 rb->close(fd);
217 } else { 223 } else {
218 /* If not, insert some space. If there is an ID3 tag in the 224 /* If not, insert some space. If there is an ID3 tag in the
219 file we only insert just enough to squeeze the Xing header 225 file we only insert just enough to squeeze the Xing header
220 in. If not, we insert an additional empty ID3 tag of 4K. */ 226 in. If not, we insert an additional empty ID3 tag of 4K. */
221 227
222 rb->close(fd); 228 rb->close(fd);
223 229
224 /* Nasty trick alert! The insert_data_in_file() function 230 /* Nasty trick alert! The insert_data_in_file() function
225 uses the MP3 buffer when copying the data. We assume 231 uses the MP3 buffer when copying the data. We assume
226 that the ID3 tag isn't longer than 1MB so the xing 232 that the ID3 tag isn't longer than 1MB so the xing
227 buffer won't be overwritten. */ 233 buffer won't be overwritten. */
228 234
229 if(entry.first_frame_offset) { 235 if(entry.first_frame_offset) {
230 DEBUGF("Inserting %d bytes\n", framelen); 236 DEBUGF("Inserting %d bytes\n", framelen);
231 numbytes = framelen; 237 numbytes = framelen;
232 } else { 238 } else {
233 DEBUGF("Inserting 4096+%d bytes\n", framelen); 239 DEBUGF("Inserting 4096+%d bytes\n", framelen);
234 numbytes = 4096 + framelen; 240 numbytes = 4096 + framelen;
235 241
236 rb->memset(audiobuf + 0x100000, 0, numbytes); 242 rb->memset(audiobuf + 0x100000, 0, numbytes);
237 243
238 /* Insert the ID3 header */ 244 /* Insert the ID3 header */
239 rb->memcpy(audiobuf + 0x100000, empty_id3_header, 245 rb->memcpy(audiobuf + 0x100000, empty_id3_header,
240 sizeof(empty_id3_header)); 246 sizeof(empty_id3_header));
241 } 247 }
242 248
243 /* Copy the Xing header */ 249 /* Copy the Xing header */
244 rb->memcpy(audiobuf + 0x100000 + numbytes - framelen, 250 rb->memcpy(audiobuf + 0x100000 + numbytes - framelen,
245 xingbuf, framelen); 251 xingbuf, framelen);
246 252
247 rc = insert_data_in_file(selected_file, 253 rc = insert_data_in_file(selected_file,
248 entry.first_frame_offset, 254 entry.first_frame_offset,
249 audiobuf + 0x100000, numbytes); 255 audiobuf + 0x100000, numbytes);
250 256
251 if(rc < 0) { 257 if(rc < 0) {
252 fileerror(rc); 258 fileerror(rc);
253 return true; 259 return true;
254 } 260 }
255 } 261 }
256 262
257 xingupdate(100); 263 xingupdate(100);
258 } 264 }
259 else 265 else
@@ -276,7 +282,7 @@ enum plugin_status plugin_start(const void *parameter)
276 return PLUGIN_ERROR; 282 return PLUGIN_ERROR;
277 283
278 audiobuf = rb->plugin_get_audio_buffer(&audiobuflen); 284 audiobuf = rb->plugin_get_audio_buffer(&audiobuflen);
279 285
280#ifdef HAVE_ADJUSTABLE_CPU_FREQ 286#ifdef HAVE_ADJUSTABLE_CPU_FREQ
281 rb->cpu_boost(true); 287 rb->cpu_boost(true);
282#endif 288#endif
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 736493bfd9..3a875d6da6 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -41,6 +41,7 @@
41#include "tagtree.h" 41#include "tagtree.h"
42#include "lang.h" 42#include "lang.h"
43#include "logf.h" 43#include "logf.h"
44#include "talk.h"
44#include "playlist.h" 45#include "playlist.h"
45#include "keyboard.h" 46#include "keyboard.h"
46#include "gui/list.h" 47#include "gui/list.h"
@@ -1744,7 +1745,12 @@ entry_skip_formatter:
1744 1745
1745 if (!sort && (sort_inverse || sort_limit)) 1746 if (!sort && (sort_inverse || sort_limit))
1746 { 1747 {
1747 splashf(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count); 1748 if (global_settings.talk_menu) {
1749 talk_id(LANG_SHOWDIR_BUFFER_FULL, true);
1750 talk_value(total_count, UNIT_INT, true);
1751 }
1752
1753 splashf(HZ*4, str(LANG_SHOWDIR_BUFFER_FULL), total_count);
1748 logf("Too small dir buffer"); 1754 logf("Too small dir buffer");
1749 return 0; 1755 return 0;
1750 } 1756 }