From 5a4b2ce38ccb595094af5e07add7e700f09ae4ba Mon Sep 17 00:00:00 2001 From: fehlfarbe Date: Tue, 12 May 2020 01:00:19 +0200 Subject: [PATCH] idsueyesrc: fix config-file path handling on Linux Couldn't load config-file. Also added additional debug info and changed filepath conversion to UCS4. Fixes #31 --- sys/idsueye/gstidsueyesrc.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/idsueye/gstidsueyesrc.c b/sys/idsueye/gstidsueyesrc.c index b5faf3b..efbbb7d 100644 --- a/sys/idsueye/gstidsueyesrc.c +++ b/sys/idsueye/gstidsueyesrc.c @@ -447,7 +447,7 @@ gst_idsueyesrc_start (GstBaseSrc * bsrc) } if (strlen (src->config_file)) { - gunichar2 *filepath; + gunichar *filepath; if (!g_file_test (src->config_file, G_FILE_TEST_EXISTS)) { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("Camera file does not exist: %s", src->config_file), (NULL)); @@ -455,11 +455,29 @@ gst_idsueyesrc_start (GstBaseSrc * bsrc) } /* function requires unicode (wide character) */ - filepath = g_utf8_to_utf16 (src->config_file, -1, NULL, NULL, NULL); + filepath = g_utf8_to_ucs4 (src->config_file, -1, NULL, NULL, NULL); ret = is_ParameterSet (src->hCam, IS_PARAMETERSET_CMD_LOAD_FILE, filepath, 0); g_free (filepath); if (ret != IS_SUCCESS) { + switch (ret) { + case IS_INCOMPATIBLE_SETTING: + GST_ELEMENT_WARNING (src, RESOURCE, OPEN_READ, + ("IS_INCOMPATIBLE_SETTING: incompatible setting"), (NULL)); + break; + case IS_INVALID_CAMERA_TYPE: + GST_ELEMENT_WARNING (src, RESOURCE, OPEN_READ, + ("IS_INVALID_CAMERA_TYPE: invalid camera type"), (NULL)); + break; + case IS_NO_SUCCESS: + GST_ELEMENT_WARNING (src, RESOURCE, OPEN_READ, + ("IS_NO_SUCCESS: general error"), (NULL)); + break; + default: + GST_ELEMENT_WARNING (src, RESOURCE, OPEN_READ, + ("UNKNOWN ERROR: return value=%d", ret), (NULL)); + break; + } GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("Failed to load parameter file: %s", src->config_file), (NULL)); return FALSE;