mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
apps: cleanly disable codec buffering when not supported
Move HAVE_CODEC_BUFFERING to config.h, and disable all related code on targets that don't support the feature, ie. hosted targets that can't implement lc_open_from_mem(). Change-Id: I0d2a43900cd05b1a80c3cee519f8ad7b26e39fe7
This commit is contained in:
parent
3d0888875e
commit
3d281c2ea3
5 changed files with 13 additions and 14 deletions
|
|
@ -474,12 +474,14 @@ static void load_codec(const struct codec_load_info *ev_data)
|
|||
dsp_configure(ci.dsp, DSP_RESET, 0);
|
||||
}
|
||||
|
||||
#if defined(HAVE_CODEC_BUFFERING)
|
||||
if (data.hid >= 0)
|
||||
{
|
||||
/* First try buffer load */
|
||||
status = codec_load_buf(data.hid, &ci);
|
||||
bufclose(data.hid);
|
||||
}
|
||||
#endif /* HAVE_CODEC_BUFFERING */
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ static int codec_load_ram(struct codec_api *api)
|
|||
return c_hdr->entry_point(CODEC_LOAD);
|
||||
}
|
||||
|
||||
#if defined(HAVE_CODEC_BUFFERING)
|
||||
int codec_load_buf(int hid, struct codec_api *api)
|
||||
{
|
||||
int rc = bufread(hid, CODEC_SIZE, codecbuf);
|
||||
|
|
@ -243,6 +244,7 @@ int codec_load_buf(int hid, struct codec_api *api)
|
|||
|
||||
return codec_load_ram(api);
|
||||
}
|
||||
#endif /* HAVE_CODEC_BUFFERING */
|
||||
|
||||
int codec_load_file(const char *plugin, struct codec_api *api)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,11 +78,6 @@
|
|||
/* Internal support for voice playback */
|
||||
#define PLAYBACK_VOICE
|
||||
|
||||
#if CONFIG_PLATFORM & PLATFORM_NATIVE
|
||||
/* Application builds don't support direct code loading */
|
||||
#define HAVE_CODEC_BUFFERING
|
||||
#endif
|
||||
|
||||
/* Amount of guess-space to allow for codecs that must hunt and peck
|
||||
* for their correct seek target, 32k seems a good size */
|
||||
#define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
|
||||
|
|
@ -494,14 +489,6 @@ static void id3_write_locked(enum audio_id3_types id3_num,
|
|||
|
||||
/** --- Track info --- **/
|
||||
|
||||
#ifdef HAVE_CODEC_BUFFERING
|
||||
static void track_info_close_handle(int *hidp)
|
||||
{
|
||||
bufclose(*hidp);
|
||||
*hidp = ERR_HANDLE_NOT_FOUND;
|
||||
}
|
||||
#endif /* HAVE_CODEC_BUFFERING */
|
||||
|
||||
/* Invalidate all members to initial values - does not close handles or sync */
|
||||
static void track_info_wipe(struct track_info *infop)
|
||||
{
|
||||
|
|
@ -1669,7 +1656,8 @@ static bool audio_init_codec(struct track_info *track_infop,
|
|||
/* Close any buffered codec (we could have skipped directly to a
|
||||
format transistion that is the same format as the current track
|
||||
and the buffered one is no longer needed) */
|
||||
track_info_close_handle(&track_infop->codec_hid);
|
||||
bufclose(track_infop->codec_hid);
|
||||
track_infop->codec_hid = ERR_HANDLE_NOT_FOUND;
|
||||
track_info_sync(track_infop);
|
||||
#endif /* HAVE_CODEC_BUFFERING */
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -689,6 +689,11 @@ Lyre prototype 1 */
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Codec buffering requires the ability to load code from RAM */
|
||||
#if CONFIG_PLATFORM & PLATFORM_NATIVE
|
||||
# define HAVE_CODEC_BUFFERING
|
||||
#endif
|
||||
|
||||
/* setup basic macros from capability masks */
|
||||
#include "config_caps.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,9 @@ void codec_get_full_path(char *path, const char *codec_root_fn);
|
|||
void *codec_get_buffer_callback(size_t *size);
|
||||
|
||||
/* defined by the codec loader (codec.c) */
|
||||
#if defined(HAVE_CODEC_BUFFERING)
|
||||
int codec_load_buf(int hid, struct codec_api *api);
|
||||
#endif /* HAVE_CODEC_BUFFERING */
|
||||
int codec_load_file(const char* codec, struct codec_api *api);
|
||||
int codec_run_proc(void);
|
||||
int codec_close(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue