summaryrefslogtreecommitdiffstats
path: root/test/grab.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-09-21 14:29:50 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-09-21 14:29:50 +0200
commit6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea (patch)
tree1b37a1eb40ad1fdec0a2bebc167f7f8128497748 /test/grab.c
parente6a6eb9aede59a1f7441b926b36afefd9c42b91d (diff)
parent9f262857d13a3e0d7ee214b33b90359c51227718 (diff)
downloaduca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.gz
uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.bz2
uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.tar.xz
uca-6eaadaa0e4ad8ce906aa8ccee63d91f0d9cb28ea.zip
Merge branch 'plugins'
Diffstat (limited to 'test/grab.c')
-rw-r--r--test/grab.c40
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);