Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
dbb06b8c
Commit
dbb06b8c
authored
Jan 21, 2012
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtsp: Allow specifying the UDP port range via AVOptions
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
bc495bad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
rtsp.c
libavformat/rtsp.c
+11
-2
rtsp.h
libavformat/rtsp.h
+5
-0
No files found.
libavformat/rtsp.c
View file @
dbb06b8c
...
...
@@ -81,6 +81,8 @@ const AVOption ff_rtsp_options[] = {
{
"http"
,
"HTTP tunneling"
,
0
,
AV_OPT_TYPE_CONST
,
{(
1
<<
RTSP_LOWER_TRANSPORT_HTTP
)},
0
,
0
,
DEC
,
"rtsp_transport"
},
RTSP_FLAG_OPTS
(
"rtsp_flags"
,
"RTSP flags"
),
RTSP_MEDIATYPE_OPTS
(
"allowed_media_types"
,
"Media types to accept from the server"
),
{
"min_port"
,
"Minimum local UDP port"
,
OFFSET
(
rtp_port_min
),
AV_OPT_TYPE_INT
,
{
RTSP_RTP_PORT_MIN
},
0
,
65535
,
DEC
|
ENC
},
{
"max_port"
,
"Maximum local UDP port"
,
OFFSET
(
rtp_port_max
),
AV_OPT_TYPE_INT
,
{
RTSP_RTP_PORT_MAX
},
0
,
65535
,
DEC
|
ENC
},
{
NULL
},
};
...
...
@@ -1121,7 +1123,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
/* XXX: we assume the same server is used for the control of each
* RTSP stream */
for
(
j
=
RTSP_RTP_PORT_MIN
,
i
=
0
;
i
<
rt
->
nb_rtsp_streams
;
++
i
)
{
for
(
j
=
rt
->
rtp_port_min
,
i
=
0
;
i
<
rt
->
nb_rtsp_streams
;
++
i
)
{
char
transport
[
2048
];
/*
...
...
@@ -1158,7 +1160,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
}
/* first try in specified port range */
while
(
j
<=
RTSP_RTP_PORT_MAX
)
{
while
(
j
<=
rt
->
rtp_port_max
)
{
ff_url_join
(
buf
,
sizeof
(
buf
),
"rtp"
,
NULL
,
host
,
-
1
,
"?localport=%d"
,
j
);
/* we will use two ports per rtp stream (rtp and rtcp) */
...
...
@@ -1356,6 +1358,13 @@ int ff_rtsp_connect(AVFormatContext *s)
struct
sockaddr_storage
peer
;
socklen_t
peer_len
=
sizeof
(
peer
);
if
(
rt
->
rtp_port_max
<
rt
->
rtp_port_min
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid UDP port range, max port %d less "
"than min port %d
\n
"
,
rt
->
rtp_port_max
,
rt
->
rtp_port_min
);
return
AVERROR
(
EINVAL
);
}
if
(
!
ff_network_init
())
return
AVERROR
(
EIO
);
...
...
libavformat/rtsp.h
View file @
dbb06b8c
...
...
@@ -359,6 +359,11 @@ typedef struct RTSPState {
* Mask of all requested media types
*/
int
media_type_mask
;
/**
* Minimum and maximum local UDP ports.
*/
int
rtp_port_min
,
rtp_port_max
;
}
RTSPState
;
#define RTSP_FLAG_FILTER_SRC 0x1
/**< Filter incoming UDP packets -
...
...
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