<html><head></head><body>So what? Some cards don't support PCM at all, or only some really weird formats. That's why we use the OS-provided HAL.<br><br>I don't think this belongs in VLC. We already decided to drop 24-bits PCM earlier.<br><br><div class="gmail_quote">Le 24 octobre 2019 15:37:12 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">But don't use VLC_CODEC_S24N as this fourcc is not handled by any audio<br>filters. Instead, request VLC_CODEC_S32N to VLC and do the conversion<br>internally.<br><br>This commit is needed by the next commit since some sound cards only support<br>24bits.<hr> modules/audio_output/wasapi.c | 30 +++++++++++++++++++++++++++---<br> 1 file changed, 27 insertions(+), 3 deletions(-)<br><br>diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c<br>index d6105169b8e..daa946f8afc 100644<br>--- a/modules/audio_output/wasapi.c<br>+++ b/modules/audio_output/wasapi.c<br>@@ -106,6 +106,7 @@ typedef struct aout_stream_sys<br> unsigned block_align;<br> UINT64 written; /**< Frames written to the buffer */<br> UINT32 frames; /**< Total buffer size (frames) */<br>+ bool s24s32; /**< Output configured as S24N, but input as S32N */<br> } aout_stream_sys_t;<br> <br> static void ResetTimer(aout_stream_t *s)<br>@@ -268,7 +269,28 @@ static HRESULT Play(aout_stream_t *s, block_t *block, vlc_tick_t date)<br> <br> const size_t copy = frames * sys->block_align;<br> <br>- memcpy(dst, block->p_buffer, copy);<br>+ if (!sys->s24s32)<br>+ {<br>+ memcpy(dst, block->p_buffer, copy);<br>+ block->p_buffer += copy;<br>+ block->i_buffer -= copy;<br>+ }<br>+ else<br>+ {<br>+ /* Convert back S32L to S24L. The following is doing the opposite<br>+ * of S24LDecode() from codec/araw.c */<br>+ BYTE *end = dst + copy;<br>+ while (dst < end)<br>+ {<br>+ dst[0] = block->p_buffer[1];<br>+ dst[1] = block->p_buffer[2];<br>+ dst[2] = block->p_buffer[3];<br>+ dst += 3;<br>+ block->p_buffer += 4;<br>+ block->i_buffer -= 4;<br>+ }<br>+<br>+ }<br> hr = IAudioRenderClient_ReleaseBuffer(render, frames, 0);<br> if (FAILED(hr))<br> {<br>@@ -276,8 +298,6 @@ static HRESULT Play(aout_stream_t *s, block_t *block, vlc_tick_t date)<br> break;<br> }<br> <br>- block->p_buffer += copy;<br>- block->i_buffer -= copy;<br> block->i_nb_samples -= frames;<br> sys->written += frames;<br> if (block->i_nb_samples == 0)<br>@@ -512,6 +532,7 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,<br> switch (wf->wBitsPerSample)<br> {<br> case 32:<br>+ case 24:<br> audio->i_format = VLC_CODEC_S32N;<br> break;<br> case 16:<br>@@ -679,6 +700,9 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,<br> sys->format = fmt.i_format;<br> sys->block_align = pwf->nBlockAlign;<br> sys->rate = pwf->nSamplesPerSec;<br>+ sys->s24s32 = pwf->wBitsPerSample == 24 && fmt.i_format == VLC_CODEC_S32N;<br>+ if (sys->s24s32)<br>+ msg_Dbg(s, "audio device configured as s24");<br> <br> hr = IAudioClient_Initialize(sys->client, shared_mode, 0, buffer_duration,<br> 0, pwf, sid);</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>