pylonsrc: add in the testimagesource parameter to allow for custom image source
This commit is contained in:
parent
8900eeb73c
commit
ee440aa927
@ -144,6 +144,7 @@ typedef enum _GST_PYLONSRC_PROP
|
|||||||
PROP_GAMMA,
|
PROP_GAMMA,
|
||||||
PROP_RESET,
|
PROP_RESET,
|
||||||
PROP_TESTIMAGE,
|
PROP_TESTIMAGE,
|
||||||
|
PROP_TESTIMAGESOURCE,
|
||||||
PROP_CONTINUOUSMODE,
|
PROP_CONTINUOUSMODE,
|
||||||
PROP_PIXEL_FORMAT,
|
PROP_PIXEL_FORMAT,
|
||||||
PROP_USERID,
|
PROP_USERID,
|
||||||
@ -340,6 +341,7 @@ ascii_strdown (gchar * *str, gssize len)
|
|||||||
#define DEFAULT_PROP_GAMMA 1.0
|
#define DEFAULT_PROP_GAMMA 1.0
|
||||||
#define DEFAULT_PROP_RESET "off"
|
#define DEFAULT_PROP_RESET "off"
|
||||||
#define DEFAULT_PROP_TESTIMAGE 0
|
#define DEFAULT_PROP_TESTIMAGE 0
|
||||||
|
#define DEFAULT_PROP_TESTIMAGESOURCE ""
|
||||||
#define DEFAULT_PROP_CONTINUOUSMODE TRUE
|
#define DEFAULT_PROP_CONTINUOUSMODE TRUE
|
||||||
#define DEFAULT_PROP_PIXEL_FORMAT "auto"
|
#define DEFAULT_PROP_PIXEL_FORMAT "auto"
|
||||||
#define DEFAULT_PROP_USERID ""
|
#define DEFAULT_PROP_USERID ""
|
||||||
@ -588,6 +590,11 @@ gst_pylonsrc_class_init (GstPylonSrcClass * klass)
|
|||||||
"(1-6) Specifies a test image to show instead of a video stream. Useful for debugging. Will be disabled by default.",
|
"(1-6) Specifies a test image to show instead of a video stream. Useful for debugging. Will be disabled by default.",
|
||||||
0, 6, DEFAULT_PROP_TESTIMAGE,
|
0, 6, DEFAULT_PROP_TESTIMAGE,
|
||||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_TESTIMAGESOURCE,
|
||||||
|
g_param_spec_string ("testimagesource", "Test image source",
|
||||||
|
"Specifies a test image (or image directory) to show instead of a video stream. Useful for debugging. Will be disabled by default.",
|
||||||
|
DEFAULT_PROP_TESTIMAGESOURCE,
|
||||||
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
g_object_class_install_property (gobject_class, PROP_CONTINUOUSMODE,
|
g_object_class_install_property (gobject_class, PROP_CONTINUOUSMODE,
|
||||||
g_param_spec_boolean ("continuous", "Continuous mode",
|
g_param_spec_boolean ("continuous", "Continuous mode",
|
||||||
"(true/false) Used to switch between triggered and continuous mode. To switch to triggered mode this parameter has to be switched to false.",
|
"(true/false) Used to switch between triggered and continuous mode. To switch to triggered mode this parameter has to be switched to false.",
|
||||||
@ -829,6 +836,7 @@ gst_pylonsrc_init (GstPylonSrc * src)
|
|||||||
src->cameraId = DEFAULT_PROP_CAMERA;
|
src->cameraId = DEFAULT_PROP_CAMERA;
|
||||||
src->maxBandwidth = DEFAULT_PROP_MAXBANDWIDTH;
|
src->maxBandwidth = DEFAULT_PROP_MAXBANDWIDTH;
|
||||||
src->testImage = DEFAULT_PROP_TESTIMAGE;
|
src->testImage = DEFAULT_PROP_TESTIMAGE;
|
||||||
|
src->testImageSource = g_strdup (DEFAULT_PROP_TESTIMAGESOURCE);
|
||||||
src->sensorMode = g_strdup (DEFAULT_PROP_SENSORREADOUTMODE);
|
src->sensorMode = g_strdup (DEFAULT_PROP_SENSORREADOUTMODE);
|
||||||
src->lightsource = g_strdup (DEFAULT_PROP_LIGHTSOURCE);
|
src->lightsource = g_strdup (DEFAULT_PROP_LIGHTSOURCE);
|
||||||
|
|
||||||
@ -998,6 +1006,10 @@ gst_pylonsrc_set_property (GObject * object, guint property_id,
|
|||||||
case PROP_TESTIMAGE:
|
case PROP_TESTIMAGE:
|
||||||
src->testImage = g_value_get_int (value);
|
src->testImage = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_TESTIMAGESOURCE:
|
||||||
|
g_free (src->testImageSource);
|
||||||
|
src->testImageSource = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
case PROP_SENSORREADOUTMODE:
|
case PROP_SENSORREADOUTMODE:
|
||||||
g_free (src->sensorMode);
|
g_free (src->sensorMode);
|
||||||
src->sensorMode = g_value_dup_string (value);
|
src->sensorMode = g_value_dup_string (value);
|
||||||
@ -1273,6 +1285,9 @@ gst_pylonsrc_get_property (GObject * object, guint property_id,
|
|||||||
case PROP_TESTIMAGE:
|
case PROP_TESTIMAGE:
|
||||||
g_value_set_int (value, src->testImage);
|
g_value_set_int (value, src->testImage);
|
||||||
break;
|
break;
|
||||||
|
case PROP_TESTIMAGESOURCE:
|
||||||
|
g_value_set_string (value, src->testImageSource);
|
||||||
|
break;
|
||||||
case PROP_SENSORREADOUTMODE:
|
case PROP_SENSORREADOUTMODE:
|
||||||
g_value_set_string (value, src->sensorMode);
|
g_value_set_string (value, src->sensorMode);
|
||||||
break;
|
break;
|
||||||
@ -2156,6 +2171,31 @@ error:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_pylonsrc_set_test_image_source (GstPylonSrc * src)
|
||||||
|
{
|
||||||
|
if (is_prop_implicit (src, PROP_TESTIMAGESOURCE)) {
|
||||||
|
// Set whether test image will be shown
|
||||||
|
if (feature_supported (src, "ImageFilename")) {
|
||||||
|
GENAPIC_RESULT res;
|
||||||
|
res = PylonDeviceFeatureFromString(src->deviceHandle, "TestImageSelector", "Off");
|
||||||
|
PYLONC_CHECK_ERROR(src, res);
|
||||||
|
/* Enable custom test images */
|
||||||
|
res = PylonDeviceFeatureFromString(src->deviceHandle, "ImageFileMode", "On");
|
||||||
|
PYLONC_CHECK_ERROR(src, res);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "Test image source enabled and set to %s", src->testImageSource);
|
||||||
|
res = PylonDeviceFeatureFromString(src->deviceHandle, "ImageFilename", src->testImageSource);
|
||||||
|
PYLONC_CHECK_ERROR (src, res);
|
||||||
|
}
|
||||||
|
reset_prop (src, PROP_TESTIMAGESOURCE);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_pylonsrc_set_readout (GstPylonSrc * src)
|
gst_pylonsrc_set_readout (GstPylonSrc * src)
|
||||||
{
|
{
|
||||||
@ -4056,6 +4096,7 @@ gst_pylonsrc_set_properties (GstPylonSrc * src)
|
|||||||
gst_pylonsrc_set_reverse (src) &&
|
gst_pylonsrc_set_reverse (src) &&
|
||||||
gst_pylonsrc_set_pixel_format (src) &&
|
gst_pylonsrc_set_pixel_format (src) &&
|
||||||
gst_pylonsrc_set_test_image (src) &&
|
gst_pylonsrc_set_test_image (src) &&
|
||||||
|
gst_pylonsrc_set_test_image_source (src) &&
|
||||||
gst_pylonsrc_set_packetsize (src) &&
|
gst_pylonsrc_set_packetsize (src) &&
|
||||||
gst_pylonsrc_set_interPacketDelay (src) &&
|
gst_pylonsrc_set_interPacketDelay (src) &&
|
||||||
gst_pylonsrc_set_frameTransDelay (src) &&
|
gst_pylonsrc_set_frameTransDelay (src) &&
|
||||||
|
|||||||
@ -108,7 +108,7 @@ struct _GstPylonSrc
|
|||||||
gint maxSize[2];
|
gint maxSize[2];
|
||||||
gint offset[2];
|
gint offset[2];
|
||||||
gchar *pixel_format, *sensorMode, *lightsource, *reset, *autoprofile,
|
gchar *pixel_format, *sensorMode, *lightsource, *reset, *autoprofile,
|
||||||
*transformationselector, *userid;
|
*transformationselector, *userid, *testImageSource;
|
||||||
gchar *autoFeature[GST_PYLONSRC_NUM_AUTO_FEATURES];
|
gchar *autoFeature[GST_PYLONSRC_NUM_AUTO_FEATURES];
|
||||||
gchar *configFile;
|
gchar *configFile;
|
||||||
GST_PYLONSRC_PROPERTY_STATE propFlags[GST_PYLONSRC_NUM_PROPS];
|
GST_PYLONSRC_PROPERTY_STATE propFlags[GST_PYLONSRC_NUM_PROPS];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user