diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2014-03-26 07:48:27 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2014-03-26 07:48:27 +0000 |
| commit | fb257efe921d3776b5231ce4e42f43a20f78d8f2 (patch) | |
| tree | b79a6bf0b1db6f6738c96c4099100efadc13c97f /src/plugins | |
| parent | 7ff6e6a4fc150f055a6d459499edf18707c06c2e (diff) | |
| download | qmmp-fb257efe921d3776b5231ce4e42f43a20f78d8f2.tar.gz qmmp-fb257efe921d3776b5231ce4e42f43a20f78d8f2.tar.bz2 qmmp-fb257efe921d3776b5231ce4e42f43a20f78d8f2.zip | |
fixed random freezing in mplayer plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4206 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/Engines/mplayer/mplayerengine.cpp | 14 | ||||
| -rw-r--r-- | src/plugins/Engines/mplayer/mplayerengine.h | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/Engines/mplayer/mplayerengine.cpp b/src/plugins/Engines/mplayer/mplayerengine.cpp index e0de42f40..12feaf73f 100644 --- a/src/plugins/Engines/mplayer/mplayerengine.cpp +++ b/src/plugins/Engines/mplayer/mplayerengine.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2013 by Ilya Kotov * + * Copyright (C) 2008-2014 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -89,6 +89,7 @@ MplayerEngine::MplayerEngine(QObject *parent) m_length = 0; m_currentTime = 0; m_muted = false; + m_user_stop = false; m_process = new QProcess(this); connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(readStdOut())); } @@ -103,6 +104,7 @@ MplayerEngine::~MplayerEngine() bool MplayerEngine::play() { + m_user_stop = false; if(m_process->state() != QProcess::NotRunning) return false; startMplayerProcess(); @@ -165,8 +167,12 @@ void MplayerEngine::stop() { while(!m_sources.isEmpty()) m_sources.dequeue()->deleteLater(); - m_process->write("quit\n"); - m_process->close(); + if(m_process->state() == QProcess::Running) + { + m_user_stop = true; + m_process->write("quit\n"); + m_process->waitForFinished(3500); + } StateHandler::instance()->dispatch(Qmmp::Stopped); } @@ -220,7 +226,7 @@ void MplayerEngine::readStdOut() return; } } - else if (rx_quit.indexIn(line) > -1) + else if (rx_quit.indexIn(line) > -1 && !m_user_stop) { if (m_process->state() == QProcess::Running) m_process->waitForFinished(1500); diff --git a/src/plugins/Engines/mplayer/mplayerengine.h b/src/plugins/Engines/mplayer/mplayerengine.h index de702a7ea..c5ae2497c 100644 --- a/src/plugins/Engines/mplayer/mplayerengine.h +++ b/src/plugins/Engines/mplayer/mplayerengine.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2013 by Ilya Kotov * + * Copyright (C) 2008-2014 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -70,6 +70,7 @@ private: int m_channels; int m_bitsPerSample; bool m_muted; + bool m_user_stop; qint64 m_currentTime; qint64 m_length; QQueue <InputSource*> m_sources; |
