Skip to content

Commit

Permalink
freerdp: purge deprecated stream utils
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed May 8, 2013
1 parent 64df210 commit 5b92413
Show file tree
Hide file tree
Showing 60 changed files with 2,333 additions and 2,393 deletions.
48 changes: 24 additions & 24 deletions channels/audin/client/audin_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w
UINT32 Version;
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;

stream_read_UINT32(s, Version);
Stream_Read_UINT32(s, Version);

DEBUG_DVC("Version=%d", Version);

out = stream_new(5);
stream_write_BYTE(out, MSG_SNDIN_VERSION);
stream_write_UINT32(out, Version);
Stream_Write_UINT8(out, MSG_SNDIN_VERSION);
Stream_Write_UINT32(out, Version);
error = callback->channel->Write(callback->channel, Stream_GetPosition(s), stream_get_head(s), NULL);
stream_free(out);

Expand Down Expand Up @@ -128,7 +128,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
audinFormat format;
UINT32 cbSizeFormatsPacket;

stream_read_UINT32(s, NumFormats);
Stream_Read_UINT32(s, NumFormats);
DEBUG_DVC("NumFormats %d", NumFormats);
if ((NumFormats < 1) || (NumFormats > 1000))
{
Expand All @@ -147,13 +147,13 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
for (i = 0; i < NumFormats; i++)
{
stream_get_mark(s, fm);
stream_read_UINT16(s, format.wFormatTag);
stream_read_UINT16(s, format.nChannels);
stream_read_UINT32(s, format.nSamplesPerSec);
Stream_Read_UINT16(s, format.wFormatTag);
Stream_Read_UINT16(s, format.nChannels);
Stream_Read_UINT32(s, format.nSamplesPerSec);
Stream_Seek_UINT32(s); /* nAvgBytesPerSec */
stream_read_UINT16(s, format.nBlockAlign);
stream_read_UINT16(s, format.wBitsPerSample);
stream_read_UINT16(s, format.cbSize);
Stream_Read_UINT16(s, format.nBlockAlign);
Stream_Read_UINT16(s, format.wBitsPerSample);
Stream_Read_UINT16(s, format.cbSize);
format.data = Stream_Pointer(s);
Stream_Seek(s, format.cbSize);

Expand All @@ -176,7 +176,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
callback->formats[callback->formats_count++] = format;
/* Put the format to output buffer */
Stream_EnsureRemainingCapacity(out, 18 + format.cbSize);
stream_write(out, fm, 18 + format.cbSize);
Stream_Write(out, fm, 18 + format.cbSize);
}
}

Expand All @@ -185,9 +185,9 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
cbSizeFormatsPacket = Stream_GetPosition(out);
Stream_SetPosition(out, 0);

stream_write_BYTE(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
stream_write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */
stream_write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */
Stream_Write_UINT8(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
Stream_Write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */
Stream_Write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */

error = callback->channel->Write(callback->channel, cbSizeFormatsPacket, stream_get_head(out), NULL);
stream_free(out);
Expand All @@ -202,8 +202,8 @@ static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCall
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;

out = stream_new(5);
stream_write_BYTE(out, MSG_SNDIN_FORMATCHANGE);
stream_write_UINT32(out, NewFormat);
Stream_Write_UINT8(out, MSG_SNDIN_FORMATCHANGE);
Stream_Write_UINT32(out, NewFormat);
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
stream_free(out);

Expand All @@ -217,8 +217,8 @@ static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallbac
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;

out = stream_new(5);
stream_write_BYTE(out, MSG_SNDIN_OPEN_REPLY);
stream_write_UINT32(out, Result);
Stream_Write_UINT8(out, MSG_SNDIN_OPEN_REPLY);
Stream_Write_UINT32(out, Result);
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
stream_free(out);

Expand All @@ -237,8 +237,8 @@ static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
return FALSE;

out = stream_new(size + 1);
stream_write_BYTE(out, MSG_SNDIN_DATA);
stream_write(out, data, size);
Stream_Write_UINT8(out, MSG_SNDIN_DATA);
Stream_Write(out, data, size);
error = callback->channel->Write(callback->channel, Stream_GetPosition(out), stream_get_head(out), NULL);
stream_free(out);

Expand All @@ -253,8 +253,8 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr
UINT32 initialFormat;
UINT32 FramesPerPacket;

stream_read_UINT32(s, FramesPerPacket);
stream_read_UINT32(s, initialFormat);
Stream_Read_UINT32(s, FramesPerPacket);
Stream_Read_UINT32(s, initialFormat);

DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
FramesPerPacket, initialFormat);
Expand Down Expand Up @@ -286,7 +286,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
UINT32 NewFormat;
audinFormat* format;

stream_read_UINT32(s, NewFormat);
Stream_Read_UINT32(s, NewFormat);

DEBUG_DVC("NewFormat=%d", NewFormat);

Expand Down Expand Up @@ -320,7 +320,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
s = stream_new(0);
stream_attach(s, pBuffer, cbSize);

stream_read_BYTE(s, MessageId);
Stream_Read_UINT8(s, MessageId);

DEBUG_DVC("MessageId=0x%x", MessageId);

Expand Down
66 changes: 33 additions & 33 deletions channels/audin/server/audin.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ static void audin_server_select_format(audin_server_context* context, int client

static void audin_server_send_version(audin_server* audin, wStream* s)
{
stream_write_BYTE(s, MSG_SNDIN_VERSION);
stream_write_UINT32(s, 1); /* Version (4 bytes) */
Stream_Write_UINT8(s, MSG_SNDIN_VERSION);
Stream_Write_UINT32(s, 1); /* Version (4 bytes) */
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
}

Expand All @@ -88,7 +88,7 @@ static BOOL audin_server_recv_version(audin_server* audin, wStream* s, UINT32 le
if (length < 4)
return FALSE;

stream_read_UINT32(s, Version);
Stream_Read_UINT32(s, Version);

if (Version < 1)
return FALSE;
Expand All @@ -102,9 +102,9 @@ static void audin_server_send_formats(audin_server* audin, wStream* s)
UINT32 nAvgBytesPerSec;

Stream_SetPosition(s, 0);
stream_write_BYTE(s, MSG_SNDIN_FORMATS);
stream_write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
stream_write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */
Stream_Write_UINT8(s, MSG_SNDIN_FORMATS);
Stream_Write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
Stream_Write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */

for (i = 0; i < audin->context.num_server_formats; i++)
{
Expand All @@ -114,18 +114,18 @@ static void audin_server_send_formats(audin_server* audin, wStream* s)

Stream_EnsureRemainingCapacity(s, 18);

stream_write_UINT16(s, audin->context.server_formats[i].wFormatTag);
stream_write_UINT16(s, audin->context.server_formats[i].nChannels);
stream_write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec);
stream_write_UINT32(s, nAvgBytesPerSec);
stream_write_UINT16(s, audin->context.server_formats[i].nBlockAlign);
stream_write_UINT16(s, audin->context.server_formats[i].wBitsPerSample);
stream_write_UINT16(s, audin->context.server_formats[i].cbSize);
Stream_Write_UINT16(s, audin->context.server_formats[i].wFormatTag);
Stream_Write_UINT16(s, audin->context.server_formats[i].nChannels);
Stream_Write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec);
Stream_Write_UINT32(s, nAvgBytesPerSec);
Stream_Write_UINT16(s, audin->context.server_formats[i].nBlockAlign);
Stream_Write_UINT16(s, audin->context.server_formats[i].wBitsPerSample);
Stream_Write_UINT16(s, audin->context.server_formats[i].cbSize);

if (audin->context.server_formats[i].cbSize)
{
Stream_EnsureRemainingCapacity(s, audin->context.server_formats[i].cbSize);
stream_write(s, audin->context.server_formats[i].data,
Stream_Write(s, audin->context.server_formats[i].data,
audin->context.server_formats[i].cbSize);
}
}
Expand All @@ -140,7 +140,7 @@ static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 le
if (length < 8)
return FALSE;

stream_read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
Stream_Read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
Stream_Seek_UINT32(s); /* cbSizeFormatsPacket (4 bytes) */
length -= 8;

Expand All @@ -159,13 +159,13 @@ static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 le
return FALSE;
}

stream_read_UINT16(s, audin->context.client_formats[i].wFormatTag);
stream_read_UINT16(s, audin->context.client_formats[i].nChannels);
stream_read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec);
Stream_Read_UINT16(s, audin->context.client_formats[i].wFormatTag);
Stream_Read_UINT16(s, audin->context.client_formats[i].nChannels);
Stream_Read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec);
Stream_Seek_UINT32(s); /* nAvgBytesPerSec */
stream_read_UINT16(s, audin->context.client_formats[i].nBlockAlign);
stream_read_UINT16(s, audin->context.client_formats[i].wBitsPerSample);
stream_read_UINT16(s, audin->context.client_formats[i].cbSize);
Stream_Read_UINT16(s, audin->context.client_formats[i].nBlockAlign);
Stream_Read_UINT16(s, audin->context.client_formats[i].wBitsPerSample);
Stream_Read_UINT16(s, audin->context.client_formats[i].cbSize);
if (audin->context.client_formats[i].cbSize > 0)
{
Stream_Seek(s, audin->context.client_formats[i].cbSize);
Expand All @@ -185,21 +185,21 @@ static void audin_server_send_open(audin_server* audin, wStream* s)
audin->opened = TRUE;

Stream_SetPosition(s, 0);
stream_write_BYTE(s, MSG_SNDIN_OPEN);
stream_write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
stream_write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
Stream_Write_UINT8(s, MSG_SNDIN_OPEN);
Stream_Write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
Stream_Write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
/*
* [MS-RDPEAI] 3.2.5.1.6
* The second format specify the format that SHOULD be used to capture data from
* the actual audio input device.
*/
stream_write_UINT16(s, 1); /* wFormatTag = PCM */
stream_write_UINT16(s, 2); /* nChannels */
stream_write_UINT32(s, 44100); /* nSamplesPerSec */
stream_write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
stream_write_UINT16(s, 4); /* nBlockAlign */
stream_write_UINT16(s, 16); /* wBitsPerSample */
stream_write_UINT16(s, 0); /* cbSize */
Stream_Write_UINT16(s, 1); /* wFormatTag = PCM */
Stream_Write_UINT16(s, 2); /* nChannels */
Stream_Write_UINT32(s, 44100); /* nSamplesPerSec */
Stream_Write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
Stream_Write_UINT16(s, 4); /* nBlockAlign */
Stream_Write_UINT16(s, 16); /* wBitsPerSample */
Stream_Write_UINT16(s, 0); /* cbSize */

WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
}
Expand All @@ -211,7 +211,7 @@ static BOOL audin_server_recv_open_reply(audin_server* audin, wStream* s, UINT32
if (length < 4)
return FALSE;

stream_read_UINT32(s, Result);
Stream_Read_UINT32(s, Result);

IFCALL(audin->context.OpenResult, &audin->context, Result);

Expand Down Expand Up @@ -346,7 +346,7 @@ static void* audin_server_thread_func(void* arg)
if (bytes_returned < 1)
continue;

stream_read_BYTE(s, MessageId);
Stream_Read_UINT8(s, MessageId);
bytes_returned--;

switch (MessageId)
Expand Down
18 changes: 9 additions & 9 deletions channels/cliprdr/client/cliprdr_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
if (cb_event->raw_format_data)
{
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, cb_event->raw_format_data_size);
stream_write(s, cb_event->raw_format_data, cb_event->raw_format_data_size);
Stream_Write(s, cb_event->raw_format_data, cb_event->raw_format_data_size);
}
else
{
Expand Down Expand Up @@ -89,12 +89,12 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS

Stream_EnsureRemainingCapacity(body, Stream_Capacity(body) + 4 + name_length);

stream_write_UINT32(body, cb_event->formats[i]);
stream_write(body, name, name_length);
Stream_Write_UINT32(body, cb_event->formats[i]);
Stream_Write(body, name, name_length);
}

s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Capacity(body));
stream_write(s, stream_get_head(body), Stream_Capacity(body));
Stream_Write(s, stream_get_head(body), Stream_Capacity(body));
stream_free(body);
}

Expand Down Expand Up @@ -137,7 +137,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT
{
format_name = &cliprdr->format_names[i];

stream_read_UINT32(s, format_name->id);
Stream_Read_UINT32(s, format_name->id);

if (ascii)
{
Expand Down Expand Up @@ -179,7 +179,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT3
}

format_name = &cliprdr->format_names[cliprdr->num_format_names++];
stream_read_UINT32(s, format_name->id);
Stream_Read_UINT32(s, format_name->id);

format_name->name = NULL;
format_name->length = 0;
Expand Down Expand Up @@ -309,7 +309,7 @@ void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UIN
cb_event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_DataRequest, NULL, NULL);

stream_read_UINT32(s, cb_event->format);
Stream_Read_UINT32(s, cb_event->format);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (wMessage*) cb_event);
}

Expand All @@ -322,7 +322,7 @@ void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_D
if (cb_event->size > 0)
{
s = cliprdr_packet_new(CB_FORMAT_DATA_RESPONSE, CB_RESPONSE_OK, cb_event->size);
stream_write(s, cb_event->data, cb_event->size);
Stream_Write(s, cb_event->data, cb_event->size);
}
else
{
Expand All @@ -339,7 +339,7 @@ void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DA
DEBUG_CLIPRDR("Sending Format Data Request");

s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4);
stream_write_UINT32(s, cb_event->format);
Stream_Write_UINT32(s, cb_event->format);
cliprdr_packet_send(cliprdr, s);
}

Expand Down
Loading

0 comments on commit 5b92413

Please sign in to comment.