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
3fbd12d1
Commit
3fbd12d1
authored
Aug 25, 2010
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle IPv6 in the SDP demuxer
Originally committed as revision 24924 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
94f8b2d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
rtsp.c
libavformat/rtsp.c
+24
-9
rtsp.h
libavformat/rtsp.h
+1
-1
No files found.
libavformat/rtsp.c
View file @
3fbd12d1
...
...
@@ -204,9 +204,21 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
}
static
int
get_sockaddr
(
const
char
*
buf
,
struct
sockaddr_storage
*
sock
)
{
struct
addrinfo
hints
,
*
ai
=
NULL
;
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_flags
=
AI_NUMERICHOST
;
if
(
getaddrinfo
(
buf
,
NULL
,
&
hints
,
&
ai
))
return
-
1
;
memcpy
(
sock
,
ai
->
ai_addr
,
FFMIN
(
sizeof
(
*
sock
),
ai
->
ai_addrlen
));
freeaddrinfo
(
ai
);
return
0
;
}
typedef
struct
SDPParseState
{
/* SDP only */
struct
in_addr
default_ip
;
struct
sockaddr_storage
default_ip
;
int
default_ttl
;
int
skip_media
;
///< set if an unknown m= line occurs
}
SDPParseState
;
...
...
@@ -221,7 +233,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
int
payload_type
,
i
;
AVStream
*
st
;
RTSPStream
*
rtsp_st
;
struct
in_addr
sdp_ip
;
struct
sockaddr_storage
sdp_ip
;
int
ttl
;
dprintf
(
s
,
"sdp: %c='%s'
\n
"
,
letter
,
buf
);
...
...
@@ -235,10 +247,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if
(
strcmp
(
buf1
,
"IN"
)
!=
0
)
return
;
get_word
(
buf1
,
sizeof
(
buf1
),
&
p
);
if
(
strcmp
(
buf1
,
"IP4"
)
!=
0
)
if
(
strcmp
(
buf1
,
"IP4"
)
&&
strcmp
(
buf1
,
"IP6"
)
)
return
;
get_word_sep
(
buf1
,
sizeof
(
buf1
),
"/"
,
&
p
);
if
(
ff_inet_aton
(
buf1
,
&
sdp_ip
)
==
0
)
if
(
get_sockaddr
(
buf1
,
&
sdp_ip
)
)
return
;
ttl
=
16
;
if
(
*
p
==
'/'
)
{
...
...
@@ -1171,7 +1183,7 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
port
=
reply
->
transports
[
0
].
port_min
;
ttl
=
reply
->
transports
[
0
].
ttl
;
}
else
{
in
=
rtsp_st
->
sdp_ip
;
in
=
((
struct
sockaddr_in
*
)
&
rtsp_st
->
sdp_ip
)
->
sin_addr
;
port
=
rtsp_st
->
sdp_port
;
ttl
=
rtsp_st
->
sdp_ttl
;
}
...
...
@@ -1996,10 +2008,10 @@ static int sdp_probe(AVProbeData *p1)
{
const
char
*
p
=
p1
->
buf
,
*
p_end
=
p1
->
buf
+
p1
->
buf_size
;
/* we look for a line beginning "c=IN IP
4
" */
/* we look for a line beginning "c=IN IP" */
while
(
p
<
p_end
&&
*
p
!=
'\0'
)
{
if
(
p
+
sizeof
(
"c=IN IP
4
"
)
-
1
<
p_end
&&
av_strstart
(
p
,
"c=IN IP
4
"
,
NULL
))
if
(
p
+
sizeof
(
"c=IN IP"
)
-
1
<
p_end
&&
av_strstart
(
p
,
"c=IN IP"
,
NULL
))
return
AVPROBE_SCORE_MAX
/
2
;
while
(
p
<
p_end
-
1
&&
*
p
!=
'\n'
)
p
++
;
...
...
@@ -2037,10 +2049,13 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* open each RTP stream */
for
(
i
=
0
;
i
<
rt
->
nb_rtsp_streams
;
i
++
)
{
char
namebuf
[
50
];
rtsp_st
=
rt
->
rtsp_streams
[
i
];
getnameinfo
((
struct
sockaddr
*
)
&
rtsp_st
->
sdp_ip
,
sizeof
(
rtsp_st
->
sdp_ip
),
namebuf
,
sizeof
(
namebuf
),
NULL
,
0
,
NI_NUMERICHOST
);
ff_url_join
(
url
,
sizeof
(
url
),
"rtp"
,
NULL
,
inet_ntoa
(
rtsp_st
->
sdp_ip
)
,
rtsp_st
->
sdp_port
,
namebuf
,
rtsp_st
->
sdp_port
,
"?localport=%d&ttl=%d"
,
rtsp_st
->
sdp_port
,
rtsp_st
->
sdp_ttl
);
if
(
url_open
(
&
rtsp_st
->
rtp_handle
,
url
,
URL_RDWR
)
<
0
)
{
...
...
libavformat/rtsp.h
View file @
3fbd12d1
...
...
@@ -327,7 +327,7 @@ typedef struct RTSPStream {
/** The following are used only in SDP, not RTSP */
//@{
int
sdp_port
;
/**< port (from SDP content) */
struct
in_addr
sdp_ip
;
/**< IP address (from SDP content) */
struct
sockaddr_storage
sdp_ip
;
/**< IP address (from SDP content) */
int
sdp_ttl
;
/**< IP Time-To-Live (from SDP content) */
int
sdp_payload_type
;
/**< payload type */
//@}
...
...
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