summaryrefslogtreecommitdiff
authorsandman <sandman>2002-08-03 23:58:20 (UTC)
committer sandman <sandman>2002-08-03 23:58:20 (UTC)
commit0cecd08dba036f39e414e34a2b7c070008ee3884 (patch) (unidiff)
treec187c9308f0553b1d5d9cd59093bcc3c11740665
parent8fb605fdfbbcbc654f567efcb59f02ec0d26228a (diff)
downloadopie-0cecd08dba036f39e414e34a2b7c070008ee3884.zip
opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.gz
opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.bz2
Added support for fullscreen playback
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp29
-rw-r--r--noncore/multimedia/opieplayer2/lib.h2
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c11
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp18
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h2
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp95
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.h20
9 files changed, 126 insertions, 60 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
@@ -73,10 +73,5 @@ Lib::Lib(XineVideoWidget* widget) {
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();
@@ -102,2 +97,10 @@ Lib::~Lib() {
102 97
98void 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
103QCString Lib::version() { 106QCString Lib::version() {
@@ -189,5 +192,4 @@ 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}
@@ -200,8 +202,3 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
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);
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
@@ -34,2 +34,4 @@ namespace XINE {
34 34
35 void resize ( const QSize &s );
36
35 int play( const QString& fileName, 37 int play( const QString& fileName,
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
@@ -66,2 +66,3 @@ struct opie_frame_s {
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];
@@ -295,3 +296,4 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
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
@@ -305,3 +307,4 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
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
@@ -538,4 +541,4 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf,
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;
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
@@ -112,2 +112,6 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
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() ) );
@@ -129,4 +133,2 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
129 133
130 videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" );
131
132} 134}
@@ -281,2 +283,3 @@ void VideoWidget::makeVisible() {
281 slider->hide(); 283 slider->hide();
284 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
282 } else { 285 } else {
@@ -286,2 +289,3 @@ void VideoWidget::makeVisible() {
286 slider->show(); 289 slider->show();
290 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) );
287 } 291 }
@@ -296,3 +300,3 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
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
@@ -300,3 +304,3 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
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
@@ -384 +388,7 @@ XineVideoWidget* VideoWidget::vidWidget() {
384} 388}
389
390
391void 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
@@ -66,3 +66,3 @@ public slots:
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();
@@ -74,2 +74,3 @@ signals:
74 void sliderMoved( long ); 74 void sliderMoved( long );
75 void videoResized ( const QSize &s );
75 76
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
@@ -45,2 +45,3 @@ XineControl::XineControl( QObject *parent, const char *name )
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) ) );
@@ -130 +131,6 @@ void XineControl::seekTo( long second ) {
130 131
132
133void 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
@@ -58,2 +58,4 @@ public slots:
58 58
59 void videoResized ( const QSize &s );
60
59private: 61private:
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
@@ -40,2 +40,3 @@
40#include <qsize.h> 40#include <qsize.h>
41#include <qapplication.h>
41 42
@@ -45,2 +46,3 @@
45 46
47
46static inline void memcpy_rev ( void *dst, void *src, size_t len ) 48static inline void memcpy_rev ( void *dst, void *src, size_t len )
@@ -76,17 +78,15 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
76 78
77XineVideoWidget::XineVideoWidget( int width, 79XineVideoWidget::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"); 83
87 image = image.smoothScale( width, height ); 84 m_image = 0;
88 85 m_buff = 0;
89 m_image = new QImage( image );*/ 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
92XineVideoWidget::~XineVideoWidget ( ) 92XineVideoWidget::~XineVideoWidget ( )
@@ -108,3 +108,4 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
108 p. fillRect ( rect ( ), black ); 108 p. fillRect ( rect ( ), black );
109 p. drawImage ( 0, 0, *m_image ); 109 if ( m_image )
110 p. drawImage ( 0, 0, *m_image );
110 //qWarning ( "logo\n" ); 111 //qWarning ( "logo\n" );
@@ -119,3 +120,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
119 120
120 int rot = dp. transformOrientation ( ); 121 int rot = dp. transformOrientation ( ) + m_rotation;
121 122
@@ -199,11 +200,2 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
199 200
200int XineVideoWidget::height ( ) const
201{
202 return m_image-> height ( );
203}
204
205int XineVideoWidget::width ( ) const
206{
207 return m_image-> width ( );
208}
209 201
@@ -215,14 +207,19 @@ void XineVideoWidget::setImage ( QImage* image )
215 207
216void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, 208void 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
@@ -230 +227,41 @@ void XineVideoWidget::setImage( uchar* image, int yoffsetXLine,
230} 227}
228
229void 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
246void 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
257void 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
@@ -37,2 +37,4 @@
37 37
38#include "lib.h"
39
38class QImage; 40class QImage;
@@ -41,3 +43,3 @@ class XineVideoWidget : public QWidget {
41public: 43public:
42 XineVideoWidget( int width, int height, QWidget* parent, const char* name ); 44 XineVideoWidget( QWidget* parent, const char* name );
43 ~XineVideoWidget(); 45 ~XineVideoWidget();
@@ -45,9 +47,15 @@ public:
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
51protected: 51protected:
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
58signals:
59 void videoResized ( const QSize &s );
60
53private: 61private:
@@ -61,3 +69,3 @@ private:
61 QImage* m_image; 69 QImage* m_image;
62 70 int m_rotation;
63}; 71};