Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 67 |
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 | |||
@@ -34,4 +34,5 @@ | |||
34 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qmessagebox.h> | ||
36 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
37 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
@@ -44,4 +45,5 @@ extern VideoWidget *videoUI; | |||
44 | XineControl::XineControl( QObject *parent, const char *name ) | 45 | 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() ); |
47 | 49 | ||
@@ -76,15 +78,20 @@ void XineControl::play( const QString& fileName ) { | |||
76 | //qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | //qDebug("<<FILENAME: " + 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 ); |
87 | hasAudioChannel=TRUE; | 92 | hasAudioChannel=TRUE; |
88 | } else { | 93 | } else { |
94 | whichGui = 'v'; | ||
95 | qDebug("HAS VIDEO"); | ||
89 | libXine->setShowVideo( true ); | 96 | libXine->setShowVideo( true ); |
90 | hasVideoChannel=TRUE; | 97 | hasVideoChannel=TRUE; |
@@ -95,5 +102,4 @@ void XineControl::play( const QString& fileName ) { | |||
95 | mediaPlayerState->setView( whichGui ); | 102 | mediaPlayerState->setView( whichGui ); |
96 | 103 | ||
97 | |||
98 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 104 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
99 | if ( !disabledSuspendScreenSaver ) { | 105 | if ( !disabledSuspendScreenSaver ) { |
@@ -128,5 +134,4 @@ void XineControl::stop( bool isSet ) { | |||
128 | } | 134 | } |
129 | #endif | 135 | #endif |
130 | |||
131 | } | 136 | } |
132 | } | 137 | } |
@@ -173,7 +178,8 @@ long XineControl::position() { | |||
173 | long emitPos = (long)m_position; | 178 | long emitPos = (long)m_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); |
179 | return m_position; | 185 | return m_position; |
@@ -188,4 +194,45 @@ void XineControl::setFullscreen( bool isSet ) { | |||
188 | } | 194 | } |
189 | 195 | ||
196 | |||
197 | QString 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 | |||
227 | QString 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 | /** |
191 | * Seek to a position in the track | 238 | * Seek to a position in the track |
@@ -193,5 +240,5 @@ void XineControl::setFullscreen( bool isSet ) { | |||
193 | */ | 240 | */ |
194 | void XineControl::seekTo( long second ) { | 241 | void XineControl::seekTo( long second ) { |
195 | libXine->play( m_fileName , 0, (int)second ); | 242 | libXine->seekTo( (int)second ); |
196 | } | 243 | } |
197 | 244 | ||