summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 11:40:20 (UTC)
committer simon <simon>2002-12-11 11:40:20 (UTC)
commit03ac4af4d6014bbd46b12d5fe89ee2cc73941080 (patch) (unidiff)
treef88296c20f73e7e46d03daff3000ef34acd31bb0
parent9431b69a1efab055c28c77e780df012b0a476a57 (diff)
downloadopie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.zip
opie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.tar.gz
opie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.tar.bz2
- slight simplification of XineControl constructor
- fixed a race between the video resizing and the xine initialization
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
@@ -365,5 +365,5 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
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() ) );
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
@@ -39,14 +39,14 @@
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 ) ) );
@@ -56,5 +56,5 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi
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;
@@ -127,4 +127,12 @@ void XineControl::setGamma( int 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 ) {
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
@@ -43,5 +43,5 @@ class 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 );
@@ -102,4 +102,7 @@ public slots:
102 102
103 103
104private slots:
105 void xineInitialized();
106
104private: 107private:
105 XINE::Lib *libXine; 108 XINE::Lib *libXine;
@@ -112,4 +115,5 @@ private:
112 bool hasAudioChannel : 1; 115 bool hasAudioChannel : 1;
113 MediaPlayerState &mediaPlayerState; 116 MediaPlayerState &mediaPlayerState;
117 XineVideoWidget *xineVideoWidget;
114 118
115signals: 119signals:
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
@@ -109,4 +109,19 @@ void XineVideoWidget::clear ( )
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{
@@ -252,15 +267,5 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
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
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
@@ -51,4 +51,6 @@ public:
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 );
@@ -70,5 +72,5 @@ private:
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