summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h6
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp27
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.h4
5 files changed, 37 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 0d9a5b8..c230d6f 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -319,59 +319,59 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
319 switch ( e->key() ) { 319 switch ( e->key() ) {
320////////////////////////////// Zaurus keys 320////////////////////////////// Zaurus keys
321 case Key_Home: 321 case Key_Home:
322 break; 322 break;
323 case Key_F9: //activity 323 case Key_F9: //activity
324 break; 324 break;
325 case Key_F10: //contacts 325 case Key_F10: //contacts
326 break; 326 break;
327 case Key_F11: //menu 327 case Key_F11: //menu
328 break; 328 break;
329 case Key_F12: //home 329 case Key_F12: //home
330 qDebug("Blank here"); 330 qDebug("Blank here");
331// mediaPlayerState->toggleBlank(); 331// mediaPlayerState->toggleBlank();
332 break; 332 break;
333 case Key_F13: //mail 333 case Key_F13: //mail
334 qDebug("Blank here"); 334 qDebug("Blank here");
335 // mediaPlayerState->toggleBlank(); 335 // mediaPlayerState->toggleBlank();
336 break; 336 break;
337 } 337 }
338} 338}
339 339
340void MediaPlayer::cleanUp() {// this happens on closing 340void MediaPlayer::cleanUp() {// this happens on closing
341 Config cfg( "OpiePlayer" ); 341 Config cfg( "OpiePlayer" );
342 mediaPlayerState.writeConfig( cfg ); 342 mediaPlayerState.writeConfig( cfg );
343 playList.writeDefaultPlaylist( ); 343 playList.writeDefaultPlaylist( );
344 344
345// QPEApplication::grabKeyboard(); 345// QPEApplication::grabKeyboard();
346// QPEApplication::ungrabKeyboard(); 346// QPEApplication::ungrabKeyboard();
347} 347}
348 348
349void MediaPlayer::recreateAudioAndVideoWidgets() 349void MediaPlayer::recreateAudioAndVideoWidgets()
350{ 350{
351 delete xineControl; 351 delete xineControl;
352 delete audioUI; 352 delete audioUI;
353 delete videoUI; 353 delete videoUI;
354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
356 356
357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
361 361
362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
366 366
367 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); 367 xineControl = new XineControl( videoUI->vidWidget(), mediaPlayerState );
368 connect( xineControl, SIGNAL( initialized() ), 368 connect( xineControl, SIGNAL( initialized() ),
369 &mediaPlayerState, SLOT( setBackendInitialized() ) ); 369 &mediaPlayerState, SLOT( setBackendInitialized() ) );
370} 370}
371 371
372void MediaPlayer::reloadSkins() 372void MediaPlayer::reloadSkins()
373{ 373{
374 audioUI->loadSkin(); 374 audioUI->loadSkin();
375 videoUI->loadSkin(); 375 videoUI->loadSkin();
376} 376}
377 377
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 14e71d9..e791c3b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,176 +1,184 @@
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 42
42XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, 43XineControl::XineControl( XineVideoWidget *xineWidget,
43 MediaPlayerState &_mediaPlayerState, 44 MediaPlayerState &_mediaPlayerState,
44 QObject *parent, const char *name ) 45 QObject *parent, const char *name )
45 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) 46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
46{ 47{
47 48
48 libXine = new XINE::Lib( xineWidget ); 49 libXine = new XINE::Lib( xineWidget );
49 50
50 connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 connect( libXine, SIGNAL( initialized() ), this, SIGNAL( initialized() ) ); 58 connect( libXine, SIGNAL( initialized() ), this, SLOT( xineInitialized() ) );
59 59
60 disabledSuspendScreenSaver = FALSE; 60 disabledSuspendScreenSaver = FALSE;
61} 61}
62 62
63XineControl::~XineControl() { 63XineControl::~XineControl() {
64#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 64#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
65 if ( disabledSuspendScreenSaver ) { 65 if ( disabledSuspendScreenSaver ) {
66 disabledSuspendScreenSaver = FALSE; 66 disabledSuspendScreenSaver = FALSE;
67 // Re-enable the suspend mode 67 // Re-enable the suspend mode
68 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 68 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
69 } 69 }
70#endif 70#endif
71 delete libXine; 71 delete libXine;
72} 72}
73 73
74void XineControl::play( const QString& fileName ) { 74void XineControl::play( const QString& fileName ) {
75 hasVideoChannel = FALSE; 75 hasVideoChannel = FALSE;
76 hasAudioChannel = FALSE; 76 hasAudioChannel = FALSE;
77 m_fileName = fileName; 77 m_fileName = fileName;
78 78
79 qDebug("<<FILENAME: " + fileName + ">>>>"); 79 qDebug("<<FILENAME: " + fileName + ">>>>");
80 80
81 if ( !libXine->play( fileName, 0, 0 ) ) { 81 if ( !libXine->play( fileName, 0, 0 ) ) {
82 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 82 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
83 // toggle stop so the the play button is reset 83 // toggle stop so the the play button is reset
84 mediaPlayerState.setPlaying( false ); 84 mediaPlayerState.setPlaying( false );
85 return; 85 return;
86 } 86 }
87 mediaPlayerState.setPlaying( true ); 87 mediaPlayerState.setPlaying( true );
88 88
89 MediaPlayerState::DisplayType displayType; 89 MediaPlayerState::DisplayType displayType;
90 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 90 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
91 if ( !libXine->hasVideo() ) { 91 if ( !libXine->hasVideo() ) {
92 displayType = MediaPlayerState::Audio; 92 displayType = MediaPlayerState::Audio;
93 qDebug("HAS AUDIO"); 93 qDebug("HAS AUDIO");
94 libXine->setShowVideo( false ); 94 libXine->setShowVideo( false );
95 hasAudioChannel = TRUE; 95 hasAudioChannel = TRUE;
96 } else { 96 } else {
97 displayType = MediaPlayerState::Video; 97 displayType = MediaPlayerState::Video;
98 qDebug("HAS VIDEO"); 98 qDebug("HAS VIDEO");
99 libXine->setShowVideo( true ); 99 libXine->setShowVideo( true );
100 hasVideoChannel = TRUE; 100 hasVideoChannel = TRUE;
101 } 101 }
102 // determine if slider is shown 102 // determine if slider is shown
103 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 103 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
104 104
105 // which gui (video / audio) 105 // which gui (video / audio)
106 mediaPlayerState.setDisplayType( displayType ); 106 mediaPlayerState.setDisplayType( displayType );
107 107
108#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 108#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
109 if ( !disabledSuspendScreenSaver ) { 109 if ( !disabledSuspendScreenSaver ) {
110 disabledSuspendScreenSaver = TRUE; 110 disabledSuspendScreenSaver = TRUE;
111 // Stop the screen from blanking and power saving state 111 // Stop the screen from blanking and power saving state
112 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 112 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
113 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 113 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
114 } 114 }
115#endif 115#endif
116 116
117 length(); 117 length();
118 position(); 118 position();
119} 119}
120 120
121void XineControl::nextMedia() { 121void XineControl::nextMedia() {
122 mediaPlayerState.setNext(); 122 mediaPlayerState.setNext();
123} 123}
124 124
125void XineControl::setGamma( int value ) { 125void XineControl::setGamma( int value ) {
126 libXine->setGamma( value ); 126 libXine->setGamma( value );
127} 127}
128 128
129void XineControl::xineInitialized()
130{
131 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
132 libXine->resize( xineVideoWidget->videoSize() );
133
134 emit initialized();
135}
136
129void XineControl::stop( bool isSet ) { 137void XineControl::stop( bool isSet ) {
130 if ( !isSet ) { 138 if ( !isSet ) {
131 libXine->stop(); 139 libXine->stop();
132 140
133#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 141#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
134 if ( disabledSuspendScreenSaver ) { 142 if ( disabledSuspendScreenSaver ) {
135 disabledSuspendScreenSaver = FALSE; 143 disabledSuspendScreenSaver = FALSE;
136 // Re-enable the suspend mode 144 // Re-enable the suspend mode
137 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 145 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
138 } 146 }
139#endif 147#endif
140 } 148 }
141} 149}
142 150
143/** 151/**
144 * Pause playback 152 * Pause playback
145 * @isSet 153 * @isSet
146 */ 154 */
147void XineControl::pause( bool isSet) { 155void XineControl::pause( bool isSet) {
148 libXine->pause( isSet ); 156 libXine->pause( isSet );
149} 157}
150 158
151 159
152/** 160/**
153 * get current time in playback 161 * get current time in playback
154 */ 162 */
155long XineControl::currentTime() { 163long XineControl::currentTime() {
156 // todo: jede sekunde überprüfen 164 // todo: jede sekunde überprüfen
157 m_currentTime = libXine->currentTime(); 165 m_currentTime = libXine->currentTime();
158 return m_currentTime; 166 return m_currentTime;
159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 167 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
160} 168}
161 169
162/** 170/**
163 * Set the length of the media file 171 * Set the length of the media file
164 */ 172 */
165void XineControl::length() { 173void XineControl::length() {
166 m_length = libXine->length(); 174 m_length = libXine->length();
167 mediaPlayerState.setLength( m_length ); 175 mediaPlayerState.setLength( m_length );
168} 176}
169 177
170 178
171/** 179/**
172 * Reports the position the xine backend is at right now 180 * Reports the position the xine backend is at right now
173 * @return long the postion in seconds 181 * @return long the postion in seconds
174 */ 182 */
175long XineControl::position() { 183long XineControl::position() {
176 m_position = ( currentTime() ); 184 m_position = ( currentTime() );
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 000529c..085de3f 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,122 +1,126 @@
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( QWidget *videoContainerWidget, 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 ~XineControl(); 48 ~XineControl();
49 49
50 bool hasVideo() const { return hasVideoChannel; } 50 bool hasVideo() const { return hasVideoChannel; }
51 bool hasAudio() const { return hasAudioChannel; } 51 bool hasAudio() const { return hasAudioChannel; }
52 52
53public slots: 53public slots:
54 void play( const QString& fileName ); 54 void play( const QString& fileName );
55 void stop( bool ); 55 void stop( bool );
56 56
57 /** 57 /**
58 * Pause the media stream 58 * Pause the media stream
59 * @param if pause or not 59 * @param if pause or not
60 */ 60 */
61 void pause( bool ); 61 void pause( bool );
62 62
63 /** 63 /**
64 * Set videos fullscreen 64 * Set videos fullscreen
65 * @param yes or no 65 * @param yes or no
66 */ 66 */
67 void setFullscreen( bool ); 67 void setFullscreen( bool );
68 68
69 /** 69 /**
70 * 70 *
71 */ 71 */
72 long currentTime(); 72 long currentTime();
73 void seekTo( long ); 73 void seekTo( long );
74 // get length of media file and set it 74 // get length of media file and set it
75 void length(); 75 void length();
76 long position(); 76 long position();
77 77
78 /** 78 /**
79 * Proceed to the next media file in playlist 79 * Proceed to the next media file in playlist
80 */ 80 */
81 void nextMedia(); 81 void nextMedia();
82 82
83 /** 83 /**
84 * Get as much info about the stream from xine as possible 84 * Get as much info about the stream from xine as possible
85 */ 85 */
86 QString getMetaInfo(); 86 QString getMetaInfo();
87 87
88 /** 88 /**
89 * get the error code and "translate" it for the user 89 * get the error code and "translate" it for the user
90 * 90 *
91 */ 91 */
92 QString getErrorCode(); 92 QString getErrorCode();
93 93
94 94
95 void videoResized ( const QSize &s ); 95 void videoResized ( const QSize &s );
96 96
97 /** 97 /**
98 * Set the gamma value of the video output 98 * Set the gamma value of the video output
99 * @param int value between -100 and 100, 0 is original 99 * @param int value between -100 and 100, 0 is original
100 */ 100 */
101 void setGamma( int ); 101 void setGamma( int );
102 102
103 103
104private slots:
105 void xineInitialized();
106
104private: 107private:
105 XINE::Lib *libXine; 108 XINE::Lib *libXine;
106 long m_currentTime; 109 long m_currentTime;
107 long m_position; 110 long m_position;
108 int m_length; 111 int m_length;
109 QString m_fileName; 112 QString m_fileName;
110 bool disabledSuspendScreenSaver : 1; 113 bool disabledSuspendScreenSaver : 1;
111 bool hasVideoChannel : 1; 114 bool hasVideoChannel : 1;
112 bool hasAudioChannel : 1; 115 bool hasAudioChannel : 1;
113 MediaPlayerState &mediaPlayerState; 116 MediaPlayerState &mediaPlayerState;
117 XineVideoWidget *xineVideoWidget;
114 118
115signals: 119signals:
116 void positionChanged( long ); 120 void positionChanged( long );
117 121
118 void initialized(); 122 void initialized();
119}; 123};
120 124
121 125
122#endif 126#endif
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 1d88cea..791818e 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -63,96 +63,111 @@ static inline void memcpy_rev ( void *dst, void *src, size_t len )
63static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step ) 63static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
64{ 64{
65 len >>= 1; 65 len >>= 1;
66 while ( len-- ) { 66 while ( len-- ) {
67 *((short int *) dst )++ = *((short int *) src ); 67 *((short int *) dst )++ = *((short int *) src );
68 ((char *) src ) += step; 68 ((char *) src ) += step;
69 } 69 }
70} 70}
71 71
72// 270 deg rot: copy a column from src to dst reversed 72// 270 deg rot: copy a column from src to dst reversed
73 73
74static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step ) 74static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step )
75{ 75{
76 len >>= 1; 76 len >>= 1;
77 77
78 ((char *) src ) += ( len * step ); 78 ((char *) src ) += ( len * step );
79 79
80 while ( len-- ) { 80 while ( len-- ) {
81 ((char *) src ) -= step; 81 ((char *) src ) -= step;
82 *((short int *) dst )++ = *((short int *) src ); 82 *((short int *) dst )++ = *((short int *) src );
83 } 83 }
84} 84}
85 85
86 86
87XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) 87XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name )
88 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) 88 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase )
89{ 89{
90 setBackgroundMode ( NoBackground ); 90 setBackgroundMode ( NoBackground );
91 91
92 m_logo = 0; 92 m_logo = 0;
93 m_buff = 0; 93 m_buff = 0;
94 m_bytes_per_line_fb = qt_screen-> linestep ( ); 94 m_bytes_per_line_fb = qt_screen-> linestep ( );
95 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; 95 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8;
96 m_rotation = 0; 96 m_rotation = 0;
97} 97}
98 98
99 99
100XineVideoWidget::~XineVideoWidget ( ) 100XineVideoWidget::~XineVideoWidget ( )
101{ 101{
102 delete m_logo; 102 delete m_logo;
103} 103}
104 104
105void XineVideoWidget::clear ( ) 105void XineVideoWidget::clear ( )
106{ 106{
107 m_buff = 0; 107 m_buff = 0;
108 repaint ( false ); 108 repaint ( false );
109} 109}
110 110
111QSize XineVideoWidget::videoSize() const
112{
113 QSize s = size();
114 bool fs = ( s == qApp->desktop()->size() );
115
116 // if we are in fullscreen mode, do not rotate the video
117 // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!)
118 m_rotation = fs ? - qt_screen->transformOrientation() : 0;
119
120 if ( fs && qt_screen->isTransformed() )
121 s = qt_screen->mapToDevice( s );
122
123 return s;
124}
125
111void XineVideoWidget::paintEvent ( QPaintEvent * ) 126void XineVideoWidget::paintEvent ( QPaintEvent * )
112{ 127{
113 if ( m_buff == 0 ) { 128 if ( m_buff == 0 ) {
114 QPainter p ( this ); 129 QPainter p ( this );
115 p. fillRect ( rect ( ), black ); 130 p. fillRect ( rect ( ), black );
116 if ( m_logo ) 131 if ( m_logo )
117 p. drawImage ( 0, 0, *m_logo ); 132 p. drawImage ( 0, 0, *m_logo );
118 } 133 }
119 else { 134 else {
120 // Qt needs to be notified which areas were really updated .. strange 135 // Qt needs to be notified which areas were really updated .. strange
121 QArray <QRect> qt_bug_workaround_clip_rects; 136 QArray <QRect> qt_bug_workaround_clip_rects;
122 137
123 { 138 {
124 QDirectPainter dp ( this ); 139 QDirectPainter dp ( this );
125 140
126 int rot = dp. transformOrientation ( ) + m_rotation; // device rotation + custom rotation 141 int rot = dp. transformOrientation ( ) + m_rotation; // device rotation + custom rotation
127 142
128 uchar *fb = dp. frameBuffer ( ); 143 uchar *fb = dp. frameBuffer ( );
129 uchar *frame = m_buff; 144 uchar *frame = m_buff;
130 145
131 // where is the video frame in fb coordinates 146 // where is the video frame in fb coordinates
132 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 147 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
133 148
134 qt_bug_workaround_clip_rects. resize ( dp. numRects ( )); 149 qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
135 150
136 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) { 151 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
137 const QRect &clip = dp. rect ( i ); 152 const QRect &clip = dp. rect ( i );
138 153
139 qt_bug_workaround_clip_rects [ i ] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 154 qt_bug_workaround_clip_rects [ i ] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
140 155
141 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); // clip x/y in the fb 156 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); // clip x/y in the fb
142 uchar *src = frame; 157 uchar *src = frame;
143 158
144 // Adjust the start the source data based on the rotation (xine frame) 159 // Adjust the start the source data based on the rotation (xine frame)
145 switch ( rot ) { 160 switch ( rot ) {
146 case 0: src += ((( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame )); break; 161 case 0: src += ((( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame )); break;
147 case 1: src += ((( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel )); break; 162 case 1: src += ((( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel )); break;
148 case 2: src += ((( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame )); break; 163 case 2: src += ((( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame )); break;
149 case 3: src += ((( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame )); break; 164 case 3: src += ((( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame )); break;
150 default: break; 165 default: break;
151 } 166 }
152 167
153 // all of the following widths/heights are fb relative (0deg rotation) 168 // all of the following widths/heights are fb relative (0deg rotation)
154 169
155 uint leftfill = 0; // black border on the "left" side of the video frame 170 uint leftfill = 0; // black border on the "left" side of the video frame
156 uint framefill = 0; // "width" of the video frame 171 uint framefill = 0; // "width" of the video frame
157 uint rightfill = 0; // black border on the "right" side of the video frame 172 uint rightfill = 0; // black border on the "right" side of the video frame
158 uint clipwidth = clip. width ( ) * m_bytes_per_pixel; // "width" of the current clip rect 173 uint clipwidth = clip. width ( ) * m_bytes_per_pixel; // "width" of the current clip rect
@@ -206,67 +221,57 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
206 // QVFB hack by Martin Jones 221 // QVFB hack by Martin Jones
207 // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter 222 // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter
208 223
209 QPainter p ( this ); 224 QPainter p ( this );
210 225
211 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) { 226 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
212 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [ i ]. topLeft ( )), qt_bug_workaround_clip_rects [ i ]. size ( )), QBrush ( NoBrush )); 227 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [ i ]. topLeft ( )), qt_bug_workaround_clip_rects [ i ]. size ( )), QBrush ( NoBrush ));
213 } 228 }
214 } 229 }
215 } 230 }
216} 231}
217 232
218 233
219QImage *XineVideoWidget::logo ( ) const 234QImage *XineVideoWidget::logo ( ) const
220{ 235{
221 return m_logo; 236 return m_logo;
222} 237}
223 238
224 239
225void XineVideoWidget::setLogo ( QImage* logo ) 240void XineVideoWidget::setLogo ( QImage* logo )
226{ 241{
227 delete m_logo; 242 delete m_logo;
228 m_logo = logo; 243 m_logo = logo;
229} 244}
230 245
231void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) 246void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
232{ 247{
233 bool rot90 = (( -m_rotation ) & 1 ); 248 bool rot90 = (( -m_rotation ) & 1 );
234 249
235 if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height 250 if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height
236 int d = w; 251 int d = w;
237 w = h; 252 w = h;
238 h = d; 253 h = d;
239 } 254 }
240 255
241 m_lastframe = m_thisframe; 256 m_lastframe = m_thisframe;
242 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 257 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
243 258
244 m_buff = img; 259 m_buff = img;
245 m_bytes_per_line_frame = bpl; 260 m_bytes_per_line_frame = bpl;
246 261
247 // only repaint the area that *really* needs to be repainted 262 // only repaint the area that *really* needs to be repainted
248 263
249 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); 264 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
250} 265}
251 266
252void XineVideoWidget::resizeEvent ( QResizeEvent * ) 267void XineVideoWidget::resizeEvent ( QResizeEvent * )
253{ 268{
254 QSize s = size ( ); 269 emit videoResized( videoSize() );
255 bool fs = ( s == qApp-> desktop ( )-> size ( ));
256
257 // if we are in fullscreen mode, do not rotate the video
258 // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!)
259 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
260
261 if ( fs && qt_screen-> isTransformed ( ))
262 s = qt_screen-> mapToDevice ( s );
263
264 emit videoResized ( s );
265} 270}
266 271
267 272
268void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) 273void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
269{ 274{
270 emit clicked(); 275 emit clicked();
271} 276}
272 277
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h
index 33f1470..8b3a3ea 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.h
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.h
@@ -5,70 +5,72 @@
5 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 5 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
6 =. 6 =.
7 .=l. 7 .=l.
8           .>+-= 8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can 9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU General Public 11:`=1 )Y*s>-.--   : the terms of the GNU General Public
12.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_. 15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that 16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more 21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30 30
31*/ 31*/
32 32
33 33
34 34
35#include <qwidget.h> 35#include <qwidget.h>
36 36
37#include "lib.h" 37#include "lib.h"
38 38
39class QImage; 39class QImage;
40 40
41 41
42class XineVideoWidget : public QWidget { 42class XineVideoWidget : public QWidget {
43 Q_OBJECT 43 Q_OBJECT
44 44
45public: 45public:
46 XineVideoWidget ( QWidget* parent, const char* name ); 46 XineVideoWidget ( QWidget* parent, const char* name );
47 ~XineVideoWidget ( ); 47 ~XineVideoWidget ( );
48 QImage *logo ( ) const; 48 QImage *logo ( ) const;
49 void setLogo ( QImage *image ); 49 void setLogo ( QImage *image );
50 void setVideoFrame ( uchar *image, int width, int height, int linestep ); 50 void setVideoFrame ( uchar *image, int width, int height, int linestep );
51 void clear ( ); 51 void clear ( );
52 52
53 QSize videoSize() const;
54
53protected: 55protected:
54 void paintEvent( QPaintEvent *p ); 56 void paintEvent( QPaintEvent *p );
55 void resizeEvent ( QResizeEvent *r ); 57 void resizeEvent ( QResizeEvent *r );
56 58
57 void mouseReleaseEvent ( QMouseEvent *e ); 59 void mouseReleaseEvent ( QMouseEvent *e );
58 60
59signals: 61signals:
60 void clicked ( ); 62 void clicked ( );
61 void videoResized ( const QSize &s ); 63 void videoResized ( const QSize &s );
62 64
63private: 65private:
64 QRect m_lastframe; 66 QRect m_lastframe;
65 QRect m_thisframe; 67 QRect m_thisframe;
66 68
67 uchar *m_buff; 69 uchar *m_buff;
68 int m_bytes_per_line_fb; 70 int m_bytes_per_line_fb;
69 int m_bytes_per_line_frame; 71 int m_bytes_per_line_frame;
70 int m_bytes_per_pixel; 72 int m_bytes_per_pixel;
71 QImage *m_logo; 73 QImage *m_logo;
72 int m_rotation; 74 mutable int m_rotation;
73}; 75};
74 76