diff options
author | Max Kellermann <max@duempel.org> | 2008-10-10 14:41:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-10 14:41:37 +0200 |
commit | 96155a3376ef40eac9ca7a7b882da6447ab53979 (patch) | |
tree | b30e5248b366b12ef860c65ea3640598f3b73658 /src/audio_format.h | |
parent | de2cb3f37568e7680549057f8d7b6d748c388480 (diff) | |
download | mpd-96155a3376ef40eac9ca7a7b882da6447ab53979.tar.gz mpd-96155a3376ef40eac9ca7a7b882da6447ab53979.tar.xz mpd-96155a3376ef40eac9ca7a7b882da6447ab53979.zip |
audio_format: added audio_format_frame_size()
A frame contains one sample per channel, thus it is sample_size *
channels. This patch includes some cleanup for various locations
where the sample size for 24 bit audio was still 3 bytes (instead of
4).
Diffstat (limited to 'src/audio_format.h')
-rw-r--r-- | src/audio_format.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/audio_format.h b/src/audio_format.h index 2475aa77e..bbebc51b1 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -61,9 +61,15 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af) return 4; } +static inline unsigned +audio_format_frame_size(const struct audio_format *af) +{ + return audio_format_sample_size(af) * af->channels; +} + static inline double audio_format_time_to_size(const struct audio_format *af) { - return af->sample_rate * af->channels * audio_format_sample_size(af); + return af->sample_rate * audio_format_frame_size(af); } static inline double audioFormatSizeToTime(const struct audio_format *af) |