summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/lib.h3
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c8
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp11
4 files changed, 21 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 1ebbbd8..19b64e8 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -108,171 +108,172 @@ Lib::Lib( XineVideoWidget* widget ) {
::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
m_wid->repaint();
}
m_queue = xine_event_new_queue (m_stream);
xine_event_create_listener_thread (m_queue, xine_event_handler, this);
}
Lib::~Lib() {
// free( m_config );
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;
return "test";
}
int Lib::majorVersion() {
xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
return m_major_version;
}
int Lib::minorVersion() {
xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
return m_minor_version;
}
int Lib::subVersion() {
xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
return m_sub_version;
}
int Lib::play( const QString& fileName, int startPos, int start_time ) {
QString str = fileName.stripWhiteSpace();
if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
return 0;
}
return xine_play( m_stream, startPos, start_time);
}
void Lib::stop() {
qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
xine_stop( m_stream );
}
void Lib::pause() {
xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
}
int Lib::speed() {
return xine_get_param ( m_stream, XINE_PARAM_SPEED );
}
void Lib::setSpeed( int speed ) {
xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
}
int Lib::status() {
return xine_get_status( m_stream );
}
int Lib::currentPosition() {
xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
return m_pos;
}
int Lib::currentTime() {
xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
return m_time/1000;
}
int Lib::length() {
xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
return m_length/1000;
}
bool Lib::isSeekable() {
return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
}
void Lib::seekTo( int time ) {
//xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
- xine_play( m_stream, 0, time );
+ // since its now milliseconds we need *1000
+ xine_play( m_stream, 0, time*1000 );
}
Frame Lib::currentFrame() {
Frame frame;
return frame;
};
QString Lib::metaInfo( int number) {
return xine_get_meta_info( m_stream, number );
}
int Lib::error() {
return xine_get_error( m_stream );
};
void Lib::handleXineEvent( const xine_event_t* t ) {
if ( t->type == XINE_EVENT_UI_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 );
}
bool Lib::hasVideo() {
return xine_get_stream_info( m_stream, 18 );
}
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) );
/* int gammaValue = ( 100 + value ); */
::null_set_videoGamma( m_videoOutput, value );
}
bool Lib::isScaling() {
return ::null_is_scaling( m_videoOutput );
}
void Lib::xine_event_handler( void* user_data, const 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;
}
m_wid-> setVideoFrame ( frame, width, height, bytes );
}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 191dbbd..38938a1 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,199 +1,202 @@
/*
                This file is part of the Opie Project
              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
Copyright (c) 2002 LJP <>
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 ZECKEXINELIB_H
#define ZECKEXINELIB_H
#include <qcstring.h>
#include <qstring.h>
#include <qobject.h>
#include <xine.h>
//#include "xine.h"
class XineVideoWidget;
namespace XINE {
/**
* Lib wrapps the simple interface
* of libxine for easy every day use
* This will become a full C++ Wrapper
* It supports playing, pausing, info,
* stooping, seeking.
*/
class Frame;
class Lib : public QObject {
Q_OBJECT
public:
Lib(XineVideoWidget* = 0);
~Lib();
QCString version();
int majorVersion()/*const*/;
int minorVersion()/*const*/;
int subVersion()/*const*/;
void resize ( const QSize &s );
int play( const QString& fileName,
int startPos = 0,
int start_time = 0 );
void stop() /*const*/;
void pause()/*const*/;
int speed() /*const*/;
/**
* Set the speed of the stream, if codec supports it
* XINE_SPEED_PAUSE 0
* XINE_SPEED_SLOW_4 1
* XINE_SPEED_SLOW_2 2
* XINE_SPEED_NORMAL 4
* XINE_SPEED_FAST_2 8
*XINE_SPEED_FAST_4 16
*/
void setSpeed( int speed = XINE_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*/ ;
/**
* Get the meta info (like author etc) from the stream
* XINE_META_INFO_TITLE 0
* XINE_META_INFO_COMMENT 1
* XINE_META_INFO_ARTIST 2
* XINE_META_INFO_GENRE 3
* XINE_META_INFO_ALBUM 4
* XINE_META_INFO_YEAR 5
* XINE_META_INFO_VIDEOCODEC 6
* XINE_META_INFO_AUDIOCODEC 7
* XINE_META_INFO_SYSTEMLAYER 8
* XINE_META_INFO_INPUT_PLUGIN 9
*/
QString metaInfo( int number );
/**
*
*/
bool isScaling();
/**
* seek to a position
*/
void seekTo( int time );
/**
*
* @return is media stream has video
*/
bool hasVideo();
/**
*
*/
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
* XINE_ERROR_NONE 0
* XINE_ERROR_NO_INPUT_PLUGIN 1
* XINE_ERROR_NO_DEMUXER_PLUGIN 2
* XINE_ERROR_DEMUXER_FAILED 3
*/
int error() /*const*/;
signals:
+
void stopped();
+
private:
int m_bytes_per_pixel;
int m_length, m_pos, m_time;
int m_major_version, m_minor_version, m_sub_version;
bool m_video:1;
XineVideoWidget *m_wid;
xine_t *m_xine;
xine_stream_t *m_stream;
xine_cfg_entry_t *m_config;
xine_vo_driver_t *m_videoOutput;
xine_ao_driver_t* m_audioOutput;
xine_event_queue_t *m_queue;
void handleXineEvent( const 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, const 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/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index dcdfae6..b1f4811 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -346,254 +346,256 @@ static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){
if (!this->m_show_video)
return;
if( display != NULL ) {
(*display)(this->caller, frame->data,
frame->sc.output_width, frame->sc.output_height,
frame->bytes_per_line );
}
frame->frame.displayed (&frame->frame);
}
/* blending related */
static void null_overlay_clut_yuv2rgb (null_driver_t *this,
vo_overlay_t *overlay,
opie_frame_t *frame) {
int i;
clut_t* clut = (clut_t*) overlay->color;
if (!overlay->rgb_clut) {
for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
*((uint32_t *)&clut[i]) =
frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
clut[i].y, clut[i].cb, clut[i].cr);
}
overlay->rgb_clut++;
}
if (!overlay->clip_rgb_clut) {
clut = (clut_t*) overlay->clip_color;
for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
*((uint32_t *)&clut[i]) =
frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
clut[i].y, clut[i].cb, clut[i].cr);
}
overlay->clip_rgb_clut++;
}
}
static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
null_driver_t *this = (null_driver_t *) this_gen;
opie_frame_t *frame = (opie_frame_t *) frame_gen;
if(!this->m_show_video || frame->sc.output_width == 0
|| frame->sc.output_height== 0)
return;
/* Alpha Blend here */
if (overlay->rle) {
if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
null_overlay_clut_yuv2rgb(this,overlay,frame);
switch(this->bpp) {
case 16:
blend_rgb16( (uint8_t *)frame->data, overlay,
frame->sc.output_width, frame->sc.output_height,
frame->sc.delivered_width, frame->sc.delivered_height);
break;
case 24:
blend_rgb24( (uint8_t *)frame->data, overlay,
frame->sc.output_width, frame->sc.output_height,
frame->sc.delivered_width, frame->sc.delivered_height);
break;
case 32:
blend_rgb32( (uint8_t *)frame->data, overlay,
frame->sc.output_width, frame->sc.output_height,
frame->sc.delivered_width, frame->sc.delivered_height);
break;
default:
/* It should never get here */
break;
}
}
}
static int null_get_property( xine_vo_driver_t* self,
int property ){
return 0;
}
static int null_set_property( xine_vo_driver_t* self,
int property,
int value ){
return value;
}
static void null_get_property_min_max( xine_vo_driver_t* self,
int property, int *min,
int *max ){
*max = 0;
*min = 0;
}
static int null_gui_data_exchange( xine_vo_driver_t* self,
int data_type,
void *data ){
return 0;
}
-static void null_exit( xine_vo_driver_t* self ){
+static void null_dispose ( xine_vo_driver_t* self ){
null_driver_t* this = (null_driver_t*)self;
free ( this );
}
static int null_redraw_needed( xine_vo_driver_t* self ){
return 0;
}
xine_vo_driver_t* init_video_out_plugin( config_values_t* conf,
void* video ){
null_driver_t *vo;
vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
/* memset? */
memset(vo,0, sizeof(null_driver_t ) );
vo_scale_init (&vo->sc, 0, 0);
vo->sc.gui_pixel_aspect = 1.0;
vo->m_show_video = 0; // false
vo->m_video_fullscreen = 0;
vo->m_is_scaling = 0;
vo->display_ratio = 1.0;
vo->gui_width = 16;
vo->gui_height = 8;
vo->frameDis = NULL;
/* install callback handlers*/
vo->vo_driver.get_capabilities = null_get_capabilities;
vo->vo_driver.alloc_frame = null_alloc_frame;
vo->vo_driver.update_frame_format = null_update_frame_format;
vo->vo_driver.display_frame = null_display_frame;
vo->vo_driver.overlay_blend = null_overlay_blend;
vo->vo_driver.get_property = null_get_property;
vo->vo_driver.set_property = null_set_property;
vo->vo_driver.get_property_min_max = null_get_property_min_max;
vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
- vo->vo_driver.exit = null_exit;
+ vo->vo_driver.dispose = null_dispose;
vo->vo_driver.redraw_needed = null_redraw_needed;
/* 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);
return ( xine_vo_driver_t*) vo;
}
+#if 0
static vo_info_t vo_info_null = {
5,
- "null plugin",
XINE_VISUAL_TYPE_FB
};
vo_info_t *get_video_out_plugin_info(){
vo_info_null.description = _("xine video output plugin using null device");
return &vo_info_null;
}
+#endif
+
/* this is special for this device */
/**
* We know that we will be controled by the XINE LIB++
*/
/**
*
*/
int null_is_showing_video( xine_vo_driver_t* self ){
null_driver_t* this = (null_driver_t*)self;
return this->m_show_video;
}
void null_set_show_video( xine_vo_driver_t* self, int show ) {
((null_driver_t*)self)->m_show_video = show;
}
int null_is_fullscreen( xine_vo_driver_t* self ){
return ((null_driver_t*)self)->m_video_fullscreen;
}
void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
((null_driver_t*)self)->m_video_fullscreen = screen;
}
int null_is_scaling( xine_vo_driver_t* self ){
return ((null_driver_t*)self)->m_is_scaling;
}
void null_set_videoGamma( xine_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( xine_vo_driver_t* self, int scale ) {
((null_driver_t*)self)->m_is_scaling = scale;
}
void null_set_gui_width( xine_vo_driver_t* self, int width ) {
((null_driver_t*)self)->gui_width = width;
}
void null_set_gui_height( xine_vo_driver_t* self, int height ) {
((null_driver_t*)self)->gui_height = height;
}
void null_set_mode( xine_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);
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 31ac9dc..03176b3 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,247 +1,258 @@
/*
                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 <qtimer.h>
#include <qmessagebox.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 + ">>>>");
if ( !libXine->play( fileName ) ) {
QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
+ // toggle stop so the the play button is reset
+ mediaPlayerState->setPlaying( false );
return;
}
mediaPlayerState->setPlaying( true );
char whichGui;
// qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
if ( !libXine->hasVideo() ) {
whichGui = 'a';
qDebug("HAS AUDIO");
libXine->setShowVideo( false );
hasAudioChannel = TRUE;
} else {
whichGui = 'v';
qDebug("HAS VIDEO");
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();
#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
}
}
/**
* 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 );
}
/**
* Reports the position the xine backend is at right now
* @return long the postion in seconds
*/
long XineControl::position() {
m_position = ( currentTime() );
mediaPlayerState->updatePosition( m_position );
long emitPos = (long)m_position;
emit positionChanged( emitPos );
if( mediaPlayerState->isPlaying ) {
// needs to be stopped the media is stopped
QTimer::singleShot( 1000, this, SLOT( position() ) );
}
// qDebug("POSITION : %d", m_position);
return m_position;
}
/**
* Set videoplayback to fullscreen
* @param isSet
*/
void XineControl::setFullscreen( bool isSet ) {
libXine->showVideoFullScreen( isSet );
}
QString XineControl::getMetaInfo() {
QString returnString;
if ( !libXine->metaInfo( 0 ).isEmpty() ) {
returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
}
if ( !libXine->metaInfo( 1 ).isEmpty() ) {
returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
}
if ( !libXine->metaInfo( 2 ).isEmpty() ) {
returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
}
if ( !libXine->metaInfo( 3 ).isEmpty() ) {
returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
}
if ( !libXine->metaInfo( 4 ).isEmpty() ) {
returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
}
if ( !libXine->metaInfo( 5 ).isEmpty() ) {
returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
}
return returnString;
}
QString XineControl::getErrorCode() {
+
int errorCode = libXine->error();
+ qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
+
if ( errorCode == 1 ) {
return tr( "No input plugin found for this media type" );
+ } else if ( errorCode == 2 ) {
+ return tr( "No demux plugin found for this media type" );
+ } else if ( errorCode == 3 ) {
+ return tr( "Demuxing failed for this media type" );
+ } else if ( errorCode == 4 ) {
+ return tr( "Malformed MRL" );
} else {
return tr( "Some other error" );
}
}
/**
* Seek to a position in the track
* @param second the second to jump to
*/
void XineControl::seekTo( long second ) {
libXine->seekTo( (int)second );
}
void XineControl::videoResized ( const QSize &s ) {
libXine->resize( s );
}