-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 8f04d0d..59e06a6 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp @@ -172,49 +172,49 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, } else perror("open(\"/dev/mixer\")"); # else // This is the way this has to be done now I guess, doesn't allow for // independant right and left channel setting, or setting for different outputs Config cfg("qpe"); // qtopia is "Sound" cfg.setGroup("Volume"); // qtopia is "Settings" cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume # endif //#endif // qDebug( "setting volume to: 0x%x", volume ); #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) // Send notification that the volume has changed QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; #endif } AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { qDebug("creating new audio device"); - QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; + // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; d = new AudioDevicePrivate; d->frequency = f; d->channels = chs; d->bytesPerSample = bps; qDebug("%d",bps); int format=0; if( bps == 8) format = AFMT_U8; else if( bps <= 0) format = AFMT_S16_LE; else format = AFMT_S16_LE; qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); int fragments = 0x10000 * 8 + sound_fragment_shift; int capabilities = 0; #ifdef KEEP_DEVICE_OPEN if ( AudioDevicePrivate::dspFd == 0 ) { #endif if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { // perror("open(\"/dev/dsp\") sending to /dev/null instead"); perror("open(\"/dev/dsp\")"); QString errorMsg=tr("Somethin's wrong with\nyour sound device.\nopen(\"/dev/dsp\")\n")+(QString)strerror(errno)+tr("\n\nClosing player now."); @@ -236,67 +236,67 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); qDebug("freq %d", d->frequency); if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) perror("ioctl(\"SNDCTL_DSP_SPEED\")"); qDebug("channels %d",d->channels); if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { d->channels = ( d->channels == 1 ) ? 2 : d->channels; if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); } d->bufferSize = sound_fragment_bytes; d->unwrittenBuffer = new char[d->bufferSize]; d->unwritten = 0; d->can_GETOSPACE = TRUE; // until we find otherwise //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); - QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; + // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; } AudioDevice::~AudioDevice() { qDebug("destryo audiodevice"); - QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; + // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; // #ifdef Q_OS_WIN32 // waveOutClose( (HWAVEOUT)d->handle ); // #else # ifndef KEEP_DEVICE_OPEN close( d->handle ); // Now it should be safe to shut the handle # endif delete d->unwrittenBuffer; delete d; //#endif - QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; +// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; } void AudioDevice::volumeChanged( bool muted ) { AudioDevicePrivate::muted = muted; } void AudioDevice::write( char *buffer, unsigned int length ) { // #ifdef Q_OS_WIN32 // // returns immediately and (to be implemented) emits completedIO() when finished writing // WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) ); // // maybe the buffer should be copied so that this fool proof, but its a performance hit // lpWaveHdr->lpData = buffer; // lpWaveHdr->dwBufferLength = length; // lpWaveHdr->dwFlags = 0L; // lpWaveHdr->dwLoops = 0L; // waveOutPrepareHeader( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ); // // waveOutWrite returns immediately. the data is sent in the background. // if ( waveOutWrite( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ) ) // qDebug( "failed to write block to audio device" ); diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 0332237..4926287 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -1317,36 +1317,41 @@ void PlayListWidget::readPls(const QString &filename) { qDebug("adding "+s+" to playlist"); // numberofentries=2 // File1=http // Title // Length // Version // File2=http s=s.replace( QRegExp("\\"),"/"); DocLnk lnk( s ); QFileInfo f(s); QString name = f.baseName(); if(name.left(4)=="http") name = s.right( s.length() - 7); else name=s; name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); // QFileInfo f(s); // QString name = f.baseName(); // name = name.left(name.length()-4); // name = name.right(name.findRev("/",0,TRUE)); lnk.setName( name); if(s.at(s.length()-4) == '.') lnk.setFile( s); - else - lnk.setFile( s+"/"); + else { + if( name.right(1).find('/') == -1) + s+="/"; + // if(s.right(1) != '/') + lnk.setFile( s); + + } lnk.setType("audio/x-mpegurl"); qDebug("DocLnk add "+name); d->selectedFiles->addToSelection( lnk); } } i++; } } |