summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-22 01:38:20 (UTC)
committer llornkcor <llornkcor>2002-06-22 01:38:20 (UTC)
commit9adc4e5ab0a07eda196fffc8921da2d2d4f273e7 (patch) (side-by-side diff)
tree91500597f01f145b5ec5a6ff80e812c59f95317f
parent28f2e6b92c40125172c9716790dc98cc30abc7fc (diff)
downloadopie-9adc4e5ab0a07eda196fffc8921da2d2d4f273e7.zip
opie-9adc4e5ab0a07eda196fffc8921da2d2d4f273e7.tar.gz
opie-9adc4e5ab0a07eda196fffc8921da2d2d4f273e7.tar.bz2
new action if /dev/dsp can't open, instead of sending to bytes to /dev/null.. lets immediately exit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp15
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp10
2 files changed, 18 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index faadd72..8f04d0d 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -15,26 +15,31 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// L.J.Potter added better error code Fri 02-15-2002 14:37:47
#include <stdlib.h>
#include <stdio.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
+#include <qmessagebox.h>
+
#include "audiodevice.h"
+
+#include <errno.h>
+
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include "qpe/qcopenvelope_qws.h"
#endif
// #ifdef Q_WS_WIN
// #include <windows.h>
// #include <mmsystem.h>
// #include <mmreg.h>
// #endif
#if defined(Q_WS_X11) || defined(Q_WS_QWS)
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -200,26 +205,32 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
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");
- d->handle = ::open( "/dev/null", O_WRONLY );
+
+// 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.");
+ QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort"));
+ exit(-1); //harsh?
+// d->handle = ::open( "/dev/null", O_WRONLY );
+ // WTF?!?!
}
#ifdef KEEP_DEVICE_OPEN
AudioDevicePrivate::dspFd = d->handle;
} else {
d->handle = AudioDevicePrivate::dspFd;
}
#endif
if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1)
perror("ioctl(\"SNDCTL_DSP_GETCAPS\")");
if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1)
perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index ae25fe3..0332237 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -408,37 +408,37 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
}
}
noOfFiles++;
}
}
while ( d->selectedFiles->next() );
cfg.writeEntry("NumberOfFiles", noOfFiles );
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
// qDebug("add");
- if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
- QMessageBox::message("Note","You are trying to play\na malformed url.");
+// if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
+// QMessageBox::message("Note","You are trying to play\na malformed url.");
- } else {
+// } else {
d->setDocumentUsed = FALSE;
if ( mediaPlayerState->playlist() ) {
if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
d->selectedFiles->addToSelection( lnk );
}
else
mediaPlayerState->setPlaying( TRUE );
- }
+// }
}
void PlayListWidget::clearList() {
while ( first() )
d->selectedFiles->removeSelected();
}
void PlayListWidget::addAllToList() {
DocLnkSet filesAll;
Global::findDocuments(&filesAll, "video/*;audio/*");
@@ -846,25 +846,25 @@ void PlayListWidget::tabChanged(QWidget *widg) {
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
- QMessageBox::message("Note","You are trying to play\na malformed url.");
+// QMessageBox::message("Note","You are trying to play\na malformed url.");
// } else {
mediaPlayerState->setPlaying(b);
// }
}
break;
case 1:
{
addToSelection( audioView->currentItem() );
mediaPlayerState->setPlaying(b);
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
d->selectedFiles->unSelect();