Beispiel #1
0
int tsmf_ifman_remove_stream(TSMF_IFMAN* ifman)
{
	int status = 0;
	UINT32 StreamId;
	TSMF_STREAM* stream;
	TSMF_PRESENTATION* presentation;

	DEBUG_DVC("");

	presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));
	Stream_Seek(ifman->input, 16);

	if (presentation == NULL)
	{
		status = 1;
	}
	else
	{
		Stream_Read_UINT32(ifman->input, StreamId);
		stream = tsmf_stream_find_by_id(presentation, StreamId);
		if (stream)
			tsmf_stream_free(stream);
		else
			status = 1;
	}

	ifman->output_pending = TRUE;

	return status;
}
Beispiel #2
0
/**
 * 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;
}
Beispiel #3
0
void tsmf_presentation_free(TSMF_PRESENTATION* presentation)
{
	TSMF_STREAM* stream;

	tsmf_presentation_stop(presentation);
	WaitForSingleObject(presentation->mutex, INFINITE);
	list_remove(presentation_list, presentation);
	ReleaseMutex(presentation->mutex);

	while (list_size(presentation->stream_list) > 0)
	{
		stream = (TSMF_STREAM*) list_dequeue(presentation->stream_list);
		tsmf_stream_free(stream);
	}
	list_free(presentation->stream_list);

	CloseHandle(presentation->mutex);

	free(presentation);
}
Beispiel #4
0
static int tsmf_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
	TSMF_STREAM* stream;
	TSMF_PRESENTATION* presentation;
	TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback;

	DEBUG_DVC("");

	if (callback->stream_id)
	{
		presentation = tsmf_presentation_find_by_id(callback->presentation_id);
		if (presentation)
		{
			stream = tsmf_stream_find_by_id(presentation, callback->stream_id);
			if (stream)
				tsmf_stream_free(stream);
		}
	}
	xfree(pChannelCallback);

	return 0;
}
Beispiel #5
0
static void tsmf_signal_handler(int s)
{
	LIST_ITEM* p_item;
	TSMF_PRESENTATION* presentation;
	LIST_ITEM* s_item;
	TSMF_STREAM* _stream;

	WaitForSingleObject(tsmf_mutex, INFINITE);
	TERMINATING = 1;
	ReleaseMutex(tsmf_mutex);

	if (presentation_list)
	{
		for (p_item = presentation_list->head; p_item; p_item = p_item->next)
		{
			presentation = (TSMF_PRESENTATION*) p_item->data;
			for (s_item = presentation->stream_list->head; s_item; s_item = s_item->next)
			{
				_stream = (TSMF_STREAM*) s_item->data;
				tsmf_stream_free(_stream);
			}
			tsmf_presentation_free(presentation);
		}
	}

	unlink("/tmp/tsmf.tid");

	if (s == SIGINT)
	{
		signal(s, SIG_DFL);
		kill(getpid(), s);
	}
	else if (s == SIGUSR1)
	{
		signal(s, SIG_DFL);
	}
}
Beispiel #6
0
int
tsmf_ifman_remove_stream(TSMF_IFMAN * ifman)
{
	TSMF_PRESENTATION * presentation;
	TSMF_STREAM * stream;
	uint32 StreamId;
	int error = 0;

	LLOGLN(0, ("tsmf_ifman_remove_stream:"));
	presentation = tsmf_presentation_find_by_id(ifman->input_buffer);
	if (presentation == NULL)
		error = 1;
	else
	{
		StreamId = GET_UINT32(ifman->input_buffer, 16);
		stream = tsmf_stream_find_by_id(presentation, StreamId);
		if (stream)
			tsmf_stream_free(stream);
		else
			error = 1;
	}
	ifman->output_pending = 1;
	return error;
}