decoder/mad: convert enums/macros to constexpr
This commit is contained in:
parent
662cc5fe20
commit
aac985951a
@ -43,9 +43,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define FRAMES_CUSHION 2000
|
static constexpr unsigned long FRAMES_CUSHION = 2000;
|
||||||
|
|
||||||
#define READ_BUFFER_SIZE 40960
|
|
||||||
|
|
||||||
enum mp3_action {
|
enum mp3_action {
|
||||||
DECODE_SKIP = -3,
|
DECODE_SKIP = -3,
|
||||||
@ -61,9 +59,9 @@ enum muteframe {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* the number of samples of silence the decoder inserts at start */
|
/* the number of samples of silence the decoder inserts at start */
|
||||||
#define DECODERDELAY 529
|
static constexpr unsigned DECODERDELAY = 529;
|
||||||
|
|
||||||
#define DEFAULT_GAPLESS_MP3_PLAYBACK true
|
static constexpr bool DEFAULT_GAPLESS_MP3_PLAYBACK = true;
|
||||||
|
|
||||||
static constexpr Domain mad_domain("mad");
|
static constexpr Domain mad_domain("mad");
|
||||||
|
|
||||||
@ -72,11 +70,9 @@ static bool gapless_playback;
|
|||||||
static inline int32_t
|
static inline int32_t
|
||||||
mad_fixed_to_24_sample(mad_fixed_t sample)
|
mad_fixed_to_24_sample(mad_fixed_t sample)
|
||||||
{
|
{
|
||||||
enum {
|
static constexpr unsigned bits = 24;
|
||||||
bits = 24,
|
static constexpr mad_fixed_t MIN = -MAD_F_ONE;
|
||||||
MIN = -MAD_F_ONE,
|
static constexpr mad_fixed_t MAX = MAD_F_ONE - 1;
|
||||||
MAX = MAD_F_ONE - 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/* round */
|
/* round */
|
||||||
sample = sample + (1L << (MAD_F_FRACBITS - bits));
|
sample = sample + (1L << (MAD_F_FRACBITS - bits));
|
||||||
@ -109,9 +105,10 @@ mp3_plugin_init(gcc_unused const config_param ¶m)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MP3_DATA_OUTPUT_BUFFER_SIZE 2048
|
|
||||||
|
|
||||||
struct MadDecoder {
|
struct MadDecoder {
|
||||||
|
static constexpr size_t READ_BUFFER_SIZE = 40960;
|
||||||
|
static constexpr size_t MP3_DATA_OUTPUT_BUFFER_SIZE = 2048;
|
||||||
|
|
||||||
struct mad_stream stream;
|
struct mad_stream stream;
|
||||||
struct mad_frame frame;
|
struct mad_frame frame;
|
||||||
struct mad_synth synth;
|
struct mad_synth synth;
|
||||||
@ -501,10 +498,10 @@ MadDecoder::DecodeNextFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* xing stuff stolen from alsaplayer, and heavily modified by jat */
|
/* xing stuff stolen from alsaplayer, and heavily modified by jat */
|
||||||
#define XI_MAGIC (('X' << 8) | 'i')
|
static constexpr unsigned XI_MAGIC = (('X' << 8) | 'i');
|
||||||
#define NG_MAGIC (('n' << 8) | 'g')
|
static constexpr unsigned NG_MAGIC = (('n' << 8) | 'g');
|
||||||
#define IN_MAGIC (('I' << 8) | 'n')
|
static constexpr unsigned IN_MAGIC = (('I' << 8) | 'n');
|
||||||
#define FO_MAGIC (('f' << 8) | 'o')
|
static constexpr unsigned FO_MAGIC = (('f' << 8) | 'o');
|
||||||
|
|
||||||
enum xing_magic {
|
enum xing_magic {
|
||||||
XING_MAGIC_XING, /* VBR */
|
XING_MAGIC_XING, /* VBR */
|
||||||
@ -520,12 +517,10 @@ struct xing {
|
|||||||
enum xing_magic magic; /* header magic */
|
enum xing_magic magic; /* header magic */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
static const unsigned XING_FRAMES = 1;
|
||||||
XING_FRAMES = 0x00000001L,
|
static const unsigned XING_BYTES = 2;
|
||||||
XING_BYTES = 0x00000002L,
|
static const unsigned XING_TOC = 4;
|
||||||
XING_TOC = 0x00000004L,
|
static const unsigned XING_SCALE = 8;
|
||||||
XING_SCALE = 0x00000008L
|
|
||||||
};
|
|
||||||
|
|
||||||
struct lame_version {
|
struct lame_version {
|
||||||
unsigned major;
|
unsigned major;
|
||||||
|
Loading…
Reference in New Issue
Block a user