mp3buf renamed to audiobuf

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6252 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-04-05 11:33:58 +00:00
parent 6cf9d51b33
commit d34865a530
22 changed files with 239 additions and 238 deletions

View file

@ -48,7 +48,7 @@ int buffersize;
int init(void)
{
int f;
buffer = rb->plugin_get_mp3_buffer(&buffersize);
buffer = rb->plugin_get_audio_buffer(&buffersize);
#ifdef HAVE_MMC
/* present info what's going on. MMC is slow. */

View file

@ -1824,7 +1824,7 @@ int main(char* filename)
rb->memset(&disp, 0, sizeof(disp));
buf = rb->plugin_get_mp3_buffer(&buf_size); /* start munching memory */
buf = rb->plugin_get_audio_buffer(&buf_size); /* start munching memory */
/* initialize the grayscale buffer:

View file

@ -29,9 +29,9 @@ static struct plugin_api* local_rb;
int mem_ptr;
int bufsize;
unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
unsigned char* mallocbuf; // 512K from the start of MP3 buffer
unsigned char* filebuf; // The rest of the MP3 buffer
unsigned char* audiobuf; // The actual audio buffer from Rockbox
unsigned char* mallocbuf; // 512K from the start of audio buffer
unsigned char* filebuf; // The rest of the audio buffer
void* codec_malloc(size_t size) {
void* x;
@ -169,11 +169,11 @@ int local_init(char* infilename, char* outfilename, file_info_struct* file_info,
local_rb=rb;
mem_ptr=0;
mp3buf=local_rb->plugin_get_mp3_buffer(&bufsize);
mallocbuf=mp3buf;
filebuf=&mp3buf[MALLOC_BUFSIZE];
audiobuf=local_rb->plugin_get_audio_buffer(&bufsize);
mallocbuf=audiobuf;
filebuf=&audiobuf[MALLOC_BUFSIZE];
local_rb->snprintf(s,32,"mp3 bufsize: %d",bufsize);
local_rb->snprintf(s,32,"audio bufsize: %d",bufsize);
local_rb->lcd_putsxy(0,100,s);
local_rb->lcd_update();

View file

@ -26,8 +26,8 @@
#define OVL_DISPLAYNAME "RockBoy"
struct plugin_api* rb;
unsigned char *mp3buf;
int mp3buf_size;
unsigned char *audiobuf;
int audiobuf_size;
/* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
@ -60,8 +60,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return PLUGIN_ERROR;
}
mp3buf = rb->plugin_get_mp3_buffer(&mp3buf_size);
if (header.start_addr < mp3buf || header.end_addr > mp3buf + mp3buf_size)
audiobuf = rb->plugin_get_audio_buffer(&audiobuf_size);
if (header.start_addr < audiobuf ||
header.end_addr > audiobuf + audiobuf_size)
{
rb->close(fh);
rb->splash(2*HZ, true, OVL_DISPLAYNAME

View file

@ -59,37 +59,37 @@ void die(char *message, ...)
errormsg=message;
}
void *mp3_bufferbase;
void *mp3_bufferpointer;
unsigned int mp3_buffer_free;
void *audio_bufferbase;
void *audio_bufferpointer;
unsigned int audio_buffer_free;
void *my_malloc(size_t size)
{
void *alloc;
if (!mp3_bufferbase)
if (!audio_bufferbase)
{
mp3_bufferbase = mp3_bufferpointer
= rb->plugin_get_mp3_buffer(&mp3_buffer_free);
audio_bufferbase = audio_bufferpointer
= rb->plugin_get_audio_buffer(&audio_buffer_free);
#if MEM <= 8 && !defined(SIMULATOR)
/* loaded as an overlay, protect from overwriting ourselves */
if ((unsigned)(ovl_start_addr - (unsigned char *)mp3_bufferbase)
< mp3_buffer_free)
mp3_buffer_free = ovl_start_addr - (unsigned char *)mp3_bufferbase;
if ((unsigned)(ovl_start_addr - (unsigned char *)audio_bufferbase)
< audio_buffer_free)
audio_buffer_free = ovl_start_addr - (unsigned char *)audio_bufferbase;
#endif
}
if (size + 4 > mp3_buffer_free)
if (size + 4 > audio_buffer_free)
return 0;
alloc = mp3_bufferpointer;
mp3_bufferpointer += size + 4;
mp3_buffer_free -= size + 4;
alloc = audio_bufferpointer;
audio_bufferpointer += size + 4;
audio_buffer_free -= size + 4;
return alloc;
}
void setmallocpos(void *pointer)
{
mp3_bufferpointer = pointer;
mp3_buffer_free = mp3_bufferpointer - mp3_bufferbase;
audio_bufferpointer = pointer;
audio_buffer_free = audio_bufferpointer - audio_bufferbase;
}
/* this is the plugin entry point */
@ -113,8 +113,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif
shut=0;
cleanshut=0;
mp3_bufferbase=mp3_bufferpointer=0;
mp3_buffer_free=0;
audio_bufferbase=audio_bufferpointer=0;
audio_buffer_free=0;
/* now go ahead and have fun! */
/* rb->splash(HZ*2, true, "Rockboy v0.3"); */

View file

@ -184,7 +184,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api;
buf = rb->plugin_get_mp3_buffer(&buf_size); /* start munching memory */
buf = rb->plugin_get_audio_buffer(&buf_size); /* start munching memory */
stringbuffer = buf;
pointers = (char **)(buf + buf_size - sizeof(int));

View file

@ -20,8 +20,8 @@
static struct plugin_api* rb;
static char *mp3buf;
static int mp3buflen;
static char *audiobuf;
static int audiobuflen;
static void xingupdate(int percent)
{
@ -56,14 +56,14 @@ static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes)
/* First, copy the initial portion (the ID3 tag) */
if(fpos) {
readlen = rb->read(orig_fd, mp3buf, fpos);
readlen = rb->read(orig_fd, audiobuf, fpos);
if(readlen < 0) {
rb->close(fd);
rb->close(orig_fd);
return 10*readlen - 3;
}
rc = rb->write(fd, mp3buf, readlen);
rc = rb->write(fd, audiobuf, readlen);
if(rc < 0) {
rb->close(fd);
rb->close(orig_fd);
@ -81,14 +81,14 @@ static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes)
/* Copy the file */
do {
readlen = rb->read(orig_fd, mp3buf, mp3buflen);
readlen = rb->read(orig_fd, audiobuf, audiobuflen);
if(readlen < 0) {
rb->close(fd);
rb->close(orig_fd);
return 10*readlen - 7;
}
rc = rb->write(fd, mp3buf, readlen);
rc = rb->write(fd, audiobuf, readlen);
if(rc < 0) {
rb->close(fd);
rb->close(orig_fd);
@ -193,8 +193,8 @@ static bool vbr_fix(char *selected_file)
and write it to the file */
if(unused_space)
{
rb->memset(mp3buf, 0, unused_space);
rc = rb->write(fd, mp3buf, unused_space);
rb->memset(audiobuf, 0, unused_space);
rc = rb->write(fd, audiobuf, unused_space);
if(rc < 0) {
rb->close(fd);
fileerror(rc);
@ -230,20 +230,20 @@ static bool vbr_fix(char *selected_file)
DEBUGF("Inserting 4096+%d bytes\n", framelen);
numbytes = 4096 + framelen;
rb->memset(mp3buf + 0x100000, 0, numbytes);
rb->memset(audiobuf + 0x100000, 0, numbytes);
/* Insert the ID3 header */
rb->memcpy(mp3buf + 0x100000, empty_id3_header,
rb->memcpy(audiobuf + 0x100000, empty_id3_header,
sizeof(empty_id3_header));
}
/* Copy the Xing header */
rb->memcpy(mp3buf + 0x100000 + numbytes - framelen,
rb->memcpy(audiobuf + 0x100000 + numbytes - framelen,
xingbuf, framelen);
rc = insert_data_in_file(selected_file,
entry.first_frame_offset,
mp3buf + 0x100000, numbytes);
audiobuf + 0x100000, numbytes);
if(rc < 0) {
fileerror(rc);
@ -272,7 +272,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
if (!parameter)
return PLUGIN_ERROR;
mp3buf = rb->plugin_get_mp3_buffer(&mp3buflen);
audiobuf = rb->plugin_get_audio_buffer(&audiobuflen);
vbr_fix(parameter);

View file

@ -864,7 +864,7 @@ int main(char* filename)
// init buffer
rb->memset(&gBuf, 0, sizeof(gBuf));
gBuf.pOSD = rb->lcd_framebuffer + LCD_WIDTH*7; // last screen line
gBuf.pBufStart = rb->plugin_get_mp3_buffer(&gBuf.bufsize);
gBuf.pBufStart = rb->plugin_get_audio_buffer(&gBuf.bufsize);
//gBuf.bufsize = 1700*1024; // test, like 2MB version!!!!
gBuf.pBufFill = gBuf.pBufStart; // all empty