Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
f94b080a
Commit
f94b080a
authored
Sep 05, 2007
by
Christophe Mutricy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings about asprintf() + cosmetics
parent
818a4855
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
43 deletions
+84
-43
modules/misc/rtsp.c
modules/misc/rtsp.c
+84
-43
No files found.
modules/misc/rtsp.c
View file @
f94b080a
...
@@ -75,7 +75,8 @@ vlc_module_begin();
...
@@ -75,7 +75,8 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
add_shortcut
(
"rtsp"
);
add_shortcut
(
"rtsp"
);
add_string
(
"rtsp-host"
,
NULL
,
NULL
,
HOST_TEXT
,
HOST_LONGTEXT
,
VLC_TRUE
);
add_string
(
"rtsp-host"
,
NULL
,
NULL
,
HOST_TEXT
,
HOST_LONGTEXT
,
VLC_TRUE
);
add_string
(
"rtsp-raw-mux"
,
"ts"
,
NULL
,
RAWMUX_TEXT
,
RAWMUX_TEXT
,
VLC_TRUE
);
add_string
(
"rtsp-raw-mux"
,
"ts"
,
NULL
,
RAWMUX_TEXT
,
RAWMUX_TEXT
,
VLC_TRUE
);
add_integer
(
"rtsp-throttle-users"
,
0
,
NULL
,
THROTLE_TEXT
,
add_integer
(
"rtsp-throttle-users"
,
0
,
NULL
,
THROTLE_TEXT
,
THROTLE_LONGTEXT
,
VLC_TRUE
);
THROTLE_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"rtsp-session-timeout"
,
5
,
NULL
,
SESSION_TIMEOUT_TEXT
,
add_integer
(
"rtsp-session-timeout"
,
5
,
NULL
,
SESSION_TIMEOUT_TEXT
,
...
@@ -368,7 +369,9 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
...
@@ -368,7 +369,9 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
TAB_INIT
(
p_media
->
i_rtsp
,
p_media
->
rtsp
);
TAB_INIT
(
p_media
->
i_rtsp
,
p_media
->
rtsp
);
p_media
->
b_raw
=
VLC_FALSE
;
p_media
->
b_raw
=
VLC_FALSE
;
asprintf
(
&
p_media
->
psz_rtsp_path
,
"%s%s"
,
p_sys
->
psz_path
,
psz_name
);
if
(
asprintf
(
&
p_media
->
psz_rtsp_path
,
"%s%s"
,
p_sys
->
psz_path
,
psz_name
)
<
0
)
return
NULL
;
p_media
->
p_rtsp_url
=
p_media
->
p_rtsp_url
=
httpd_UrlNewUnique
(
p_sys
->
p_rtsp_host
,
p_media
->
psz_rtsp_path
,
NULL
,
httpd_UrlNewUnique
(
p_sys
->
p_rtsp_host
,
p_media
->
psz_rtsp_path
,
NULL
,
NULL
,
NULL
);
NULL
,
NULL
);
...
@@ -383,12 +386,14 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
...
@@ -383,12 +386,14 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
msg_Dbg
(
p_vod
,
"created RTSP url: %s"
,
p_media
->
psz_rtsp_path
);
msg_Dbg
(
p_vod
,
"created RTSP url: %s"
,
p_media
->
psz_rtsp_path
);
asprintf
(
&
p_media
->
psz_rtsp_control_v4
,
if
(
asprintf
(
&
p_media
->
psz_rtsp_control_v4
,
"a=control:rtsp://%%s:%d%s/trackID=%%d
\r\n
"
,
"a=control:rtsp://%%s:%d%s/trackID=%%d
\r\n
"
,
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
);
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
)
<
0
)
asprintf
(
&
p_media
->
psz_rtsp_control_v6
,
return
NULL
;
if
(
asprintf
(
&
p_media
->
psz_rtsp_control_v6
,
"a=control:rtsp://[%%s]:%d%s/trackID=%%d
\r\n
"
,
"a=control:rtsp://[%%s]:%d%s/trackID=%%d
\r\n
"
,
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
);
p_sys
->
i_port
,
p_media
->
psz_rtsp_path
)
<
0
)
return
NULL
;
httpd_UrlCatch
(
p_media
->
p_rtsp_url
,
HTTPD_MSG_SETUP
,
httpd_UrlCatch
(
p_media
->
p_rtsp_url
,
HTTPD_MSG_SETUP
,
RtspCallback
,
(
void
*
)
p_media
);
RtspCallback
,
(
void
*
)
p_media
);
...
@@ -461,7 +466,8 @@ static void MediaDel( vod_t *p_vod, vod_media_t *p_media )
...
@@ -461,7 +466,8 @@ static void MediaDel( vod_t *p_vod, vod_media_t *p_media )
vlc_mutex_destroy
(
&
p_media
->
lock
);
vlc_mutex_destroy
(
&
p_media
->
lock
);
if
(
p_media
->
psz_session_name
)
free
(
p_media
->
psz_session_name
);
if
(
p_media
->
psz_session_name
)
free
(
p_media
->
psz_session_name
);
if
(
p_media
->
psz_session_description
)
free
(
p_media
->
psz_session_description
);
if
(
p_media
->
psz_session_description
)
free
(
p_media
->
psz_session_description
);
if
(
p_media
->
psz_session_url
)
free
(
p_media
->
psz_session_url
);
if
(
p_media
->
psz_session_url
)
free
(
p_media
->
psz_session_url
);
if
(
p_media
->
psz_session_email
)
free
(
p_media
->
psz_session_email
);
if
(
p_media
->
psz_session_email
)
free
(
p_media
->
psz_session_email
);
if
(
p_media
->
psz_mux
)
free
(
p_media
->
psz_mux
);
if
(
p_media
->
psz_mux
)
free
(
p_media
->
psz_mux
);
...
@@ -480,8 +486,9 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
...
@@ -480,8 +486,9 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
p_media
->
psz_mux
=
NULL
;
p_media
->
psz_mux
=
NULL
;
/* TODO: update SDP, etc... */
/* TODO: update SDP, etc... */
asprintf
(
&
psz_urlc
,
"%s/trackID=%d"
,
if
(
asprintf
(
&
psz_urlc
,
"%s/trackID=%d"
,
p_media
->
psz_rtsp_path
,
p_media
->
i_es
);
p_media
->
psz_rtsp_path
,
p_media
->
i_es
)
<
0
)
return
VLC_ENOMEM
;
msg_Dbg
(
p_vod
,
" - ES %4.4s (%s)"
,
(
char
*
)
&
p_fmt
->
i_codec
,
psz_urlc
);
msg_Dbg
(
p_vod
,
" - ES %4.4s (%s)"
,
(
char
*
)
&
p_fmt
->
i_codec
,
psz_urlc
);
switch
(
p_fmt
->
i_codec
)
switch
(
p_fmt
->
i_codec
)
...
@@ -491,7 +498,8 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
...
@@ -491,7 +498,8 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
{
{
p_es
->
i_payload_type
=
11
;
p_es
->
i_payload_type
=
11
;
}
}
else
if
(
p_fmt
->
audio
.
i_channels
==
2
&&
p_fmt
->
audio
.
i_rate
==
44100
)
else
if
(
p_fmt
->
audio
.
i_channels
==
2
&&
p_fmt
->
audio
.
i_rate
==
44100
)
{
{
p_es
->
i_payload_type
=
10
;
p_es
->
i_payload_type
=
10
;
}
}
...
@@ -570,7 +578,11 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
...
@@ -570,7 +578,11 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
}
}
/* */
/* */
if
(
p_64_sps
&&
p_64_pps
)
if
(
p_64_sps
&&
p_64_pps
)
asprintf
(
&
p_es
->
psz_fmtp
,
"packetization-mode=1;profile-level-id=%s;sprop-parameter-sets=%s,%s;"
,
hexa
,
p_64_sps
,
p_64_pps
);
if
(
asprintf
(
&
p_es
->
psz_fmtp
,
"packetization-mode=1;profile-level-id=%s;"
"sprop-parameter-sets=%s,%s;"
,
hexa
,
p_64_sps
,
p_64_pps
)
<
0
)
return
VLC_ENOMEM
;
if
(
p_64_sps
)
if
(
p_64_sps
)
free
(
p_64_sps
);
free
(
p_64_sps
);
if
(
p_64_pps
)
if
(
p_64_pps
)
...
@@ -971,7 +983,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -971,7 +983,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
answer
->
p_body
=
NULL
;
answer
->
p_body
=
NULL
;
break
;
break
;
}
}
asprintf
(
&
psz_new
,
"%d"
,
rand
()
);
if
(
asprintf
(
&
psz_new
,
"%d"
,
rand
()
)
<
0
)
return
VLC_ENOMEM
;
psz_session
=
psz_new
;
psz_session
=
psz_new
;
p_rtsp
=
RtspClientNew
(
p_media
,
psz_new
);
p_rtsp
=
RtspClientNew
(
p_media
,
psz_new
);
...
@@ -1003,17 +1016,20 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1003,17 +1016,20 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
{
{
if
(
strstr
(
psz_transport
,
"MP2T/H2221/UDP"
)
)
if
(
strstr
(
psz_transport
,
"MP2T/H2221/UDP"
)
)
{
{
httpd_MsgAdd
(
answer
,
"Transport"
,
"MP2T/H2221/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
"MP2T/H2221/UDP;client_port=%d-%d"
,
i_port
,
i_port
+
1
);
i_port
,
i_port
+
1
);
}
}
else
if
(
strstr
(
psz_transport
,
"RAW/RAW/UDP"
)
)
else
if
(
strstr
(
psz_transport
,
"RAW/RAW/UDP"
)
)
{
{
httpd_MsgAdd
(
answer
,
"Transport"
,
"RAW/RAW/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
"RAW/RAW/UDP;client_port=%d-%d"
,
i_port
,
i_port
+
1
);
i_port
,
i_port
+
1
);
}
}
}
}
else
else
httpd_MsgAdd
(
answer
,
"Transport"
,
"RTP/AVP/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
"RTP/AVP/UDP;client_port=%d-%d"
,
i_port
,
i_port
+
1
);
i_port
,
i_port
+
1
);
}
}
else
/* TODO strstr( psz_transport, "interleaved" ) ) */
else
/* TODO strstr( psz_transport, "interleaved" ) ) */
...
@@ -1058,7 +1074,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1058,7 +1074,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
{
{
const
char
*
psz_position
=
httpd_MsgGet
(
query
,
"Range"
);
const
char
*
psz_position
=
httpd_MsgGet
(
query
,
"Range"
);
const
char
*
psz_scale
=
httpd_MsgGet
(
query
,
"Scale"
);
const
char
*
psz_scale
=
httpd_MsgGet
(
query
,
"Scale"
);
if
(
psz_position
)
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
)
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
&&
!
psz_scale
)
if
(
psz_position
&&
!
psz_scale
)
{
{
double
f_pos
;
double
f_pos
;
...
@@ -1071,7 +1088,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1071,7 +1088,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
end
>
psz_position
)
if
(
end
>
psz_position
)
{
{
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
1000
/
1000
/
100
;
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
1000
/
1000
/
100
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
}
}
break
;
break
;
}
}
...
@@ -1087,18 +1105,22 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1087,18 +1105,22 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
psz_scale
[
0
]
==
'-'
)
/* rewind */
if
(
psz_scale
[
0
]
==
'-'
)
/* rewind */
{
{
msg_Dbg
(
p_vod
,
"rewind request: %s"
,
psz_scale
);
msg_Dbg
(
p_vod
,
"rewind request: %s"
,
psz_scale
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_REWIND
,
p_media
,
psz_session
,
f_scale
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_REWIND
,
p_media
,
psz_session
,
f_scale
,
NULL
);
}
}
else
if
(
psz_scale
[
0
]
!=
'1'
)
/* fast-forward */
else
if
(
psz_scale
[
0
]
!=
'1'
)
/* fast-forward */
{
{
msg_Dbg
(
p_vod
,
"fastforward request: %s"
,
psz_scale
);
msg_Dbg
(
p_vod
,
"fastforward request: %s"
,
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_FORWARD
,
p_media
,
psz_session
,
f_scale
,
NULL
);
psz_scale
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_FORWARD
,
p_media
,
psz_session
,
f_scale
,
NULL
);
}
}
if
(
p_rtsp
->
b_paused
==
VLC_TRUE
)
if
(
p_rtsp
->
b_paused
==
VLC_TRUE
)
{
{
p_rtsp
->
b_paused
=
VLC_FALSE
;
p_rtsp
->
b_paused
=
VLC_FALSE
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
}
}
}
}
break
;
break
;
...
@@ -1107,7 +1129,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1107,7 +1129,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
p_rtsp
->
b_playing
&&
p_rtsp
->
b_paused
)
if
(
p_rtsp
->
b_playing
&&
p_rtsp
->
b_paused
)
{
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
p_rtsp
->
b_paused
=
VLC_FALSE
;
p_rtsp
->
b_paused
=
VLC_FALSE
;
break
;
break
;
}
}
...
@@ -1130,22 +1153,29 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1130,22 +1153,29 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
{
{
if
(
p_media
->
b_raw
)
if
(
p_media
->
b_raw
)
{
{
asprintf
(
&
psz_output
,
"std{access=udp,dst=%s:%i,mux=%s}"
,
if
(
asprintf
(
&
psz_output
,
ip
,
i_port
,
p_media
->
psz_mux
);
"std{access=udp,dst=%s:%i,mux=%s}"
,
ip
,
i_port
,
p_media
->
psz_mux
)
<
0
)
return
VLC_ENOMEM
;
}
}
else
else
{
{
asprintf
(
&
psz_output
,
"rtp{dst=%s,port=%i,mux=%s}"
,
if
(
asprintf
(
&
psz_output
,
ip
,
i_port_video
,
p_media
->
psz_mux
);
"rtp{dst=%s,port=%i,mux=%s}"
,
ip
,
i_port_video
,
p_media
->
psz_mux
)
<
0
)
return
VLC_ENOMEM
;
}
}
}
}
else
else
{
{
asprintf
(
&
psz_output
,
"rtp{dst=%s,port-video=%i,"
if
(
asprintf
(
&
psz_output
,
"port-audio=%i}"
,
ip
,
i_port_video
,
i_port_audio
);
"rtp{dst=%s,port-video=%i,port-audio=%i}"
,
ip
,
i_port_video
,
i_port_audio
)
<
0
)
return
VLC_ENOMEM
;
}
}
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
psz_session
,
0
,
psz_output
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
psz_session
,
0
,
psz_output
);
free
(
psz_output
);
free
(
psz_output
);
break
;
break
;
}
}
...
@@ -1158,7 +1188,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1158,7 +1188,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
psz_sdp
!=
NULL
)
if
(
psz_sdp
!=
NULL
)
{
{
answer
->
i_status
=
200
;
answer
->
i_status
=
200
;
httpd_MsgAdd
(
answer
,
"Content-type"
,
"%s"
,
"application/sdp"
);
httpd_MsgAdd
(
answer
,
"Content-type"
,
"%s"
,
"application/sdp"
);
answer
->
p_body
=
(
uint8_t
*
)
psz_sdp
;
answer
->
p_body
=
(
uint8_t
*
)
psz_sdp
;
answer
->
i_body
=
strlen
(
psz_sdp
);
answer
->
i_body
=
strlen
(
psz_sdp
);
...
@@ -1179,7 +1210,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1179,7 +1210,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
if
(
!
p_rtsp
)
break
;
if
(
!
p_rtsp
)
break
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
p_rtsp
->
b_paused
=
VLC_TRUE
;
p_rtsp
->
b_paused
=
VLC_TRUE
;
answer
->
i_status
=
200
;
answer
->
i_status
=
200
;
...
@@ -1199,7 +1231,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1199,7 +1231,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
if
(
!
p_rtsp
)
break
;
if
(
!
p_rtsp
)
break
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
RtspClientDel
(
p_media
,
p_rtsp
);
RtspClientDel
(
p_media
,
p_rtsp
);
break
;
break
;
...
@@ -1233,7 +1266,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1233,7 +1266,8 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
}
}
static
int
RtspCallbackES
(
httpd_callback_sys_t
*
p_args
,
httpd_client_t
*
cl
,
static
int
RtspCallbackES
(
httpd_callback_sys_t
*
p_args
,
httpd_client_t
*
cl
,
httpd_message_t
*
answer
,
const
httpd_message_t
*
query
)
httpd_message_t
*
answer
,
const
httpd_message_t
*
query
)
{
{
media_es_t
*
p_es
=
(
media_es_t
*
)
p_args
;
media_es_t
*
p_es
=
(
media_es_t
*
)
p_args
;
vod_media_t
*
p_media
=
p_es
->
p_media
;
vod_media_t
*
p_media
=
p_es
->
p_media
;
...
@@ -1272,7 +1306,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1272,7 +1306,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
rtsp_client_es_t
*
p_rtsp_es
=
NULL
;
rtsp_client_es_t
*
p_rtsp_es
=
NULL
;
char
ip
[
NI_MAXNUMERICHOST
];
char
ip
[
NI_MAXNUMERICHOST
];
int
i_port
=
atoi
(
strstr
(
psz_transport
,
"client_port="
)
+
int
i_port
=
atoi
(
strstr
(
psz_transport
,
"client_port="
)
+
strlen
(
"client_port="
)
);
strlen
(
"client_port="
)
);
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
if
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
{
{
...
@@ -1297,7 +1331,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1297,7 +1331,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
answer
->
p_body
=
NULL
;
answer
->
p_body
=
NULL
;
break
;
break
;
}
}
asprintf
(
&
psz_new
,
"%d"
,
rand
()
);
if
(
asprintf
(
&
psz_new
,
"%d"
,
rand
()
)
<
0
)
return
VLC_ENOMEM
;
psz_session
=
psz_new
;
psz_session
=
psz_new
;
p_rtsp
=
RtspClientNew
(
p_media
,
psz_new
);
p_rtsp
=
RtspClientNew
(
p_media
,
psz_new
);
...
@@ -1335,18 +1370,21 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1335,18 +1370,21 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
{
{
if
(
strstr
(
psz_transport
,
"MP2T/H2221/UDP"
)
)
if
(
strstr
(
psz_transport
,
"MP2T/H2221/UDP"
)
)
{
{
httpd_MsgAdd
(
answer
,
"Transport"
,
"MP2T/H2221/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
"MP2T/H2221/UDP;client_port=%d-%d"
,
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
}
}
else
if
(
strstr
(
psz_transport
,
"RAW/RAW/UDP"
)
)
else
if
(
strstr
(
psz_transport
,
"RAW/RAW/UDP"
)
)
{
{
httpd_MsgAdd
(
answer
,
"Transport"
,
"RAW/RAW/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
"RAW/RAW/UDP;client_port=%d-%d"
,
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
}
}
}
}
else
else
{
{
httpd_MsgAdd
(
answer
,
"Transport"
,
"RTP/AVP/UDP;client_port=%d-%d"
,
httpd_MsgAdd
(
answer
,
"Transport"
,
"RTP/AVP/UDP;client_port=%d-%d"
,
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
p_rtsp_es
->
i_port
,
p_rtsp_es
->
i_port
+
1
);
}
}
}
}
...
@@ -1384,7 +1422,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1384,7 +1422,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
end
>
psz_position
)
if
(
end
>
psz_position
)
{
{
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
1000
/
1000
/
100
;
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
1000
/
1000
/
100
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
}
}
}
}
...
@@ -1419,7 +1458,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1419,7 +1458,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
!
p_rtsp
->
i_es
)
if
(
!
p_rtsp
->
i_es
)
{
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
RtspClientDel
(
p_media
,
p_rtsp
);
RtspClientDel
(
p_media
,
p_rtsp
);
}
}
break
;
break
;
...
@@ -1433,7 +1473,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1433,7 +1473,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
p_rtsp
=
RtspClientGet
(
p_media
,
psz_session
);
if
(
!
p_rtsp
)
break
;
if
(
!
p_rtsp
)
break
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
p_rtsp
->
b_paused
=
VLC_TRUE
;
p_rtsp
->
b_paused
=
VLC_TRUE
;
answer
->
i_status
=
200
;
answer
->
i_status
=
200
;
...
...
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