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
f561f73c
Commit
f561f73c
authored
Feb 14, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC: allow setting playback rate even without input
parent
951dd377
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
32 deletions
+15
-32
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+4
-2
src/control/media_player.c
src/control/media_player.c
+11
-30
No files found.
include/vlc/libvlc_media_player.h
View file @
f561f73c
...
...
@@ -409,10 +409,12 @@ VLC_PUBLIC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t
VLC_PUBLIC_API
void
libvlc_media_player_next_chapter
(
libvlc_media_player_t
*
p_mi
);
/**
* Get movie play rate
* Get the requested movie play rate.
* @warning Depending on the underlying media, the requested rate may be
* different from the real playback rate.
*
* \param p_mi the Media Player
* \return movie play rate
, or zero in case of error
* \return movie play rate
*/
VLC_PUBLIC_API
float
libvlc_media_player_get_rate
(
libvlc_media_player_t
*
p_mi
);
...
...
src/control/media_player.c
View file @
f561f73c
...
...
@@ -496,6 +496,9 @@ libvlc_media_player_new( libvlc_instance_t *instance )
}
vlc_object_attach
(
mp
,
mp
->
p_libvlc
);
/* Input */
var_Create
(
mp
,
"rate"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
/* Video */
var_Create
(
mp
,
"drawable-xid"
,
VLC_VAR_INTEGER
);
#ifdef WIN32
...
...
@@ -1221,21 +1224,17 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
int
libvlc_media_player_set_rate
(
libvlc_media_player_t
*
p_mi
,
float
rate
)
{
input_thread_t
*
p_input_thread
;
bool
b_can_rewind
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
b_can_rewind
=
var_GetBool
(
p_input_thread
,
"can-rewind"
);
if
(
(
rate
<
0
.
0
)
&&
!
b_can_rewind
)
if
(
rate
<
0
.)
{
vlc_object_release
(
p_input_thread
);
libvlc_printerr
(
"Invalid playback rate"
);
libvlc_printerr
(
"Playing backward not supported"
);
return
-
1
;
}
var_SetFloat
(
p_mi
,
"rate"
,
rate
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
0
;
var_SetFloat
(
p_input_thread
,
"rate"
,
rate
);
vlc_object_release
(
p_input_thread
);
return
0
;
...
...
@@ -1243,25 +1242,7 @@ int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
float
libvlc_media_player_get_rate
(
libvlc_media_player_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
;
float
f_rate
;
bool
b_can_rewind
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
0
.
0
;
/* rate < 0 indicates rewind */
f_rate
=
var_GetFloat
(
p_input_thread
,
"rate"
);
b_can_rewind
=
var_GetBool
(
p_input_thread
,
"can-rewind"
);
/* FIXME: why are negative values forbidden ?? (rewinding) */
if
(
f_rate
<
0
&&
!
b_can_rewind
)
{
vlc_object_release
(
p_input_thread
);
return
0
.
0
;
}
vlc_object_release
(
p_input_thread
);
return
f_rate
;
return
var_GetFloat
(
p_mi
,
"rate"
);
}
libvlc_state_t
libvlc_media_player_get_state
(
libvlc_media_player_t
*
p_mi
)
...
...
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