summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cameras/uca-mock-camera.c19
-rw-r--r--src/cameras/uca-pco-camera.c39
-rw-r--r--src/uca-camera.c8
3 files changed, 55 insertions, 11 deletions
diff --git a/src/cameras/uca-mock-camera.c b/src/cameras/uca-mock-camera.c
index b1c325e..9e74a01 100644
--- a/src/cameras/uca-mock-camera.c
+++ b/src/cameras/uca-mock-camera.c
@@ -31,6 +31,7 @@ enum {
PROP_SENSOR_HORIZONTAL_BINNINGS,
PROP_SENSOR_VERTICAL_BINNING,
PROP_SENSOR_VERTICAL_BINNINGS,
+ PROP_SENSOR_MAX_FRAME_RATE,
PROP_HAS_STREAMING,
PROP_HAS_CAMRAM_RECORDING,
N_INTERFACE_PROPERTIES,
@@ -47,6 +48,7 @@ static const gchar *mock_overrideables[N_PROPERTIES] = {
"sensor-horizontal-binnings",
"sensor-vertical-binning",
"sensor-vertical-binnings",
+ "max-frame-rate",
"has-streaming",
"has-camram-recording"
};
@@ -56,7 +58,8 @@ static GParamSpec *mock_properties[N_PROPERTIES - N_INTERFACE_PROPERTIES - 1] =
struct _UcaMockCameraPrivate {
guint width;
guint height;
- guint framerate;
+ guint frame_rate;
+ gfloat max_frame_rate;
guint16 *dummy_data;
gboolean thread_running;
@@ -86,7 +89,7 @@ static gpointer mock_grab_func(gpointer data)
UcaMockCameraPrivate *priv = UCA_MOCK_CAMERA_GET_PRIVATE(mock_camera);
UcaCamera *camera = UCA_CAMERA(mock_camera);
- const gulong sleep_time = G_USEC_PER_SEC / priv->framerate;
+ const gulong sleep_time = G_USEC_PER_SEC / priv->frame_rate;
while (priv->thread_running) {
camera->grab_func(NULL, camera->user_data);
@@ -153,7 +156,7 @@ static void uca_mock_camera_set_property(GObject *object, guint property_id, con
switch (property_id) {
case PROP_FRAMERATE:
- priv->framerate = g_value_get_uint(value);
+ priv->frame_rate = g_value_get_uint(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
@@ -187,6 +190,9 @@ static void uca_mock_camera_get_property(GObject *object, guint property_id, GVa
case PROP_SENSOR_VERTICAL_BINNINGS:
g_value_set_boxed(value, priv->binnings);
break;
+ case PROP_SENSOR_MAX_FRAME_RATE:
+ g_value_set_float(value, priv->max_frame_rate);
+ break;
case PROP_HAS_STREAMING:
g_value_set_boolean(value, TRUE);
break;
@@ -194,7 +200,7 @@ static void uca_mock_camera_get_property(GObject *object, guint property_id, GVa
g_value_set_boolean(value, FALSE);
break;
case PROP_FRAMERATE:
- g_value_set_uint(value, priv->framerate);
+ g_value_set_uint(value, priv->frame_rate);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
@@ -233,8 +239,8 @@ static void uca_mock_camera_class_init(UcaMockCameraClass *klass)
g_object_class_override_property(gobject_class, id, mock_overrideables[id-1]);
mock_properties[PROP_FRAMERATE] =
- g_param_spec_uint("framerate",
- "Framerate",
+ g_param_spec_uint("frame-rate",
+ "Frame rate",
"Number of frames per second that are taken",
1, 30, 25,
G_PARAM_READWRITE);
@@ -250,6 +256,7 @@ static void uca_mock_camera_init(UcaMockCamera *self)
self->priv = UCA_MOCK_CAMERA_GET_PRIVATE(self);
self->priv->width = 640;
self->priv->height = 480;
+ self->priv->max_frame_rate = 100.0f;
self->priv->dummy_data = (guint16 *) g_malloc0(self->priv->width * self->priv->height);
self->priv->grab_thread = NULL;
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c
index 80034e3..3e1791a 100644
--- a/src/cameras/uca-pco-camera.c
+++ b/src/cameras/uca-pco-camera.c
@@ -59,6 +59,9 @@ enum {
PROP_SENSOR_HORIZONTAL_BINNINGS,
PROP_SENSOR_VERTICAL_BINNING,
PROP_SENSOR_VERTICAL_BINNINGS,
+ PROP_SENSOR_MAX_FRAME_RATE,
+ PROP_HAS_STREAMING,
+ PROP_HAS_CAMRAM_RECORDING,
N_INTERFACE_PROPERTIES,
PROP_NAME,
@@ -74,22 +77,30 @@ static const gchar *base_overrideables[N_PROPERTIES] = {
"sensor-horizontal-binnings",
"sensor-vertical-binning",
"sensor-vertical-binnings",
+ "max-frame-rate",
+ "has-streaming",
+ "has-camram-recording"
};
static GParamSpec *pco_properties[N_PROPERTIES - N_INTERFACE_PROPERTIES - 1] = { NULL, };
+/*
+ * This structure defines type-specific properties of PCO cameras.
+ */
typedef struct {
int camera_type;
const char *so_file;
int cl_type;
int cl_format;
+ gfloat max_frame_rate;
+ gboolean has_camram;
} pco_cl_map_entry;
static pco_cl_map_entry pco_cl_map[] = {
- { CAMERATYPE_PCO_EDGE, "libFullAreaGray8.so", FG_CL_8BIT_FULL_10, FG_GRAY },
- { CAMERATYPE_PCO4000, "libDualAreaGray16.so", FG_CL_SINGLETAP_16_BIT, FG_GRAY16 },
- { CAMERATYPE_PCO_DIMAX_STD, "libFullAreaGray16.so", FG_CL_SINGLETAP_8_BIT, FG_GRAY16 },
- { 0, NULL, 0, 0}
+ { CAMERATYPE_PCO_EDGE, "libFullAreaGray8.so", FG_CL_8BIT_FULL_10, FG_GRAY, 30.0f, FALSE },
+ { CAMERATYPE_PCO4000, "libDualAreaGray16.so", FG_CL_SINGLETAP_16_BIT, FG_GRAY16, 5.0f, TRUE },
+ { CAMERATYPE_PCO_DIMAX_STD, "libFullAreaGray16.so", FG_CL_SINGLETAP_8_BIT, FG_GRAY16, 1279.0f, TRUE },
+ { 0, NULL, 0, 0, 0.0f, FALSE }
};
static pco_cl_map_entry *get_pco_cl_map_entry(int camera_type)
@@ -107,6 +118,7 @@ static pco_cl_map_entry *get_pco_cl_map_entry(int camera_type)
struct _UcaPcoCameraPrivate {
pco_handle pco;
+ pco_cl_map_entry *camera_description;
Fg_Struct *fg;
guint fg_port;
@@ -168,7 +180,6 @@ static guint override_temperature_range(UcaPcoCameraPrivate *priv)
UcaPcoCamera *uca_pco_camera_new(GError **error)
{
- /* TODO: find a good way to handle libpco and fg errors */
pco_handle pco = pco_init();
if (pco == NULL) {
@@ -184,6 +195,7 @@ UcaPcoCamera *uca_pco_camera_new(GError **error)
guint16 camera_type, camera_subtype;
pco_get_camera_type(priv->pco, &camera_type, &camera_subtype);
pco_cl_map_entry *map_entry = get_pco_cl_map_entry(camera_type);
+ priv->camera_description = map_entry;
if (map_entry == NULL) {
g_set_error(error, UCA_PCO_CAMERA_ERROR, UCA_PCO_CAMERA_ERROR_UNSUPPORTED,
@@ -308,6 +320,22 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal
g_value_set_boxed(value, priv->vertical_binnings);
break;
+ case PROP_SENSOR_MAX_FRAME_RATE:
+ g_value_set_float(value, priv->camera_description->max_frame_rate);
+ break;
+
+ case PROP_SENSOR_BITDEPTH:
+ g_value_set_uint(value, 16);
+ break;
+
+ case PROP_HAS_STREAMING:
+ g_value_set_boolean(value, TRUE);
+ break;
+
+ case PROP_HAS_CAMRAM_RECORDING:
+ g_value_set_boolean(value, priv->camera_description->has_camram);
+ break;
+
case PROP_NAME:
{
char *name = NULL;
@@ -400,4 +428,5 @@ static void uca_pco_camera_init(UcaPcoCamera *self)
self->priv->pco = NULL;
self->priv->horizontal_binnings = NULL;
self->priv->vertical_binnings = NULL;
+ self->priv->camera_description = NULL;
}
diff --git a/src/uca-camera.c b/src/uca-camera.c
index f7f980a..97215bb 100644
--- a/src/uca-camera.c
+++ b/src/uca-camera.c
@@ -66,6 +66,7 @@ enum {
PROP_SENSOR_HORIZONTAL_BINNINGS,
PROP_SENSOR_VERTICAL_BINNING,
PROP_SENSOR_VERTICAL_BINNINGS,
+ PROP_SENSOR_MAX_FRAME_RATE,
PROP_HAS_STREAMING,
PROP_HAS_CAMRAM_RECORDING,
PROP_TRANSFER_ASYNCHRONOUSLY,
@@ -181,6 +182,13 @@ static void uca_camera_class_init(UcaCameraClass *klass)
1, G_MAXUINT, 1,
G_PARAM_READABLE), G_PARAM_READABLE);
+ camera_properties[PROP_SENSOR_MAX_FRAME_RATE] =
+ g_param_spec_float("max-frame-rate",
+ "Maximum frame rate",
+ "Maximum frame rate at full frame resolution",
+ 0.0f, G_MAXFLOAT, 1.0f,
+ G_PARAM_READABLE);
+
camera_properties[PROP_HAS_STREAMING] =
g_param_spec_boolean("has-streaming",
"Streaming capability",