aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-02 16:57:16 +0100
committerMax Kellermann <max@duempel.org>2008-11-02 16:57:16 +0100
commit5347cca29d0b6df888122d09ec05101d24a227be (patch)
tree97959c6751a7eafda228a949be58a378732b9695
parent8490c1b4cfbd35f049f36c3f85396a429a80d837 (diff)
downloadmpd-5347cca29d0b6df888122d09ec05101d24a227be.tar.gz
mpd-5347cca29d0b6df888122d09ec05101d24a227be.tar.xz
mpd-5347cca29d0b6df888122d09ec05101d24a227be.zip
music_pipe: no CamelCase
Rename all variables and struct members.
-rw-r--r--src/crossfade.c16
-rw-r--r--src/pipe.c28
-rw-r--r--src/pipe.h6
-rw-r--r--src/player_thread.c8
4 files changed, 29 insertions, 29 deletions
diff --git a/src/crossfade.c b/src/crossfade.c
index 27a1c3642..a65d304e8 100644
--- a/src/crossfade.c
+++ b/src/crossfade.c
@@ -58,9 +58,9 @@ void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b,
assert(current_chunk <= num_chunks);
- size = b->chunkSize > a->chunkSize
- ? a->chunkSize
- : b->chunkSize;
+ size = b->length > a->length
+ ? a->length
+ : b->length;
pcm_mix(a->data,
b->data,
@@ -68,14 +68,14 @@ void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b,
format,
((float)current_chunk) / num_chunks);
- if (b->chunkSize > a->chunkSize) {
+ if (b->length > a->length) {
/* the second buffer is larger than the first one:
there is unmixed rest at the end. Copy it over.
The output buffer API guarantees that there is
enough room in a->data. */
- memcpy(a->data + a->chunkSize,
- b->data + a->chunkSize,
- b->chunkSize - a->chunkSize);
- a->chunkSize = b->chunkSize;
+ memcpy(a->data + a->length,
+ b->data + a->length,
+ b->length - a->length);
+ a->length = b->length;
}
}
diff --git a/src/pipe.c b/src/pipe.c
index e8383e31a..38a016958 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -37,7 +37,7 @@ music_pipe_init(unsigned int size, struct notify *notify)
music_pipe.end = 0;
music_pipe.lazy = false;
music_pipe.notify = notify;
- music_pipe.chunks[0].chunkSize = 0;
+ music_pipe.chunks[0].length = 0;
}
void music_pipe_free(void)
@@ -49,7 +49,7 @@ void music_pipe_free(void)
void music_pipe_clear(void)
{
music_pipe.end = music_pipe.begin;
- music_pipe.chunks[music_pipe.end].chunkSize = 0;
+ music_pipe.chunks[music_pipe.end].length = 0;
}
/** return the index of the chunk after i */
@@ -73,7 +73,7 @@ static void output_buffer_expand(unsigned i)
assert(i != music_pipe.end);
music_pipe.end = i;
- music_pipe.chunks[i].chunkSize = 0;
+ music_pipe.chunks[i].length = 0;
if (was_empty)
/* if the buffer was empty, the player thread might be
waiting for us; wake it up now that another decoded
@@ -85,7 +85,7 @@ void music_pipe_flush(void)
{
struct music_chunk *chunk = music_pipe_get_chunk(music_pipe.end);
- if (chunk->chunkSize > 0) {
+ if (chunk->length > 0) {
unsigned int next = successor(music_pipe.end);
if (next == music_pipe.begin)
/* all buffers are full; we have to wait for
@@ -161,8 +161,8 @@ tail_chunk(size_t frame_size)
struct music_chunk *chunk;
chunk = music_pipe_get_chunk(music_pipe.end);
- assert(chunk->chunkSize <= sizeof(chunk->data));
- if (chunk->chunkSize + frame_size > sizeof(chunk->data)) {
+ assert(chunk->length <= sizeof(chunk->data));
+ if (chunk->length + frame_size > sizeof(chunk->data)) {
/* this chunk is full; allocate a new chunk */
next = successor(music_pipe.end);
if (music_pipe.begin == next)
@@ -171,7 +171,7 @@ tail_chunk(size_t frame_size)
output_buffer_expand(next);
chunk = music_pipe_get_chunk(next);
- assert(chunk->chunkSize == 0);
+ assert(chunk->length == 0);
}
return chunk;
@@ -181,7 +181,7 @@ static size_t
music_chunk_append(struct music_chunk *chunk, const void *data, size_t length,
size_t frame_size)
{
- size_t rest = sizeof(chunk->data) - chunk->chunkSize;
+ size_t rest = sizeof(chunk->data) - chunk->length;
assert(rest >= frame_size);
@@ -192,15 +192,15 @@ music_chunk_append(struct music_chunk *chunk, const void *data, size_t length,
length /= frame_size;
length *= frame_size;
- memcpy(chunk->data + chunk->chunkSize, data, length);
- chunk->chunkSize += length;
+ memcpy(chunk->data + chunk->length, data, length);
+ chunk->length += length;
return length;
}
size_t music_pipe_append(const void *data0, size_t datalen,
const struct audio_format *audio_format,
- float data_time, uint16_t bitRate)
+ float data_time, uint16_t bit_rate)
{
const unsigned char *data = data0;
const size_t frame_size = audio_format_frame_size(audio_format);
@@ -215,11 +215,11 @@ size_t music_pipe_append(const void *data0, size_t datalen,
if (chunk == NULL)
return ret;
- if (chunk->chunkSize == 0) {
+ if (chunk->length == 0) {
/* if the chunk is empty, nobody has set bitRate and
times yet */
- chunk->bitRate = bitRate;
+ chunk->bit_rate = bit_rate;
chunk->times = data_time;
}
@@ -232,7 +232,7 @@ size_t music_pipe_append(const void *data0, size_t datalen,
ret += nbytes;
}
- if (chunk != NULL && chunk->chunkSize == sizeof(chunk->data))
+ if (chunk != NULL && chunk->length == sizeof(chunk->data))
music_pipe_flush();
return ret;
diff --git a/src/pipe.h b/src/pipe.h
index ae5fa64d5..51c8ed3f3 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -29,8 +29,8 @@
struct audio_format;
struct music_chunk {
- uint16_t chunkSize;
- uint16_t bitRate;
+ uint16_t length;
+ uint16_t bit_rate;
float times;
char data[CHUNK_SIZE];
};
@@ -136,7 +136,7 @@ music_pipe_peek(void)
*/
size_t music_pipe_append(const void *data, size_t datalen,
const struct audio_format *audio_format,
- float data_time, uint16_t bitRate);
+ float data_time, uint16_t bit_rate);
void music_pipe_skip(unsigned num);
diff --git a/src/player_thread.c b/src/player_thread.c
index 3a378b069..1507d11b5 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -211,15 +211,15 @@ playChunk(struct music_chunk *chunk, const struct audio_format *format,
double sizeToTime)
{
pc.elapsedTime = chunk->times;
- pc.bitRate = chunk->bitRate;
+ pc.bitRate = chunk->bit_rate;
- pcm_volume(chunk->data, chunk->chunkSize,
+ pcm_volume(chunk->data, chunk->length,
format, pc.softwareVolume);
- if (!playAudio(chunk->data, chunk->chunkSize))
+ if (!playAudio(chunk->data, chunk->length))
return -1;
- pc.totalPlayTime += sizeToTime * chunk->chunkSize;
+ pc.totalPlayTime += sizeToTime * chunk->length;
return 0;
}