Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d2a1ea1d
Commit
d2a1ea1d
authored
Jun 22, 2008
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http or rtsp only support
Originally committed as revision 13859 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
3296409d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
ffserver.c
ffserver.c
+19
-12
No files found.
ffserver.c
View file @
d2a1ea1d
...
@@ -512,17 +512,27 @@ static void start_multicast(void)
...
@@ -512,17 +512,27 @@ static void start_multicast(void)
/* main loop of the http server */
/* main loop of the http server */
static
int
http_server
(
void
)
static
int
http_server
(
void
)
{
{
int
server_fd
,
ret
,
rtsp_server_fd
,
delay
,
delay1
;
int
server_fd
=
0
,
rtsp_server_fd
=
0
;
int
ret
,
delay
,
delay1
;
struct
pollfd
poll_table
[
HTTP_MAX_CONNECTIONS
+
2
],
*
poll_entry
;
struct
pollfd
poll_table
[
HTTP_MAX_CONNECTIONS
+
2
],
*
poll_entry
;
HTTPContext
*
c
,
*
c_next
;
HTTPContext
*
c
,
*
c_next
;
if
(
my_http_addr
.
sin_port
)
{
server_fd
=
socket_open_listen
(
&
my_http_addr
);
server_fd
=
socket_open_listen
(
&
my_http_addr
);
if
(
server_fd
<
0
)
if
(
server_fd
<
0
)
return
-
1
;
return
-
1
;
}
if
(
my_rtsp_addr
.
sin_port
)
{
rtsp_server_fd
=
socket_open_listen
(
&
my_rtsp_addr
);
rtsp_server_fd
=
socket_open_listen
(
&
my_rtsp_addr
);
if
(
rtsp_server_fd
<
0
)
if
(
rtsp_server_fd
<
0
)
return
-
1
;
return
-
1
;
}
if
(
!
rtsp_server_fd
&&
!
server_fd
)
{
http_log
(
"HTTP and RTSP disabled.
\n
"
);
return
-
1
;
}
http_log
(
"ffserver started.
\n
"
);
http_log
(
"ffserver started.
\n
"
);
...
@@ -535,13 +545,16 @@ static int http_server(void)
...
@@ -535,13 +545,16 @@ static int http_server(void)
for
(;;)
{
for
(;;)
{
poll_entry
=
poll_table
;
poll_entry
=
poll_table
;
if
(
server_fd
)
{
poll_entry
->
fd
=
server_fd
;
poll_entry
->
fd
=
server_fd
;
poll_entry
->
events
=
POLLIN
;
poll_entry
->
events
=
POLLIN
;
poll_entry
++
;
poll_entry
++
;
}
if
(
rtsp_server_fd
)
{
poll_entry
->
fd
=
rtsp_server_fd
;
poll_entry
->
fd
=
rtsp_server_fd
;
poll_entry
->
events
=
POLLIN
;
poll_entry
->
events
=
POLLIN
;
poll_entry
++
;
poll_entry
++
;
}
/* wait for events on each HTTP handle */
/* wait for events on each HTTP handle */
c
=
first_http_ctx
;
c
=
first_http_ctx
;
...
@@ -620,14 +633,18 @@ static int http_server(void)
...
@@ -620,14 +633,18 @@ static int http_server(void)
}
}
poll_entry
=
poll_table
;
poll_entry
=
poll_table
;
if
(
server_fd
)
{
/* new HTTP connection request ? */
/* new HTTP connection request ? */
if
(
poll_entry
->
revents
&
POLLIN
)
if
(
poll_entry
->
revents
&
POLLIN
)
new_connection
(
server_fd
,
0
);
new_connection
(
server_fd
,
0
);
poll_entry
++
;
poll_entry
++
;
}
if
(
rtsp_server_fd
)
{
/* new RTSP connection request ? */
/* new RTSP connection request ? */
if
(
poll_entry
->
revents
&
POLLIN
)
if
(
poll_entry
->
revents
&
POLLIN
)
new_connection
(
rtsp_server_fd
,
1
);
new_connection
(
rtsp_server_fd
,
1
);
}
}
}
}
}
/* start waiting for a new HTTP/RTSP request */
/* start waiting for a new HTTP/RTSP request */
...
@@ -4446,16 +4463,6 @@ int main(int argc, char **argv)
...
@@ -4446,16 +4463,6 @@ int main(int argc, char **argv)
av_init_random
(
av_gettime
()
+
(
getpid
()
<<
16
),
&
random_state
);
av_init_random
(
av_gettime
()
+
(
getpid
()
<<
16
),
&
random_state
);
/* address on which the server will handle HTTP connections */
my_http_addr
.
sin_family
=
AF_INET
;
my_http_addr
.
sin_port
=
htons
(
8080
);
my_http_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
/* address on which the server will handle RTSP connections */
my_rtsp_addr
.
sin_family
=
AF_INET
;
my_rtsp_addr
.
sin_port
=
htons
(
5454
);
my_rtsp_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
nb_max_connections
=
5
;
nb_max_connections
=
5
;
max_bandwidth
=
1000
;
max_bandwidth
=
1000
;
first_stream
=
NULL
;
first_stream
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment