diff --git a/src/libs/frame.h b/src/libs/frame.h index 44abef9..b5facc2 100644 --- a/src/libs/frame.h +++ b/src/libs/frame.h @@ -26,26 +26,30 @@ #include "tools.h" +#define US_FRAME_META_DECLARE \ + uint width; \ + uint height; \ + uint format; \ + uint stride; \ + /* Stride is a bytesperline in V4L2 */ \ + /* https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/pixfmt-v4l2.html */ \ + /* https://medium.com/@oleg.shipitko/what-does-stride-mean-in-image-processing-bba158a72bcd */ \ + bool online; \ + bool key; \ + uint gop; \ + \ + ldf grab_ts; \ + ldf encode_begin_ts; \ + ldf encode_end_ts; + + typedef struct { u8 *data; uz used; uz allocated; int dma_fd; - uint width; - uint height; - uint format; - uint stride; - // Stride is a bytesperline in V4L2 - // https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/pixfmt-v4l2.html - // https://medium.com/@oleg.shipitko/what-does-stride-mean-in-image-processing-bba158a72bcd - bool online; - bool key; - uint gop; - - ldf grab_ts; - ldf encode_begin_ts; - ldf encode_end_ts; + US_FRAME_META_DECLARE; } us_frame_s; diff --git a/src/libs/memsinksh.h b/src/libs/memsinksh.h index 639e389..031ee37 100644 --- a/src/libs/memsinksh.h +++ b/src/libs/memsinksh.h @@ -23,33 +23,23 @@ #pragma once #include "types.h" +#include "frame.h" #define US_MEMSINK_MAGIC ((u64)0xCAFEBABECAFEBABE) -#define US_MEMSINK_VERSION ((u32)6) +#define US_MEMSINK_VERSION ((u32)7) typedef struct { u64 magic; u32 version; - u64 id; - uz used; - uint width; - uint height; - uint format; - uint stride; - bool online; - bool key; - uint gop; - - ldf grab_ts; - ldf encode_begin_ts; - ldf encode_end_ts; ldf last_client_ts; bool key_requested; + + US_FRAME_META_DECLARE; } us_memsink_shared_s;