truehd_frame_t: re-factor to use more C++11isms, make functions const

This commit is contained in:
Moritz Bunkus 2015-12-29 09:51:21 +01:00
parent e3df2184d4
commit d03a0de9c4

View File

@ -29,45 +29,35 @@ struct truehd_frame_t {
truehd, truehd,
mlp, mlp,
ac3, ac3,
} m_codec; };
enum frame_type_e { enum frame_type_e {
invalid, invalid,
normal, normal,
sync, sync,
} m_type; };
int m_size; codec_e m_codec{truehd};
int m_sampling_rate; frame_type_e m_type{invalid};
int m_channels; int m_size{}, m_sampling_rate{}, m_channels{}, m_samples_per_frame{};
int m_samples_per_frame;
ac3::frame_c m_ac3_header; ac3::frame_c m_ac3_header;
memory_cptr m_data; memory_cptr m_data;
truehd_frame_t() bool is_truehd() const {
: m_codec(truehd)
, m_type(invalid)
, m_size(0)
, m_sampling_rate(0)
, m_channels(0)
, m_samples_per_frame(0)
{ };
bool is_truehd() {
return truehd == m_codec; return truehd == m_codec;
} }
bool is_sync() { bool is_sync() const {
return sync == m_type; return sync == m_type;
} }
bool is_normal() { bool is_normal() const {
return sync == m_type; return sync == m_type;
} }
bool is_ac3() { bool is_ac3() const {
return ac3 == m_codec; return ac3 == m_codec;
} }
}; };