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
72ab2078
Commit
72ab2078
authored
May 22, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: split time and time-offset callbacks
There was no common code.
parent
a30f9045
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
25 deletions
+28
-25
src/input/var.c
src/input/var.c
+28
-25
No files found.
src/input/var.c
View file @
72ab2078
...
@@ -47,6 +47,8 @@ static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -47,6 +47,8 @@ static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
static
int
TimeCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
TimeCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
static
int
TimeOffsetCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
static
int
ProgramCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
ProgramCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
);
static
int
TitleCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
TitleCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
...
@@ -91,7 +93,7 @@ static const vlc_input_callback_t p_input_callbacks[] =
...
@@ -91,7 +93,7 @@ static const vlc_input_callback_t p_input_callbacks[] =
CALLBACK
(
"position"
,
PositionCallback
),
CALLBACK
(
"position"
,
PositionCallback
),
CALLBACK
(
"position-offset"
,
PositionCallback
),
CALLBACK
(
"position-offset"
,
PositionCallback
),
CALLBACK
(
"time"
,
TimeCallback
),
CALLBACK
(
"time"
,
TimeCallback
),
CALLBACK
(
"time-offset"
,
TimeCallback
),
CALLBACK
(
"time-offset"
,
Time
Offset
Callback
),
CALLBACK
(
"bookmark"
,
BookmarkCallback
),
CALLBACK
(
"bookmark"
,
BookmarkCallback
),
CALLBACK
(
"program"
,
ProgramCallback
),
CALLBACK
(
"program"
,
ProgramCallback
),
CALLBACK
(
"title"
,
TitleCallback
),
CALLBACK
(
"title"
,
TitleCallback
),
...
@@ -611,35 +613,36 @@ static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -611,35 +613,36 @@ static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_data
);
VLC_UNUSED
(
psz_cmd
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_data
);
if
(
!
strcmp
(
psz_cmd
,
"time-offset"
)
)
/* Update "position" for better intf behavour */
const
mtime_t
i_length
=
var_GetTime
(
p_input
,
"length"
);
if
(
i_length
>
0
&&
newval
.
i_time
>=
0
&&
newval
.
i_time
<=
i_length
)
{
{
mtime_t
i_time
=
var_GetTime
(
p_input
,
"time"
)
+
newval
.
i_time
;
vlc_value_t
val
;
if
(
i_time
<
0
)
i_time
=
0
;
val
.
f_float
=
(
double
)
newval
.
i_time
/
(
double
)
i_length
;
var_SetTime
(
p_this
,
"time"
,
i_time
);
var_Change
(
p_input
,
"position"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
/*
* Notify the intf that a new event has been occurred.
* XXX this is a bit hackish but it's the only way to do it now.
*/
var_SetInteger
(
p_input
,
"intf-event"
,
INPUT_EVENT_POSITION
);
}
}
else
{
/* Update "position" for better intf behavour */
const
mtime_t
i_length
=
var_GetTime
(
p_input
,
"length"
);
if
(
i_length
>
0
&&
newval
.
i_time
>=
0
&&
newval
.
i_time
<=
i_length
)
{
vlc_value_t
val
;
val
.
f_float
=
(
double
)
newval
.
i_time
/
(
double
)
i_length
;
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TIME
,
&
newval
);
var_Change
(
p_input
,
"position"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
return
VLC_SUCCESS
;
/*
}
* Notify the intf that a new event has been occurred.
* XXX this is a bit hackish but it's the only way to do it now.
*/
var_SetInteger
(
p_input
,
"intf-event"
,
INPUT_EVENT_POSITION
);
}
/* */
static
int
TimeOffsetCallback
(
vlc_object_t
*
obj
,
char
const
*
varname
,
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TIME
,
&
newval
);
vlc_value_t
prev
,
vlc_value_t
cur
,
void
*
data
)
}
{
VLC_UNUSED
(
varname
);
VLC_UNUSED
(
prev
);
VLC_UNUSED
(
data
);
mtime_t
i_time
=
var_GetTime
(
obj
,
"time"
)
+
cur
.
i_time
;
if
(
i_time
<
0
)
i_time
=
0
;
var_SetTime
(
obj
,
"time"
,
i_time
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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