summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-05 23:58:16 (UTC)
committer harlekin <harlekin>2002-08-05 23:58:16 (UTC)
commitd96244956f42782f987acc2b5efb32dc1f1dd70a (patch) (unidiff)
tree0e1652d36a7ee2b38568fb5686057864b03bf85a
parent6577ed5401ef1374b57a58dd459e91c10899e097 (diff)
downloadopie-d96244956f42782f987acc2b5efb32dc1f1dd70a.zip
opie-d96244956f42782f987acc2b5efb32dc1f1dd70a.tar.gz
opie-d96244956f42782f987acc2b5efb32dc1f1dd70a.tar.bz2
pause should be right now
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index cf7dcb2..eba837e 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -4,154 +4,158 @@
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include "xinecontrol.h" 36#include "xinecontrol.h"
37#include "mediaplayerstate.h" 37#include "mediaplayerstate.h"
38#include "videowidget.h" 38#include "videowidget.h"
39 39
40extern MediaPlayerState *mediaPlayerState; 40extern MediaPlayerState *mediaPlayerState;
41extern VideoWidget *videoUI; 41extern VideoWidget *videoUI;
42XineControl::XineControl( QObject *parent, const char *name ) 42XineControl::XineControl( QObject *parent, const char *name )
43 : QObject( parent, name ) { 43 : QObject( parent, name ) {
44 libXine = new XINE::Lib(videoUI->vidWidget() ); 44 libXine = new XINE::Lib(videoUI->vidWidget() );
45 45
46 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); 46 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
47 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); 47 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
48 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 48 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
49 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 49 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
50 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 50 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
51 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 51 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
52} 52}
53 53
54XineControl::~XineControl() { 54XineControl::~XineControl() {
55 delete libXine; 55 delete libXine;
56} 56}
57 57
58void XineControl::play( const QString& fileName ) { 58void XineControl::play( const QString& fileName ) {
59 m_fileName = fileName; 59 m_fileName = fileName;
60 libXine->play( fileName ); 60 libXine->play( fileName );
61 mediaPlayerState->setPlaying( true ); 61 mediaPlayerState->setPlaying( true );
62 // default to audio view until we know how to handle video 62 // default to audio view until we know how to handle video
63 // MediaDetect mdetect; 63 // MediaDetect mdetect;
64 char whichGui = mdetect.videoOrAudio( fileName ); 64 char whichGui = mdetect.videoOrAudio( fileName );
65 if (whichGui == 'f') { 65 if (whichGui == 'f') {
66 qDebug("Nicht erkannter Dateityp"); 66 qDebug("Nicht erkannter Dateityp");
67 return; 67 return;
68 } 68 }
69 69
70 if (whichGui == 'a') { 70 if (whichGui == 'a') {
71 libXine->setShowVideo( false ); 71 libXine->setShowVideo( false );
72 } else { 72 } else {
73 libXine->setShowVideo( true ); 73 libXine->setShowVideo( true );
74 } 74 }
75 75
76 // determine if slider is shown 76 // determine if slider is shown
77 // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); 77 // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
78 mediaPlayerState->setIsStreaming( libXine->isSeekable() ); 78 mediaPlayerState->setIsStreaming( libXine->isSeekable() );
79 // which gui (video / audio) 79 // which gui (video / audio)
80 mediaPlayerState->setView( whichGui ); 80 mediaPlayerState->setView( whichGui );
81 length(); 81 length();
82 position(); 82 position();
83} 83}
84 84
85void XineControl::stop( bool isSet ) { 85void XineControl::stop( bool isSet ) {
86 if ( !isSet) { 86 if ( !isSet) {
87 libXine->stop(); 87 libXine->stop();
88 mediaPlayerState->setList(); 88 mediaPlayerState->setList();
89 //mediaPlayerState->setPlaying( false ); 89 //mediaPlayerState->setPlaying( false );
90 } else { 90 } else {
91 // play again 91 // play again
92 } 92 }
93} 93}
94 94
95/** 95/**
96 * Pause playback 96 * Pause playback
97 * @isSet 97 * @isSet
98 */ 98 */
99void XineControl::pause( bool isSet) { 99void XineControl::pause( bool isSet) {
100 libXine->pause(); 100 if (isSet) {
101 libXine->pause();
102 } else {
103 libXine->play( m_fileName, 0, m_currentTime);
104 }
101} 105}
102 106
103 107
104/** 108/**
105 * get current time in playback 109 * get current time in playback
106 */ 110 */
107long XineControl::currentTime() { 111long XineControl::currentTime() {
108 // todo: jede sekunde überprüfen 112 // todo: jede sekunde überprüfen
109 m_currentTime = libXine->currentTime(); 113 m_currentTime = libXine->currentTime();
110 return m_currentTime; 114 return m_currentTime;
111 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 115 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
112} 116}
113 117
114/** 118/**
115 * Set the length of the media file 119 * Set the length of the media file
116 */ 120 */
117void XineControl::length() { 121void XineControl::length() {
118 m_length = libXine->length(); 122 m_length = libXine->length();
119 mediaPlayerState->setLength( m_length ); 123 mediaPlayerState->setLength( m_length );
120} 124}
121 125
122 126
123/** 127/**
124 * Reports the position the xine backend is at right now 128 * Reports the position the xine backend is at right now
125 * @return long the postion in seconds 129 * @return long the postion in seconds
126 */ 130 */
127long XineControl::position() { 131long XineControl::position() {
128 m_position = ( currentTime() ); 132 m_position = ( currentTime() );
129 mediaPlayerState->updatePosition( m_position ); 133 mediaPlayerState->updatePosition( m_position );
130 long emitPos = (long)m_position; 134 long emitPos = (long)m_position;
131 emit positionChanged( emitPos ); 135 emit positionChanged( emitPos );
132 if(mediaPlayerState->isPlaying) 136 if(mediaPlayerState->isPlaying)
133 // needs to be stopped the media is stopped 137 // needs to be stopped the media is stopped
134 QTimer::singleShot( 1000, this, SLOT( position() ) ); 138 QTimer::singleShot( 1000, this, SLOT( position() ) );
135// qDebug("POSITION : %d", m_position); 139// qDebug("POSITION : %d", m_position);
136 return m_position; 140 return m_position;
137} 141}
138 142
139/** 143/**
140 * Set videoplayback to fullscreen 144 * Set videoplayback to fullscreen
141 * @param isSet 145 * @param isSet
142 */ 146 */
143void XineControl::setFullscreen( bool isSet ) { 147void XineControl::setFullscreen( bool isSet ) {
144 libXine->showVideoFullScreen( isSet); 148 libXine->showVideoFullScreen( isSet);
145} 149}
146 150
147/** 151/**
148 * Seek to a position in the track 152 * Seek to a position in the track
149 * @param second the second to jump to 153 * @param second the second to jump to
150 */ 154 */
151void XineControl::seekTo( long second ) { 155void XineControl::seekTo( long second ) {
152 libXine->play( m_fileName , 0, (int)second ); 156 libXine->play( m_fileName , 0, (int)second );
153} 157}
154 158
155void XineControl::videoResized ( const QSize &s ) { 159void XineControl::videoResized ( const QSize &s ) {
156 libXine-> resize ( s ); 160 libXine-> resize ( s );
157} 161}