author | simon <simon> | 2002-12-11 11:40:20 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 11:40:20 (UTC) |
commit | 03ac4af4d6014bbd46b12d5fe89ee2cc73941080 (patch) (unidiff) | |
tree | f88296c20f73e7e46d03daff3000ef34acd31bb0 | |
parent | 9431b69a1efab055c28c77e780df012b0a476a57 (diff) | |
download | opie-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
-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 | |||
@@ -364,7 +364,7 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
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 | } |
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 | |||
@@ -38,16 +38,16 @@ | |||
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 ) ) ); |
@@ -55,7 +55,7 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi | |||
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 | } |
@@ -126,6 +126,14 @@ 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(); |
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 | |||
@@ -42,7 +42,7 @@ | |||
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(); |
@@ -101,6 +101,9 @@ public slots: | |||
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; |
@@ -111,6 +114,7 @@ private: | |||
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 ); |
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 | |||
@@ -108,6 +108,21 @@ void XineVideoWidget::clear ( ) | |||
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 ) { |
@@ -251,17 +266,7 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) | |||
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 | ||
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 | |||
@@ -50,6 +50,8 @@ public: | |||
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 ); |
@@ -69,6 +71,6 @@ private: | |||
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 | ||