Ejemplo n.º 1
0
int
rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
                   const char *buf, int width, int height, int stride_bytes,
                   const struct rfx_rect *regions, int num_regions,
                   const struct rfx_tile *tiles, int num_tiles,
                   const char *quants, int num_quants, int flags)
{
    struct rfxencode *enc;
    STREAM s;

    enc = (struct rfxencode *) handle;

    s.data = (uint8 *) cdata;
    s.p = s.data;
    s.size = *cdata_bytes;

    /* Only the first frame should send the RemoteFX header */
    if ((enc->frame_idx == 0) && (enc->header_processed == 0))
    {
        if (rfx_compose_message_header(enc, &s) != 0)
        {
            return 1;
        }
    }
    if (rfx_compose_message_data(enc, &s, regions, num_regions,
                                 buf, width, height, stride_bytes,
                                 tiles, num_tiles, quants, num_quants,
                                 flags) != 0)
    {
        return 1;
    }
    *cdata_bytes = (int) (s.p - s.data);
    return 0;
}
Ejemplo n.º 2
0
FREERDP_API void rfx_compose_message(RFX_CONTEXT* context, STREAM* s,
	const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height, int rowstride)
{
	/* Only the first frame should send the RemoteFX header */
	if (context->frame_idx == 0 && !context->header_processed)
		rfx_compose_message_header(context, s);

	rfx_compose_message_data(context, s, rects, num_rects, image_data, width, height, rowstride);
}
Ejemplo n.º 3
0
void
test_message(void)
{
	RFX_CONTEXT * context;
	uint8 buffer[1024000];
	int size;
	int i, j;
	RFX_RECT rect = {0, 0, 100, 80};
	RFX_MESSAGE * message;

	rgb_data = (uint8 *) malloc(100 * 80 * 3);
	for (i = 0; i < 80; i++)
		memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 100 * 3);

	context = rfx_context_new();
	context->mode = RLGR3;
	context->width = 800;
	context->height = 600;
	rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB);

	size = rfx_compose_message_header(context, buffer, sizeof(buffer));
	/*hexdump(buffer, size);*/
	message = rfx_process_message(context, buffer, size);
	rfx_message_free(context, message);

	for (i = 0; i < 1000; i++)
	{
		size = rfx_compose_message_data(context, buffer, sizeof(buffer),
			&rect, 1, rgb_data, 100, 80, 100 * 3);
		/*hexdump(buffer, size);*/
		message = rfx_process_message(context, buffer, size);
		if (i == 0)
		{
			for (j = 0; j < message->num_tiles; j++)
			{
				dump_ppm_image(message->tiles[j]->data);
			}
		}
		rfx_message_free(context, message);
	}

	rfx_context_free(context);
	free(rgb_data);
}