From 0d97fffb3eec1ac21dd642dc19b22d4fc5aaad86 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Mon, 14 Dec 2020 13:19:55 +0300 Subject: [PATCH] pass online flag to rawsink --- src/rawsink/rawsink.c | 6 ++++-- src/rawsink/rawsink.h | 5 +++-- src/ustreamer/stream.c | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rawsink/rawsink.c b/src/rawsink/rawsink.c index 340ab1d..9c75585 100644 --- a/src/rawsink/rawsink.c +++ b/src/rawsink/rawsink.c @@ -133,7 +133,7 @@ int rawsink_server_put( rawsink_s *rawsink, const uint8_t *data, size_t size, unsigned format, unsigned width, unsigned height, - long double grab_ts) { + long double grab_ts, bool online) { long double now = get_now_monotonic(); @@ -157,6 +157,7 @@ int rawsink_server_put( COPY(width); COPY(height); COPY(grab_ts); + COPY(online); COPY(size); memcpy(rawsink->mem->data, data, size); # undef COPY @@ -185,7 +186,7 @@ int rawsink_client_get( rawsink_s *rawsink, char *data, size_t *size, unsigned *format, unsigned *width, unsigned *height, - long double *grab_ts) { + long double *grab_ts, bool *online) { assert(!rawsink->server); // Client only @@ -209,6 +210,7 @@ int rawsink_client_get( COPY(width); COPY(height); COPY(grab_ts); + COPY(online); COPY(size); memcpy(data, rawsink->mem->data, *size); # undef COPY diff --git a/src/rawsink/rawsink.h b/src/rawsink/rawsink.h index cfcdd36..5a9677c 100644 --- a/src/rawsink/rawsink.h +++ b/src/rawsink/rawsink.h @@ -50,6 +50,7 @@ typedef struct { unsigned width; unsigned height; long double grab_ts; + bool online; size_t size; uint8_t data[RAWSINK_MAX_DATA]; } rawsink_shared_s; @@ -75,10 +76,10 @@ int rawsink_server_put( rawsink_s *rawsink, const uint8_t *data, size_t size, unsigned format, unsigned witdh, unsigned height, - long double grab_ts); + long double grab_ts, bool online); int rawsink_client_get( rawsink_s *rawsink, char *data, size_t *size, unsigned *format, unsigned *width, unsigned *height, - long double *grab_ts); + long double *grab_ts, bool *online); diff --git a/src/ustreamer/stream.c b/src/ustreamer/stream.c index 9ec57ec..36de92e 100644 --- a/src/ustreamer/stream.c +++ b/src/ustreamer/stream.c @@ -212,7 +212,7 @@ void stream_loop(stream_s *stream) { # define HW(_next) DEV(run->hw_buffers[buf_index]._next) if (stream->rawsink && rawsink_server_put( stream->rawsink, HW(data), HW(used), HW(format), - HW(width), HW(height), HW(grab_ts) + HW(width), HW(height), HW(grab_ts), true ) < 0) { stream->rawsink = NULL; LOG_ERROR("RAW sink completely disabled due error"); @@ -273,7 +273,7 @@ static _pool_s *_stream_init_loop(stream_s *stream) { # define BLANK(_next) stream->blank->_next if (stream->rawsink && rawsink_server_put( stream->rawsink, BLANK(data), BLANK(used), V4L2_PIX_FMT_JPEG, - BLANK(width), BLANK(height), BLANK(grab_ts) + BLANK(width), BLANK(height), BLANK(grab_ts), false ) < 0) { stream->rawsink = NULL; LOG_ERROR("RAW sink completely disabled due error");