新增更新流代理的功能,支持修改已有拉流代理的URL和参数

This commit is contained in:
xia-chu
2026-03-20 21:59:55 +08:00
parent 0f704cca47
commit 899d9653a4
5 changed files with 61 additions and 25 deletions

View File

@@ -374,6 +374,20 @@ PYBIND11_EMBEDDED_MODULE(mk_loader, m) {
py::arg("timeout_sec") = 0.0f, py::arg("opt") = py::dict()
);
// update_stream_proxy(vhost, app, stream, url, opt={})
// 更新已有拉流代理的 url 和参数,流不存在时抛出异常
m.def("update_stream_proxy",
[](const std::string &vhost, const std::string &app, const std::string &stream,
const std::string &url, const py::dict &opt) {
mINI args = to_native(opt);
MediaTuple tuple { vhost.empty() ? DEFAULT_VHOST : vhost, app, stream, "" };
py::gil_scoped_release release;
updateStreamProxy(tuple, url, args);
},
py::arg("vhost"), py::arg("app"), py::arg("stream"), py::arg("url"),
py::arg("opt") = py::dict()
);
m.def("set_fastapi", [](const py::object &check_route, const py::object &submit_coro) {
static void *fastapi_tag = nullptr;
NoticeCenter::Instance().delListener(&fastapi_tag, Broadcast::kBroadcastHttpRequest);