summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-07-10 16:48:36 (UTC)
committer harlekin <harlekin>2002-07-10 16:48:36 (UTC)
commite482423ab6e4631316adc8c7e5a3738dee5330c5 (patch) (unidiff)
treede1abe7c8e2662c2ce8bbf0228a998d740a43704
parent5f1f106ab58429a73834574ebc5ed9dedc892185 (diff)
downloadopie-e482423ab6e4631316adc8c7e5a3738dee5330c5.zip
opie-e482423ab6e4631316adc8c7e5a3738dee5330c5.tar.gz
opie-e482423ab6e4631316adc8c7e5a3738dee5330c5.tar.bz2
more updates
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h32
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp167
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h35
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp46
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h34
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp2
6 files changed, 185 insertions, 131 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 20e3552..79ba579 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,3 +1,35 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2#ifndef MEDIA_PLAYER_STATE_H 34#ifndef MEDIA_PLAYER_STATE_H
3#define MEDIA_PLAYER_STATE_H 35#define MEDIA_PLAYER_STATE_H
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 5625c0e..8fdb3d3 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,3 +1,35 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2#include <qpe/resource.h> 34#include <qpe/resource.h>
3#include <qpe/mediaplayerplugininterface.h> 35#include <qpe/mediaplayerplugininterface.h>
@@ -89,6 +121,9 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
89 setFullscreen( mediaPlayerState->fullscreen() ); 121 setFullscreen( mediaPlayerState->fullscreen() );
90 setPaused( mediaPlayerState->paused() ); 122 setPaused( mediaPlayerState->paused() );
91 setPlaying( mediaPlayerState->playing() ); 123 setPlaying( mediaPlayerState->playing() );
124
125 videoFrame = new XineVideoWidget( 200, 150 ,this, "Video frame" );
126 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) );
92} 127}
93 128
94 129
@@ -256,8 +291,6 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
256 p.setBrush( QBrush( Qt::black ) ); 291 p.setBrush( QBrush( Qt::black ) );
257 p.drawRect( rect() ); 292 p.drawRect( rect() );
258 293
259 // Draw the current frame
260 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen
261 } else { 294 } else {
262 // draw border 295 // draw border
263 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); 296 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL );
@@ -267,7 +300,7 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
267 p.drawRect( 9, 20, 220, 160 ); 300 p.drawRect( 9, 20, 220, 160 );
268 301
269 // draw current frame (centrally positioned from scaling to maintain aspect ratio) 302 // draw current frame (centrally positioned from scaling to maintain aspect ratio)
270 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 303 //p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
271 304
272 // draw the buttons 305 // draw the buttons
273 for ( int i = 0; i < numButtons; i++ ) { 306 for ( int i = 0; i < numButtons; i++ ) {
@@ -290,135 +323,13 @@ bool VideoWidget::playVideo() {
290 323
291 int stream = 0; 324 int stream = 0;
292 325
293 int sw = 240; //mediaPlayerState->curDecoder()->videoWidth( stream ); 326 int sw = 240;
294 int sh = 320; //mediaPlayerState->curDecoder()->videoHeight( stream ); 327 int sh = 320;
295 int dd = QPixmap::defaultDepth(); 328 int dd = QPixmap::defaultDepth();
296 int w = height(); 329 int w = height();
297 int h = width(); 330 int h = width();
298 331
299 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; 332 return true;
300
301 if ( mediaPlayerState->fullscreen() ) {
302#ifdef USE_DIRECT_PAINTER
303 QDirectPainter p(this);
304
305 if ( ( qt_screen->transformOrientation() == 3 ) &&
306 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) {
307
308 w = 320;
309 h = 240;
310
311 if ( mediaPlayerState->scaled() ) {
312 // maintain aspect ratio
313 if ( w * sh > sw * h )
314 w = sw * h / sh;
315 else
316 h = sh * w / sw;
317 } else {
318 w = sw;
319 h = sh;
320 }
321
322 w--; // we can't allow libmpeg to overwrite.
323 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
324
325 int ox = roff.x() - height() + 2 + (height() - w) / 2;
326 int oy = roff.y() + (width() - h) / 2;
327 int sx = 0, sy = 0;
328
329 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
330 fp += dd * ox / 8;
331 uchar **jt = new uchar*[h];
332 for ( int i = h; i; i-- ) {
333 jt[h - i] = fp;
334 fp += p.lineStep();
335 }
336
337 result = 42; //mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
338
339 delete [] jt;
340 } else {
341#endif
342 QPainter p(this);
343
344 w = 320;
345 h = 240;
346
347 if ( mediaPlayerState->scaled() ) {
348 // maintain aspect ratio
349 if ( w * sh > sw * h ) {
350 w = sw * h / sh;
351 } else {
352 h = sh * w / sw;
353 }
354 } else {
355 w = sw;
356 h = sh;
357 }
358
359 int bytes = ( dd == 16 ) ? 2 : 4;
360 QImage tempFrame( w, h, bytes << 3 );
361 result = 42; // mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
362 // 0, 0, sw, sh, w, h, format, 0) == 0;
363 if ( result && mediaPlayerState->fullscreen() ) {
364
365 int rw = h, rh = w;
366 QImage rotatedFrame( rw, rh, bytes << 3 );
367
368 ushort* in = (ushort*)tempFrame.bits();
369 ushort* out = (ushort*)rotatedFrame.bits();
370 int spl = rotatedFrame.bytesPerLine() / bytes;
371 for (int x=0; x<h; x++) {
372 if ( bytes == 2 ) {
373 ushort* lout = out++ + (w - 1)*spl;
374 for (int y=0; y<w; y++) {
375 *lout=*in++;
376 lout-=spl;
377 }
378 } else {
379 ulong* lout = ((ulong *)out)++ + (w - 1)*spl;
380 for (int y=0; y<w; y++) {
381 *lout=*((ulong*)in)++;
382 lout-=spl;
383 }
384 }
385 }
386
387 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
388 }
389#ifdef USE_DIRECT_PAINTER
390 }
391#endif
392 } else {
393
394 w = 220;
395 h = 160;
396
397 // maintain aspect ratio
398 if ( w * sh > sw * h ) {
399 w = sw * h / sh;
400 } else {
401 h = sh * w / sw;
402 }
403
404 result = 42 ; //mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
405
406 QPainter p( this );
407
408 // Image changed size, therefore need to blank the possibly unpainted regions first
409 if ( scaledWidth != w || scaledHeight != h ) {
410 p.setBrush( QBrush( Qt::black ) );
411 p.drawRect( 9, 20, 220, 160 );
412 }
413
414 scaledWidth = w;
415 scaledHeight = h;
416
417 if ( result ) {
418 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
419 }
420 }
421 return result;
422} 333}
423 334
424 335
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index e18edd1..9ab91ac 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,9 +1,41 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
3#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
4 36
5
6#include <qwidget.h> 37#include <qwidget.h>
38#include "xinevideowidget.h"
7 39
8class QPixmap; 40class QPixmap;
9class QSlider; 41class QSlider;
@@ -59,6 +91,7 @@ private:
59 QImage *currentFrame; 91 QImage *currentFrame;
60 int scaledWidth; 92 int scaledWidth;
61 int scaledHeight; 93 int scaledHeight;
94 XineVideoWidget* videoFrame;
62}; 95};
63 96
64#endif // VIDEO_WIDGET_H 97#endif // VIDEO_WIDGET_H
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 7d3b1f7..893ac41 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,3 +1,37 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34
1#include <qtimer.h> 35#include <qtimer.h>
2#include "xinecontrol.h" 36#include "xinecontrol.h"
3#include "mediaplayerstate.h" 37#include "mediaplayerstate.h"
@@ -13,6 +47,8 @@ XineControl::XineControl( QObject *parent, const char *name )
13 connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); 47 connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) );
14 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 48 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
15 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 49 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
50 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
51
16} 52}
17 53
18XineControl::~XineControl() { 54XineControl::~XineControl() {
@@ -30,6 +66,12 @@ void XineControl::play( const QString& fileName ) {
30 return; 66 return;
31 } 67 }
32 68
69 if (whichGui == 'a') {
70 libXine->setShowVideo( false );
71 } else {
72 libXine->setShowVideo( true );
73 }
74
33 // determine if slider is shown 75 // determine if slider is shown
34 // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); 76 // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
35 mediaPlayerState->setIsStreaming( libXine->isSeekable() ); 77 mediaPlayerState->setIsStreaming( libXine->isSeekable() );
@@ -74,3 +116,7 @@ int XineControl::position() {
74void XineControl::setFullscreen( bool isSet ) { 116void XineControl::setFullscreen( bool isSet ) {
75 libXine-> showVideoFullScreen( isSet); 117 libXine-> showVideoFullScreen( isSet);
76} 118}
119
120void XineControl::seekTo( long second ) {
121 // libXine->
122}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 145cd0c..47eee91 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,3 +1,35 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
3#define XINECONTROL_H 35#define XINECONTROL_H
@@ -18,7 +50,7 @@ public slots:
18 void pause( bool ); 50 void pause( bool );
19 void setFullscreen( bool ); 51 void setFullscreen( bool );
20 int currentTime(); 52 int currentTime();
21 53 void seekTo( long );
22 // get length of media file and set it 54 // get length of media file and set it
23 void length(); 55 void length();
24 56
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 47f4805..e02ee7c 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -3,7 +3,7 @@
3                This file is part of the Opie Project 3                This file is part of the Opie Project
4 4
5              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 5              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
6 Copyright (c) 2002 LJP <> 6 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
7 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 7 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
8 =. 8 =.
9 .=l. 9 .=l.