libfreerdp-core: added --play-rfx option to play RemoteFX data from a file

This commit is contained in:
Marc-André Moreau 2011-08-28 15:51:49 -04:00
parent 53aa938683
commit 5fd35f0402
5 changed files with 46 additions and 0 deletions

View File

@ -298,7 +298,9 @@ struct rdp_settings
boolean frame_acknowledge;
boolean dump_rfx;
boolean play_rfx;
char* dump_rfx_file;
char* play_rfx_file;
boolean remote_app;
uint8 num_icon_caches;

View File

@ -1076,6 +1076,7 @@ struct rdp_update
void* param2;
boolean dump_rfx;
boolean play_rfx;
rdpPcap* pcap_rfx;
pcBeginPaint BeginPaint;

View File

@ -20,6 +20,7 @@
#include "rdp.h"
#include "input.h"
#include "update.h"
#include "surface.h"
#include "transport.h"
#include "connection.h"
@ -46,6 +47,37 @@ boolean freerdp_connect(freerdp* instance)
}
IFCALL(instance->PostConnect, instance);
if (instance->settings->play_rfx)
{
STREAM* s;
rdpUpdate* update;
pcap_record record;
s = stream_new(1024);
instance->update->play_rfx = instance->settings->play_rfx;
instance->update->pcap_rfx = pcap_open(instance->settings->play_rfx_file, False);
update = instance->update;
while (pcap_has_next_record(update->pcap_rfx))
{
pcap_get_next_record_header(update->pcap_rfx, &record);
s->data = xrealloc(s->data, record.length);
record.data = s->data;
s->size = record.length;
pcap_get_next_record_content(update->pcap_rfx, &record);
stream_set_pos(s, 0);
update->BeginPaint(update);
update_recv_surfcmds(update, s->size, s);
update->EndPaint(update);
}
xfree(s->data);
return True;
}
}
return status;

View File

@ -293,6 +293,17 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
settings->dump_rfx_file = xstrdup(argv[index]);
settings->dump_rfx = True;
}
else if (strcmp("--play-rfx", argv[index]) == 0)
{
index++;
if (index == argc)
{
printf("missing file name\n");
return -1;
}
settings->play_rfx_file = xstrdup(argv[index]);
settings->play_rfx = True;
}
else if (strcmp("-m", argv[index]) == 0)
{
settings->mouse_motion = 0;

Binary file not shown.