Regroup source.

This commit is contained in:
Michael Jumper 2012-10-27 20:03:18 -07:00
parent c440cd21a0
commit a1ed00728c
5 changed files with 165 additions and 106 deletions

View File

@ -48,7 +48,7 @@ libguac_client_rdp_la_SOURCES = src/client.c src/rdp_bitmap.c src/rdp_glyph.c sr
src/rdp_keymap_en_us.c \ src/rdp_keymap_en_us.c \
src/default_pointer.c src/default_pointer.c
guac_rdpsnd_la_SOURCES = guac_rdpsnd/rdpsnd_main.c guac_rdpsnd_la_SOURCES = guac_rdpsnd/messages.c guac_rdpsnd/service.c
noinst_HEADERS = \ noinst_HEADERS = \
include/client.h \ include/client.h \
@ -60,7 +60,8 @@ noinst_HEADERS = \
include/rdp_glyph.h \ include/rdp_glyph.h \
include/rdp_keymap.h \ include/rdp_keymap.h \
include/rdp_pointer.h \ include/rdp_pointer.h \
guac_rdpsnd/rdpsnd_main.h guac_rdpsnd/messages.h \
guac_rdpsnd/service.h
libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0 libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0
guac_rdpsnd_la_LDFLAGS = -module -avoid-version -shared guac_rdpsnd_la_LDFLAGS = -module -avoid-version -shared

View File

@ -31,82 +31,8 @@
#include <guacamole/client.h> #include <guacamole/client.h>
#include "rdpsnd_main.h" #include "service.h"
#include "messages.h"
/* SVC DEFINITION */
DEFINE_SVC_PLUGIN(guac_rdpsnd, "rdpsnd",
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP)
void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin) {
/* Get client from plugin */
guac_client* client = (guac_client*)
plugin->channel_entry_points.pExtendedData;
/* Log that sound has been loaded */
guac_client_log_info(client, "guac_rdpsnd connected.");
}
void guac_rdpsnd_process_terminate(rdpSvcPlugin* plugin) {
xfree(plugin);
}
void guac_rdpsnd_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) {
freerdp_event_free(event);
}
void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
STREAM* input_stream) {
guac_rdpsndPlugin* rdpsnd = (guac_rdpsndPlugin*) plugin;
/* Get client from plugin */
guac_client* client = (guac_client*)
plugin->channel_entry_points.pExtendedData;
uint8 msgType;
uint16 BodySize;
if (rdpsnd->expectingWave) {
rdpsnd_process_message_wave(rdpsnd, client, input_stream);
return;
}
/* Read event */
stream_read_uint8(input_stream, msgType); /* msgType */
stream_seek_uint8(input_stream); /* bPad */
stream_read_uint16(input_stream, BodySize);
switch (msgType) {
case SNDC_FORMATS:
guac_rdpsnd_process_message_formats(rdpsnd, client, input_stream);
break;
case SNDC_TRAINING:
guac_rdpsnd_process_message_training(rdpsnd, client, input_stream);
break;
case SNDC_WAVE:
guac_rdpsnd_process_message_wave_info(rdpsnd, client, input_stream, BodySize);
break;
case SNDC_CLOSE:
guac_rdpsnd_process_message_close(rdpsnd, client);
break;
case SNDC_SETVOLUME:
guac_rdpsnd_process_message_setvolume(rdpsnd, client, input_stream);
break;
default:
/*DEBUG_WARN("unknown msgType %d", msgType);*/
break;
}
}
/* MESSAGE HANDLERS */ /* MESSAGE HANDLERS */

View File

@ -17,8 +17,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef __RDPSND_MAIN_H #ifndef __GUAC_RDPSND_MESSAGES_H
#define __RDPSND_MAIN_H #define __GUAC_RDPSND_MESSAGES_H
#define SNDC_CLOSE 1 #define SNDC_CLOSE 1
#define SNDC_WAVE 2 #define SNDC_WAVE 2
@ -53,31 +53,6 @@ typedef struct rdpsndFormat {
uint8* data; uint8* data;
} rdpsndFormat; } rdpsndFormat;
typedef struct guac_rdpsndPlugin {
rdpSvcPlugin plugin;
uint8 cBlockNo;
boolean expectingWave;
uint8 waveData[4];
uint16 waveDataSize;
uint32 wTimeStamp; /* server timestamp */
} guac_rdpsndPlugin ;
void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin);
void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
STREAM* data_in);
void guac_rdpsnd_process_terminate(rdpSvcPlugin* plugin);
void guac_rdpsnd_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event);
void guac_rdpsnd_process_message_formats(guac_rdpsndPlugin* rdpsnd, void guac_rdpsnd_process_message_formats(guac_rdpsndPlugin* rdpsnd,
guac_client* client, STREAM* data_in); guac_client* client, STREAM* data_in);
@ -96,5 +71,5 @@ void guac_rdpsnd_process_message_setvolume(guac_rdpsndPlugin* rdpsnd,
void guac_rdpsnd_process_message_close(guac_rdpsndPlugin* rdpsnd, void guac_rdpsnd_process_message_close(guac_rdpsndPlugin* rdpsnd,
guac_client* client); guac_client* client);
#endif /* __RDPSND_MAIN_H */ #endif

View File

@ -0,0 +1,111 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* Audio Output Virtual Channel
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/constants.h>
#include <freerdp/types.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/load_plugin.h>
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#include "service.h"
#include "messages.h"
/* SVC DEFINITION */
DEFINE_SVC_PLUGIN(guac_rdpsnd, "rdpsnd",
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP)
void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin) {
/* Get client from plugin */
guac_client* client = (guac_client*)
plugin->channel_entry_points.pExtendedData;
/* Log that sound has been loaded */
guac_client_log_info(client, "guac_rdpsnd connected.");
}
void guac_rdpsnd_process_terminate(rdpSvcPlugin* plugin) {
xfree(plugin);
}
void guac_rdpsnd_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) {
freerdp_event_free(event);
}
void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
STREAM* input_stream) {
guac_rdpsndPlugin* rdpsnd = (guac_rdpsndPlugin*) plugin;
/* Get client from plugin */
guac_client* client = (guac_client*)
plugin->channel_entry_points.pExtendedData;
uint8 msgType;
uint16 BodySize;
if (rdpsnd->expectingWave) {
rdpsnd_process_message_wave(rdpsnd, client, input_stream);
return;
}
/* Read event */
stream_read_uint8(input_stream, msgType); /* msgType */
stream_seek_uint8(input_stream); /* bPad */
stream_read_uint16(input_stream, BodySize);
switch (msgType) {
case SNDC_FORMATS:
guac_rdpsnd_process_message_formats(rdpsnd, client, input_stream);
break;
case SNDC_TRAINING:
guac_rdpsnd_process_message_training(rdpsnd, client, input_stream);
break;
case SNDC_WAVE:
guac_rdpsnd_process_message_wave_info(rdpsnd, client, input_stream, BodySize);
break;
case SNDC_CLOSE:
guac_rdpsnd_process_message_close(rdpsnd, client);
break;
case SNDC_SETVOLUME:
guac_rdpsnd_process_message_setvolume(rdpsnd, client, input_stream);
break;
default:
/*DEBUG_WARN("unknown msgType %d", msgType);*/
break;
}
}

View File

@ -0,0 +1,46 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* Audio Output Virtual Channel
*
* Copyright 2010-2011 Vic Lee
*
* 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 __GUAC_RDPSND_SERVICE_H
#define __GUAC_RDPSND_SERVICE_H
typedef struct guac_rdpsndPlugin {
rdpSvcPlugin plugin;
uint8 cBlockNo;
boolean expectingWave;
uint8 waveData[4];
uint16 waveDataSize;
uint32 wTimeStamp; /* server timestamp */
} guac_rdpsndPlugin ;
void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin);
void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
STREAM* data_in);
void guac_rdpsnd_process_terminate(rdpSvcPlugin* plugin);
void guac_rdpsnd_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event);
#endif