Ejemplo n.º 1
0
void tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
{
	LIST_ITEM* item;
	TSMF_STREAM* stream;

	tsmf_presentation_flush(presentation);

	for (item = presentation->stream_list->head; item; item = item->next)
	{
		stream = (TSMF_STREAM*) item->data;
		tsmf_stream_stop(stream);
	}

	tsmf_presentation_restore_last_video_frame(presentation);

	if (presentation->last_rects)
	{
		free(presentation->last_rects);
		presentation->last_rects = NULL;
	}

	presentation->last_num_rects = 0;

	if (presentation->output_rects)
	{
		free(presentation->output_rects);
		presentation->output_rects = NULL;
	}

	presentation->output_num_rects = 0;
}
Ejemplo n.º 2
0
void tsmf_stream_free(TSMF_STREAM* stream)
{
	TSMF_PRESENTATION* presentation = stream->presentation;

	tsmf_stream_stop(stream);
	tsmf_stream_flush(stream);

	WaitForSingleObject(presentation->mutex, INFINITE);
	list_remove(presentation->stream_list, stream);
	ReleaseMutex(presentation->mutex);

	Queue_Free(stream->sample_list);
	Queue_Free(stream->sample_ack_list);

	if (stream->decoder)
	{
		stream->decoder->Free(stream->decoder);
		stream->decoder = 0;
	}

	SetEvent(stream->thread);

	free(stream);
	stream = 0;
}
Ejemplo n.º 3
0
void _tsmf_stream_free(TSMF_STREAM *stream)
{
	assert(stream);
	tsmf_stream_stop(stream);
	tsmf_stream_flush(stream);
	SetEvent(stream->stopEvent);

	if (stream->play_thread)
	{
		WaitForSingleObject(stream->play_thread, INFINITE);
		CloseHandle(stream->play_thread);
		stream->play_thread = NULL;
	}

	if (stream->ack_thread)
	{
		WaitForSingleObject(stream->ack_thread, INFINITE);
		CloseHandle(stream->ack_thread);
		stream->ack_thread = NULL;
	}

	Queue_Free(stream->sample_list);
	Queue_Free(stream->sample_ack_list);

	if (stream->decoder && stream->decoder->Free)
	{
		stream->decoder->Free(stream->decoder);
		stream->decoder = NULL;
	}

	CloseHandle(stream->stopEvent);
	CloseHandle(stream->ready);
	memset(stream, 0, sizeof(TSMF_STREAM));
	free(stream);
}
Ejemplo n.º 4
0
void _tsmf_stream_free(void* obj)
{
	TSMF_STREAM* stream = (TSMF_STREAM*)obj;

	if (!stream)
		return;

	tsmf_stream_stop(stream);
	SetEvent(stream->stopEvent);

	if (stream->play_thread)
	{
		if (WaitForSingleObject(stream->play_thread, INFINITE) == WAIT_FAILED)
		{
			WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"!", GetLastError());
			return;
		}

		CloseHandle(stream->play_thread);
		stream->play_thread = NULL;
	}

	if (stream->ack_thread)
	{
		if (WaitForSingleObject(stream->ack_thread, INFINITE) == WAIT_FAILED)
		{
			WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"!", GetLastError());
			return;
		}

		CloseHandle(stream->ack_thread);
		stream->ack_thread = NULL;
	}

	Queue_Free(stream->sample_list);
	Queue_Free(stream->sample_ack_list);

	if (stream->decoder && stream->decoder->Free)
	{
		stream->decoder->Free(stream->decoder);
		stream->decoder = NULL;
	}

	CloseHandle(stream->stopEvent);
	CloseHandle(stream->ready);
	ZeroMemory(stream, sizeof(TSMF_STREAM));
	free(stream);
}
Ejemplo n.º 5
0
void tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
{
	UINT32 index;
	UINT32 count;
	TSMF_STREAM* stream;
	tsmf_presentation_flush(presentation);
	ArrayList_Lock(presentation->stream_list);
	count = ArrayList_Count(presentation->stream_list);

	for (index = 0; index < count; index++)
	{
		stream = (TSMF_STREAM *) ArrayList_GetItem(presentation->stream_list, index);
		tsmf_stream_stop(stream);
	}

	ArrayList_Unlock(presentation->stream_list);
}
Ejemplo n.º 6
0
BOOL tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
{
	UINT32 index;
	UINT32 count;
	TSMF_STREAM* stream;
	BOOL ret = TRUE;
	ArrayList_Lock(presentation->stream_list);
	count = ArrayList_Count(presentation->stream_list);

	for (index = 0; index < count; index++)
	{
		stream = (TSMF_STREAM*) ArrayList_GetItem(presentation->stream_list, index);
		ret &= tsmf_stream_stop(stream);
	}

	ArrayList_Unlock(presentation->stream_list);
	presentation->audio_start_time = 0;
	presentation->audio_end_time = 0;
	return ret;
}