20 #include <freerdp/config.h>
22 #include <freerdp/log.h>
25 #include "shadow_audin.h"
26 #include <freerdp/server/server-common.h>
28 #if defined(CHANNEL_AUDIN_SERVER)
29 #include <freerdp/server/audin.h>
32 #if defined(CHANNEL_AUDIN_SERVER)
34 static UINT AudinServerData(audin_server_context* audin,
const SNDIN_DATA* data)
36 rdpShadowClient* client = NULL;
37 rdpShadowSubsystem* subsystem = NULL;
42 client = audin->userdata;
44 WINPR_ASSERT(client->server);
45 subsystem = client->server->subsystem;
46 WINPR_ASSERT(subsystem);
48 if (!client->mayInteract)
51 if (!IFCALLRESULT(TRUE, subsystem->AudinServerReceiveSamples, subsystem, client,
52 audin_server_get_negotiated_format(client->audin), data->Data))
53 return ERROR_INTERNAL_ERROR;
60 BOOL shadow_client_audin_init(rdpShadowClient* client)
64 #if defined(CHANNEL_AUDIN_SERVER)
65 audin_server_context* audin = client->audin = audin_server_context_new(client->vcm);
70 audin->userdata = client;
72 audin->Data = AudinServerData;
74 if (client->subsystem->audinFormats)
76 if (client->subsystem->nAudinFormats > SSIZE_MAX)
79 if (!audin_server_set_formats(client->audin, (SSIZE_T)client->subsystem->nAudinFormats,
80 client->subsystem->audinFormats))
85 if (!audin_server_set_formats(client->audin, -1, NULL))
91 audin_server_context_free(audin);
97 void shadow_client_audin_uninit(rdpShadowClient* client)
101 #if defined(CHANNEL_AUDIN_SERVER)
102 audin_server_context_free(client->audin);
103 client->audin = NULL;