diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c index 21c293a380..0344c7410e 100644 --- a/libao2/ao_dsound.c +++ b/libao2/ao_dsound.c @@ -364,6 +364,17 @@ static int init(int rate, int channels, int format, int flags) DSBUFFERDESC dsbpridesc; DSBUFFERDESC dsbdesc; + //check if the format is supported in general + switch(format){ + case AFMT_AC3: + case AFMT_S24_LE: + case AFMT_S16_LE: + case AFMT_S8: + break; + default: + mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); + format=AFMT_S16_LE; + } //fill global ao_data ao_data.channels = channels; ao_data.samplerate = rate; diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c index 698e2d727b..ba004c7b26 100644 --- a/libao2/ao_win32.c +++ b/libao2/ao_win32.c @@ -148,6 +148,16 @@ static int init(int rate,int channels,int format,int flags) unsigned char* buffer; int i; + switch(format){ + case AFMT_AC3: + case AFMT_S24_LE: + case AFMT_S16_LE: + case AFMT_S8: + break; + default: + mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); + format=AFMT_S16_LE; + } //fill global ao_data ao_data.channels=channels; ao_data.samplerate=rate;