[channels,rdpsnd] Add PlayEx callback

This new callback is preferred over the older Play callback and provides
the AUDIO_FORMAT as additional argument.
This commit is contained in:
akallabeth 2022-12-13 15:11:49 +01:00 committed by Martin Fleisz
parent 8aa880c0ba
commit 4ab9fb4425
2 changed files with 16 additions and 3 deletions

View File

@ -630,12 +630,22 @@ static UINT rdpsnd_treat_wave(rdpsndPlugin* rdpsnd, wStream* s, size_t size)
wStream* pcmData = StreamPool_Take(rdpsnd->pool, 4096);
if (rdpsnd->device->FormatSupported(rdpsnd->device, format))
{
if (rdpsnd->device->PlayEx)
latency = rdpsnd->device->PlayEx(rdpsnd->device, format, data, size);
else
latency = IFCALLRESULT(0, rdpsnd->device->Play, rdpsnd->device, data, size);
}
else if (freerdp_dsp_decode(rdpsnd->dsp_context, format, data, size, pcmData))
{
Stream_SealLength(pcmData);
latency = IFCALLRESULT(0, rdpsnd->device->Play, rdpsnd->device, Stream_Buffer(pcmData),
if (rdpsnd->device->PlayEx)
latency = rdpsnd->device->PlayEx(rdpsnd->device, format, Stream_Buffer(pcmData),
Stream_Length(pcmData));
else
latency = IFCALLRESULT(0, rdpsnd->device->Play, rdpsnd->device,
Stream_Buffer(pcmData), Stream_Length(pcmData));
}
else
status = ERROR_INTERNAL_ERROR;

View File

@ -39,6 +39,8 @@ extern "C"
typedef UINT32 (*pcGetVolume)(rdpsndDevicePlugin* device);
typedef BOOL (*pcSetVolume)(rdpsndDevicePlugin* device, UINT32 value);
typedef UINT (*pcPlay)(rdpsndDevicePlugin* device, const BYTE* data, size_t size);
typedef UINT (*pcPlayEx)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format,
const BYTE* data, size_t size);
typedef void (*pcStart)(rdpsndDevicePlugin* device);
typedef void (*pcClose)(rdpsndDevicePlugin* device);
typedef void (*pcFree)(rdpsndDevicePlugin* device);
@ -61,6 +63,7 @@ extern "C"
pcFree Free;
pcDefaultFormat DefaultFormat;
pcServerFormatAnnounce ServerFormatAnnounce;
pcPlayEx PlayEx;
};
#define RDPSND_DEVICE_EXPORT_FUNC_NAME "freerdp_rdpsnd_client_subsystem_entry"