summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinecontrol.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 9f944d7..e1816c8 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -72,59 +72,57 @@ void XineControl::init()
72 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); 72 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
73 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); 73 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
74 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); 74 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
75 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); 75 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
76 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); 76 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
77 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 77 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
78 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); 78 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
79 79
80 disabledSuspendScreenSaver = FALSE; 80 disabledSuspendScreenSaver = FALSE;
81} 81}
82 82
83XineControl::~XineControl() { 83XineControl::~XineControl() {
84#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 84#if !defined(QT_NO_COP)
85 if ( disabledSuspendScreenSaver ) { 85 if ( disabledSuspendScreenSaver ) {
86 disabledSuspendScreenSaver = FALSE; 86 disabledSuspendScreenSaver = FALSE;
87 // Re-enable the suspend mode 87 // Re-enable the suspend mode
88 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 88 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
89 } 89 }
90#endif 90#endif
91 delete libXine; 91 delete libXine;
92} 92}
93 93
94void XineControl::play( const QString& fileName ) { 94void XineControl::play( const QString& fileName ) {
95 95
96 hasVideoChannel = FALSE; 96 hasVideoChannel = FALSE;
97 hasAudioChannel = FALSE; 97 hasAudioChannel = FALSE;
98 m_fileName = fileName; 98 m_fileName = fileName;
99 99
100 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; 100 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
101 101
102 if ( !libXine->play( fileName, 0, 0 ) ) { 102 if ( !libXine->play( fileName, 0, 0 ) ) {
103 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 103 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
104 // toggle stop so the the play button is reset 104 // toggle stop so the the play button is reset
105 mediaPlayerState.setPlaying( false ); 105 mediaPlayerState.setPlaying( false );
106 return; 106 return;
107 } 107 }
108 mediaPlayerState.setPlaying( true ); 108 mediaPlayerState.setPlaying( true );
109 109
110 MediaPlayerState::DisplayType displayType; 110 MediaPlayerState::DisplayType displayType;
111 if ( !libXine->hasVideo() ) { 111 if ( !libXine->hasVideo() ) {
112 displayType = MediaPlayerState::Audio; 112 displayType = MediaPlayerState::Audio;
113 odebug << "HAS AUDIO" << oendl;
114 libXine->setShowVideo( false ); 113 libXine->setShowVideo( false );
115 hasAudioChannel = TRUE; 114 hasAudioChannel = TRUE;
116 } else { 115 } else {
117 displayType = MediaPlayerState::Video; 116 displayType = MediaPlayerState::Video;
118 odebug << "HAS VIDEO" << oendl;
119 libXine->setShowVideo( true ); 117 libXine->setShowVideo( true );
120 hasVideoChannel = TRUE; 118 hasVideoChannel = TRUE;
121 } 119 }
122 // determine if slider is shown 120 // determine if slider is shown
123 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 121 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
124 122
125 // which gui (video / audio) 123 // which gui (video / audio)
126 mediaPlayerState.setDisplayType( displayType ); 124 mediaPlayerState.setDisplayType( displayType );
127 125
128#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 126#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
129 if ( !disabledSuspendScreenSaver ) { 127 if ( !disabledSuspendScreenSaver ) {
130 disabledSuspendScreenSaver = TRUE; 128 disabledSuspendScreenSaver = TRUE;
@@ -141,25 +139,25 @@ void XineControl::play( const QString& fileName ) {
141void XineControl::nextMedia() { 139void XineControl::nextMedia() {
142 mediaPlayerState.setNext(); 140 mediaPlayerState.setNext();
143} 141}
144 142
145void XineControl::setGamma( int value ) { 143void XineControl::setGamma( int value ) {
146 libXine->setGamma( value ); 144 libXine->setGamma( value );
147} 145}
148 146
149void XineControl::stop( bool isSet ) { 147void XineControl::stop( bool isSet ) {
150 if ( !isSet ) { 148 if ( !isSet ) {
151 libXine->stop(); 149 libXine->stop();
152 150
153#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 151#if !defined(QT_NO_COP)
154 if ( disabledSuspendScreenSaver ) { 152 if ( disabledSuspendScreenSaver ) {
155 disabledSuspendScreenSaver = FALSE; 153 disabledSuspendScreenSaver = FALSE;
156 // Re-enable the suspend mode 154 // Re-enable the suspend mode
157 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 155 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
158 } 156 }
159#endif 157#endif
160 } 158 }
161} 159}
162 160
163/** 161/**
164 * Pause playback 162 * Pause playback
165 * @isSet 163 * @isSet
@@ -167,25 +165,24 @@ void XineControl::stop( bool isSet ) {
167void XineControl::pause( bool isSet) { 165void XineControl::pause( bool isSet) {
168 libXine->pause( isSet ); 166 libXine->pause( isSet );
169} 167}
170 168
171 169
172/** 170/**
173 * get current time in playback 171 * get current time in playback
174 */ 172 */
175long XineControl::currentTime() { 173long XineControl::currentTime() {
176 // todo: jede sekunde überprüfen 174 // todo: jede sekunde überprüfen
177 m_currentTime = libXine->currentTime(); 175 m_currentTime = libXine->currentTime();
178 return m_currentTime; 176 return m_currentTime;
179 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
180} 177}
181 178
182/** 179/**
183 * Set the length of the media file 180 * Set the length of the media file
184 */ 181 */
185void XineControl::length() { 182void XineControl::length() {
186 m_length = libXine->length(); 183 m_length = libXine->length();
187 mediaPlayerState.setLength( m_length ); 184 mediaPlayerState.setLength( m_length );
188} 185}
189 186
190 187
191/** 188/**
@@ -238,34 +235,36 @@ QString XineControl::getMetaInfo() {
238 } 235 }
239 236
240 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 237 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
241 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 238 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
242 } 239 }
243 return returnString; 240 return returnString;
244} 241}
245 242
246QString XineControl::getErrorCode() { 243QString XineControl::getErrorCode() {
247 244
248 int errorCode = libXine->error(); 245 int errorCode = libXine->error();
249 246
250 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; 247 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
251 248
252 if ( errorCode == 1 ) { 249 if ( errorCode == 1 ) {
253 return tr( "No input plugin found for this media type" ); 250 return tr( "No input plugin found for this media type" );
254 } else if ( errorCode == 2 ) { 251 } else if ( errorCode == 2 ) {
255 return tr( "No demux plugin found for this media type" ); 252 return tr( "No demux plugin found for this media type" );
256 } else if ( errorCode == 3 ) { 253 } else if ( errorCode == 3 ) {
257 return tr( "Demuxing failed for this media type" ); 254 return tr( "Demuxing failed for this media type" );
258 } else if ( errorCode == 4 ) { 255 } else if ( errorCode == 4 ) {
259 return tr( "Malformed MRL" ); 256 return tr( "Malformed MRL" );
257 } else if ( errorCode == 5 ) {
258 return tr( "Input failed" );
260 } else { 259 } else {
261 return tr( "Some other error" ); 260 return tr( "Some other error" );
262 } 261 }
263} 262}
264 263
265/** 264/**
266 * Seek to a position in the track 265 * Seek to a position in the track
267 * @param second the second to jump to 266 * @param second the second to jump to
268 */ 267 */
269void XineControl::seekTo( long second ) { 268void XineControl::seekTo( long second ) {
270 libXine->seekTo( (int)second ); 269 libXine->seekTo( (int)second );
271} 270}