Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
cc3200cc
Commit
cc3200cc
authored
Nov 17, 2010
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vod: use time instead of position for seek requests
RTSP uses NPT in seconds, so don't convert for nothing...
parent
74d18c46
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
44 deletions
+43
-44
modules/misc/rtsp.c
modules/misc/rtsp.c
+24
-23
modules/stream_out/rtp.h
modules/stream_out/rtp.h
+1
-1
modules/stream_out/rtsp.c
modules/stream_out/rtsp.c
+3
-3
modules/stream_out/vod.c
modules/stream_out/vod.c
+13
-15
src/input/vlm.c
src/input/vlm.c
+2
-2
No files found.
modules/misc/rtsp.c
View file @
cc3200cc
...
...
@@ -214,6 +214,7 @@ typedef struct
vod_media_t
*
p_media
;
char
*
psz_session
;
char
*
psz_arg
;
int64_t
i_arg
;
double
f_arg
;
}
rtsp_cmd_t
;
...
...
@@ -224,7 +225,8 @@ static int MediaAddES( vod_t *, vod_media_t *, es_format_t * );
static
void
MediaDelES
(
vod_t
*
,
vod_media_t
*
,
es_format_t
*
);
static
void
*
CommandThread
(
vlc_object_t
*
p_this
);
static
void
CommandPush
(
vod_t
*
,
rtsp_cmd_type_t
,
vod_media_t
*
,
const
char
*
psz_session
,
static
void
CommandPush
(
vod_t
*
,
rtsp_cmd_type_t
,
vod_media_t
*
,
const
char
*
psz_session
,
int64_t
i_arg
,
double
f_arg
,
const
char
*
psz_arg
);
static
rtsp_client_t
*
RtspClientNew
(
vod_media_t
*
,
char
*
);
...
...
@@ -332,7 +334,7 @@ static void Close( vlc_object_t * p_this )
/* Stop command thread */
vlc_object_kill
(
p_vod
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_NONE
,
NULL
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_NONE
,
NULL
,
NULL
,
0
,
0
.
0
,
NULL
);
vlc_thread_join
(
p_vod
);
while
(
block_FifoCount
(
p_sys
->
p_fifo_cmd
)
>
0
)
...
...
@@ -444,13 +446,13 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
}
vlc_mutex_unlock
(
&
p_item
->
lock
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_ADD
,
p_media
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_ADD
,
p_media
,
NULL
,
0
,
0
.
0
,
NULL
);
return
p_media
;
}
static
void
MediaAskDel
(
vod_t
*
p_vod
,
vod_media_t
*
p_media
)
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_DEL
,
p_media
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_DEL
,
p_media
,
NULL
,
0
,
0
.
0
,
NULL
);
}
static
void
MediaDel
(
vod_t
*
p_vod
,
vod_media_t
*
p_media
)
...
...
@@ -752,7 +754,7 @@ static void MediaDelES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt)
free
(
p_es
);
}
static
void
CommandPush
(
vod_t
*
p_vod
,
rtsp_cmd_type_t
i_type
,
vod_media_t
*
p_media
,
const
char
*
psz_session
,
static
void
CommandPush
(
vod_t
*
p_vod
,
rtsp_cmd_type_t
i_type
,
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_t
i_arg
,
double
f_arg
,
const
char
*
psz_arg
)
{
rtsp_cmd_t
cmd
;
...
...
@@ -765,6 +767,7 @@ static void CommandPush( vod_t *p_vod, rtsp_cmd_type_t i_type, vod_media_t *p_me
cmd
.
i_media_id
=
p_media
->
id
;
if
(
psz_session
)
cmd
.
psz_session
=
strdup
(
psz_session
);
cmd
.
i_arg
=
i_arg
;
cmd
.
f_arg
=
f_arg
;
if
(
psz_arg
)
cmd
.
psz_arg
=
strdup
(
psz_arg
);
...
...
@@ -838,7 +841,7 @@ static void* CommandThread( vlc_object_t *p_this )
case
RTSP_CMD_TYPE_SEEK
:
vod_MediaControl
(
p_vod
,
p_media
,
cmd
.
psz_session
,
VOD_MEDIA_SEEK
,
cmd
.
f
_arg
);
VOD_MEDIA_SEEK
,
cmd
.
i
_arg
);
break
;
case
RTSP_CMD_TYPE_REWIND
:
...
...
@@ -916,7 +919,7 @@ static void RtspClientDel( vod_media_t *p_media, rtsp_client_t *p_rtsp )
}
static
floa
t
ParseNPT
(
const
char
*
str
)
static
int64_
t
ParseNPT
(
const
char
*
str
)
{
locale_t
loc
=
newlocale
(
LC_NUMERIC_MASK
,
"C"
,
NULL
);
locale_t
oldloc
=
uselocale
(
loc
);
...
...
@@ -934,7 +937,7 @@ static float ParseNPT (const char *str)
uselocale
(
oldloc
);
freelocale
(
loc
);
}
return
sec
;
return
sec
*
CLOCK_FREQ
;
}
...
...
@@ -1108,11 +1111,10 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
psz_position
=
strstr
(
psz_position
,
"npt="
);
if
(
psz_position
&&
!
psz_scale
)
{
double
f_pos
=
ParseNPT
(
psz_position
+
4
);
int64_t
i_time
=
ParseNPT
(
psz_position
+
4
);
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
CLOCK_FREQ
/
100
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
psz_session
,
i_time
,
0
.
0
,
NULL
);
}
else
if
(
psz_scale
)
{
...
...
@@ -1127,21 +1129,21 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
{
msg_Dbg
(
p_vod
,
"rewind request: %s"
,
psz_scale
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_REWIND
,
p_media
,
psz_session
,
f_scale
,
NULL
);
psz_session
,
0
,
f_scale
,
NULL
);
}
else
if
(
psz_scale
[
0
]
!=
'1'
)
/* fast-forward */
{
msg_Dbg
(
p_vod
,
"fastforward request: %s"
,
psz_scale
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_FORWARD
,
p_media
,
psz_session
,
f_scale
,
NULL
);
psz_session
,
0
,
f_scale
,
NULL
);
}
if
(
p_rtsp
->
b_paused
)
{
p_rtsp
->
b_paused
=
false
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
psz_session
,
0
,
0
.
0
,
NULL
);
}
}
break
;
...
...
@@ -1151,7 +1153,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
p_rtsp
->
b_playing
&&
p_rtsp
->
b_paused
)
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
psz_session
,
0
,
0
.
0
,
NULL
);
p_rtsp
->
b_paused
=
false
;
break
;
}
...
...
@@ -1196,7 +1198,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
}
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
psz_session
,
0
,
psz_output
);
0
,
0
.
0
,
psz_output
);
free
(
psz_output
);
break
;
}
...
...
@@ -1234,7 +1236,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
!
p_rtsp
->
b_paused
)
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
0
,
0
.
0
,
NULL
);
p_rtsp
->
b_paused
=
true
;
}
...
...
@@ -1256,7 +1258,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
!
p_rtsp
)
break
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
0
,
0
.
0
,
NULL
);
RtspClientDel
(
p_media
,
p_rtsp
);
break
;
...
...
@@ -1441,11 +1443,10 @@ 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
)
{
double
f_pos
=
ParseNPT
(
psz_position
+
4
);
int64_t
i_time
=
ParseNPT
(
psz_position
+
4
);
msg_Dbg
(
p_vod
,
"seeking request: %s"
,
psz_position
);
f_pos
/=
((
double
)(
p_media
->
i_length
))
/
CLOCK_FREQ
/
100
;
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
f_pos
,
NULL
);
psz_session
,
i_time
,
0
.
0
,
NULL
);
}
if
(
!
psz_playnow
)
...
...
@@ -1479,7 +1480,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
!
p_rtsp
->
i_es
)
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
,
NULL
);
0
,
0
.
0
,
NULL
);
RtspClientDel
(
p_media
,
p_rtsp
);
}
break
;
...
...
@@ -1496,7 +1497,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if
(
!
p_rtsp
->
b_paused
)
{
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
,
NULL
);
0
,
0
.
0
,
NULL
);
p_rtsp
->
b_paused
=
true
;
}
...
...
modules/stream_out/rtp.h
View file @
cc3200cc
...
...
@@ -93,7 +93,7 @@ void CloseVoD( vlc_object_t * );
void
vod_start
(
vod_media_t
*
p_media
,
const
char
*
psz_session
);
void
vod_toggle_pause
(
vod_media_t
*
p_media
,
const
char
*
psz_session
);
void
vod_stop
(
vod_media_t
*
p_media
,
const
char
*
psz_session
);
void
vod_seek
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
floa
t
time
);
void
vod_seek
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_
t
time
);
const
char
*
vod_get_mux
(
const
vod_media_t
*
p_media
);
int
vod_init_id
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int
es_id
,
...
...
modules/stream_out/rtsp.c
View file @
cc3200cc
...
...
@@ -478,7 +478,7 @@ static inline const char *parameter_next( const char *str )
}
static
floa
t
ParseNPT
(
const
char
*
str
)
static
int64_
t
ParseNPT
(
const
char
*
str
)
{
locale_t
loc
=
newlocale
(
LC_NUMERIC_MASK
,
"C"
,
NULL
);
locale_t
oldloc
=
uselocale
(
loc
);
...
...
@@ -496,7 +496,7 @@ static float ParseNPT (const char *str)
uselocale
(
oldloc
);
freelocale
(
loc
);
}
return
sec
;
return
sec
*
CLOCK_FREQ
;
}
...
...
@@ -897,7 +897,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
{
if
(
range
!=
NULL
)
{
floa
t
time
=
ParseNPT
(
range
+
4
);
int64_
t
time
=
ParseNPT
(
range
+
4
);
vod_seek
(
rtsp
->
vod_media
,
psz_session
,
time
);
}
if
(
ses
->
paused
)
...
...
modules/stream_out/vod.c
View file @
cc3200cc
...
...
@@ -116,7 +116,7 @@ typedef struct
vod_media_t
*
p_media
;
char
*
psz_session
;
char
*
psz_arg
;
double
f
_arg
;
int64_t
i
_arg
;
}
rtsp_cmd_t
;
static
vod_media_t
*
MediaNew
(
vod_t
*
,
const
char
*
,
input_item_t
*
);
...
...
@@ -125,7 +125,7 @@ static void MediaAskDel ( vod_t *, vod_media_t * );
static
void
*
CommandThread
(
vlc_object_t
*
p_this
);
static
void
CommandPush
(
vod_t
*
,
rtsp_cmd_type_t
,
vod_media_t
*
,
const
char
*
psz_session
,
double
f
_arg
,
const
char
*
psz_arg
);
int64_t
i
_arg
,
const
char
*
psz_arg
);
/*****************************************************************************
* Open: Starts the RTSP server module
...
...
@@ -194,7 +194,7 @@ void CloseVoD( vlc_object_t * p_this )
/* Stop command thread */
vlc_object_kill
(
p_vod
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_NONE
,
NULL
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_NONE
,
NULL
,
NULL
,
0
,
NULL
);
vlc_thread_join
(
p_vod
);
while
(
block_FifoCount
(
p_sys
->
p_fifo_cmd
)
>
0
)
...
...
@@ -310,7 +310,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
msg_Dbg
(
p_vod
,
"adding media '%s', id %i"
,
psz_name
,
p_media
->
id
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_ADD
,
p_media
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_ADD
,
p_media
,
NULL
,
0
,
NULL
);
return
p_media
;
error:
...
...
@@ -321,7 +321,7 @@ error:
static
void
MediaAskDel
(
vod_t
*
p_vod
,
vod_media_t
*
p_media
)
{
msg_Dbg
(
p_vod
,
"deleting media id %i"
,
p_media
->
id
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_DEL
,
p_media
,
NULL
,
0
.
0
,
NULL
);
CommandPush
(
p_vod
,
RTSP_CMD_TYPE_DEL
,
p_media
,
NULL
,
0
,
NULL
);
}
static
void
MediaDel
(
vod_t
*
p_vod
,
vod_media_t
*
p_media
)
...
...
@@ -354,7 +354,7 @@ static void MediaDel( vod_t *p_vod, vod_media_t *p_media )
}
static
void
CommandPush
(
vod_t
*
p_vod
,
rtsp_cmd_type_t
i_type
,
vod_media_t
*
p_media
,
const
char
*
psz_session
,
double
f
_arg
,
const
char
*
psz_arg
)
int64_t
i
_arg
,
const
char
*
psz_arg
)
{
rtsp_cmd_t
cmd
;
block_t
*
p_cmd
;
...
...
@@ -366,7 +366,7 @@ static void CommandPush( vod_t *p_vod, rtsp_cmd_type_t i_type, vod_media_t *p_me
cmd
.
i_media_id
=
p_media
->
id
;
if
(
psz_session
)
cmd
.
psz_session
=
strdup
(
psz_session
);
cmd
.
f_arg
=
f
_arg
;
cmd
.
i_arg
=
i
_arg
;
if
(
psz_arg
)
cmd
.
psz_arg
=
strdup
(
psz_arg
);
...
...
@@ -439,7 +439,7 @@ static void* CommandThread( vlc_object_t *p_this )
case
RTSP_CMD_TYPE_SEEK
:
vod_MediaControl
(
p_vod
,
p_media
,
cmd
.
psz_session
,
VOD_MEDIA_SEEK
,
cmd
.
f
_arg
);
VOD_MEDIA_SEEK
,
cmd
.
i
_arg
);
break
;
#if 0
...
...
@@ -545,7 +545,7 @@ void vod_start(vod_media_t *p_media, const char *psz_session)
{
/* We're passing the #vod{} sout chain here */
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_PLAY
,
p_media
,
psz_session
,
0
.
0
,
"vod"
);
psz_session
,
0
,
"vod"
);
}
/* FIXME: this sucks, RTSP doesn't really toggle the pause state, it
...
...
@@ -553,21 +553,19 @@ void vod_start(vod_media_t *p_media, const char *psz_session)
void
vod_toggle_pause
(
vod_media_t
*
p_media
,
const
char
*
psz_session
)
{
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_PAUSE
,
p_media
,
psz_session
,
0
.
0
,
NULL
);
psz_session
,
0
,
NULL
);
}
void
vod_stop
(
vod_media_t
*
p_media
,
const
char
*
psz_session
)
{
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_STOP
,
p_media
,
psz_session
,
0
.
0
,
NULL
);
psz_session
,
0
,
NULL
);
}
void
vod_seek
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
floa
t
time
)
void
vod_seek
(
vod_media_t
*
p_media
,
const
char
*
psz_session
,
int64_
t
time
)
{
/* FIXME: why do we even bother converting from time to position??? */
double
position
=
time
/
(((
double
)(
p_media
->
i_length
))
/
CLOCK_FREQ
/
100
);
CommandPush
(
p_media
->
p_vod
,
RTSP_CMD_TYPE_SEEK
,
p_media
,
psz_session
,
position
,
NULL
);
psz_session
,
time
,
NULL
);
}
...
...
src/input/vlm.c
View file @
cc3200cc
...
...
@@ -325,8 +325,8 @@ static int vlm_MediaVodControl( void *p_private, vod_media_t *p_vod_media,
case
VOD_MEDIA_SEEK
:
{
double
d_position
=
(
double
)
va_arg
(
args
,
double
);
i_ret
=
vlm_ControlInternal
(
vlm
,
VLM_SET_MEDIA_INSTANCE_
POSITION
,
id
,
psz_id
,
d_position
/
100
.
0
);
int64_t
i_time
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
i_ret
=
vlm_ControlInternal
(
vlm
,
VLM_SET_MEDIA_INSTANCE_
TIME
,
id
,
psz_id
,
i_time
);
break
;
}
...
...
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