Merge branch 'master' of github.com:neutrinolabs/xrdp

This commit is contained in:
Laxmikant Rashinkar 2013-11-06 19:48:34 -08:00
commit e8c2f328fb
5 changed files with 139 additions and 13 deletions

View File

@ -108,6 +108,7 @@ struct xrdp_client_info
int nego_sec_layer; /* 0, 1, 2 = RDP security layer, TLS , Negotiate */
int multimon; /* 0 = deny , 1 = allow */
int monitorCount; /* number of monitors detected (max = 16) */
struct monitor_info minfo[16]; /* client monitor data */
};

View File

@ -540,7 +540,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
{
return 1;
}
in_uint32_le(s, tzone); /* len of timetone */
in_uint32_le(s, tzone); /* len of timezone */
in_uint8s(s, 62); /* skip */
in_uint8s(s, 22); /* skip misc. */
in_uint8s(s, 62); /* skip */
@ -990,17 +990,19 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
g_writeln("monitorCount= %d", monitorCount); // for debugging only
client_info->monitorCount = monitorCount;
/* Add client_monitor_data to client_info struct, will later pass to X11rdp */
for (index = 0; index < monitorCount; index++)
{
in_uint32_le(s, client_info->minfo->left);
in_uint32_le(s, client_info->minfo->top);
in_uint32_le(s, client_info->minfo->right);
in_uint32_le(s, client_info->minfo->bottom);
in_uint32_le(s, client_info->minfo->is_primary);
in_uint32_le(s, client_info->minfo[index].left);
in_uint32_le(s, client_info->minfo[index].top);
in_uint32_le(s, client_info->minfo[index].right);
in_uint32_le(s, client_info->minfo[index].bottom);
in_uint32_le(s, client_info->minfo[index].is_primary);
g_writeln("got a monitor: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d", client_info->minfo->left,
client_info->minfo->top, client_info->minfo->right, client_info->minfo->bottom, client_info->minfo->is_primary);
g_writeln("got a monitor: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d", client_info->minfo[index].left,
client_info->minfo[index].top, client_info->minfo[index].right, client_info->minfo[index].bottom, client_info->minfo[index].is_primary);
}
return 0;
}

View File

@ -149,6 +149,8 @@ static int g_disconnect_scheduled = 0;
static CARD32 g_disconnect_timeout_s = 60; /* 60 seconds */
static CARD32 g_disconnect_time_ms = 0; /* time of disconnect in milliseconds */
static int g_do_multimon = 0; /* multimon - turn on or off */
/******************************************************************************/
static CARD32
rdpDeferredDisconnectCallback(OsTimerPtr timer, CARD32 now, pointer arg)
@ -1103,6 +1105,17 @@ rdpup_process_msg(struct stream *s)
{
LLOGLN(0, (" client can not do new(color) cursor"));
}
if (g_rdpScreen.client_info.monitorCount > 0)
{
LLOGLN(0, (" client can do multimon"));
LLOGLN(0, (" client monitor data, monitorCount= %d", g_rdpScreen.client_info.monitorCount));
g_do_multimon = 1;
}
else
{
LLOGLN(0, (" client can not do multimon"));
g_do_multimon = 0;
}
}
else if (msg_type == 105)
{

View File

@ -28,6 +28,49 @@ PLAYER_STATE_INFO g_psi;
int g_video_index = -1;
int g_audio_index = -1;
/*****************************************************************************/
/* produce a hex dump */
void hexdump(char *p, int len)
{
unsigned char *line;
int i;
int thisline;
int offset;
line = (unsigned char *)p;
offset = 0;
while (offset < len)
{
printf("%04x ", offset);
thisline = len - offset;
if (thisline > 16)
{
thisline = 16;
}
for (i = 0; i < thisline; i++)
{
printf("%02x ", line[i]);
}
for (; i < 16; i++)
{
printf(" ");
}
for (i = 0; i < thisline; i++)
{
printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
printf("\n");
offset += thisline;
line += thisline;
}
}
/**
* initialize the media player
*
@ -45,12 +88,14 @@ xrdpvr_init_player(void *channel, int stream_id, char *filename)
return -1;
}
#if 0
/* send metadata from media file to client */
if (xrdpvr_create_metadata_file(channel, filename))
{
printf("error sending metadata to client\n");
return -1;
}
#endif
/* ask client to get video format from media file */
if (xrdpvr_set_video_format(channel, 101))
@ -244,6 +289,9 @@ xrdpvr_play_media(void *channel, int stream_id, char *filename)
return -1;
}
g_psi.bsfc = av_bitstream_filter_init("h264_mp4toannexb");
printf("g_psi.bsfc %p\n", g_psi.bsfc);
return 0;
}
@ -252,9 +300,13 @@ static int firstVideoPkt = 1;
int xrdpvr_get_frame(void **av_pkt_ret, int *is_video_frame, int *delay_in_us)
{
AVPacket *av_pkt;
double dts;
AVPacket *av_pkt;
double dts;
int error;
AVBitStreamFilterContext *bsfc;
AVPacket new_pkt;
//printf("xrdpvr_get_frame:\n");
/* alloc an AVPacket */
if ((av_pkt = (AVPacket *) malloc(sizeof(AVPacket))) == NULL)
return -1;
@ -292,6 +344,34 @@ int xrdpvr_get_frame(void **av_pkt_ret, int *is_video_frame, int *delay_in_us)
}
else if (av_pkt->stream_index == g_video_index)
{
bsfc = g_psi.bsfc;
printf("hi %p\n", bsfc);
while (bsfc != 0)
{
new_pkt = *av_pkt;
error = av_bitstream_filter_filter(bsfc, g_psi.p_video_codec_ctx, 0,
&new_pkt.data, &new_pkt.size,
av_pkt->data, av_pkt->size,
av_pkt->flags & AV_PKT_FLAG_KEY);
//printf("new size %d\n", new_pkt.size);
//hexdump(new_pkt.data, 32);
//printf("old size %d\n", av_pkt->size);
//hexdump(av_pkt->data, 32);
if (error > 0)
{
av_free_packet(av_pkt);
new_pkt.destruct = av_destruct_packet;
}
else if (error < 0)
{
printf("bitstream filter error\n");
}
*av_pkt = new_pkt;
bsfc = bsfc->next;
}
dts = av_pkt->dts;
//printf("$$$ video raw_dts=%f raw_pts=%f\n", (double) av_pkt->dts, (double) av_pkt->dts);
@ -344,9 +424,14 @@ int send_video_pkt(void *channel, int stream_id, void *pkt_p)
int xrdpvr_play_frame(void *channel, int stream_id, int *videoTimeout, int *audioTimeout)
{
AVPacket av_pkt;
double dts;
int delay_in_us;
AVPacket av_pkt;
double dts;
int delay_in_us;
int error;
AVBitStreamFilterContext *bsfc;
AVPacket new_pkt;
printf("xrdpvr_play_frame:\n");
if (av_read_frame(g_psi.p_format_ctx, &av_pkt) < 0)
{
@ -381,6 +466,29 @@ int xrdpvr_play_frame(void *channel, int stream_id, int *videoTimeout, int *audi
}
else if (av_pkt.stream_index == g_video_index)
{
bsfc = g_psi.bsfc;
printf("hi %p\n", bsfc);
while (bsfc != 0)
{
new_pkt= av_pkt;
error = av_bitstream_filter_filter(bsfc, g_psi.p_video_codec_ctx, 0,
&new_pkt.data, &new_pkt.size,
av_pkt.data, av_pkt.size,
av_pkt.flags & AV_PKT_FLAG_KEY);
// av_pkt.flags & PKT_FLAG_KEY);
if (error > 0)
{
av_free_packet(&av_pkt);
new_pkt.destruct = av_destruct_packet;
}
else if (error < 0)
{
printf("bitstream filter error\n");
}
av_pkt = new_pkt;
bsfc = bsfc->next;
}
xrdpvr_send_video_data(channel, stream_id, av_pkt.size, av_pkt.data);
dts = av_pkt.dts;

View File

@ -217,6 +217,8 @@ typedef struct _player_state_info
AVFrame *frame;
AVPacket avpkt;
AVBitStreamFilterContext *bsfc;
} PLAYER_STATE_INFO;
static int xrdpvr_write_to_client(void *channel, STREAM *s);