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
75adef44
Commit
75adef44
authored
Nov 20, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signal can_rewind for use by user interfaces.
parent
f76cff41
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
14 deletions
+39
-14
src/control/media_player.c
src/control/media_player.c
+22
-7
src/input/input.c
src/input/input.c
+10
-6
src/input/var.c
src/input/var.c
+7
-1
No files found.
src/control/media_player.c
View file @
75adef44
...
@@ -1044,16 +1044,24 @@ void libvlc_media_player_set_rate(
...
@@ -1044,16 +1044,24 @@ void libvlc_media_player_set_rate(
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
bool
b_can_rewind
;
if
(
rate
<
=
0
)
if
(
rate
!
=
0
)
RAISEVOID
(
"Rate value is invalid"
);
RAISEVOID
(
"Rate value is invalid"
);
val
.
i_int
=
1000
.
0
f
/
rate
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
;
return
;
b_can_rewind
=
var_GetBool
(
p_input_thread
,
"can-rewind"
);
if
(
(
rate
<
0
)
&&
!
b_can_rewind
)
{
vlc_object_release
(
p_input_thread
);
libvlc_exception_raise
(
p_e
,
"Rate value is invalid"
);
return
;
}
val
.
i_int
=
1000
.
0
f
/
rate
;
var_Set
(
p_input_thread
,
"rate"
,
val
);
var_Set
(
p_input_thread
,
"rate"
,
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
}
}
...
@@ -1064,12 +1072,19 @@ float libvlc_media_player_get_rate(
...
@@ -1064,12 +1072,19 @@ float libvlc_media_player_get_rate(
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
bool
b_can_rewind
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
-
1
.
0
;
return
0
.
0
;
/* rate < 0 indicates rewind */
var_Get
(
p_input_thread
,
"rate"
,
&
val
);
var_Get
(
p_input_thread
,
"rate"
,
&
val
);
b_can_rewind
=
var_GetBool
(
p_input_thread
,
"can-rewind"
);
if
(
(
val
.
i_int
<
0
)
&&
!
b_can_rewind
)
{
libvlc_exception_raise
(
p_e
,
"invalid rate"
);
return
0
.
0
;
}
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
(
float
)
1000
.
0
f
/
val
.
i_int
;
return
(
float
)
1000
.
0
f
/
val
.
i_int
;
...
...
src/input/input.c
View file @
75adef44
...
@@ -191,20 +191,20 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -191,20 +191,20 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input
->
b_eof
=
false
;
p_input
->
b_eof
=
false
;
p_input
->
b_can_pace_control
=
true
;
p_input
->
b_can_pace_control
=
true
;
p_input
->
p
->
i_start
=
0
;
p_input
->
p
->
i_start
=
0
;
p_input
->
i_time
=
0
;
p_input
->
i_time
=
0
;
p_input
->
p
->
i_stop
=
0
;
p_input
->
p
->
i_stop
=
0
;
p_input
->
p
->
i_run
=
0
;
p_input
->
p
->
i_run
=
0
;
p_input
->
p
->
i_title
=
0
;
p_input
->
p
->
i_title
=
0
;
p_input
->
p
->
title
=
NULL
;
p_input
->
p
->
title
=
NULL
;
p_input
->
p
->
i_title_offset
=
p_input
->
p
->
i_seekpoint_offset
=
0
;
p_input
->
p
->
i_title_offset
=
p_input
->
p
->
i_seekpoint_offset
=
0
;
p_input
->
i_state
=
INIT_S
;
p_input
->
i_state
=
INIT_S
;
p_input
->
p
->
i_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
p
->
i_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
p
->
b_recording
=
false
;
p_input
->
p
->
b_recording
=
false
;
TAB_INIT
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
);
TAB_INIT
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
);
TAB_INIT
(
p_input
->
p
->
i_attachment
,
p_input
->
p
->
attachment
);
TAB_INIT
(
p_input
->
p
->
i_attachment
,
p_input
->
p
->
attachment
);
p_input
->
p
->
p_es_out_display
=
NULL
;
p_input
->
p
->
p_es_out_display
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
p_input
->
p
->
p_sout
=
NULL
;
p_input
->
p
->
p_sout
=
NULL
;
p_input
->
p
->
b_out_pace_control
=
false
;
p_input
->
p
->
b_out_pace_control
=
false
;
p_input
->
i_pts_delay
=
0
;
p_input
->
i_pts_delay
=
0
;
...
@@ -1746,6 +1746,7 @@ static bool Control( input_thread_t *p_input, int i_type,
...
@@ -1746,6 +1746,7 @@ static bool Control( input_thread_t *p_input, int i_type,
i_error
=
i_test_e
;
i_error
=
i_test_e
;
}
}
}
}
assert
(
i_idx
>=
0
&&
ppi_factor
[
i_idx
][
0
]
!=
0
);
assert
(
i_idx
>=
0
&&
ppi_factor
[
i_idx
][
0
]
!=
0
);
if
(
i_type
==
INPUT_CONTROL_SET_RATE_SLOWER
)
if
(
i_type
==
INPUT_CONTROL_SET_RATE_SLOWER
)
...
@@ -1811,7 +1812,7 @@ static bool Control( input_thread_t *p_input, int i_type,
...
@@ -1811,7 +1812,7 @@ static bool Control( input_thread_t *p_input, int i_type,
var_Change
(
p_input
,
"rate"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
var_Change
(
p_input
,
"rate"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
var_SetBool
(
p_input
,
"rate-change"
,
true
);
var_SetBool
(
p_input
,
"rate-change"
,
true
);
p_input
->
p
->
i_rate
=
i_rate
;
p_input
->
p
->
i_rate
=
i_rate
;
/* FIXME do we need a RESET_PCR when !p_input->p->input.b_rescale_ts ? */
/* FIXME do we need a RESET_PCR when !p_input->p->input.b_rescale_ts ? */
if
(
p_input
->
p
->
input
.
b_rescale_ts
)
if
(
p_input
->
p
->
input
.
b_rescale_ts
)
...
@@ -2359,6 +2360,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2359,6 +2360,7 @@ static int InputSourceInit( input_thread_t *p_input,
&
in
->
b_can_pause
)
)
&
in
->
b_can_pause
)
)
in
->
b_can_pause
=
false
;
in
->
b_can_pause
=
false
;
var_SetBool
(
p_input
,
"can-pause"
,
in
->
b_can_pause
||
!
in
->
b_can_pace_control
);
/* XXX temporary because of es_out_timeshift*/
var_SetBool
(
p_input
,
"can-pause"
,
in
->
b_can_pause
||
!
in
->
b_can_pace_control
);
/* XXX temporary because of es_out_timeshift*/
var_SetBool
(
p_input
,
"can-rewind"
,
!
in
->
b_rescale_ts
&&
!
in
->
b_can_pace_control
);
int
ret
=
demux_Control
(
in
->
p_demux
,
DEMUX_CAN_SEEK
,
int
ret
=
demux_Control
(
in
->
p_demux
,
DEMUX_CAN_SEEK
,
&
val
.
b_bool
);
&
val
.
b_bool
);
...
@@ -2443,6 +2445,8 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2443,6 +2445,8 @@ static int InputSourceInit( input_thread_t *p_input,
access_Control
(
in
->
p_access
,
ACCESS_CAN_PAUSE
,
access_Control
(
in
->
p_access
,
ACCESS_CAN_PAUSE
,
&
in
->
b_can_pause
);
&
in
->
b_can_pause
);
var_SetBool
(
p_input
,
"can-pause"
,
in
->
b_can_pause
||
!
in
->
b_can_pace_control
);
/* XXX temporary because of es_out_timeshift*/
var_SetBool
(
p_input
,
"can-pause"
,
in
->
b_can_pause
||
!
in
->
b_can_pace_control
);
/* XXX temporary because of es_out_timeshift*/
var_SetBool
(
p_input
,
"can-rewind"
,
!
in
->
b_rescale_ts
&&
!
in
->
b_can_pace_control
);
access_Control
(
in
->
p_access
,
ACCESS_CAN_SEEK
,
access_Control
(
in
->
p_access
,
ACCESS_CAN_SEEK
,
&
val
.
b_bool
);
&
val
.
b_bool
);
var_Set
(
p_input
,
"seekable"
,
val
);
var_Set
(
p_input
,
"seekable"
,
val
);
...
...
src/input/var.c
View file @
75adef44
...
@@ -73,6 +73,7 @@ typedef struct
...
@@ -73,6 +73,7 @@ typedef struct
const
char
*
psz_name
;
const
char
*
psz_name
;
vlc_callback_t
callback
;
vlc_callback_t
callback
;
}
vlc_input_callback_t
;
}
vlc_input_callback_t
;
static
void
InputAddCallbacks
(
input_thread_t
*
,
const
vlc_input_callback_t
*
);
static
void
InputAddCallbacks
(
input_thread_t
*
,
const
vlc_input_callback_t
*
);
static
void
InputDelCallbacks
(
input_thread_t
*
,
const
vlc_input_callback_t
*
);
static
void
InputDelCallbacks
(
input_thread_t
*
,
const
vlc_input_callback_t
*
);
...
@@ -478,6 +479,9 @@ void input_ConfigVarInit ( input_thread_t *p_input )
...
@@ -478,6 +479,9 @@ void input_ConfigVarInit ( input_thread_t *p_input )
var_Create
(
p_input
,
"can-pause"
,
VLC_VAR_BOOL
);
var_Create
(
p_input
,
"can-pause"
,
VLC_VAR_BOOL
);
var_SetBool
(
p_input
,
"can-pause"
,
true
);
/* Fixed later*/
var_SetBool
(
p_input
,
"can-pause"
,
true
);
/* Fixed later*/
var_Create
(
p_input
,
"can-rewind"
,
VLC_VAR_BOOL
);
var_SetBool
(
p_input
,
"can-rewind"
,
false
);
var_Create
(
p_input
,
"can-record"
,
VLC_VAR_BOOL
);
var_Create
(
p_input
,
"can-record"
,
VLC_VAR_BOOL
);
var_SetBool
(
p_input
,
"can-record"
,
false
);
/* Fixed later*/
var_SetBool
(
p_input
,
"can-record"
,
false
);
/* Fixed later*/
...
@@ -521,6 +525,7 @@ static void InputAddCallbacks( input_thread_t *p_input,
...
@@ -521,6 +525,7 @@ static void InputAddCallbacks( input_thread_t *p_input,
p_callbacks
[
i
].
psz_name
,
p_callbacks
[
i
].
psz_name
,
p_callbacks
[
i
].
callback
,
NULL
);
p_callbacks
[
i
].
callback
,
NULL
);
}
}
static
void
InputDelCallbacks
(
input_thread_t
*
p_input
,
static
void
InputDelCallbacks
(
input_thread_t
*
p_input
,
const
vlc_input_callback_t
*
p_callbacks
)
const
vlc_input_callback_t
*
p_callbacks
)
{
{
...
@@ -530,6 +535,7 @@ static void InputDelCallbacks( input_thread_t *p_input,
...
@@ -530,6 +535,7 @@ static void InputDelCallbacks( input_thread_t *p_input,
p_callbacks
[
i
].
psz_name
,
p_callbacks
[
i
].
psz_name
,
p_callbacks
[
i
].
callback
,
NULL
);
p_callbacks
[
i
].
callback
,
NULL
);
}
}
/*****************************************************************************
/*****************************************************************************
* All Callbacks:
* All Callbacks:
*****************************************************************************/
*****************************************************************************/
...
@@ -568,7 +574,6 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -568,7 +574,6 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
{
{
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_RATE
,
&
newval
);
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_RATE
,
&
newval
);
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -812,6 +817,7 @@ static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -812,6 +817,7 @@ static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
FrameNextCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
FrameNextCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
void
*
p_data
)
...
...
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