author | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
commit | 657eeb18141838eeb0d18351a6755d7fa686f9d9 (patch) (unidiff) | |
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) (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 | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
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> |
38 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
@@ -43,6 +44,7 @@ extern MediaPlayerState *mediaPlayerState; | |||
43 | extern VideoWidget *videoUI; | 44 | 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 | ||
48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | 50 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); |
@@ -75,17 +77,22 @@ void XineControl::play( const QString& fileName ) { | |||
75 | 77 | ||
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; |
91 | } | 98 | } |
@@ -94,7 +101,6 @@ void XineControl::play( const QString& fileName ) { | |||
94 | // which gui (video / audio) | 101 | // which gui (video / audio) |
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 ) { |
100 | disabledSuspendScreenSaver = TRUE; | 106 | disabledSuspendScreenSaver = TRUE; |
@@ -127,7 +133,6 @@ void XineControl::stop( bool isSet ) { | |||
127 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 133 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
128 | } | 134 | } |
129 | #endif | 135 | #endif |
130 | |||
131 | } | 136 | } |
132 | } | 137 | } |
133 | 138 | ||
@@ -172,9 +177,10 @@ long XineControl::position() { | |||
172 | mediaPlayerState->updatePosition( m_position ); | 177 | mediaPlayerState->updatePosition( m_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; |
180 | } | 186 | } |
@@ -187,12 +193,53 @@ void XineControl::setFullscreen( bool isSet ) { | |||
187 | libXine->showVideoFullScreen( isSet); | 193 | libXine->showVideoFullScreen( 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 |
192 | * @param second the second to jump to | 239 | * @param second the second to jump to |
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 | ||
198 | void XineControl::videoResized ( const QSize &s ) { | 245 | void XineControl::videoResized ( const QSize &s ) { |