From cde7de8b97b7435cfab098e470e6b9e1af203dce Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Tue, 2 Oct 2018 07:36:53 -0400 Subject: [PATCH] pixcisrc: only use format-file if specified, ignoring format-name --- sys/pixci/gstpixcisrc.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/pixci/gstpixcisrc.c b/sys/pixci/gstpixcisrc.c index b93cdd1..bac6ef1 100644 --- a/sys/pixci/gstpixcisrc.c +++ b/sys/pixci/gstpixcisrc.c @@ -504,26 +504,30 @@ gst_pixcisrc_start (GstBaseSrc * bsrc) { GstPixciSrc *src = GST_PIXCI_SRC (bsrc); int pxerr; - GEnumClass *video_format_enum_class; - GEnumValue *video_format_enum_value; GST_DEBUG_OBJECT (src, "start"); - if (strlen (src->format_file) - && !g_file_test (src->format_file, G_FILE_TEST_EXISTS)) { - GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, - ("Format file does not exist: %s", src->format_file), (NULL)); - return FALSE; + /* open with either a format name or config file */ + if (strlen (src->format_file)) { + if (!g_file_test (src->format_file, G_FILE_TEST_EXISTS)) { + GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, + ("Format file does not exist: %s", src->format_file), (NULL)); + return FALSE; + } + + pxerr = pxd_PIXCIopen (src->driver_params, NULL, src->format_file); + } else { + GEnumClass *video_format_enum_class; + GEnumValue *video_format_enum_value; + video_format_enum_class = g_type_class_ref (GST_TYPE_PIXCI_VIDEO_FORMAT); + video_format_enum_value = + g_enum_get_value (video_format_enum_class, src->format_name); + pxerr = + pxd_PIXCIopen (src->driver_params, video_format_enum_value->value_name, + NULL); + g_type_class_unref (video_format_enum_class); } - /* open XCLIB library and driver */ - video_format_enum_class = g_type_class_ref (GST_TYPE_PIXCI_VIDEO_FORMAT); - video_format_enum_value = - g_enum_get_value (video_format_enum_class, src->format_name); - pxerr = - pxd_PIXCIopen (src->driver_params, video_format_enum_value->value_name, - src->format_file); - g_type_class_unref (video_format_enum_class); if (pxerr) { char buf[1024]; pxd_mesgFaultText (src->unitmap, buf, 1024);