pylonsrc: fixed offset default behaviour and continuous mode reading

This commit is contained in:
mrstecklo 2020-12-26 17:12:13 +03:00 committed by joshdoe
parent 11b85fcc3a
commit 2ea7e9ee63
2 changed files with 835 additions and 709 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,36 +31,37 @@
// if pylon environment is needed beyond lifetime of plugins. // if pylon environment is needed beyond lifetime of plugins.
// On success return value is the new value of counter // On success return value is the new value of counter
// On failure return value is negative // On failure return value is negative
int gst_pylonsrc_ref_pylon_environment(); int gst_pylonsrc_ref_pylon_environment ();
int gst_pylonsrc_unref_pylon_environment(); int gst_pylonsrc_unref_pylon_environment ();
enum { 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 = 66 GST_PYLONSRC_NUM_PROPS = 66
}; };
typedef enum _GST_PYLONSRC_PROPERTY_STATE { typedef enum _GST_PYLONSRC_PROPERTY_STATE
{
GST_PYLONSRC_PROPST_DEFAULT, GST_PYLONSRC_PROPST_DEFAULT,
GST_PYLONSRC_PROPST_NOT_SET, GST_PYLONSRC_PROPST_NOT_SET,
GST_PYLONSRC_PROPST_SET GST_PYLONSRC_PROPST_SET
} GST_PYLONSRC_PROPERTY_STATE; } GST_PYLONSRC_PROPERTY_STATE;
typedef struct _GstPylonSrcLimitedFeature { typedef struct _GstPylonSrcLimitedFeature
{
double lower; double lower;
double upper; double upper;
double manual; double manual;
} GstPylonSrcLimitedFeature; } GstPylonSrcLimitedFeature;
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_PYLONSRC (gst_pylonsrc_get_type()) #define GST_TYPE_PYLONSRC (gst_pylonsrc_get_type())
#define GST_PYLONSRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PYLONSRC,GstPylonSrc)) #define GST_PYLONSRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PYLONSRC,GstPylonSrc))
#define GST_PYLONSRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PYLONSRC,GstPylonSrcClass)) #define GST_PYLONSRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PYLONSRC,GstPylonSrcClass))
#define GST_IS_PYLONSRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PYLONSRC)) #define GST_IS_PYLONSRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PYLONSRC))
#define GST_IS_PYLONSRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PYLONSRC)) #define GST_IS_PYLONSRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PYLONSRC))
typedef struct _GstPylonSrc GstPylonSrc; typedef struct _GstPylonSrc GstPylonSrc;
typedef struct _GstPylonSrcClass GstPylonSrcClass; typedef struct _GstPylonSrcClass GstPylonSrcClass;
@ -71,25 +72,26 @@ struct _GstPylonSrc
GstCaps *caps; GstCaps *caps;
gint cameraId; gint cameraId;
PYLON_DEVICE_HANDLE deviceHandle; // Handle for the camera. PYLON_DEVICE_HANDLE deviceHandle; // Handle for the camera.
PYLON_STREAMGRABBER_HANDLE streamGrabber; // Handler for camera's streams. PYLON_STREAMGRABBER_HANDLE streamGrabber; // Handler for camera's streams.
PYLON_WAITOBJECT_HANDLE waitObject; // Handles timing out in the main loop. PYLON_WAITOBJECT_HANDLE waitObject; // Handles timing out in the main loop.
gboolean deviceConnected; gboolean deviceConnected;
gboolean acquisition_configured; gboolean acquisition_configured;
unsigned char *buffers[GST_PYLONSRC_NUM_CAPTURE_BUFFERS]; unsigned char *buffers[GST_PYLONSRC_NUM_CAPTURE_BUFFERS];
PYLON_STREAMBUFFER_HANDLE bufferHandle[GST_PYLONSRC_NUM_CAPTURE_BUFFERS]; PYLON_STREAMBUFFER_HANDLE bufferHandle[GST_PYLONSRC_NUM_CAPTURE_BUFFERS];
int32_t frameSize; // Size of a frame in bytes. int32_t frameSize; // Size of a frame in bytes.
int32_t payloadSize; // Size of a frame in bytes. int32_t payloadSize; // Size of a frame in bytes.
guint64 frameNumber; // Fun note: At 120fps it will take around 4 billion years to overflow this variable. guint64 frameNumber; // Fun note: At 120fps it will take around 4 billion years to overflow this variable.
// Plugin parameters // Plugin parameters
_Bool setFPS, continuousMode, limitBandwidth, demosaicing; _Bool setFPS, continuousMode, limitBandwidth, demosaicing;
_Bool center[2]; _Bool center[2];
_Bool flip[2]; _Bool flip[2];
_Bool ignoreDefaults; _Bool ignoreDefaults;
double fps, blacklevel, gamma, sharpnessenhancement, noisereduction, brightnesstarget; double fps, blacklevel, gamma, sharpnessenhancement, noisereduction,
brightnesstarget;
double balance[3]; double balance[3];
double hue[6]; double hue[6];
double saturation[6]; double saturation[6];
@ -102,9 +104,10 @@ struct _GstPylonSrc
gint binning[2]; gint binning[2];
gint maxSize[2]; gint maxSize[2];
gint offset[2]; gint offset[2];
gchar *pixel_format, *sensorMode, *lightsource, *reset, *autoprofile, *transformationselector, *userid; gchar *pixel_format, *sensorMode, *lightsource, *reset, *autoprofile,
gchar* autoFeature[GST_PYLONSRC_NUM_AUTO_FEATURES]; *transformationselector, *userid;
gchar* configFile; gchar *autoFeature[GST_PYLONSRC_NUM_AUTO_FEATURES];
gchar *configFile;
GST_PYLONSRC_PROPERTY_STATE propFlags[GST_PYLONSRC_NUM_PROPS]; GST_PYLONSRC_PROPERTY_STATE propFlags[GST_PYLONSRC_NUM_PROPS];
}; };
@ -116,5 +119,4 @@ struct _GstPylonSrcClass
GType gst_pylonsrc_get_type (void); GType gst_pylonsrc_get_type (void);
G_END_DECLS G_END_DECLS
#endif #endif