-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 27 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 4 |
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 | |||
@@ -359,17 +359,17 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
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 | ||
372 | void MediaPlayer::reloadSkins() | 372 | void MediaPlayer::reloadSkins() |
373 | { | 373 | { |
374 | audioUI->loadSkin(); | 374 | audioUI->loadSkin(); |
375 | videoUI->loadSkin(); | 375 | videoUI->loadSkin(); |
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 | |||
@@ -33,34 +33,34 @@ | |||
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 | ||
42 | XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, | 43 | XineControl::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 | ||
63 | XineControl::~XineControl() { | 63 | XineControl::~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; |
@@ -121,16 +121,24 @@ void XineControl::play( const QString& fileName ) { | |||
121 | void XineControl::nextMedia() { | 121 | void XineControl::nextMedia() { |
122 | mediaPlayerState.setNext(); | 122 | mediaPlayerState.setNext(); |
123 | } | 123 | } |
124 | 124 | ||
125 | void XineControl::setGamma( int value ) { | 125 | void XineControl::setGamma( int value ) { |
126 | libXine->setGamma( value ); | 126 | libXine->setGamma( value ); |
127 | } | 127 | } |
128 | 128 | ||
129 | void 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 | |||
129 | void XineControl::stop( bool isSet ) { | 137 | void 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 |
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 | |||
@@ -37,17 +37,17 @@ | |||
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 | ||
42 | class XineControl : public QObject { | 42 | class XineControl : public QObject { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
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 | ||
53 | public slots: | 53 | public slots: |
@@ -96,26 +96,30 @@ public slots: | |||
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 | ||
104 | private slots: | ||
105 | void xineInitialized(); | ||
106 | |||
104 | private: | 107 | private: |
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 | ||
115 | signals: | 119 | signals: |
116 | void positionChanged( long ); | 120 | void positionChanged( long ); |
117 | 121 | ||
118 | void initialized(); | 122 | void initialized(); |
119 | }; | 123 | }; |
120 | 124 | ||
121 | 125 | ||
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 | |||
@@ -103,16 +103,31 @@ XineVideoWidget::~XineVideoWidget ( ) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | void XineVideoWidget::clear ( ) | 105 | void XineVideoWidget::clear ( ) |
106 | { | 106 | { |
107 | m_buff = 0; | 107 | m_buff = 0; |
108 | repaint ( false ); | 108 | repaint ( false ); |
109 | } | 109 | } |
110 | 110 | ||
111 | QSize 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 | |||
111 | void XineVideoWidget::paintEvent ( QPaintEvent * ) | 126 | void 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 | } |
@@ -246,27 +261,17 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int 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 | ||
252 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) | 267 | void 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 | ||
268 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) | 273 | void 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 | |||
@@ -45,16 +45,18 @@ class XineVideoWidget : public QWidget { | |||
45 | public: | 45 | public: |
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 | |||
53 | protected: | 55 | protected: |
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 | ||
59 | signals: | 61 | signals: |
60 | void clicked ( ); | 62 | void clicked ( ); |
@@ -64,11 +66,11 @@ private: | |||
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 | ||