21#include <freerdp/config.h>
23#include <freerdp/log.h>
26#include "shadow_encomsp.h"
28#define TAG SERVER_TAG("shadow")
37encomsp_change_participant_control_level(EncomspServerContext* context,
43 rdpShadowClient* client = (rdpShadowClient*)context->custom;
46 "ChangeParticipantControlLevel: ParticipantId: %" PRIu32
" Flags: 0x%04" PRIX16
"",
47 pdu->ParticipantId, pdu->Flags);
49 mayView = (pdu->Flags & ENCOMSP_MAY_VIEW) != 0;
50 mayInteract = (pdu->Flags & ENCOMSP_MAY_INTERACT) != 0;
52 if (mayInteract && !mayView)
57 if (!client->mayInteract)
60 client->mayInteract = TRUE;
61 client->mayView = TRUE;
66 if (client->mayInteract)
69 client->mayInteract = FALSE;
71 else if (!client->mayView)
74 client->mayView = TRUE;
79 if (client->mayInteract)
82 client->mayView = FALSE;
83 client->mayInteract = FALSE;
85 else if (client->mayView)
88 client->mayView = FALSE;
89 client->mayInteract = FALSE;
93 inLobby = !(client->mayView);
95 if (inLobby != client->inLobby)
97 if (shadow_encoder_reset(client->encoder) < 0)
98 return ERROR_NOT_READY;
99 client->inLobby = inLobby;
102 return CHANNEL_RC_OK;
105int shadow_client_encomsp_init(rdpShadowClient* client)
107 WINPR_ASSERT(client);
109 EncomspServerContext* encomsp = client->encomsp = encomsp_server_context_new(client->vcm);
113 encomsp->rdpcontext = &client->context;
115 encomsp->custom = (
void*)client;
117 encomsp->ChangeParticipantControlLevel = encomsp_change_participant_control_level;
121 const UINT rc = client->encomsp->Start(client->encomsp);
122 if (rc != CHANNEL_RC_OK)
129void shadow_client_encomsp_uninit(rdpShadowClient* client)
131 WINPR_ASSERT(client);
134 client->encomsp->Stop(client->encomsp);
135 encomsp_server_context_free(client->encomsp);
136 client->encomsp =
nullptr;