summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-13 22:12:49 (UTC)
committer simon <simon>2002-12-13 22:12:49 (UTC)
commit43ebe08628369c245da597555909025942f4ac0c (patch) (unidiff)
tree4b5a25d48afc481de153a2b0103964b03142e43b
parentde449c83cf37a64a9d2df586f6d1acecf3bc0c6e (diff)
downloadopie-43ebe08628369c245da597555909025942f4ac0c.zip
opie-43ebe08628369c245da597555909025942f4ac0c.tar.gz
opie-43ebe08628369c245da597555909025942f4ac0c.tar.bz2
- added a second constructor that takes a XINE::Lib object (and takes
ownership of it)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h7
2 files changed, 20 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index ee2cd83..efa9934 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,256 +1,269 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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 <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include "xinecontrol.h" 39#include "xinecontrol.h"
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41#include "xinevideowidget.h" 41#include "xinevideowidget.h"
42 42
43XineControl::XineControl( XineVideoWidget *xineWidget, 43XineControl::XineControl( XineVideoWidget *xineWidget,
44 MediaPlayerState &_mediaPlayerState, 44 MediaPlayerState &_mediaPlayerState,
45 QObject *parent, const char *name ) 45 QObject *parent, const char *name )
46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
47{ 47{
48 48
49 libXine = new XINE::Lib( xineWidget ); 49 libXine = new XINE::Lib( xineWidget );
50 50
51 init();
52}
53
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{
59 init();
60}
61
62void XineControl::init()
63{
51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 64 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 65 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 66 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 67 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 68 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 69 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 70 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 71 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
59 72
60 disabledSuspendScreenSaver = FALSE; 73 disabledSuspendScreenSaver = FALSE;
61} 74}
62 75
63XineControl::~XineControl() { 76XineControl::~XineControl() {
64#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 77#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
65 if ( disabledSuspendScreenSaver ) { 78 if ( disabledSuspendScreenSaver ) {
66 disabledSuspendScreenSaver = FALSE; 79 disabledSuspendScreenSaver = FALSE;
67 // Re-enable the suspend mode 80 // Re-enable the suspend mode
68 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 81 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
69 } 82 }
70#endif 83#endif
71 delete libXine; 84 delete libXine;
72} 85}
73 86
74void XineControl::play( const QString& fileName ) { 87void XineControl::play( const QString& fileName ) {
75 hasVideoChannel = FALSE; 88 hasVideoChannel = FALSE;
76 hasAudioChannel = FALSE; 89 hasAudioChannel = FALSE;
77 m_fileName = fileName; 90 m_fileName = fileName;
78 91
79 qDebug("<<FILENAME: " + fileName + ">>>>"); 92 qDebug("<<FILENAME: " + fileName + ">>>>");
80 93
81 if ( !libXine->play( fileName, 0, 0 ) ) { 94 if ( !libXine->play( fileName, 0, 0 ) ) {
82 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 95 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
83 // toggle stop so the the play button is reset 96 // toggle stop so the the play button is reset
84 mediaPlayerState.setPlaying( false ); 97 mediaPlayerState.setPlaying( false );
85 return; 98 return;
86 } 99 }
87 mediaPlayerState.setPlaying( true ); 100 mediaPlayerState.setPlaying( true );
88 101
89 MediaPlayerState::DisplayType displayType; 102 MediaPlayerState::DisplayType displayType;
90 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 103 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
91 if ( !libXine->hasVideo() ) { 104 if ( !libXine->hasVideo() ) {
92 displayType = MediaPlayerState::Audio; 105 displayType = MediaPlayerState::Audio;
93 qDebug("HAS AUDIO"); 106 qDebug("HAS AUDIO");
94 libXine->setShowVideo( false ); 107 libXine->setShowVideo( false );
95 hasAudioChannel = TRUE; 108 hasAudioChannel = TRUE;
96 } else { 109 } else {
97 displayType = MediaPlayerState::Video; 110 displayType = MediaPlayerState::Video;
98 qDebug("HAS VIDEO"); 111 qDebug("HAS VIDEO");
99 libXine->setShowVideo( true ); 112 libXine->setShowVideo( true );
100 hasVideoChannel = TRUE; 113 hasVideoChannel = TRUE;
101 } 114 }
102 // determine if slider is shown 115 // determine if slider is shown
103 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 116 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
104 117
105 // which gui (video / audio) 118 // which gui (video / audio)
106 mediaPlayerState.setDisplayType( displayType ); 119 mediaPlayerState.setDisplayType( displayType );
107 120
108#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 121#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
109 if ( !disabledSuspendScreenSaver ) { 122 if ( !disabledSuspendScreenSaver ) {
110 disabledSuspendScreenSaver = TRUE; 123 disabledSuspendScreenSaver = TRUE;
111 // Stop the screen from blanking and power saving state 124 // Stop the screen from blanking and power saving state
112 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 125 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
113 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 126 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
114 } 127 }
115#endif 128#endif
116 129
117 length(); 130 length();
118 position(); 131 position();
119} 132}
120 133
121void XineControl::nextMedia() { 134void XineControl::nextMedia() {
122 mediaPlayerState.setNext(); 135 mediaPlayerState.setNext();
123} 136}
124 137
125void XineControl::setGamma( int value ) { 138void XineControl::setGamma( int value ) {
126 libXine->setGamma( value ); 139 libXine->setGamma( value );
127} 140}
128 141
129void XineControl::stop( bool isSet ) { 142void XineControl::stop( bool isSet ) {
130 if ( !isSet ) { 143 if ( !isSet ) {
131 libXine->stop(); 144 libXine->stop();
132 145
133#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 146#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
134 if ( disabledSuspendScreenSaver ) { 147 if ( disabledSuspendScreenSaver ) {
135 disabledSuspendScreenSaver = FALSE; 148 disabledSuspendScreenSaver = FALSE;
136 // Re-enable the suspend mode 149 // Re-enable the suspend mode
137 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 150 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
138 } 151 }
139#endif 152#endif
140 } 153 }
141} 154}
142 155
143/** 156/**
144 * Pause playback 157 * Pause playback
145 * @isSet 158 * @isSet
146 */ 159 */
147void XineControl::pause( bool isSet) { 160void XineControl::pause( bool isSet) {
148 libXine->pause( isSet ); 161 libXine->pause( isSet );
149} 162}
150 163
151 164
152/** 165/**
153 * get current time in playback 166 * get current time in playback
154 */ 167 */
155long XineControl::currentTime() { 168long XineControl::currentTime() {
156 // todo: jede sekunde überprüfen 169 // todo: jede sekunde überprüfen
157 m_currentTime = libXine->currentTime(); 170 m_currentTime = libXine->currentTime();
158 return m_currentTime; 171 return m_currentTime;
159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 172 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
160} 173}
161 174
162/** 175/**
163 * Set the length of the media file 176 * Set the length of the media file
164 */ 177 */
165void XineControl::length() { 178void XineControl::length() {
166 m_length = libXine->length(); 179 m_length = libXine->length();
167 mediaPlayerState.setLength( m_length ); 180 mediaPlayerState.setLength( m_length );
168} 181}
169 182
170 183
171/** 184/**
172 * Reports the position the xine backend is at right now 185 * Reports the position the xine backend is at right now
173 * @return long the postion in seconds 186 * @return long the postion in seconds
174 */ 187 */
175long XineControl::position() { 188long XineControl::position() {
176 m_position = ( currentTime() ); 189 m_position = ( currentTime() );
177 mediaPlayerState.updatePosition( m_position ); 190 mediaPlayerState.updatePosition( m_position );
178 long emitPos = (long)m_position; 191 long emitPos = (long)m_position;
179 emit positionChanged( emitPos ); 192 emit positionChanged( emitPos );
180 if( mediaPlayerState.isPlaying() ) { 193 if( mediaPlayerState.isPlaying() ) {
181 // needs to be stopped the media is stopped 194 // needs to be stopped the media is stopped
182 QTimer::singleShot( 1000, this, SLOT( position() ) ); 195 QTimer::singleShot( 1000, this, SLOT( position() ) );
183 } 196 }
184 // qDebug("POSITION : %d", m_position); 197 // qDebug("POSITION : %d", m_position);
185 return m_position; 198 return m_position;
186} 199}
187 200
188/** 201/**
189 * Set videoplayback to fullscreen 202 * Set videoplayback to fullscreen
190 * @param isSet 203 * @param isSet
191 */ 204 */
192void XineControl::setFullscreen( bool isSet ) { 205void XineControl::setFullscreen( bool isSet ) {
193 libXine->showVideoFullScreen( isSet ); 206 libXine->showVideoFullScreen( isSet );
194} 207}
195 208
196 209
197QString XineControl::getMetaInfo() { 210QString XineControl::getMetaInfo() {
198 211
199 QString returnString; 212 QString returnString;
200 213
201 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 214 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
202 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 215 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
203 } 216 }
204 217
205 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 218 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 219 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
207 } 220 }
208 221
209 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 222 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 223 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
211 } 224 }
212 225
213 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 226 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 227 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
215 } 228 }
216 229
217 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 230 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 231 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
219 } 232 }
220 233
221 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 234 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 235 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
223 } 236 }
224 return returnString; 237 return returnString;
225} 238}
226 239
227QString XineControl::getErrorCode() { 240QString XineControl::getErrorCode() {
228 241
229 int errorCode = libXine->error(); 242 int errorCode = libXine->error();
230 243
231 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 244 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
232 245
233 if ( errorCode == 1 ) { 246 if ( errorCode == 1 ) {
234 return tr( "No input plugin found for this media type" ); 247 return tr( "No input plugin found for this media type" );
235 } else if ( errorCode == 2 ) { 248 } else if ( errorCode == 2 ) {
236 return tr( "No demux plugin found for this media type" ); 249 return tr( "No demux plugin found for this media type" );
237 } else if ( errorCode == 3 ) { 250 } else if ( errorCode == 3 ) {
238 return tr( "Demuxing failed for this media type" ); 251 return tr( "Demuxing failed for this media type" );
239 } else if ( errorCode == 4 ) { 252 } else if ( errorCode == 4 ) {
240 return tr( "Malformed MRL" ); 253 return tr( "Malformed MRL" );
241 } else { 254 } else {
242 return tr( "Some other error" ); 255 return tr( "Some other error" );
243 } 256 }
244} 257}
245 258
246/** 259/**
247 * Seek to a position in the track 260 * Seek to a position in the track
248 * @param second the second to jump to 261 * @param second the second to jump to
249 */ 262 */
250void XineControl::seekTo( long second ) { 263void XineControl::seekTo( long second ) {
251 libXine->seekTo( (int)second ); 264 libXine->seekTo( (int)second );
252} 265}
253 266
254void XineControl::videoResized ( const QSize &s ) { 267void XineControl::videoResized ( const QSize &s ) {
255 libXine->resize( s ); 268 libXine->resize( s );
256} 269}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index fdc5d2b..0e985d6 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,120 +1,127 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38#include <qobject.h> 38#include <qobject.h>
39 39
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41 41
42class XineControl : public QObject { 42class XineControl : public QObject {
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 XineControl( XineVideoWidget *xineWidget, 45 XineControl( XineVideoWidget *xineWidget,
46 MediaPlayerState &_mediaPlayerState, 46 MediaPlayerState &_mediaPlayerState,
47 QObject *parent = 0, const char *name =0 ); 47 QObject *parent = 0, const char *name =0 );
48 // note that this constructor takes over ownership of the passed
49 // XINE::Lib object.
50 XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
51 MediaPlayerState &_mediaPlayerState,
52 QObject *parent = 0, const char *name =0 );
48 ~XineControl(); 53 ~XineControl();
49 54
50 bool hasVideo() const { return hasVideoChannel; } 55 bool hasVideo() const { return hasVideoChannel; }
51 bool hasAudio() const { return hasAudioChannel; } 56 bool hasAudio() const { return hasAudioChannel; }
52 57
53public slots: 58public slots:
54 void play( const QString& fileName ); 59 void play( const QString& fileName );
55 void stop( bool ); 60 void stop( bool );
56 61
57 /** 62 /**
58 * Pause the media stream 63 * Pause the media stream
59 * @param if pause or not 64 * @param if pause or not
60 */ 65 */
61 void pause( bool ); 66 void pause( bool );
62 67
63 /** 68 /**
64 * Set videos fullscreen 69 * Set videos fullscreen
65 * @param yes or no 70 * @param yes or no
66 */ 71 */
67 void setFullscreen( bool ); 72 void setFullscreen( bool );
68 73
69 /** 74 /**
70 * 75 *
71 */ 76 */
72 long currentTime(); 77 long currentTime();
73 void seekTo( long ); 78 void seekTo( long );
74 // get length of media file and set it 79 // get length of media file and set it
75 void length(); 80 void length();
76 long position(); 81 long position();
77 82
78 /** 83 /**
79 * Proceed to the next media file in playlist 84 * Proceed to the next media file in playlist
80 */ 85 */
81 void nextMedia(); 86 void nextMedia();
82 87
83 /** 88 /**
84 * Get as much info about the stream from xine as possible 89 * Get as much info about the stream from xine as possible
85 */ 90 */
86 QString getMetaInfo(); 91 QString getMetaInfo();
87 92
88 /** 93 /**
89 * get the error code and "translate" it for the user 94 * get the error code and "translate" it for the user
90 * 95 *
91 */ 96 */
92 QString getErrorCode(); 97 QString getErrorCode();
93 98
94 99
95 void videoResized ( const QSize &s ); 100 void videoResized ( const QSize &s );
96 101
97 /** 102 /**
98 * Set the gamma value of the video output 103 * Set the gamma value of the video output
99 * @param int value between -100 and 100, 0 is original 104 * @param int value between -100 and 100, 0 is original
100 */ 105 */
101 void setGamma( int ); 106 void setGamma( int );
102 107
103private: 108private:
109 void init();
110
104 XINE::Lib *libXine; 111 XINE::Lib *libXine;
105 long m_currentTime; 112 long m_currentTime;
106 long m_position; 113 long m_position;
107 int m_length; 114 int m_length;
108 QString m_fileName; 115 QString m_fileName;
109 bool disabledSuspendScreenSaver : 1; 116 bool disabledSuspendScreenSaver : 1;
110 bool hasVideoChannel : 1; 117 bool hasVideoChannel : 1;
111 bool hasAudioChannel : 1; 118 bool hasAudioChannel : 1;
112 MediaPlayerState &mediaPlayerState; 119 MediaPlayerState &mediaPlayerState;
113 XineVideoWidget *xineVideoWidget; 120 XineVideoWidget *xineVideoWidget;
114 121
115signals: 122signals:
116 void positionChanged( long ); 123 void positionChanged( long );
117}; 124};
118 125
119 126
120#endif 127#endif