Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/maxlapshin/erlyvideo
Browse files Browse the repository at this point in the history
  • Loading branch information
windock committed Nov 26, 2009
2 parents 401af5b + e8edbea commit 16cd839
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions Emakefile
Expand Up @@ -3,6 +3,7 @@
{"src/apps/*", [{d, debug}, {outdir, "ebin"}, {i, "include"}]}.
{"src/media/*", [{d, debug}, {outdir, "ebin"}, {i, "include"}]}.
{"src/formats/*", [{d, debug}, {outdir, "ebin"}, {i, "include"}]}.
{"src/plugins/*", [{d, debug}, {outdir, "ebin"}, {i, "include"}]}.
{"deps/misultin/src/*", [{outdir, "ebin"}, {i, "deps/misultin/include"}]}.
{"deps/erlydtl-0.5.3/src/erlydtl/*", [{outdir, "ebin"}, {i, "deps/erlydtl-0.5.3/include"}]}.
% debug_info, bin_opt_info,
10 changes: 8 additions & 2 deletions src/amf0.erl
Expand Up @@ -120,8 +120,14 @@ decode_list(List, Data) ->
decode(Bin) ->
{string, Command, Rest} = parse(Bin),
FullArguments = decode_list([], Rest),
[_Num | Arguments] = FullArguments,
#amf{command = list_to_atom(Command), args = Arguments, type = invoke}.
% ?D({"Rest", Rest, FullArguments}),
case FullArguments of
[{number, Id} | Arguments] -> #amf{command = list_to_atom(Command), args = Arguments, type = invoke, id = Id};
Arguments -> #amf{command = list_to_atom(Command), args = Arguments, type = notify}
end.
% [{number, Id} | Arguments] = FullArguments,
% #amf{command = list_to_atom(Command), args = Arguments, type = invoke, id = Id}.

% case parse(Rest) of
% {{mixed_array, Rest2}, _Rest3} -> %without id, set type to notify
% Args = decode_args(Rest2, []),
Expand Down
2 changes: 1 addition & 1 deletion src/apps/apps_rtmp.erl
Expand Up @@ -96,7 +96,7 @@ connect(AMF, #rtmp_client{window_size = WindowAckSize} = State) ->
reply(Id, Args) ->
gen_fsm:send_event(self(), {invoke, #amf{
command = '_result',
id = Id, %% muriel: dirty too, but the only way I can make this work
id = Id,
type = invoke,
args= Args}}).

Expand Down
4 changes: 3 additions & 1 deletion src/media/stream_media.erl
Expand Up @@ -57,6 +57,7 @@ init([Name, record]) ->
Clients = ets:new(clients, [set, private]),
FileName = filename:join([file_play:file_dir(), Name ++ ".flv"]),
(catch file:delete(FileName)),
ok = filelib:ensure_dir(FileName),
Header = flv:header(#flv_header{version = 1, audio = 1, video = 1}),
?D({"Recording to file", FileName}),
case file:open(FileName, [write, {delayed_write, 1024, 50}]) of
Expand All @@ -65,6 +66,7 @@ init([Name, record]) ->
Recorder = #media_info{type=record, device = Device, file_name = FileName, ts_prev = 0, clients = Clients},
{ok, Recorder, ?TIMEOUT};
_Error ->
error_logger:error_msg("Failed to start recording stream to ~p because of ~p", [FileName, _Error]),
ignore
end.

Expand Down Expand Up @@ -120,7 +122,7 @@ handle_call({set_owner, _Owner}, _From, #media_info{owner = Owner} = MediaInfo)

handle_call({publish, Channel}, _From, #media_info{device = Device, clients = Clients} = Recorder) ->
Tag = ems_flv:to_tag(Channel),
?D({"Record",Channel#channel.type, Channel#channel.timestamp}),
% ?D({"Record",Channel#channel.type, Channel#channel.timestamp}),
case Device of
undefined -> ok;
_ -> file:write(Device, Tag)
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/.gitignore
@@ -0,0 +1,2 @@
*.erl

2 changes: 1 addition & 1 deletion src/rtmp.erl
Expand Up @@ -272,7 +272,7 @@ command(#channel{type = Type}, State) ->
State.

call_function(unhandled, Command, #rtmp_client{addr = IP, port = Port} = State, #amf{args = Args}) ->
error_logger:error_msg("Client ~p:~p requested unknown function ~p/~p", [IP, Port, Command, length(Args)]),
error_logger:error_msg("Client ~p:~p requested unknown function ~p/~p~n", [IP, Port, Command, length(Args)]),
State;

call_function(App, Command, State, AMF) ->
Expand Down

0 comments on commit 16cd839

Please sign in to comment.