summaryrefslogtreecommitdiffstats
path: root/bin/tools
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-10-21 08:51:14 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-10-21 08:51:14 +0200
commita30cc5c930ed2dd3fdf386eb97ee9cf40a105aa5 (patch)
treea7babc3deac0f8c6d22f6c91b3c42632b085f91e /bin/tools
parentaff780afa3866e8e1f64fcc7ce46722d404852ef (diff)
downloadlibuca-a30cc5c930ed2dd3fdf386eb97ee9cf40a105aa5.tar.gz
libuca-a30cc5c930ed2dd3fdf386eb97ee9cf40a105aa5.tar.bz2
libuca-a30cc5c930ed2dd3fdf386eb97ee9cf40a105aa5.tar.xz
libuca-a30cc5c930ed2dd3fdf386eb97ee9cf40a105aa5.zip
Use prop parsing in grab and benchmark
Diffstat (limited to 'bin/tools')
-rw-r--r--bin/tools/benchmark.c16
-rw-r--r--bin/tools/grab.c11
2 files changed, 12 insertions, 15 deletions
diff --git a/bin/tools/benchmark.c b/bin/tools/benchmark.c
index 5e77af2..7f7d3c4 100644
--- a/bin/tools/benchmark.c
+++ b/bin/tools/benchmark.c
@@ -27,7 +27,6 @@
typedef struct {
gint n_frames;
gint n_runs;
- gdouble exposure_time;
gboolean test_async;
gboolean test_software;
gboolean test_external;
@@ -35,12 +34,10 @@ typedef struct {
gsize n_bytes;
} Options;
-
typedef guint (*GrabFrameFunc) (UcaCamera *, gpointer, guint, UcaCameraTriggerSource);
static UcaCamera *camera = NULL;
-
static void
sigint_handler(int signal)
{
@@ -213,10 +210,6 @@ benchmark (UcaCamera *camera, Options *options)
gdouble exposure_time;
gpointer buffer;
- g_object_set (G_OBJECT (camera),
- "exposure-time", options->exposure_time,
- NULL);
-
g_object_get (G_OBJECT (camera),
"name", &name,
"sensor-width", &sensor_width,
@@ -274,7 +267,6 @@ main (int argc, char *argv[])
static Options options = {
.n_frames = 1000,
.n_runs = 3,
- .exposure_time = 0.001,
.test_async = FALSE,
.test_software = FALSE,
.test_external = FALSE,
@@ -283,7 +275,6 @@ main (int argc, char *argv[])
static GOptionEntry entries[] = {
{ "num-frames", 'n', 0, G_OPTION_ARG_INT, &options.n_frames, "Number of frames per run", "N" },
{ "num-runs", 'r', 0, G_OPTION_ARG_INT, &options.n_runs, "Number of runs", "N" },
- { "exposure-time", 'e', 0, G_OPTION_ARG_DOUBLE, &options.exposure_time, "Exposure time in seconds", NULL },
{ "async", 0, 0, G_OPTION_ARG_NONE, &options.test_async, "Test asynchronous mode", NULL },
{ "software", 0, 0, G_OPTION_ARG_NONE, &options.test_software, "Test software trigger mode", NULL },
{ "external", 0, 0, G_OPTION_ARG_NONE, &options.test_external, "Test external trigger mode", NULL },
@@ -314,13 +305,18 @@ main (int argc, char *argv[])
g_assert_no_error (error);
g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_handler, log_channel);
- camera = uca_plugin_manager_get_camera (manager, argv[1], &error, NULL);
+ camera = uca_plugin_manager_get_camera (manager, argv[argc - 1], &error, NULL);
if (camera == NULL) {
g_print ("Initialization: %s\n", error->message);
goto cleanup_manager;
}
+ if (!uca_camera_parse_arg_props (camera, argv, argc - 1, &error)) {
+ g_print ("Error setting properties: %s\n", error->message);
+ goto cleanup_manager;
+ }
+
benchmark (camera, &options);
g_io_channel_shutdown (log_channel, TRUE, &error);
diff --git a/bin/tools/grab.c b/bin/tools/grab.c
index c6a0d71..e3dea42 100644
--- a/bin/tools/grab.c
+++ b/bin/tools/grab.c
@@ -33,7 +33,6 @@
typedef struct {
gint n_frames;
gdouble duration;
- gdouble exposure_time;
gchar *filename;
#ifdef HAVE_LIBTIFF
gboolean write_tiff;
@@ -220,7 +219,6 @@ main (int argc, char *argv[])
static Options opts = {
.n_frames = -1,
.duration = -1.0,
- .exposure_time = 0.001,
.filename = NULL,
#ifdef HAVE_LIBTIFF
.write_tiff = FALSE,
@@ -230,7 +228,6 @@ main (int argc, char *argv[])
static GOptionEntry entries[] = {
{ "num-frames", 'n', 0, G_OPTION_ARG_INT, &opts.n_frames, "Number of frames to acquire", "N" },
{ "duration", 'd', 0, G_OPTION_ARG_DOUBLE, &opts.duration, "Duration in seconds", NULL },
- { "exposure-time", 'e', 0, G_OPTION_ARG_DOUBLE, &opts.exposure_time, "Exposure time in seconds", NULL },
{ "output", 'o', 0, G_OPTION_ARG_STRING, &opts.filename, "Output file name", "FILE" },
#ifdef HAVE_LIBTIFF
{ "write-tiff", 't', 0, G_OPTION_ARG_NONE, &opts.write_tiff, "Write as TIFF", NULL },
@@ -261,14 +258,18 @@ main (int argc, char *argv[])
goto cleanup_manager;
}
- camera = uca_plugin_manager_get_camera (manager, argv[1], &error, NULL);
+ camera = uca_plugin_manager_get_camera (manager, argv[argc - 1], &error, NULL);
if (camera == NULL) {
g_print ("Error during initialization: %s\n", error->message);
goto cleanup_camera;
}
- g_object_set (camera, "exposure-time", opts.exposure_time, NULL);
+ if (!uca_camera_parse_arg_props (camera, argv, argc - 1, &error)) {
+ g_print ("Error setting properties: %s\n", error->message);
+ goto cleanup_manager;
+ }
+
error = record_frames (camera, &opts);
if (error != NULL)