-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 32 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 171 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 35 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 48 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 34 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 2 |
6 files changed, 188 insertions, 134 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 +1,33 @@ | |||
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 | ||
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 +1,33 @@ | |||
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 | ||
@@ -75,4 +107,4 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
75 | 107 | ||
76 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 108 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
77 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 109 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
78 | 110 | ||
@@ -91,2 +123,5 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
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 | } |
@@ -258,4 +293,2 @@ void VideoWidget::paintEvent( QPaintEvent * ) { | |||
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 { |
@@ -269,3 +302,3 @@ void VideoWidget::paintEvent( QPaintEvent * ) { | |||
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 | ||
@@ -292,4 +325,4 @@ bool VideoWidget::playVideo() { | |||
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(); |
@@ -298,125 +331,3 @@ bool VideoWidget::playVideo() { | |||
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 | } |
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 +1,33 @@ | |||
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 | ||
@@ -4,4 +36,4 @@ | |||
4 | 36 | ||
5 | |||
6 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include "xinevideowidget.h" | ||
7 | 39 | ||
@@ -61,2 +93,3 @@ private: | |||
61 | int scaledHeight; | 93 | int scaledHeight; |
94 | XineVideoWidget* videoFrame; | ||
62 | }; | 95 | }; |
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 +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 | */ | ||
33 | |||
34 | |||
1 | #include <qtimer.h> | 35 | #include <qtimer.h> |
@@ -15,2 +49,4 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
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 | } |
@@ -32,2 +68,8 @@ void XineControl::play( const QString& fileName ) { | |||
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 |
@@ -74,3 +116,7 @@ int XineControl::position() { | |||
74 | void XineControl::setFullscreen( bool isSet ) { | 116 | void XineControl::setFullscreen( bool isSet ) { |
75 | libXine-> showVideoFullScreen( isSet); | 117 | libXine->showVideoFullScreen( isSet); |
118 | } | ||
119 | |||
120 | void XineControl::seekTo( long second ) { | ||
121 | // libXine-> | ||
76 | } | 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 +1,33 @@ | |||
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 | ||
@@ -20,3 +52,3 @@ public slots: | |||
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 |
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 | |||
@@ -5,3 +5,3 @@ | |||
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> |