Commit 863badd9 authored by Max Kellermann's avatar Max Kellermann

decoder: no CamelCase

Renamed variables and functions.
parent b3dfcfef
...@@ -43,7 +43,7 @@ void decoder_initialized(struct decoder * decoder, ...@@ -43,7 +43,7 @@ void decoder_initialized(struct decoder * decoder,
getOutputAudioFormat(audio_format, &dc.out_audio_format); getOutputAudioFormat(audio_format, &dc.out_audio_format);
dc.seekable = seekable; dc.seekable = seekable;
dc.totalTime = total_time; dc.total_time = total_time;
dc.state = DECODE_STATE_DECODE; dc.state = DECODE_STATE_DECODE;
notify_signal(&pc.notify); notify_signal(&pc.notify);
...@@ -63,7 +63,7 @@ void decoder_command_finished(mpd_unused struct decoder * decoder) ...@@ -63,7 +63,7 @@ void decoder_command_finished(mpd_unused struct decoder * decoder)
{ {
assert(dc.command != DECODE_COMMAND_NONE); assert(dc.command != DECODE_COMMAND_NONE);
assert(dc.command != DECODE_COMMAND_SEEK || assert(dc.command != DECODE_COMMAND_SEEK ||
dc.seekError || decoder->seeking); dc.seek_error || decoder->seeking);
if (dc.command == DECODE_COMMAND_SEEK) if (dc.command == DECODE_COMMAND_SEEK)
/* delete frames from the old song position */ /* delete frames from the old song position */
...@@ -79,14 +79,14 @@ double decoder_seek_where(mpd_unused struct decoder * decoder) ...@@ -79,14 +79,14 @@ double decoder_seek_where(mpd_unused struct decoder * decoder)
decoder->seeking = true; decoder->seeking = true;
return dc.seekWhere; return dc.seek_where;
} }
void decoder_seek_error(struct decoder * decoder) void decoder_seek_error(struct decoder * decoder)
{ {
assert(dc.command == DECODE_COMMAND_SEEK); assert(dc.command == DECODE_COMMAND_SEEK);
dc.seekError = true; dc.seek_error = true;
decoder_command_finished(decoder); decoder_command_finished(decoder);
} }
......
...@@ -93,11 +93,11 @@ dc_seek(struct notify *notify, double where) ...@@ -93,11 +93,11 @@ dc_seek(struct notify *notify, double where)
if (dc.state == DECODE_STATE_STOP || !dc.seekable) if (dc.state == DECODE_STATE_STOP || !dc.seekable)
return false; return false;
dc.seekWhere = where; dc.seek_where = where;
dc.seekError = false; dc.seek_error = false;
dc_command(notify, DECODE_COMMAND_SEEK); dc_command(notify, DECODE_COMMAND_SEEK);
if (dc.seekError) if (dc.seek_error)
return false; return false;
return true; return true;
......
...@@ -44,9 +44,9 @@ struct decoder_control { ...@@ -44,9 +44,9 @@ struct decoder_control {
volatile enum decoder_state state; volatile enum decoder_state state;
volatile enum decoder_command command; volatile enum decoder_command command;
volatile uint16_t error; volatile uint16_t error;
bool seekError; bool seek_error;
bool seekable; bool seekable;
volatile double seekWhere; volatile double seek_where;
/** the format of the song file */ /** the format of the song file */
struct audio_format in_audio_format; struct audio_format in_audio_format;
...@@ -56,7 +56,7 @@ struct decoder_control { ...@@ -56,7 +56,7 @@ struct decoder_control {
struct song *current_song; struct song *current_song;
struct song *volatile next_song; struct song *volatile next_song;
volatile float totalTime; volatile float total_time;
}; };
extern struct decoder_control dc; extern struct decoder_control dc;
......
...@@ -45,7 +45,7 @@ decoder_try_decode(const struct decoder_plugin *plugin, ...@@ -45,7 +45,7 @@ decoder_try_decode(const struct decoder_plugin *plugin,
return ret; return ret;
} }
static void decodeStart(void) static void decoder_run(void)
{ {
struct song *song = dc.next_song; struct song *song = dc.next_song;
char buffer[MPD_PATH_MAX]; char buffer[MPD_PATH_MAX];
...@@ -53,7 +53,7 @@ static void decodeStart(void) ...@@ -53,7 +53,7 @@ static void decodeStart(void)
struct decoder decoder; struct decoder decoder;
int ret; int ret;
bool close_instream = true; bool close_instream = true;
struct input_stream inStream; struct input_stream input_stream;
const struct decoder_plugin *plugin; const struct decoder_plugin *plugin;
if (song_is_file(song)) if (song_is_file(song))
...@@ -66,7 +66,7 @@ static void decodeStart(void) ...@@ -66,7 +66,7 @@ static void decodeStart(void)
} }
dc.current_song = dc.next_song; /* NEED LOCK */ dc.current_song = dc.next_song; /* NEED LOCK */
if (!input_stream_open(&inStream, uri)) { if (!input_stream_open(&input_stream, uri)) {
dc.error = DECODE_ERROR_FILE; dc.error = DECODE_ERROR_FILE;
return; return;
} }
...@@ -81,21 +81,21 @@ static void decodeStart(void) ...@@ -81,21 +81,21 @@ static void decodeStart(void)
/* wait for the input stream to become ready; its metadata /* wait for the input stream to become ready; its metadata
will be available then */ will be available then */
while (!inStream.ready) { while (!input_stream.ready) {
if (dc.command != DECODE_COMMAND_NONE) { if (dc.command != DECODE_COMMAND_NONE) {
input_stream_close(&inStream); input_stream_close(&input_stream);
return; return;
} }
ret = input_stream_buffer(&inStream); ret = input_stream_buffer(&input_stream);
if (ret < 0) { if (ret < 0) {
input_stream_close(&inStream); input_stream_close(&input_stream);
return; return;
} }
} }
if (dc.command == DECODE_COMMAND_STOP) { if (dc.command == DECODE_COMMAND_STOP) {
input_stream_close(&inStream); input_stream_close(&input_stream);
return; return;
} }
...@@ -104,14 +104,14 @@ static void decodeStart(void) ...@@ -104,14 +104,14 @@ static void decodeStart(void)
unsigned int next = 0; unsigned int next = 0;
/* first we try mime types: */ /* first we try mime types: */
while ((plugin = decoder_plugin_from_mime_type(inStream.mime, next++))) { while ((plugin = decoder_plugin_from_mime_type(input_stream.mime, next++))) {
if (plugin->stream_decode == NULL) if (plugin->stream_decode == NULL)
continue; continue;
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL)) if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
continue; continue;
if (!decoder_try_decode(plugin, &inStream)) if (!decoder_try_decode(plugin, &input_stream))
continue; continue;
ret = plugin->stream_decode(&decoder, &inStream); ret = plugin->stream_decode(&decoder, &input_stream);
break; break;
} }
...@@ -125,11 +125,11 @@ static void decodeStart(void) ...@@ -125,11 +125,11 @@ static void decodeStart(void)
if (!(plugin->stream_types & if (!(plugin->stream_types &
INPUT_PLUGIN_STREAM_URL)) INPUT_PLUGIN_STREAM_URL))
continue; continue;
if (!decoder_try_decode(plugin, &inStream)) if (!decoder_try_decode(plugin, &input_stream))
continue; continue;
decoder.plugin = plugin; decoder.plugin = plugin;
ret = plugin->stream_decode(&decoder, ret = plugin->stream_decode(&decoder,
&inStream); &input_stream);
break; break;
} }
} }
...@@ -142,7 +142,7 @@ static void decodeStart(void) ...@@ -142,7 +142,7 @@ static void decodeStart(void)
if ((plugin = decoder_plugin_from_name("mp3"))) { if ((plugin = decoder_plugin_from_name("mp3"))) {
decoder.plugin = plugin; decoder.plugin = plugin;
ret = plugin->stream_decode(&decoder, ret = plugin->stream_decode(&decoder,
&inStream); &input_stream);
} }
} }
} else { } else {
...@@ -152,11 +152,11 @@ static void decodeStart(void) ...@@ -152,11 +152,11 @@ static void decodeStart(void)
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE) if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
continue; continue;
if (!decoder_try_decode(plugin, &inStream)) if (!decoder_try_decode(plugin, &input_stream))
continue; continue;
if (plugin->file_decode != NULL) { if (plugin->file_decode != NULL) {
input_stream_close(&inStream); input_stream_close(&input_stream);
close_instream = false; close_instream = false;
decoder.plugin = plugin; decoder.plugin = plugin;
ret = plugin->file_decode(&decoder, uri); ret = plugin->file_decode(&decoder, uri);
...@@ -164,7 +164,7 @@ static void decodeStart(void) ...@@ -164,7 +164,7 @@ static void decodeStart(void)
} else if (plugin->stream_decode != NULL) { } else if (plugin->stream_decode != NULL) {
decoder.plugin = plugin; decoder.plugin = plugin;
ret = plugin->stream_decode(&decoder, ret = plugin->stream_decode(&decoder,
&inStream); &input_stream);
break; break;
} }
} }
...@@ -179,7 +179,7 @@ static void decodeStart(void) ...@@ -179,7 +179,7 @@ static void decodeStart(void)
} }
if (close_instream) if (close_instream)
input_stream_close(&inStream); input_stream_close(&input_stream);
} }
static void * decoder_task(mpd_unused void *arg) static void * decoder_task(mpd_unused void *arg)
...@@ -190,7 +190,7 @@ static void * decoder_task(mpd_unused void *arg) ...@@ -190,7 +190,7 @@ static void * decoder_task(mpd_unused void *arg)
switch (dc.command) { switch (dc.command) {
case DECODE_COMMAND_START: case DECODE_COMMAND_START:
case DECODE_COMMAND_SEEK: case DECODE_COMMAND_SEEK:
decodeStart(); decoder_run();
dc.state = DECODE_STATE_STOP; dc.state = DECODE_STATE_STOP;
dc.command = DECODE_COMMAND_NONE; dc.command = DECODE_COMMAND_NONE;
......
...@@ -329,7 +329,7 @@ static void do_play(void) ...@@ -329,7 +329,7 @@ static void do_play(void)
if (player.paused) if (player.paused)
closeAudioDevice(); closeAudioDevice();
pc.totalTime = dc.totalTime; pc.totalTime = dc.total_time;
pc.audio_format = dc.in_audio_format; pc.audio_format = dc.in_audio_format;
play_audio_format = dc.out_audio_format; play_audio_format = dc.out_audio_format;
sizeToTime = audioFormatSizeToTime(&dc.out_audio_format); sizeToTime = audioFormatSizeToTime(&dc.out_audio_format);
...@@ -367,7 +367,7 @@ static void do_play(void) ...@@ -367,7 +367,7 @@ static void do_play(void)
calculate how many chunks will be required calculate how many chunks will be required
for it */ for it */
crossFadeChunks = crossFadeChunks =
cross_fade_calc(pc.crossFade, dc.totalTime, cross_fade_calc(pc.crossFade, dc.total_time,
&dc.out_audio_format, &dc.out_audio_format,
music_pipe_size() - music_pipe_size() -
pc.buffered_before_play); pc.buffered_before_play);
......
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