mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
channels/rdpsnd: fix build on Windows
This commit is contained in:
@@ -6,9 +6,5 @@ set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]")
|
||||
|
||||
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
|
||||
|
||||
if(WIN32)
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
|
||||
else()
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
endif()
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
|
||||
|
||||
@@ -80,10 +80,25 @@ struct data_out_item
|
||||
/* get time in milliseconds */
|
||||
static UINT32 get_mstime(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
struct timeval tp;
|
||||
|
||||
gettimeofday(&tp, 0);
|
||||
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
|
||||
#else
|
||||
FILETIME ft;
|
||||
UINT64 time64 = 0;
|
||||
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
time64 |= ft.dwHighDateTime;
|
||||
time64 <<= 32;
|
||||
time64 |= ft.dwLowDateTime;
|
||||
time64 /= 10000;
|
||||
|
||||
/* fix epoch? */
|
||||
|
||||
return (UINT32) time64;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* process the linked list of data that has queued to be sent */
|
||||
|
||||
@@ -28,5 +28,5 @@ else()
|
||||
set(${MODULE_PREFIX}_LIBS freerdp-utils PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Server")
|
||||
#set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Server")
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/dsp.h>
|
||||
@@ -127,7 +129,8 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
|
||||
if (rdpsnd->context.num_client_formats > 0)
|
||||
{
|
||||
rdpsnd->context.client_formats = xzalloc(rdpsnd->context.num_client_formats * sizeof(rdpsndFormat));
|
||||
rdpsnd->context.client_formats = (rdpsndFormat*) malloc(rdpsnd->context.num_client_formats * sizeof(rdpsndFormat));
|
||||
ZeroMemory(rdpsnd->context.client_formats, sizeof(rdpsndFormat));
|
||||
|
||||
for (i = 0; i < rdpsnd->context.num_client_formats; i++)
|
||||
{
|
||||
@@ -290,7 +293,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
|
||||
|
||||
if (rdpsnd->out_buffer_size < out_buffer_size)
|
||||
{
|
||||
rdpsnd->out_buffer = realloc(rdpsnd->out_buffer, out_buffer_size);
|
||||
rdpsnd->out_buffer = (BYTE*) realloc(rdpsnd->out_buffer, out_buffer_size);
|
||||
rdpsnd->out_buffer_size = out_buffer_size;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ set(${MODULE_PREFIX}_SRCS
|
||||
wf_mirage.h
|
||||
wf_peer.c
|
||||
wf_peer.h
|
||||
wf_rdpsnd.c
|
||||
wf_rdpsnd.h
|
||||
wf_settings.c
|
||||
wf_settings.h
|
||||
wf_info.c
|
||||
@@ -51,6 +53,8 @@ if(WITH_WIN8)
|
||||
set(${MODULE_PREFIX}_LIBS d3d11 dxgi dxguid)
|
||||
endif()
|
||||
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-server)
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp)
|
||||
else()
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/codec/rfx.h>
|
||||
#include <freerdp/server/rdpsnd.h>
|
||||
|
||||
typedef struct wf_info wfInfo;
|
||||
typedef struct wf_peer_context wfPeerContext;
|
||||
@@ -73,6 +74,9 @@ struct wf_peer_context
|
||||
HANDLE socketEvent;
|
||||
HANDLE socketThread;
|
||||
HANDLE socketSemaphore;
|
||||
|
||||
WTSVirtualChannelManager* vcm;
|
||||
rdpsnd_server_context* rdpsnd;
|
||||
};
|
||||
|
||||
struct wf_server
|
||||
|
||||
69
server/Windows/wf_rdpsnd.c
Normal file
69
server/Windows/wf_rdpsnd.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* FreeRDP Windows Server (Audio Output)
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <freerdp/server/rdpsnd.h>
|
||||
|
||||
#include "wf_rdpsnd.h"
|
||||
|
||||
static const rdpsndFormat test_audio_formats[] =
|
||||
{
|
||||
{ 0x11, 2, 22050, 1024, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 2 channels */
|
||||
{ 0x11, 1, 22050, 512, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 1 channels */
|
||||
{ 0x01, 2, 22050, 4, 16, 0, NULL }, /* PCM, 22050 Hz, 2 channels, 16 bits */
|
||||
{ 0x01, 1, 22050, 2, 16, 0, NULL }, /* PCM, 22050 Hz, 1 channels, 16 bits */
|
||||
{ 0x01, 2, 44100, 4, 16, 0, NULL }, /* PCM, 44100 Hz, 2 channels, 16 bits */
|
||||
{ 0x01, 1, 44100, 2, 16, 0, NULL }, /* PCM, 44100 Hz, 1 channels, 16 bits */
|
||||
{ 0x01, 2, 11025, 4, 16, 0, NULL }, /* PCM, 11025 Hz, 2 channels, 16 bits */
|
||||
{ 0x01, 1, 11025, 2, 16, 0, NULL }, /* PCM, 11025 Hz, 1 channels, 16 bits */
|
||||
{ 0x01, 2, 8000, 4, 16, 0, NULL }, /* PCM, 8000 Hz, 2 channels, 16 bits */
|
||||
{ 0x01, 1, 8000, 2, 16, 0, NULL } /* PCM, 8000 Hz, 1 channels, 16 bits */
|
||||
};
|
||||
|
||||
static void wf_peer_rdpsnd_activated(rdpsnd_server_context* context)
|
||||
{
|
||||
printf("RDPSND Activated\n");
|
||||
}
|
||||
|
||||
BOOL wf_peer_rdpsnd_init(wfPeerContext* context)
|
||||
{
|
||||
context->rdpsnd = rdpsnd_server_context_new(context->vcm);
|
||||
context->rdpsnd->data = context;
|
||||
|
||||
context->rdpsnd->server_formats = test_audio_formats;
|
||||
context->rdpsnd->num_server_formats =
|
||||
sizeof(test_audio_formats) / sizeof(test_audio_formats[0]);
|
||||
|
||||
context->rdpsnd->src_format.wFormatTag = 1;
|
||||
context->rdpsnd->src_format.nChannels = 2;
|
||||
context->rdpsnd->src_format.nSamplesPerSec = 44100;
|
||||
context->rdpsnd->src_format.wBitsPerSample = 16;
|
||||
|
||||
context->rdpsnd->Activated = wf_peer_rdpsnd_activated;
|
||||
|
||||
context->rdpsnd->Initialize(context->rdpsnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
32
server/Windows/wf_rdpsnd.h
Normal file
32
server/Windows/wf_rdpsnd.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* FreeRDP Windows Server (Audio Output)
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* 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 WF_RDPSND_H
|
||||
#define WF_RDPSND_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/listener.h>
|
||||
#include <freerdp/server/rdpsnd.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
|
||||
BOOL wf_peer_rdpsnd_init(wfPeerContext* context);
|
||||
|
||||
#endif /* WF_RDPSND_H */
|
||||
|
||||
Reference in New Issue
Block a user