author | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
commit | 657eeb18141838eeb0d18351a6755d7fa686f9d9 (patch) (side-by-side diff) | |
tree | 049c19f776543aee296ce0cd3a1fde8c37ec374b /noncore/multimedia/opieplayer2/xinecontrol.cpp | |
parent | bba0335bbea81519beafb7fec1979a0abbd8a7ea (diff) | |
download | opie-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) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 109 |
1 files changed, 78 insertions, 31 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 @@ -34,4 +34,5 @@ #include <qtimer.h> +#include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> @@ -44,8 +45,9 @@ 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 ( 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 ) ) ); @@ -53,5 +55,5 @@ XineControl::XineControl( QObject *parent, const char *name ) 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() ) ); + connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); disabledSuspendScreenSaver = FALSE; @@ -63,5 +65,5 @@ XineControl::~XineControl() { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode - QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; + QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif @@ -70,23 +72,28 @@ XineControl::~XineControl() { void XineControl::play( const QString& fileName ) { - hasVideoChannel=FALSE; - hasAudioChannel=FALSE; + hasVideoChannel = FALSE; + hasAudioChannel = FALSE; m_fileName = 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; + hasAudioChannel = TRUE; } else { + whichGui = 'v'; + qDebug("HAS VIDEO"); libXine->setShowVideo( true ); - hasVideoChannel=TRUE; + hasVideoChannel = TRUE; } // determine if slider is shown @@ -95,10 +102,9 @@ void XineControl::play( const QString& fileName ) { 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)" ) + QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); } @@ -118,6 +124,6 @@ void XineControl::setGamma( int value ) { void XineControl::stop( bool isSet ) { - if ( !isSet) { - libXine->stop( ); + if ( !isSet ) { + libXine->stop(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) @@ -125,8 +131,7 @@ void XineControl::stop( bool isSet ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode - QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; + QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif - } } @@ -137,8 +142,8 @@ void XineControl::stop( bool isSet ) { */ void XineControl::pause( bool isSet) { - if (isSet) { + if ( isSet ) { libXine->pause(); } else { - libXine->play( m_fileName, 0, m_currentTime); + libXine->play( m_fileName, 0, m_currentTime ); } } @@ -150,5 +155,5 @@ void XineControl::pause( bool isSet) { long XineControl::currentTime() { // todo: jede sekunde überprüfen - m_currentTime = libXine->currentTime(); + m_currentTime = libXine->currentTime(); return m_currentTime; QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); @@ -169,12 +174,13 @@ void XineControl::length() { */ long XineControl::position() { - m_position = ( currentTime() ); - mediaPlayerState->updatePosition( m_position ); + m_position = ( currentTime() ); + 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); + QTimer::singleShot( 1000, this, SLOT( position() ) ); + } + // qDebug("POSITION : %d", m_position); return m_position; } @@ -185,5 +191,46 @@ long XineControl::position() { */ void XineControl::setFullscreen( bool isSet ) { - libXine->showVideoFullScreen( 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" ); + } } @@ -193,8 +240,8 @@ void XineControl::setFullscreen( bool isSet ) { */ void XineControl::seekTo( long second ) { - libXine->play( m_fileName , 0, (int)second ); + libXine->seekTo( (int)second ); } void XineControl::videoResized ( const QSize &s ) { - libXine-> resize ( s ); + libXine->resize( s ); } |