author | harlekin <harlekin> | 2002-08-09 20:11:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-09 20:11:31 (UTC) |
commit | 46eb53b1fd042d2591933a7d89a0e65b79140f16 (patch) (side-by-side diff) | |
tree | c5304881a9597b98f05adb04216b8042ca0d78b6 | |
parent | d8e5c405aa6bf33b8b1d59443926876e8f056e5b (diff) | |
download | opie-46eb53b1fd042d2591933a7d89a0e65b79140f16.zip opie-46eb53b1fd042d2591933a7d89a0e65b79140f16.tar.gz opie-46eb53b1fd042d2591933a7d89a0e65b79140f16.tar.bz2 |
autoadvance to next media when current is finished (playlist)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index eba837e..8b9413f 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -4,129 +4,134 @@ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qtimer.h> #include "xinecontrol.h" #include "mediaplayerstate.h" #include "videowidget.h" extern MediaPlayerState *mediaPlayerState; extern VideoWidget *videoUI; XineControl::XineControl( QObject *parent, const char *name ) : QObject( parent, name ) { libXine = new XINE::Lib(videoUI->vidWidget() ); connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); + connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); } XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { m_fileName = fileName; libXine->play( fileName ); mediaPlayerState->setPlaying( true ); // default to audio view until we know how to handle video // MediaDetect mdetect; char whichGui = mdetect.videoOrAudio( fileName ); if (whichGui == 'f') { qDebug("Nicht erkannter Dateityp"); return; } if (whichGui == 'a') { libXine->setShowVideo( false ); } else { libXine->setShowVideo( true ); } // determine if slider is shown // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); - mediaPlayerState->setIsStreaming( libXine->isSeekable() ); + mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState->setView( whichGui ); length(); position(); } +void XineControl::nextMedia() { + mediaPlayerState->setNext(); +} + void XineControl::stop( bool isSet ) { if ( !isSet) { libXine->stop(); mediaPlayerState->setList(); //mediaPlayerState->setPlaying( false ); } else { // play again } } /** * Pause playback * @isSet */ void XineControl::pause( bool isSet) { if (isSet) { libXine->pause(); } else { libXine->play( m_fileName, 0, m_currentTime); } } /** * get current time in playback */ long XineControl::currentTime() { // todo: jede sekunde überprüfen m_currentTime = libXine->currentTime(); return m_currentTime; QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); } /** * Set the length of the media file */ void XineControl::length() { m_length = libXine->length(); mediaPlayerState->setLength( m_length ); } /** * Reports the position the xine backend is at right now * @return long the postion in seconds */ long XineControl::position() { m_position = ( currentTime() ); diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index c7aefd4..712e298 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -10,64 +10,64 @@ _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XINECONTROL_H #define XINECONTROL_H #include "lib.h" #include "mediadetect.h" #include <qobject.h> class XineControl : public QObject { Q_OBJECT public: XineControl( QObject *parent = 0, const char *name =0 ); ~XineControl(); int m_length; public slots: void play( const QString& fileName ); void stop( bool ); void pause( bool ); void setFullscreen( bool ); long currentTime(); void seekTo( long ); // get length of media file and set it void length(); long position(); - + void nextMedia(); void videoResized ( const QSize &s ); private: XINE::Lib *libXine; MediaDetect mdetect; long m_currentTime; long m_position; QString m_fileName; signals: void positionChanged( long ); }; #endif |