mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
warble: fix build on targets with HAVE_RECORDING
Change-Id: Ic04392da41177f51dd5f392b288e078a76298839
This commit is contained in:
parent
c04c2c3e0b
commit
7fef95dc08
2 changed files with 77 additions and 16 deletions
|
|
@ -47,7 +47,8 @@ kss.c
|
|||
#endif
|
||||
aac_bsf.c
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
/* warble is decoder-only */
|
||||
#if defined(HAVE_RECORDING) && !defined(WARBLE)
|
||||
|
||||
/* encoders */
|
||||
|
||||
|
|
@ -56,4 +57,4 @@ mp3_enc.c
|
|||
wav_enc.c
|
||||
wavpack_enc.c
|
||||
|
||||
#endif /* HAVE_RECORDING */
|
||||
#endif /* HAVE_RECORDING && !WARBLE */
|
||||
|
|
|
|||
|
|
@ -647,6 +647,73 @@ static void ci_logf(const char *fmt, ...)
|
|||
|
||||
static void stub_void_void(void) { }
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
/* warble only ever loads decoders, so the encoder half of the codec API is
|
||||
never entered. Fail loudly instead of leaving these NULL, which would turn
|
||||
a mistake into a segfault. */
|
||||
static void stub_enc_unsupported(const char *func)
|
||||
{
|
||||
fprintf(stderr, "error: warble does not support encoding (%s)\n", func);
|
||||
abort();
|
||||
}
|
||||
|
||||
static int ci_enc_pcmbuf_read(void *buf, int count)
|
||||
{
|
||||
(void)buf; (void)count;
|
||||
stub_enc_unsupported(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ci_enc_pcmbuf_advance(int count)
|
||||
{
|
||||
(void)count;
|
||||
stub_enc_unsupported(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct enc_chunk_data *ci_enc_encbuf_get_buffer(size_t need)
|
||||
{
|
||||
(void)need;
|
||||
stub_enc_unsupported(__func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ci_enc_encbuf_finish_buffer(void)
|
||||
{
|
||||
stub_enc_unsupported(__func__);
|
||||
}
|
||||
|
||||
static ssize_t ci_enc_stream_read(void *buf, size_t count)
|
||||
{
|
||||
(void)buf; (void)count;
|
||||
stub_enc_unsupported(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static off_t ci_enc_stream_lseek(off_t offset, int whence)
|
||||
{
|
||||
(void)offset; (void)whence;
|
||||
stub_enc_unsupported(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t ci_enc_stream_write(const void *buf, size_t count)
|
||||
{
|
||||
(void)buf; (void)count;
|
||||
stub_enc_unsupported(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int ci_round_value_to_list32(unsigned long value,
|
||||
const unsigned long list[],
|
||||
int count, bool signd)
|
||||
{
|
||||
(void)value; (void)list; (void)count; (void)signd;
|
||||
stub_enc_unsupported(__func__);
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_RECORDING */
|
||||
|
||||
static struct codec_api ci = {
|
||||
|
||||
0, /* filesize */
|
||||
|
|
@ -703,21 +770,14 @@ static struct codec_api ci = {
|
|||
qsort,
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
ci_enc_get_inputs,
|
||||
ci_enc_set_parameters,
|
||||
ci_enc_get_chunk,
|
||||
ci_enc_finish_chunk,
|
||||
ci_enc_get_pcm_data,
|
||||
ci_enc_unget_pcm_data,
|
||||
|
||||
/* file */
|
||||
open,
|
||||
close,
|
||||
read,
|
||||
lseek,
|
||||
write,
|
||||
ci_enc_pcmbuf_read,
|
||||
ci_enc_pcmbuf_advance,
|
||||
ci_enc_encbuf_get_buffer,
|
||||
ci_enc_encbuf_finish_buffer,
|
||||
ci_enc_stream_read,
|
||||
ci_enc_stream_lseek,
|
||||
ci_enc_stream_write,
|
||||
ci_round_value_to_list32,
|
||||
|
||||
#endif /* HAVE_RECORDING */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue