From d0175f9a6b22c72642d43819ce873d03be3f455f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 5 Mar 2009 14:25:03 +0000 Subject: added item skip limit git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@820 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/mediaplayer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/qmmpui/mediaplayer.cpp') 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() -- cgit v1.2.3-13-gbd6f