Commit 96eb0119 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

use unsigned integers and size_t in the flac plugin

git-svn-id: https://svn.musicpd.org/mpd/trunk@7324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 14529af7
......@@ -144,9 +144,9 @@ typedef size_t flac_read_status_size_t;
typedef struct {
unsigned char chunk[FLAC_CHUNK_SIZE];
int chunk_length;
size_t chunk_length;
float time;
int bitRate;
unsigned int bitRate;
FLAC__uint64 position;
OutputBuffer *cb;
DecoderControl *dc;
......
......@@ -216,15 +216,20 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
FLAC__uint16 u16;
unsigned char *uc;
unsigned int c_samp, c_chan;
int i;
unsigned int i;
float timeChange;
FLAC__uint64 newPosition = 0;
assert(data->dc->audioFormat.bits > 0);
timeChange = ((float)samples) / frame->header.sample_rate;
data->time += timeChange;
flac_get_decode_position(dec, &newPosition);
if (data->position) {
assert(newPosition >= data->position);
assert(timeChange >= 0);
data->bitRate =
((newPosition - data->position) * 8.0 / timeChange)
/ 1000 + 0.5;
......@@ -236,7 +241,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
c_chan++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
for (i = 0; i < (data->dc->audioFormat.bits / 8); i++) {
for (i = 0; i < (unsigned)(data->dc->audioFormat.bits / 8); i++) {
if (data->chunk_length >= FLAC_CHUNK_SIZE) {
if (flacSendChunk(data) < 0) {
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment