-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 50 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 25 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 68 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 42 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol_threaded.cpp | 54 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 18 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.cpp | 26 | ||||
-rw-r--r-- | core/multimedia/opieplayer/modplug/memfile.cpp | 6 | ||||
-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 18 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 19 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 90 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 25 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/libtremorplugin.cpp | 31 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.cpp | 48 |
14 files changed, 292 insertions, 228 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 355062b..9b64e07 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -20,21 +20,25 @@ | |||
20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 | 20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 |
21 | 21 | ||
22 | 22 | ||
23 | #include <stdlib.h> | ||
24 | #include <stdio.h> | ||
25 | #include <qpe/qpeapplication.h> | ||
26 | #include <qpe/config.h> | ||
27 | #include <qmessagebox.h> | ||
28 | |||
29 | #include "audiodevice.h" | 23 | #include "audiodevice.h" |
30 | 24 | ||
31 | 25 | /* OPIE */ | |
32 | #include <errno.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/config.h> | ||
28 | #include <opie2/odebug.h> | ||
33 | 29 | ||
34 | #if !defined(QT_NO_COP) | 30 | #if !defined(QT_NO_COP) |
35 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
36 | #endif | 32 | #endif |
37 | 33 | ||
34 | /* QT */ | ||
35 | #include <qmessagebox.h> | ||
36 | |||
37 | /* STD */ | ||
38 | #include <stdlib.h> | ||
39 | #include <stdio.h> | ||
40 | #include <errno.h> | ||
41 | |||
38 | #if defined(Q_WS_X11) || defined(Q_WS_QWS) | 42 | #if defined(Q_WS_X11) || defined(Q_WS_QWS) |
39 | #include <fcntl.h> | 43 | #include <fcntl.h> |
40 | #include <sys/ioctl.h> | 44 | #include <sys/ioctl.h> |
@@ -145,7 +149,7 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
145 | # endif | 149 | # endif |
146 | 150 | ||
147 | //#endif | 151 | //#endif |
148 | // qDebug( "setting volume to: 0x%x", volume ); | 152 | // odebug << "setting volume to: 0x" << volume << "" << oendl; |
149 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 153 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
150 | // Send notification that the volume has changed | 154 | // Send notification that the volume has changed |
151 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 155 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
@@ -155,18 +159,18 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
155 | 159 | ||
156 | 160 | ||
157 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | 161 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { |
158 | // qDebug("creating new audio device"); | 162 | // odebug << "creating new audio device" << oendl; |
159 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | 163 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; |
160 | d = new AudioDevicePrivate; | 164 | d = new AudioDevicePrivate; |
161 | d->frequency = f; | 165 | d->frequency = f; |
162 | d->channels = chs; | 166 | d->channels = chs; |
163 | d->bytesPerSample = bps; | 167 | d->bytesPerSample = bps; |
164 | // qDebug("%d",bps); | 168 | // odebug << "" << bps << "" << oendl; |
165 | int format=0; | 169 | int format=0; |
166 | if( bps == 8) format = AFMT_U8; | 170 | if( bps == 8) format = AFMT_U8; |
167 | else if( bps <= 0) format = AFMT_S16_LE; | 171 | else if( bps <= 0) format = AFMT_S16_LE; |
168 | else format = AFMT_S16_LE; | 172 | else format = AFMT_S16_LE; |
169 | // qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | 173 | // odebug << "AD- freq " << f << ", channels " << chs << ", b/sample " << bps << ", bitrate " << format << "" << oendl; |
170 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 174 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
171 | 175 | ||
172 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 176 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
@@ -200,10 +204,10 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
200 | perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); | 204 | perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); |
201 | if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) | 205 | if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) |
202 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | 206 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); |
203 | // qDebug("freq %d", d->frequency); | 207 | // odebug << "freq " << d->frequency << "" << oendl; |
204 | if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) | 208 | if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) |
205 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | 209 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); |
206 | // qDebug("channels %d",d->channels); | 210 | // odebug << "channels " << d->channels << "" << oendl; |
207 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { | 211 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { |
208 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; | 212 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; |
209 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) | 213 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) |
@@ -216,18 +220,18 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
216 | d->unwritten = 0; | 220 | d->unwritten = 0; |
217 | d->can_GETOSPACE = TRUE; // until we find otherwise | 221 | d->can_GETOSPACE = TRUE; // until we find otherwise |
218 | 222 | ||
219 | //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); | 223 | //if ( chs != d->channels ) odebug << "Wanted " << chs << ", got " << d->channels << " channels" << oendl; |
220 | //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); | 224 | //if ( f != d->frequency ) odebug << "wanted " << f << "Hz, got " << d->frequency << "Hz" << oendl; |
221 | //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); | 225 | //if ( capabilities & DSP_CAP_BATCH ) odebug << "Sound card has local buffer" << oendl; |
222 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); | 226 | //if ( capabilities & DSP_CAP_REALTIME )odebug << "Sound card has realtime sync" << oendl; |
223 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); | 227 | //if ( capabilities & DSP_CAP_TRIGGER ) odebug << "Sound card has precise trigger" << oendl; |
224 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); | 228 | //if ( capabilities & DSP_CAP_MMAP ) odebug << "Sound card can mmap" << oendl; |
225 | 229 | ||
226 | } | 230 | } |
227 | 231 | ||
228 | 232 | ||
229 | AudioDevice::~AudioDevice() { | 233 | AudioDevice::~AudioDevice() { |
230 | // qDebug("destryo audiodevice"); | 234 | // odebug << "destryo audiodevice" << oendl; |
231 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | 235 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; |
232 | 236 | ||
233 | # ifndef KEEP_DEVICE_OPEN | 237 | # ifndef KEEP_DEVICE_OPEN |
@@ -251,7 +255,7 @@ void AudioDevice::write( char *buffer, unsigned int length ) | |||
251 | int t = ::write( d->handle, buffer, length ); | 255 | int t = ::write( d->handle, buffer, length ); |
252 | if ( t<0 ) t = 0; | 256 | if ( t<0 ) t = 0; |
253 | if ( t != (int)length) { | 257 | if ( t != (int)length) { |
254 | // qDebug("Ahhh!! memcpys 1"); | 258 | // odebug << "Ahhh!! memcpys 1" << oendl; |
255 | memcpy(d->unwrittenBuffer,buffer+t,length-t); | 259 | memcpy(d->unwrittenBuffer,buffer+t,length-t); |
256 | d->unwritten = length-t; | 260 | d->unwritten = length-t; |
257 | } | 261 | } |
@@ -314,7 +318,7 @@ unsigned int AudioDevice::canWrite() const | |||
314 | int AudioDevice::bytesWritten() { | 318 | int AudioDevice::bytesWritten() { |
315 | int buffered = 0; | 319 | int buffered = 0; |
316 | if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) { | 320 | if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) { |
317 | // qDebug( "failed to get audio device position" ); | 321 | // odebug << "failed to get audio device position" << oendl; |
318 | return -1; | 322 | return -1; |
319 | } | 323 | } |
320 | return buffered; | 324 | return buffered; |
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 7da2d54..376f8d3 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -17,14 +17,19 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "audiowidget.h" | ||
21 | #include "mediaplayerstate.h" | ||
22 | |||
23 | /* OPIE */ | ||
20 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <opie2/odebug.h> | ||
23 | 28 | ||
29 | /* QT */ | ||
24 | #include <qdir.h> | 30 | #include <qdir.h> |
25 | #include "audiowidget.h" | ||
26 | #include "mediaplayerstate.h" | ||
27 | 31 | ||
32 | /* STD */ | ||
28 | #include <stdlib.h> | 33 | #include <stdlib.h> |
29 | #include <stdio.h> | 34 | #include <stdio.h> |
30 | 35 | ||
@@ -71,7 +76,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
71 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) | 76 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
72 | { | 77 | { |
73 | setCaption( tr("OpiePlayer") ); | 78 | setCaption( tr("OpiePlayer") ); |
74 | // qDebug("<<<<<audioWidget"); | 79 | // odebug << "<<<<<audioWidget" << oendl; |
75 | 80 | ||
76 | Config cfg("OpiePlayer"); | 81 | Config cfg("OpiePlayer"); |
77 | cfg.setGroup("Options"); | 82 | cfg.setGroup("Options"); |
@@ -85,7 +90,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
85 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 90 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
86 | skinPath = "opieplayer2/skins/default"; | 91 | skinPath = "opieplayer2/skins/default"; |
87 | 92 | ||
88 | // qDebug("skin path " + skinPath); | 93 | // odebug << "skin path " + skinPath << oendl; |
89 | 94 | ||
90 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 95 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
91 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 96 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
@@ -121,7 +126,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
121 | int height = d->height(); | 126 | int height = d->height(); |
122 | 127 | ||
123 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 128 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
124 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); | 129 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; |
125 | QImage img; | 130 | QImage img; |
126 | img = pixBg->convertToImage(); | 131 | img = pixBg->convertToImage(); |
127 | pixBg->convertFromImage( img.smoothScale( width, height)); | 132 | pixBg->convertFromImage( img.smoothScale( width, height)); |
@@ -253,7 +258,7 @@ void AudioWidget::sliderReleased() { | |||
253 | 258 | ||
254 | 259 | ||
255 | void AudioWidget::setPosition( long i ) { | 260 | void AudioWidget::setPosition( long i ) { |
256 | // qDebug("set position %d",i); | 261 | // odebug << "set position " << i << "" << oendl; |
257 | long length = mediaPlayerState->length(); | 262 | long length = mediaPlayerState->length(); |
258 | updateSlider( i, length ); | 263 | updateSlider( i, length ); |
259 | } | 264 | } |
@@ -367,18 +372,18 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
367 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 372 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
368 | 373 | ||
369 | // if ( isOnButton && i == AudioVolumeUp ) | 374 | // if ( isOnButton && i == AudioVolumeUp ) |
370 | // qDebug("on up"); | 375 | // odebug << "on up" << oendl; |
371 | 376 | ||
372 | if ( isOnButton && !audioButtons[i].isHeld ) { | 377 | if ( isOnButton && !audioButtons[i].isHeld ) { |
373 | audioButtons[i].isHeld = TRUE; | 378 | audioButtons[i].isHeld = TRUE; |
374 | toggleButton(i); | 379 | toggleButton(i); |
375 | switch (i) { | 380 | switch (i) { |
376 | case AudioVolumeUp: | 381 | case AudioVolumeUp: |
377 | // qDebug("more clicked"); | 382 | // odebug << "more clicked" << oendl; |
378 | emit moreClicked(); | 383 | emit moreClicked(); |
379 | return; | 384 | return; |
380 | case AudioVolumeDown: | 385 | case AudioVolumeDown: |
381 | // qDebug("less clicked"); | 386 | // odebug << "less clicked" << oendl; |
382 | emit lessClicked(); | 387 | emit lessClicked(); |
383 | return; | 388 | return; |
384 | case AudioForward: | 389 | case AudioForward: |
@@ -470,7 +475,7 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) | |||
470 | break; | 475 | break; |
471 | case Key_F9: //activity | 476 | case Key_F9: //activity |
472 | hide(); | 477 | hide(); |
473 | // qDebug("Audio F9"); | 478 | // odebug << "Audio F9" << oendl; |
474 | break; | 479 | break; |
475 | case Key_F10: //contacts | 480 | case Key_F10: //contacts |
476 | break; | 481 | break; |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 1989b4a..428fc28 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -19,6 +19,18 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // largly modified by Maximilian Reiss <max.reiss@gmx.de> | 20 | // largly modified by Maximilian Reiss <max.reiss@gmx.de> |
21 | 21 | ||
22 | #include "libmadplugin.h" | ||
23 | |||
24 | /* OPIE */ | ||
25 | #include <qpe/config.h> | ||
26 | #include <opie2/odebug.h> | ||
27 | |||
28 | /* QT */ | ||
29 | #include <qapplication.h> | ||
30 | #include <qmessagebox.h> | ||
31 | #include <qregexp.h> | ||
32 | |||
33 | /* STD */ | ||
22 | #include <stdio.h> | 34 | #include <stdio.h> |
23 | #include <stdarg.h> | 35 | #include <stdarg.h> |
24 | #include <stdlib.h> | 36 | #include <stdlib.h> |
@@ -34,12 +46,6 @@ | |||
34 | #include <math.h> | 46 | #include <math.h> |
35 | #include <assert.h> | 47 | #include <assert.h> |
36 | 48 | ||
37 | #include <qapplication.h> | ||
38 | #include <qmessagebox.h> | ||
39 | #include <qregexp.h> | ||
40 | |||
41 | #include <qpe/config.h> | ||
42 | |||
43 | // for network handling | 49 | // for network handling |
44 | #include <netinet/in.h> | 50 | #include <netinet/in.h> |
45 | #include <netdb.h> | 51 | #include <netdb.h> |
@@ -54,7 +60,6 @@ | |||
54 | #if defined(HAVE_MMAP) | 60 | #if defined(HAVE_MMAP) |
55 | # include <sys/mman.h> | 61 | # include <sys/mman.h> |
56 | #endif | 62 | #endif |
57 | #include "libmadplugin.h" | ||
58 | 63 | ||
59 | 64 | ||
60 | extern "C" { | 65 | extern "C" { |
@@ -382,7 +387,7 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
382 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); | 387 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); |
383 | 388 | ||
384 | if (len == -1) { | 389 | if (len == -1) { |
385 | // qDebug( "http_open: "+ QString(strerror(errno)) +"\n"); | 390 | // odebug << "http_open: "+ QString(strerror(errno)) +"\n" << oendl; |
386 | return 0; | 391 | return 0; |
387 | } | 392 | } |
388 | 393 | ||
@@ -396,7 +401,7 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
396 | if (QString(http_request).left(4) == "ICY ") { | 401 | if (QString(http_request).left(4) == "ICY ") { |
397 | /* This is shoutcast/icecast streaming */ | 402 | /* This is shoutcast/icecast streaming */ |
398 | if (strncmp(http_request + 4, "200 ", 4)) { | 403 | if (strncmp(http_request + 4, "200 ", 4)) { |
399 | // qDebug("http_open: " + QString(http_request) + "\n"); | 404 | // odebug << "http_open: " + QString(http_request) + "\n" << oendl; |
400 | return 0; | 405 | return 0; |
401 | } | 406 | } |
402 | } else if (QString(http_request).left(4) == "icy-") { | 407 | } else if (QString(http_request).left(4) == "icy-") { |
@@ -417,7 +422,7 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
417 | 422 | ||
418 | info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " ); | 423 | info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " ); |
419 | 424 | ||
420 | // qDebug("Stream info: " + info); | 425 | // odebug << "Stream info: " + info << oendl; |
421 | 426 | ||
422 | return (tcp_sock); | 427 | return (tcp_sock); |
423 | } | 428 | } |
@@ -429,12 +434,12 @@ bool LibMadPlugin::open( const QString& path ) { | |||
429 | Config cfg("OpiePlayer"); | 434 | Config cfg("OpiePlayer"); |
430 | cfg.setGroup("Options"); | 435 | cfg.setGroup("Options"); |
431 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | 436 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); |
432 | // qDebug("buffer size is %d", bufferSize); | 437 | // odebug << "buffer size is " << bufferSize << "" << oendl; |
433 | d->bad_last_frame = 0; | 438 | d->bad_last_frame = 0; |
434 | d->flush = TRUE; | 439 | d->flush = TRUE; |
435 | info = QString( "" ); | 440 | info = QString( "" ); |
436 | 441 | ||
437 | //qDebug( "Opening %s", path.latin1() ); | 442 | //odebug << "Opening " << path << "" << oendl; |
438 | 443 | ||
439 | if (path.left( 4 ) == "http" ) { | 444 | if (path.left( 4 ) == "http" ) { |
440 | // in case of any error we get 0 here | 445 | // in case of any error we get 0 here |
@@ -450,13 +455,13 @@ bool LibMadPlugin::open( const QString& path ) { | |||
450 | printID3Tags(); | 455 | printID3Tags(); |
451 | } | 456 | } |
452 | if (d->input.fd == -1) { | 457 | if (d->input.fd == -1) { |
453 | // qDebug("error opening %s", d->input.path ); | 458 | // odebug << "error opening " << d->input.path << "" << oendl; |
454 | return FALSE; | 459 | return FALSE; |
455 | } | 460 | } |
456 | 461 | ||
457 | struct stat stat; | 462 | struct stat stat; |
458 | if (fstat(d->input.fd, &stat) == -1) { | 463 | if (fstat(d->input.fd, &stat) == -1) { |
459 | // qDebug("error calling fstat"); return FALSE; | 464 | // odebug << "error calling fstat" << oendl; return FALSE; |
460 | } | 465 | } |
461 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) | 466 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) |
462 | d->input.fileLength = stat.st_size; | 467 | d->input.fileLength = stat.st_size; |
@@ -468,7 +473,7 @@ bool LibMadPlugin::open( const QString& path ) { | |||
468 | d->input.length = stat.st_size; | 473 | d->input.length = stat.st_size; |
469 | d->input.fdm = map_file(d->input.fd, &d->input.length); | 474 | d->input.fdm = map_file(d->input.fd, &d->input.length); |
470 | if (d->input.fdm == 0) { | 475 | if (d->input.fdm == 0) { |
471 | // qDebug("error mmapping file"); return FALSE; | 476 | // odebug << "error mmapping file" << oendl; return FALSE; |
472 | } | 477 | } |
473 | d->input.data = (unsigned char *)d->input.fdm; | 478 | d->input.data = (unsigned char *)d->input.fdm; |
474 | } | 479 | } |
@@ -477,7 +482,7 @@ bool LibMadPlugin::open( const QString& path ) { | |||
477 | if (d->input.data == 0) { | 482 | if (d->input.data == 0) { |
478 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); | 483 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); |
479 | if (d->input.data == 0) { | 484 | if (d->input.data == 0) { |
480 | // qDebug("error allocating input buffer"); | 485 | // odebug << "error allocating input buffer" << oendl; |
481 | return FALSE; | 486 | return FALSE; |
482 | } | 487 | } |
483 | d->input.length = 0; | 488 | d->input.length = 0; |
@@ -505,7 +510,7 @@ bool LibMadPlugin::close() { | |||
505 | #if defined(HAVE_MMAP) | 510 | #if defined(HAVE_MMAP) |
506 | if (d->input.fdm) { | 511 | if (d->input.fdm) { |
507 | if (unmap_file(d->input.fdm, d->input.length) == -1) { | 512 | if (unmap_file(d->input.fdm, d->input.length) == -1) { |
508 | // qDebug("error munmapping file"); | 513 | // odebug << "error munmapping file" << oendl; |
509 | result = FALSE; | 514 | result = FALSE; |
510 | } | 515 | } |
511 | d->input.fdm = 0; | 516 | d->input.fdm = 0; |
@@ -519,7 +524,7 @@ bool LibMadPlugin::close() { | |||
519 | } | 524 | } |
520 | 525 | ||
521 | if (::close(d->input.fd) == -1) { | 526 | if (::close(d->input.fd) == -1) { |
522 | // qDebug("error closing file %s", d->input.path); | 527 | // odebug << "error closing file " << d->input.path << "" << oendl; |
523 | result = FALSE; | 528 | result = FALSE; |
524 | } | 529 | } |
525 | 530 | ||
@@ -545,7 +550,7 @@ int LibMadPlugin::audioChannels( int ) { | |||
545 | debugMsg( "LibMadPlugin::audioChannels" ); | 550 | debugMsg( "LibMadPlugin::audioChannels" ); |
546 | /* | 551 | /* |
547 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 552 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
548 | qDebug( "LibMadPlugin::audioChannels: %i", d->frame.header.mode > 0 ? 2 : 1 ); | 553 | odebug << "LibMadPlugin::audioChannels: " << d->frame.header.mode > 0 ? 2 : 1 << "" << oendl; |
549 | return d->frame.header.mode > 0 ? 2 : 1; | 554 | return d->frame.header.mode > 0 ? 2 : 1; |
550 | */ | 555 | */ |
551 | return 2; | 556 | return 2; |
@@ -555,7 +560,7 @@ int LibMadPlugin::audioChannels( int ) { | |||
555 | int LibMadPlugin::audioFrequency( int ) { | 560 | int LibMadPlugin::audioFrequency( int ) { |
556 | debugMsg( "LibMadPlugin::audioFrequency" ); | 561 | debugMsg( "LibMadPlugin::audioFrequency" ); |
557 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 562 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
558 | // qDebug( "LibMadPlugin::audioFrequency: %i", d->frame.header.samplerate ); | 563 | // odebug << "LibMadPlugin::audioFrequency: " << d->frame.header.samplerate << "" << oendl; |
559 | return d->frame.header.samplerate; | 564 | return d->frame.header.samplerate; |
560 | } | 565 | } |
561 | 566 | ||
@@ -566,8 +571,7 @@ int LibMadPlugin::audioSamples( int ) { | |||
566 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 571 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
567 | mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); | 572 | mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); |
568 | /* | 573 | /* |
569 | qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, | 574 | odebug << "LibMadPlugin::audioSamples: " << d->frame.header.duration.seconds << "*" << d->frame.header.samplerate << oendl; |
570 | d->frame.header.samplerate ); | ||
571 | return d->frame.header.duration.seconds * d->frame.header.samplerate; | 575 | return d->frame.header.duration.seconds * d->frame.header.samplerate; |
572 | */ | 576 | */ |
573 | if ( d->frame.header.bitrate == 0 ) | 577 | if ( d->frame.header.bitrate == 0 ) |
@@ -576,7 +580,7 @@ int LibMadPlugin::audioSamples( int ) { | |||
576 | 580 | ||
577 | // qDebug( "LibMadPlugin::audioSamples: %i * %i * 8 / %i", (int)d->input.fileLength, | 581 | // qDebug( "LibMadPlugin::audioSamples: %i * %i * 8 / %i", (int)d->input.fileLength, |
578 | // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); | 582 | // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); |
579 | // qDebug( "LibMadPlugin::audioSamples: %i", samples ); | 583 | // odebug << "LibMadPlugin::audioSamples: " << samples << "" << oendl; |
580 | 584 | ||
581 | return samples; | 585 | return samples; |
582 | 586 | ||
@@ -592,7 +596,7 @@ bool LibMadPlugin::audioSetSample( long, int ) { | |||
592 | // return FALSE; | 596 | // return FALSE; |
593 | 597 | ||
594 | // // Seek to requested position | 598 | // // Seek to requested position |
595 | // qDebug( "seek pos: %i", (int)((double)pos * d->input.fileLength / totalSamples) ); | 599 | // odebug << "seek pos: " << (int)((double)pos * d->input.fileLength / totalSamples) << "" << oendl; |
596 | // ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET ); | 600 | // ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET ); |
597 | // mad_stream_sync(&d->stream); | 601 | // mad_stream_sync(&d->stream); |
598 | 602 | ||
@@ -680,7 +684,7 @@ bool LibMadPlugin::read() { | |||
680 | while (len == -1 && errno == EINTR); | 684 | while (len == -1 && errno == EINTR); |
681 | 685 | ||
682 | if (len == -1) { | 686 | if (len == -1) { |
683 | // qDebug("error reading audio"); | 687 | // odebug << "error reading audio" << oendl; |
684 | return FALSE; | 688 | return FALSE; |
685 | } | 689 | } |
686 | else if (len == 0) { | 690 | else if (len == 0) { |
@@ -758,7 +762,7 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | |||
758 | } | 762 | } |
759 | if ( d->stream.error == MAD_ERROR_BADCRC ) { | 763 | if ( d->stream.error == MAD_ERROR_BADCRC ) { |
760 | mad_frame_mute(&d->frame); | 764 | mad_frame_mute(&d->frame); |
761 | // qDebug( "error decoding, bad crc" ); | 765 | // odebug << "error decoding, bad crc" << oendl; |
762 | } | 766 | } |
763 | } | 767 | } |
764 | 768 | ||
@@ -821,17 +825,17 @@ double LibMadPlugin::getTime() { | |||
821 | 825 | ||
822 | 826 | ||
823 | void LibMadPlugin::printID3Tags() { | 827 | void LibMadPlugin::printID3Tags() { |
824 | // qDebug( "LibMadPlugin::printID3Tags" ); | 828 | // odebug << "LibMadPlugin::printID3Tags" << oendl; |
825 | 829 | ||
826 | char id3v1[128 + 1]; | 830 | char id3v1[128 + 1]; |
827 | 831 | ||
828 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { | 832 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { |
829 | // qDebug( "error seeking to id3 tags" ); | 833 | // odebug << "error seeking to id3 tags" << oendl; |
830 | return; | 834 | return; |
831 | } | 835 | } |
832 | 836 | ||
833 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { | 837 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { |
834 | // qDebug( "error reading in id3 tags" ); | 838 | // odebug << "error reading in id3 tags" << oendl; |
835 | return; | 839 | return; |
836 | } | 840 | } |
837 | 841 | ||
@@ -841,7 +845,7 @@ void LibMadPlugin::printID3Tags() { | |||
841 | int len[5] = { 30, 30, 30, 4, 30 }; | 845 | int len[5] = { 30, 30, 30, 4, 30 }; |
842 | QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; | 846 | QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; |
843 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; | 847 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; |
844 | // qDebug( "ID3 tags in file:" ); | 848 | // odebug << "ID3 tags in file:" << oendl; |
845 | info = ""; | 849 | info = ""; |
846 | for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { | 850 | for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { |
847 | char push = *ptr2; | 851 | char push = *ptr2; |
@@ -853,7 +857,7 @@ void LibMadPlugin::printID3Tags() { | |||
853 | if( ((QString)ptr).find(" ") == -1) // don't add anything that has blanks | 857 | if( ((QString)ptr).find(" ") == -1) // don't add anything that has blanks |
854 | info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; | 858 | info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; |
855 | } | 859 | } |
856 | // qDebug( info.latin1() ); | 860 | // odebug << info.latin1() << oendl; |
857 | *ptr3 = push2; | 861 | *ptr3 = push2; |
858 | *ptr2 = push; | 862 | *ptr2 = push; |
859 | } | 863 | } |
@@ -862,7 +866,7 @@ void LibMadPlugin::printID3Tags() { | |||
862 | } | 866 | } |
863 | 867 | ||
864 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { | 868 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { |
865 | // qDebug( "error seeking back to beginning" ); | 869 | // odebug << "error seeking back to beginning" << oendl; |
866 | return; | 870 | return; |
867 | } | 871 | } |
868 | } | 872 | } |
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 4ed5921..91153fd 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -19,22 +19,30 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | 20 | // L.J.Potter added changes Fri 02-15-2002 |
21 | 21 | ||
22 | |||
23 | #include "mediaplayerstate.h" | ||
24 | #include "loopcontrol.h" | ||
25 | #include "videowidget.h" | ||
26 | #include "audiodevice.h" | ||
27 | |||
28 | /* OPIE */ | ||
22 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/mediaplayerplugininterface.h> | ||
31 | #include <opie2/odebug.h> | ||
23 | 32 | ||
24 | #ifdef Q_WS_QWS | 33 | #ifdef Q_WS_QWS |
25 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
26 | #endif | 35 | #endif |
36 | |||
37 | /* QT */ | ||
38 | |||
39 | /* STD */ | ||
27 | #include <stdio.h> | 40 | #include <stdio.h> |
28 | #include <stdlib.h> | 41 | #include <stdlib.h> |
29 | #include <string.h> | 42 | #include <string.h> |
30 | #include <pthread.h> | 43 | #include <pthread.h> |
31 | #include <errno.h> | 44 | #include <errno.h> |
32 | #include <unistd.h> | 45 | #include <unistd.h> |
33 | #include "loopcontrol.h" | ||
34 | #include "videowidget.h" | ||
35 | #include "audiodevice.h" | ||
36 | #include <qpe/mediaplayerplugininterface.h> | ||
37 | #include "mediaplayerstate.h" | ||
38 | 46 | ||
39 | 47 | ||
40 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame | 48 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame |
@@ -100,7 +108,7 @@ LoopControl::LoopControl( QObject *parent, const char *name ) | |||
100 | : QObject( parent, name ) { | 108 | : QObject( parent, name ) { |
101 | isMuted = FALSE; | 109 | isMuted = FALSE; |
102 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); | 110 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); |
103 | //qDebug("starting loopcontrol"); | 111 | //odebug << "starting loopcontrol" << oendl; |
104 | audioMutex = new Mutex; | 112 | audioMutex = new Mutex; |
105 | 113 | ||
106 | pthread_attr_init(&audio_attr); | 114 | pthread_attr_init(&audio_attr); |
@@ -112,12 +120,12 @@ LoopControl::LoopControl( QObject *parent, const char *name ) | |||
112 | params.sched_priority = 50; | 120 | params.sched_priority = 50; |
113 | pthread_attr_setschedparam(&audio_attr,¶ms); | 121 | pthread_attr_setschedparam(&audio_attr,¶ms); |
114 | } else { | 122 | } else { |
115 | // qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); | 123 | // odebug << "Error setting up a realtime thread, reverting to using a normal thread." << oendl; |
116 | pthread_attr_destroy(&audio_attr); | 124 | pthread_attr_destroy(&audio_attr); |
117 | pthread_attr_init(&audio_attr); | 125 | pthread_attr_init(&audio_attr); |
118 | } | 126 | } |
119 | #endif | 127 | #endif |
120 | //qDebug("create audio thread"); | 128 | //odebug << "create audio thread" << oendl; |
121 | pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); | 129 | pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); |
122 | } | 130 | } |
123 | 131 | ||
@@ -153,7 +161,7 @@ void LoopControl::timerEvent( QTimerEvent *te ) { | |||
153 | 161 | ||
154 | void LoopControl::setPosition( long pos ) { | 162 | void LoopControl::setPosition( long pos ) { |
155 | audioMutex->lock(); | 163 | audioMutex->lock(); |
156 | // qDebug("Loop control %d", pos); | 164 | // odebug << "Loop control " << pos << "" << oendl; |
157 | if ( hasVideoChannel && hasAudioChannel ) { | 165 | if ( hasVideoChannel && hasAudioChannel ) { |
158 | playtime.restart(); | 166 | playtime.restart(); |
159 | playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) ); | 167 | playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) ); |
@@ -228,7 +236,7 @@ void LoopControl::startAudio() { | |||
228 | currentSample = audioSampleCounter + 1; | 236 | currentSample = audioSampleCounter + 1; |
229 | 237 | ||
230 | // if ( currentSample != audioSampleCounter + 1 ) | 238 | // if ( currentSample != audioSampleCounter + 1 ) |
231 | // qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 239 | // odebug << "out of sync with decoder " << currentSample << " " << audioSampleCounter << "" << oendl; |
232 | 240 | ||
233 | long samplesRead = 0; | 241 | long samplesRead = 0; |
234 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); | 242 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); |
@@ -241,7 +249,7 @@ void LoopControl::startAudio() { | |||
241 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 249 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
242 | } | 250 | } |
243 | else if ( sampleWaitTime <= -5000 ) { | 251 | else if ( sampleWaitTime <= -5000 ) { |
244 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 252 | // odebug << "need to catch up by: " << -sampleWaitTime << " (" << currentSample << "," << sampleWeShouldBeAt << ")" << oendl; |
245 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 253 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
246 | currentSample = sampleWeShouldBeAt; | 254 | currentSample = sampleWeShouldBeAt; |
247 | } | 255 | } |
@@ -361,7 +369,7 @@ bool LoopControl::init( const QString& filename ) { | |||
361 | stream = 0; // only play stream 0 for now | 369 | stream = 0; // only play stream 0 for now |
362 | current_frame = total_video_frames = total_audio_samples = 0; | 370 | current_frame = total_video_frames = total_audio_samples = 0; |
363 | 371 | ||
364 | // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); | 372 | // odebug << "Using the " << mediaPlayerState->curDecoder()->pluginName() << " decoder" << oendl; |
365 | 373 | ||
366 | // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin | 374 | // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin |
367 | // if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { | 375 | // if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { |
@@ -387,23 +395,23 @@ bool LoopControl::init( const QString& filename ) { | |||
387 | else | 395 | else |
388 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); | 396 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); |
389 | 397 | ||
390 | // qDebug( "LC- channels = %d", channels ); | 398 | // odebug << "LC- channels = " << channels << "" << oendl; |
391 | 399 | ||
392 | // if ( !total_audio_samples ) | 400 | // if ( !total_audio_samples ) |
393 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); | 401 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); |
394 | 402 | ||
395 | total_audio_samples += 1000; | 403 | total_audio_samples += 1000; |
396 | // qDebug("total samples %d", total_audio_samples); | 404 | // odebug << "total samples " << total_audio_samples << "" << oendl; |
397 | mediaPlayerState->setLength( total_audio_samples ); | 405 | mediaPlayerState->setLength( total_audio_samples ); |
398 | 406 | ||
399 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); | 407 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); |
400 | // qDebug( "LC- frequency = %d", freq ); | 408 | // odebug << "LC- frequency = " << freq << "" << oendl; |
401 | 409 | ||
402 | audioSampleCounter = 0; | 410 | audioSampleCounter = 0; |
403 | int bits_per_sample; | 411 | int bits_per_sample; |
404 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { | 412 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { |
405 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); | 413 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); |
406 | // qDebug("using stupid hack"); | 414 | // odebug << "using stupid hack" << oendl; |
407 | } else { | 415 | } else { |
408 | bits_per_sample=0; | 416 | bits_per_sample=0; |
409 | } | 417 | } |
@@ -451,7 +459,7 @@ bool LoopControl::init( const QString& filename ) { | |||
451 | 459 | ||
452 | 460 | ||
453 | void LoopControl::play() { | 461 | void LoopControl::play() { |
454 | // qDebug("LC- play"); | 462 | // odebug << "LC- play" << oendl; |
455 | mediaPlayerState->setPosition( 0); //uglyhack | 463 | mediaPlayerState->setPosition( 0); //uglyhack |
456 | 464 | ||
457 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 465 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index 0a1fc17..9a162c2 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp | |||
@@ -19,28 +19,34 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #define _REENTRANT | 20 | #define _REENTRANT |
21 | 21 | ||
22 | #include "mediaplayerplugininterface.h" | ||
23 | #include "loopcontrol.h" | ||
24 | #include "audiodevice.h" | ||
25 | #include "videowidget.h" | ||
26 | #include "audiowidget.h" | ||
27 | #include "mediaplayerstate.h" | ||
28 | |||
29 | /* OPIE */ | ||
22 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/custom.h> | 31 | #include <qpe/custom.h> |
24 | #include <qimage.h> | 32 | |
25 | #include <qpainter.h> | ||
26 | #if !defined(QT_NO_COP) | 33 | #if !defined(QT_NO_COP) |
27 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
28 | #endif | 35 | #endif |
29 | #include "mediaplayerplugininterface.h" | 36 | |
37 | #include <opie2/odebug.h> | ||
38 | |||
39 | /* QT */ | ||
40 | #include <qimage.h> | ||
41 | #include <qpainter.h> | ||
42 | |||
43 | /* STD */ | ||
30 | #include <stdio.h> | 44 | #include <stdio.h> |
31 | #include <stdlib.h> | 45 | #include <stdlib.h> |
32 | #include <string.h> | 46 | #include <string.h> |
33 | #include <time.h> | 47 | #include <time.h> |
34 | #include <unistd.h> | 48 | #include <unistd.h> |
35 | #include <pthread.h> | 49 | #include <pthread.h> |
36 | #include "loopcontrol.h" | ||
37 | #include "audiodevice.h" | ||
38 | #include "videowidget.h" | ||
39 | #include "audiowidget.h" | ||
40 | #include "mediaplayerstate.h" | ||
41 | |||
42 | |||
43 | |||
44 | 50 | ||
45 | 51 | ||
46 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame | 52 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame |
@@ -191,7 +197,7 @@ void LoopControl::setPosition( long pos ) { | |||
191 | if ( hasVideoChannel && hasAudioChannel ) { | 197 | if ( hasVideoChannel && hasAudioChannel ) { |
192 | videoMutex->lock(); | 198 | videoMutex->lock(); |
193 | audioMutex->lock(); | 199 | audioMutex->lock(); |
194 | //qDebug("setting position"); | 200 | //odebug << "setting position" << oendl; |
195 | playtime.restart(); | 201 | playtime.restart(); |
196 | playtime = playtime.addMSecs( -pos * 1000 / framerate ); | 202 | playtime = playtime.addMSecs( -pos * 1000 / framerate ); |
197 | //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate; | 203 | //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate; |
@@ -292,7 +298,7 @@ void LoopControl::startVideo() { | |||
292 | 298 | ||
293 | } while ( !done ); | 299 | } while ( !done ); |
294 | 300 | ||
295 | // qDebug("elapsed: %i %i (%f)", int( playtime.elapsed() ), current_frame, framerate ); | 301 | // odebug << "elapsed: " << int( playtime.elapsed() ) << " " << current_frame << " (" << framerate << ")" << oendl; |
296 | 302 | ||
297 | } else { | 303 | } else { |
298 | videoMutex->lock(); | 304 | videoMutex->lock(); |
@@ -307,7 +313,7 @@ void LoopControl::startVideo() { | |||
307 | if ( check ) { | 313 | if ( check ) { |
308 | videoMutex->lock(); | 314 | videoMutex->lock(); |
309 | if ( current_frame > prev_frame + 1 ) { | 315 | if ( current_frame > prev_frame + 1 ) { |
310 | // qDebug("skipped a frame"); | 316 | // odebug << "skipped a frame" << oendl; |
311 | mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); | 317 | mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); |
312 | } | 318 | } |
313 | prev_frame = current_frame; | 319 | prev_frame = current_frame; |
@@ -341,7 +347,7 @@ void LoopControl::startAudio() { | |||
341 | currentSample = audioSampleCounter + 1; | 347 | currentSample = audioSampleCounter + 1; |
342 | 348 | ||
343 | // if ( currentSample != audioSampleCounter + 1 ) | 349 | // if ( currentSample != audioSampleCounter + 1 ) |
344 | // qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 350 | // odebug << "out of sync with decoder " << currentSample << " " << audioSampleCounter << "" << oendl; |
345 | audioMutex->unlock(); | 351 | audioMutex->unlock(); |
346 | 352 | ||
347 | /* | 353 | /* |
@@ -365,12 +371,12 @@ void LoopControl::startAudio() { | |||
365 | audioMutex->unlock(); | 371 | audioMutex->unlock(); |
366 | 372 | ||
367 | if ( sampleWaitTime >= 0 && sampleWaitTime <= 2000 ) { | 373 | if ( sampleWaitTime >= 0 && sampleWaitTime <= 2000 ) { |
368 | //qDebug("sampleWaitTime: %i", sampleWaitTime); | 374 | //odebug << "sampleWaitTime: " << sampleWaitTime << "" << oendl; |
369 | usleep( ( sampleWaitTime * 1000000 ) / ( freq ) ); | 375 | usleep( ( sampleWaitTime * 1000000 ) / ( freq ) ); |
370 | } else { | 376 | } else { |
371 | audioMutex->lock(); | 377 | audioMutex->lock(); |
372 | if ( sampleWaitTime <= -2000 ) { | 378 | if ( sampleWaitTime <= -2000 ) { |
373 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 379 | // odebug << "need to catch up by: " << -sampleWaitTime << " (" << currentSample << "," << sampleWeShouldBeAt << ")" << oendl; |
374 | mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 380 | mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
375 | currentSample = sampleWeShouldBeAt; | 381 | currentSample = sampleWeShouldBeAt; |
376 | } | 382 | } |
@@ -387,8 +393,8 @@ void LoopControl::startAudio() { | |||
387 | if ( !hasVideoChannel ) | 393 | if ( !hasVideoChannel ) |
388 | emitChangePos = TRUE; | 394 | emitChangePos = TRUE; |
389 | 395 | ||
390 | //qDebug("currentSample: %i audioSampleCounter: %i total_audio_samples: %i", currentSample, audioSampleCounter, total_audio_samples); | 396 | //odebug << "currentSample: " << currentSample << " audioSampleCounter: " << audioSampleCounter << " total_audio_samples: " << total_audio_samples << "" << oendl; |
391 | // qDebug("current: %i counter: %i total: %i", currentSample, audioSampleCounter, (int)total_audio_samples); | 397 | // odebug << "current: " << currentSample << " counter: " << audioSampleCounter << " total: " << (int)total_audio_samples << "" << oendl; |
392 | moreAudio = audioSampleCounter <= total_audio_samples; | 398 | moreAudio = audioSampleCounter <= total_audio_samples; |
393 | 399 | ||
394 | } else { | 400 | } else { |
@@ -401,7 +407,7 @@ void LoopControl::startAudio() { | |||
401 | } | 407 | } |
402 | } | 408 | } |
403 | 409 | ||
404 | // qDebug( "End of file" ); | 410 | // odebug << "End of file" << oendl; |
405 | 411 | ||
406 | if ( !moreVideo && !moreAudio ) | 412 | if ( !moreVideo && !moreAudio ) |
407 | emitPlayFinished = TRUE; | 413 | emitPlayFinished = TRUE; |
@@ -415,7 +421,7 @@ void LoopControl::killTimers() { | |||
415 | if ( pthread_cancel(video_tid) == 0 ) { | 421 | if ( pthread_cancel(video_tid) == 0 ) { |
416 | void *thread_result = 0; | 422 | void *thread_result = 0; |
417 | if ( pthread_join(video_tid,&thread_result) != 0 ) | 423 | if ( pthread_join(video_tid,&thread_result) != 0 ) |
418 | // qDebug("thread join error 1"); | 424 | // odebug << "thread join error 1" << oendl; |
419 | pthread_attr_destroy(&video_attr); | 425 | pthread_attr_destroy(&video_attr); |
420 | } | 426 | } |
421 | } | 427 | } |
@@ -425,7 +431,7 @@ void LoopControl::killTimers() { | |||
425 | if ( pthread_cancel(audio_tid) == 0 ) { | 431 | if ( pthread_cancel(audio_tid) == 0 ) { |
426 | void *thread_result = 0; | 432 | void *thread_result = 0; |
427 | if ( pthread_join(audio_tid,&thread_result) != 0 ) | 433 | if ( pthread_join(audio_tid,&thread_result) != 0 ) |
428 | // qDebug("thread join error 2"); | 434 | // odebug << "thread join error 2" << oendl; |
429 | pthread_attr_destroy(&audio_attr); | 435 | pthread_attr_destroy(&audio_attr); |
430 | } | 436 | } |
431 | } | 437 | } |
@@ -447,7 +453,7 @@ void LoopControl::startTimers() { | |||
447 | pthread_attr_init(&audio_attr); | 453 | pthread_attr_init(&audio_attr); |
448 | #ifdef USE_REALTIME_AUDIO_THREAD | 454 | #ifdef USE_REALTIME_AUDIO_THREAD |
449 | pthread_attr_setschedpolicy(&audio_attr,SCHED_RR); // Real-time round robin | 455 | pthread_attr_setschedpolicy(&audio_attr,SCHED_RR); // Real-time round robin |
450 | //qDebug("min: %i, max: %i", sched_get_priority_min( SCHED_RR ), sched_get_priority_max( SCHED_RR ) ); | 456 | //odebug << "min: " << sched_get_priority_min( SCHED_RR ) << ", max: " << sched_get_priority_max( SCHED_RR ) << "" << oendl; |
451 | sched_param params; | 457 | sched_param params; |
452 | params.sched_priority = 50; | 458 | params.sched_priority = 50; |
453 | pthread_attr_setschedparam(&audio_attr,¶ms); | 459 | pthread_attr_setschedparam(&audio_attr,¶ms); |
@@ -512,7 +518,7 @@ bool LoopControl::init( const QString& filename ) { | |||
512 | stream = 0; // only play stream 0 for now | 518 | stream = 0; // only play stream 0 for now |
513 | current_frame = total_video_frames = total_audio_samples = 0; | 519 | current_frame = total_video_frames = total_audio_samples = 0; |
514 | 520 | ||
515 | // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); | 521 | // odebug << "Using the " << mediaPlayerState->curDecoder()->pluginName() << " decoder" << oendl; |
516 | 522 | ||
517 | // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin | 523 | // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin |
518 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { | 524 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { |
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index 6c743ec..15f6928 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp | |||
@@ -19,16 +19,18 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #include <qmessagebox.h> | ||
23 | |||
24 | #include "mediaplayer.h" | 22 | #include "mediaplayer.h" |
25 | #include "playlistwidget.h" | 23 | #include "playlistwidget.h" |
26 | #include "audiowidget.h" | 24 | #include "audiowidget.h" |
27 | #include "loopcontrol.h" | 25 | #include "loopcontrol.h" |
28 | #include "audiodevice.h" | 26 | #include "audiodevice.h" |
29 | |||
30 | #include "mediaplayerstate.h" | 27 | #include "mediaplayerstate.h" |
31 | 28 | ||
29 | /* OPIE */ | ||
30 | #include <opie2/odebug.h> | ||
31 | |||
32 | /* QT */ | ||
33 | #include <qmessagebox.h> | ||
32 | 34 | ||
33 | extern AudioWidget *audioUI; | 35 | extern AudioWidget *audioUI; |
34 | extern PlayListWidget *playList; | 36 | extern PlayListWidget *playList; |
@@ -73,7 +75,7 @@ void MediaPlayer::play() { | |||
73 | 75 | ||
74 | 76 | ||
75 | void MediaPlayer::setPlaying( bool play ) { | 77 | void MediaPlayer::setPlaying( bool play ) { |
76 | // qDebug("MediaPlayer setPlaying %d", play); | 78 | // odebug << "MediaPlayer setPlaying " << play << "" << oendl; |
77 | if ( !play ) { | 79 | if ( !play ) { |
78 | mediaPlayerState->setPaused( FALSE ); | 80 | mediaPlayerState->setPaused( FALSE ); |
79 | loopControl->stop( FALSE ); | 81 | loopControl->stop( FALSE ); |
@@ -84,7 +86,7 @@ void MediaPlayer::setPlaying( bool play ) { | |||
84 | mediaPlayerState->setPaused( FALSE ); | 86 | mediaPlayerState->setPaused( FALSE ); |
85 | return; | 87 | return; |
86 | } | 88 | } |
87 | // qDebug("about to ctrash"); | 89 | // odebug << "about to ctrash" << oendl; |
88 | const DocLnk *playListCurrent = playList->current(); | 90 | const DocLnk *playListCurrent = playList->current(); |
89 | 91 | ||
90 | if ( playListCurrent != NULL ) { | 92 | if ( playListCurrent != NULL ) { |
@@ -191,7 +193,7 @@ void MediaPlayer::stopChangingVolume() { | |||
191 | 193 | ||
192 | 194 | ||
193 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 195 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
194 | // qDebug("timer"); | 196 | // odebug << "timer" << oendl; |
195 | if ( volumeDirection == +1 ) | 197 | if ( volumeDirection == +1 ) |
196 | AudioDevice::increaseVolume(); | 198 | AudioDevice::increaseVolume(); |
197 | else if ( volumeDirection == -1 ) | 199 | else if ( volumeDirection == -1 ) |
@@ -203,7 +205,7 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
203 | v = ((l + r) * 11) / (2*0xFFFF); | 205 | v = ((l + r) * 11) / (2*0xFFFF); |
204 | 206 | ||
205 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 207 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
206 | // qDebug("returning %d, %d, %d, %d", v, l, r, m); | 208 | // odebug << "returning " << v << ", " << l << ", " << r << ", " << m << "" << oendl; |
207 | return; | 209 | return; |
208 | } | 210 | } |
209 | 211 | ||
@@ -249,7 +251,7 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | |||
249 | case Key_F11: //menu | 251 | case Key_F11: //menu |
250 | break; | 252 | break; |
251 | case Key_F12: //home | 253 | case Key_F12: //home |
252 | // qDebug("Blank here"); | 254 | // odebug << "Blank here" << oendl; |
253 | break; | 255 | break; |
254 | case Key_F13: //mail | 256 | case Key_F13: //mail |
255 | break; | 257 | break; |
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 5bfb87e..b700cd1 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp | |||
@@ -17,14 +17,6 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <qpe/qlibrary.h> | ||
22 | #include <qpe/config.h> | ||
23 | #include <qdir.h> | ||
24 | #include <qpe/mediaplayerplugininterface.h> | ||
25 | #include "mediaplayerstate.h" | ||
26 | |||
27 | |||
28 | 20 | ||
29 | #ifdef QT_NO_COMPONENT | 21 | #ifdef QT_NO_COMPONENT |
30 | // Plugins which are compiled in when no plugin architecture available | 22 | // Plugins which are compiled in when no plugin architecture available |
@@ -33,6 +25,18 @@ | |||
33 | #include "wavplugin/wavpluginimpl.h" | 25 | #include "wavplugin/wavpluginimpl.h" |
34 | #endif | 26 | #endif |
35 | 27 | ||
28 | #include "mediaplayerstate.h" | ||
29 | |||
30 | /* OPIE */ | ||
31 | #include <qpe/qpeapplication.h> | ||
32 | #include <qpe/qlibrary.h> | ||
33 | #include <qpe/config.h> | ||
34 | #include <qpe/mediaplayerplugininterface.h> | ||
35 | #include <opie2/odebug.h> | ||
36 | |||
37 | /* QT */ | ||
38 | #include <qdir.h> | ||
39 | |||
36 | 40 | ||
37 | //#define MediaPlayerDebug(x) qDebug x | 41 | //#define MediaPlayerDebug(x) qDebug x |
38 | #define MediaPlayerDebug(x) | 42 | #define MediaPlayerDebug(x) |
@@ -125,7 +129,7 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { | |||
125 | // } | 129 | // } |
126 | 130 | ||
127 | void MediaPlayerState::loadPlugins() { | 131 | void MediaPlayerState::loadPlugins() { |
128 | // qDebug("load plugins"); | 132 | // odebug << "load plugins" << oendl; |
129 | #ifndef QT_NO_COMPONENT | 133 | #ifndef QT_NO_COMPONENT |
130 | QValueList<MediaPlayerPlugin>::Iterator mit; | 134 | QValueList<MediaPlayerPlugin>::Iterator mit; |
131 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { | 135 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { |
@@ -142,11 +146,11 @@ void MediaPlayerState::loadPlugins() { | |||
142 | for ( it = list.begin(); it != list.end(); ++it ) { | 146 | for ( it = list.begin(); it != list.end(); ++it ) { |
143 | MediaPlayerPluginInterface *iface = 0; | 147 | MediaPlayerPluginInterface *iface = 0; |
144 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 148 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
145 | // qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 149 | // odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl; |
146 | 150 | ||
147 | if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { | 151 | if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { |
148 | 152 | ||
149 | // qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 153 | // odebug << "loading: " << QString( path + "/" + *it ) << "" << oendl; |
150 | 154 | ||
151 | MediaPlayerPlugin plugin; | 155 | MediaPlayerPlugin plugin; |
152 | plugin.library = lib; | 156 | plugin.library = lib; |
diff --git a/core/multimedia/opieplayer/modplug/memfile.cpp b/core/multimedia/opieplayer/modplug/memfile.cpp index 8a29997..cd243c7 100644 --- a/core/multimedia/opieplayer/modplug/memfile.cpp +++ b/core/multimedia/opieplayer/modplug/memfile.cpp | |||
@@ -19,6 +19,10 @@ | |||
19 | 19 | ||
20 | #include "memfile.h" | 20 | #include "memfile.h" |
21 | 21 | ||
22 | /* OPIE */ | ||
23 | #include <opie2/odebug.h> | ||
24 | |||
25 | /* STD */ | ||
22 | #include <unistd.h> | 26 | #include <unistd.h> |
23 | #include <sys/mman.h> | 27 | #include <sys/mman.h> |
24 | 28 | ||
@@ -66,7 +70,7 @@ QByteArray &MemFile::data() | |||
66 | return m_data; | 70 | return m_data; |
67 | } | 71 | } |
68 | else | 72 | else |
69 | qDebug( "MemFile: mmap() failed!" ); | 73 | odebug << "MemFile: mmap() failed!" << oendl; |
70 | // fallback | 74 | // fallback |
71 | #endif | 75 | #endif |
72 | m_data = readAll(); | 76 | m_data = readAll(); |
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index ae89518..95ed03c 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | #include "om3u.h" | 32 | #include "om3u.h" |
33 | 33 | ||
34 | /* OPIE */ | ||
35 | #include <opie2/odebug.h> | ||
34 | 36 | ||
35 | 37 | ||
36 | static inline QString fullBaseName ( const QFileInfo &fi ) | 38 | static inline QString fullBaseName ( const QFileInfo &fi ) |
@@ -44,7 +46,7 @@ static inline QString fullBaseName ( const QFileInfo &fi ) | |||
44 | 46 | ||
45 | Om3u::Om3u( const QString &filePath, int mode) | 47 | Om3u::Om3u( const QString &filePath, int mode) |
46 | : QStringList (){ | 48 | : QStringList (){ |
47 | //qDebug("<<<<<<<new m3u "+filePath); | 49 | //odebug << "<<<<<<<new m3u "+filePath << oendl; |
48 | f.setName(filePath); | 50 | f.setName(filePath); |
49 | f.open(mode); | 51 | f.open(mode); |
50 | } | 52 | } |
@@ -52,13 +54,13 @@ Om3u::Om3u( const QString &filePath, int mode) | |||
52 | Om3u::~Om3u(){} | 54 | Om3u::~Om3u(){} |
53 | 55 | ||
54 | void Om3u::readM3u() { | 56 | void Om3u::readM3u() { |
55 | // qDebug("<<<<<<reading m3u "+f.name()); | 57 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
56 | QTextStream t(&f); | 58 | QTextStream t(&f); |
57 | t.setEncoding(QTextStream::UnicodeUTF8); | 59 | t.setEncoding(QTextStream::UnicodeUTF8); |
58 | QString s; | 60 | QString s; |
59 | while ( !t.atEnd() ) { | 61 | while ( !t.atEnd() ) { |
60 | s=t.readLine(); | 62 | s=t.readLine(); |
61 | // qDebug(s); | 63 | // odebug << s << oendl; |
62 | if( s.find( "#", 0, TRUE) == -1 ) { | 64 | if( s.find( "#", 0, TRUE) == -1 ) { |
63 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
64 | s = s.right( s.length() -2 ); | 66 | s = s.right( s.length() -2 ); |
@@ -67,7 +69,7 @@ void Om3u::readM3u() { | |||
67 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
68 | s=s.replace( QRegExp( "\\" ), "/" ); | 70 | s=s.replace( QRegExp( "\\" ), "/" ); |
69 | append(s); | 71 | append(s); |
70 | // qDebug(s); | 72 | // odebug << s << oendl; |
71 | } else { // is url | 73 | } else { // is url |
72 | s.replace( QRegExp( "%20" )," " ); | 74 | s.replace( QRegExp( "%20" )," " ); |
73 | QString name; | 75 | QString name; |
@@ -77,7 +79,7 @@ void Om3u::readM3u() { | |||
77 | name = s; | 79 | name = s; |
78 | // } | 80 | // } |
79 | append(name); | 81 | append(name); |
80 | // qDebug(name); | 82 | // odebug << name << oendl; |
81 | } | 83 | } |
82 | } | 84 | } |
83 | } | 85 | } |
@@ -92,7 +94,7 @@ void Om3u::readPls() { //it's a pls file | |||
92 | if( s.left(4) == "File" ) { | 94 | if( s.left(4) == "File" ) { |
93 | s = s.right( s.length() - 6 ); | 95 | s = s.right( s.length() - 6 ); |
94 | s.replace( QRegExp( "%20" )," "); | 96 | s.replace( QRegExp( "%20" )," "); |
95 | // qDebug( "adding " + s + " to playlist" ); | 97 | // odebug << "adding " + s + " to playlist" << oendl; |
96 | // numberofentries=2 | 98 | // numberofentries=2 |
97 | // File1=http | 99 | // File1=http |
98 | // Title | 100 | // Title |
@@ -126,7 +128,7 @@ void Om3u::write() { //writes list to m3u file | |||
126 | t.setEncoding(QTextStream::UnicodeUTF8); | 128 | t.setEncoding(QTextStream::UnicodeUTF8); |
127 | if(count()>0) { | 129 | if(count()>0) { |
128 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 130 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
129 | // qDebug(*it); | 131 | // odebug << *it << oendl; |
130 | t << *it << "\n"; | 132 | t << *it << "\n"; |
131 | } | 133 | } |
132 | } | 134 | } |
@@ -142,7 +144,7 @@ void Om3u::remove(const QString &filePath) { //removes from m3u list | |||
142 | if(count()>0) { | 144 | if(count()>0) { |
143 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 145 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
144 | currentFile=*it; | 146 | currentFile=*it; |
145 | // qDebug(*it); | 147 | // odebug << *it << oendl; |
146 | 148 | ||
147 | if( filePath != currentFile) | 149 | if( filePath != currentFile) |
148 | list += currentFile+"\n"; | 150 | list += currentFile+"\n"; |
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index ad831cf..58c3966 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -18,10 +18,15 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qheader.h> | ||
22 | |||
23 | #include "playlistselection.h" | 21 | #include "playlistselection.h" |
24 | 22 | ||
23 | /* OPIE */ | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
26 | /* QT */ | ||
27 | #include <qheader.h> | ||
28 | |||
29 | /* STD */ | ||
25 | #include <stdlib.h> | 30 | #include <stdlib.h> |
26 | 31 | ||
27 | class PlayListSelectionItem : public QListViewItem { | 32 | class PlayListSelectionItem : public QListViewItem { |
@@ -44,7 +49,7 @@ private: | |||
44 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 49 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
45 | : QListView( parent, name ) | 50 | : QListView( parent, name ) |
46 | { | 51 | { |
47 | // qDebug("starting playlistselector"); | 52 | // odebug << "starting playlistselector" << oendl; |
48 | // #ifdef USE_PLAYLIST_BACKGROUND | 53 | // #ifdef USE_PLAYLIST_BACKGROUND |
49 | // setStaticBackground( TRUE ); | 54 | // setStaticBackground( TRUE ); |
50 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); | 55 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); |
@@ -66,7 +71,7 @@ PlayListSelection::~PlayListSelection() { | |||
66 | 71 | ||
67 | // #ifdef USE_PLAYLIST_BACKGROUND | 72 | // #ifdef USE_PLAYLIST_BACKGROUND |
68 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
69 | // qDebug("drawBackground"); | 74 | // odebug << "drawBackground" << oendl; |
70 | p->fillRect( r, QBrush( white ) ); | 75 | p->fillRect( r, QBrush( white ) ); |
71 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); | 76 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); |
72 | // if ( !logo.isNull() ) | 77 | // if ( !logo.isNull() ) |
@@ -186,7 +191,7 @@ void PlayListSelection::writeCurrent( Config& cfg ) { | |||
186 | QListViewItem *item = selectedItem(); | 191 | QListViewItem *item = selectedItem(); |
187 | if ( item ) | 192 | if ( item ) |
188 | cfg.writeEntry("current", item->text(0) ); | 193 | cfg.writeEntry("current", item->text(0) ); |
189 | // qDebug(item->text(0)); | 194 | // odebug << item->text(0) << oendl; |
190 | 195 | ||
191 | } | 196 | } |
192 | 197 | ||
@@ -195,9 +200,9 @@ void PlayListSelection::setSelectedItem(const QString &strk ) { | |||
195 | unSelect(); | 200 | unSelect(); |
196 | QListViewItemIterator it( this ); | 201 | QListViewItemIterator it( this ); |
197 | for ( ; it.current(); ++it ) { | 202 | for ( ; it.current(); ++it ) { |
198 | // qDebug( it.current()->text(0)); | 203 | // odebug << it.current()->text(0) << oendl; |
199 | if( strk == it.current()->text(0)) { | 204 | if( strk == it.current()->text(0)) { |
200 | // qDebug( "We have a match "+strk); | 205 | // odebug << "We have a match "+strk << oendl; |
201 | setSelected( it.current(), TRUE); | 206 | setSelected( it.current(), TRUE); |
202 | ensureItemVisible( it.current() ); | 207 | ensureItemVisible( it.current() ); |
203 | return; | 208 | return; |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 3609f5d..d85ce50 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -20,25 +20,27 @@ | |||
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | 22 | ||
23 | #include <qtoolbar.h> | 23 | #include "playlistselection.h" |
24 | #include "playlistwidget.h" | ||
25 | #include "mediaplayerstate.h" | ||
26 | #include "inputDialog.h" | ||
27 | #include "audiowidget.h" | ||
28 | #include "videowidget.h" | ||
29 | |||
30 | /* OPIE */ | ||
24 | #include <qpe/qpemenubar.h> | 31 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/lnkproperties.h> | 32 | #include <qpe/lnkproperties.h> |
33 | #include <opie2/odebug.h> | ||
26 | 34 | ||
35 | /* QT */ | ||
36 | #include <qtoolbar.h> | ||
27 | #include <qaction.h> | 37 | #include <qaction.h> |
28 | #include <qlayout.h> | 38 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
30 | |||
31 | //#include <qtimer.h> | 40 | //#include <qtimer.h> |
32 | 41 | ||
33 | #include "playlistselection.h" | 42 | /* STD */ |
34 | #include "playlistwidget.h" | ||
35 | #include "mediaplayerstate.h" | ||
36 | |||
37 | #include "inputDialog.h" | ||
38 | |||
39 | #include <stdlib.h> | 43 | #include <stdlib.h> |
40 | #include "audiowidget.h" | ||
41 | #include "videowidget.h" | ||
42 | 44 | ||
43 | #include <unistd.h> | 45 | #include <unistd.h> |
44 | #include <sys/file.h> | 46 | #include <sys/file.h> |
@@ -389,7 +391,7 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
389 | if ( lnk ) { | 391 | if ( lnk ) { |
390 | QString entryName; | 392 | QString entryName; |
391 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 393 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
392 | // qDebug(entryName); | 394 | // odebug << entryName << oendl; |
393 | cfg.writeEntry( entryName, lnk->linkFile() ); | 395 | cfg.writeEntry( entryName, lnk->linkFile() ); |
394 | // if this link does exist, add it so we have the file | 396 | // if this link does exist, add it so we have the file |
395 | // next time... | 397 | // next time... |
@@ -483,7 +485,7 @@ void PlayListWidget::setDocument(const QString& fileref) { | |||
483 | } | 485 | } |
484 | 486 | ||
485 | void PlayListWidget::setDocumentEx(const QString& fileref) { | 487 | void PlayListWidget::setDocumentEx(const QString& fileref) { |
486 | qDebug("opieplayer receive "+fileref); | 488 | odebug << "opieplayer receive "+fileref << oendl; |
487 | clearList(); | 489 | clearList(); |
488 | DocLnk lnk; | 490 | DocLnk lnk; |
489 | QFileInfo fileInfo(fileref); | 491 | QFileInfo fileInfo(fileref); |
@@ -492,7 +494,7 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { | |||
492 | tr( "There was a problem in getting the file." ) ); | 494 | tr( "There was a problem in getting the file." ) ); |
493 | return; | 495 | return; |
494 | } | 496 | } |
495 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); | 497 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl; |
496 | QString extension = fileInfo.extension(false); | 498 | QString extension = fileInfo.extension(false); |
497 | if( extension.find( "m3u", 0, false) != -1) { //is m3u | 499 | if( extension.find( "m3u", 0, false) != -1) { //is m3u |
498 | readm3u( fileref); | 500 | readm3u( fileref); |
@@ -534,7 +536,7 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { | |||
534 | 536 | ||
535 | 537 | ||
536 | void PlayListWidget::setActiveWindow() { | 538 | void PlayListWidget::setActiveWindow() { |
537 | // qDebug("SETTING active window"); | 539 | // odebug << "SETTING active window" << oendl; |
538 | // When we get raised we need to ensure that it switches views | 540 | // When we get raised we need to ensure that it switches views |
539 | char origView = mediaPlayerState->view(); | 541 | char origView = mediaPlayerState->view(); |
540 | mediaPlayerState->setView( 'l' ); // invalidate | 542 | mediaPlayerState->setView( 'l' ); // invalidate |
@@ -551,7 +553,7 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
551 | switch (tabWidget->currentPageIndex()) { | 553 | switch (tabWidget->currentPageIndex()) { |
552 | case 0: //playlist | 554 | case 0: //playlist |
553 | { | 555 | { |
554 | // qDebug("playlist"); | 556 | // odebug << "playlist" << oendl; |
555 | if ( mediaPlayerState->playlist() ) { | 557 | if ( mediaPlayerState->playlist() ) { |
556 | return d->selectedFiles->current(); | 558 | return d->selectedFiles->current(); |
557 | } | 559 | } |
@@ -564,7 +566,7 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
564 | break; | 566 | break; |
565 | case 1://audio | 567 | case 1://audio |
566 | { | 568 | { |
567 | // qDebug("audioView"); | 569 | // odebug << "audioView" << oendl; |
568 | QListIterator<DocLnk> dit( files.children() ); | 570 | QListIterator<DocLnk> dit( files.children() ); |
569 | for ( ; dit.current(); ++dit ) { | 571 | for ( ; dit.current(); ++dit ) { |
570 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 572 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
@@ -660,11 +662,11 @@ void PlayListWidget::saveList() { | |||
660 | 662 | ||
661 | void PlayListWidget::loadList( const DocLnk & lnk) { | 663 | void PlayListWidget::loadList( const DocLnk & lnk) { |
662 | QString name = lnk.name(); | 664 | QString name = lnk.name(); |
663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 665 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name << oendl; |
664 | 666 | ||
665 | if( name.length()>0) { | 667 | if( name.length()>0) { |
666 | setCaption("OpiePlayer: "+name); | 668 | setCaption("OpiePlayer: "+name); |
667 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 669 | // odebug << "<<<<<<<<<<<<load list "+ lnk.file() << oendl; |
668 | clearList(); | 670 | clearList(); |
669 | readm3u(lnk.file()); | 671 | readm3u(lnk.file()); |
670 | tabWidget->setCurrentPage(0); | 672 | tabWidget->setCurrentPage(0); |
@@ -818,7 +820,7 @@ void PlayListWidget::btnPlay(bool b) { | |||
818 | // } else { | 820 | // } else { |
819 | mediaPlayerState->setPlaying(b); | 821 | mediaPlayerState->setPlaying(b); |
820 | insanityBool=FALSE; | 822 | insanityBool=FALSE; |
821 | qDebug("insanity"); | 823 | odebug << "insanity" << oendl; |
822 | // } | 824 | // } |
823 | } | 825 | } |
824 | break; | 826 | break; |
@@ -951,7 +953,7 @@ void PlayListWidget::listDelete() { | |||
951 | } | 953 | } |
952 | 954 | ||
953 | void PlayListWidget::scanForAudio() { | 955 | void PlayListWidget::scanForAudio() { |
954 | // qDebug("scan for audio"); | 956 | // odebug << "scan for audio" << oendl; |
955 | files.detachChildren(); | 957 | files.detachChildren(); |
956 | QListIterator<DocLnk> sdit( files.children() ); | 958 | QListIterator<DocLnk> sdit( files.children() ); |
957 | for ( ; sdit.current(); ++sdit ) { | 959 | for ( ; sdit.current(); ++sdit ) { |
@@ -961,7 +963,7 @@ void PlayListWidget::scanForAudio() { | |||
961 | audioScan = true; | 963 | audioScan = true; |
962 | } | 964 | } |
963 | void PlayListWidget::scanForVideo() { | 965 | void PlayListWidget::scanForVideo() { |
964 | // qDebug("scan for video"); | 966 | // odebug << "scan for video" << oendl; |
965 | vFiles.detachChildren(); | 967 | vFiles.detachChildren(); |
966 | QListIterator<DocLnk> sdit( vFiles.children() ); | 968 | QListIterator<DocLnk> sdit( vFiles.children() ); |
967 | for ( ; sdit.current(); ++sdit ) { | 969 | for ( ; sdit.current(); ++sdit ) { |
@@ -996,7 +998,7 @@ void PlayListWidget::populateAudioView() { | |||
996 | size=0; | 998 | size=0; |
997 | else | 999 | else |
998 | size = QFile( dit.current()->file() ).size(); | 1000 | size = QFile( dit.current()->file() ).size(); |
999 | // qDebug(dit.current()->name()); | 1001 | // odebug << dit.current()->name() << oendl; |
1000 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1002 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1001 | QString::number(size ), storage, dit.current()->file()); | 1003 | QString::number(size ), storage, dit.current()->file()); |
1002 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1004 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
@@ -1040,7 +1042,7 @@ void PlayListWidget::openFile() { | |||
1040 | fileDlg->exec(); | 1042 | fileDlg->exec(); |
1041 | if( fileDlg->result() == 1 ) { | 1043 | if( fileDlg->result() == 1 ) { |
1042 | filename = fileDlg->text(); | 1044 | filename = fileDlg->text(); |
1043 | // qDebug( "Selected filename is " + filename ); | 1045 | // odebug << "Selected filename is " + filename << oendl; |
1044 | DocLnk lnk; | 1046 | DocLnk lnk; |
1045 | Config cfg( "OpiePlayer" ); | 1047 | Config cfg( "OpiePlayer" ); |
1046 | cfg.setGroup("PlayList"); | 1048 | cfg.setGroup("PlayList"); |
@@ -1085,7 +1087,7 @@ void PlayListWidget::openFile() { | |||
1085 | /* | 1087 | /* |
1086 | reads m3u and shows files/urls to playlist widget */ | 1088 | reads m3u and shows files/urls to playlist widget */ |
1087 | void PlayListWidget::readm3u( const QString &filename ) { | 1089 | void PlayListWidget::readm3u( const QString &filename ) { |
1088 | // qDebug( "read m3u filename " + filename ); | 1090 | // odebug << "read m3u filename " + filename << oendl; |
1089 | 1091 | ||
1090 | Om3u *m3uList; | 1092 | Om3u *m3uList; |
1091 | QString s, name; | 1093 | QString s, name; |
@@ -1094,7 +1096,7 @@ void PlayListWidget::readm3u( const QString &filename ) { | |||
1094 | DocLnk lnk; | 1096 | DocLnk lnk; |
1095 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1097 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1096 | s = *it; | 1098 | s = *it; |
1097 | // qDebug("reading "+ s); | 1099 | // odebug << "reading "+ s << oendl; |
1098 | if(s.left(4)=="http") { | 1100 | if(s.left(4)=="http") { |
1099 | lnk.setName( s ); //sets file name | 1101 | lnk.setName( s ); //sets file name |
1100 | lnk.setIcon("opieplayer2/musicfile"); | 1102 | lnk.setIcon("opieplayer2/musicfile"); |
@@ -1111,11 +1113,11 @@ void PlayListWidget::readm3u( const QString &filename ) { | |||
1111 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1113 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1112 | // if(s.right(4) == '.') {//if regular file | 1114 | // if(s.right(4) == '.') {//if regular file |
1113 | if(s.left(1) != "/") { | 1115 | if(s.left(1) != "/") { |
1114 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1116 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; |
1115 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1117 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1116 | lnk.setIcon("SoundPlayer"); | 1118 | lnk.setIcon("SoundPlayer"); |
1117 | } else { | 1119 | } else { |
1118 | // qDebug("set link2 "+s); | 1120 | // odebug << "set link2 "+s << oendl; |
1119 | lnk.setFile( s); | 1121 | lnk.setFile( s); |
1120 | lnk.setIcon("SoundPlayer"); | 1122 | lnk.setIcon("SoundPlayer"); |
1121 | } | 1123 | } |
@@ -1142,7 +1144,7 @@ void PlayListWidget::readm3u( const QString &filename ) { | |||
1142 | reads pls and adds files/urls to playlist */ | 1144 | reads pls and adds files/urls to playlist */ |
1143 | void PlayListWidget::readPls( const QString &filename ) { | 1145 | void PlayListWidget::readPls( const QString &filename ) { |
1144 | 1146 | ||
1145 | // qDebug( "pls filename is " + filename ); | 1147 | // odebug << "pls filename is " + filename << oendl; |
1146 | Om3u *m3uList; | 1148 | Om3u *m3uList; |
1147 | QString s, name; | 1149 | QString s, name; |
1148 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1150 | m3uList = new Om3u( filename, IO_ReadOnly ); |
@@ -1185,7 +1187,7 @@ void PlayListWidget::readPls( const QString &filename ) { | |||
1185 | /* | 1187 | /* |
1186 | writes current playlist to current m3u file */ | 1188 | writes current playlist to current m3u file */ |
1187 | void PlayListWidget::writeCurrentM3u() { | 1189 | void PlayListWidget::writeCurrentM3u() { |
1188 | // qDebug("writing to current m3u"); | 1190 | // odebug << "writing to current m3u" << oendl; |
1189 | Config cfg( "OpiePlayer" ); | 1191 | Config cfg( "OpiePlayer" ); |
1190 | cfg.setGroup("PlayList"); | 1192 | cfg.setGroup("PlayList"); |
1191 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 1193 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
@@ -1194,11 +1196,11 @@ void PlayListWidget::writeCurrentM3u() { | |||
1194 | 1196 | ||
1195 | if( d->selectedFiles->first()) { | 1197 | if( d->selectedFiles->first()) { |
1196 | do { | 1198 | do { |
1197 | // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); | 1199 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
1198 | m3uList->add( d->selectedFiles->current()->file() ); | 1200 | m3uList->add( d->selectedFiles->current()->file() ); |
1199 | } | 1201 | } |
1200 | while ( d->selectedFiles->next() ); | 1202 | while ( d->selectedFiles->next() ); |
1201 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 1203 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; |
1202 | m3uList->write(); | 1204 | m3uList->write(); |
1203 | m3uList->close(); | 1205 | m3uList->close(); |
1204 | 1206 | ||
@@ -1217,7 +1219,7 @@ void PlayListWidget::writem3u() { | |||
1217 | 1219 | ||
1218 | if( fileDlg->result() == 1 ) { | 1220 | if( fileDlg->result() == 1 ) { |
1219 | name = fileDlg->text(); | 1221 | name = fileDlg->text(); |
1220 | // qDebug( filename ); | 1222 | // odebug << filename << oendl; |
1221 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 1223 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
1222 | filename = name; | 1224 | filename = name; |
1223 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 1225 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
@@ -1235,7 +1237,7 @@ void PlayListWidget::writem3u() { | |||
1235 | m3uList->add( d->selectedFiles->current()->file()); | 1237 | m3uList->add( d->selectedFiles->current()->file()); |
1236 | } | 1238 | } |
1237 | while ( d->selectedFiles->next() ); | 1239 | while ( d->selectedFiles->next() ); |
1238 | // qDebug( list ); | 1240 | // odebug << list << oendl; |
1239 | m3uList->write(); | 1241 | m3uList->write(); |
1240 | m3uList->close(); | 1242 | m3uList->close(); |
1241 | if(m3uList) delete m3uList; | 1243 | if(m3uList) delete m3uList; |
@@ -1247,7 +1249,7 @@ void PlayListWidget::writem3u() { | |||
1247 | lnk.setIcon("opieplayer2/playlist2"); | 1249 | lnk.setIcon("opieplayer2/playlist2"); |
1248 | lnk.setName( name); //sets file name | 1250 | lnk.setName( name); //sets file name |
1249 | 1251 | ||
1250 | // qDebug(filename); | 1252 | // odebug << filename << oendl; |
1251 | Config config( "OpiePlayer" ); | 1253 | Config config( "OpiePlayer" ); |
1252 | config.setGroup( "PlayList" ); | 1254 | config.setGroup( "PlayList" ); |
1253 | 1255 | ||
@@ -1255,7 +1257,7 @@ void PlayListWidget::writem3u() { | |||
1255 | currentPlayList=filename; | 1257 | currentPlayList=filename; |
1256 | 1258 | ||
1257 | if(!lnk.writeLink()) { | 1259 | if(!lnk.writeLink()) { |
1258 | // qDebug("Writing doclink did not work"); | 1260 | // odebug << "Writing doclink did not work" << oendl; |
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | setCaption(tr("OpiePlayer: ") + name); | 1263 | setCaption(tr("OpiePlayer: ") + name); |
@@ -1291,7 +1293,7 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1291 | removeSelected(); | 1293 | removeSelected(); |
1292 | break; | 1294 | break; |
1293 | // case Key_P: //play | 1295 | // case Key_P: //play |
1294 | // qDebug("Play"); | 1296 | // odebug << "Play" << oendl; |
1295 | // playSelected(); | 1297 | // playSelected(); |
1296 | // break; | 1298 | // break; |
1297 | case Key_Space: | 1299 | case Key_Space: |
@@ -1325,29 +1327,29 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1325 | 1327 | ||
1326 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1328 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1327 | { | 1329 | { |
1328 | // qDebug("Key press"); | 1330 | // odebug << "Key press" << oendl; |
1329 | // switch ( e->key() ) { | 1331 | // switch ( e->key() ) { |
1330 | // ////////////////////////////// Zaurus keys | 1332 | // ////////////////////////////// Zaurus keys |
1331 | // case Key_A: //add to playlist | 1333 | // case Key_A: //add to playlist |
1332 | // qDebug("Add"); | 1334 | // odebug << "Add" << oendl; |
1333 | // addSelected(); | 1335 | // addSelected(); |
1334 | // break; | 1336 | // break; |
1335 | // case Key_R: //remove from playlist | 1337 | // case Key_R: //remove from playlist |
1336 | // removeSelected(); | 1338 | // removeSelected(); |
1337 | // break; | 1339 | // break; |
1338 | // case Key_P: //play | 1340 | // case Key_P: //play |
1339 | // qDebug("Play"); | 1341 | // odebug << "Play" << oendl; |
1340 | // playSelected(); | 1342 | // playSelected(); |
1341 | // break; | 1343 | // break; |
1342 | // case Key_Space: | 1344 | // case Key_Space: |
1343 | // qDebug("Play"); | 1345 | // odebug << "Play" << oendl; |
1344 | // playSelected(); | 1346 | // playSelected(); |
1345 | // break; | 1347 | // break; |
1346 | // } | 1348 | // } |
1347 | } | 1349 | } |
1348 | 1350 | ||
1349 | void PlayListWidget::doBlank() { | 1351 | void PlayListWidget::doBlank() { |
1350 | // qDebug("do blanking"); | 1352 | // odebug << "do blanking" << oendl; |
1351 | #ifdef QT_QWS_DEVFS | 1353 | #ifdef QT_QWS_DEVFS |
1352 | fd=open("/dev/fb/0",O_RDWR); | 1354 | fd=open("/dev/fb/0",O_RDWR); |
1353 | #else | 1355 | #else |
@@ -1363,7 +1365,7 @@ void PlayListWidget::doUnblank() { | |||
1363 | // this crashes opieplayer with a segfault | 1365 | // this crashes opieplayer with a segfault |
1364 | // int fd; | 1366 | // int fd; |
1365 | // fd=open("/dev/fb0",O_RDWR); | 1367 | // fd=open("/dev/fb0",O_RDWR); |
1366 | // qDebug("do unblanking"); | 1368 | // odebug << "do unblanking" << oendl; |
1367 | if (fd != -1) { | 1369 | if (fd != -1) { |
1368 | ioctl(fd,FBIOBLANK,0); | 1370 | ioctl(fd,FBIOBLANK,0); |
1369 | close(fd); | 1371 | close(fd); |
@@ -1388,7 +1390,7 @@ void PlayListWidget::populateSkinsMenu() { | |||
1388 | QFileInfo *fi; | 1390 | QFileInfo *fi; |
1389 | while ( ( fi = it.current() ) ) { | 1391 | while ( ( fi = it.current() ) ) { |
1390 | skinName = fi->fileName(); | 1392 | skinName = fi->fileName(); |
1391 | // qDebug( fi->fileName() ); | 1393 | // odebug << fi->fileName() << oendl; |
1392 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1394 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1393 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1395 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1394 | } | 1396 | } |
@@ -1414,7 +1416,7 @@ void PlayListWidget::skinsMenuActivated( int item ) { | |||
1414 | } | 1416 | } |
1415 | 1417 | ||
1416 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1418 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { |
1417 | // qDebug("qcop message "+msg ); | 1419 | // odebug << "qcop message "+msg << oendl; |
1418 | QDataStream stream ( data, IO_ReadOnly ); | 1420 | QDataStream stream ( data, IO_ReadOnly ); |
1419 | if ( msg == "play()" ) { //plays current selection | 1421 | if ( msg == "play()" ) { //plays current selection |
1420 | btnPlay( true); | 1422 | btnPlay( true); |
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 164458b..e851044 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -17,15 +17,20 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
21 | #include "videowidget.h" | ||
22 | #include "mediaplayerstate.h" | ||
23 | |||
24 | /* OPIE */ | ||
20 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
21 | #include <qpe/mediaplayerplugininterface.h> | 26 | #include <qpe/mediaplayerplugininterface.h> |
22 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <opie2/odebug.h> | ||
24 | 30 | ||
31 | /* QT */ | ||
25 | #include <qdir.h> | 32 | #include <qdir.h> |
26 | #include <qslider.h> | 33 | #include <qslider.h> |
27 | #include "videowidget.h" | ||
28 | #include "mediaplayerstate.h" | ||
29 | 34 | ||
30 | 35 | ||
31 | #ifdef Q_WS_QWS | 36 | #ifdef Q_WS_QWS |
@@ -82,7 +87,7 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
82 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 87 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
83 | skinPath = "opieplayer2/skins/default"; | 88 | skinPath = "opieplayer2/skins/default"; |
84 | 89 | ||
85 | // qDebug("skin path " + skinPath); | 90 | // odebug << "skin path " + skinPath << oendl; |
86 | 91 | ||
87 | // QString skinPath = "opieplayer2/skins/" + skin; | 92 | // QString skinPath = "opieplayer2/skins/" + skin; |
88 | 93 | ||
@@ -96,7 +101,7 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
96 | for ( int i = 0; i < 7; i++ ) { | 101 | for ( int i = 0; i < 7; i++ ) { |
97 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + | 102 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + |
98 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 103 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
99 | // qDebug("loading "+filename); | 104 | // odebug << "loading "+filename << oendl; |
100 | masks[i] = new QBitmap( filename ); | 105 | masks[i] = new QBitmap( filename ); |
101 | 106 | ||
102 | if ( !masks[i]->isNull() ) { | 107 | if ( !masks[i]->isNull() ) { |
@@ -111,7 +116,7 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
111 | } | 116 | } |
112 | } | 117 | } |
113 | } | 118 | } |
114 | // qDebug("finished loading first pics"); | 119 | // odebug << "finished loading first pics" << oendl; |
115 | for ( int i = 0; i < 7; i++ ) { | 120 | for ( int i = 0; i < 7; i++ ) { |
116 | buttonPixUp[i] = NULL; | 121 | buttonPixUp[i] = NULL; |
117 | buttonPixDown[i] = NULL; | 122 | buttonPixDown[i] = NULL; |
@@ -123,7 +128,7 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
123 | int height = d->height(); | 128 | int height = d->height(); |
124 | 129 | ||
125 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 130 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
126 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); | 131 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; |
127 | QImage img; | 132 | QImage img; |
128 | img = pixBg->convertToImage(); | 133 | img = pixBg->convertToImage(); |
129 | pixBg->convertFromImage( img.smoothScale( width, height)); | 134 | pixBg->convertFromImage( img.smoothScale( width, height)); |
@@ -353,7 +358,7 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
353 | switch(i) { | 358 | switch(i) { |
354 | 359 | ||
355 | case VideoPlay: { | 360 | case VideoPlay: { |
356 | // qDebug("play"); | 361 | // odebug << "play" << oendl; |
357 | if( !mediaPlayerState->playing()) { | 362 | if( !mediaPlayerState->playing()) { |
358 | mediaPlayerState->setPlaying( true); | 363 | mediaPlayerState->setPlaying( true); |
359 | setToggleButton( i-1, false ); | 364 | setToggleButton( i-1, false ); |
@@ -361,12 +366,12 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
361 | return; | 366 | return; |
362 | } | 367 | } |
363 | if( mediaPlayerState->isPaused ) { | 368 | if( mediaPlayerState->isPaused ) { |
364 | // qDebug("isPaused"); | 369 | // odebug << "isPaused" << oendl; |
365 | setToggleButton( i, FALSE ); | 370 | setToggleButton( i, FALSE ); |
366 | mediaPlayerState->setPaused( FALSE ); | 371 | mediaPlayerState->setPaused( FALSE ); |
367 | return; | 372 | return; |
368 | } else if( !mediaPlayerState->isPaused ) { | 373 | } else if( !mediaPlayerState->isPaused ) { |
369 | // qDebug("is not paused"); | 374 | // odebug << "is not paused" << oendl; |
370 | setToggleButton( i, TRUE ); | 375 | setToggleButton( i, TRUE ); |
371 | mediaPlayerState->setPaused( TRUE ); | 376 | mediaPlayerState->setPaused( TRUE ); |
372 | return; | 377 | return; |
@@ -458,7 +463,7 @@ void VideoWidget::closeEvent( QCloseEvent* ) { | |||
458 | 463 | ||
459 | bool VideoWidget::playVideo() { | 464 | bool VideoWidget::playVideo() { |
460 | bool result = FALSE; | 465 | bool result = FALSE; |
461 | // qDebug("<<<<<<<<<<<<<<<< play video"); | 466 | // odebug << "<<<<<<<<<<<<<<<< play video" << oendl; |
462 | int stream = 0; | 467 | int stream = 0; |
463 | 468 | ||
464 | int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); | 469 | int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); |
diff --git a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp index 53c4b2b..0002213 100644 --- a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp +++ b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp | |||
@@ -19,6 +19,15 @@ | |||
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | // fixed and adapted for opieplayer 2003 ljp <llornkcor@handhelds.org> | 20 | // fixed and adapted for opieplayer 2003 ljp <llornkcor@handhelds.org> |
21 | 21 | ||
22 | #include "libtremorplugin.h" | ||
23 | |||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
26 | |||
27 | /* QT */ | ||
28 | #include <qmap.h> | ||
29 | |||
30 | /* STD */ | ||
22 | #include <stdio.h> | 31 | #include <stdio.h> |
23 | #include <stdarg.h> | 32 | #include <stdarg.h> |
24 | #include <stdlib.h> | 33 | #include <stdlib.h> |
@@ -33,10 +42,6 @@ | |||
33 | #include <math.h> | 42 | #include <math.h> |
34 | #include <assert.h> | 43 | #include <assert.h> |
35 | 44 | ||
36 | #include <qmap.h> | ||
37 | |||
38 | #include "libtremorplugin.h" | ||
39 | |||
40 | 45 | ||
41 | extern "C" { | 46 | extern "C" { |
42 | #include "tremor/ivorbisfile.h" | 47 | #include "tremor/ivorbisfile.h" |
@@ -62,7 +67,7 @@ public: | |||
62 | 67 | ||
63 | 68 | ||
64 | LibTremorPlugin::LibTremorPlugin() { | 69 | LibTremorPlugin::LibTremorPlugin() { |
65 | qDebug("<<<<<<<<<<<<<TREMOR!!!!!>>>>>>>>>>>>>>>>>>"); | 70 | odebug << "<<<<<<<<<<<<<TREMOR!!!!!>>>>>>>>>>>>>>>>>>" << oendl; |
66 | d = new LibTremorPluginData; | 71 | d = new LibTremorPluginData; |
67 | d->f = 0; | 72 | d->f = 0; |
68 | d->vi = 0; | 73 | d->vi = 0; |
@@ -105,12 +110,12 @@ bool LibTremorPlugin::open( const QString& path ) { | |||
105 | d->filename = (char*) path.latin1(); | 110 | d->filename = (char*) path.latin1(); |
106 | d->f = fopen( d->filename, "r" ); | 111 | d->f = fopen( d->filename, "r" ); |
107 | if (d->f == 0) { | 112 | if (d->f == 0) { |
108 | qDebug("error opening %s", d->filename ); | 113 | odebug << "error opening " << d->filename << "" << oendl; |
109 | return FALSE; | 114 | return FALSE; |
110 | } | 115 | } |
111 | 116 | ||
112 | if (ov_open(d->f, &d->vf, NULL, 0) < 0) { | 117 | if (ov_open(d->f, &d->vf, NULL, 0) < 0) { |
113 | qDebug("error opening %s", d->filename); | 118 | odebug << "error opening " << d->filename << "" << oendl; |
114 | return FALSE; | 119 | return FALSE; |
115 | } | 120 | } |
116 | 121 | ||
@@ -153,7 +158,7 @@ bool LibTremorPlugin::open( const QString& path ) { | |||
153 | } | 158 | } |
154 | } | 159 | } |
155 | 160 | ||
156 | qDebug("finfo: " + d->finfo); | 161 | odebug << "finfo: " + d->finfo << oendl; |
157 | 162 | ||
158 | return TRUE; | 163 | return TRUE; |
159 | } | 164 | } |
@@ -165,7 +170,7 @@ bool LibTremorPlugin::close() { | |||
165 | int result = TRUE; | 170 | int result = TRUE; |
166 | 171 | ||
167 | if (fclose(d->f) == -1) { | 172 | if (fclose(d->f) == -1) { |
168 | qDebug("error closing file %s", d->filename); | 173 | odebug << "error closing file " << d->filename << "" << oendl; |
169 | result = FALSE; | 174 | result = FALSE; |
170 | } | 175 | } |
171 | 176 | ||
@@ -193,13 +198,13 @@ int LibTremorPlugin::audioStreams() { | |||
193 | 198 | ||
194 | 199 | ||
195 | int LibTremorPlugin::audioChannels( int ) { | 200 | int LibTremorPlugin::audioChannels( int ) { |
196 | qDebug( "LibTremorPlugin::audioChannels: %i", d->vi->channels ); | 201 | odebug << "LibTremorPlugin::audioChannels: " << d->vi->channels << "" << oendl; |
197 | return d->vi->channels; | 202 | return d->vi->channels; |
198 | } | 203 | } |
199 | 204 | ||
200 | 205 | ||
201 | int LibTremorPlugin::audioFrequency( int ) { | 206 | int LibTremorPlugin::audioFrequency( int ) { |
202 | qDebug( "LibTremorPlugin::audioFrequency: %ld", d->vi->rate ); | 207 | odebug << "LibTremorPlugin::audioFrequency: " << d->vi->rate << "" << oendl; |
203 | return d->vi->rate; | 208 | return d->vi->rate; |
204 | } | 209 | } |
205 | 210 | ||
@@ -223,7 +228,7 @@ long LibTremorPlugin::audioGetSample( int ) { | |||
223 | 228 | ||
224 | 229 | ||
225 | bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& samplesMade, int ) { | 230 | bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& samplesMade, int ) { |
226 | // qDebug( "<<<<<<<<<<<<LibTremorPlugin::audioReadStereoSamples %d", samples ); | 231 | // odebug << "<<<<<<<<<<<<LibTremorPlugin::audioReadStereoSamples " << samples << "" << oendl; |
227 | 232 | ||
228 | int old_section = d->csection; | 233 | int old_section = d->csection; |
229 | 234 | ||
@@ -245,7 +250,7 @@ bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& | |||
245 | } | 250 | } |
246 | 251 | ||
247 | long ret = ov_read(&d->vf, buf, n, &d->csection); | 252 | long ret = ov_read(&d->vf, buf, n, &d->csection); |
248 | // qDebug("%d", ret); | 253 | // odebug << "" << ret << "" << oendl; |
249 | if (ret == 0) { | 254 | if (ret == 0) { |
250 | break; | 255 | break; |
251 | } else if (ret < 0) { | 256 | } else if (ret < 0) { |
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp index 4e82900..7f3a0a8 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp | |||
@@ -19,13 +19,21 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | 20 | // L.J.Potter added changes Fri 02-15-2002 |
21 | 21 | ||
22 | |||
23 | #include "wavplugin.h" | ||
24 | |||
25 | /* OPIE */ | ||
26 | #include <opie2/odebug.h> | ||
27 | |||
28 | /* QT */ | ||
29 | #include <qfile.h> | ||
30 | |||
31 | /* STD */ | ||
22 | #include <stdio.h> | 32 | #include <stdio.h> |
23 | #include <stdarg.h> | 33 | #include <stdarg.h> |
24 | #include <stdlib.h> | 34 | #include <stdlib.h> |
25 | #include <errno.h> | 35 | #include <errno.h> |
26 | #include <unistd.h> | 36 | #include <unistd.h> |
27 | #include <qfile.h> | ||
28 | #include "wavplugin.h" | ||
29 | 37 | ||
30 | //#define debugMsg(a) qDebug(a) | 38 | //#define debugMsg(a) qDebug(a) |
31 | #define debugMsg(a) | 39 | #define debugMsg(a) |
@@ -76,14 +84,14 @@ public: | |||
76 | done = 0; | 84 | done = 0; |
77 | 85 | ||
78 | if ( input == 0 ) { | 86 | if ( input == 0 ) { |
79 | qDebug("no input"); | 87 | odebug << "no input" << oendl; |
80 | return FALSE; | 88 | return FALSE; |
81 | } | 89 | } |
82 | 90 | ||
83 | while ( count ) { | 91 | while ( count ) { |
84 | int l,r; | 92 | int l,r; |
85 | if ( getSample(l, r) == FALSE ) { | 93 | if ( getSample(l, r) == FALSE ) { |
86 | qDebug("didn't get sample"); | 94 | odebug << "didn't get sample" << oendl; |
87 | return FALSE; | 95 | return FALSE; |
88 | } | 96 | } |
89 | samples_due += chunkdata.samplesPerSec; | 97 | samples_due += chunkdata.samplesPerSec; |
@@ -135,7 +143,7 @@ public: | |||
135 | } | 143 | } |
136 | #define WAVE_FORMAT_PCM 1 | 144 | #define WAVE_FORMAT_PCM 1 |
137 | if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { | 145 | if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { |
138 | qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); | 146 | odebug << "WAV file: UNSUPPORTED FORMAT " << chunkdata.formatTag << "" << oendl; |
139 | return FALSE; | 147 | return FALSE; |
140 | } | 148 | } |
141 | } else { | 149 | } else { |
@@ -145,7 +153,7 @@ public: | |||
145 | } | 153 | } |
146 | } | 154 | } |
147 | } // while | 155 | } // while |
148 | qDebug("bits %d", chunkdata.wBitsPerSample); | 156 | odebug << "bits " << chunkdata.wBitsPerSample << "" << oendl; |
149 | return TRUE; | 157 | return TRUE; |
150 | } | 158 | } |
151 | 159 | ||
@@ -207,7 +215,7 @@ WavPlugin::~WavPlugin() { | |||
207 | 215 | ||
208 | 216 | ||
209 | bool WavPlugin::isFileSupported( const QString& path ) { | 217 | bool WavPlugin::isFileSupported( const QString& path ) { |
210 | // qDebug( "WavPlugin::isFileSupported" ); | 218 | // odebug << "WavPlugin::isFileSupported" << oendl; |
211 | 219 | ||
212 | char *ext = strrchr( path.latin1(), '.' ); | 220 | char *ext = strrchr( path.latin1(), '.' ); |
213 | 221 | ||
@@ -226,7 +234,7 @@ bool WavPlugin::isFileSupported( const QString& path ) { | |||
226 | 234 | ||
227 | 235 | ||
228 | bool WavPlugin::open( const QString& path ) { | 236 | bool WavPlugin::open( const QString& path ) { |
229 | // qDebug( "WavPlugin::open" ); | 237 | // odebug << "WavPlugin::open" << oendl; |
230 | 238 | ||
231 | d->max = d->out = sound_buffer_size; | 239 | d->max = d->out = sound_buffer_size; |
232 | d->wavedata_remaining = 0; | 240 | d->wavedata_remaining = 0; |
@@ -234,7 +242,7 @@ bool WavPlugin::open( const QString& path ) { | |||
234 | 242 | ||
235 | d->input = new QFile( path ); | 243 | d->input = new QFile( path ); |
236 | if ( d->input->open(IO_ReadOnly) == FALSE ) { | 244 | if ( d->input->open(IO_ReadOnly) == FALSE ) { |
237 | qDebug("couldn't open file"); | 245 | odebug << "couldn't open file" << oendl; |
238 | delete d->input; | 246 | delete d->input; |
239 | d->input = 0; | 247 | d->input = 0; |
240 | return FALSE; | 248 | return FALSE; |
@@ -248,7 +256,7 @@ bool WavPlugin::open( const QString& path ) { | |||
248 | 256 | ||
249 | 257 | ||
250 | bool WavPlugin::close() { | 258 | bool WavPlugin::close() { |
251 | // qDebug( "WavPlugin::close" ); | 259 | // odebug << "WavPlugin::close" << oendl; |
252 | 260 | ||
253 | d->input->close(); | 261 | d->input->close(); |
254 | delete d->input; | 262 | delete d->input; |
@@ -258,44 +266,44 @@ bool WavPlugin::close() { | |||
258 | 266 | ||
259 | 267 | ||
260 | bool WavPlugin::isOpen() { | 268 | bool WavPlugin::isOpen() { |
261 | // qDebug( "WavPlugin::isOpen" ); | 269 | // odebug << "WavPlugin::isOpen" << oendl; |
262 | return ( d->input != 0 ); | 270 | return ( d->input != 0 ); |
263 | } | 271 | } |
264 | 272 | ||
265 | 273 | ||
266 | int WavPlugin::audioStreams() { | 274 | int WavPlugin::audioStreams() { |
267 | // qDebug( "WavPlugin::audioStreams" ); | 275 | // odebug << "WavPlugin::audioStreams" << oendl; |
268 | return 1; | 276 | return 1; |
269 | } | 277 | } |
270 | 278 | ||
271 | 279 | ||
272 | int WavPlugin::audioChannels( int ) { | 280 | int WavPlugin::audioChannels( int ) { |
273 | // qDebug( "WavPlugin::audioChannels" ); | 281 | // odebug << "WavPlugin::audioChannels" << oendl; |
274 | return d->chunkdata.channels;// 2; // ### Always scale audio to stereo samples | 282 | return d->chunkdata.channels;// 2; // ### Always scale audio to stereo samples |
275 | } | 283 | } |
276 | 284 | ||
277 | 285 | ||
278 | int WavPlugin::audioFrequency( int ) { | 286 | int WavPlugin::audioFrequency( int ) { |
279 | // qDebug( "WavPlugin::audioFrequency %d", d->chunkdata.samplesPerSec ); | 287 | // odebug << "WavPlugin::audioFrequency " << d->chunkdata.samplesPerSec << "" << oendl; |
280 | return d->chunkdata.samplesPerSec; //44100; // ### Always scale to frequency of 44100 | 288 | return d->chunkdata.samplesPerSec; //44100; // ### Always scale to frequency of 44100 |
281 | } | 289 | } |
282 | 290 | ||
283 | 291 | ||
284 | int WavPlugin::audioSamples( int ) { | 292 | int WavPlugin::audioSamples( int ) { |
285 | // qDebug( "WavPlugin::audioSamples" ); | 293 | // odebug << "WavPlugin::audioSamples" << oendl; |
286 | return d->samples / d->chunkdata.channels/2; // ### Scaled samples will be made stereo, | 294 | return d->samples / d->chunkdata.channels/2; // ### Scaled samples will be made stereo, |
287 | // Therefore if source is mono we will double the number of samples | 295 | // Therefore if source is mono we will double the number of samples |
288 | } | 296 | } |
289 | 297 | ||
290 | 298 | ||
291 | bool WavPlugin::audioSetSample( long, int ) { | 299 | bool WavPlugin::audioSetSample( long, int ) { |
292 | // qDebug( "WavPlugin::audioSetSample" ); | 300 | // odebug << "WavPlugin::audioSetSample" << oendl; |
293 | return FALSE; | 301 | return FALSE; |
294 | } | 302 | } |
295 | 303 | ||
296 | 304 | ||
297 | long WavPlugin::audioGetSample( int ) { | 305 | long WavPlugin::audioGetSample( int ) { |
298 | // qDebug( "WavPlugin::audioGetSample" ); | 306 | // odebug << "WavPlugin::audioGetSample" << oendl; |
299 | return 0; | 307 | return 0; |
300 | } | 308 | } |
301 | 309 | ||
@@ -325,17 +333,17 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl | |||
325 | */ | 333 | */ |
326 | 334 | ||
327 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { | 335 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { |
328 | // qDebug( "WavPlugin::audioReadSamples" ); | 336 | // odebug << "WavPlugin::audioReadSamples" << oendl; |
329 | return d->add( output, samples, samplesMade, channels != 1 ); | 337 | return d->add( output, samples, samplesMade, channels != 1 ); |
330 | } | 338 | } |
331 | 339 | ||
332 | double WavPlugin::getTime() { | 340 | double WavPlugin::getTime() { |
333 | // qDebug( "WavPlugin::getTime" ); //this is a stupid hack here!! | 341 | // odebug << "WavPlugin::getTime" << oendl; //this is a stupid hack here!! |
334 | return d->chunkdata.wBitsPerSample; /*0.0*/; | 342 | return d->chunkdata.wBitsPerSample; /*0.0*/; |
335 | } | 343 | } |
336 | 344 | ||
337 | // int WavPlugin::audioBitsPerSample( int ) { | 345 | // int WavPlugin::audioBitsPerSample( int ) { |
338 | // // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); | 346 | // // odebug << "WavPlugin::audioFormat " << d->chunkdata.wBitsPerSample << "" << oendl; |
339 | // return d->chunkdata.wBitsPerSample; // | 347 | // return d->chunkdata.wBitsPerSample; // |
340 | // } | 348 | // } |
341 | 349 | ||