summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Side-by-side diff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/lib.h7
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp60
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h10
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c43
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h10
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h33
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp88
-rw-r--r--noncore/multimedia/opieplayer2/yuv2rgb.c17
13 files changed, 244 insertions, 88 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index b2143a0..748ae1f 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -15,129 +15,130 @@
     ._= =}       : 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 <stdio.h>
#include <stdlib.h>
#include <qimage.h>
#include <qtextstream.h>
#include <qpe/resource.h>
#include <qfile.h>
#include <qgfx_qws.h>
#include <qdirectpainter_qws.h>
#include "xinevideowidget.h"
#include "frame.h"
#include "lib.h"
typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
int width, int height,int bytes );
extern "C" {
vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video);
int null_is_showing_video( vo_driver_t* self );
void null_set_show_video( vo_driver_t* self, int show );
int null_is_fullscreen( vo_driver_t* self );
void null_set_fullscreen( vo_driver_t* self, int screen );
int null_is_scaling( vo_driver_t* self );
void null_set_scaling( vo_driver_t* self, int scale );
void null_set_gui_width( vo_driver_t* self, int width );
void null_set_gui_height( vo_driver_t* self, int height );
void null_set_mode( vo_driver_t* self, int depth, int rgb );
+ void null_set_videoGamma( vo_driver_t* self , int value );
void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data);
}
using namespace XINE;
Lib::Lib(XineVideoWidget* widget) {
m_video = false;
m_wid = widget;
printf("Lib");
QCString str( getenv("HOME") );
str += "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
if ( !QFile(str).exists() ) {
QFile f(str);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
f.close();
}
m_config = xine_config_file_init( str.data() );
// allocate oss for sound
// and fb for framebuffer
m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
m_videoOutput = ::init_video_out_plugin( m_config, NULL );
if (m_wid != 0 ) {
printf("!0\n" );
resize ( m_wid-> size ( ));
::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
- m_wid-> setImage ( new QImage ( Resource::loadImage("")));
+ m_wid-> setImage ( new QImage ( Resource::loadImage("") ) );
m_wid->repaint();
}
null_display_handler( m_videoOutput,
xine_display_frame,
this );
m_xine = xine_init( m_videoOutput,
m_audioOutput, m_config );
// install the event handler
xine_register_event_listener( m_xine, xine_event_handler, this );
}
Lib::~Lib() {
free( m_config );
xine_remove_event_listener( m_xine, xine_event_handler );
xine_exit( m_xine );
/* FIXME either free or delete but valgrind bitches against both */
//free( m_videoOutput );
//delete m_audioOutput;
}
void Lib::resize ( const QSize &s )
{
if ( s. width ( ) && s. height ( )) {
::null_set_gui_width( m_videoOutput, s. width() );
::null_set_gui_height(m_videoOutput, s. height() );
}
}
QCString Lib::version() {
QCString str( xine_get_str_version() );
return str;
};
int Lib::majorVersion() {
return xine_get_major_version();
}
int Lib::minorVersion() {
return xine_get_minor_version();
};
int Lib::subVersion() {
return xine_get_sub_version();
}
int Lib::play( const QString& fileName,
int startPos,
int start_time ) {
@@ -158,70 +159,76 @@ void Lib::pause(){
int Lib::speed() {
return xine_get_speed( m_xine );
}
void Lib::setSpeed( int speed ) {
xine_set_speed( m_xine, speed );
}
int Lib::status(){
return xine_get_status( m_xine );
}
int Lib::currentPosition(){
return xine_get_current_position( m_xine );
}
int Lib::currentTime() {
return xine_get_current_time( m_xine );
};
int Lib::length() {
return xine_get_stream_length( m_xine );
}
bool Lib::isSeekable() {
return xine_is_stream_seekable(m_xine);
}
Frame Lib::currentFrame() {
Frame frame;
return frame;
};
int Lib::error() {
return xine_get_error( m_xine );
};
void Lib::handleXineEvent( xine_event_t* t ) {
if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
emit stopped();
}
void Lib::setShowVideo( bool video ) {
m_video = video;
::null_set_show_video( m_videoOutput, video );
}
bool Lib::isShowingVideo() {
return ::null_is_showing_video( m_videoOutput );
}
void Lib::showVideoFullScreen( bool fullScreen ) {
::null_set_fullscreen( m_videoOutput, fullScreen );
}
bool Lib::isVideoFullScreen() {
return ::null_is_fullscreen( m_videoOutput );
}
void Lib::setScaling( bool scale ) {
::null_set_scaling( m_videoOutput, scale );
}
+
+void Lib::setGamma( int value ) {
+ //qDebug( QString( "%1").arg(value) );
+ ::null_set_videoGamma( m_videoOutput, value );
+}
+
bool Lib::isScaling() {
return ::null_is_scaling( m_videoOutput );
}
void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
((Lib*)user_data)->handleXineEvent( t );
}
void Lib::xine_display_frame( void* user_data, uint8_t *frame,
int width, int height, int bytes ) {
((Lib*)user_data)->drawFrame( frame, width, height, bytes );
}
void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
if (!m_video ) {
qWarning("not showing video now");
return;
}
// qWarning("called draw frame %d %d", width, height);
m_wid->setImage( frame, width, height, bytes );
// m_wid->repaint(false);
}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index abd8c65..b9d0a8a 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -67,80 +67,87 @@ namespace XINE {
int play( const QString& fileName,
int startPos = 0,
int start_time = 0 );
void stop() /*const*/;
void pause()/*const*/;
int speed() /*const*/;
void setSpeed( int speed = SPEED_PAUSE );
int status() /*const*/;
int currentPosition()/*const*/;
//in seconds
int currentTime()/*const*/;
int length() /*const*/;
bool isSeekable()/*const*/;
/**
* Whether or not to show video output
*/
void setShowVideo(bool video);
/**
* is we show video
*/
bool isShowingVideo() /*const*/;
/**
*
*/
void showVideoFullScreen( bool fullScreen );
/**
*
*/
bool isVideoFullScreen()/*const*/ ;
/**
*
*/
bool isScaling();
/**
*
*/
void setScaling( bool );
+
+ /**
+ * Set the Gamma value for video output
+ * @param int the value between -100 and 100, 0 is original
+ */
+ void setGamma( int );
+
/**
* test
*/
Frame currentFrame()/*const*/;
/**
* Returns the error code
*/
int error() /*const*/;
signals:
void stopped();
private:
int m_bytes_per_pixel;
bool m_video:1;
XineVideoWidget *m_wid;
xine_t *m_xine;
config_values_t *m_config;
vo_driver_t *m_videoOutput;
ao_driver_t* m_audioOutput;
void handleXineEvent( xine_event_t* t );
void drawFrame( uint8_t* frame, int width, int height, int bytes );
// C -> C++ bridge for the event system
static void xine_event_handler( void* user_data, xine_event_t* t);
static void xine_display_frame( void* user_data, uint8_t* frame ,
int width, int height, int bytes );
};
};
#endif
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index d984022..4ec5989 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,101 +1,135 @@
+/*
+                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
+..}^=.=       =       ; General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = 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.
+
+*/
+
+// this file is based on work by trolltech
+
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qobject.h>
#include <qdir.h>
#include "mediaplayerstate.h"
//#define MediaPlayerDebug(x) qDebug x
#define MediaPlayerDebug(x)
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ) {
Config cfg( "OpiePlayer" );
readConfig( cfg );
isStreaming = false;
}
MediaPlayerState::~MediaPlayerState() {
-// Config cfg( "OpiePlayer" );
-// writeConfig( cfg );
-
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
isShuffled = cfg.readBoolEntry( "Shuffle" );
usePlaylist = cfg.readBoolEntry( "UsePlayList" );
+ videoGamma = cfg.readNumEntry( "VideoGamma" );
usePlaylist = TRUE;
isPlaying = FALSE;
isStreaming = FALSE;
isPaused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
}
void MediaPlayerState::writeConfig( Config& cfg ) const {
- cfg.setGroup("Options");
- cfg.writeEntry("FullScreen", isFullscreen );
- cfg.writeEntry("Scaling", isScaled );
- cfg.writeEntry("Looping", isLooping );
- cfg.writeEntry("Shuffle", isShuffled );
- cfg.writeEntry("UsePlayList", usePlaylist );
+ cfg.setGroup( "Options" );
+ cfg.writeEntry( "FullScreen", isFullscreen );
+ cfg.writeEntry( "Scaling", isScaled );
+ cfg.writeEntry( "Looping", isLooping );
+ cfg.writeEntry( "Shuffle", isShuffled );
+ cfg.writeEntry( "UsePlayList", usePlaylist );
+ cfg.writeEntry( "VideoGamma", videoGamma );
}
// public stuff
bool MediaPlayerState::streaming() {
return isStreaming;
}
bool MediaPlayerState::fullscreen() {
return isFullscreen;
}
bool MediaPlayerState::scaled() {
return isScaled;
}
bool MediaPlayerState::looping() {
return isLooping;
}
bool MediaPlayerState::shuffled() {
return isShuffled;
}
bool MediaPlayerState:: playlist() {
return usePlaylist;
}
bool MediaPlayerState::paused() {
return isPaused;
}
bool MediaPlayerState::playing() {
return isPlaying;
}
bool MediaPlayerState::stop() {
return isStoped;
}
long MediaPlayerState::position() {
return curPosition;
}
long MediaPlayerState::length() {
@@ -164,96 +198,104 @@ void MediaPlayerState::setPlaylist( bool b ) {
}
usePlaylist = b;
emit playlistToggled(b);
}
void MediaPlayerState::setPaused( bool b ) {
if ( isPaused == b ) {
isPaused = FALSE;
emit pausedToggled(FALSE);
return;
}
isPaused = b;
emit pausedToggled(b);
}
void MediaPlayerState::setPlaying( bool b ) {
if ( isPlaying == b ) {
return;
}
isPlaying = b;
isStoped = !b;
emit playingToggled(b);
}
void MediaPlayerState::setStop( bool b ) {
if ( isStoped == b ) {
return;
}
isStoped = b;
emit stopToggled(b);
}
void MediaPlayerState::setPosition( long p ) {
if ( curPosition == p ) {
return;
}
curPosition = p;
emit positionChanged(p);
}
void MediaPlayerState::updatePosition( long p ){
if ( curPosition == p ) {
return;
}
curPosition = p;
emit positionUpdated(p);
}
+void MediaPlayerState::setVideoGamma( int v ){
+ if ( videoGamma == v ) {
+ return;
+ }
+ videoGamma = v;
+ emit videoGammaChanged( v );
+}
+
void MediaPlayerState::setLength( long l ) {
if ( curLength == l ) {
return;
}
curLength = l;
emit lengthChanged(l);
}
void MediaPlayerState::setView( char v ) {
if ( curView == v ) {
return;
}
curView = v;
emit viewChanged(v);
}
void MediaPlayerState::setPrev(){
emit prev();
}
void MediaPlayerState::setNext() {
emit next();
}
void MediaPlayerState::setList() {
setPlaying( FALSE );
setView('l');
}
void MediaPlayerState::setVideo() {
setView('v');
}
void MediaPlayerState::setAudio() {
setView('a');
}
void MediaPlayerState::toggleFullscreen() {
setFullscreen( !isFullscreen );
}
void MediaPlayerState::toggleScaled() {
setScaled( !isScaled);
}
void MediaPlayerState::toggleLooping() {
setLooping( !isLooping);
}
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 215a2a8..4fef8e0 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,135 +1,139 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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.
*/
+// this file is based on work by trolltech
+
#ifndef MEDIA_PLAYER_STATE_H
#define MEDIA_PLAYER_STATE_H
#include <qobject.h>
class MediaPlayerDecoder;
class Config;
class MediaPlayerState : public QObject {
Q_OBJECT
public:
MediaPlayerState( QObject *parent, const char *name );
~MediaPlayerState();
bool isPaused;
bool isPlaying;
bool isStoped;
bool streaming();
bool fullscreen();
bool scaled();
bool looping();
bool shuffled();
bool playlist();
bool paused();
bool playing();
bool stop();
long position();
long length();
char view();
public slots:
void setIsStreaming( bool b );
void setFullscreen( bool b );
void setScaled( bool b );
void setLooping( bool b );
void setShuffled( bool b );
void setPlaylist( bool b );
void setPaused( bool b );
void setPlaying( bool b );
void setStop( bool b );
void setPosition( long p );
void updatePosition( long p );
void setLength( long l );
void setView( char v );
void setBlanked( bool b );
+ void setVideoGamma( int v );
void setPrev();
void setNext();
void setList();
void setVideo();
void setAudio();
void toggleFullscreen();
void toggleScaled();
void toggleLooping();
void toggleShuffled();
void togglePlaylist();
void togglePaused();
void togglePlaying();
void toggleBlank();
void writeConfig( Config& cfg ) const;
signals:
void fullscreenToggled( bool );
void scaledToggled( bool );
void loopingToggled( bool );
void shuffledToggled( bool );
void playlistToggled( bool );
void pausedToggled( bool );
void playingToggled( bool );
void stopToggled( bool );
void positionChanged( long ); // When the slider is moved
void positionUpdated( long ); // When the media file progresses
void lengthChanged( long );
void viewChanged( char );
void blankToggled( bool );
+ void videoGammaChanged( int );
void prev();
void next();
private:
bool isStreaming;
bool isFullscreen;
bool isScaled;
bool isBlanked;
bool isLooping;
bool isShuffled;
bool usePlaylist;
long curPosition;
long curLength;
char curView;
-
+ int videoGamma;
void readConfig( Config& cfg );
};
#endif // MEDIA_PLAYER_STATE_H
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index bd52869..ceda333 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -1,82 +1,114 @@
+/*
+                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
+..}^=.=       =       ; General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = 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 <xine.h>*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <xine/video_out.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/configfile.h>
#include <pthread.h>
#include "alphablend.h"
#include "yuv2rgb.h"
#define printf(x,...)
/* the caller for our event draw handler */
typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
int width, int height,int bytes );
typedef struct null_driver_s null_driver_t;
struct null_driver_s {
vo_driver_t vo_driver;
uint32_t m_capabilities;
int m_show_video;
int m_video_fullscreen;
int m_is_scaling;
int depth, bpp, bytes_per_pixel;
int yuv2rgb_mode;
int yuv2rgb_swap;
- int zuv2rgb_gamma;
+ int yuv2rgb_gamma;
uint8_t *yuv2rgb_cmap;
yuv2rgb_factory_t *yuv2rgb_factory;
vo_overlay_t *overlay;
int user_ratio;
double output_scale_factor;
int last_frame_output_width;
int last_frame_output_height;
int gui_width;
int gui_height;
int gui_changed;
double display_ratio;
void* caller;
display_xine_frame_t frameDis;
};
typedef struct opie_frame_s opie_frame_t;
struct opie_frame_s {
vo_frame_t frame;
char* name;
int version;
int width;
int height;
int ratio_code;
int format;
int flags;
int user_ratio;
double ratio_factor;
int ideal_width;
int ideal_height;
int output_width, output_height;
int gui_width, gui_height;
uint8_t *chunk[3];
yuv2rgb_t *yuv2rgb;
uint8_t *rgb_dst;
int yuv_stride;
int stripe_height, stripe_inc;
int bytes_per_line;
uint8_t *data;
// int show_video;
null_driver_t *output;
};
static uint32_t null_get_capabilities(vo_driver_t *self ){
@@ -560,113 +592,122 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf,
/* capabilities */
vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
vo->yuv2rgb_cmap);
printf("done initialisation\n");
return (vo_driver_t*) vo;
}
static vo_info_t vo_info_null = {
5,
"null plugin",
NULL,
VISUAL_TYPE_FB,
5
};
vo_info_t *get_video_out_plugin_info(){
vo_info_null.description = _("xine video output plugin using null device");
return &vo_info_null;
}
/* this is special for this device */
/**
* We know that we will be controled by the XINE LIB++
*/
/**
*
*/
int null_is_showing_video( vo_driver_t* self ){
null_driver_t* this = (null_driver_t*)self;
return this->m_show_video;
}
void null_set_show_video( vo_driver_t* self, int show ) {
((null_driver_t*)self)->m_show_video = show;
}
int null_is_fullscreen( vo_driver_t* self ){
return ((null_driver_t*)self)->m_video_fullscreen;
}
void null_set_fullscreen( vo_driver_t* self, int screen ){
((null_driver_t*)self)->m_video_fullscreen = screen;
}
int null_is_scaling( vo_driver_t* self ){
return ((null_driver_t*)self)->m_is_scaling;
}
+
+void null_set_videoGamma( vo_driver_t* self , int value ) {
+ ((null_driver_t*) self) ->yuv2rgb_gamma = value;
+ ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value );
+}
+
void null_set_scaling( vo_driver_t* self, int scale ){
((null_driver_t*)self)->m_is_scaling = scale;
}
void null_set_gui_width( vo_driver_t* self, int width ){
((null_driver_t*)self)->gui_width = width;
}
void null_set_gui_height( vo_driver_t* self, int height ){
((null_driver_t*)self)->gui_height = height;
}
+
+
void null_set_mode( vo_driver_t* self, int depth, int rgb ){
null_driver_t* this = (null_driver_t*)self;
this->bytes_per_pixel = (depth + 7 ) / 8;
this->bpp = this->bytes_per_pixel * 8;
this->depth = depth;
printf("depth %d %d\n", depth, this->bpp);
printf("pixeltype %d\n", rgb );
switch ( this->depth ){
case 32:
if( rgb == 0 )
this->yuv2rgb_mode = MODE_32_RGB;
else
this->yuv2rgb_mode = MODE_32_BGR;
case 24:
if( this->bpp == 32 ) {
if(rgb == 0 )
this->yuv2rgb_mode = MODE_32_RGB;
else
this->yuv2rgb_mode = MODE_32_BGR;
}else{
if( rgb == 0 )
this->yuv2rgb_mode = MODE_24_RGB;
else
this->yuv2rgb_mode = MODE_24_BGR;
};
break;
case 16:
if( rgb == 0 )
this->yuv2rgb_mode = MODE_16_RGB;
else
this->yuv2rgb_mode = MODE_16_BGR;
break;
case 15:
if( rgb == 0 )
this->yuv2rgb_mode = MODE_15_RGB;
else
this->yuv2rgb_mode = MODE_15_BGR;
break;
case 8:
if( rgb == 0 )
this->yuv2rgb_mode = MODE_8_RGB;
else
this->yuv2rgb_mode = MODE_8_BGR;
break;
};
//free(this->yuv2rgb_factory );
// this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap,
// this->yuv2rgb_cmap);
};
void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data) {
null_driver_t* this = (null_driver_t*) self;
this->caller = user_data;
this->frameDis = t;
}
+
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6c4d07f..3bd04bc 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,184 +1,185 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/storage.h>
#include <qpe/mimetype.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qdir.h>
#include <qmessagebox.h>
#include <qregexp.h>
#include <qtextstream.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
//only needed for the random play
#include <stdlib.h>
#include "audiowidget.h"
#include "videowidget.h"
extern MediaPlayerState *mediaPlayerState;
PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
: PlayListWidgetGui( parent, name, fl ) {
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist",
this , SLOT(addSelected() ) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist",
this , SLOT(removeSelected() ) );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
this , SLOT( btnPlay( bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
(void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
(void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
(void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
Config cfg( "OpiePlayer" );
bool b= cfg.readBoolEntry("FullScreen", 0);
mediaPlayerState->setFullscreen( b );
pmView->setItemChecked( -16, b );
(void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) );
(void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) );
(void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) );
QVBox *stretch2 = new QVBox( vbox1 );
connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) );
connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) );
connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) );
connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
this,SLOT( playIt( QListViewItem *) ) );
connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
this,SLOT( playIt( QListViewItem *) ) );
connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
+ connect ( gammaSlider, SIGNAL( valueChanged( int ) ), mediaPlayerState, SLOT( setVideoGamma( int ) ) );
readConfig( cfg );
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
loadList(DocLnk( currentPlaylist ) );
setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
// see which skins are installed
videoScan=FALSE;
audioScan=FALSE;
populateSkinsMenu();
initializeStates();
}
PlayListWidget::~PlayListWidget() {
- // WTF?!@?!
+ // WTF?!@?!
if ( d->current ) {
delete d->current;
}
delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
setPlaylist( true );
}
void PlayListWidget::readConfig( Config& cfg ) {
cfg.setGroup( "PlayList" );
QString currentString = cfg.readEntry( "current", "" );
int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
for ( int i = 0; i < noOfFiles; i++ ) {
QString entryName;
entryName.sprintf( "File%i", i + 1 );
QString linkFile = cfg.readEntry( entryName );
if( QFileInfo( linkFile ).exists() ) {
DocLnk lnk( linkFile );
if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) {
d->selectedFiles->addToSelection( lnk );
}
}
}
d->selectedFiles->setSelectedItem( currentString );
}
void PlayListWidget::writeConfig( Config& cfg ) const {
d->selectedFiles->writeCurrent( cfg );
cfg.setGroup( "PlayList" );
int noOfFiles = 0;
d->selectedFiles->first();
do {
const DocLnk *lnk = d->selectedFiles->current();
if ( lnk ) {
QString entryName;
entryName.sprintf( "File%i", noOfFiles + 1 );
cfg.writeEntry( entryName, lnk->linkFile() );
// if this link does exist, add it so we have the file
// next time...
@@ -688,97 +689,97 @@ void PlayListWidget::playSelected() {
void PlayListWidget::scanForAudio() {
// qDebug("scan for audio");
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments(&files, "audio/*");
audioScan = TRUE;
}
void PlayListWidget::scanForVideo() {
// qDebug("scan for video");
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments(&vFiles, "video/*");
videoScan = TRUE;
}
void PlayListWidget::populateAudioView() {
audioView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!audioScan) {
scanForAudio();
}
QListIterator<DocLnk> dit( files.children() );
QListIterator<FileSystem> it ( fs );
QString storage;
for ( ; dit.current(); ++dit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if(dit.current()->file().find(path) != -1 ) {
storage = name;
}
}
QListViewItem * newItem;
if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
long size;
if( dit.current()->file().left(4) == "http" )
size=0;
- else
+ else
size = QFile( dit.current()->file() ).size();
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage);
newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
}
}
}
void PlayListWidget::populateVideoView() {
videoView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!videoScan ) {
scanForVideo();
}
QListIterator<DocLnk> Vdit( vFiles.children() );
QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage;
for ( ; Vdit.current(); ++Vdit ) {
for( ; it.current(); ++it ) {
const QString name = (*it)->name();
const QString path = (*it)->path();
if( Vdit.current()->file().find(path) != -1 ) {
storage=name;
}
}
QListViewItem * newItem;
if ( QFile( Vdit.current()->file() ).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
QString::number( QFile( Vdit.current()->file() ).size() ), storage );
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
}
}
}
void PlayListWidget::openFile() {
QString filename, name;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
@@ -889,97 +890,97 @@ void PlayListWidget::readm3u( const QString &filename ) {
s=s.replace( QRegExp( "\\" ), "/" );
lnk.setFile( s );
lnk.writeLink();
qDebug( "add " + name);
d->selectedFiles->addToSelection( lnk );
} else { // is url
s.replace( QRegExp( "%20" )," " );
DocLnk lnk( s );
QString name;
if( name.left( 4 ) == "http" ) {
name = s.right( s.length() - 7 );
} else {
name = s;
}
lnk.setName( name );
if( s.at( s.length() - 4) == '.' ) {
lnk.setFile( s );
} else {
lnk.setFile( s + "/" );
}
lnk.setType( "audio/x-mpegurl" );
lnk.writeLink();
d->selectedFiles->addToSelection( lnk );
}
i++;
}
}
}
}
f.close();
}
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
fileDlg->exec();
QString filename, list;
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
qDebug( filename );
int noOfFiles = 0;
d->selectedFiles->first();
do {
// we dont check for existance because of url's
// qDebug(d->selectedFiles->current()->file());
// so maybe we should do some net checking to ,-)
// no, cause it takes to long...
-
+
list += d->selectedFiles->current()->file() + "\n";
noOfFiles++;
}
while ( d->selectedFiles->next() );
qDebug( list );
if( filename.left( 1) != "/" ) {
filename=QPEApplication::documentDir() + "/" + filename;
}
if( filename.right( 3 ) != "m3u" ) {
filename=filename+".m3u";
}
QFile f( filename );
f.open( IO_WriteOnly );
f.writeBlock( list, list.length() );
f.close();
}
if( fileDlg ) {
delete fileDlg;
}
}
void PlayListWidget::readPls( const QString &filename ) {
qDebug( "pls filename is " + filename );
QFile f( filename );
if( f.open( IO_ReadOnly ) ) {
QTextStream t( &f );
QString s;//, first, second;
int i = 0;
while ( !t.atEnd() ) {
s = t.readLine();
if( s.left(4) == "File" ) {
s = s.right( s.length() - 6 );
s.replace( QRegExp( "%20" )," ");
qDebug( "adding " + s + " to playlist" );
// numberofentries=2
// File1=http
// Title
// Length
// Version
// File2=http
s = s.replace( QRegExp( "\\" ), "/" );
DocLnk lnk( s );
QFileInfo f( s );
QString name = f.baseName();
if( name.left( 4 ) == "http" ) {
name = s.right( s.length() - 7);
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 2742252..dcfdd48 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -1,74 +1,74 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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 PLAY_LIST_WIDGET_H
#define PLAY_LIST_WIDGET_H
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qtabwidget.h>
#include <qpe/fileselector.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include "playlistwidgetgui.h"
//class PlayListWidgetPrivate;
class Config;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
class PlayListWidget : public PlayListWidgetGui {
Q_OBJECT
public:
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidget();
DocLnkSet files;
DocLnkSet vFiles;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
int selected;
public slots:
bool first();
bool last();
bool next();
bool prev();
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 6ecd016..250833c 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,158 +1,177 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/fileselector.h>
#include <qpe/qpeapplication.h>
#include <qpe/storage.h>
#include <qpe/mimetype.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpopupmenu.h>
#include <qaction.h>
#include <qcursor.h>
#include <qdir.h>
#include <qlayout.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
//only needed for the random play
#include <stdlib.h>
#include "audiowidget.h"
#include "videowidget.h"
#include "mediaplayerstate.h"
extern MediaPlayerState *mediaPlayerState;
PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl ) {
d = new PlayListWidgetPrivate;
d->setDocumentUsed = FALSE;
d->current = NULL;
setBackgroundMode( PaletteButton );
setToolBarsMovable( FALSE );
// Create Toolbar
QPEToolBar *toolbar = new QPEToolBar( this );
toolbar->setHorizontalStretchable( TRUE );
// Create Menubar
QPEMenuBar *menu = new QPEMenuBar( toolbar );
menu->setMargin( 0 );
bar = new QPEToolBar( this );
bar->setLabel( tr( "Play Operations" ) );
tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
tbDeletePlaylist->setFlat( TRUE );
tbDeletePlaylist->setFixedSize( 20, 20 );
tbDeletePlaylist->hide();
pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
pmView->isCheckable();
skinsMenu = new QPopupMenu( this );
pmView->insertItem( tr( "Skins" ), skinsMenu );
skinsMenu->isCheckable();
+ gammaMenu = new QPopupMenu( this );
+ pmView->insertItem( tr( "Gamma" ), gammaMenu );
+ gammaMenu->setMinimumHeight( 50 );
+
+ gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
+ gammaSlider->setRange( -100, 100 );
+ gammaSlider->setTickmarks( QSlider::Left );
+ gammaSlider->setTickInterval( 20 );
+ gammaSlider->setFocusPolicy( QWidget::NoFocus );
+ gammaSlider->setValue( 0 );
+ gammaSlider->setMinimumHeight( 50 );
+
+ gammaLCD = new QLCDNumber( 3, gammaMenu );
+
+ gammaMenu->insertItem( gammaSlider );
+ gammaMenu->insertItem( gammaLCD );
+
+ connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
+
vbox5 = new QVBox( this );
QVBox *vbox4 = new QVBox( vbox5 );
QHBox *hbox6 = new QHBox( vbox4 );
tabWidget = new QTabWidget( hbox6, "tabWidget" );
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
- tabWidget->insertTab( pTab,"Playlist");
+ tabWidget->insertTab( pTab, "Playlist");
QGridLayout *Playout = new QGridLayout( pTab );
Playout->setSpacing( 2);
Playout->setMargin( 2);
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab );
d->playListFrame = vbox3;
QHBox *hbox2 = new QHBox( vbox3 );
d->selectedFiles = new PlayListSelection( hbox2 );
vbox1 = new QVBox( hbox2 );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
QWidget *aTab;
aTab = new QWidget( tabWidget, "aTab" );
QGridLayout *Alayout = new QGridLayout( aTab );
Alayout->setSpacing( 2 );
Alayout->setMargin( 2 );
audioView = new QListView( aTab, "Audioview" );
audioView->addColumn( tr( "Title" ), 140 );
audioView->addColumn( tr( "Size" ), -1 );
audioView->addColumn( tr( "Media" ), -1 );
audioView->setColumnAlignment( 1, Qt::AlignRight );
audioView->setColumnAlignment( 2, Qt::AlignRight );
audioView->setAllColumnsShowFocus( TRUE );
audioView->setSorting( 0, TRUE );
audioView->setMultiSelection( TRUE );
audioView->setSelectionMode( QListView::Extended );
Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
tabWidget->insertTab( aTab, tr( "Audio" ) );
QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
QGridLayout *Vlayout = new QGridLayout( vTab );
Vlayout->setSpacing( 2 );
Vlayout->setMargin( 2 );
videoView = new QListView( vTab, "Videoview" );
videoView->addColumn( tr( "Title" ), 140);
videoView->addColumn( tr( "Size" ), -1 );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 4c8d737..61fd40d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,126 +1,130 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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 PLAY_LIST_WIDGET_GUI_H
#define PLAY_LIST_WIDGET_GUI_H
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
#include <qpe/qpemenubar.h>
#include <qtabwidget.h>
#include <qpe/fileselector.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qaction.h>
-
+#include <qslider.h>
+#include <qlcdnumber.h>
class PlayListWidgetPrivate;
class PlayListSelection;
class Config;
class QPEToolBar;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
class PlayListWidgetPrivate {
public:
QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
QFrame *playListFrame;
FileSelector *files;
PlayListSelection *selectedFiles;
bool setDocumentUsed;
DocLnk *current;
};
class ToolButton : public QToolButton {
public:
ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
: QToolButton( parent, name ) {
setTextLabel( name );
setPixmap( Resource::loadPixmap( icon ) );
setAutoRaise( TRUE );
setFocusPolicy( QWidget::NoFocus );
setToggleButton( t );
connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
QPEMenuToolFocusManager::manager()->addWidget( this );
}
};
class MenuItem : public QAction {
public:
MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
: QAction( text, QString::null, 0, 0 ) {
connect( this, SIGNAL( activated() ), handler, slot );
addTo( parent );
}
};
class PlayListWidgetGui : public QMainWindow {
Q_OBJECT
public:
PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidgetGui();
protected:
QTabWidget * tabWidget;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
QPopupMenu *pmView ;
+ QPopupMenu *gammaMenu;
+ QSlider *gammaSlider;
+ QLCDNumber *gammaLCD;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef;
// retrieve the current playlist entry (media file link)
QPushButton *tbDeletePlaylist;
int selected;
QPopupMenu *pmPlayList;
FileSelector* playLists;
QPopupMenu *skinsMenu;
PlayListWidgetPrivate *d; // Private implementation data
QVBox *vbox1;
QVBox *vbox5;
QPEToolBar *bar;
void setActiveWindow(); // need to handle this to show the right view
void setView( char );
};
#endif
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 12d80ba..d18fde5 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,164 +1,169 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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 <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include "xinecontrol.h"
#include "mediaplayerstate.h"
#include "videowidget.h"
extern MediaPlayerState *mediaPlayerState;
extern VideoWidget *videoUI;
XineControl::XineControl( QObject *parent, const char *name )
: QObject( parent, name ) {
libXine = new XINE::Lib(videoUI->vidWidget() );
connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
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 ) ) );
+ connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
hasVideoChannel=FALSE;
hasAudioChannel=FALSE;
m_fileName = fileName;
-
- qDebug("<<FILENAME: " + fileName + ">>>>");
-
+
+ //qDebug("<<FILENAME: " + 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 );
hasAudioChannel=TRUE;
} else {
libXine->setShowVideo( true );
hasVideoChannel=TRUE;
}
// determine if slider is shown
mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
// Stop the screen from blanking and power saving state
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
<< ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif
length();
position();
}
void XineControl::nextMedia() {
mediaPlayerState->setNext();
}
+void XineControl::setGamma( int value ) {
+ libXine->setGamma( value );
+}
+
void XineControl::stop( bool isSet ) {
if ( !isSet) {
libXine->stop( );
mediaPlayerState->setList();
// mediaPlayerState->setPlaying( false );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
} else {
// play again
}
}
/**
* Pause playback
* @isSet
*/
void XineControl::pause( bool isSet) {
if (isSet) {
libXine->pause();
} else {
libXine->play( m_fileName, 0, m_currentTime);
}
}
/**
* get current time in playback
*/
long XineControl::currentTime() {
// todo: jede sekunde überprüfen
m_currentTime = libXine->currentTime();
return m_currentTime;
QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
}
/**
* Set the length of the media file
*/
void XineControl::length() {
m_length = libXine->length();
mediaPlayerState->setLength( m_length );
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 4263b36..1de610b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,79 +1,106 @@
/*
                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
+..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
+  -_. . .   )=.  = 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();
bool hasVideo() const { return hasVideoChannel; }
bool hasAudio() const { return hasAudioChannel; }
public slots:
void play( const QString& fileName );
void stop( bool );
+
+ /**
+ * Pause the media stream
+ * @param if pause or not
+ */
void pause( bool );
+
+ /**
+ * Set videos fullscreen
+ * @param yes or no
+ */
void setFullscreen( bool );
+
+ /**
+ *
+ */
long currentTime();
void seekTo( long );
// get length of media file and set it
void length();
long position();
+
+ /**
+ * Proceed to the next media file in playlist
+ */
void nextMedia();
+
void videoResized ( const QSize &s );
+ /**
+ * Set the gamma value of the video output
+ * @param int value between -100 and 100, 0 is original
+ */
+ void setGamma( int );
+
+
private:
XINE::Lib *libXine;
MediaDetect mdetect;
- long m_currentTime;
+ long m_currentTime;
long m_position;
int m_length;
QString m_fileName;
bool disabledSuspendScreenSaver : 1;
bool hasVideoChannel : 1;
bool hasAudioChannel : 1;
+
signals:
void positionChanged( long );
};
#endif
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index bc95d86..d06d62a 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -84,164 +84,164 @@ XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name )
m_image = 0;
m_buff = 0;
m_bytes_per_line_fb = qt_screen-> linestep ( );
m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8;
m_rotation = 0;
}
XineVideoWidget::~XineVideoWidget ( )
{
delete m_image;
}
void XineVideoWidget::clear ( )
{
m_buff = 0;
repaint ( false );
}
void XineVideoWidget::paintEvent ( QPaintEvent * )
{
//qWarning( "painting <<<" );
if ( m_buff == 0 ) {
QPainter p ( this );
p. fillRect ( rect ( ), black );
if ( m_image )
p. drawImage ( 0, 0, *m_image );
//qWarning ( "logo\n" );
}
else {
// qWarning ( "paintevent\n" );
QArray <QRect> qt_bug_workaround_clip_rects;
{
QDirectPainter dp ( this );
int rot = dp. transformOrientation ( ) + m_rotation;
uchar *fb = dp. frameBuffer ( );
uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
- const QRect &clip = dp. rect ( i );
+ const QRect &clip = dp. rect ( i );
- qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
+ qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
- uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
- uchar *src = frame;
+ uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
+ uchar *src = frame;
- switch ( rot ) {
+ switch ( rot ) {
case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break;
case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break;
case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
- default: break;
- }
+ default: break;
+ }
- uint leftfill = 0;
- uint framefill = 0;
- uint rightfill = 0;
- uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
+ uint leftfill = 0;
+ uint framefill = 0;
+ uint rightfill = 0;
+ uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
- if ( clip. left ( ) < framerect. left ( ))
- leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
- if ( clip. right ( ) > framerect. right ( ))
- rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
+ if ( clip. left ( ) < framerect. left ( ))
+ leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
+ if ( clip. right ( ) > framerect. right ( ))
+ rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
- framefill = clipwidth - ( leftfill + rightfill );
+ framefill = clipwidth - ( leftfill + rightfill );
- for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
- if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
- memset ( dst, 0, clipwidth );
- }
+ for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
+ if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
+ memset ( dst, 0, clipwidth );
+ }
else {
- if ( leftfill )
- memset ( dst, 0, leftfill );
-
- if ( framefill ) {
- switch ( rot ) {
- case 0: memcpy ( dst + leftfill, src, framefill ); break;
- case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
- case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
- case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
- default: break;
+ if ( leftfill )
+ memset ( dst, 0, leftfill );
+
+ if ( framefill ) {
+ switch ( rot ) {
+ case 0: memcpy ( dst + leftfill, src, framefill ); break;
+ case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
+ case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
+ case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
+ default: break;
+ }
}
- }
if ( rightfill )
- memset ( dst + leftfill + framefill, 0, rightfill );
+ memset ( dst + leftfill + framefill, 0, rightfill );
}
- dst += m_bytes_per_line_fb;
+ dst += m_bytes_per_line_fb;
- switch ( rot ) {
- case 0: src += m_bytes_per_line_frame; break;
- case 1: src -= m_bytes_per_pixel; break;
- case 2: src -= m_bytes_per_line_frame; break;
+ switch ( rot ) {
+ case 0: src += m_bytes_per_line_frame; break;
+ case 1: src -= m_bytes_per_pixel; break;
+ case 2: src -= m_bytes_per_line_frame; break;
case 3: src += m_bytes_per_pixel; break;
- default: break;
+ default: break;
+ }
}
- }
}
}
//qWarning ( " ||| painting |||" );
{
- // QVFB hack by MArtin Jones
- QPainter p ( this );
+ // QVFB hack by MArtin Jones
+ QPainter p ( this );
- for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
- p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
- }
+ for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
+ p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
+ }
}
}
//qWarning( "painting >>>" );
}
void XineVideoWidget::setImage ( QImage* image )
{
delete m_image;
m_image = image;
}
void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl )
{
bool rot90 = (( -m_rotation ) & 1 );
if ( rot90 ) {
int d = w;
w = h;
h = d;
}
m_lastframe = m_thisframe;
m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
// qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
m_buff = img;
m_bytes_per_line_frame = bpl;
repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
}
void XineVideoWidget::resizeEvent ( QResizeEvent * )
{
QSize s = size ( );
bool fs = ( s == qApp-> desktop ( )-> size ( ));
m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
if ( fs && qt_screen-> isTransformed ( )) {
s = qt_screen-> mapToDevice ( s );
}
// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation );
emit videoResized ( s );
}
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.c b/noncore/multimedia/opieplayer2/yuv2rgb.c
index 22bb4cb..e8e86e6 100644
--- a/noncore/multimedia/opieplayer2/yuv2rgb.c
+++ b/noncore/multimedia/opieplayer2/yuv2rgb.c
@@ -3018,106 +3018,105 @@ static void yuy22rgb_c_init (yuv2rgb_factory_t *this)
case MODE_16_RGB:
this->yuy22rgb_fun = yuy22rgb_c_16;
break;
case MODE_8_RGB:
case MODE_8_BGR:
this->yuy22rgb_fun = yuy22rgb_c_8;
break;
case MODE_8_GRAY:
this->yuy22rgb_fun = yuy22rgb_c_gray;
break;
case MODE_PALETTE:
this->yuy22rgb_fun = yuy22rgb_c_palette;
break;
default:
printf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode);
}
}
yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) {
yuv2rgb_t *this = xine_xmalloc (sizeof (yuv2rgb_t));
this->cmap = factory->cmap;
this->y_chunk = this->y_buffer = NULL;
this->u_chunk = this->u_buffer = NULL;
this->v_chunk = this->v_buffer = NULL;
this->table_rV = factory->table_rV;
this->table_gU = factory->table_gU;
this->table_gV = factory->table_gV;
this->table_bU = factory->table_bU;
this->yuv2rgb_fun = factory->yuv2rgb_fun;
this->yuy22rgb_fun = factory->yuy22rgb_fun;
this->yuv2rgb_single_pixel_fun = factory->yuv2rgb_single_pixel_fun;
this->configure = yuv2rgb_configure;
return this;
}
/*
* factory functions
*/
-
void yuv2rgb_set_gamma (yuv2rgb_factory_t *this, int gamma) {
-
- int i;
-
- for (i = 0; i < 256; i++) {
- (uint8_t *)this->table_rV[i] += this->entry_size*(gamma - this->gamma);
- (uint8_t *)this->table_gU[i] += this->entry_size*(gamma - this->gamma);
- (uint8_t *)this->table_bU[i] += this->entry_size*(gamma - this->gamma);
- }
+
+ int i;
+
+ for (i = 0; i < 256; i++) {
+ (uint8_t *)this->table_rV[i] += this->entry_size*(gamma - this->gamma);
+ (uint8_t *)this->table_gU[i] += this->entry_size*(gamma - this->gamma);
+ (uint8_t *)this->table_bU[i] += this->entry_size*(gamma - this->gamma);
+ }
#ifdef ARCH_X86
mmx_yuv2rgb_set_gamma(gamma);
#endif
this->gamma = gamma;
}
int yuv2rgb_get_gamma (yuv2rgb_factory_t *this) {
return this->gamma;
}
yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped,
uint8_t *cmap) {
yuv2rgb_factory_t *this;
#ifdef ARCH_X86
uint32_t mm = xine_mm_accel();
#endif
this = malloc (sizeof (yuv2rgb_factory_t));
this->mode = mode;
this->swapped = swapped;
this->cmap = cmap;
this->create_converter = yuv2rgb_create_converter;
this->set_gamma = yuv2rgb_set_gamma;
this->get_gamma = yuv2rgb_get_gamma;
this->matrix_coefficients = 6;
yuv2rgb_setup_tables (this, mode, swapped);
/*
* auto-probe for the best yuv2rgb function
*/
this->yuv2rgb_fun = NULL;
#ifdef ARCH_X86
if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMXEXT)) {
yuv2rgb_init_mmxext (this);
if (this->yuv2rgb_fun != NULL)
printf ("yuv2rgb: using MMXEXT for colorspace transform\n");
}
if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMX)) {