diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am index 05007757..293efeca 100644 --- a/sesman/chansrv/Makefile.am +++ b/sesman/chansrv/Makefile.am @@ -70,7 +70,9 @@ xrdp_chansrv_SOURCES = \ sound.c \ sound.h \ xcommon.c \ - xcommon.h + xcommon.h \ + audin.c \ + audin.h xrdp_chansrv_LDFLAGS = \ $(X_LIBS) diff --git a/sesman/chansrv/audin.c b/sesman/chansrv/audin.c new file mode 100644 index 00000000..17629010 --- /dev/null +++ b/sesman/chansrv/audin.c @@ -0,0 +1,104 @@ +/** + * xrdp: A Remote Desktop Protocol server. + * + * Copyright (C) Jay Sorg 2019 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include + +#include "os_calls.h" +#include "chansrv.h" +#include "log.h" + +static struct chansrv_drdynvc_procs g_audin_info; +static int g_audio_chanid = 0; + +/*****************************************************************************/ +static int +audio_send_version(int chan_id) +{ + int error; + struct stream *s; + + LOG(0, ("audio_send_version:")); + make_stream(s); + init_stream(s, 32); + out_uint8(s, 1); /* MSG_SNDIN_VERSION */ + out_uint32_le(s, 1); /* version */ + error = chansrv_drdynvc_data(chan_id, s->data, 5); + free_stream(s); + return error; +} + +/*****************************************************************************/ +static int +audin_open_response(int chan_id, int creation_status) +{ + LOG(0, ("audin_open_response: creation_status %d", creation_status)); + if (creation_status == 0) + { + return audio_send_version(chan_id); + } + return 0; +} + +/*****************************************************************************/ +static int +audin_close_response(int chan_id) +{ + LOG(0, ("audin_close_response:")); + return 0; +} + +/*****************************************************************************/ +static int +audin_data_first(int chan_id, char *data, int bytes, int total_bytes) +{ + LOG(0, ("audin_data_first:")); + return 0; +} + +/*****************************************************************************/ +static int +audin_data(int chan_id, char *data, int bytes) +{ + LOG(0, ("audin_data:")); + g_hexdump(data, bytes); + return 0; +} + +/*****************************************************************************/ +int +audin_init(void) +{ + int error; + + LOG(0, ("audin_init:")); + g_memset(&g_audin_info, 0, sizeof(g_audin_info)); + g_audin_info.open_response = audin_open_response; + g_audin_info.close_response = audin_close_response; + g_audin_info.data_first = audin_data_first; + g_audin_info.data = audin_data; + error = chansrv_drdynvc_open("AUDIO_INPUT", 1, &g_audin_info, + &g_audio_chanid); + LOG(0, ("audin_init: error %d", error)); + return error; +} diff --git a/sesman/chansrv/audin.h b/sesman/chansrv/audin.h new file mode 100644 index 00000000..17cf6f8f --- /dev/null +++ b/sesman/chansrv/audin.h @@ -0,0 +1,25 @@ +/** + * xrdp: A Remote Desktop Protocol server. + * + * Copyright (C) Jay Sorg 2019 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _AUDIN_H_ +#define _AUDIN_H_ + +int +audin_init(void); + +#endif diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 04a73000..4dde8bef 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -37,6 +37,7 @@ #include "xcommon.h" #include "chansrv_fuse.h" #include "xrdp_sockets.h" +#include "audin.h" static struct trans *g_lis_trans = 0; static struct trans *g_con_trans = 0; @@ -415,6 +416,8 @@ process_message_channel_setup(struct stream *s) rail_init(); } + audin_init(); + return rv; }