-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRtspProxy.dpr
61 lines (54 loc) · 1.32 KB
/
RtspProxy.dpr
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
program RtspProxy;
{$APPTYPE CONSOLE}
uses
SysUtils, Classes;
const
RtspProxyLib = 'RtspProxyLib';
procedure InitProxy; stdcall; external RtspProxyLib;
procedure StartProxy; stdcall; external RtspProxyLib;
procedure StopProxy; stdcall; external RtspProxyLib;
procedure AppendResource(Name, RtspAddress: PChar); stdcall; external RtspProxyLib;
procedure LoadResources;
const
ResourceFile = 'Resources.cfg';
var
I, P: Integer;
Lines: TStrings;
Line, Name, Resource: String;
begin
if FileExists(ResourceFile) then
begin
Lines := TStringList.Create;
try
Lines.LoadFromFile(ResourceFile);
for I := 0 to Lines.Count-1 do
begin
Line := Trim(Lines[I]);
if Line = '' then Continue;
if Line[1] = '#' then Continue;
P := Pos('=', Line);
if P < 0 then Continue;
Name := Trim(Copy(Line, 1, P-1));
Resource := Trim(Copy(Line, P+1, MaxInt));
AppendResource(PChar(Name), PChar(Resource));
end;
finally
Lines.Free;
end;
end;
end;
begin
try
WriteLn('MWIE RTSP Proxy Server. Signatec (c) 2012.');
WriteLn;
WriteLn('Press Enter to stop proxy');
WriteLn;
InitProxy;
LoadResources;
StartProxy;
ReadLn;
StopProxy;
except
on E: Exception do WriteLn(E.ClassName + ': ' + E.Message);
end;
end.