mirror of
https://github.com/pikvm/ustreamer.git
synced 2025-12-23 18:50:00 +00:00
verbose on-screen error messages
This commit is contained in:
parent
5b18e29555
commit
aec8431024
@ -193,6 +193,12 @@ int us_capture_open(us_capture_s *cap) {
|
|||||||
_LOG_DEBUG("Capture device fd=%d opened", run->fd);
|
_LOG_DEBUG("Capture device fd=%d opened", run->fd);
|
||||||
|
|
||||||
if (cap->dv_timings && cap->persistent) {
|
if (cap->dv_timings && cap->persistent) {
|
||||||
|
struct v4l2_control ctl = {.id = V4L2_CID_DV_RX_POWER_PRESENT};
|
||||||
|
if (!us_xioctl(run->fd, VIDIOC_G_CTRL, &ctl)) {
|
||||||
|
if (!ctl.value) {
|
||||||
|
goto error_no_cable;
|
||||||
|
}
|
||||||
|
}
|
||||||
_LOG_DEBUG("Probing DV-timings or QuerySTD ...");
|
_LOG_DEBUG("Probing DV-timings or QuerySTD ...");
|
||||||
if (_capture_open_dv_timings(cap, false) < 0) {
|
if (_capture_open_dv_timings(cap, false) < 0) {
|
||||||
US_ONCE_FOR(run->open_error_once, __LINE__, {
|
US_ONCE_FOR(run->open_error_once, __LINE__, {
|
||||||
@ -248,6 +254,10 @@ error_no_device:
|
|||||||
us_capture_close(cap);
|
us_capture_close(cap);
|
||||||
return US_ERROR_NO_DEVICE;
|
return US_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
|
error_no_cable:
|
||||||
|
us_capture_close(cap);
|
||||||
|
return US_ERROR_NO_CABLE;
|
||||||
|
|
||||||
error_no_signal:
|
error_no_signal:
|
||||||
us_capture_close(cap);
|
us_capture_close(cap);
|
||||||
return US_ERROR_NO_DATA;
|
return US_ERROR_NO_DATA;
|
||||||
|
|||||||
@ -24,4 +24,5 @@
|
|||||||
|
|
||||||
#define US_ERROR_COMMON -1
|
#define US_ERROR_COMMON -1
|
||||||
#define US_ERROR_NO_DEVICE -2
|
#define US_ERROR_NO_DEVICE -2
|
||||||
#define US_ERROR_NO_DATA -3
|
#define US_ERROR_NO_CABLE -3
|
||||||
|
#define US_ERROR_NO_DATA -4
|
||||||
|
|||||||
@ -529,6 +529,8 @@ static int _stream_init_loop(us_stream_s *stream) {
|
|||||||
|
|
||||||
int once = 0;
|
int once = 0;
|
||||||
while (!atomic_load(&stream->run->stop)) {
|
while (!atomic_load(&stream->run->stop)) {
|
||||||
|
char *blank_reason = "< NO SIGNAL >";
|
||||||
|
|
||||||
# ifdef WITH_GPIO
|
# ifdef WITH_GPIO
|
||||||
us_gpio_set_stream_online(false);
|
us_gpio_set_stream_online(false);
|
||||||
# endif
|
# endif
|
||||||
@ -554,16 +556,27 @@ static int _stream_init_loop(us_stream_s *stream) {
|
|||||||
switch (us_capture_open(stream->cap)) {
|
switch (us_capture_open(stream->cap)) {
|
||||||
case 0: break;
|
case 0: break;
|
||||||
case US_ERROR_NO_DEVICE:
|
case US_ERROR_NO_DEVICE:
|
||||||
|
blank_reason = "< NO CAPTURE DEVICE >";
|
||||||
|
goto known_error;
|
||||||
|
case US_ERROR_NO_CABLE:
|
||||||
|
blank_reason = "< NO VIDEO SOURCE >";
|
||||||
|
goto known_error;
|
||||||
case US_ERROR_NO_DATA:
|
case US_ERROR_NO_DATA:
|
||||||
US_ONCE({ US_LOG_INFO("Waiting for the capture device ..."); });
|
goto known_error;
|
||||||
goto offline_and_retry;
|
|
||||||
default:
|
default:
|
||||||
once = 0;
|
goto unknown_error;
|
||||||
goto offline_and_retry;
|
|
||||||
}
|
}
|
||||||
us_encoder_open(stream->enc, stream->cap);
|
us_encoder_open(stream->enc, stream->cap);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
known_error:
|
||||||
|
US_ONCE({ US_LOG_INFO("Waiting for the capture device ..."); });
|
||||||
|
goto offline_and_retry;
|
||||||
|
|
||||||
|
unknown_error:
|
||||||
|
once = 0;
|
||||||
|
goto offline_and_retry;
|
||||||
|
|
||||||
offline_and_retry:
|
offline_and_retry:
|
||||||
for (uint count = 0; count < stream->error_delay * 10; ++count) {
|
for (uint count = 0; count < stream->error_delay * 10; ++count) {
|
||||||
if (atomic_load(&run->stop)) {
|
if (atomic_load(&run->stop)) {
|
||||||
@ -577,7 +590,7 @@ static int _stream_init_loop(us_stream_s *stream) {
|
|||||||
width = stream->cap->width;
|
width = stream->cap->width;
|
||||||
height = stream->cap->height;
|
height = stream->cap->height;
|
||||||
}
|
}
|
||||||
us_blank_draw(run->blank, "< NO SIGNAL >", width, height);
|
us_blank_draw(run->blank, blank_reason, width, height);
|
||||||
|
|
||||||
_stream_update_captured_fpsi(stream, run->blank->raw, false);
|
_stream_update_captured_fpsi(stream, run->blank->raw, false);
|
||||||
_stream_expose_jpeg(stream, run->blank->jpeg);
|
_stream_expose_jpeg(stream, run->blank->jpeg);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user