tag/Rva2: make enum rva2_channel strictly-typed

This commit is contained in:
Max Kellermann 2015-02-04 15:56:01 +01:00
parent 833ec3d3cd
commit e582e893cc

View File

@ -26,20 +26,20 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
enum rva2_channel { enum class Rva2Channel : uint8_t {
CHANNEL_OTHER = 0x00, OTHER = 0x00,
CHANNEL_MASTER_VOLUME = 0x01, MASTER_VOLUME = 0x01,
CHANNEL_FRONT_RIGHT = 0x02, FRONT_RIGHT = 0x02,
CHANNEL_FRONT_LEFT = 0x03, FRONT_LEFT = 0x03,
CHANNEL_BACK_RIGHT = 0x04, BACK_RIGHT = 0x04,
CHANNEL_BACK_LEFT = 0x05, BACK_LEFT = 0x05,
CHANNEL_FRONT_CENTRE = 0x06, FRONT_CENTRE = 0x06,
CHANNEL_BACK_CENTRE = 0x07, BACK_CENTRE = 0x07,
CHANNEL_SUBWOOFER = 0x08 SUBWOOFER = 0x08
}; };
struct rva2_data { struct rva2_data {
uint8_t type; Rva2Channel type;
uint8_t volume_adjustment[2]; uint8_t volume_adjustment[2];
uint8_t peak_bits; uint8_t peak_bits;
}; };
@ -76,7 +76,7 @@ static inline bool
rva2_apply_data(ReplayGainInfo &rgi, rva2_apply_data(ReplayGainInfo &rgi,
const struct rva2_data *data, const id3_latin1_t *id) const struct rva2_data *data, const id3_latin1_t *id)
{ {
if (data->type != CHANNEL_MASTER_VOLUME) if (data->type != Rva2Channel::MASTER_VOLUME)
return false; return false;
float volume_adjustment = rva2_float_volume_adjustment(data); float volume_adjustment = rva2_float_volume_adjustment(data);