diff options
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; } |
