diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-01-30 22:30:40 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-01-30 22:30:40 +0000 |
| commit | 95298a955846d59a7758076a56df12f9996fc0bd (patch) | |
| tree | d9fba4fab3fa32bfefbeba6129b35959c5c6550b /apps/plugin.c | |
| parent | 41354a85d9e0240121ad709ccbf704cf50c8addc (diff) | |
| download | rockbox-95298a955846d59a7758076a56df12f9996fc0bd.zip rockbox-95298a955846d59a7758076a56df12f9996fc0bd.tar.gz rockbox-95298a955846d59a7758076a56df12f9996fc0bd.tar.bz2 rockbox-95298a955846d59a7758076a56df12f9996fc0bd.tar.xz | |
mp3 playback "engine" now in plugin API, rocks can make sound
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4285 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugin.c')
| -rw-r--r-- | apps/plugin.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index e91cba0..e010ebe 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -34,6 +34,9 @@ #include "lang.h" #include "keyboard.h" #include "mpeg.h" +#include "buffer.h" +#include "mp3_playback.h" +#include "backlight.h" #ifdef HAVE_LCD_BITMAP #include "widgets.h" @@ -58,6 +61,7 @@ static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; #else extern unsigned char pluginbuf[]; +extern void bitswap(unsigned char *data, int length); #endif static bool plugin_loaded = false; @@ -163,6 +167,19 @@ static struct plugin_api rockbox_api = { lcd_blit, #endif yield, + + plugin_get_mp3_buffer, + mpeg_sound_set, +#ifndef SIMULATOR + mp3_play_init, + mp3_play_data, + mp3_play_pause, + mp3_play_stop, + mp3_is_playing, + bitswap, +#endif + &global_settings, + backlight_set_timeout, }; int plugin_load(char* plugin, void* parameter) @@ -294,6 +311,21 @@ void* plugin_get_buffer(int* buffer_size) return &pluginbuf[buffer_pos]; } +/* Returns a pointer to the mp3 buffer. + Playback gets stopped, to avoid conflicts. */ +void* plugin_get_mp3_buffer(int* buffer_size) +{ +#ifdef SIMULATOR + static unsigned char buf[1700*1024]; + *buffer_size = sizeof(buf); + return buf; +#else + mpeg_stop(); + *buffer_size = mp3end - mp3buf; + return mp3buf; +#endif +} + static int plugin_test(int api_version, int model, int memsize) { if (api_version < PLUGIN_MIN_API_VERSION || |