idsueyesrc: fix config-file path handling to work on Windows and Linux
The 5a4b2ce3 commit fixed it for Linux, but broke it for Windows.
This commit is contained in:
parent
8e702a802b
commit
87f20146a6
@ -397,6 +397,24 @@ gst_idsueyesrc_alloc_memory (GstIdsueyeSrc * src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
void *
|
||||||
|
char_to_ids_unicode (const char *str)
|
||||||
|
{
|
||||||
|
size_t newsize = strlen (str) + 1;
|
||||||
|
wchar_t *wcstring = g_new (wchar_t, newsize);
|
||||||
|
size_t convertedChars = 0;
|
||||||
|
mbstowcs_s (&convertedChars, wcstring, newsize, str, _TRUNCATE);
|
||||||
|
return wcstring;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void *
|
||||||
|
char_to_ids_unicode (const char *str)
|
||||||
|
{
|
||||||
|
return g_utf8_to_ucs4 (src->config_file, -1, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_idsueyesrc_start (GstBaseSrc * bsrc)
|
gst_idsueyesrc_start (GstBaseSrc * bsrc)
|
||||||
{
|
{
|
||||||
@ -447,15 +465,15 @@ gst_idsueyesrc_start (GstBaseSrc * bsrc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen (src->config_file)) {
|
if (strlen (src->config_file)) {
|
||||||
gunichar *filepath;
|
void *filepath;
|
||||||
if (!g_file_test (src->config_file, G_FILE_TEST_EXISTS)) {
|
if (!g_file_test (src->config_file, G_FILE_TEST_EXISTS)) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||||
("Camera file does not exist: %s", src->config_file), (NULL));
|
("Camera file does not exist: %s", src->config_file), (NULL));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function requires unicode (wide character) */
|
/* function requires Unicode */
|
||||||
filepath = g_utf8_to_ucs4 (src->config_file, -1, NULL, NULL, NULL);
|
filepath = char_to_ids_unicode (src->config_file);
|
||||||
ret =
|
ret =
|
||||||
is_ParameterSet (src->hCam, IS_PARAMETERSET_CMD_LOAD_FILE, filepath, 0);
|
is_ParameterSet (src->hCam, IS_PARAMETERSET_CMD_LOAD_FILE, filepath, 0);
|
||||||
g_free (filepath);
|
g_free (filepath);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user