-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 27 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 91 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 20 |
9 files changed, 123 insertions, 57 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index eb57b67..00c534a 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -71,14 +71,9 @@ Lib::Lib(XineVideoWidget* widget) { | |||
71 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 71 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
72 | if (m_wid != 0 ) { | 72 | if (m_wid != 0 ) { |
73 | printf("!0\n" ); | 73 | printf("!0\n" ); |
74 | ::null_set_gui_width( m_videoOutput, m_wid->image()->width() ); | 74 | resize ( m_wid-> size ( )); |
75 | ::null_set_gui_height(m_videoOutput, m_wid->image()->height() ); | ||
76 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 75 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
77 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | 76 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); |
78 | QImage image = Resource::loadImage(""); | ||
79 | image = image.smoothScale( m_wid->width(), m_wid->height() ); | ||
80 | QImage* img = new QImage( image ); | ||
81 | m_wid->setImage( img ); | ||
82 | m_wid->repaint(); | 77 | m_wid->repaint(); |
83 | } | 78 | } |
84 | null_display_handler( m_videoOutput, | 79 | null_display_handler( m_videoOutput, |
@@ -100,6 +95,14 @@ Lib::~Lib() { | |||
100 | 95 | ||
101 | } | 96 | } |
102 | 97 | ||
98 | void Lib::resize ( const QSize &s ) | ||
99 | { | ||
100 | if ( s. width ( ) && s. height ( )) { | ||
101 | ::null_set_gui_width( m_videoOutput, s. width() ); | ||
102 | ::null_set_gui_height(m_videoOutput, s. height() ); | ||
103 | } | ||
104 | } | ||
105 | |||
103 | QCString Lib::version() { | 106 | QCString Lib::version() { |
104 | QCString str( xine_get_str_version() ); | 107 | QCString str( xine_get_str_version() ); |
105 | return str; | 108 | return str; |
@@ -187,9 +190,8 @@ void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | |||
187 | } | 190 | } |
188 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 191 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
189 | int width, int height, int bytes ) { | 192 | int width, int height, int bytes ) { |
190 | // printf("display x frame"); | 193 | |
191 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 194 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
192 | // printf("displayed x frame\n"); | ||
193 | } | 195 | } |
194 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 196 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
195 | if (!m_video ) { | 197 | if (!m_video ) { |
@@ -198,12 +200,7 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | |||
198 | } | 200 | } |
199 | // qWarning("called draw frame %d %d", width, height); | 201 | // qWarning("called draw frame %d %d", width, height); |
200 | 202 | ||
201 | QSize size = m_wid->size(); | 203 | m_wid->setImage( frame, width, height, bytes ); |
202 | int xoffset = (size.width() - width) / 2; | ||
203 | int yoffset = (size.height() - height) / 2; | ||
204 | int linestep = qt_screen->linestep(); | ||
205 | |||
206 | m_wid->setImage( frame, yoffset, xoffset, width, height, linestep, bytes, m_bytes_per_pixel ); | ||
207 | // m_wid->repaint(false); | 204 | // m_wid->repaint(false); |
208 | 205 | ||
209 | } | 206 | } |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index d568a32..a15f362 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -32,6 +32,8 @@ namespace XINE { | |||
32 | int subVersion()/*const*/; | 32 | int subVersion()/*const*/; |
33 | 33 | ||
34 | 34 | ||
35 | void resize ( const QSize &s ); | ||
36 | |||
35 | int play( const QString& fileName, | 37 | int play( const QString& fileName, |
36 | int startPos = 0, | 38 | int startPos = 0, |
37 | int start_time = 0 ); | 39 | int start_time = 0 ); |
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index 3a18a40..5ee8d5d 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -64,6 +64,7 @@ struct opie_frame_s { | |||
64 | int ideal_width; | 64 | int ideal_width; |
65 | int ideal_height; | 65 | int ideal_height; |
66 | int output_width, output_height; | 66 | int output_width, output_height; |
67 | int gui_width, gui_height; | ||
67 | uint8_t *chunk[3]; | 68 | uint8_t *chunk[3]; |
68 | 69 | ||
69 | yuv2rgb_t *yuv2rgb; | 70 | yuv2rgb_t *yuv2rgb; |
@@ -293,7 +294,8 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | |||
293 | || (flags != frame->flags) | 294 | || (flags != frame->flags) |
294 | || (format != frame->format) | 295 | || (format != frame->format) |
295 | || (this->user_ratio != frame->user_ratio) | 296 | || (this->user_ratio != frame->user_ratio) |
296 | || this->gui_changed ) { | 297 | || (this->gui_width != frame-> gui_width ) |
298 | || (this-> gui_height != frame-> gui_height)) { | ||
297 | 299 | ||
298 | frame->width = width; | 300 | frame->width = width; |
299 | frame->height = height; | 301 | frame->height = height; |
@@ -303,7 +305,8 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | |||
303 | frame->user_ratio = this->user_ratio; | 305 | frame->user_ratio = this->user_ratio; |
304 | this->gui_changed = 0; | 306 | this->gui_changed = 0; |
305 | //frame->show_video = this->m_show_video; | 307 | //frame->show_video = this->m_show_video; |
306 | 308 | frame->gui_width = this->gui_width; | |
309 | frame->gui_height = this->gui_height; | ||
307 | 310 | ||
308 | null_compute_ideal_size (this, frame); | 311 | null_compute_ideal_size (this, frame); |
309 | null_compute_rgb_size (this, frame); | 312 | null_compute_rgb_size (this, frame); |
@@ -536,8 +539,8 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf, | |||
536 | vo->m_is_scaling = 0; | 539 | vo->m_is_scaling = 0; |
537 | vo->user_ratio = ASPECT_AUTO; | 540 | vo->user_ratio = ASPECT_AUTO; |
538 | vo->display_ratio = 1.0; | 541 | vo->display_ratio = 1.0; |
539 | vo->gui_width = 200; | 542 | vo->gui_width = 16; |
540 | vo->gui_height = 150; | 543 | vo->gui_height = 8; |
541 | vo->frameDis = NULL; | 544 | vo->frameDis = NULL; |
542 | 545 | ||
543 | /* install callback handlers*/ | 546 | /* install callback handlers*/ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 48caf00..af06079 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -110,6 +110,10 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
110 | slider->setFocusPolicy( QWidget::NoFocus ); | 110 | slider->setFocusPolicy( QWidget::NoFocus ); |
111 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 111 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
112 | 112 | ||
113 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | ||
114 | |||
115 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | ||
116 | |||
113 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 117 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
114 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 118 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
115 | 119 | ||
@@ -127,8 +131,6 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
127 | setPaused( mediaPlayerState->paused() ); | 131 | setPaused( mediaPlayerState->paused() ); |
128 | setPlaying( mediaPlayerState->playing() ); | 132 | setPlaying( mediaPlayerState->playing() ); |
129 | 133 | ||
130 | videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" ); | ||
131 | |||
132 | } | 134 | } |
133 | 135 | ||
134 | 136 | ||
@@ -279,11 +281,13 @@ void VideoWidget::makeVisible() { | |||
279 | showFullScreen(); | 281 | showFullScreen(); |
280 | resize( qApp->desktop()->size() ); | 282 | resize( qApp->desktop()->size() ); |
281 | slider->hide(); | 283 | slider->hide(); |
284 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | ||
282 | } else { | 285 | } else { |
283 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 286 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
284 | showNormal(); | 287 | showNormal(); |
285 | showMaximized(); | 288 | showMaximized(); |
286 | slider->show(); | 289 | slider->show(); |
290 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | ||
287 | } | 291 | } |
288 | } | 292 | } |
289 | 293 | ||
@@ -294,11 +298,11 @@ void VideoWidget::paintEvent( QPaintEvent * ) { | |||
294 | if ( mediaPlayerState->fullscreen() ) { | 298 | if ( mediaPlayerState->fullscreen() ) { |
295 | // Clear the background | 299 | // Clear the background |
296 | p.setBrush( QBrush( Qt::black ) ); | 300 | p.setBrush( QBrush( Qt::black ) ); |
297 | videoFrame->setGeometry( QRect( 0, 0 , 240 ,340 ) ); | 301 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); |
298 | 302 | ||
299 | } else { | 303 | } else { |
300 | 304 | ||
301 | videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); | 305 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); |
302 | // draw the buttons | 306 | // draw the buttons |
303 | 307 | ||
304 | for ( int i = 0; i < numButtons; i++ ) { | 308 | for ( int i = 0; i < numButtons; i++ ) { |
@@ -382,3 +386,9 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) | |||
382 | XineVideoWidget* VideoWidget::vidWidget() { | 386 | XineVideoWidget* VideoWidget::vidWidget() { |
383 | return videoFrame; | 387 | return videoFrame; |
384 | } | 388 | } |
389 | |||
390 | |||
391 | void VideoWidget::setFullscreen ( bool b ) | ||
392 | { | ||
393 | setToggleButton( VideoFullscreen, b ); | ||
394 | } \ No newline at end of file | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 0122d5d..fc53f89 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -64,7 +64,7 @@ public slots: | |||
64 | void sliderReleased( ); | 64 | void sliderReleased( ); |
65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } |
66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } |
67 | void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } | 67 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 68 | void makeVisible(); |
69 | void setPosition( long ); | 69 | void setPosition( long ); |
70 | void setLength( long ); | 70 | void setLength( long ); |
@@ -72,6 +72,7 @@ public slots: | |||
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void sliderMoved( long ); | 74 | void sliderMoved( long ); |
75 | void videoResized ( const QSize &s ); | ||
75 | 76 | ||
76 | protected: | 77 | protected: |
77 | void paintEvent( QPaintEvent *pe ); | 78 | void paintEvent( QPaintEvent *pe ); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 19a9172..33889d0 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -43,6 +43,7 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
43 | : QObject( parent, name ) { | 43 | : QObject( parent, name ) { |
44 | libXine = new XINE::Lib(videoUI->vidWidget() ); | 44 | libXine = new XINE::Lib(videoUI->vidWidget() ); |
45 | 45 | ||
46 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | ||
46 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 47 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
47 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 48 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
48 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( setPosition( long ) ) ); | 49 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( setPosition( long ) ) ); |
@@ -128,3 +129,8 @@ void XineControl::seekTo( long second ) { | |||
128 | // libXine-> | 129 | // libXine-> |
129 | } | 130 | } |
130 | 131 | ||
132 | |||
133 | void XineControl::videoResized ( const QSize &s ) | ||
134 | { | ||
135 | libXine-> resize ( s ); | ||
136 | } | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 295d2b4..4a61f32 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -56,6 +56,8 @@ public slots: | |||
56 | void length(); | 56 | void length(); |
57 | long position(); | 57 | long position(); |
58 | 58 | ||
59 | void videoResized ( const QSize &s ); | ||
60 | |||
59 | private: | 61 | private: |
60 | XINE::Lib *libXine; | 62 | XINE::Lib *libXine; |
61 | MediaDetect mdetect; | 63 | MediaDetect mdetect; |
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 4b69044..98446a0 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -38,11 +38,13 @@ | |||
38 | #include <qdirectpainter_qws.h> | 38 | #include <qdirectpainter_qws.h> |
39 | #include <qgfx_qws.h> | 39 | #include <qgfx_qws.h> |
40 | #include <qsize.h> | 40 | #include <qsize.h> |
41 | #include <qapplication.h> | ||
41 | 42 | ||
42 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
43 | 44 | ||
44 | #include "xinevideowidget.h" | 45 | #include "xinevideowidget.h" |
45 | 46 | ||
47 | |||
46 | static inline void memcpy_rev ( void *dst, void *src, size_t len ) | 48 | static inline void memcpy_rev ( void *dst, void *src, size_t len ) |
47 | { | 49 | { |
48 | ((char *) src ) += len; | 50 | ((char *) src ) += len; |
@@ -74,21 +76,19 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st | |||
74 | } | 76 | } |
75 | 77 | ||
76 | 78 | ||
77 | XineVideoWidget::XineVideoWidget( int width, | 79 | XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) |
78 | int height, | ||
79 | QWidget* parent, | ||
80 | const char* name ) | ||
81 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) | 80 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) |
82 | { | 81 | { |
83 | m_image = new QImage ( width, height, qt_screen-> depth ( )); | ||
84 | m_buff = 0; | ||
85 | setBackgroundMode ( NoBackground ); | 82 | setBackgroundMode ( NoBackground ); |
86 | /* QImage image = Resource::loadImage("SoundPlayer"); | ||
87 | image = image.smoothScale( width, height ); | ||
88 | 83 | ||
89 | m_image = new QImage( image );*/ | 84 | m_image = 0; |
85 | m_buff = 0; | ||
86 | m_bytes_per_line_fb = qt_screen-> linestep ( ); | ||
87 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | ||
88 | m_rotation = 0; | ||
90 | } | 89 | } |
91 | 90 | ||
91 | |||
92 | XineVideoWidget::~XineVideoWidget ( ) | 92 | XineVideoWidget::~XineVideoWidget ( ) |
93 | { | 93 | { |
94 | delete m_image; | 94 | delete m_image; |
@@ -106,6 +106,7 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
106 | if ( m_buff == 0 ) { | 106 | if ( m_buff == 0 ) { |
107 | QPainter p ( this ); | 107 | QPainter p ( this ); |
108 | p. fillRect ( rect ( ), black ); | 108 | p. fillRect ( rect ( ), black ); |
109 | if ( m_image ) | ||
109 | p. drawImage ( 0, 0, *m_image ); | 110 | p. drawImage ( 0, 0, *m_image ); |
110 | //qWarning ( "logo\n" ); | 111 | //qWarning ( "logo\n" ); |
111 | } | 112 | } |
@@ -117,7 +118,7 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
117 | { | 118 | { |
118 | QDirectPainter dp ( this ); | 119 | QDirectPainter dp ( this ); |
119 | 120 | ||
120 | int rot = dp. transformOrientation ( ); | 121 | int rot = dp. transformOrientation ( ) + m_rotation; |
121 | 122 | ||
122 | uchar *fb = dp. frameBuffer ( ); | 123 | uchar *fb = dp. frameBuffer ( ); |
123 | uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; | 124 | uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; |
@@ -197,15 +198,6 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
197 | //qWarning( "painting >>>" ); | 198 | //qWarning( "painting >>>" ); |
198 | } | 199 | } |
199 | 200 | ||
200 | int XineVideoWidget::height ( ) const | ||
201 | { | ||
202 | return m_image-> height ( ); | ||
203 | } | ||
204 | |||
205 | int XineVideoWidget::width ( ) const | ||
206 | { | ||
207 | return m_image-> width ( ); | ||
208 | } | ||
209 | 201 | ||
210 | void XineVideoWidget::setImage ( QImage* image ) | 202 | void XineVideoWidget::setImage ( QImage* image ) |
211 | { | 203 | { |
@@ -213,18 +205,63 @@ void XineVideoWidget::setImage ( QImage* image ) | |||
213 | m_image = image; | 205 | m_image = image; |
214 | } | 206 | } |
215 | 207 | ||
216 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | 208 | void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl ) |
217 | int xoffsetXBytes, int width, | ||
218 | int height, int linestep, int bytes, int bpp ) | ||
219 | { | 209 | { |
210 | bool rot90 = (( -m_rotation ) & 1 ); | ||
211 | |||
212 | if ( rot90 ) { | ||
213 | int d = w; | ||
214 | w = h; | ||
215 | h = d; | ||
216 | } | ||
220 | 217 | ||
221 | m_lastframe = m_thisframe; | 218 | m_lastframe = m_thisframe; |
222 | m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); | 219 | m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); |
223 | 220 | ||
224 | m_buff = image; | 221 | //qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); |
225 | m_bytes_per_line_fb = linestep; | 222 | |
226 | m_bytes_per_line_frame = bytes; | 223 | m_buff = img; |
227 | m_bytes_per_pixel = bpp; | 224 | m_bytes_per_line_frame = bpl; |
228 | 225 | ||
229 | repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); | 226 | repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); |
230 | } | 227 | } |
228 | |||
229 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) | ||
230 | { | ||
231 | QSize s = size ( ); | ||
232 | bool fs = ( s == qApp-> desktop ( )-> size ( )); | ||
233 | |||
234 | m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; | ||
235 | |||
236 | if ( fs && qt_screen-> isTransformed ( )) { | ||
237 | s = qt_screen-> mapToDevice ( s ); | ||
238 | } | ||
239 | |||
240 | //qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); | ||
241 | |||
242 | emit videoResized ( s ); | ||
243 | } | ||
244 | |||
245 | |||
246 | void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) | ||
247 | { | ||
248 | QWidget *p = parentWidget ( ); | ||
249 | |||
250 | if ( p ) { | ||
251 | QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | ||
252 | |||
253 | QApplication::sendEvent ( p, &pme ); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) | ||
258 | { | ||
259 | QWidget *p = parentWidget ( ); | ||
260 | |||
261 | if ( p ) { | ||
262 | QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | ||
263 | |||
264 | QApplication::sendEvent ( p, &pme ); | ||
265 | } | ||
266 | } | ||
267 | |||
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index 7d9a6d2..2fc627d 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h | |||
@@ -35,21 +35,29 @@ | |||
35 | 35 | ||
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | #include "lib.h" | ||
39 | |||
38 | class QImage; | 40 | class QImage; |
39 | class XineVideoWidget : public QWidget { | 41 | class XineVideoWidget : public QWidget { |
40 | Q_OBJECT | 42 | Q_OBJECT |
41 | public: | 43 | public: |
42 | XineVideoWidget( int width, int height, QWidget* parent, const char* name ); | 44 | XineVideoWidget( QWidget* parent, const char* name ); |
43 | ~XineVideoWidget(); | 45 | ~XineVideoWidget(); |
44 | QImage *image() { return m_image; }; | 46 | QImage *image() { return m_image; }; |
45 | void setImage( QImage* image ); | 47 | void setImage( QImage* image ); |
46 | void setImage( uchar* image, int yoffsetXLine, int xoffsetXBytes, | 48 | void setImage( uchar* image, int width, int height, int linestep); |
47 | int width, int height, int linestep, int bytes, int bpp); | ||
48 | int width() const; | ||
49 | int height() const; | ||
50 | void clear() ; | 49 | void clear() ; |
50 | |||
51 | protected: | 51 | protected: |
52 | void paintEvent( QPaintEvent* p ); | 52 | void paintEvent( QPaintEvent* p ); |
53 | void resizeEvent ( QResizeEvent *r ); | ||
54 | |||
55 | void mousePressEvent ( QMouseEvent *e ); | ||
56 | void mouseReleaseEvent ( QMouseEvent *e ); | ||
57 | |||
58 | signals: | ||
59 | void videoResized ( const QSize &s ); | ||
60 | |||
53 | private: | 61 | private: |
54 | QRect m_lastframe; | 62 | QRect m_lastframe; |
55 | QRect m_thisframe; | 63 | QRect m_thisframe; |
@@ -59,6 +67,6 @@ private: | |||
59 | int m_bytes_per_line_frame; | 67 | int m_bytes_per_line_frame; |
60 | int m_bytes_per_pixel; | 68 | int m_bytes_per_pixel; |
61 | QImage* m_image; | 69 | QImage* m_image; |
62 | 70 | int m_rotation; | |
63 | }; | 71 | }; |
64 | 72 | ||