Stop wavemap lookup if a device isn't functional (spotted by Lionel
Ulmer).
This commit is contained in:
parent
cadffabd2d
commit
639db3ef8b
|
@ -185,8 +185,11 @@ static DWORD wodOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
/* try some ACM stuff */
|
/* try some ACM stuff */
|
||||||
|
|
||||||
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
|
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
|
||||||
if (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
|
switch (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
|
||||||
{wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
|
case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
|
||||||
|
case WAVERR_BADFORMAT: break; \
|
||||||
|
default: goto error; \
|
||||||
|
}
|
||||||
|
|
||||||
/* Our resampling algorithm is quite primitive so first try
|
/* Our resampling algorithm is quite primitive so first try
|
||||||
* to just change the bit depth and number of channels
|
* to just change the bit depth and number of channels
|
||||||
|
@ -248,6 +251,9 @@ found:
|
||||||
*lpdwUser = (DWORD)wom;
|
*lpdwUser = (DWORD)wom;
|
||||||
}
|
}
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
|
error:
|
||||||
|
HeapFree(GetProcessHeap(), 0, wom);
|
||||||
|
return MMSYSERR_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD wodClose(WAVEMAPDATA* wom)
|
static DWORD wodClose(WAVEMAPDATA* wom)
|
||||||
|
@ -627,8 +633,11 @@ static DWORD widOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
/* try some ACM stuff */
|
/* try some ACM stuff */
|
||||||
|
|
||||||
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
|
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
|
||||||
if (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
|
switch (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
|
||||||
{wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
|
case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
|
||||||
|
case WAVERR_BADFORMAT: break; \
|
||||||
|
default: goto error; \
|
||||||
|
}
|
||||||
|
|
||||||
for (i = ndlo; i < ndhi; i++) {
|
for (i = ndlo; i < ndhi; i++) {
|
||||||
wfx.nSamplesPerSec=lpDesc->lpFormat->nSamplesPerSec;
|
wfx.nSamplesPerSec=lpDesc->lpFormat->nSamplesPerSec;
|
||||||
|
@ -689,6 +698,9 @@ found:
|
||||||
}
|
}
|
||||||
TRACE("Ok (stream=%08lx)\n", (DWORD)wim->hAcmStream);
|
TRACE("Ok (stream=%08lx)\n", (DWORD)wim->hAcmStream);
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
|
error:
|
||||||
|
HeapFree(GetProcessHeap(), 0, wim);
|
||||||
|
return MMSYSERR_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD widClose(WAVEMAPDATA* wim)
|
static DWORD widClose(WAVEMAPDATA* wim)
|
||||||
|
|
|
@ -284,7 +284,7 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
|
||||||
*/
|
*/
|
||||||
if (rc != 0 && errno != EINVAL) {
|
if (rc != 0 && errno != EINVAL) {
|
||||||
ERR("ioctl(%s, SNDCTL_DSP_SETDUPLEX) failed (%s)\n", ossdev->dev_name, strerror(errno));
|
ERR("ioctl(%s, SNDCTL_DSP_SETDUPLEX) failed (%s)\n", ossdev->dev_name, strerror(errno));
|
||||||
goto error;
|
goto error2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
|
||||||
rc = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &ossdev->audio_fragment);
|
rc = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &ossdev->audio_fragment);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
ERR("ioctl(%s, SNDCTL_DSP_SETFRAGMENT) failed (%s)\n", ossdev->dev_name, strerror(errno));
|
ERR("ioctl(%s, SNDCTL_DSP_SETFRAGMENT) failed (%s)\n", ossdev->dev_name, strerror(errno));
|
||||||
goto error;
|
goto error2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +350,9 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
|
||||||
error:
|
error:
|
||||||
close(fd);
|
close(fd);
|
||||||
return WAVERR_BADFORMAT;
|
return WAVERR_BADFORMAT;
|
||||||
|
error2:
|
||||||
|
close(fd);
|
||||||
|
return MMSYSERR_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -1455,7 +1458,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
||||||
audio_buf_info info;
|
audio_buf_info info;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
|
TRACE("(%u, %p[cb=%08lx], %08lX);\n", wDevID, lpDesc, lpDesc->dwCallback, dwFlags);
|
||||||
if (lpDesc == NULL) {
|
if (lpDesc == NULL) {
|
||||||
WARN("Invalid Parameter !\n");
|
WARN("Invalid Parameter !\n");
|
||||||
return MMSYSERR_INVALPARAM;
|
return MMSYSERR_INVALPARAM;
|
||||||
|
|
Loading…
Reference in New Issue