summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h32
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp171
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h35
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp48
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h34
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp2
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,12 +1,44 @@
+/*
+                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
#define MEDIA_PLAYER_STATE_H
#include <qobject.h>
class MediaPlayerDecoder;
class Config;
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,12 +1,44 @@
+/*
+                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>
#include <qpe/mediaplayerplugininterface.h>
#include <qpe/config.h>
#include <qwidget.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qslider.h>
#include <qdrawutil.h>
#include "videowidget.h"
#include "mediaplayerstate.h"
@@ -64,40 +96,43 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) );
pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) );
pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) );
currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
slider->setFocusPolicy( QWidget::NoFocus );
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) ) );
connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setFullscreen( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
+
+ videoFrame = new XineVideoWidget( 200, 150 ,this, "Video frame" );
+ videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) );
}
VideoWidget::~VideoWidget() {
for ( int i = 0; i < 3; i++ ) {
delete pixmaps[i];
}
delete currentFrame;
}
static bool videoSliderBeingMoved = FALSE;
@@ -247,187 +282,63 @@ void VideoWidget::makeVisible() {
}
}
void VideoWidget::paintEvent( QPaintEvent * ) {
QPainter p( this );
if ( mediaPlayerState->fullscreen() ) {
// Clear the background
p.setBrush( QBrush( Qt::black ) );
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
qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL );
// Clear the movie screen first
p.setBrush( QBrush( Qt::black ) );
p.drawRect( 9, 20, 220, 160 );
// 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
for ( int i = 0; i < numButtons; i++ ) {
paintButton( &p, i );
}
// draw the slider
slider->repaint( TRUE );
}
}
void VideoWidget::closeEvent( QCloseEvent* ) {
mediaPlayerState->setList();
}
bool VideoWidget::playVideo() {
bool result = FALSE;
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;
}
void VideoWidget::keyReleaseEvent( QKeyEvent *e)
{
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
case Key_F9: //activity
break;
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,18 +1,50 @@
+/*
+                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;
class QSlider;
enum VideoButtons {
VideoPrevious,
VideoStop,
VideoPlay,
VideoPause,
VideoNext,
VideoPlayList,
VideoFullscreen
@@ -50,18 +82,19 @@ protected:
void keyReleaseEvent( QKeyEvent *e);
private:
void paintButton( QPainter *p, int i );
void toggleButton( int );
void setToggleButton( int, bool );
QSlider *slider;
QPixmap *pixmaps[3];
QImage *currentFrame;
int scaledWidth;
int scaledHeight;
+ XineVideoWidget* videoFrame;
};
#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,44 +1,86 @@
+/*
+                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"
#include "mediaplayerstate.h"
extern MediaPlayerState *mediaPlayerState;
XineControl::XineControl( QObject *parent, const char *name )
: QObject( parent, name ) {
libXine = new XINE::Lib();
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) );
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 ) ) );
+
}
XineControl::~XineControl() {
delete libXine;
}
void XineControl::play( const QString& fileName ) {
libXine->play( fileName );
mediaPlayerState->setPlaying( true );
// default to audio view until we know how to handle video
// MediaDetect mdetect;
char whichGui = mdetect.videoOrAudio( fileName );
if (whichGui == 'f') {
qDebug("Nicht erkannter Dateityp");
return;
}
+ if (whichGui == 'a') {
+ libXine->setShowVideo( false );
+ } else {
+ libXine->setShowVideo( true );
+ }
+
// determine if slider is shown
// mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
mediaPlayerState->setIsStreaming( libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
}
void XineControl::stop( bool isSet ) {
if ( !isSet) {
libXine->stop();
mediaPlayerState->setList();
@@ -63,14 +105,18 @@ void XineControl::length() {
mediaPlayerState->setLength( m_length );
}
int XineControl::position() {
m_position = (m_currentTime/m_length*100);
mediaPlayerState->setPosition( m_position );
return m_position;
emit positionChanged( m_position );
QTimer::singleShot( 1000, this, SLOT( 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,33 +1,65 @@
+/*
+                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
#define XINECONTROL_H
#include "lib.h"
#include "mediadetect.h"
#include <qobject.h>
class XineControl : public QObject {
Q_OBJECT
public:
XineControl( QObject *parent = 0, const char *name =0 );
~XineControl();
public slots:
void play( const QString& fileName );
void stop( bool );
void pause( bool );
void setFullscreen( bool );
int currentTime();
-
+ void seekTo( long );
// get length of media file and set it
void length();
int position();
private:
XINE::Lib *libXine;
MediaDetect mdetect;
int m_length;
int m_currentTime;
int m_position;
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
@@ -1,18 +1,18 @@
/*
                This file is part of the Opie Project
              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>
=.
.=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