diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-05 14:25:03 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-05 14:25:03 +0000 |
| commit | d0175f9a6b22c72642d43819ce873d03be3f455f (patch) | |
| tree | 1a4ab7f60ec5d922ad5864852e8787daf5be9340 | |
| parent | c1c9c6be73a86b910b25069907e204cc6e7ed6e0 (diff) | |
| download | qmmp-d0175f9a6b22c72642d43819ce873d03be3f455f.tar.gz qmmp-d0175f9a6b22c72642d43819ce873d03be3f455f.tar.bz2 qmmp-d0175f9a6b22c72642d43819ce873d03be3f455f.zip | |
added item skip limit
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@820 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/Output/oss/outputoss.cpp | 18 | ||||
| -rw-r--r-- | src/qmmpui/mediaplayer.cpp | 14 | ||||
| -rw-r--r-- | src/qmmpui/mediaplayer.h | 1 |
3 files changed, 27 insertions, 6 deletions
diff --git a/src/plugins/Output/oss/outputoss.cpp b/src/plugins/Output/oss/outputoss.cpp index 51e36e90f..49a4c5793 100644 --- a/src/plugins/Output/oss/outputoss.cpp +++ b/src/plugins/Output/oss/outputoss.cpp @@ -129,6 +129,7 @@ void OutputOSS::configure(long freq, int chan, int prec, int rate) // we need to configure if (freq != m_frequency || chan != m_channels || prec != m_precision) { + qDebug("OutputOSS: frequency=%d, channels=%d, bits=%d", freq, chan, prec); // we have already configured, but are changing settings... // reset the device resetDSP(); @@ -157,11 +158,18 @@ void OutputOSS::configure(long freq, int chan, int prec, int rate) } - ioctl(m_audio_fd, SNDCTL_DSP_SETFMT, &p); - ioctl(m_audio_fd, SNDCTL_DSP_SAMPLESIZE, &prec); - int stereo = (chan > 1) ? 1 : 0; - ioctl(m_audio_fd, SNDCTL_DSP_STEREO, &stereo); - ioctl(m_audio_fd, SNDCTL_DSP_SPEED, &freq); + if (ioctl(m_audio_fd, SNDCTL_DSP_SETFMT, &p) == -1) + qWarning("OutputOSS: can't set audio format"); + /*if(ioctl(m_audio_fd, SNDCTL_DSP_SAMPLESIZE, &prec) == -1) + qDebug("OutputOSS: can't set audio format");*/ + /*int stereo = (chan > 1) ? 1 : 0; + ioctl(m_audio_fd, SNDCTL_DSP_STEREO, &stereo);*/ + if (ioctl(m_audio_fd, SNDCTL_DSP_SPEED, &m_channels) == -1) + qWarning("OutputOSS: can't set number of channels"); + if (chan != m_channels) + qWarning("OutputOSS: can't set number of channels, using %d instead", m_channels); + if (ioctl(m_audio_fd, SNDCTL_DSP_SPEED, &freq) == -1) + qWarning("OutputOSS: can't set audio format"); } m_rate = rate; diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp index 168204a67..f15517d09 100644 --- a/src/qmmpui/mediaplayer.cpp +++ b/src/qmmpui/mediaplayer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -29,6 +29,8 @@ #include "mediaplayer.h" +#define MAX_SKIPS 5 + MediaPlayer *MediaPlayer::m_instance = 0; MediaPlayer::MediaPlayer(QObject *parent) @@ -37,6 +39,7 @@ MediaPlayer::MediaPlayer(QObject *parent) m_instance = this; m_model = 0; m_core = 0; + m_skips = 0; m_repeat = FALSE; QTranslator *translator = new QTranslator(parent); QString locale = QLocale::system().name(); @@ -101,6 +104,13 @@ void MediaPlayer::play() case Qmmp::NormalError: { //error in decoder, so we should try to play next song + m_skips++; + if (m_skips > MAX_SKIPS) + { + stop(); + qWarning("MediaPlayer: skip limit exceeded"); + break; + } qApp->processEvents(); if (!m_model->isEmptyQueue()) { @@ -117,6 +127,8 @@ void MediaPlayer::play() } } } + else + m_skips = 0; } void MediaPlayer::stop() diff --git a/src/qmmpui/mediaplayer.h b/src/qmmpui/mediaplayer.h index 920ef6908..cb52ffa37 100644 --- a/src/qmmpui/mediaplayer.h +++ b/src/qmmpui/mediaplayer.h @@ -57,6 +57,7 @@ private: SoundCore *m_core; static MediaPlayer* m_instance; bool m_repeat; + int m_skips; }; |
