19 #include <freerdp/config.h>
21 #include <winpr/crt.h>
22 #include <freerdp/log.h>
23 #include <freerdp/codec/dsp.h>
24 #include <freerdp/server/server-common.h>
28 #include "shadow_rdpsnd.h"
30 #define TAG SERVER_TAG("shadow")
32 static void rdpsnd_activated(RdpsndServerContext* context)
34 for (
size_t i = 0; i < context->num_client_formats; i++)
36 for (
size_t j = 0; j < context->num_server_formats; j++)
38 if (audio_format_compatible(&context->server_formats[j], &context->client_formats[i]))
40 context->SelectFormat(context, i);
46 WLog_ERR(TAG,
"Could not agree on a audio format with the server\n");
49 int shadow_client_rdpsnd_init(rdpShadowClient* client)
51 RdpsndServerContext* rdpsnd = NULL;
52 rdpsnd = client->rdpsnd = rdpsnd_server_context_new(client->vcm);
59 rdpsnd->data = client;
61 if (client->subsystem->rdpsndFormats)
63 rdpsnd->server_formats = client->subsystem->rdpsndFormats;
64 rdpsnd->num_server_formats = client->subsystem->nRdpsndFormats;
68 rdpsnd->num_server_formats = server_rdpsnd_get_formats(&rdpsnd->server_formats);
71 if (rdpsnd->num_server_formats > 0)
72 rdpsnd->src_format = &rdpsnd->server_formats[0];
74 rdpsnd->Activated = rdpsnd_activated;
75 rdpsnd->Initialize(rdpsnd, TRUE);
79 void shadow_client_rdpsnd_uninit(rdpShadowClient* client)
83 client->rdpsnd->Stop(client->rdpsnd);
84 rdpsnd_server_context_free(client->rdpsnd);
85 client->rdpsnd = NULL;