-
Notifications
You must be signed in to change notification settings - Fork 7
/
04-camera-features.c
55 lines (40 loc) · 1.29 KB
/
04-camera-features.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* SPDX-License-Identifier:Unlicense */
/* Aravis header */
#include <arv.h>
/* Standard headers */
#include <stdlib.h>
#include <stdio.h>
/*
* Connect to the first available camera, then display the current settings for image width and height, as well as the
* pixel format, using the more generic ArvCamera feature API.
*/
int
main (int argc, char **argv)
{
ArvCamera *camera;
GError *error = NULL;
/* Connect to the first available camera */
camera = arv_camera_new (NULL, &error);
if (ARV_IS_CAMERA (camera)) {
int width;
int height;
const char *pixel_format;
printf ("Found camera '%s'\n", arv_camera_get_model_name (camera, NULL));
/* Retrieve generally mandatory features for transmitters */
if (!error) width = arv_camera_get_integer (camera, "Width", &error);
if (!error) height = arv_camera_get_integer (camera, "Height", &error);
if (!error) pixel_format = arv_camera_get_string (camera, "PixelFormat", &error);
if (error == NULL) {
printf ("Width = %d\n", width);
printf ("Height = %d\n", height);
printf ("Pixel format = %s\n", pixel_format);
}
g_clear_object (&camera);
}
if (error != NULL) {
/* En error happened, display the correspdonding message */
printf ("Error: %s\n", error->message);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}