Beispiel #1
0
static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name, TS_AM_MEDIA_TYPE* media_type)
{
	ITSMFDecoder* decoder;
	TSMF_DECODER_ENTRY entry;
	char* fullname;

	if (strrchr(name, '.') != NULL)
		entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(name, TSMF_DECODER_EXPORT_FUNC_NAME);
	else
	{
		fullname = xzalloc(strlen(name) + 6);
		strcpy(fullname, "tsmf_");
		strcat(fullname, name);
		entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(fullname, TSMF_DECODER_EXPORT_FUNC_NAME);
		free(fullname);
	}
	if (entry == NULL)
	{
		return NULL;
	}

	decoder = entry();
	if (decoder == NULL)
	{
		DEBUG_WARN("failed to call export function in %s", name);
		return NULL;
	}
	if (!decoder->SetFormat(decoder, media_type))
	{
		decoder->Free(decoder);
		decoder = NULL;
	}
	return decoder;
}
Beispiel #2
0
static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name, TS_AM_MEDIA_TYPE* media_type)
{
	ITSMFDecoder* decoder;
	TSMF_DECODER_ENTRY entry;

	entry = (TSMF_DECODER_ENTRY) freerdp_load_channel_addin_entry("tsmf", (LPSTR) name, "decoder", 0);

	if (entry == NULL)
		return NULL;

	decoder = entry();

	if (decoder == NULL)
	{
		DEBUG_WARN("failed to call export function in %s", name);
		return NULL;
	}

	if (!decoder->SetFormat(decoder, media_type))
	{
		decoder->Free(decoder);
		decoder = NULL;
	}

	return decoder;
}
Beispiel #3
0
static ITSMFDecoder *
tsmf_load_decoder_by_name(const char * name, TS_AM_MEDIA_TYPE * media_type)
{
	ITSMFDecoder * decoder;
	char path[256];
	void * han;
	TSMF_DECODER_ENTRY entry;

	if (strchr(name, PATH_SEPARATOR) == NULL)
	{
		snprintf(path, sizeof(path), PLUGIN_PATH "/tsmf_%s." PLUGIN_EXT, name);
	}
	else
	{
		snprintf(path, sizeof(path), "%s", name);
	}
	han = DLOPEN(path);
	LLOGLN(0, ("tsmf_load_decoder_by_name: %s", path));
	if (han == NULL)
	{
		LLOGLN(0, ("tsmf_load_decoder_by_name: failed to load %s", path));
		return NULL;
	}
	entry = (TSMF_DECODER_ENTRY) DLSYM(han, TSMF_DECODER_EXPORT_FUNC_NAME);
	if (entry == NULL)
	{
		DLCLOSE(han);
		LLOGLN(0, ("tsmf_load_decoder_by_name: failed to find export function in %s", path));
		return NULL;
	}
	decoder = entry();
	if (decoder == NULL)
	{
		DLCLOSE(han);
		LLOGLN(0, ("tsmf_load_decoder_by_name: failed to call export function in %s", path));
		return NULL;
	}
	if (decoder->SetFormat(decoder, media_type) != 0)
	{
		decoder->Free(decoder);
		decoder = NULL;
	}
	return decoder;
}