Skip to content

Commit 7cb115c

Browse files
committed
cameratest: report stream init error
1 parent 519849f commit 7cb115c

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

src/arvcameratest.c

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -723,44 +723,51 @@ main (int argc, char **argv)
723723
emit_software_trigger, camera);
724724
}
725725

726-
arv_camera_start_acquisition (camera, NULL);
726+
g_clear_error (&error);
727+
arv_camera_start_acquisition (camera, &error);
728+
if (error == NULL) {
727729

728-
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data);
729-
arv_stream_set_emit_signals (stream, TRUE);
730+
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data);
731+
arv_stream_set_emit_signals (stream, TRUE);
730732

731-
g_signal_connect (arv_camera_get_device (camera), "control-lost",
732-
G_CALLBACK (control_lost_cb), NULL);
733+
g_signal_connect (arv_camera_get_device (camera), "control-lost",
734+
G_CALLBACK (control_lost_cb), NULL);
733735

734-
data.start_time = g_get_monotonic_time();
736+
data.start_time = g_get_monotonic_time();
735737

736-
g_timeout_add (1000, periodic_task_cb, &data);
738+
g_timeout_add (1000, periodic_task_cb, &data);
737739

738-
data.main_loop = g_main_loop_new (NULL, FALSE);
740+
data.main_loop = g_main_loop_new (NULL, FALSE);
739741

740-
old_sigint_handler = signal (SIGINT, set_cancel);
742+
old_sigint_handler = signal (SIGINT, set_cancel);
741743

742-
g_main_loop_run (data.main_loop);
744+
g_main_loop_run (data.main_loop);
743745

744-
if (software_trigger_source > 0)
745-
g_source_remove (software_trigger_source);
746+
if (software_trigger_source > 0)
747+
g_source_remove (software_trigger_source);
746748

747-
signal (SIGINT, old_sigint_handler);
749+
signal (SIGINT, old_sigint_handler);
748750

749-
g_main_loop_unref (data.main_loop);
751+
g_main_loop_unref (data.main_loop);
750752

751-
arv_stream_get_statistics (stream, &n_completed_buffers, &n_failures, &n_underruns);
753+
arv_stream_get_statistics (stream, &n_completed_buffers, &n_failures, &n_underruns);
752754

753-
for (i = 0; i < arv_stream_get_n_infos (stream); i++) {
754-
if (arv_stream_get_info_type (stream, i) == G_TYPE_UINT64) {
755-
g_print ("%-22s = %" G_GUINT64_FORMAT "\n",
756-
arv_stream_get_info_name (stream, i),
757-
arv_stream_get_info_uint64 (stream, i));
755+
for (i = 0; i < arv_stream_get_n_infos (stream); i++) {
756+
if (arv_stream_get_info_type (stream, i) == G_TYPE_UINT64) {
757+
g_print ("%-22s = %" G_GUINT64_FORMAT "\n",
758+
arv_stream_get_info_name (stream, i),
759+
arv_stream_get_info_uint64 (stream, i));
760+
}
758761
}
759-
}
760762

761-
arv_camera_stop_acquisition (camera, NULL);
763+
arv_camera_stop_acquisition (camera, NULL);
762764

763-
arv_stream_set_emit_signals (stream, FALSE);
765+
arv_stream_set_emit_signals (stream, FALSE);
766+
} else {
767+
printf ("Failed to start acquisition (%s)\n",
768+
error->message);
769+
g_clear_error (&error);
770+
}
764771

765772
g_object_unref (stream);
766773
} else {

0 commit comments

Comments
 (0)