Skip to content

Commit 9a6f61e

Browse files
henriquesimoesEmmanuelP
authored andcommitted
multiple-acquisition: set up continuous acquisition mode
An important configuration for acquiring multiple images is to set the acquisition mode either to `ARV_ACQUISITION_MODE_MULTI_FRAME` or `ARV_ACQUISITION_MODE_CONTINUOUS`. This is because examples and implementations directly based on them will stall at the first frame if the camera was externally set to `ARV_ACQUISITION_MODE_SINGLE_FRAME`. This produces an unexpected behavior. Continuous mode has been chosen here so that there is no need to configure the number of expected frames, making the script a bit cleaner.
1 parent e56b3fe commit 9a6f61e

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

02-multiple-acquisition-callback.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,16 @@ main (int argc, char **argv)
8383

8484
printf ("Found camera '%s'\n", arv_camera_get_model_name (camera, NULL));
8585

86-
/* Create the stream object without callback */
86+
arv_camera_set_acquisition_mode (camera, ARV_ACQUISITION_MODE_CONTINUOUS, &error);
87+
8788
callback_data.counter = 0;
8889
callback_data.done = FALSE;
89-
callback_data.stream = arv_camera_create_stream (camera, stream_callback, &callback_data, &error);
90+
callback_data.stream = NULL;
91+
92+
if (error == NULL)
93+
/* Create the stream object with callback */
94+
callback_data.stream = arv_camera_create_stream (camera, stream_callback, &callback_data, &error);
95+
9096
if (ARV_IS_STREAM (callback_data.stream)) {
9197
int i;
9298
size_t payload;

02-multiple-acquisition-main-thread.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ main (int argc, char **argv)
2323
camera = arv_camera_new (NULL, &error);
2424

2525
if (ARV_IS_CAMERA (camera)) {
26-
ArvStream *stream;
26+
ArvStream *stream = NULL;
2727

2828
printf ("Found camera '%s'\n", arv_camera_get_model_name (camera, NULL));
2929

30-
/* Create the stream object without callback */
31-
stream = arv_camera_create_stream (camera, NULL, NULL, &error);
30+
arv_camera_set_acquisition_mode (camera, ARV_ACQUISITION_MODE_CONTINUOUS, &error);
31+
32+
if (error == NULL)
33+
/* Create the stream object without callback */
34+
stream = arv_camera_create_stream (camera, NULL, NULL, &error);
35+
3236
if (ARV_IS_STREAM (stream)) {
3337
int i;
3438
size_t payload;

02-multiple-acquisition-signal.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ main (int argc, char **argv)
5757
camera = arv_camera_new (NULL, &error);
5858

5959
if (ARV_IS_CAMERA (camera)) {
60-
ArvStream *stream;
60+
ArvStream *stream = NULL;
6161

6262
printf ("Found camera '%s'\n", arv_camera_get_model_name (camera, NULL));
6363

64-
/* Create the stream object without callback */
65-
stream = arv_camera_create_stream (camera, NULL, NULL, &error);
64+
arv_camera_set_acquisition_mode (camera, ARV_ACQUISITION_MODE_CONTINUOUS, &error);
65+
66+
if (error == NULL)
67+
/* Create the stream object without callback */
68+
stream = arv_camera_create_stream (camera, NULL, NULL, &error);
69+
6670
if (ARV_IS_STREAM (stream)) {
6771
int i;
6872
size_t payload;

0 commit comments

Comments
 (0)