On 05/07/2011 07:46 PM, Gerald Pfeifer wrote:
As we have seen from a related thread on wine-devel, FreeBSD's implementation of OSS is slightly, though not a lot, different from what current Linux distributions feature.
This patch addresses one such case, AFMT_FLOAT which does not exist on FreeBSD (yet?), and I'm sure other non-Linux systems.
I guess we can add this workaround. I don't know how far down this road we should be willing to go, though. I would consider the FreeBSD implementation broken: it deviates from the spec as stated by the authors. So this seems to be their bug, not ours. How far should we bend over backwards to accommodate their bug?
Anyways this is a tiny hassle, so I'm fine with it. Perhaps you should consider filing a FreeBSD bug?
Thanks Gerald.
Andrew
I created this diff with more context so that it becomes immediate that this patch is harmless in that AFMT_FLOAT is handled as an error case for system not providing it.
Gerald
dlls/wineoss.drv/mmdevdrv.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 789cb1e..254a119 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -504,25 +504,27 @@ static int get_oss_format(const WAVEFORMATEX *fmt) case 32: return AFMT_S32_LE; } return -1; }
if(fmt->wFormatTag == WAVE_FORMAT_IEEE_FLOAT || (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE&& IsEqualGUID(&fmtex->SubFormat,&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))){ if(fmt->wBitsPerSample != 32) return -1;
+#ifdef AFMT_FLOAT return AFMT_FLOAT; +#endif }
return -1;
}
static WAVEFORMATEX *clone_format(const WAVEFORMATEX *fmt) { WAVEFORMATEX *ret; size_t size;
if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) size = sizeof(WAVEFORMATEXTENSIBLE);
@@ -935,27 +937,29 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
if(This->dataflow == eRender) formats = This->ai.oformats; else if(This->dataflow == eCapture) formats = This->ai.iformats; else return E_UNEXPECTED; fmt->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; if(formats& AFMT_S16_LE){ fmt->Format.wBitsPerSample = 16; fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+#ifdef AFMT_FLOAT }else if(formats& AFMT_FLOAT){ fmt->Format.wBitsPerSample = 32; fmt->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; +#endif }else if(formats& AFMT_U8){ fmt->Format.wBitsPerSample = 8; fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; }else if(formats& AFMT_S32_LE){ fmt->Format.wBitsPerSample = 32; fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; }else if(formats& AFMT_S24_LE){ fmt->Format.wBitsPerSample = 24; fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; }else{ ERR("Didn't recognize any available OSS formats: %x\n", formats); return E_FAIL;
On Mon, 9 May 2011, Andrew Eikum wrote:
Anyways this is a tiny hassle, so I'm fine with it. Perhaps you should consider filing a FreeBSD bug?
Sure thing, Andrew! That's sounds like a good idea (no pun intended :-).
http://www.freebsd.org/cgi/query-pr.cgi?pr=157050
Gerald