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/grab.c | |
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/grab.c')
-rw-r--r-- | test/grab.c | 40 |
1 files changed, 25 insertions, 15 deletions
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); |