mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Remove explicit 'enum codec_command_action' in codec API
Just use long so the compiler potentially doesn't complain about use of other values not in the enum. It's also the type used around the system for event ids. Increase min codec API version. No functional changes. Change-Id: If4419b42912f5e4ef673adcdeb69313e503f94cc
This commit is contained in:
parent
83e8e35a58
commit
6c868dd48f
46 changed files with 55 additions and 52 deletions
|
@ -349,8 +349,7 @@ static void codec_configure_callback(int setting, intptr_t value)
|
|||
dsp_configure(ci.dsp, setting, value);
|
||||
}
|
||||
|
||||
static enum codec_command_action
|
||||
codec_get_command_callback(intptr_t *param)
|
||||
static long codec_get_command_callback(intptr_t *param)
|
||||
{
|
||||
yield();
|
||||
|
||||
|
@ -361,7 +360,7 @@ static enum codec_command_action
|
|||
be expected) */
|
||||
while (1)
|
||||
{
|
||||
enum codec_command_action action = CODEC_ACTION_NULL;
|
||||
long action = CODEC_ACTION_NULL;
|
||||
struct queue_event ev;
|
||||
|
||||
queue_peek(&codec_queue, &ev); /* Find out what it is */
|
||||
|
|
|
@ -173,7 +173,7 @@ enum codec_status codec_run(void)
|
|||
/* The main decoding loop */
|
||||
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,7 @@ enum codec_status codec_run(void)
|
|||
int consumed, packet_offset;
|
||||
int playback_on = -1;
|
||||
size_t resume_offset;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -72,7 +72,7 @@ enum codec_status codec_run(void)
|
|||
uint32_t sbr_fac = 1;
|
||||
unsigned char c = 0;
|
||||
void *ret;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
bool empty_first_frame = false;
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ enum codec_status codec_run(void)
|
|||
/* The main decoder loop */
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -305,7 +305,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -207,7 +207,7 @@ enum codec_status ICODE_ATTR codec_run(void)
|
|||
/* main encoding loop */
|
||||
while (1)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(NULL);
|
||||
long action = ci->get_command(NULL);
|
||||
|
||||
if (action != CODEC_ACTION_NULL)
|
||||
break;
|
||||
|
|
|
@ -109,7 +109,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
/* The main decoding loop */
|
||||
while (i < demux_res.num_sample_byte_sizes) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -155,7 +155,7 @@ enum codec_status codec_run(void)
|
|||
int res;
|
||||
int firstbyte;
|
||||
size_t resume_offset;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -107,7 +107,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -50,7 +50,7 @@ enum codec_status codec_run(void)
|
|||
int elapsed = 0;
|
||||
size_t resume_offset;
|
||||
intptr_t param;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
|
|
|
@ -61,7 +61,7 @@ enum codec_status codec_run(void)
|
|||
int playback_on = -1;
|
||||
size_t resume_offset;
|
||||
intptr_t param;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
|
|
|
@ -270,7 +270,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -97,7 +97,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "gcc_extensions.h"
|
||||
#include "load_code.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef CODEC
|
||||
#if defined(DEBUG) || defined(SIMULATOR)
|
||||
#undef DEBUGF
|
||||
|
@ -72,12 +74,12 @@
|
|||
#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
|
||||
|
||||
/* increase this every time the api struct changes */
|
||||
#define CODEC_API_VERSION 47
|
||||
#define CODEC_API_VERSION 48
|
||||
|
||||
/* update this to latest version if a change to the api struct breaks
|
||||
backwards compatibility (and please take the opportunity to sort in any
|
||||
new function which are "waiting" at the end of the function table) */
|
||||
#define CODEC_MIN_API_VERSION 47
|
||||
#define CODEC_MIN_API_VERSION 48
|
||||
|
||||
/* reasons for calling codec main entrypoint */
|
||||
enum codec_entry_call_reason {
|
||||
|
@ -99,6 +101,8 @@ enum codec_command_action {
|
|||
#ifdef HAVE_RECORDING
|
||||
CODEC_ACTION_STREAM_FINISH = 2,
|
||||
#endif
|
||||
CODEC_ACTION_MIN = LONG_MIN,
|
||||
CODEC_ACTION_MAX = LONG_MAX,
|
||||
};
|
||||
|
||||
/* NOTE: To support backwards compatibility, only add new functions at
|
||||
|
@ -144,7 +148,7 @@ struct codec_api {
|
|||
/* Configure different codec buffer parameters. */
|
||||
void (*configure)(int setting, intptr_t value);
|
||||
/* Obtain command action on what to do next */
|
||||
enum codec_command_action (*get_command)(intptr_t *param);
|
||||
long (*get_command)(intptr_t *param);
|
||||
/* Determine whether the track should be looped, if applicable. */
|
||||
bool (*loop_track)(void);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ enum codec_status codec_run(void)
|
|||
int scrambling_unit_size, num_units;
|
||||
size_t resume_offset;
|
||||
intptr_t param;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
|
|
|
@ -498,7 +498,7 @@ enum codec_status codec_run(void)
|
|||
frame=0;
|
||||
buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE);
|
||||
while (bytesleft) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -86,7 +86,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -86,7 +86,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while ( 1 ) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -89,7 +89,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -1333,7 +1333,7 @@ enum codec_status codec_run(void)
|
|||
old_patterntableposition = 0;
|
||||
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -2961,7 +2961,7 @@ enum codec_status codec_run(void)
|
|||
while (1)
|
||||
{
|
||||
intptr_t param;
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action != CODEC_ACTION_NULL)
|
||||
{
|
||||
|
|
|
@ -392,7 +392,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
/* This is the decoding loop. */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,7 @@ enum codec_status codec_run(void)
|
|||
/* This is the decoding loop. */
|
||||
do
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
return CODEC_OK;
|
||||
|
|
|
@ -95,7 +95,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -314,7 +314,7 @@ enum codec_status codec_main(enum codec_entry_call_reason reason)
|
|||
enum codec_status codec_run(void)
|
||||
{
|
||||
int error = CODEC_ERROR;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
ogg_sync_state oy;
|
||||
ogg_page og;
|
||||
|
|
|
@ -63,7 +63,7 @@ enum codec_status codec_run(void)
|
|||
unsigned char c = 0; /* channels */
|
||||
int playback_on = -1;
|
||||
size_t resume_offset;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -101,7 +101,7 @@ next_track:
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -110,7 +110,7 @@ seek_start:
|
|||
samplesdone = 0;
|
||||
buf = ci->request_buffer(&bytesleft, MAX_BUFFER_SIZE);
|
||||
while (bytesleft) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -1277,7 +1277,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -446,7 +446,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -453,7 +453,7 @@ static int play_track( void )
|
|||
|
||||
while ( 1 )
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -405,7 +405,7 @@ enum codec_status codec_run(void)
|
|||
unsigned long strtoffset;
|
||||
void *st = NULL;
|
||||
int j = 0;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
|
||||
memset(&bits, 0, sizeof(bits));
|
||||
|
|
|
@ -104,7 +104,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
while (!endofstream)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -135,7 +135,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
/* The main decoder loop */
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ enum codec_status codec_run(void)
|
|||
previous_section = -1;
|
||||
|
||||
while (1) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -159,7 +159,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -396,7 +396,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -400,7 +400,7 @@ enum codec_status codec_run(void)
|
|||
endofstream = 0;
|
||||
|
||||
while (!endofstream) {
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -188,7 +188,7 @@ enum codec_status ICODE_ATTR codec_run(void)
|
|||
/* main encoding loop */
|
||||
while (1)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(NULL);
|
||||
long action = ci->get_command(NULL);
|
||||
|
||||
if (action != CODEC_ACTION_NULL)
|
||||
break;
|
||||
|
|
|
@ -90,7 +90,7 @@ enum codec_status codec_run(void)
|
|||
|
||||
while (1) {
|
||||
int32_t nsamples;
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -353,7 +353,7 @@ enum codec_status codec_run(void)
|
|||
/* main encoding loop */
|
||||
while (1)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(NULL);
|
||||
long action = ci->get_command(NULL);
|
||||
|
||||
if (action != CODEC_ACTION_NULL)
|
||||
break;
|
||||
|
|
2
lib/rbcodec/codecs/wma.c
Executable file → Normal file
2
lib/rbcodec/codecs/wma.c
Executable file → Normal file
|
@ -52,7 +52,7 @@ enum codec_status codec_run(void)
|
|||
int audiobufsize;
|
||||
int packetlength = 0;
|
||||
int errcount = 0;
|
||||
enum codec_command_action action;
|
||||
long action;
|
||||
intptr_t param;
|
||||
|
||||
/* Remember the resume position - when the codec is opened, the
|
||||
|
|
|
@ -93,7 +93,7 @@ restart_track:
|
|||
|
||||
while (pktcnt < wfx.numpackets)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -120,7 +120,7 @@ restart_track:
|
|||
|
||||
while (pktcnt < wfx.numpackets)
|
||||
{
|
||||
enum codec_command_action action = ci->get_command(¶m);
|
||||
long action = ci->get_command(¶m);
|
||||
|
||||
if (action == CODEC_ACTION_HALT)
|
||||
break;
|
||||
|
|
|
@ -108,7 +108,7 @@ static const char *config = "";
|
|||
static uint32_t playback_vol_factor = VOL_FACTOR_UNITY;
|
||||
|
||||
static int input_fd;
|
||||
static enum codec_command_action codec_action;
|
||||
static long codec_action;
|
||||
static intptr_t codec_action_param = 0;
|
||||
static unsigned long num_output_samples = 0;
|
||||
static struct codec_api ci;
|
||||
|
@ -606,9 +606,9 @@ static void ci_configure(int setting, intptr_t value)
|
|||
}
|
||||
}
|
||||
|
||||
static enum codec_command_action ci_get_command(intptr_t *param)
|
||||
static long ci_get_command(intptr_t *param)
|
||||
{
|
||||
enum codec_command_action ret = codec_action;
|
||||
long ret = codec_action;
|
||||
*param = codec_action_param;
|
||||
codec_action = CODEC_ACTION_NULL;
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue