-
Notifications
You must be signed in to change notification settings - Fork 21
/
publisher.erl
executable file
·36 lines (30 loc) · 1.14 KB
/
publisher.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env escript
%%! -boot start_sasl +A 4 +a 4096
% -include_lib("erlmedia/include/video_frame.hrl").
-define(TIME, 3).
main([]) ->
main([undefined]);
main([ConfigPath]) ->
io:format("UVC streamer~n"),
%erlang:system_flag(scheduler_bind_type, spread),
%io:format("~p~n", [erlang:system_info(scheduler_bind_type)]),
%io:format("~p~n", [erlang:system_info(multi_scheduling)]),
%io:format("~p~n", [{erlang:system_info(smp_support),erlang:system_info(threads),erlang:system_info(thread_pool_size),erlang:system_info(schedulers_online)}]),
Root = filename:dirname(escript:script_name()),
[code:add_pathz(P) || P <- filelib:wildcard(Root ++ "/apps/*/ebin")],
[code:add_pathz(P) || P <- filelib:wildcard(Root ++ "/deps/*/ebin")],
case file:read_file_info(Root ++ "/publisher.conf") of
{error, enoent} -> os:cmd("cp "++Root++"/publisher.conf.sample "++Root++"/publisher.conf");
_ -> ok
end,
Options = case ConfigPath of
undefined -> [];
_ -> [{config,ConfigPath}]
end,
{ok, Pid} = publisher:run(Options),
erlang:monitor(process, Pid),
receive
stop -> ok;
{'DOWN', _, process, Pid, _} -> ok
end,
ok.