Пример #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;
}
Пример #2
0
BOOL tsmf_check_decoder_available(const char* name)
{
	ITSMFDecoder* decoder = NULL;
	BOOL retValue = FALSE;

	if (name)
	{
		decoder = tsmf_load_decoder_by_name(name);
	}
#if defined(WITH_GSTREAMER_1_0) || defined(WITH_GSTREAMER_0_10)
        if (!decoder)
                decoder = tsmf_load_decoder_by_name("gstreamer");
#endif

#if defined(WITH_FFMPEG)
	if (!decoder)
		decoder = tsmf_load_decoder_by_name("ffmpeg");
#endif

	if (decoder)
	{
		decoder->Free(decoder);
		decoder = NULL;
		retValue = TRUE;
	}

	return retValue;
}
Пример #3
0
ITSMFDecoder* tsmf_load_decoder(const char* name, TS_AM_MEDIA_TYPE* media_type)
{
	ITSMFDecoder* decoder = NULL;

	if (name)
	{
		decoder = tsmf_load_decoder_by_name(name);
	}

#if defined(WITH_GSTREAMER_1_0) || defined(WITH_GSTREAMER_0_10)
	if (!decoder)
		decoder = tsmf_load_decoder_by_name("gstreamer");
#endif

#if defined(WITH_FFMPEG)
	if (!decoder)
		decoder = tsmf_load_decoder_by_name("ffmpeg");
#endif

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

	return decoder;
}
Пример #4
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;
}
Пример #5
0
BOOL tsmf_codec_check_media_type(const char* decoder_name, wStream* s)
{
	BYTE* m;
	BOOL ret;
	TS_AM_MEDIA_TYPE mediatype;

	Stream_GetPointer(s, m);
	ret = tsmf_codec_parse_media_type(&mediatype, s);
	Stream_SetPointer(s, m);

	if (ret)
	{
		ITSMFDecoder* decoder = tsmf_load_decoder(decoder_name, &mediatype);

		if (!decoder)
		{
			WLog_WARN(TAG, "Format not supported by decoder %s", decoder_name);
			ret = FALSE;
		}
		else
		{
			decoder->Free(decoder);
		}
	}

	return ret;
}
Пример #6
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;
}