Skip to content

Commit b9affd6

Browse files
committed
cameratest: add native buffer selection option
1 parent 8f6133f commit b9affd6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/arvcameratest.c

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <signal.h>
66
#include <stdio.h>
77

8+
#define N_BUFFERS 5
9+
810
static char *arv_option_camera_name = NULL;
911
static char *arv_option_debug_domains = NULL;
1012
static char *arv_option_trigger = NULL;
@@ -41,6 +43,7 @@ static char *arv_option_uv_usb_mode = NULL;
4143
static gboolean arv_option_show_version = FALSE;
4244
static gboolean arv_option_gv_allow_broadcast_discovery_ack = FALSE;
4345
static char *arv_option_gv_port_range = NULL;
46+
static gboolean arv_option_native_buffers = FALSE;
4447

4548
/* clang-format off */
4649
static const GOptionEntry arv_option_entries[] =
@@ -178,7 +181,7 @@ static const GOptionEntry arv_option_entries[] =
178181
},
179182
{
180183
"multipart", '\0', 0, G_OPTION_ARG_NONE,
181-
&arv_option_multipart, "Enable multipart payload",
184+
&arv_option_multipart, "Enable multipart payload",
182185
NULL
183186
},
184187
{
@@ -217,6 +220,11 @@ static const GOptionEntry arv_option_entries[] =
217220
&arv_option_gv_port_range, "GV port range",
218221
"<min>-<max>"
219222
},
223+
{
224+
"native-buffers", '\0', 0, G_OPTION_ARG_NONE,
225+
&arv_option_native_buffers, "Enable native buffers",
226+
NULL
227+
},
220228
{
221229
"debug", 'd', 0, G_OPTION_ARG_STRING,
222230
&arv_option_debug_domains, "Debug output selection",
@@ -684,7 +692,12 @@ main (int argc, char **argv)
684692
NULL);
685693
}
686694

687-
arv_stream_create_buffers(stream, 50, NULL, NULL, NULL);
695+
if (arv_option_native_buffers)
696+
arv_stream_create_buffers(stream, N_BUFFERS, NULL, NULL, NULL);
697+
else {
698+
for (i = 0; i < N_BUFFERS; i++)
699+
arv_stream_push_buffer (stream, arv_buffer_new_allocate (payload));
700+
}
688701

689702
arv_camera_set_acquisition_mode (camera, ARV_ACQUISITION_MODE_CONTINUOUS, NULL);
690703

0 commit comments

Comments
 (0)