pylonsrc: added parameter packet-size for better tuning in bandwidth restricted environments.
This commit is contained in:
parent
314581b002
commit
1f121e3e01
@ -172,6 +172,7 @@ typedef enum _GST_PYLONSRC_PROP
|
|||||||
PROP_TRANSFORMATION22,
|
PROP_TRANSFORMATION22,
|
||||||
PROP_FRAMEDROPLIMIT,
|
PROP_FRAMEDROPLIMIT,
|
||||||
PROP_GRABTIMEOUT,
|
PROP_GRABTIMEOUT,
|
||||||
|
PROP_PACKETSIZE,
|
||||||
|
|
||||||
PROP_CONFIGFILE,
|
PROP_CONFIGFILE,
|
||||||
PROP_IGNOREDEFAULTS,
|
PROP_IGNOREDEFAULTS,
|
||||||
@ -353,6 +354,7 @@ ascii_strdown (gchar * *str, gssize len)
|
|||||||
#define DEFAULT_PROP_COLORADJUSTMENTENABLE TRUE
|
#define DEFAULT_PROP_COLORADJUSTMENTENABLE TRUE
|
||||||
#define DEFAULT_PROP_FRAMEDROPLIMIT 10
|
#define DEFAULT_PROP_FRAMEDROPLIMIT 10
|
||||||
#define DEFAULT_PROP_GRABTIMEOUT 1000
|
#define DEFAULT_PROP_GRABTIMEOUT 1000
|
||||||
|
#define DEFAULT_PROP_PACKETSIZE 1500
|
||||||
|
|
||||||
/* pad templates */
|
/* pad templates */
|
||||||
static GstStaticPadTemplate gst_pylonsrc_src_template =
|
static GstStaticPadTemplate gst_pylonsrc_src_template =
|
||||||
@ -738,6 +740,11 @@ gst_pylonsrc_class_init (GstPylonSrcClass * klass)
|
|||||||
"Specifies the number of miiliseconds to wait for frame to be grabed from the camera.",
|
"Specifies the number of miiliseconds to wait for frame to be grabed from the camera.",
|
||||||
0, 60000, DEFAULT_PROP_GRABTIMEOUT,
|
0, 60000, DEFAULT_PROP_GRABTIMEOUT,
|
||||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_PACKETSIZE,
|
||||||
|
g_param_spec_int ("packet-size", "Maximum size of data packet",
|
||||||
|
"The packetsize parameter specifies the maximum size of a data packet transmitted via Ethernet. The value is in bytes.",
|
||||||
|
0, 16000, DEFAULT_PROP_PACKETSIZE,
|
||||||
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -828,6 +835,7 @@ gst_pylonsrc_init (GstPylonSrc * src)
|
|||||||
|
|
||||||
src->frameDropLimit = DEFAULT_PROP_FRAMEDROPLIMIT;
|
src->frameDropLimit = DEFAULT_PROP_FRAMEDROPLIMIT;
|
||||||
src->grabtimeout = DEFAULT_PROP_GRABTIMEOUT;
|
src->grabtimeout = DEFAULT_PROP_GRABTIMEOUT;
|
||||||
|
src->packetSize = DEFAULT_PROP_PACKETSIZE;
|
||||||
|
|
||||||
for (int i = 0; i < PROP_NUM_PROPERTIES; i++) {
|
for (int i = 0; i < PROP_NUM_PROPERTIES; i++) {
|
||||||
src->propFlags[i] = GST_PYLONSRC_PROPST_DEFAULT;
|
src->propFlags[i] = GST_PYLONSRC_PROPST_DEFAULT;
|
||||||
@ -1152,6 +1160,9 @@ gst_pylonsrc_set_property (GObject * object, guint property_id,
|
|||||||
case PROP_GRABTIMEOUT:
|
case PROP_GRABTIMEOUT:
|
||||||
src->grabtimeout = g_value_get_int (value);
|
src->grabtimeout = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PACKETSIZE:
|
||||||
|
src->packetSize = g_value_get_int (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
return;
|
return;
|
||||||
@ -1369,6 +1380,9 @@ gst_pylonsrc_get_property (GObject * object, guint property_id,
|
|||||||
case PROP_GRABTIMEOUT:
|
case PROP_GRABTIMEOUT:
|
||||||
g_value_set_int (value, src->grabtimeout);
|
g_value_set_int (value, src->grabtimeout);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PACKETSIZE:
|
||||||
|
g_value_set_int (value, src->packetSize);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -2851,6 +2865,29 @@ error:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_pylonsrc_set_packetsize (GstPylonSrc * src)
|
||||||
|
{
|
||||||
|
GENAPIC_RESULT res;
|
||||||
|
|
||||||
|
if (is_prop_implicit (src, PROP_PACKETSIZE)) {
|
||||||
|
if (is_prop_set (src, PROP_PACKETSIZE)) {
|
||||||
|
if (feature_supported (src, "GevSCPSPacketSize")) {
|
||||||
|
GST_DEBUG_OBJECT (src, "Setting packetsize to %d", src->packetSize);
|
||||||
|
res =
|
||||||
|
PylonDeviceSetIntegerFeature (src->deviceHandle,
|
||||||
|
"GevSCPSPacketSize", src->packetSize);
|
||||||
|
PYLONC_CHECK_ERROR (src, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reset_prop (src, PROP_PACKETSIZE);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_pylonsrc_configure_start_acquisition (GstPylonSrc * src)
|
gst_pylonsrc_configure_start_acquisition (GstPylonSrc * src)
|
||||||
{
|
{
|
||||||
@ -3678,6 +3715,7 @@ read_all_features (GstPylonSrc * src)
|
|||||||
gst_pylonsrc_read_reverse (src);
|
gst_pylonsrc_read_reverse (src);
|
||||||
gst_pylonsrc_read_pixel_format (src);
|
gst_pylonsrc_read_pixel_format (src);
|
||||||
gst_pylonsrc_read_test_image (src);
|
gst_pylonsrc_read_test_image (src);
|
||||||
|
//gst_pylonsrc_read_packetsize(src);
|
||||||
gst_pylonsrc_read_readout (src);
|
gst_pylonsrc_read_readout (src);
|
||||||
gst_pylonsrc_read_bandwidth (src);
|
gst_pylonsrc_read_bandwidth (src);
|
||||||
gst_pylonsrc_read_framerate (src);
|
gst_pylonsrc_read_framerate (src);
|
||||||
@ -3734,6 +3772,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_packetsize (src) &&
|
||||||
gst_pylonsrc_set_readout (src) &&
|
gst_pylonsrc_set_readout (src) &&
|
||||||
gst_pylonsrc_set_bandwidth (src) &&
|
gst_pylonsrc_set_bandwidth (src) &&
|
||||||
gst_pylonsrc_set_framerate (src) &&
|
gst_pylonsrc_set_framerate (src) &&
|
||||||
@ -3862,14 +3901,15 @@ gst_pylonsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
|
|||||||
|
|
||||||
if (grabResult.Status != Grabbed) {
|
if (grabResult.Status != Grabbed) {
|
||||||
src->failedFrames += 1;
|
src->failedFrames += 1;
|
||||||
GST_WARNING_OBJECT (src, "Failed capture count=%d. Status=%d",
|
GST_WARNING_OBJECT (src,
|
||||||
src->failedFrames, grabResult.Status);
|
"Failed capture count=%d. Status=%d, ErrorCode=%d", src->failedFrames,
|
||||||
} else {
|
grabResult.Status, grabResult.ErrorCode);
|
||||||
|
} else
|
||||||
src->failedFrames = 0;
|
src->failedFrames = 0;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
GST_ERROR_OBJECT (src, "Error in the image processing loop. Status=%d",
|
GST_ERROR_OBJECT (src,
|
||||||
grabResult.Status);
|
"Error in the image processing loop. Status=%d, ErrorCode=%d",
|
||||||
|
grabResult.Status, grabResult.ErrorCode);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ enum
|
|||||||
GST_PYLONSRC_NUM_CAPTURE_BUFFERS = 10,
|
GST_PYLONSRC_NUM_CAPTURE_BUFFERS = 10,
|
||||||
GST_PYLONSRC_NUM_AUTO_FEATURES = 3,
|
GST_PYLONSRC_NUM_AUTO_FEATURES = 3,
|
||||||
GST_PYLONSRC_NUM_LIMITED_FEATURES = 2,
|
GST_PYLONSRC_NUM_LIMITED_FEATURES = 2,
|
||||||
GST_PYLONSRC_NUM_PROPS = 69
|
GST_PYLONSRC_NUM_PROPS = 70
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum _GST_PYLONSRC_PROPERTY_STATE
|
typedef enum _GST_PYLONSRC_PROPERTY_STATE
|
||||||
@ -100,7 +100,7 @@ struct _GstPylonSrc
|
|||||||
|
|
||||||
GstPylonSrcLimitedFeature limitedFeature[GST_PYLONSRC_NUM_LIMITED_FEATURES];
|
GstPylonSrcLimitedFeature limitedFeature[GST_PYLONSRC_NUM_LIMITED_FEATURES];
|
||||||
|
|
||||||
gint maxBandwidth, testImage, frameDropLimit, grabtimeout;
|
gint maxBandwidth, testImage, frameDropLimit, grabtimeout, packetSize;
|
||||||
gint size[2];
|
gint size[2];
|
||||||
gint binning[2];
|
gint binning[2];
|
||||||
gint maxSize[2];
|
gint maxSize[2];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user