当前位置: 首页>>代码示例>>C++>>正文


C++ Stream_Seek函数代码示例

本文整理汇总了C++中Stream_Seek函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Seek函数的具体用法?C++ Stream_Seek怎么用?C++ Stream_Seek使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Stream_Seek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tsmf_ifman_remove_stream

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
UINT tsmf_ifman_remove_stream(TSMF_IFMAN* ifman)
{
	int status = CHANNEL_RC_OK;
	UINT32 StreamId;
	TSMF_STREAM* stream;
	TSMF_PRESENTATION* presentation;

	DEBUG_TSMF("");

	if (Stream_GetRemainingLength(ifman->input) < 20)
		return ERROR_INVALID_DATA;

	presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));

	Stream_Seek(ifman->input, GUID_SIZE);

	if (!presentation)
	{
		status = ERROR_NOT_FOUND;
	}
	else
	{
		Stream_Read_UINT32(ifman->input, StreamId);
		stream = tsmf_stream_find_by_id(presentation, StreamId);

		if (stream)
			tsmf_stream_free(stream);
		else
			status = ERROR_NOT_FOUND;
	}

	ifman->output_pending = TRUE;

	return status;
}
开发者ID:artemh,项目名称:FreeRDP,代码行数:40,代码来源:tsmf_ifman.c

示例2: tsmf_ifman_set_source_video_rect

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
UINT tsmf_ifman_set_source_video_rect(TSMF_IFMAN* ifman)
{
	UINT status = CHANNEL_RC_OK;
	float Left, Top;
	float Right, Bottom;
	TSMF_PRESENTATION* presentation;

	DEBUG_TSMF("");

	if (Stream_GetRemainingLength(ifman->input) < 32)
		return ERROR_INVALID_DATA;

	presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));

	Stream_Seek(ifman->input, GUID_SIZE);

	if (!presentation)
	{
		status = ERROR_NOT_FOUND;
	}
	else
	{
		Left = tsmf_stream_read_float(ifman->input); /* Left (4 bytes) */
		Top = tsmf_stream_read_float(ifman->input); /* Top (4 bytes) */
		Right = tsmf_stream_read_float(ifman->input); /* Right (4 bytes) */
		Bottom = tsmf_stream_read_float(ifman->input); /* Bottom (4 bytes) */
		DEBUG_TSMF("SetSourceVideoRect: Left: %f Top: %f Right: %f Bottom: %f",
				   Left, Top, Right, Bottom);
	}

	ifman->output_pending = TRUE;

	return status;
}
开发者ID:artemh,项目名称:FreeRDP,代码行数:39,代码来源:tsmf_ifman.c

示例3: tsmf_codec_parse_VIDEOINFOHEADER

/* http://msdn.microsoft.com/en-us/library/dd390700.aspx */
static UINT32 tsmf_codec_parse_VIDEOINFOHEADER(TS_AM_MEDIA_TYPE *mediatype, wStream *s)
{
	/*
	typedef struct tagVIDEOINFOHEADER {
	  RECT             rcSource;			//16
	  RECT             rcTarget;			//16	32
	  DWORD            dwBitRate;			//4	36
	  DWORD            dwBitErrorRate;		//4	40
	  REFERENCE_TIME   AvgTimePerFrame;		//8	48
	  BITMAPINFOHEADER bmiHeader;
	} VIDEOINFOHEADER;
	*/
	UINT64 AvgTimePerFrame;
	/* VIDEOINFOHEADER.rcSource, RECT(LONG left, LONG top, LONG right, LONG bottom) */
	Stream_Seek_UINT32(s);
	Stream_Seek_UINT32(s);
	Stream_Read_UINT32(s, mediatype->Width);
	Stream_Read_UINT32(s, mediatype->Height);
	/* VIDEOINFOHEADER.rcTarget */
	Stream_Seek(s, 16);
	/* VIDEOINFOHEADER.dwBitRate */
	Stream_Read_UINT32(s, mediatype->BitRate);
	/* VIDEOINFOHEADER.dwBitErrorRate */
	Stream_Seek_UINT32(s);
	/* VIDEOINFOHEADER.AvgTimePerFrame */
	Stream_Read_UINT64(s, AvgTimePerFrame);
	mediatype->SamplesPerSecond.Numerator = 1000000;
	mediatype->SamplesPerSecond.Denominator = (int)(AvgTimePerFrame / 10LL);
	return 48;
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:31,代码来源:tsmf_codec.c

示例4: remdesk_read_channel_header

static int remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
	int status;
	UINT32 ChannelNameLen;
	char* pChannelName = NULL;

	if (Stream_GetRemainingLength(s) < 8)
		return -1;

	Stream_Read_UINT32(s, ChannelNameLen); /* ChannelNameLen (4 bytes) */
	Stream_Read_UINT32(s, header->DataLength); /* DataLen (4 bytes) */

	if (ChannelNameLen > 64)
		return -1;

	if ((ChannelNameLen % 2) != 0)
		return -1;

	if (Stream_GetRemainingLength(s) < ChannelNameLen)
		return -1;

	ZeroMemory(header->ChannelName, sizeof(header->ChannelName));

	pChannelName = (char*) header->ChannelName;
	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),
			ChannelNameLen / 2, &pChannelName, 32, NULL, NULL);

	Stream_Seek(s, ChannelNameLen);

	if (status <= 0)
		return -1;

	return 1;
}
开发者ID:Distrotech,项目名称:FreeRDP,代码行数:34,代码来源:remdesk_main.c

示例5: rdg_process_handshake_response

BOOL rdg_process_handshake_response(rdpRdg* rdg, wStream* s)
{
	HRESULT errorCode;

	WLog_DBG(TAG, "Handshake response received");

	if (rdg->state != RDG_CLIENT_STATE_HANDSHAKE)
	{
		return FALSE;
	}

	if (Stream_GetRemainingLength(s) < 12)
		return FALSE;

	Stream_Seek(s, 8);
	Stream_Read_UINT32(s, errorCode);

	if (FAILED(errorCode))
	{
		WLog_DBG(TAG, "Handshake error %x", errorCode);
		return FALSE;
	}

	return rdg_send_tunnel_request(rdg);
}
开发者ID:bceverly,项目名称:FreeRDP,代码行数:25,代码来源:rdg.c

示例6: rdg_process_channel_response

BOOL rdg_process_channel_response(rdpRdg* rdg, wStream* s)
{
	HRESULT errorCode;

	WLog_DBG(TAG, "Channel response received");

	if (rdg->state != RDG_CLIENT_STATE_CHANNEL_CREATE)
	{
		return FALSE;
	}

	if (Stream_GetRemainingLength(s) < 12)
		return FALSE;

	Stream_Seek(s, 8);
	Stream_Read_UINT32(s, errorCode);

	if (FAILED(errorCode))
	{
		WLog_DBG(TAG, "Channel error %x", errorCode);
		return FALSE;
	}

	rdg->state = RDG_CLIENT_STATE_OPENED;

	return TRUE;
}
开发者ID:bceverly,项目名称:FreeRDP,代码行数:27,代码来源:rdg.c

示例7: rdg_process_tunnel_authorization_response

BOOL rdg_process_tunnel_authorization_response(rdpRdg* rdg, wStream* s)
{
	HRESULT errorCode;

	WLog_DBG(TAG, "Tunnel authorization received");

	if (rdg->state != RDG_CLIENT_STATE_TUNNEL_AUTHORIZE)
	{
		return FALSE;
	}

	if (Stream_GetRemainingLength(s) < 12)
		return FALSE;

	Stream_Seek(s, 8);
	Stream_Read_UINT32(s, errorCode);

	if (FAILED(errorCode))
	{
		WLog_DBG(TAG, "Tunnel authorization error %x", errorCode);
		return FALSE;
	}

	return rdg_send_channel_create(rdg);
}
开发者ID:bceverly,项目名称:FreeRDP,代码行数:25,代码来源:rdg.c

示例8: tsmf_ifman_on_stream_volume

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
UINT tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman)
{
	TSMF_PRESENTATION* presentation;
	UINT32 newVolume;
	UINT32 muted;

	DEBUG_TSMF("on stream volume");

	if (Stream_GetRemainingLength(ifman->input) < GUID_SIZE + 8)
		return ERROR_INVALID_DATA;

	presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));

	if (!presentation)
	{
		WLog_ERR(TAG, "unknown presentation id");
		return ERROR_NOT_FOUND;
	}

	Stream_Seek(ifman->input, 16);
	Stream_Read_UINT32(ifman->input, newVolume);
	DEBUG_TSMF("on stream volume: new volume=[%d]", newVolume);
	Stream_Read_UINT32(ifman->input, muted);
	DEBUG_TSMF("on stream volume: muted=[%d]", muted);

	if (!tsmf_presentation_volume_changed(presentation, newVolume, muted))
		return ERROR_INVALID_OPERATION;

	ifman->output_pending = TRUE;

	return 0;
}
开发者ID:artemh,项目名称:FreeRDP,代码行数:37,代码来源:tsmf_ifman.c

示例9: input_recv_keyboard_event

static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s)
{
	UINT16 keyboardFlags, keyCode;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
	Stream_Read_UINT16(s, keyCode); /* keyCode (2 bytes) */
	Stream_Seek(s, 2); /* pad2Octets (2 bytes) */

	/**
	 * Note: A lot of code in FreeRDP and in dependent projects checks the
	 * KBDFLAGS_DOWN flag in order to detect a key press.
	 * According to the specs only the absence of the slow-path
	 * KBDFLAGS_RELEASE flag indicates a key-down event.
	 * The slow-path KBDFLAGS_DOWN flag merely indicates that the key was
	 * down prior to this event.
	 * The checks for KBDFLAGS_DOWN only work successfully because the code
	 * handling the fast-path keyboard input sets the KBDFLAGS_DOWN flag if
	 * the FASTPATH_INPUT_KBDFLAGS_RELEASE flag is missing.
	 * Since the same input callback is used for slow- and fast-path events
	 * we have to follow that "convention" here.
	 */

	if (keyboardFlags & KBD_FLAGS_RELEASE)
		keyboardFlags &= ~KBD_FLAGS_DOWN;
	else
		keyboardFlags |= KBD_FLAGS_DOWN;

	IFCALL(input->KeyboardEvent, input, keyboardFlags, keyCode);

	return TRUE;
}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:34,代码来源:input.c

示例10: input_recv_event

static BOOL input_recv_event(rdpInput* input, wStream* s)
{
	UINT16 messageType;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Seek(s, 4); /* eventTime (4 bytes), ignored by the server */
	Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */

	switch (messageType)
	{
		case INPUT_EVENT_SYNC:
			if (!input_recv_sync_event(input, s))
				return FALSE;
			break;

		case INPUT_EVENT_SCANCODE:
			if (!input_recv_keyboard_event(input, s))
				return FALSE;
			break;

		case INPUT_EVENT_UNICODE:
			if (!input_recv_unicode_keyboard_event(input, s))
				return FALSE;
			break;

		case INPUT_EVENT_MOUSE:
			if (!input_recv_mouse_event(input, s))
				return FALSE;
			break;

		case INPUT_EVENT_MOUSEX:
			if (!input_recv_extended_mouse_event(input, s))
				return FALSE;
			break;

		default:
			fprintf(stderr, "Unknown messageType %u\n", messageType);
			/* Each input event uses 6 bytes. */
			Stream_Seek(s, 6);
			break;
	}

	return TRUE;
}
开发者ID:pevik,项目名称:debian-freerdp,代码行数:46,代码来源:input.c

示例11: rdp_message_channel_pdu_init

wStream* rdp_message_channel_pdu_init(rdpRdp* rdp)
{
    wStream* s;
    s = transport_send_stream_init(rdp->transport, 2048);
    Stream_Seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
    rdp_security_stream_init(rdp, s);
    return s;
}
开发者ID:JozLes77,项目名称:FreeRDP,代码行数:8,代码来源:rdp.c

示例12: rdpgfx_recv_wire_to_surface_1_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_recv_wire_to_surface_1_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
{
	RDPGFX_SURFACE_COMMAND cmd;
	RDPGFX_WIRE_TO_SURFACE_PDU_1 pdu;
	RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
	UINT error;

	if (Stream_GetRemainingLength(s) < 17)
	{
		WLog_ERR(TAG, "not enough data!");
		return ERROR_INVALID_DATA;
	}

	Stream_Read_UINT16(s, pdu.surfaceId); /* surfaceId (2 bytes) */
	Stream_Read_UINT16(s, pdu.codecId); /* codecId (2 bytes) */
	Stream_Read_UINT8(s, pdu.pixelFormat); /* pixelFormat (1 byte) */

	if ((error = rdpgfx_read_rect16(s, &(pdu.destRect)))) /* destRect (8 bytes) */
	{
		WLog_ERR(TAG, "rdpgfx_read_rect16 failed with error %lu", error);
		return error;
	}

	Stream_Read_UINT32(s, pdu.bitmapDataLength); /* bitmapDataLength (4 bytes) */

	if (pdu.bitmapDataLength > Stream_GetRemainingLength(s))
	{
		WLog_ERR(TAG, "not enough data!");
		return ERROR_INVALID_DATA;
	}

	pdu.bitmapData = Stream_Pointer(s);
	Stream_Seek(s, pdu.bitmapDataLength);

	WLog_DBG(TAG, "RecvWireToSurface1Pdu: surfaceId: %d codecId: %s (0x%04X) pixelFormat: 0x%04X "
			"destRect: left: %d top: %d right: %d bottom: %d bitmapDataLength: %d",
			(int) pdu.surfaceId, rdpgfx_get_codec_id_string(pdu.codecId), pdu.codecId, pdu.pixelFormat,
			pdu.destRect.left, pdu.destRect.top, pdu.destRect.right, pdu.destRect.bottom,
			pdu.bitmapDataLength);

	cmd.surfaceId = pdu.surfaceId;
	cmd.codecId = pdu.codecId;
	cmd.contextId = 0;
	cmd.format = pdu.pixelFormat;
	cmd.left = pdu.destRect.left;
	cmd.top = pdu.destRect.top;
	cmd.right = pdu.destRect.right;
	cmd.bottom = pdu.destRect.bottom;
	cmd.width = cmd.right - cmd.left;
	cmd.height = cmd.bottom - cmd.top;
	cmd.length = pdu.bitmapDataLength;
	cmd.data = pdu.bitmapData;

	if ((error = rdpgfx_decode(gfx, &cmd)))
		WLog_ERR(TAG, "rdpgfx_decode failed with error %lu!", error);

	return error;
}
开发者ID:BrianChangchien,项目名称:FiWoRDC,代码行数:63,代码来源:rdpgfx_main.c

示例13: transport_write

int transport_write(rdpTransport* transport, wStream* s)
{
	int status = -1;
	int length;

	length = Stream_GetPosition(s);
	Stream_SetPosition(s, 0);

#ifdef WITH_DEBUG_TRANSPORT
	if (length > 0)
	{
		fprintf(stderr, "Local > Remote\n");
		winpr_HexDump(s->buffer, length);
	}
#endif

	while (length > 0)
	{
		if (transport->layer == TRANSPORT_LAYER_TLS)
			status = tls_write(transport->TlsOut, Stream_Pointer(s), length);
		else if (transport->layer == TRANSPORT_LAYER_TCP)
			status = tcp_write(transport->TcpOut, Stream_Pointer(s), length);
		else if (transport->layer == TRANSPORT_LAYER_TSG)
			status = tsg_write(transport->tsg, Stream_Pointer(s), length);

		if (status < 0)
			break; /* error occurred */

		if (status == 0)
		{
			/* when sending is blocked in nonblocking mode, the receiving buffer should be checked */
			if (!transport->blocking)
			{
				/* and in case we do have buffered some data, we set the event so next loop will get it */
				if (transport_read_nonblocking(transport) > 0)
					SetEvent(transport->ReceiveEvent);
			}

			if (transport->layer == TRANSPORT_LAYER_TLS)
				tls_wait_write(transport->TlsOut);
			else if (transport->layer == TRANSPORT_LAYER_TCP)
				tcp_wait_write(transport->TcpOut);
			else
				USleep(transport->SleepInterval);
		}

		length -= status;
		Stream_Seek(s, status);
	}

	if (status < 0)
	{
		/* A write error indicates that the peer has dropped the connection */
		transport->layer = TRANSPORT_LAYER_CLOSED;
	}

	return status;
}
开发者ID:Nigel62,项目名称:FreeRDP,代码行数:58,代码来源:transport.c

示例14: rdp_recv_logon_plain_notify

BOOL rdp_recv_logon_plain_notify(rdpRdp* rdp, wStream* s)
{
	if (Stream_GetRemainingLength(s) < 576)
		return FALSE;

	Stream_Seek(s, 576); /* pad */

	return TRUE;
}
开发者ID:pevik,项目名称:debian-freerdp,代码行数:9,代码来源:info.c

示例15: rail_pdu_init

wStream* rail_pdu_init(size_t length)
{
	wStream* s;
	s = Stream_New(NULL, length + RAIL_PDU_HEADER_LENGTH);
	if (!s)
		return NULL;
	Stream_Seek(s, RAIL_PDU_HEADER_LENGTH);
	return s;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:9,代码来源:rail_common.c


注:本文中的Stream_Seek函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。