wineoss.drv: Support platforms that do not feature AFMT_FLOAT.

Gerald Pfeifer gerald at pfeifer.com
Sat May 7 19:46:37 CDT 2011


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 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;



More information about the wine-patches mailing list