From d03a0de9c48a1678be73af631ae716598a1b8b99 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 29 Dec 2015 09:51:21 +0100 Subject: [PATCH] truehd_frame_t: re-factor to use more C++11isms, make functions const --- src/common/truehd.h | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/common/truehd.h b/src/common/truehd.h index afc314cb1..a7f59447e 100644 --- a/src/common/truehd.h +++ b/src/common/truehd.h @@ -29,45 +29,35 @@ struct truehd_frame_t { truehd, mlp, ac3, - } m_codec; + }; enum frame_type_e { invalid, normal, sync, - } m_type; + }; - int m_size; - int m_sampling_rate; - int m_channels; - int m_samples_per_frame; + codec_e m_codec{truehd}; + frame_type_e m_type{invalid}; + int m_size{}, m_sampling_rate{}, m_channels{}, m_samples_per_frame{}; ac3::frame_c m_ac3_header; memory_cptr m_data; - truehd_frame_t() - : m_codec(truehd) - , m_type(invalid) - , m_size(0) - , m_sampling_rate(0) - , m_channels(0) - , m_samples_per_frame(0) - { }; - - bool is_truehd() { + bool is_truehd() const { return truehd == m_codec; } - bool is_sync() { + bool is_sync() const { return sync == m_type; } - bool is_normal() { + bool is_normal() const { return sync == m_type; } - bool is_ac3() { + bool is_ac3() const { return ac3 == m_codec; } };