forked from windock/erlyvideo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a31a23f
commit 671b2c3
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-module(ems_config). | ||
|
||
-export([test/0]). | ||
|
||
|
||
test() -> | ||
{ok, Lex, _} = ems_config_lex:string(binary_to_list(element(2,file:read_file("priv/example.conf")))), | ||
io:format("Lex: ~p~n", [Lex]), | ||
ems_config_parser:parse(Lex). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Definitions. | ||
|
||
D = [0-9] | ||
L = [A-Z0-9a-z_:] | ||
LS = [][A-Z0-9a-z_\s%*$#@().><:/\-\+] | ||
WS = ([\000-\s]|%.*) | ||
|
||
SPACE = [\s\t\r\n]+ | ||
NAME = ([A-Z0-9a-z_]+) | ||
|
||
Rules. | ||
|
||
server : {token,{server_def,TokenLine, server}}. | ||
module : {token,{module_def,TokenLine, module}}. | ||
{D}+ : {token,{integer,TokenLine,list_to_integer(TokenChars)}}. | ||
%%{L}+_appender : {token,{apender,TokenLine,list_to_atom(TokenChars)}}. | ||
{L}+ : {token,{atom,TokenLine,list_to_atom(TokenChars)}}. | ||
'{LS}+' : {token,{val,TokenLine,strip(TokenChars,TokenLen)}}. | ||
"{LS}+" : {token,{val,TokenLine,strip(TokenChars,TokenLen)}}. | ||
[{};] : {token,{list_to_atom(TokenChars),TokenLine}}. | ||
{WS}+ : skip_token. | ||
|
||
|
||
Erlang code. | ||
|
||
strip(TokenChars,TokenLen) -> | ||
lists:sublist(TokenChars, 2, TokenLen - 2). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Nonterminals servers server module section_name key_values value key_value values. | ||
|
||
Terminals '{' '}' 'server_def' 'module_def' 'integer' 'val' 'atom' ';'. | ||
|
||
Rootsymbol servers. | ||
|
||
servers -> server : ['$1']. | ||
servers -> module : ['$1']. | ||
servers -> key_value : ['$1']. | ||
servers -> server servers : ['$1'] ++ '$2'. | ||
servers -> module servers : ['$1'] ++ '$2'. | ||
servers -> key_value servers : ['$1'] ++ '$2'. | ||
|
||
|
||
section_name -> atom : unwrap('$1'). | ||
server -> server_def section_name '{' key_values '}' : {server, '$2', '$4'}. | ||
module -> module_def section_name '{' key_values '}' : {'$2', '$4'}. | ||
|
||
|
||
key_values -> key_value : ['$1']. | ||
key_values -> key_value key_values : ['$1'] ++ '$2'. | ||
|
||
|
||
key_value -> atom values ';' : list_to_tuple([unwrap('$1')] ++ '$2'). | ||
|
||
values -> value : ['$1']. | ||
values -> value values : ['$1'] ++ '$2'. | ||
|
||
value -> val : unwrap('$1'). | ||
value -> integer : unwrap('$1'). | ||
value -> atom : unwrap('$1'). | ||
|
||
|
||
Erlang code. | ||
|
||
unwrap({_,_,V}) -> io:format("Unwrap: ~p~n", [V]), V. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
|
||
server default { | ||
listen 1935; | ||
server_name erlyvideo.org rtmp.erlyvideo.org; | ||
|
||
secret_key "1234"; | ||
|
||
root "/Users/max/Movies", "/var/lib/erlyvideo/movies"; | ||
|
||
user_limit 100; | ||
|
||
rtmp { | ||
handlers remove_useless_prefix, trusted_login, apps_push, | ||
apps_rewrite_play "http://erlyvideo.org/stream_auth", | ||
apps_registrator, apps_stat_collector, apps_streaming, apps_recording, apps_sip; | ||
} | ||
|
||
http { | ||
location / { | ||
handlers ems_http_rtmpt, ems_http_file registrator, ems_http_file "/Users/max/Sites/registrator/wwwroot"; | ||
} | ||
|
||
location /erlyvideo/api { | ||
handlers ems_http_erlyvideo_api; | ||
} | ||
|
||
location /shoutcast { | ||
handlers ems_http_shoutcast; | ||
} | ||
|
||
location /deskshare { | ||
handlers ems_http_deskshare; | ||
} | ||
} | ||
|
||
play { | ||
location / { | ||
handlers rewrite, http, rtsp, ts_file, file, livestream; | ||
} | ||
|
||
location /playlists { | ||
handlers playlist_adapter "http://erlyvideo.org/playlists"; | ||
} | ||
|
||
rewrite "cam1_view" registrator_playlist '{camera,"cam1"},{public,false},{clients_timeout,0}'; | ||
rewrite "mpeg2" mpegts "http://erlybuild.local:4242/bynumber/1" '{clients_timeout,1}'; | ||
rewrite "pp3" mpegts "http://localhost:9022/" failover="http://localhost:9023",registrator=false; | ||
rewrite "axis" rtsp "rtsp://root:root@axis-00408ca51334.local./axis-media/media.amp" clients_timeout=false,source_timeout=false,retry_limit=false; | ||
} | ||
} |