12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include <libmegapixels.h>
- #include <stdio.h>
- #include <limits.h>
- int
- main()
- {
- char configpath[PATH_MAX];
- int ret = libmegapixels_find_config(configpath);
- libmegapixels_devconfig *config = {0};
- if (ret) {
- printf("Using config: %s\n", configpath);
- libmegapixels_load_file(&config, configpath);
- } else {
- printf("No config found\n");
- libmegapixels_load_file(&config, "config/uvc.conf");
- }
- printf("Device: %s %s\n", config->make, config->model);
- printf("Found %d cameras\n", config->count);
- for (int i = 0; i < config->count; i++) {
- printf("\n----[ Camera %s (%d) ]----\n", config->cameras[i]->name, i);
- printf("Media : %s (%s)\n", config->cameras[i]->bridge_name, config->cameras[i]->media_path);
- printf("Sensor: %s (%s)\n", config->cameras[i]->sensor_name, config->cameras[i]->sensor_path);
- printf("Bridge: %s\n", config->cameras[i]->video_path);
- printf("Modes : ");
- for (int j = 0; j < config->cameras[i]->num_modes; j++) {
- if (j > 0) {
- printf(" ");
- }
- libmegapixels_mode *mode = config->cameras[i]->modes[j];
- printf("%dx%d@%d\n", mode->width, mode->height, mode->rate);
- }
- }
- return 0;
- }
|