pass online flag to rawsink

This commit is contained in:
Devaev Maxim
2020-12-14 13:19:55 +03:00
parent cf5f284b95
commit 0d97fffb3e
3 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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");