diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-09-21 14:29:50 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-09-21 14:29:50 +0200 |
commit | 6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea (patch) | |
tree | 1b37a1eb40ad1fdec0a2bebc167f7f8128497748 /test/benchmark.c | |
parent | e6a6eb9aede59a1f7441b926b36afefd9c42b91d (diff) | |
parent | 9f262857d13a3e0d7ee214b33b90359c51227718 (diff) | |
download | uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.gz uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.bz2 uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.xz uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.zip |
Merge branch 'plugins'
Diffstat (limited to 'test/benchmark.c')
-rw-r--r-- | test/benchmark.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test/benchmark.c b/test/benchmark.c index 0b4f6f8..ef99fd1 100644 --- a/test/benchmark.c +++ b/test/benchmark.c @@ -20,6 +20,7 @@ #include <string.h> #include <stdlib.h> #include "uca-camera.h" +#include "uca-plugin-manager.h" typedef void (*GrabFrameFunc) (UcaCamera *camera, gpointer buffer, guint n_frames); @@ -37,20 +38,25 @@ sigint_handler(int signal) static void print_usage (void) { - gchar **types; + GList *types; + UcaPluginManager *manager; - g_print ("Usage: benchmark ("); - types = uca_camera_get_types (); + manager = uca_plugin_manager_new (); + g_print ("Usage: benchmark [ "); + types = uca_plugin_manager_get_available_cameras (manager); - for (guint i = 0; types[i] != NULL; i++) { - if (types[i+1] == NULL) - g_print ("%s)", types[i]); - else - g_print ("%s | ", types[i]); + 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); + } } static void @@ -227,10 +233,12 @@ benchmark (UcaCamera *camera) int main (int argc, char *argv[]) { + UcaPluginManager *manager; GIOChannel *log_channel; GError *error = NULL; (void) signal (SIGINT, sigint_handler); + g_type_init(); if (argc < 2) { print_usage(); @@ -241,8 +249,8 @@ main (int argc, char *argv[]) g_assert_no_error (error); g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_handler, log_channel); - 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_error ("Initialization: %s", error->message); |