diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/daq/nginx-lua/s5-nginx.lua | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/daq/nginx-lua/s5-nginx.lua b/src/daq/nginx-lua/s5-nginx.lua index 8393562..3d6ad8e 100644 --- a/src/daq/nginx-lua/s5-nginx.lua +++ b/src/daq/nginx-lua/s5-nginx.lua @@ -39,7 +39,18 @@ -- lua_shared_dict sfive_locks 64k; -- lua_shared_dict sfive_data 64m; -- init_by_lua 's5 = require "s5-nginx.lua"'; --- init_worker_by_lua 's5.init_worker("myhostname", 5, "/path/to/sfive.sock")'; +-- init_worker_by_lua ' +-- s5.init_worker("myhostname", 5, "/path/to/sfive.sock", +-- { "tag1", "tag2" }, +-- { { "contentA", "format1", "low" }, +-- { "contentA", "format1", "high" }, +-- { "contentB", "format1", "low" }, +-- { "contentB", "format1", "high" }, +-- { "contentA", "format2", "low" }, +-- { "contentA", "format2", "high" }, +-- { "contentB", "format2", "low" }, +-- { "contentB", "format2", "high" } }) +-- '; -- -- ..... -- @@ -47,10 +58,12 @@ -- -- ..... -- --- location /path/to/hls/content-quality/ { --- log_by_lua 's5.log("content", "hls", "quality")'; +-- location /path/to/fromat1/contentA-low/ { +-- log_by_lua 's5.log("contentA", "format1", "low")'; +-- } +-- location /path/to/fromat1/contentA-high/ { +-- log_by_lua 's5.log("contentA", "format1", "high")'; -- } --- -- ..... -- -- } @@ -66,6 +79,8 @@ local config = { hostname = "unknown", duration = 5, sockpath = "/var/run/sfive.sock", + tags = {}, + streamer = {} } local sfive = ngx.shared.sfive local sfive_data = ngx.shared.sfive_data @@ -122,8 +137,13 @@ end local send_init = function(sock) local json = '{' - json = json .. '"version": 1,' - json = json .. '"hostname": "' .. config.hostname .. '"' + json = json .. '"version": 1' + json = json .. ',"hostname": "' .. config.hostname .. '"' + json = json .. ',"tags": [' + for i, k in ipairs(config.tags) do + json = json .. (i==1 and '' or ',') .. '"' .. k .. '"' + end + json = json .. ']' json = json .. '}\n' return sock:send(json) end @@ -194,10 +214,12 @@ local init = function() ngx.log(ngx.INFO, "SFive(init): task initialized successfully!") end -function _SFIVE.init_worker(hostname, duration, sockpath) +function _SFIVE.init_worker(hostname, duration, sockpath, tags, streamer) config.hostname = hostname config.duration = duration config.sockpath = sockpath + config.tags = (tags and tags or {}) + config.streamer = (streamer and streamer or {}) init() ngx.log(ngx.INFO, "SFive(init): worker initialized successfully!") end |