summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinecontrol.cpp
authorharlekin <harlekin>2002-10-01 15:36:31 (UTC)
committer harlekin <harlekin>2002-10-01 15:36:31 (UTC)
commit657eeb18141838eeb0d18351a6755d7fa686f9d9 (patch) (side-by-side diff)
tree049c19f776543aee296ce0cd3a1fde8c37ec374b /noncore/multimedia/opieplayer2/xinecontrol.cpp
parentbba0335bbea81519beafb7fec1979a0abbd8a7ea (diff)
downloadopie-657eeb18141838eeb0d18351a6755d7fa686f9d9.zip
opie-657eeb18141838eeb0d18351a6755d7fa686f9d9.tar.gz
opie-657eeb18141838eeb0d18351a6755d7fa686f9d9.tar.bz2
mediadetect no longer needed, also beginning of id3 etc tag info support along with some other small fixes
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp67
1 files changed, 57 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index fabc9a5..c22822c 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -33,6 +33,7 @@
#include <qtimer.h>
+#include <qmessagebox.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include "xinecontrol.h"
@@ -43,6 +44,7 @@ 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 & )));
@@ -75,17 +77,22 @@ void XineControl::play( const QString& fileName ) {
//qDebug("<<FILENAME: " + fileName + ">>>>");
- libXine->play( fileName );
- mediaPlayerState->setPlaying( true );
- char whichGui = mdetect.videoOrAudio( fileName );
- if (whichGui == 'f') {
- qDebug("Nicht erkannter Dateityp");
+ if ( !libXine->play( fileName ) ) {
+ QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
return;
}
- if (whichGui == 'a') {
+ 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;
}
@@ -94,7 +101,6 @@ void XineControl::play( const QString& fileName ) {
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
-
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
@@ -127,7 +133,6 @@ void XineControl::stop( bool isSet ) {
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
-
}
}
@@ -172,9 +177,10 @@ long XineControl::position() {
mediaPlayerState->updatePosition( m_position );
long emitPos = (long)m_position;
emit positionChanged( emitPos );
- if(mediaPlayerState->isPlaying)
+ 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;
}
@@ -187,12 +193,53 @@ void XineControl::setFullscreen( bool isSet ) {
libXine->showVideoFullScreen( isSet);
}
+
+QString XineControl::getMetaInfo() {
+
+ QString returnString;
+
+ if ( !libXine->metaInfo( 0 ).isEmpty() ) {
+ returnString += tr( " Titel: " + 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();
+
+ if ( errorCode == 1 ) {
+ return tr( "No input plugin found for this media type" );
+ } 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->play( m_fileName , 0, (int)second );
+ libXine->seekTo( (int)second );
}
void XineControl::videoResized ( const QSize &s ) {