| 1 | /** |
| 2 | * FreeRDP: A Remote Desktop Protocol Implementation |
| 3 | * Audio Input Redirection Virtual Channel |
| 4 | * |
| 5 | * Copyright 2010-2011 Vic Lee |
| 6 | * Copyright 2015 Thincast Technologies GmbH |
| 7 | * Copyright 2015 DI (FH) Martin Haimberger <[email protected]> |
| 8 | * Copyright 2015 Armin Novak <[email protected]> |
| 9 | * |
| 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | * you may not use this file except in compliance with the License. |
| 12 | * You may obtain a copy of the License at |
| 13 | * |
| 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | * |
| 16 | * Unless required by applicable law or agreed to in writing, software |
| 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | * See the License for the specific language governing permissions and |
| 20 | * limitations under the License. |
| 21 | */ |
| 22 | |
| 23 | #include <freerdp/config.h>cxx . . $ `<file>/build/include/freerdp/config.h`/ |
| 24 | |
| 25 | #include <errno.h> |
| 26 | #include <winpr/assert.h>cxx . . $ `<file>/winpr/include/winpr/assert.h`/ |
| 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | |
| 31 | #include <winpr/crt.h>cxx . . $ `<file>/winpr/include/winpr/crt.h`/ |
| 32 | #include <winpr/cmdline.h>cxx . . $ `<file>/winpr/include/winpr/cmdline.h`/ |
| 33 | #include <winpr/wlog.h>cxx . . $ `<file>/winpr/include/winpr/wlog.h`/ |
| 34 | |
| 35 | #include <freerdp/addin.h>cxx . . $ `<file>/include/freerdp/addin.h`/ |
| 36 | |
| 37 | #include <winpr/stream.h>cxx . . $ `<file>/winpr/include/winpr/stream.h`/ |
| 38 | #include <freerdp/freerdp.h>cxx . . $ `<file>/include/freerdp/freerdp.h`/ |
| 39 | #include <freerdp/codec/dsp.h>cxx . . $ `<file>/include/freerdp/codec/dsp.h`/ |
| 40 | #include <freerdp/client/channels.h>cxx . . $ `<file>/include/freerdp/client/channels.h`/ |
| 41 | #include <freerdp/channels/audin.h>cxx . . $ `<file>/include/freerdp/channels/audin.h`/ |
| 42 | |
| 43 | #include "audin_main.h"cxx . . $ `<file>/channels/audin/client/audin_main.h`/ |
| 44 | |
| 45 | #define SNDIN_VERSIONcxx . . $ `channels/audin/client/audin_main.c:45:9`! 0x02 |
| 46 | |
| 47 | typedef enumcxx . . $ $anonymous_type_dad3bc0f619f42c7_0# |
| 48 | { |
| 49 | MSG_SNDIN_VERSIONcxx . . $ MSG_SNDIN_VERSION. = 0x01, |
| 50 | MSG_SNDIN_FORMATScxx . . $ MSG_SNDIN_FORMATS. = 0x02, |
| 51 | MSG_SNDIN_OPENcxx . . $ MSG_SNDIN_OPEN. = 0x03, |
| 52 | MSG_SNDIN_OPEN_REPLYcxx . . $ MSG_SNDIN_OPEN_REPLY. = 0x04, |
| 53 | MSG_SNDIN_DATA_INCOMINGcxx . . $ MSG_SNDIN_DATA_INCOMING. = 0x05, |
| 54 | MSG_SNDIN_DATAcxx . . $ MSG_SNDIN_DATA. = 0x06, |
| 55 | MSG_SNDIN_FORMATCHANGEcxx . . $ MSG_SNDIN_FORMATCHANGE. = 0x07, |
| 56 | } MSG_SNDINcxx . . $ MSG_SNDIN#; |
| 57 | |
| 58 | typedef structcxx . . $ $anonymous_type_dad3bc0f619f42c7_1# |
| 59 | { |
| 60 | IWTSVirtualChannelCallbackcxx . . $ IWTSVirtualChannelCallback# ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_1#iface.; |
| 61 | |
| 62 | IWTSPlugincxx . . $ IWTSPlugin#* plugincxx . . $ $anonymous_type_dad3bc0f619f42c7_1#plugin.; |
| 63 | IWTSVirtualChannelManagercxx . . $ IWTSVirtualChannelManager#* channel_mgrcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel_mgr.; |
| 64 | IWTSVirtualChannelcxx . . $ IWTSVirtualChannel#* channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel.; |
| 65 | |
| 66 | /** |
| 67 | * The supported format list sent back to the server, which needs to |
| 68 | * be stored as reference when the server sends the format index in |
| 69 | * Open PDU and Format Change PDU |
| 70 | */ |
| 71 | AUDIO_FORMATcxx . . $ AUDIO_FORMAT#* formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats.; |
| 72 | UINT32cxx . . $ UINT32# formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.; |
| 73 | } AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#; |
| 74 | |
| 75 | typedef structcxx . . $ $anonymous_type_dad3bc0f619f42c7_2# |
| 76 | { |
| 77 | IWTSPlugincxx . . $ IWTSPlugin# ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface.; |
| 78 | |
| 79 | GENERIC_LISTENER_CALLBACKcxx . . $ GENERIC_LISTENER_CALLBACK#* listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.; |
| 80 | |
| 81 | /* Parsed plugin data */ |
| 82 | AUDIO_FORMATcxx . . $ AUDIO_FORMAT#* fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format.; |
| 83 | char* subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem.; |
| 84 | char* device_namecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device_name.; |
| 85 | |
| 86 | /* Device interface */ |
| 87 | IAudinDevicecxx . . $ IAudinDevice#* devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.; |
| 88 | |
| 89 | rdpContextcxx . . $ rdpContext#* rdpcontextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#rdpcontext.; |
| 90 | BOOLcxx . . $ BOOL# attachedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#attached.; |
| 91 | wStreamcxx . . $ wStream#* datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data.; |
| 92 | AUDIO_FORMATcxx . . $ AUDIO_FORMAT#* formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.; |
| 93 | UINT32cxx . . $ UINT32# FramesPerPacketcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#FramesPerPacket.; |
| 94 | |
| 95 | FREERDP_DSP_CONTEXTcxx . . $ FREERDP_DSP_CONTEXT#* dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context.; |
| 96 | wLogcxx . . $ wLog#* logcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#log.; |
| 97 | |
| 98 | IWTSListenercxx . . $ IWTSListener#* listenercxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener.; |
| 99 | |
| 100 | BOOLcxx . . $ BOOL# initializedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#initialized.; |
| 101 | UINT32cxx . . $ UINT32# versioncxx . . $ $anonymous_type_dad3bc0f619f42c7_2#version.; |
| 102 | } AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#; |
| 103 | |
| 104 | static BOOLcxx . . $ BOOL# audin_process_addin_argscxx . . $ audin_process_addin_args(8718c804439721d6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, const ADDIN_ARGVcxx . . $ ADDIN_ARGV#* args); |
| 105 | |
| 106 | static UINTcxx . . $ UINT# audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, wStreamcxx . . $ wStream#* out, |
| 107 | BOOLcxx . . $ BOOL# freeStream) |
| 108 | { |
| 109 | if (!callback || !out) |
| 110 | return ERROR_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/error.h:252:9`!; |
| 111 | |
| 112 | if (!callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel. || !callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel.->Writecxx . . $ s_IWTSVirtualChannel#Write.) |
| 113 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 114 | |
| 115 | Stream_SealLengthcxx . . $ Stream_SealLength(141d0e356bb21ff3).(out); |
| 116 | |
| 117 | const ULONGcxx . . $ ULONG# len = WINPR_ASSERTING_INT_CASTcxx . . $ `winpr/include/winpr/cast.h:111:9`!(ULONG, Stream_Length(out)); |
| 118 | const UINTcxx . . $ UINT# error = |
| 119 | callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel.->Writecxx . . $ s_IWTSVirtualChannel#Write.(callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel., len, Stream_Buffercxx . . $ Stream_Buffer(38abee8bfc36c01e).(out), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!); |
| 120 | |
| 121 | if (freeStream) |
| 122 | Stream_Freecxx . . $ Stream_Free(31813de2214206e2).(out, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 123 | |
| 124 | return error; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Function description |
| 129 | * |
| 130 | * @return 0 on success, otherwise a Win32 error code |
| 131 | */ |
| 132 | static UINTcxx . . $ UINT# audin_process_versioncxx . . $ audin_process_version(d058d81a7488abf6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, wStreamcxx . . $ wStream#* s) |
| 133 | { |
| 134 | const UINT32cxx . . $ UINT32# ClientVersion = SNDIN_VERSIONcxx . . $ `channels/audin/client/audin_main.c:45:9`!; |
| 135 | UINT32cxx . . $ UINT32# ServerVersion = 0; |
| 136 | |
| 137 | if (!Stream_CheckAndLogRequiredLengthcxx . . $ `winpr/include/winpr/stream.h:127:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, s, 4)) |
| 138 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 139 | |
| 140 | Stream_Read_UINT32cxx . . $ `winpr/include/winpr/stream.h:683:9`!(s, ServerVersion); |
| 141 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "ServerVersion=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! ", ClientVersion=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`!, |
| 142 | ServerVersion, ClientVersion); |
| 143 | |
| 144 | /* Do not answer server packet, we do not support the channel version. */ |
| 145 | if (ServerVersion > ClientVersion) |
| 146 | { |
| 147 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_WARN, |
| 148 | "Incompatible channel version server=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! |
| 149 | ", client supports version=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`!, |
| 150 | ServerVersion, ClientVersion); |
| 151 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 152 | } |
| 153 | audin->versioncxx . . $ $anonymous_type_dad3bc0f619f42c7_2#version. = ServerVersion; |
| 154 | |
| 155 | wStreamcxx . . $ wStream#* out = Stream_Newcxx . . $ Stream_New(af7e1125a927123a).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 5); |
| 156 | |
| 157 | if (!out) |
| 158 | { |
| 159 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Stream_New failed!"); |
| 160 | return ERROR_OUTOFMEMORYcxx . . $ `winpr/include/winpr/error.h:199:9`!; |
| 161 | } |
| 162 | |
| 163 | Stream_Write_UINT8cxx . . $ `winpr/include/winpr/stream.h:857:9`!(out, MSG_SNDIN_VERSION); |
| 164 | Stream_Write_UINT32cxx . . $ `winpr/include/winpr/stream.h:1070:9`!(out, ClientVersion); |
| 165 | return audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(callback, out, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Function description |
| 170 | * |
| 171 | * @return 0 on success, otherwise a Win32 error code |
| 172 | */ |
| 173 | static UINTcxx . . $ UINT# audin_send_incoming_data_pducxx . . $ audin_send_incoming_data_pdu(a09fa0152219c853).(AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback) |
| 174 | { |
| 175 | BYTEcxx . . $ BYTE# out_data[1] = { MSG_SNDIN_DATA_INCOMINGcxx . . $ MSG_SNDIN_DATA_INCOMING. }; |
| 176 | |
| 177 | if (!callback || !callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel. || !callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel.->Writecxx . . $ s_IWTSVirtualChannel#Write.) |
| 178 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 179 | |
| 180 | return callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel.->Writecxx . . $ s_IWTSVirtualChannel#Write.(callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel., 1, out_data, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Function description |
| 185 | * |
| 186 | * @return 0 on success, otherwise a Win32 error code |
| 187 | */ |
| 188 | static UINTcxx . . $ UINT# audin_process_formatscxx . . $ audin_process_formats(d058d81a7488abf6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, wStreamcxx . . $ wStream#* s) |
| 189 | { |
| 190 | UINTcxx . . $ UINT# error = ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 191 | UINT32cxx . . $ UINT32# NumFormats = 0; |
| 192 | UINT32cxx . . $ UINT32# cbSizeFormatsPacket = 0; |
| 193 | |
| 194 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 195 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(callback); |
| 196 | |
| 197 | if (!Stream_CheckAndLogRequiredLengthcxx . . $ `winpr/include/winpr/stream.h:127:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, s, 8)) |
| 198 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 199 | |
| 200 | Stream_Read_UINT32cxx . . $ `winpr/include/winpr/stream.h:683:9`!(s, NumFormats); |
| 201 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "NumFormats %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", NumFormats); |
| 202 | |
| 203 | if ((NumFormats < 1) || (NumFormats > 1000)) |
| 204 | { |
| 205 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "bad NumFormats %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", NumFormats); |
| 206 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 207 | } |
| 208 | |
| 209 | Stream_Seek_UINT32cxx . . $ Stream_Seek_UINT32(141d0e356bb21ff3).(s); /* cbSizeFormatsPacket */ |
| 210 | |
| 211 | audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 212 | audio_formats_freecxx . . $ audio_formats_free(675a8d52ad36a196).(callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats., callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.); |
| 213 | callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count. = 0; |
| 214 | |
| 215 | callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats. = audio_formats_newcxx . . $ audio_formats_new(4773944cfa970936).(NumFormats); |
| 216 | |
| 217 | if (!callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats.) |
| 218 | { |
| 219 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "calloc failed!"); |
| 220 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 221 | } |
| 222 | |
| 223 | wStreamcxx . . $ wStream#* out = Stream_Newcxx . . $ Stream_New(af7e1125a927123a).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 9); |
| 224 | |
| 225 | if (!out) |
| 226 | { |
| 227 | error = CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 228 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Stream_New failed!"); |
| 229 | goto out; |
| 230 | } |
| 231 | |
| 232 | Stream_Seekcxx . . $ Stream_Seek(e1fedc387646b1c9).(out, 9); |
| 233 | |
| 234 | /* SoundFormats (variable) */ |
| 235 | for (UINT32cxx . . $ UINT32# i = 0; i < NumFormats; i++) |
| 236 | { |
| 237 | AUDIO_FORMATcxx . . $ AUDIO_FORMAT# format = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!; |
| 238 | |
| 239 | if (!audio_format_readcxx . . $ audio_format_read(4b2fa3f63d2d6add).(s, &format)) |
| 240 | { |
| 241 | error = ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 242 | goto out; |
| 243 | } |
| 244 | |
| 245 | audio_format_printcxx . . $ audio_format_print(754254553bdbfe27).(audin->logcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#log., WLOG_DEBUGcxx . . $ WLOG_DEBUG., &format); |
| 246 | |
| 247 | if (!audio_format_compatiblecxx . . $ audio_format_compatible(dbc5ef6307e36589).(audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format., &format)) |
| 248 | { |
| 249 | audio_format_freecxx . . $ audio_format_free(cb178f2ce807c768).(&format); |
| 250 | continue; |
| 251 | } |
| 252 | |
| 253 | if (freerdp_dsp_supports_formatcxx . . $ freerdp_dsp_supports_format(bd0981799771a3d7).(&format, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!) || |
| 254 | audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.->FormatSupportedcxx . . $ s_IAudinDevice#FormatSupported.(audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device., &format)) |
| 255 | { |
| 256 | /* Store the agreed format in the corresponding index */ |
| 257 | callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats.[callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.++] = format; |
| 258 | |
| 259 | if (!audio_format_writecxx . . $ audio_format_write(75f6c1c8d498598c).(out, &format)) |
| 260 | { |
| 261 | error = CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 262 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Stream_EnsureRemainingCapacity failed!"); |
| 263 | goto out; |
| 264 | } |
| 265 | } |
| 266 | else |
| 267 | { |
| 268 | audio_format_freecxx . . $ audio_format_free(cb178f2ce807c768).(&format); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | if ((error = audin_send_incoming_data_pducxx . . $ audin_send_incoming_data_pdu(a09fa0152219c853).(callback))) |
| 273 | { |
| 274 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "audin_send_incoming_data_pdu failed!"); |
| 275 | goto out; |
| 276 | } |
| 277 | |
| 278 | cbSizeFormatsPacket = (UINT32cxx . . $ UINT32#)Stream_GetPositioncxx . . $ Stream_GetPosition(ebc7f695a8644dc0).(out); |
| 279 | Stream_ResetPositioncxx . . $ Stream_ResetPosition(141d0e356bb21ff3).(out); |
| 280 | Stream_Write_UINT8cxx . . $ `winpr/include/winpr/stream.h:857:9`!(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */ |
| 281 | Stream_Write_UINT32cxx . . $ `winpr/include/winpr/stream.h:1070:9`!(out, callback->formats_count); /* NumFormats (4 bytes) */ |
| 282 | Stream_Write_UINT32cxx . . $ `winpr/include/winpr/stream.h:1070:9`!(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */ |
| 283 | if (!Stream_SetPositioncxx . . $ Stream_SetPosition(db6c6e3e90d014c4).(out, cbSizeFormatsPacket)) |
| 284 | goto out; |
| 285 | error = audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(callback, out, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!); |
| 286 | out: |
| 287 | |
| 288 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 289 | { |
| 290 | audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 291 | audio_formats_freecxx . . $ audio_formats_free(675a8d52ad36a196).(callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats., NumFormats); |
| 292 | callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 293 | } |
| 294 | |
| 295 | Stream_Freecxx . . $ Stream_Free(31813de2214206e2).(out, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 296 | return error; |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * Function description |
| 301 | * |
| 302 | * @return 0 on success, otherwise a Win32 error code |
| 303 | */ |
| 304 | static UINTcxx . . $ UINT# audin_send_format_change_pducxx . . $ audin_send_format_change_pdu(9682e9f688a1730c).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, |
| 305 | UINT32cxx . . $ UINT32# NewFormat) |
| 306 | { |
| 307 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 308 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(callback); |
| 309 | |
| 310 | wStreamcxx . . $ wStream#* out = Stream_Newcxx . . $ Stream_New(af7e1125a927123a).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 5); |
| 311 | |
| 312 | if (!out) |
| 313 | { |
| 314 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Stream_New failed!"); |
| 315 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 316 | } |
| 317 | |
| 318 | Stream_Write_UINT8cxx . . $ `winpr/include/winpr/stream.h:857:9`!(out, MSG_SNDIN_FORMATCHANGE); |
| 319 | Stream_Write_UINT32cxx . . $ `winpr/include/winpr/stream.h:1070:9`!(out, NewFormat); |
| 320 | return audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(callback, out, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * Function description |
| 325 | * |
| 326 | * @return 0 on success, otherwise a Win32 error code |
| 327 | */ |
| 328 | static UINTcxx . . $ UINT# audin_send_open_reply_pducxx . . $ audin_send_open_reply_pdu(9682e9f688a1730c).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, |
| 329 | UINT32cxx . . $ UINT32# Result) |
| 330 | { |
| 331 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 332 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(callback); |
| 333 | |
| 334 | wStreamcxx . . $ wStream#* out = Stream_Newcxx . . $ Stream_New(af7e1125a927123a).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 5); |
| 335 | |
| 336 | if (!out) |
| 337 | { |
| 338 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Stream_New failed!"); |
| 339 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 340 | } |
| 341 | |
| 342 | Stream_Write_UINT8cxx . . $ `winpr/include/winpr/stream.h:857:9`!(out, MSG_SNDIN_OPEN_REPLY); |
| 343 | Stream_Write_UINT32cxx . . $ `winpr/include/winpr/stream.h:1070:9`!(out, Result); |
| 344 | return audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(callback, out, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Function description |
| 349 | * |
| 350 | * @return 0 on success, otherwise a Win32 error code |
| 351 | */ |
| 352 | static UINTcxx . . $ UINT# audin_receive_wave_datacxx . . $ audin_receive_wave_data(86178d519469b1e5).(const AUDIO_FORMATcxx . . $ AUDIO_FORMAT#* format, const BYTEcxx . . $ BYTE#* data, size_t size, |
| 353 | void* user_data) |
| 354 | { |
| 355 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(format); |
| 356 | |
| 357 | UINTcxx . . $ UINT# error = ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 358 | AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback = (AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#*)user_data; |
| 359 | |
| 360 | if (!callback) |
| 361 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 362 | |
| 363 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)callback->plugincxx . . $ $anonymous_type_dad3bc0f619f42c7_1#plugin.; |
| 364 | |
| 365 | if (!audin) |
| 366 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 367 | |
| 368 | if (!audin->attachedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#attached.) |
| 369 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 370 | |
| 371 | Stream_ResetPositioncxx . . $ Stream_ResetPosition(141d0e356bb21ff3).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data.); |
| 372 | |
| 373 | if (!Stream_EnsureRemainingCapacitycxx . . $ Stream_EnsureRemainingCapacity(db6c6e3e90d014c4).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data., 1)) |
| 374 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 375 | |
| 376 | Stream_Write_UINT8cxx . . $ `winpr/include/winpr/stream.h:857:9`!(audin->data, MSG_SNDIN_DATA); |
| 377 | |
| 378 | const BOOLcxx . . $ BOOL# compatible = audio_format_compatiblecxx . . $ audio_format_compatible(dbc5ef6307e36589).(format, audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.); |
| 379 | if (compatible && audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.->FormatSupportedcxx . . $ s_IAudinDevice#FormatSupported.(audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device., audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.)) |
| 380 | { |
| 381 | if (!Stream_EnsureRemainingCapacitycxx . . $ Stream_EnsureRemainingCapacity(db6c6e3e90d014c4).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data., size)) |
| 382 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 383 | |
| 384 | Stream_Writecxx . . $ Stream_Write(6afa9478ce9fa6e6).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data., data, size); |
| 385 | } |
| 386 | else |
| 387 | { |
| 388 | if (!freerdp_dsp_encodecxx . . $ freerdp_dsp_encode(cc33578da2529caa).(audin->dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context., format, data, size, audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data.)) |
| 389 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 390 | } |
| 391 | |
| 392 | /* Did not encode anything, skip this, the codec is not ready for output. */ |
| 393 | if (Stream_GetPositioncxx . . $ Stream_GetPosition(ebc7f695a8644dc0).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data.) <= 1) |
| 394 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 395 | |
| 396 | audio_format_printcxx . . $ audio_format_print(754254553bdbfe27).(audin->logcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#log., WLOG_TRACEcxx . . $ WLOG_TRACE., audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.); |
| 397 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_TRACE, "[%" PRIuzcxx . . $ `winpr/include/winpr/wtypes.h:485:9`! "/%" PRIuzcxx . . $ `winpr/include/winpr/wtypes.h:485:9`! "]", size, |
| 398 | Stream_GetPosition(audin->data) - 1); |
| 399 | |
| 400 | if ((error = audin_send_incoming_data_pducxx . . $ audin_send_incoming_data_pdu(a09fa0152219c853).(callback))) |
| 401 | { |
| 402 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "audin_send_incoming_data_pdu failed!"); |
| 403 | return error; |
| 404 | } |
| 405 | |
| 406 | return audin_channel_write_and_freecxx . . $ audin_channel_write_and_free(29b4d7604a198a60).(callback, audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data., FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!); |
| 407 | } |
| 408 | |
| 409 | static BOOLcxx . . $ BOOL# audin_open_devicecxx . . $ audin_open_device(a48d87b02f19f337).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback) |
| 410 | { |
| 411 | UINTcxx . . $ UINT# error = ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 412 | AUDIO_FORMATcxx . . $ AUDIO_FORMAT# format = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!; |
| 413 | |
| 414 | if (!audin || !audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 415 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 416 | |
| 417 | format = *audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.; |
| 418 | const BOOLcxx . . $ BOOL# supported = |
| 419 | IFCALLRESULTcxx . . $ `include/freerdp/api.h:106:9`!(FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!, audin->device->FormatSupported, audin->device, &format); |
| 420 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "microphone uses %s codec", |
| 421 | audio_format_get_tag_string(format.wFormatTag)); |
| 422 | |
| 423 | if (!supported) |
| 424 | { |
| 425 | /* Default sample rates supported by most backends. */ |
| 426 | const UINT32cxx . . $ UINT32# samplerates[] = { format.nSamplesPerSeccxx . . $ AUDIO_FORMAT#nSamplesPerSec., 96000, 48000, 44100, 22050 }; |
| 427 | BOOLcxx . . $ BOOL# test = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 428 | |
| 429 | format.wFormatTagcxx . . $ AUDIO_FORMAT#wFormatTag. = WAVE_FORMAT_PCMcxx . . $ `include/freerdp/codec/audio.h:79:9`!; |
| 430 | format.wBitsPerSamplecxx . . $ AUDIO_FORMAT#wBitsPerSample. = 16; |
| 431 | format.cbSizecxx . . $ AUDIO_FORMAT#cbSize. = 0; |
| 432 | for (size_t x = 0; x < ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(samplerates); x++) |
| 433 | { |
| 434 | format.nSamplesPerSeccxx . . $ AUDIO_FORMAT#nSamplesPerSec. = samplerates[x]; |
| 435 | for (UINT16cxx . . $ UINT16# y = audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format.->nChannelscxx . . $ AUDIO_FORMAT#nChannels.; y > 0; y--) |
| 436 | { |
| 437 | format.nChannelscxx . . $ AUDIO_FORMAT#nChannels. = y; |
| 438 | format.nBlockAligncxx . . $ AUDIO_FORMAT#nBlockAlign. = 2 * format.nChannelscxx . . $ AUDIO_FORMAT#nChannels.; |
| 439 | test = IFCALLRESULTcxx . . $ `include/freerdp/api.h:106:9`!(FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!, audin->device->FormatSupported, audin->device, &format); |
| 440 | if (test) |
| 441 | break; |
| 442 | } |
| 443 | if (test) |
| 444 | break; |
| 445 | } |
| 446 | if (!test) |
| 447 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 448 | } |
| 449 | |
| 450 | IFCALLRETcxx . . $ `include/freerdp/api.h:96:9`!(audin->device->SetFormat, error, audin->device, &format, audin->FramesPerPacket); |
| 451 | |
| 452 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 453 | { |
| 454 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "SetFormat failed with errorcode %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", error); |
| 455 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 456 | } |
| 457 | |
| 458 | if (!freerdp_dsp_context_resetcxx . . $ freerdp_dsp_context_reset(49ad71785202a848).(audin->dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context., audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format., audin->FramesPerPacketcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#FramesPerPacket.)) |
| 459 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 460 | |
| 461 | IFCALLRETcxx . . $ `include/freerdp/api.h:96:9`!(audin->device->Open, error, audin->device, audin_receive_wave_data, callback); |
| 462 | |
| 463 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 464 | { |
| 465 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "Open failed with errorcode %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", error); |
| 466 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 467 | } |
| 468 | |
| 469 | return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * Function description |
| 474 | * |
| 475 | * @return 0 on success, otherwise a Win32 error code |
| 476 | */ |
| 477 | static UINTcxx . . $ UINT# audin_process_opencxx . . $ audin_process_open(d058d81a7488abf6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, wStreamcxx . . $ wStream#* s) |
| 478 | { |
| 479 | UINT32cxx . . $ UINT32# initialFormat = 0; |
| 480 | UINT32cxx . . $ UINT32# FramesPerPacket = 0; |
| 481 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 482 | |
| 483 | if (!Stream_CheckAndLogRequiredLengthcxx . . $ `winpr/include/winpr/stream.h:127:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, s, 8)) |
| 484 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 485 | |
| 486 | Stream_Read_UINT32cxx . . $ `winpr/include/winpr/stream.h:683:9`!(s, FramesPerPacket); |
| 487 | Stream_Read_UINT32cxx . . $ `winpr/include/winpr/stream.h:683:9`!(s, initialFormat); |
| 488 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "FramesPerPacket=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " initialFormat=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", |
| 489 | FramesPerPacket, initialFormat); |
| 490 | |
| 491 | if (initialFormat >= callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.) |
| 492 | { |
| 493 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "invalid format index %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " (total %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! ")", |
| 494 | initialFormat, callback->formats_count); |
| 495 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 496 | } |
| 497 | |
| 498 | /* The RDP protocol field allows UINT32_MAX, but most backend API use INT32 as input parameter |
| 499 | * or do some math with it, so ensure that the value does not exceed reasonable limits */ |
| 500 | if (FramesPerPacket >= INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`!) |
| 501 | { |
| 502 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "invalid frames per packet %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`!, FramesPerPacket); |
| 503 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 504 | } |
| 505 | |
| 506 | audin->FramesPerPacketcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#FramesPerPacket. = FramesPerPacket; |
| 507 | audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format. = &callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats.[initialFormat]; |
| 508 | |
| 509 | if (!audin_open_devicecxx . . $ audin_open_device(a48d87b02f19f337).(audin, callback)) |
| 510 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 511 | |
| 512 | if ((error = audin_send_format_change_pducxx . . $ audin_send_format_change_pdu(9682e9f688a1730c).(audin, callback, initialFormat))) |
| 513 | { |
| 514 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "audin_send_format_change_pdu failed!"); |
| 515 | return error; |
| 516 | } |
| 517 | |
| 518 | if ((error = audin_send_open_reply_pducxx . . $ audin_send_open_reply_pdu(9682e9f688a1730c).(audin, callback, 0))) |
| 519 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "audin_send_open_reply_pdu failed!"); |
| 520 | |
| 521 | return error; |
| 522 | } |
| 523 | |
| 524 | /** |
| 525 | * Function description |
| 526 | * |
| 527 | * @return 0 on success, otherwise a Win32 error code |
| 528 | */ |
| 529 | static UINTcxx . . $ UINT# audin_process_format_changecxx . . $ audin_process_format_change(d058d81a7488abf6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback, |
| 530 | wStreamcxx . . $ wStream#* s) |
| 531 | { |
| 532 | UINT32cxx . . $ UINT32# NewFormat = 0; |
| 533 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 534 | |
| 535 | if (!Stream_CheckAndLogRequiredLengthcxx . . $ `winpr/include/winpr/stream.h:127:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, s, 4)) |
| 536 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 537 | |
| 538 | Stream_Read_UINT32cxx . . $ `winpr/include/winpr/stream.h:683:9`!(s, NewFormat); |
| 539 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "NewFormat=%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", NewFormat); |
| 540 | |
| 541 | if (NewFormat >= callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.) |
| 542 | { |
| 543 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "invalid format index %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " (total %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! ")", |
| 544 | NewFormat, callback->formats_count); |
| 545 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 546 | } |
| 547 | |
| 548 | audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format. = &callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats.[NewFormat]; |
| 549 | |
| 550 | if (audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 551 | { |
| 552 | IFCALLRETcxx . . $ `include/freerdp/api.h:96:9`!(audin->device->Close, error, audin->device); |
| 553 | |
| 554 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 555 | { |
| 556 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "Close failed with errorcode %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", error); |
| 557 | return error; |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | if (!audin_open_devicecxx . . $ audin_open_device(a48d87b02f19f337).(audin, callback)) |
| 562 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 563 | |
| 564 | if ((error = audin_send_format_change_pducxx . . $ audin_send_format_change_pdu(9682e9f688a1730c).(audin, callback, NewFormat))) |
| 565 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "audin_send_format_change_pdu failed!"); |
| 566 | |
| 567 | return error; |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * Function description |
| 572 | * |
| 573 | * @return 0 on success, otherwise a Win32 error code |
| 574 | */ |
| 575 | static UINTcxx . . $ UINT# audin_on_data_receivedcxx . . $ audin_on_data_received(7d5bfc0113ae0792).(IWTSVirtualChannelCallbackcxx . . $ IWTSVirtualChannelCallback#* pChannelCallback, wStreamcxx . . $ wStream#* data) |
| 576 | { |
| 577 | UINTcxx . . $ UINT# error = 0; |
| 578 | BYTEcxx . . $ BYTE# MessageId = 0; |
| 579 | AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback = (AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#*)pChannelCallback; |
| 580 | |
| 581 | if (!callback || !data) |
| 582 | return ERROR_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/error.h:252:9`!; |
| 583 | |
| 584 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)callback->plugincxx . . $ $anonymous_type_dad3bc0f619f42c7_1#plugin.; |
| 585 | |
| 586 | if (!audin) |
| 587 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 588 | |
| 589 | if (!Stream_CheckAndLogRequiredLengthcxx . . $ `winpr/include/winpr/stream.h:127:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, data, 1)) |
| 590 | return ERROR_NO_DATAcxx . . $ `winpr/include/winpr/error.h:365:9`!; |
| 591 | |
| 592 | Stream_Read_UINT8cxx . . $ `winpr/include/winpr/stream.h:647:9`!(data, MessageId); |
| 593 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "MessageId=0x%02" PRIx8cxx . . $ `<external>/15933738808807975373/inttypes.h:123:10`! "", MessageId); |
| 594 | |
| 595 | switch (MessageId) |
| 596 | { |
| 597 | case MSG_SNDIN_VERSIONcxx . . $ MSG_SNDIN_VERSION.: |
| 598 | error = audin_process_versioncxx . . $ audin_process_version(d058d81a7488abf6).(audin, callback, data); |
| 599 | break; |
| 600 | |
| 601 | case MSG_SNDIN_FORMATScxx . . $ MSG_SNDIN_FORMATS.: |
| 602 | error = audin_process_formatscxx . . $ audin_process_formats(d058d81a7488abf6).(audin, callback, data); |
| 603 | break; |
| 604 | |
| 605 | case MSG_SNDIN_OPENcxx . . $ MSG_SNDIN_OPEN.: |
| 606 | error = audin_process_opencxx . . $ audin_process_open(d058d81a7488abf6).(audin, callback, data); |
| 607 | break; |
| 608 | |
| 609 | case MSG_SNDIN_FORMATCHANGEcxx . . $ MSG_SNDIN_FORMATCHANGE.: |
| 610 | error = audin_process_format_changecxx . . $ audin_process_format_change(d058d81a7488abf6).(audin, callback, data); |
| 611 | break; |
| 612 | |
| 613 | default: |
| 614 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "unknown MessageId=0x%02" PRIx8cxx . . $ `<external>/15933738808807975373/inttypes.h:123:10`! "", MessageId); |
| 615 | error = ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 616 | break; |
| 617 | } |
| 618 | |
| 619 | return error; |
| 620 | } |
| 621 | |
| 622 | /** |
| 623 | * Function description |
| 624 | * |
| 625 | * @return 0 on success, otherwise a Win32 error code |
| 626 | */ |
| 627 | static UINTcxx . . $ UINT# audin_on_closecxx . . $ audin_on_close(291fd05f9f405f8c).(IWTSVirtualChannelCallbackcxx . . $ IWTSVirtualChannelCallback#* pChannelCallback) |
| 628 | { |
| 629 | AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback = (AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#*)pChannelCallback; |
| 630 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(callback); |
| 631 | |
| 632 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)callback->plugincxx . . $ $anonymous_type_dad3bc0f619f42c7_1#plugin.; |
| 633 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 634 | |
| 635 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 636 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_TRACE, "..."); |
| 637 | |
| 638 | if (audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 639 | { |
| 640 | IFCALLRETcxx . . $ `include/freerdp/api.h:96:9`!(audin->device->Close, error, audin->device); |
| 641 | |
| 642 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 643 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Close failed with errorcode %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", error); |
| 644 | } |
| 645 | |
| 646 | audin->formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#format. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 647 | audio_formats_freecxx . . $ audio_formats_free(675a8d52ad36a196).(callback->formatscxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats., callback->formats_countcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#formats_count.); |
| 648 | freecxx . . $ free(5d22bdacc48458e8).(callback); |
| 649 | return error; |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * Function description |
| 654 | * |
| 655 | * @return 0 on success, otherwise a Win32 error code |
| 656 | */ |
| 657 | static UINTcxx . . $ UINT# audin_on_new_channel_connectioncxx . . $ audin_on_new_channel_connection(9816725f00ad0c3d).(IWTSListenerCallbackcxx . . $ IWTSListenerCallback#* pListenerCallback, |
| 658 | IWTSVirtualChannelcxx . . $ IWTSVirtualChannel#* pChannel, |
| 659 | WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! BYTEcxx . . $ BYTE#* Data, |
| 660 | WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! BOOLcxx . . $ BOOL#* pbAccept, |
| 661 | IWTSVirtualChannelCallbackcxx . . $ IWTSVirtualChannelCallback#** ppCallback) |
| 662 | { |
| 663 | GENERIC_LISTENER_CALLBACKcxx . . $ GENERIC_LISTENER_CALLBACK#* listener_callback = (GENERIC_LISTENER_CALLBACKcxx . . $ GENERIC_LISTENER_CALLBACK#*)pListenerCallback; |
| 664 | |
| 665 | if (!listener_callback || !listener_callback->plugincxx . . $ $anonymous_type_b3a06c54c4b60133_1#plugin.) |
| 666 | return ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 667 | |
| 668 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)listener_callback->plugincxx . . $ $anonymous_type_b3a06c54c4b60133_1#plugin.; |
| 669 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_TRACE, "..."); |
| 670 | AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#* callback = |
| 671 | (AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(AUDIN_CHANNEL_CALLBACKcxx . . $ AUDIN_CHANNEL_CALLBACK#)); |
| 672 | |
| 673 | if (!callback) |
| 674 | { |
| 675 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "calloc failed!"); |
| 676 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 677 | } |
| 678 | |
| 679 | callback->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_1#iface..OnDataReceivedcxx . . $ s_IWTSVirtualChannelCallback#OnDataReceived. = audin_on_data_receivedcxx . . $ audin_on_data_received(7d5bfc0113ae0792).; |
| 680 | callback->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_1#iface..OnClosecxx . . $ s_IWTSVirtualChannelCallback#OnClose. = audin_on_closecxx . . $ audin_on_close(291fd05f9f405f8c).; |
| 681 | callback->plugincxx . . $ $anonymous_type_dad3bc0f619f42c7_1#plugin. = listener_callback->plugincxx . . $ $anonymous_type_b3a06c54c4b60133_1#plugin.; |
| 682 | callback->channel_mgrcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel_mgr. = listener_callback->channel_mgrcxx . . $ $anonymous_type_b3a06c54c4b60133_1#channel_mgr.; |
| 683 | callback->channelcxx . . $ $anonymous_type_dad3bc0f619f42c7_1#channel. = pChannel; |
| 684 | *ppCallback = &callback->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_1#iface.; |
| 685 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * Function description |
| 690 | * |
| 691 | * @return 0 on success, otherwise a Win32 error code |
| 692 | */ |
| 693 | static UINTcxx . . $ UINT# audin_plugin_initializecxx . . $ audin_plugin_initialize(c0a1eccfbb63a827).(IWTSPlugincxx . . $ IWTSPlugin#* pPlugin, IWTSVirtualChannelManagercxx . . $ IWTSVirtualChannelManager#* pChannelMgr) |
| 694 | { |
| 695 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pPlugin; |
| 696 | |
| 697 | if (!audin) |
| 698 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 699 | |
| 700 | if (!pChannelMgr) |
| 701 | return ERROR_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/error.h:252:9`!; |
| 702 | |
| 703 | if (audin->initializedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#initialized.) |
| 704 | { |
| 705 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "[%s] channel initialized twice, aborting", AUDIN_DVC_CHANNEL_NAMEcxx . . $ `include/freerdp/channels/audin.h:39:9`!); |
| 706 | return ERROR_INVALID_DATAcxx . . $ `winpr/include/winpr/error.h:198:9`!; |
| 707 | } |
| 708 | |
| 709 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_TRACE, "..."); |
| 710 | audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback. = |
| 711 | (GENERIC_LISTENER_CALLBACKcxx . . $ GENERIC_LISTENER_CALLBACK#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(GENERIC_LISTENER_CALLBACKcxx . . $ GENERIC_LISTENER_CALLBACK#)); |
| 712 | |
| 713 | if (!audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.) |
| 714 | { |
| 715 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "calloc failed!"); |
| 716 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 717 | } |
| 718 | |
| 719 | audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.->ifacecxx . . $ $anonymous_type_b3a06c54c4b60133_1#iface..OnNewChannelConnectioncxx . . $ s_IWTSListenerCallback#OnNewChannelConnection. = audin_on_new_channel_connectioncxx . . $ audin_on_new_channel_connection(9816725f00ad0c3d).; |
| 720 | audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.->plugincxx . . $ $anonymous_type_b3a06c54c4b60133_1#plugin. = pPlugin; |
| 721 | audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.->channel_mgrcxx . . $ $anonymous_type_b3a06c54c4b60133_1#channel_mgr. = pChannelMgr; |
| 722 | const UINTcxx . . $ UINT# rc = pChannelMgr->CreateListenercxx . . $ s_IWTSVirtualChannelManager#CreateListener.(pChannelMgr, AUDIN_DVC_CHANNEL_NAMEcxx . . $ `include/freerdp/channels/audin.h:39:9`!, 0, |
| 723 | &audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.->ifacecxx . . $ $anonymous_type_b3a06c54c4b60133_1#iface., &audin->listenercxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener.); |
| 724 | |
| 725 | audin->initializedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#initialized. = rc == CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 726 | return rc; |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * Function description |
| 731 | * |
| 732 | * @return 0 on success, otherwise a Win32 error code |
| 733 | */ |
| 734 | static UINTcxx . . $ UINT# audin_plugin_terminatedcxx . . $ audin_plugin_terminated(e2a01140fd1b6948).(IWTSPlugincxx . . $ IWTSPlugin#* pPlugin) |
| 735 | { |
| 736 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pPlugin; |
| 737 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 738 | |
| 739 | if (!audin) |
| 740 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 741 | |
| 742 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_TRACE, "..."); |
| 743 | |
| 744 | if (audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.) |
| 745 | { |
| 746 | IWTSVirtualChannelManagercxx . . $ IWTSVirtualChannelManager#* mgr = audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.->channel_mgrcxx . . $ $anonymous_type_b3a06c54c4b60133_1#channel_mgr.; |
| 747 | if (mgr) |
| 748 | IFCALLcxx . . $ `include/freerdp/api.h:88:9`!(mgr->DestroyListener, mgr, audin->listener); |
| 749 | } |
| 750 | audio_formats_freecxx . . $ audio_formats_free(675a8d52ad36a196).(audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format., 1); |
| 751 | |
| 752 | if (audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 753 | { |
| 754 | IFCALLRETcxx . . $ `include/freerdp/api.h:96:9`!(audin->device->Free, error, audin->device); |
| 755 | |
| 756 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 757 | { |
| 758 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "Free failed with errorcode %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "", error); |
| 759 | // don't stop on error |
| 760 | } |
| 761 | |
| 762 | audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 763 | } |
| 764 | |
| 765 | freerdp_dsp_context_freecxx . . $ freerdp_dsp_context_free(9d6dddf0bafb1346).(audin->dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context.); |
| 766 | Stream_Freecxx . . $ Stream_Free(31813de2214206e2).(audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data., TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 767 | freecxx . . $ free(5d22bdacc48458e8).(audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem.); |
| 768 | freecxx . . $ free(5d22bdacc48458e8).(audin->device_namecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device_name.); |
| 769 | freecxx . . $ free(5d22bdacc48458e8).(audin->listener_callbackcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#listener_callback.); |
| 770 | freecxx . . $ free(5d22bdacc48458e8).(audin); |
| 771 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 772 | } |
| 773 | |
| 774 | static UINTcxx . . $ UINT# audin_plugin_attachedcxx . . $ audin_plugin_attached(e2a01140fd1b6948).(IWTSPlugincxx . . $ IWTSPlugin#* pPlugin) |
| 775 | { |
| 776 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pPlugin; |
| 777 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 778 | |
| 779 | if (!audin) |
| 780 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 781 | |
| 782 | audin->attachedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#attached. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; |
| 783 | return error; |
| 784 | } |
| 785 | |
| 786 | static UINTcxx . . $ UINT# audin_plugin_detachedcxx . . $ audin_plugin_detached(e2a01140fd1b6948).(IWTSPlugincxx . . $ IWTSPlugin#* pPlugin) |
| 787 | { |
| 788 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pPlugin; |
| 789 | UINTcxx . . $ UINT# error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 790 | |
| 791 | if (!audin) |
| 792 | return CHANNEL_RC_BAD_CHANNEL_HANDLEcxx . . $ `winpr/include/winpr/wtsapi.h:166:9`!; |
| 793 | |
| 794 | audin->attachedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#attached. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 795 | return error; |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * Function description |
| 800 | * |
| 801 | * @return 0 on success, otherwise a Win32 error code |
| 802 | */ |
| 803 | static UINTcxx . . $ UINT# audin_register_device_plugincxx . . $ audin_register_device_plugin(59fb0711c6589365).(IWTSPlugincxx . . $ IWTSPlugin#* pPlugin, IAudinDevicecxx . . $ IAudinDevice#* device) |
| 804 | { |
| 805 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pPlugin; |
| 806 | |
| 807 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 808 | |
| 809 | if (audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 810 | { |
| 811 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "existing device, abort."); |
| 812 | return ERROR_ALREADY_EXISTScxx . . $ `winpr/include/winpr/error.h:324:9`!; |
| 813 | } |
| 814 | |
| 815 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_DEBUG, "device registered."); |
| 816 | audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device. = device; |
| 817 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 818 | } |
| 819 | |
| 820 | /** |
| 821 | * Function description |
| 822 | * |
| 823 | * @return 0 on success, otherwise a Win32 error code |
| 824 | */ |
| 825 | static UINTcxx . . $ UINT# audin_load_device_plugincxx . . $ audin_load_device_plugin(9d48615d5a943e9f).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, const char* name, const ADDIN_ARGVcxx . . $ ADDIN_ARGV#* args) |
| 826 | { |
| 827 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 828 | |
| 829 | FREERDP_AUDIN_DEVICE_ENTRY_POINTScxx . . $ FREERDP_AUDIN_DEVICE_ENTRY_POINTS# entryPoints = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!; |
| 830 | UINTcxx . . $ UINT# error = ERROR_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/error.h:985:9`!; |
| 831 | |
| 832 | PVIRTUALCHANNELENTRYcxx . . $ PVIRTUALCHANNELENTRY# pvce = |
| 833 | freerdp_load_channel_addin_entrycxx . . $ freerdp_load_channel_addin_entry(16a35db1d2c07bf0).(AUDIN_CHANNEL_NAMEcxx . . $ `include/freerdp/channels/audin.h:33:9`!, name, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0); |
| 834 | PFREERDP_AUDIN_DEVICE_ENTRYcxx . . $ PFREERDP_AUDIN_DEVICE_ENTRY# entry = WINPR_FUNC_PTR_CASTcxx . . $ `winpr/include/winpr/cast.h:81:9`!(pvce, PFREERDP_AUDIN_DEVICE_ENTRY); |
| 835 | |
| 836 | if (entry == nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!) |
| 837 | { |
| 838 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 839 | "freerdp_load_channel_addin_entry did not return any function pointers for %s ", |
| 840 | name); |
| 841 | return ERROR_INVALID_FUNCTIONcxx . . $ `winpr/include/winpr/error.h:186:9`!; |
| 842 | } |
| 843 | |
| 844 | entryPoints.plugincxx . . $ $anonymous_type_e8649c5628935951_0#plugin. = &audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface.; |
| 845 | entryPoints.pRegisterAudinDevicecxx . . $ $anonymous_type_e8649c5628935951_0#pRegisterAudinDevice. = audin_register_device_plugincxx . . $ audin_register_device_plugin(59fb0711c6589365).; |
| 846 | entryPoints.argscxx . . $ $anonymous_type_e8649c5628935951_0#args. = args; |
| 847 | entryPoints.rdpcontextcxx . . $ $anonymous_type_e8649c5628935951_0#rdpcontext. = audin->rdpcontextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#rdpcontext.; |
| 848 | |
| 849 | error = entry(&entryPoints); |
| 850 | if (error) |
| 851 | { |
| 852 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "%s entry returned error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! ".", name, error); |
| 853 | return error; |
| 854 | } |
| 855 | |
| 856 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_INFO, "Loaded %s backend for audin", name); |
| 857 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 858 | } |
| 859 | |
| 860 | /** |
| 861 | * Function description |
| 862 | * |
| 863 | * @return 0 on success, otherwise a Win32 error code |
| 864 | */ |
| 865 | static UINTcxx . . $ UINT# audin_set_subsystemcxx . . $ audin_set_subsystem(d01820f93e5e7219).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, const char* subsystem) |
| 866 | { |
| 867 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 868 | |
| 869 | freecxx . . $ free(5d22bdacc48458e8).(audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem.); |
| 870 | audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem. = _strdupcxx . . $ _strdup(a8b8e32347182212).(subsystem); |
| 871 | |
| 872 | if (!audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem.) |
| 873 | { |
| 874 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "_strdup failed!"); |
| 875 | return ERROR_NOT_ENOUGH_MEMORYcxx . . $ `winpr/include/winpr/error.h:193:9`!; |
| 876 | } |
| 877 | |
| 878 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 879 | } |
| 880 | |
| 881 | /** |
| 882 | * Function description |
| 883 | * |
| 884 | * @return 0 on success, otherwise a Win32 error code |
| 885 | */ |
| 886 | static UINTcxx . . $ UINT# audin_set_device_namecxx . . $ audin_set_device_name(d01820f93e5e7219).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, const char* device_name) |
| 887 | { |
| 888 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(audin); |
| 889 | |
| 890 | freecxx . . $ free(5d22bdacc48458e8).(audin->device_namecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device_name.); |
| 891 | audin->device_namecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device_name. = _strdupcxx . . $ _strdup(a8b8e32347182212).(device_name); |
| 892 | |
| 893 | if (!audin->device_namecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device_name.) |
| 894 | { |
| 895 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "_strdup failed!"); |
| 896 | return ERROR_NOT_ENOUGH_MEMORYcxx . . $ `winpr/include/winpr/error.h:193:9`!; |
| 897 | } |
| 898 | |
| 899 | return CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 900 | } |
| 901 | |
| 902 | BOOLcxx . . $ BOOL# audin_process_addin_argscxx . . $ audin_process_addin_args(8718c804439721d6).(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin, const ADDIN_ARGVcxx . . $ ADDIN_ARGV#* args) |
| 903 | { |
| 904 | COMMAND_LINE_ARGUMENT_Acxx . . $ COMMAND_LINE_ARGUMENT_A# audin_args[] = { |
| 905 | { "sys", COMMAND_LINE_VALUE_REQUIREDcxx . . $ `winpr/include/winpr/cmdline.h:34:9`!, "<subsystem>", nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, |
| 906 | "subsystem" }, |
| 907 | { "dev", COMMAND_LINE_VALUE_REQUIREDcxx . . $ `winpr/include/winpr/cmdline.h:34:9`!, "<device>", nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, "device" }, |
| 908 | { "format", COMMAND_LINE_VALUE_REQUIREDcxx . . $ `winpr/include/winpr/cmdline.h:34:9`!, "<format>", nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, |
| 909 | "format" }, |
| 910 | { "rate", COMMAND_LINE_VALUE_REQUIREDcxx . . $ `winpr/include/winpr/cmdline.h:34:9`!, "<rate>", nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, "rate" }, |
| 911 | { "channel", COMMAND_LINE_VALUE_REQUIREDcxx . . $ `winpr/include/winpr/cmdline.h:34:9`!, "<channel>", nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, |
| 912 | "channel" }, |
| 913 | { nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, -1, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! } |
| 914 | }; |
| 915 | |
| 916 | if (!args || args->argccxx . . $ $anonymous_type_ead674a03c2ca7a6_6#argc. == 1) |
| 917 | return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; |
| 918 | |
| 919 | const DWORDcxx . . $ DWORD# flags = |
| 920 | COMMAND_LINE_SIGIL_NONEcxx . . $ `winpr/include/winpr/cmdline.h:51:9`! | COMMAND_LINE_SEPARATOR_COLONcxx . . $ `winpr/include/winpr/cmdline.h:59:9`! | COMMAND_LINE_IGN_UNKNOWN_KEYWORDcxx . . $ `winpr/include/winpr/cmdline.h:64:9`!; |
| 921 | const int status = CommandLineParseArgumentsAcxx . . $ CommandLineParseArgumentsA(187c6f9c924790d7).(args->argccxx . . $ $anonymous_type_ead674a03c2ca7a6_6#argc., args->argvcxx . . $ $anonymous_type_ead674a03c2ca7a6_6#argv., audin_args, flags, audin, |
| 922 | nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!); |
| 923 | |
| 924 | if (status != 0) |
| 925 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 926 | |
| 927 | const COMMAND_LINE_ARGUMENT_Acxx . . $ COMMAND_LINE_ARGUMENT_A#* arg = audin_args; |
| 928 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0; |
| 929 | |
| 930 | do |
| 931 | { |
| 932 | if (!(arg->Flagscxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Flags. & COMMAND_LINE_VALUE_PRESENTcxx . . $ `winpr/include/winpr/cmdline.h:47:9`!)) |
| 933 | continue; |
| 934 | |
| 935 | CommandLineSwitchStartcxx . . $ `winpr/include/winpr/cmdline.h:88:9`!(arg) CommandLineSwitchCasecxx . . $ `winpr/include/winpr/cmdline.h:92:9`!(arg, "sys") |
| 936 | { |
| 937 | const UINTcxx . . $ UINT# error = audin_set_subsystemcxx . . $ audin_set_subsystem(d01820f93e5e7219).(audin, arg->Valuecxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Value.); |
| 938 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 939 | { |
| 940 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 941 | "audin_set_subsystem failed with error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "!", error); |
| 942 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 943 | } |
| 944 | } |
| 945 | CommandLineSwitchCasecxx . . $ `winpr/include/winpr/cmdline.h:92:9`!(arg, "dev") |
| 946 | { |
| 947 | const UINTcxx . . $ UINT# error = audin_set_device_namecxx . . $ audin_set_device_name(d01820f93e5e7219).(audin, arg->Valuecxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Value.); |
| 948 | if (error != CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 949 | { |
| 950 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 951 | "audin_set_device_name failed with error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "!", error); |
| 952 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 953 | } |
| 954 | } |
| 955 | CommandLineSwitchCasecxx . . $ `winpr/include/winpr/cmdline.h:92:9`!(arg, "format") |
| 956 | { |
| 957 | unsigned long val = strtoulcxx . . $ strtoul(31746e8d6ec49860).(arg->Valuecxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Value., nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0); |
| 958 | |
| 959 | if ((errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != 0) || (val > UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`!)) |
| 960 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 961 | |
| 962 | audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format.->wFormatTagcxx . . $ AUDIO_FORMAT#wFormatTag. = (UINT16cxx . . $ UINT16#)val; |
| 963 | } |
| 964 | CommandLineSwitchCasecxx . . $ `winpr/include/winpr/cmdline.h:92:9`!(arg, "rate") |
| 965 | { |
| 966 | unsigned long val = strtoulcxx . . $ strtoul(31746e8d6ec49860).(arg->Valuecxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Value., nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0); |
| 967 | |
| 968 | if ((errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != 0) || (val == 0) || (val > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!)) |
| 969 | return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!; |
| 970 | |
| 971 | audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format.->nSamplesPerSeccxx . . $ AUDIO_FORMAT#nSamplesPerSec. = (UINT32cxx . . $ UINT32#)val; |
| 972 | } |
| 973 | CommandLineSwitchCasecxx . . $ `winpr/include/winpr/cmdline.h:92:9`!(arg, "channel") |
| 974 | { |
| 975 | unsigned long val = strtoulcxx . . $ strtoul(31746e8d6ec49860).(arg->Valuecxx . . $ $anonymous_type_4f50d0f9be0f3fce_0#Value., nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0); |
| 976 | |
| 977 | if ((errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != 0) || (val <= UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`!)) |
| 978 | audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format.->nChannelscxx . . $ AUDIO_FORMAT#nChannels. = (UINT16cxx . . $ UINT16#)val; |
| 979 | } |
| 980 | CommandLineSwitchDefaultcxx . . $ `winpr/include/winpr/cmdline.h:93:9`!(arg) |
| 981 | { |
| 982 | } |
| 983 | CommandLineSwitchEndcxx . . $ `winpr/include/winpr/cmdline.h:94:9`!(arg) |
| 984 | } while ((arg = CommandLineFindNextArgumentAcxx . . $ CommandLineFindNextArgumentA(6c05a084fb90a3a2).(arg)) != nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!); |
| 985 | |
| 986 | return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; |
| 987 | } |
| 988 | |
| 989 | /** |
| 990 | * Function description |
| 991 | * |
| 992 | * @return 0 on success, otherwise a Win32 error code |
| 993 | */ |
| 994 | FREERDP_ENTRY_POINTcxx . . $ `include/freerdp/api.h:30:9`!(UINT VCAPITYPEcxx . . $ `winpr/include/winpr/wtsapi.h:120:9`! audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)) |
| 995 | { |
| 996 | struct SubsystemEntrycxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry# |
| 997 | { |
| 998 | char* subsystemcxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#subsystem.; |
| 999 | char* devicecxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#device.; |
| 1000 | }; |
| 1001 | UINTcxx . . $ UINT# error = CHANNEL_RC_INITIALIZATION_ERRORcxx . . $ `winpr/include/winpr/wtsapi.h:179:9`!; |
| 1002 | struct SubsystemEntrycxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry# entries[] = { |
| 1003 | #if defined(WITH_PULSE) |
| 1004 | { "pulse", "" }, |
| 1005 | #endif |
| 1006 | #if defined(WITH_OSScxx . . $ `build/include/freerdp/config.h:37:9`!) |
| 1007 | { "oss", "default" }, |
| 1008 | #endif |
| 1009 | #if defined(WITH_ALSAcxx . . $ `build/include/freerdp/config.h:38:9`!) |
| 1010 | { "alsa", "default" }, |
| 1011 | #endif |
| 1012 | #if defined(WITH_OPENSLES) |
| 1013 | { "opensles", "default" }, |
| 1014 | #endif |
| 1015 | #if defined(WITH_WINMM) |
| 1016 | { "winmm", "default" }, |
| 1017 | #endif |
| 1018 | #if defined(WITH_MACAUDIO) |
| 1019 | { "mac", "default" }, |
| 1020 | #endif |
| 1021 | #if defined(WITH_IOSAUDIO) |
| 1022 | { "ios", "default" }, |
| 1023 | #endif |
| 1024 | #if defined(WITH_SNDIO) |
| 1025 | { "sndio", "default" }, |
| 1026 | #endif |
| 1027 | { nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! } |
| 1028 | }; |
| 1029 | struct SubsystemEntrycxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#* entry = &entries[0]; |
| 1030 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pEntryPoints); |
| 1031 | WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pEntryPoints->GetPlugin); |
| 1032 | AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#* audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)pEntryPoints->GetPlugincxx . . $ S_IDRDYNVC_ENTRY_POINTS#GetPlugin.(pEntryPoints, AUDIN_CHANNEL_NAMEcxx . . $ `include/freerdp/channels/audin.h:33:9`!); |
| 1033 | |
| 1034 | if (audin != nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!) |
| 1035 | return CHANNEL_RC_ALREADY_INITIALIZEDcxx . . $ `winpr/include/winpr/wtsapi.h:160:9`!; |
| 1036 | |
| 1037 | audin = (AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(AUDIN_PLUGINcxx . . $ AUDIN_PLUGIN#)); |
| 1038 | |
| 1039 | if (!audin) |
| 1040 | { |
| 1041 | WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!, "calloc failed!"); |
| 1042 | return CHANNEL_RC_NO_MEMORYcxx . . $ `winpr/include/winpr/wtsapi.h:171:9`!; |
| 1043 | } |
| 1044 | |
| 1045 | audin->logcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#log. = WLog_Getcxx . . $ WLog_Get(1d389f31f69e7580).(TAGcxx . . $ `channels/audin/client/audin_main.h:31:9`!); |
| 1046 | audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data. = Stream_Newcxx . . $ Stream_New(af7e1125a927123a).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 4096); |
| 1047 | audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format. = audio_format_newcxx . . $ audio_format_new(f96071c799e85587).(); |
| 1048 | |
| 1049 | if (!audin->fixed_formatcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#fixed_format.) |
| 1050 | goto out; |
| 1051 | |
| 1052 | if (!audin->datacxx . . $ $anonymous_type_dad3bc0f619f42c7_2#data.) |
| 1053 | goto out; |
| 1054 | |
| 1055 | audin->dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context. = freerdp_dsp_context_newcxx . . $ freerdp_dsp_context_new(3c49be04be7959e3).(TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!); |
| 1056 | |
| 1057 | if (!audin->dsp_contextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#dsp_context.) |
| 1058 | goto out; |
| 1059 | |
| 1060 | audin->attachedcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#attached. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; |
| 1061 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Initializecxx . . $ s_IWTSPlugin#Initialize. = audin_plugin_initializecxx . . $ audin_plugin_initialize(c0a1eccfbb63a827).; |
| 1062 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Connectedcxx . . $ s_IWTSPlugin#Connected. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 1063 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Disconnectedcxx . . $ s_IWTSPlugin#Disconnected. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!; |
| 1064 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Terminatedcxx . . $ s_IWTSPlugin#Terminated. = audin_plugin_terminatedcxx . . $ audin_plugin_terminated(e2a01140fd1b6948).; |
| 1065 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Attachedcxx . . $ s_IWTSPlugin#Attached. = audin_plugin_attachedcxx . . $ audin_plugin_attached(e2a01140fd1b6948).; |
| 1066 | audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface..Detachedcxx . . $ s_IWTSPlugin#Detached. = audin_plugin_detachedcxx . . $ audin_plugin_detached(e2a01140fd1b6948).; |
| 1067 | |
| 1068 | { |
| 1069 | const ADDIN_ARGVcxx . . $ ADDIN_ARGV#* args = pEntryPoints->GetPluginDatacxx . . $ S_IDRDYNVC_ENTRY_POINTS#GetPluginData.(pEntryPoints); |
| 1070 | audin->rdpcontextcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#rdpcontext. = pEntryPoints->GetRdpContextcxx . . $ S_IDRDYNVC_ENTRY_POINTS#GetRdpContext.(pEntryPoints); |
| 1071 | |
| 1072 | if (args) |
| 1073 | { |
| 1074 | if (!audin_process_addin_argscxx . . $ audin_process_addin_args(8718c804439721d6).(audin, args)) |
| 1075 | goto out; |
| 1076 | } |
| 1077 | |
| 1078 | if (audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem.) |
| 1079 | { |
| 1080 | if ((error = audin_load_device_plugincxx . . $ audin_load_device_plugin(9d48615d5a943e9f).(audin, audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem., args))) |
| 1081 | { |
| 1082 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!( |
| 1083 | audin->log, WLOG_ERROR, |
| 1084 | "Unable to load microphone redirection subsystem %s because of error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! |
| 1085 | "", |
| 1086 | audin->subsystem, error); |
| 1087 | goto out; |
| 1088 | } |
| 1089 | } |
| 1090 | else |
| 1091 | { |
| 1092 | while (entry && entry->subsystemcxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#subsystem. && !audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device.) |
| 1093 | { |
| 1094 | if ((error = audin_set_subsystemcxx . . $ audin_set_subsystem(d01820f93e5e7219).(audin, entry->subsystemcxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#subsystem.))) |
| 1095 | { |
| 1096 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 1097 | "audin_set_subsystem for %s failed with error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "!", |
| 1098 | entry->subsystem, error); |
| 1099 | } |
| 1100 | else if ((error = audin_set_device_namecxx . . $ audin_set_device_name(d01820f93e5e7219).(audin, entry->devicecxx . . $ audin_DVCPluginEntry(83cfb5bec28944aa).SubsystemEntry#device.))) |
| 1101 | { |
| 1102 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 1103 | "audin_set_device_name for %s failed with error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "!", |
| 1104 | entry->subsystem, error); |
| 1105 | } |
| 1106 | else if ((error = audin_load_device_plugincxx . . $ audin_load_device_plugin(9d48615d5a943e9f).(audin, audin->subsystemcxx . . $ $anonymous_type_dad3bc0f619f42c7_2#subsystem., args))) |
| 1107 | { |
| 1108 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, |
| 1109 | "audin_load_device_plugin %s failed with error %" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! "!", |
| 1110 | entry->subsystem, error); |
| 1111 | } |
| 1112 | |
| 1113 | entry++; |
| 1114 | } |
| 1115 | } |
| 1116 | } |
| 1117 | |
| 1118 | if (audin->devicecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#device. == nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!) |
| 1119 | { |
| 1120 | /* If we have no audin device do not register plugin but still return OK or the client will |
| 1121 | * just disconnect due to a missing microphone. */ |
| 1122 | WLog_Printcxx . . $ `winpr/include/winpr/wlog.h:256:9`!(audin->log, WLOG_ERROR, "No microphone device could be found."); |
| 1123 | error = CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!; |
| 1124 | goto out; |
| 1125 | } |
| 1126 | |
| 1127 | error = pEntryPoints->RegisterPlugincxx . . $ S_IDRDYNVC_ENTRY_POINTS#RegisterPlugin.(pEntryPoints, AUDIN_CHANNEL_NAMEcxx . . $ `include/freerdp/channels/audin.h:33:9`!, &audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface.); |
| 1128 | if (error == CHANNEL_RC_OKcxx . . $ `winpr/include/winpr/wtsapi.h:159:9`!) |
| 1129 | return error; |
| 1130 | |
| 1131 | out: |
| 1132 | audin_plugin_terminatedcxx . . $ audin_plugin_terminated(e2a01140fd1b6948).(&audin->ifacecxx . . $ $anonymous_type_dad3bc0f619f42c7_2#iface.); |
| 1133 | return error; |
| 1134 | } |