aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/flac_plugin.c3
-rw-r--r--src/inputPlugins/oggflac_plugin.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 15d5c6d63..a579209e4 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -237,7 +237,8 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
FLAC__uint32 samples = frame->header.blocksize;
unsigned int c_samp;
const unsigned int num_channels = frame->header.channels;
- const unsigned int bytes_per_sample = (data->audio_format.bits / 8);
+ const unsigned int bytes_per_sample =
+ audio_format_sample_size(&data->audio_format);
const unsigned int bytes_per_channel =
bytes_per_sample * frame->header.channels;
const unsigned int max_samples = FLAC_CHUNK_SIZE / bytes_per_channel;
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c
index e0cf02524..31ddaab7f 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -160,7 +160,7 @@ static FLAC__StreamDecoderWriteStatus oggflacWrite(mpd_unused const
FLAC__uint16 u16;
unsigned char *uc;
unsigned int c_samp, c_chan;
- int i;
+ unsigned int i;
float timeChange;
timeChange = ((float)samples) / frame->header.sample_rate;
@@ -183,7 +183,7 @@ static FLAC__StreamDecoderWriteStatus oggflacWrite(mpd_unused const
c_chan++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
- for (i = 0; i < (data->audio_format.bits / 8); i++) {
+ for (i = 0; i < audio_format_sample_size(&data->audio_format); i++) {
if (data->chunk_length >= FLAC_CHUNK_SIZE) {
if (flacSendChunk(data) < 0) {
return