decoder: introduce switch statement in decoder_task()
switch looks much nicer than if/elseif/... and gcc generates nice warnings when a new command is added to the enum.
This commit is contained in:
parent
78448fe1a5
commit
86fbac54fd
|
@ -169,15 +169,21 @@ static void * decoder_task(mpd_unused void *arg)
|
|||
while (1) {
|
||||
assert(dc.state == DECODE_STATE_STOP);
|
||||
|
||||
if (dc.command == DECODE_COMMAND_START ||
|
||||
dc.command == DECODE_COMMAND_SEEK) {
|
||||
switch (dc.command) {
|
||||
case DECODE_COMMAND_START:
|
||||
case DECODE_COMMAND_SEEK:
|
||||
decodeStart();
|
||||
} else if (dc.command == DECODE_COMMAND_STOP) {
|
||||
break;
|
||||
|
||||
case DECODE_COMMAND_STOP:
|
||||
dc.command = DECODE_COMMAND_NONE;
|
||||
notify_signal(&pc.notify);
|
||||
} else {
|
||||
break;
|
||||
|
||||
case DECODE_COMMAND_NONE:
|
||||
notify_wait(&dc.notify);
|
||||
notify_signal(&pc.notify);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue