mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 18:03:30 +08:00
[channels,rdpsnd] Callback on server format
When the server sends the format list to the client call a device callback that provides the details to the audio backend.
This commit is contained in:
parent
a1febe11f0
commit
8aa880c0ba
@ -180,6 +180,7 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
|
||||
if (!audio_format_compatible(rdpsnd->fixed_format, serverFormat))
|
||||
continue;
|
||||
|
||||
WINPR_ASSERT(rdpsnd->device->FormatSupported);
|
||||
if (freerdp_dsp_supports_format(serverFormat, FALSE) ||
|
||||
rdpsnd->device->FormatSupported(rdpsnd->device, serverFormat))
|
||||
{
|
||||
@ -282,19 +283,26 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, 14ull * wNumberOfFormats))
|
||||
return ERROR_BAD_LENGTH;
|
||||
|
||||
rdpsnd->ServerFormats = audio_formats_new(wNumberOfFormats);
|
||||
|
||||
if (!rdpsnd->ServerFormats)
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
|
||||
for (index = 0; index < wNumberOfFormats; index++)
|
||||
if (rdpsnd->NumberOfServerFormats > 0)
|
||||
{
|
||||
AUDIO_FORMAT* format = &rdpsnd->ServerFormats[index];
|
||||
rdpsnd->ServerFormats = audio_formats_new(wNumberOfFormats);
|
||||
|
||||
if (!audio_format_read(s, format))
|
||||
goto out_fail;
|
||||
if (!rdpsnd->ServerFormats)
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
|
||||
for (index = 0; index < wNumberOfFormats; index++)
|
||||
{
|
||||
AUDIO_FORMAT* format = &rdpsnd->ServerFormats[index];
|
||||
|
||||
if (!audio_format_read(s, format))
|
||||
goto out_fail;
|
||||
}
|
||||
}
|
||||
|
||||
WINPR_ASSERT(rdpsnd->device);
|
||||
ret = IFCALLRESULT(CHANNEL_RC_OK, rdpsnd->device->ServerFormatAnnounce, rdpsnd->device,
|
||||
rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
|
||||
|
||||
rdpsnd_select_supported_audio_formats(rdpsnd);
|
||||
WLog_Print(rdpsnd->log, WLOG_DEBUG, "%s Server Audio Formats",
|
||||
rdpsnd_is_dyn_str(rdpsnd->dynamic));
|
||||
|
@ -44,6 +44,8 @@ extern "C"
|
||||
typedef void (*pcFree)(rdpsndDevicePlugin* device);
|
||||
typedef BOOL (*pcDefaultFormat)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* desired,
|
||||
AUDIO_FORMAT* defaultFormat);
|
||||
typedef UINT (*pcServerFormatAnnounce)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* formats,
|
||||
size_t count);
|
||||
|
||||
struct rdpsnd_device_plugin
|
||||
{
|
||||
@ -58,6 +60,7 @@ extern "C"
|
||||
pcClose Close;
|
||||
pcFree Free;
|
||||
pcDefaultFormat DefaultFormat;
|
||||
pcServerFormatAnnounce ServerFormatAnnounce;
|
||||
};
|
||||
|
||||
#define RDPSND_DEVICE_EXPORT_FUNC_NAME "freerdp_rdpsnd_client_subsystem_entry"
|
||||
|
Loading…
Reference in New Issue
Block a user