From 2bf91a0487202de381e15b3dcd4aff45abf2ecf9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 13 Dec 2016 20:07:00 +0100 Subject: [PATCH] output/Internal: merge REOPEN and OPEN --- src/output/Internal.hxx | 7 +++---- src/output/OutputControl.cxx | 4 +--- src/output/OutputThread.cxx | 10 ++++------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 1d9d5c1f7..89a86c2c4 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -48,13 +48,12 @@ struct AudioOutput { NONE, ENABLE, DISABLE, - OPEN, /** - * This command is invoked when the input audio format - * changes. + * Open the output, or reopen it if it is already + * open, adjusting for input #AudioFormat changes. */ - REOPEN, + OPEN, CLOSE, PAUSE, diff --git a/src/output/OutputControl.cxx b/src/output/OutputControl.cxx index c8b25c101..a848063d9 100644 --- a/src/output/OutputControl.cxx +++ b/src/output/OutputControl.cxx @@ -138,9 +138,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp) if (!thread.IsDefined()) StartThread(); - CommandWait(open - ? Command::REOPEN - : Command::OPEN); + CommandWait(Command::OPEN); const bool open2 = open; if (open2 && mixer != nullptr) { diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 18af1923e..2746e6699 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -590,12 +590,10 @@ AudioOutput::Task() break; case Command::OPEN: - Open(); - CommandFinished(); - break; - - case Command::REOPEN: - Reopen(); + if (open) + Reopen(); + else + Open(); CommandFinished(); break;