diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-08-30 17:45:38 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-08-30 17:45:38 +0000 |
| commit | 39556dbfe68a0b153825b0c75c8cb3f2dc5c1094 (patch) | |
| tree | a35813d4615bef2016d5be5fbd22f95bc084d042 /src/plugins/Output/oss/outputoss.cpp | |
| parent | 53388fec83220c0a42e769484f321add84b35741 (diff) | |
| download | qmmp-39556dbfe68a0b153825b0c75c8cb3f2dc5c1094.tar.gz qmmp-39556dbfe68a0b153825b0c75c8cb3f2dc5c1094.tar.bz2 qmmp-39556dbfe68a0b153825b0c75c8cb3f2dc5c1094.zip | |
some oss fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2325 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Output/oss/outputoss.cpp')
| -rw-r--r-- | src/plugins/Output/oss/outputoss.cpp | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/src/plugins/Output/oss/outputoss.cpp b/src/plugins/Output/oss/outputoss.cpp index 51031116a..4e0f9e1d1 100644 --- a/src/plugins/Output/oss/outputoss.cpp +++ b/src/plugins/Output/oss/outputoss.cpp @@ -111,40 +111,26 @@ bool OutputOSS::initialize(quint32 freq, int chan, Qmmp::AudioFormat format) qWarning("OutputOSS: unsupported audio format"); return false; } - int param = p; - if (ioctl(m_audio_fd, SNDCTL_DSP_SETFMT, &p) < 0) - { - qWarning("OutputOSS: ioctl SNDCTL_DSP_SETFMT failed: %s",strerror(errno)); - //return; - } - /*if(param != p) - { - qWarning("OutputOSS: unsupported audio format"); - return; - }*/ - param = chan; - if(ioctl(m_audio_fd, SNDCTL_DSP_CHANNELS, &chan) < 0) - { + + ioctl(m_audio_fd, SNDCTL_DSP_SYNC, 0); + + if(ioctl(m_audio_fd, SNDCTL_DSP_CHANNELS, &chan) == -1) qWarning("OutputOSS: ioctl SNDCTL_DSP_CHANNELS failed: %s", strerror(errno)); - return false; - } - if(param != chan) + + if(chan <= 2) { - qWarning("OutputOSS: unsupported %d-channel mode", param); - return false; + int param = chan - 1; + if(ioctl(m_audio_fd, SNDCTL_DSP_STEREO, ¶m) == -1) + qWarning("OutputOSS: ioctl SNDCTL_DSP_STEREO failed: %s", strerror(errno)); + chan = param + 1; } - uint param2 = freq; + + if (ioctl(m_audio_fd, SNDCTL_DSP_SETFMT, &p) == -1) + qWarning("OutputOSS: ioctl SNDCTL_DSP_SETFMT failed: %s",strerror(errno)); + if (ioctl(m_audio_fd, SNDCTL_DSP_SPEED, &freq) < 0) - { qWarning("OutputOSS: ioctl SNDCTL_DSP_SPEED failed: %s", strerror(errno)); - return false; - } - if(param2 != freq) - { - qWarning("OutputOSS: unsupported sample rate"); - return false; - } - ioctl(m_audio_fd, SNDCTL_DSP_RESET, 0); + configure(freq, chan, format); return true; } |
