Add START_INGEST and STOP_INGEST protocol commands
START_INGEST carries stream_id, format/width/height/fps, dest_host:port, transport_mode (encapsulated or opaque), and device_path. All format fields default to 0 (auto-select). STOP_INGEST carries stream_id only. Both commands set wanted state on the node; reconciliation is asynchronous. Protocol doc updated with wire schemas for both commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#define PROTO_CMD_GET_CONTROL 0x0005u
|
||||
#define PROTO_CMD_SET_CONTROL 0x0006u
|
||||
#define PROTO_CMD_ENUM_MONITORS 0x0007u
|
||||
#define PROTO_CMD_START_INGEST 0x0008u
|
||||
#define PROTO_CMD_STOP_INGEST 0x0009u
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Response status codes (carried in CONTROL_RESPONSE payload offset 2)
|
||||
@@ -66,6 +68,13 @@
|
||||
#define PROTO_PIXEL_YUV420P 0x0004u
|
||||
#define PROTO_PIXEL_YUV422 0x0005u
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Transport mode codes (START_INGEST transport_mode field)
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
#define PROTO_TRANSPORT_ENCAPSULATED 0x0001u /* framed: message_type + payload_length header */
|
||||
#define PROTO_TRANSPORT_OPAQUE 0x0002u /* raw byte stream, no frame boundaries */
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Origin codes (STREAM_OPEN origin field; informational only)
|
||||
* ------------------------------------------------------------------------- */
|
||||
@@ -196,6 +205,33 @@ struct Proto_Set_Control_Req {
|
||||
int32_t value;
|
||||
};
|
||||
|
||||
/*
|
||||
* START_INGEST: controller tells a source node to open a V4L2 device and
|
||||
* connect outbound to a sink at dest_host:dest_port.
|
||||
* format/width/height/fps_n/fps_d of 0 mean auto-select.
|
||||
* Strings point into the caller's payload buffer; not NUL-terminated.
|
||||
*/
|
||||
struct Proto_Start_Ingest {
|
||||
uint16_t request_id;
|
||||
uint16_t stream_id;
|
||||
uint16_t format; /* PROTO_FORMAT_* code; 0 = auto (best MJPEG) */
|
||||
uint16_t width; /* 0 = auto */
|
||||
uint16_t height; /* 0 = auto */
|
||||
uint16_t fps_n; /* 0 = auto */
|
||||
uint16_t fps_d;
|
||||
uint16_t dest_port;
|
||||
uint16_t transport_mode; /* PROTO_TRANSPORT_ENCAPSULATED or PROTO_TRANSPORT_OPAQUE */
|
||||
const char *device_path;
|
||||
uint8_t device_path_len;
|
||||
const char *dest_host;
|
||||
uint8_t dest_host_len;
|
||||
};
|
||||
|
||||
struct Proto_Stop_Ingest {
|
||||
uint16_t request_id;
|
||||
uint16_t stream_id;
|
||||
};
|
||||
|
||||
struct Proto_Response_Header {
|
||||
uint16_t request_id;
|
||||
uint16_t status;
|
||||
@@ -253,6 +289,18 @@ struct App_Error proto_write_set_control(struct Transport_Conn *conn,
|
||||
struct App_Error proto_write_enum_monitors(struct Transport_Conn *conn,
|
||||
uint16_t request_id);
|
||||
|
||||
/* CONTROL_REQUEST: START_INGEST */
|
||||
struct App_Error proto_write_start_ingest(struct Transport_Conn *conn,
|
||||
uint16_t request_id, uint16_t stream_id,
|
||||
uint16_t format, uint16_t width, uint16_t height,
|
||||
uint16_t fps_n, uint16_t fps_d,
|
||||
uint16_t transport_mode,
|
||||
const char *device_path, const char *dest_host, uint16_t dest_port);
|
||||
|
||||
/* CONTROL_REQUEST: STOP_INGEST */
|
||||
struct App_Error proto_write_stop_ingest(struct Transport_Conn *conn,
|
||||
uint16_t request_id, uint16_t stream_id);
|
||||
|
||||
/*
|
||||
* CONTROL_RESPONSE: generic.
|
||||
* payload/payload_len are the command-specific bytes after request_id+status.
|
||||
@@ -325,6 +373,14 @@ struct App_Error proto_read_set_control_req(
|
||||
const uint8_t *payload, uint32_t length,
|
||||
struct Proto_Set_Control_Req *out);
|
||||
|
||||
struct App_Error proto_read_start_ingest(
|
||||
const uint8_t *payload, uint32_t length,
|
||||
struct Proto_Start_Ingest *out);
|
||||
|
||||
struct App_Error proto_read_stop_ingest(
|
||||
const uint8_t *payload, uint32_t length,
|
||||
struct Proto_Stop_Ingest *out);
|
||||
|
||||
/*
|
||||
* Read the common 4-byte response header (request_id + status).
|
||||
* For responses with no extra fields (STREAM_OPEN, STREAM_CLOSE, SET_CONTROL),
|
||||
|
||||
Reference in New Issue
Block a user