From 8d32d3ff66b859c913f2046f313b996d3ba34ce8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Apr 2013 16:18:07 +0200 Subject: decoder_control: cosmetics, reformat --- src/decoder/decoder_control.c | 44 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/src/decoder/decoder_control.c b/src/decoder/decoder_control.c index 4c7d59da..17f7ced3 100644 --- a/src/decoder/decoder_control.c +++ b/src/decoder/decoder_control.c @@ -26,8 +26,7 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "decoder_control" -struct decoder_control * -dc_new(GCond *client_cond) +struct decoder_control *dc_new(GCond *client_cond) { struct decoder_control *dc = g_new(struct decoder_control, 1); @@ -49,8 +48,7 @@ dc_new(GCond *client_cond) return dc; } -void -dc_free(struct decoder_control *dc) +void dc_free(struct decoder_control *dc) { g_cond_free(dc->cond); g_mutex_free(dc->mutex); @@ -60,31 +58,27 @@ dc_free(struct decoder_control *dc) g_free(dc); } -static void -dc_command_wait_locked(struct decoder_control *dc) +static void dc_command_wait_locked(struct decoder_control *dc) { while (dc->command != DECODE_COMMAND_NONE) g_cond_wait(dc->client_cond, dc->mutex); } -static void -dc_command_locked(struct decoder_control *dc, enum decoder_command cmd) +static void dc_command_locked(struct decoder_control *dc, enum decoder_command cmd) { dc->command = cmd; decoder_signal(dc); dc_command_wait_locked(dc); } -static void -dc_command(struct decoder_control *dc, enum decoder_command cmd) +static void dc_command(struct decoder_control *dc, enum decoder_command cmd) { decoder_lock(dc); dc_command_locked(dc, cmd); decoder_unlock(dc); } -static void -dc_command_async(struct decoder_control *dc, enum decoder_command cmd) +static void dc_command_async(struct decoder_control *dc, enum decoder_command cmd) { decoder_lock(dc); @@ -110,16 +104,15 @@ void dc_start(struct decoder_control *dc, struct song *song, dc_command(dc, DECODE_COMMAND_START); } -void -dc_stop(struct decoder_control *dc) +void dc_stop(struct decoder_control *dc) { decoder_lock(dc); + /* Attempt to cancel the current command. If it's too + late and the decoder thread is already executing + the old command, we'll call STOP again in this + function (see below). */ if (dc->command != DECODE_COMMAND_NONE) - /* Attempt to cancel the current command. If it's too - late and the decoder thread is already executing - the old command, we'll call STOP again in this - function (see below). */ dc_command_locked(dc, DECODE_COMMAND_STOP); if (dc->state != DECODE_STATE_STOP && dc->state != DECODE_STATE_ERROR) @@ -128,8 +121,7 @@ dc_stop(struct decoder_control *dc) decoder_unlock(dc); } -bool -dc_seek(struct decoder_control *dc, double where) +bool dc_seek(struct decoder_control *dc, double where) { assert(dc->state != DECODE_STATE_START); assert(where >= 0.0); @@ -148,8 +140,7 @@ dc_seek(struct decoder_control *dc, double where) return true; } -void -dc_quit(struct decoder_control *dc) +void dc_quit(struct decoder_control *dc) { assert(dc->thread != NULL); @@ -160,8 +151,7 @@ dc_quit(struct decoder_control *dc) dc->thread = NULL; } -void -dc_mixramp_start(struct decoder_control *dc, char *mixramp_start) +void dc_mixramp_start(struct decoder_control *dc, char *mixramp_start) { assert(dc != NULL); @@ -170,8 +160,7 @@ dc_mixramp_start(struct decoder_control *dc, char *mixramp_start) g_debug("mixramp_start = %s", mixramp_start ? mixramp_start : "NULL"); } -void -dc_mixramp_end(struct decoder_control *dc, char *mixramp_end) +void dc_mixramp_end(struct decoder_control *dc, char *mixramp_end) { assert(dc != NULL); @@ -180,8 +169,7 @@ dc_mixramp_end(struct decoder_control *dc, char *mixramp_end) g_debug("mixramp_end = %s", mixramp_end ? mixramp_end : "NULL"); } -void -dc_mixramp_prev_end(struct decoder_control *dc, char *mixramp_prev_end) +void dc_mixramp_prev_end(struct decoder_control *dc, char *mixramp_prev_end) { assert(dc != NULL); -- cgit v1.2.3