diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-09-19 18:04:32 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-09-19 18:04:32 +0200 |
commit | 6dd3229337aa1920d266fbd2c4001fb7c65f5cf1 (patch) | |
tree | ee6efb0b6f1a0bc179f7165faf6c9895a975d553 /test | |
parent | 90f0d4f6fa74111f38c9aedf31ecb740bc0ddf97 (diff) | |
download | uca-6dd3229337aa1920d266fbd2c4001fb7c65f5cf1.tar.gz uca-6dd3229337aa1920d266fbd2c4001fb7c65f5cf1.tar.bz2 uca-6dd3229337aa1920d266fbd2c4001fb7c65f5cf1.tar.xz uca-6dd3229337aa1920d266fbd2c4001fb7c65f5cf1.zip |
Make most cameras plugins
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | test/benchmark.c | 9 | ||||
-rw-r--r-- | test/grab.c | 40 |
3 files changed, 32 insertions, 21 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8fe702b..37ea6bf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,12 +36,12 @@ if (HAVE_PYLON_CAMERA) link_directories(${PYLON_LIB_DIRS} ${LIBPYLONCAM_LIBDIR}) endif() -#add_executable(grab grab.c) +add_executable(grab grab.c) #add_executable(grab-async grab-async.c) add_executable(benchmark benchmark.c) target_link_libraries(benchmark uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES}) -#target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES}) +target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES}) #target_link_libraries(grab-async uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES}) #add_executable(grab_pylon grab_pylon.c) diff --git a/test/benchmark.c b/test/benchmark.c index 73b6805..ef99fd1 100644 --- a/test/benchmark.c +++ b/test/benchmark.c @@ -42,7 +42,7 @@ print_usage (void) UcaPluginManager *manager; manager = uca_plugin_manager_new (); - g_print ("Usage: benchmark ["); + g_print ("Usage: benchmark [ "); types = uca_plugin_manager_get_available_cameras (manager); if (types == NULL) { @@ -52,10 +52,11 @@ print_usage (void) for (GList *it = g_list_first (types); it != NULL; it = g_list_next (it)) { gchar *name = (gchar *) it->data; - g_print ("`%s' ", name); + if (g_list_next (it) == NULL) + g_print ("%s ]\n", name); + else + g_print ("%s, ", name); } - - g_print ("]\n"); } static void diff --git a/test/grab.c b/test/grab.c index 41e6d88..e507d69 100644 --- a/test/grab.c +++ b/test/grab.c @@ -19,6 +19,7 @@ #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include "uca-plugin-manager.h" #include "uca-camera.h" static UcaCamera *camera = NULL; @@ -31,26 +32,33 @@ static void sigint_handler(int signal) exit(signal); } -static void print_usage(void) +static void +print_usage (void) { - gchar **types; - - g_print("Usage: grab ("); - types = uca_camera_get_types(); - - for (guint i = 0; types[i] != NULL; i++) { - if (types[i+1] == NULL) - g_print("%s)", types[i]); - else - g_print("%s | ", types[i]); + GList *types; + UcaPluginManager *manager; + + manager = uca_plugin_manager_new (); + g_print ("Usage: benchmark [ "); + types = uca_plugin_manager_get_available_cameras (manager); + + if (types == NULL) { + g_print ("] -- no camera plugin found\n"); + return; } - g_print("\n"); - g_strfreev(types); + for (GList *it = g_list_first (types); it != NULL; it = g_list_next (it)) { + gchar *name = (gchar *) it->data; + if (g_list_next (it) == NULL) + g_print ("%s ]\n", name); + else + g_print ("%s, ", name); + } } int main(int argc, char *argv[]) { + UcaPluginManager *manager; GError *error = NULL; (void) signal(SIGINT, sigint_handler); @@ -59,13 +67,15 @@ int main(int argc, char *argv[]) guint bits; gchar *name; + g_type_init(); + if (argc < 2) { print_usage(); return 1; } - g_type_init(); - camera = uca_camera_new(argv[1], &error); + manager = uca_plugin_manager_new (); + camera = uca_plugin_manager_new_camera (manager, argv[1], &error); if (camera == NULL) { g_print("Error during initialization: %s\n", error->message); |