Add built-in MPEGTS-over-TCP stream server (--stream-port)

Co-authored-by: yeicor <4929005+yeicor@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-13 08:18:36 +00:00
parent 1494c37eb5
commit d4e458370d
8 changed files with 879 additions and 1 deletions

View file

@ -114,6 +114,7 @@ enum {
OPT_NO_VD_SYSTEM_DECORATIONS,
OPT_NO_VD_DESTROY_CONTENT,
OPT_DISPLAY_IME_POLICY,
OPT_STREAM_PORT,
};
struct sc_option {
@ -956,6 +957,15 @@ static const struct sc_option options[] = {
"Default is info.",
#endif
},
{
.longopt_id = OPT_STREAM_PORT,
.longopt = "stream-port",
.argdesc = "port",
.text = "Start a TCP server that streams the device video (and audio, "
"if enabled) as MPEG-TS on the given port. "
"Once started, connect with any compatible player using "
"tcp://127.0.0.1:<port> (e.g. in OBS Media Source or VLC).",
},
{
.longopt_id = OPT_V4L2_SINK,
.longopt = "v4l2-sink",
@ -2686,6 +2696,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
LOGE("OTG mode (--otg) is disabled.");
return false;
#endif
case OPT_STREAM_PORT:
if (!parse_port(optarg, &opts->stream_port)) {
return false;
}
break;
case OPT_V4L2_SINK:
#ifdef HAVE_V4L2
opts->v4l2_device = optarg;