summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinecontrol.cpp
Unidiff
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
@@ -35,2 +35,3 @@
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h>
36#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
@@ -45,2 +46,3 @@ XineControl::XineControl( QObject *parent, const char *name )
45 : QObject( parent, name ) { 46 : QObject( parent, name ) {
47
46 libXine = new XINE::Lib(videoUI->vidWidget() ); 48 libXine = new XINE::Lib(videoUI->vidWidget() );
@@ -77,10 +79,13 @@ void XineControl::play( const QString& fileName ) {
77 79
78 libXine->play( fileName ); 80 if ( !libXine->play( fileName ) ) {
79 mediaPlayerState->setPlaying( true ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
80 char whichGui = mdetect.videoOrAudio( fileName );
81 if (whichGui == 'f') {
82 qDebug("Nicht erkannter Dateityp");
83 return; 82 return;
84 } 83 }
85 if (whichGui == 'a') { 84 mediaPlayerState->setPlaying( true );
85
86 char whichGui;
87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
88 if ( !libXine->hasVideo() ) {
89 whichGui = 'a';
90 qDebug("HAS AUDIO");
86 libXine->setShowVideo( false ); 91 libXine->setShowVideo( false );
@@ -88,2 +93,4 @@ void XineControl::play( const QString& fileName ) {
88 } else { 93 } else {
94 whichGui = 'v';
95 qDebug("HAS VIDEO");
89 libXine->setShowVideo( true ); 96 libXine->setShowVideo( true );
@@ -96,3 +103,2 @@ void XineControl::play( const QString& fileName ) {
96 103
97
98#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 104#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
@@ -129,3 +135,2 @@ void XineControl::stop( bool isSet ) {
129#endif 135#endif
130
131 } 136 }
@@ -174,5 +179,6 @@ long XineControl::position() {
174 emit positionChanged( emitPos ); 179 emit positionChanged( emitPos );
175 if(mediaPlayerState->isPlaying) 180 if( mediaPlayerState->isPlaying ) {
176 // needs to be stopped the media is stopped 181 // needs to be stopped the media is stopped
177 QTimer::singleShot( 1000, this, SLOT( position() ) ); 182 QTimer::singleShot( 1000, this, SLOT( position() ) );
183 }
178// qDebug("POSITION : %d", m_position); 184// qDebug("POSITION : %d", m_position);
@@ -189,2 +195,43 @@ void XineControl::setFullscreen( bool isSet ) {
189 195
196
197QString XineControl::getMetaInfo() {
198
199 QString returnString;
200
201 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
202 returnString += tr( " Titel: " + libXine->metaInfo( 0 ) );
203 }
204
205 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
207 }
208
209 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
211 }
212
213 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
215 }
216
217 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
219 }
220
221 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
223 }
224 return returnString;
225}
226
227QString XineControl::getErrorCode() {
228 int errorCode = libXine->error();
229
230 if ( errorCode == 1 ) {
231 return tr( "No input plugin found for this media type" );
232 } else {
233 return tr( "Some other error" );
234 }
235}
236
190/** 237/**
@@ -194,3 +241,3 @@ void XineControl::setFullscreen( bool isSet ) {
194void XineControl::seekTo( long second ) { 241void XineControl::seekTo( long second ) {
195 libXine->play( m_fileName , 0, (int)second ); 242 libXine->seekTo( (int)second );
196} 243}