author | harlekin <harlekin> | 2002-07-10 16:48:36 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-10 16:48:36 (UTC) |
commit | e482423ab6e4631316adc8c7e5a3738dee5330c5 (patch) (side-by-side diff) | |
tree | de1abe7c8e2662c2ce8bbf0228a998d740a43704 | |
parent | 5f1f106ab58429a73834574ebc5ed9dedc892185 (diff) | |
download | opie-e482423ab6e4631316adc8c7e5a3738dee5330c5.zip opie-e482423ab6e4631316adc8c7e5a3738dee5330c5.tar.gz opie-e482423ab6e4631316adc8c7e5a3738dee5330c5.tar.bz2 |
more updates
-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,2 +1,34 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #ifndef 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,2 +1,34 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #include <qpe/resource.h> @@ -74,6 +106,6 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : slider->setGeometry( QRect( 7, 250, 220, 20 ) ); - connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); - connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); + connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); @@ -90,4 +122,7 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); + + videoFrame = new XineVideoWidget( 200, 150 ,this, "Video frame" ); + videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); } @@ -257,6 +292,4 @@ void VideoWidget::paintEvent( QPaintEvent * ) { p.drawRect( rect() ); - // Draw the current frame - //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen } else { // draw border @@ -268,5 +301,5 @@ void VideoWidget::paintEvent( QPaintEvent * ) { // draw current frame (centrally positioned from scaling to maintain aspect ratio) - p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); + //p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); // draw the buttons @@ -291,133 +324,11 @@ bool VideoWidget::playVideo() { int stream = 0; - int sw = 240; //mediaPlayerState->curDecoder()->videoWidth( stream ); - int sh = 320; //mediaPlayerState->curDecoder()->videoHeight( stream ); + int sw = 240; + int sh = 320; int dd = QPixmap::defaultDepth(); int w = height(); int h = width(); - ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; - - if ( mediaPlayerState->fullscreen() ) { -#ifdef USE_DIRECT_PAINTER - QDirectPainter p(this); - - if ( ( qt_screen->transformOrientation() == 3 ) && - ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { - - w = 320; - h = 240; - - if ( mediaPlayerState->scaled() ) { - // maintain aspect ratio - if ( w * sh > sw * h ) - w = sw * h / sh; - else - h = sh * w / sw; - } else { - w = sw; - h = sh; - } - - w--; // we can't allow libmpeg to overwrite. - QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); - - int ox = roff.x() - height() + 2 + (height() - w) / 2; - int oy = roff.y() + (width() - h) / 2; - int sx = 0, sy = 0; - - uchar* fp = p.frameBuffer() + p.lineStep() * oy; - fp += dd * ox / 8; - uchar **jt = new uchar*[h]; - for ( int i = h; i; i-- ) { - jt[h - i] = fp; - fp += p.lineStep(); - } - - result = 42; //mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; - - delete [] jt; - } else { -#endif - QPainter p(this); - - w = 320; - h = 240; - - if ( mediaPlayerState->scaled() ) { - // maintain aspect ratio - if ( w * sh > sw * h ) { - w = sw * h / sh; - } else { - h = sh * w / sw; - } - } else { - w = sw; - h = sh; - } - - int bytes = ( dd == 16 ) ? 2 : 4; - QImage tempFrame( w, h, bytes << 3 ); - result = 42; // mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), - // 0, 0, sw, sh, w, h, format, 0) == 0; - if ( result && mediaPlayerState->fullscreen() ) { - - int rw = h, rh = w; - QImage rotatedFrame( rw, rh, bytes << 3 ); - - ushort* in = (ushort*)tempFrame.bits(); - ushort* out = (ushort*)rotatedFrame.bits(); - int spl = rotatedFrame.bytesPerLine() / bytes; - for (int x=0; x<h; x++) { - if ( bytes == 2 ) { - ushort* lout = out++ + (w - 1)*spl; - for (int y=0; y<w; y++) { - *lout=*in++; - lout-=spl; - } - } else { - ulong* lout = ((ulong *)out)++ + (w - 1)*spl; - for (int y=0; y<w; y++) { - *lout=*((ulong*)in)++; - lout-=spl; - } - } - } - - p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); - } -#ifdef USE_DIRECT_PAINTER - } -#endif - } else { - - w = 220; - h = 160; - - // maintain aspect ratio - if ( w * sh > sw * h ) { - w = sw * h / sh; - } else { - h = sh * w / sw; - } - - result = 42 ; //mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; - - QPainter p( this ); - - // Image changed size, therefore need to blank the possibly unpainted regions first - if ( scaledWidth != w || scaledHeight != h ) { - p.setBrush( QBrush( Qt::black ) ); - p.drawRect( 9, 20, 220, 160 ); - } - - scaledWidth = w; - scaledHeight = h; - - if ( result ) { - p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); - } - } - return result; + return true; } 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,8 +1,40 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H - #include <qwidget.h> +#include "xinevideowidget.h" class QPixmap; @@ -60,4 +92,5 @@ private: int scaledWidth; int scaledHeight; + XineVideoWidget* videoFrame; }; 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,2 +1,36 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + + #include <qtimer.h> #include "xinecontrol.h" @@ -14,4 +48,6 @@ XineControl::XineControl( QObject *parent, const char *name ) connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); + connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); + } @@ -31,4 +67,10 @@ void XineControl::play( const QString& fileName ) { } + if (whichGui == 'a') { + libXine->setShowVideo( false ); + } else { + libXine->setShowVideo( true ); + } + // determine if slider is shown // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); @@ -73,4 +115,8 @@ int XineControl::position() { void XineControl::setFullscreen( bool isSet ) { - libXine-> showVideoFullScreen( isSet); + libXine->showVideoFullScreen( isSet); +} + +void XineControl::seekTo( long second ) { + // libXine-> } 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,2 +1,34 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #ifndef XINECONTROL_H @@ -19,5 +51,5 @@ public slots: void setFullscreen( bool ); int currentTime(); - + void seekTo( long ); // get length of media file and set it void length(); 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 @@ -4,5 +4,5 @@ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> - Copyright (c) 2002 LJP <> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. |