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) (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 | |||
@@ -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,6 +46,7 @@ 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 & ) ) ); |
49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
@@ -54,3 +56,3 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
54 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
55 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
56 | 58 | ||
@@ -64,3 +66,3 @@ XineControl::~XineControl() { | |||
64 | // Re-enable the suspend mode | 66 | // Re-enable the suspend mode |
65 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
66 | } | 68 | } |
@@ -71,4 +73,4 @@ XineControl::~XineControl() { | |||
71 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
72 | hasVideoChannel=FALSE; | 74 | hasVideoChannel = FALSE; |
73 | hasAudioChannel=FALSE; | 75 | hasAudioChannel = FALSE; |
74 | m_fileName = fileName; | 76 | m_fileName = fileName; |
@@ -77,15 +79,20 @@ 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 ); |
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 | } |
@@ -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) |
@@ -101,3 +107,3 @@ void XineControl::play( const QString& fileName ) { | |||
101 | // Stop the screen from blanking and power saving state | 107 | // Stop the screen from blanking and power saving state |
102 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) | 108 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
103 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 109 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
@@ -119,4 +125,4 @@ void XineControl::setGamma( int value ) { | |||
119 | void XineControl::stop( bool isSet ) { | 125 | void XineControl::stop( bool isSet ) { |
120 | if ( !isSet) { | 126 | if ( !isSet ) { |
121 | libXine->stop( ); | 127 | libXine->stop(); |
122 | 128 | ||
@@ -126,6 +132,5 @@ void XineControl::stop( bool isSet ) { | |||
126 | // Re-enable the suspend mode | 132 | // Re-enable the suspend mode |
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 | } |
@@ -138,6 +143,6 @@ void XineControl::stop( bool isSet ) { | |||
138 | void XineControl::pause( bool isSet) { | 143 | void XineControl::pause( bool isSet) { |
139 | if (isSet) { | 144 | if ( isSet ) { |
140 | libXine->pause(); | 145 | libXine->pause(); |
141 | } else { | 146 | } else { |
142 | libXine->play( m_fileName, 0, m_currentTime); | 147 | libXine->play( m_fileName, 0, m_currentTime ); |
143 | } | 148 | } |
@@ -151,3 +156,3 @@ long XineControl::currentTime() { | |||
151 | // todo: jede sekunde überprüfen | 156 | // todo: jede sekunde überprüfen |
152 | m_currentTime = libXine->currentTime(); | 157 | m_currentTime = libXine->currentTime(); |
153 | return m_currentTime; | 158 | return m_currentTime; |
@@ -170,10 +175,11 @@ void XineControl::length() { | |||
170 | long XineControl::position() { | 175 | long XineControl::position() { |
171 | m_position = ( currentTime() ); | 176 | m_position = ( currentTime() ); |
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() ) ); |
178 | // qDebug("POSITION : %d", m_position); | 183 | } |
184 | // qDebug("POSITION : %d", m_position); | ||
179 | return m_position; | 185 | return m_position; |
@@ -186,3 +192,44 @@ long XineControl::position() { | |||
186 | void XineControl::setFullscreen( bool isSet ) { | 192 | void XineControl::setFullscreen( bool isSet ) { |
187 | libXine->showVideoFullScreen( isSet); | 193 | libXine->showVideoFullScreen( isSet ); |
194 | } | ||
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 | } | ||
188 | } | 235 | } |
@@ -194,3 +241,3 @@ void XineControl::setFullscreen( bool isSet ) { | |||
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 | } |
@@ -198,3 +245,3 @@ void XineControl::seekTo( long second ) { | |||
198 | void XineControl::videoResized ( const QSize &s ) { | 245 | void XineControl::videoResized ( const QSize &s ) { |
199 | libXine-> resize ( s ); | 246 | libXine->resize( s ); |
200 | } | 247 | } |