19#include <freerdp/config.h> 
   22#include <winpr/assert.h> 
   23#include <winpr/cast.h> 
   25#include <freerdp/log.h> 
   26#include <freerdp/codec/dsp.h> 
   27#include <freerdp/server/server-common.h> 
   31#include "shadow_rdpsnd.h" 
   33#define TAG SERVER_TAG("shadow") 
   35static void rdpsnd_activated(RdpsndServerContext* context)
 
   37  for (
size_t i = 0; i < context->num_client_formats; i++)
 
   39    for (
size_t j = 0; j < context->num_server_formats; j++)
 
   41      if (audio_format_compatible(&context->server_formats[j], &context->client_formats[i]))
 
   43        context->SelectFormat(context, WINPR_ASSERTING_INT_CAST(UINT16, i));
 
   49  WLog_ERR(TAG, 
"Could not agree on a audio format with the server\n");
 
   52int shadow_client_rdpsnd_init(rdpShadowClient* client)
 
   54  RdpsndServerContext* rdpsnd = NULL;
 
   55  rdpsnd = client->rdpsnd = rdpsnd_server_context_new(client->vcm);
 
   62  rdpsnd->data = client;
 
   64  if (client->subsystem->rdpsndFormats)
 
   66    rdpsnd->server_formats = client->subsystem->rdpsndFormats;
 
   67    rdpsnd->num_server_formats = client->subsystem->nRdpsndFormats;
 
   71    rdpsnd->num_server_formats = server_rdpsnd_get_formats(&rdpsnd->server_formats);
 
   74  if (rdpsnd->num_server_formats > 0)
 
   75    rdpsnd->src_format = &rdpsnd->server_formats[0];
 
   77  rdpsnd->Activated = rdpsnd_activated;
 
   78  rdpsnd->Initialize(rdpsnd, TRUE);
 
   82void shadow_client_rdpsnd_uninit(rdpShadowClient* client)
 
   86    client->rdpsnd->Stop(client->rdpsnd);
 
   87    rdpsnd_server_context_free(client->rdpsnd);
 
   88    client->rdpsnd = NULL;