The StreamInfo message contanis information about the new stream, e.g. the guest (xrandr) output ID of the monitor that is being streamed. --- configure.ac | 2 +- src/spice-streaming-agent.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d8af9a1..c78e54a 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,7 @@ PKG_PROG_PKG_CONFIG dnl ========================================================================= dnl Check deps -SPICE_PROTOCOL_MIN_VER=0.12.14 +SPICE_PROTOCOL_MIN_VER=0.12.15 PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= $SPICE_PROTOCOL_MIN_VER]) AC_SUBST([SPICE_PROTOCOL_MIN_VER]) diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp index 1121f35..667f2d6 100644 --- a/src/spice-streaming-agent.cpp +++ b/src/spice-streaming-agent.cpp @@ -55,6 +55,12 @@ struct SpiceStreamDataMessage StreamMsgData msg; }; +struct SpiceStreamInfoMessage +{ + StreamDevHeader hdr; + StreamMsgInfo msg; +}; + static bool streaming_requested = false; static bool quit_requested = false; static bool log_binary = false; @@ -204,6 +210,20 @@ static void spice_stream_send_format(StreamPort &stream_port, unsigned w, unsign stream_port.write(&msg, msgsize); } +static void spice_stream_send_info(StreamPort &stream_port, uint32_t output_id) +{ + SpiceStreamInfoMessage msg; + const size_t msgsize = sizeof(msg); + const size_t hdrsize = sizeof(msg.hdr); + memset(&msg, 0, msgsize); + msg.hdr.protocol_version = STREAM_DEVICE_PROTOCOL; + msg.hdr.type = STREAM_TYPE_INFO; + msg.hdr.size = msgsize - hdrsize; + msg.msg.output_id = output_id; + syslog(LOG_DEBUG, "writing stream info\n"); + stream_port.write(&msg, msgsize); +} + static void spice_stream_send_frame(StreamPort &stream_port, const void *buf, const unsigned size) { SpiceStreamDataMessage msg; @@ -387,6 +407,8 @@ do_capture(StreamPort &stream_port, FILE *f_log) syslog(LOG_DEBUG, "wXh %uX%u codec=%u\n", width, height, codec); STAT_LOG("Started new stream wXh %uX%u codec=%u", width, height, codec); + // TODO use xrandr to get the output id, hard-coded 1 is ok until multimonitor support + spice_stream_send_info(stream_port, 1); spice_stream_send_format(stream_port, width, height, codec); } STAT_LOG("Frame of %zu bytes:", frame.buffer_size); -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel