Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
e1b39c52
Commit
e1b39c52
authored
Jul 09, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partially fix parsing of npt=
parent
7c14959c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
25 deletions
+34
-25
modules/misc/rtsp.c
modules/misc/rtsp.c
+34
-25
No files found.
modules/misc/rtsp.c
View file @
e1b39c52
...
@@ -44,6 +44,9 @@
...
@@ -44,6 +44,9 @@
#include <vlc_strings.h>
#include <vlc_strings.h>
#include <errno.h>
#include <errno.h>
#ifndef WIN32
# include <locale.h>
#endif
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -919,6 +922,29 @@ static void RtspClientDel( vod_media_t *p_media, rtsp_client_t *p_rtsp )
...
@@ -919,6 +922,29 @@ static void RtspClientDel( vod_media_t *p_media, rtsp_client_t *p_rtsp )
free
(
p_rtsp
);
free
(
p_rtsp
);
}
}
static
float
ParseNPT
(
const
char
*
str
)
{
locale_t
loc
=
newlocale
(
LC_NUMERIC_MASK
,
"C"
,
NULL
);
locale_t
oldloc
=
uselocale
(
loc
);
unsigned
hour
,
min
;
float
sec
;
if
(
sscanf
(
str
,
"%u:%u:%f"
,
&
hour
,
&
min
,
&
sec
)
==
3
)
sec
+=
((
hour
*
60
)
+
min
)
*
60
;
else
if
(
sscanf
(
str
,
"%f"
,
&
sec
)
!=
1
)
sec
=
0
.;
if
(
loc
!=
(
locale_t
)
0
)
{
uselocale
(
oldloc
);
freelocale
(
loc
);
}
return
sec
;
}
static
int
RtspCallback
(
httpd_callback_sys_t
*
p_args
,
httpd_client_t
*
cl
,
static
int
RtspCallback
(
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
)
{
{
...
@@ -1090,19 +1116,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1090,19 +1116,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
psz_position
=
strstr
(
psz_position
,
"npt="
);
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
&&
!
psz_scale
)
if
(
psz_position
&&
!
psz_scale
)
{
{
double
f_pos
;
double
f_pos
=
ParseNPT
(
psz_position
+
4
);
char
*
end
;
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
psz_position
+=
4
;
/* FIXME: npt= is not necessarily formatted as a float */
f_pos
=
us_strtod
(
psz_position
,
&
end
);
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
,
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
psz_session
,
f_pos
,
NULL
);
}
break
;
break
;
}
}
if
(
psz_scale
)
if
(
psz_scale
)
...
@@ -1423,21 +1441,12 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
...
@@ -1423,21 +1441,12 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
psz_position
)
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
)
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
)
if
(
psz_position
)
{
{
double
f_pos
;
double
f_pos
=
ParseNPT
(
psz_position
+
4
);
char
*
end
;
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
psz_position
+=
4
;
/* FIXME: npt= is not necessarily formatted as a float */
f_pos
=
us_strtod
(
psz_position
,
&
end
);
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
,
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
psz_session
,
f_pos
,
NULL
);
}
}
}
if
(
!
psz_playnow
)
if
(
!
psz_playnow
)
{
{
...
...
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