summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinecontrol.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp11
1 files changed, 11 insertions, 0 deletions
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
@@ -34,96 +34,98 @@
#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)
@@ -180,68 +182,77 @@ long XineControl::position() {
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 );
}