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
ce80ca38
Commit
ce80ca38
authored
May 22, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: change time and length variable to integer
parent
72ab2078
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
106 additions
and
137 deletions
+106
-137
lib/media_player.c
lib/media_player.c
+5
-5
modules/control/dbus/dbus.c
modules/control/dbus/dbus.c
+1
-1
modules/control/dbus/dbus_player.c
modules/control/dbus/dbus_player.c
+5
-17
modules/control/hotkeys.c
modules/control/hotkeys.c
+8
-9
modules/control/oldrc.c
modules/control/oldrc.c
+11
-23
modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/CoreInteraction.m
+4
-4
modules/gui/macosx/StringUtility.m
modules/gui/macosx/StringUtility.m
+4
-6
modules/gui/macosx/controls.m
modules/gui/macosx/controls.m
+5
-5
modules/gui/macosx/fspanel.m
modules/gui/macosx/fspanel.m
+4
-5
modules/gui/macosx/playlist.m
modules/gui/macosx/playlist.m
+2
-2
modules/gui/ncurses.c
modules/gui/ncurses.c
+4
-4
modules/gui/qt4/dialogs/gototime.cpp
modules/gui/qt4/dialogs/gototime.cpp
+3
-3
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+11
-14
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+1
-1
modules/gui/skins2/vars/time.cpp
modules/gui/skins2/vars/time.cpp
+7
-7
share/lua/intf/cli.lua
share/lua/intf/cli.lua
+1
-1
share/lua/intf/modules/httprequests.lua
share/lua/intf/modules/httprequests.lua
+2
-2
share/lua/modules/common.lua
share/lua/modules/common.lua
+2
-2
src/input/control.c
src/input/control.c
+3
-3
src/input/event.c
src/input/event.c
+3
-3
src/input/input.c
src/input/input.c
+5
-5
src/input/var.c
src/input/var.c
+7
-7
src/input/vlm.c
src/input/vlm.c
+4
-4
src/input/vlmshell.c
src/input/vlmshell.c
+2
-2
src/text/strings.c
src/text/strings.c
+2
-2
No files found.
lib/media_player.c
View file @
ce80ca38
...
...
@@ -324,14 +324,14 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
/* */
event
.
type
=
libvlc_MediaPlayerTimeChanged
;
event
.
u
.
media_player_time_changed
.
new_time
=
from_mtime
(
var_Get
Time
(
p_input
,
"time"
));
from_mtime
(
var_Get
Integer
(
p_input
,
"time"
));
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
}
else
if
(
newval
.
i_int
==
INPUT_EVENT_LENGTH
)
{
event
.
type
=
libvlc_MediaPlayerLengthChanged
;
event
.
u
.
media_player_length_changed
.
new_length
=
from_mtime
(
var_Get
Time
(
p_input
,
"length"
));
from_mtime
(
var_Get
Integer
(
p_input
,
"length"
));
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
}
else
if
(
newval
.
i_int
==
INPUT_EVENT_CACHE
)
...
...
@@ -1158,7 +1158,7 @@ libvlc_time_t libvlc_media_player_get_length(
if
(
!
p_input_thread
)
return
-
1
;
i_time
=
from_mtime
(
var_Get
Time
(
p_input_thread
,
"length"
));
i_time
=
from_mtime
(
var_Get
Integer
(
p_input_thread
,
"length"
));
vlc_object_release
(
p_input_thread
);
return
i_time
;
...
...
@@ -1173,7 +1173,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
if
(
!
p_input_thread
)
return
-
1
;
i_time
=
from_mtime
(
var_Get
Time
(
p_input_thread
,
"time"
));
i_time
=
from_mtime
(
var_Get
Integer
(
p_input_thread
,
"time"
));
vlc_object_release
(
p_input_thread
);
return
i_time
;
}
...
...
@@ -1187,7 +1187,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
if
(
!
p_input_thread
)
return
;
var_Set
Time
(
p_input_thread
,
"time"
,
to_mtime
(
i_time
)
);
var_Set
Integer
(
p_input_thread
,
"time"
,
to_mtime
(
i_time
)
);
vlc_object_release
(
p_input_thread
);
}
...
...
modules/control/dbus/dbus.c
View file @
ce80ca38
...
...
@@ -923,7 +923,7 @@ static int InputCallback( vlc_object_t *p_this, const char *psz_var,
/* Detect seeks
* XXX: This is way more convoluted than it should be... */
i_pos
=
var_Get
Time
(
p_input
,
"time"
);
i_pos
=
var_Get
Integer
(
p_input
,
"time"
);
if
(
!
p_intf
->
p_sys
->
i_last_input_pos_event
||
!
(
var_GetInteger
(
p_input
,
"state"
)
==
PLAYING_S
)
)
...
...
modules/control/dbus/dbus_player.c
View file @
ce80ca38
...
...
@@ -49,10 +49,9 @@ MarshalPosition( intf_thread_t *p_intf, DBusMessageIter *container )
if
(
!
p_input
)
i_pos
=
0
;
else
{
i_pos
=
var_Get
Time
(
p_input
,
"time"
);
i_pos
=
var_Get
Integer
(
p_input
,
"time"
);
vlc_object_release
(
p_input
);
}
...
...
@@ -67,7 +66,6 @@ DBUS_METHOD( SetPosition )
REPLY_INIT
;
dbus_int64_t
i_pos
;
vlc_value_t
position
;
char
*
psz_trackid
,
*
psz_dbus_trackid
;
input_item_t
*
p_item
;
...
...
@@ -102,10 +100,7 @@ DBUS_METHOD( SetPosition )
}
if
(
!
strcmp
(
psz_trackid
,
psz_dbus_trackid
)
)
{
position
.
i_time
=
(
mtime_t
)
i_pos
;
var_Set
(
p_input
,
"time"
,
position
);
}
var_SetInteger
(
p_input
,
"time"
,
i_pos
);
free
(
psz_trackid
);
}
...
...
@@ -120,8 +115,6 @@ DBUS_METHOD( Seek )
{
REPLY_INIT
;
dbus_int64_t
i_step
;
vlc_value_t
newpos
;
mtime_t
i_pos
;
DBusError
error
;
dbus_error_init
(
&
error
);
...
...
@@ -141,13 +134,8 @@ DBUS_METHOD( Seek )
input_thread_t
*
p_input
=
pl_CurrentInput
(
p_this
);
if
(
p_input
&&
var_GetBool
(
p_input
,
"can-seek"
)
)
{
i_pos
=
var_GetTime
(
p_input
,
"time"
);
newpos
.
i_time
=
(
mtime_t
)
i_step
+
i_pos
;
if
(
newpos
.
i_time
<
0
)
newpos
.
i_time
=
0
;
var_Set
(
p_input
,
"time"
,
newpos
);
mtime_t
i_pos
=
var_GetInteger
(
p_input
,
"time"
)
+
i_step
;
var_SetInteger
(
p_input
,
"time"
,
(
i_pos
>=
0
)
?
i_pos
:
0
);
}
if
(
p_input
)
...
...
@@ -576,7 +564,7 @@ DBUS_SIGNAL( SeekedSignal )
if
(
p_input
)
{
i_pos
=
var_Get
Time
(
p_input
,
"time"
);
i_pos
=
var_Get
Integer
(
p_input
,
"time"
);
vlc_object_release
(
p_input
);
}
...
...
modules/control/hotkeys.c
View file @
ce80ca38
...
...
@@ -1179,30 +1179,29 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
{
char
psz_duration
[
MSTRTIME_MAX_SIZE
];
char
psz_time
[
MSTRTIME_MAX_SIZE
];
vlc_value_t
time
,
pos
;
mtime_t
i_seconds
;
if
(
p_vout
==
NULL
)
return
;
ClearChannels
(
p_intf
,
p_vout
);
var_Get
(
p_input
,
"time"
,
&
time
);
i_seconds
=
time
.
i_time
/
1000000
;
secstotimestr
(
psz_time
,
i_seconds
);
int64_t
t
=
var_GetInteger
(
p_input
,
"time"
)
/
CLOCK_FREQ
;
int64_t
l
=
var_GetInteger
(
p_input
,
"length"
)
/
CLOCK_FREQ
;
var_Get
(
p_input
,
"length"
,
&
time
);
if
(
time
.
i_time
>
0
)
secstotimestr
(
psz_time
,
t
);
if
(
l
>
0
)
{
secstotimestr
(
psz_duration
,
time
.
i_time
/
1000000
);
secstotimestr
(
psz_duration
,
l
);
DisplayMessage
(
p_vout
,
"%s / %s"
,
psz_time
,
psz_duration
);
}
else
if
(
i_seconds
>
0
)
else
if
(
t
>
0
)
{
DisplayMessage
(
p_vout
,
"%s"
,
psz_time
);
}
if
(
var_GetBool
(
p_vout
,
"fullscreen"
)
)
{
vlc_value_t
pos
;
var_Get
(
p_input
,
"position"
,
&
pos
);
vout_OSDSlider
(
p_vout
,
p_intf
->
p_sys
->
slider_chan
,
pos
.
f_float
*
100
,
OSD_HOR_SLIDER
);
...
...
modules/control/oldrc.c
View file @
ce80ca38
...
...
@@ -683,29 +683,17 @@ static void *Run( void *data )
}
else
if
(
!
strcmp
(
psz_cmd
,
"get_time"
)
)
{
if
(
p_sys
->
p_input
==
NULL
)
{
msg_rc
(
"0"
);
}
else
{
vlc_value_t
time
;
var_Get
(
p_sys
->
p_input
,
"time"
,
&
time
);
msg_rc
(
"%"
PRIu64
,
time
.
i_time
/
1000000
);
}
int64_t
t
=
0
;
if
(
p_sys
->
p_input
!=
NULL
)
t
=
var_GetInteger
(
p_sys
->
p_input
,
"time"
)
/
CLOCK_FREQ
;
msg_rc
(
"%"
PRIu64
,
t
);
}
else
if
(
!
strcmp
(
psz_cmd
,
"get_length"
)
)
{
if
(
p_sys
->
p_input
==
NULL
)
{
msg_rc
(
"0"
);
}
else
{
vlc_value_t
time
;
var_Get
(
p_sys
->
p_input
,
"length"
,
&
time
);
msg_rc
(
"%"
PRIu64
,
time
.
i_time
/
1000000
);
}
int64_t
l
=
0
;
if
(
p_sys
->
p_input
!=
NULL
)
l
=
var_GetInteger
(
p_sys
->
p_input
,
"length"
)
/
CLOCK_FREQ
;
msg_rc
(
"%"
PRIu64
,
l
);
}
else
if
(
!
strcmp
(
psz_cmd
,
"get_title"
)
)
{
...
...
@@ -905,7 +893,7 @@ static void PositionChanged( intf_thread_t *p_intf,
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
status_lock
);
if
(
p_intf
->
p_sys
->
b_input_buffering
)
msg_rc
(
STATUS_CHANGE
"( time: %"
PRId64
"s )"
,
(
var_Get
Time
(
p_input
,
"time"
)
/
1000000
)
);
(
var_Get
Integer
(
p_input
,
"time"
)
/
CLOCK_FREQ
)
);
p_intf
->
p_sys
->
b_input_buffering
=
false
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
status_lock
);
}
...
...
@@ -983,8 +971,8 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
}
else
{
mtime_t
t
=
((
int64_t
)
atoi
(
newval
.
psz_string
))
*
CLOCK_FREQ
;
var_Set
Time
(
p_input
,
"time"
,
t
);
mtime_t
t
=
atoi
(
newval
.
psz_string
)
;
var_Set
Integer
(
p_input
,
"time"
,
CLOCK_FREQ
*
t
);
}
i_error
=
VLC_SUCCESS
;
}
...
...
modules/gui/macosx/CoreInteraction.m
View file @
ce80ca38
...
...
@@ -433,13 +433,13 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if
(
!
timeA
)
{
input_thread_t
*
p_input
=
pl_CurrentInput
(
VLCIntf
);
if
(
p_input
)
{
timeA
=
var_Get
Time
(
p_input
,
"time"
);
timeA
=
var_Get
Integer
(
p_input
,
"time"
);
vlc_object_release
(
p_input
);
}
}
else
if
(
!
timeB
)
{
input_thread_t
*
p_input
=
pl_CurrentInput
(
VLCIntf
);
if
(
p_input
)
{
timeB
=
var_Get
Time
(
p_input
,
"time"
);
timeB
=
var_Get
Integer
(
p_input
,
"time"
);
vlc_object_release
(
p_input
);
}
}
else
...
...
@@ -457,9 +457,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if
(
timeB
)
{
input_thread_t
*
p_input
=
pl_CurrentInput
(
VLCIntf
);
if
(
p_input
)
{
mtime_t
currentTime
=
var_Get
Time
(
p_input
,
"time"
);
mtime_t
currentTime
=
var_Get
Integer
(
p_input
,
"time"
);
if
(
currentTime
>=
timeB
||
currentTime
<
timeA
)
var_Set
Time
(
p_input
,
"time"
,
timeA
);
var_Set
Integer
(
p_input
,
"time"
,
timeA
);
vlc_object_release
(
p_input
);
}
}
...
...
modules/gui/macosx/StringUtility.m
View file @
ce80ca38
...
...
@@ -117,19 +117,17 @@ static VLCStringUtility *_o_sharedInstance = nil;
{
assert
(
p_input
!=
nil
);
vlc_value_t
time
;
char
psz_time
[
MSTRTIME_MAX_SIZE
];
var_Get
(
p_input
,
"time"
,
&
time
);
int64_t
t
=
var_GetInteger
(
p_input
,
"time"
);
mtime_t
dur
=
input_item_GetDuration
(
input_GetItem
(
p_input
));
if
(
b_negative
&&
dur
>
0
)
{
mtime_t
remaining
=
0
;
if
(
dur
>
t
ime
.
i_time
)
remaining
=
dur
-
t
ime
.
i_time
;
if
(
dur
>
t
)
remaining
=
dur
-
t
;
return
[
NSString
stringWithFormat
:
@"-%s"
,
secstotimestr
(
psz_time
,
(
remaining
/
1000000
))];
}
else
return
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
(
time
.
i_time
/
1000000
)
)];
return
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
t
/
CLOCK_FREQ
)];
}
-
(
NSString
*
)
stringForTime
:(
long
long
int
)
time
...
...
modules/gui/macosx/controls.m
View file @
ce80ca38
...
...
@@ -233,11 +233,11 @@
input_thread_t
*
p_input
=
pl_CurrentInput
(
VLCIntf
);
if
(
p_input
)
{
/* we can obviously only do that if an input is available */
vlc_value
_t
pos
,
length
;
var_Get
(
p_input
,
"length"
,
&
length
);
[
o_specificTime_stepper
setMaxValue
:
(
length
.
i_time
/
1000000
)];
var_Get
(
p_input
,
"time"
,
&
pos
);
[
self
setJumpTimeValue
:
(
pos
.
i_time
/
1000000
)];
int64
_t
pos
,
length
;
length
=
var_GetInteger
(
p_input
,
"length"
);
[
o_specificTime_stepper
setMaxValue
:
(
length
/
CLOCK_FREQ
)];
pos
=
var_GetInteger
(
p_input
,
"time"
);
[
self
setJumpTimeValue
:
(
pos
/
CLOCK_FREQ
)];
[
NSApp
beginSheet
:
o_specificTime_win
modalForWindow
:
\
[
NSApp
mainWindow
]
modalDelegate
:
self
didEndSelector
:
nil
\
contextInfo
:
nil
];
...
...
modules/gui/macosx/fspanel.m
View file @
ce80ca38
...
...
@@ -545,10 +545,9 @@
f_updated
=
10000
.
*
pos
.
f_float
;
[
o_fs_timeSlider
setFloatValue
:
f_updated
];
vlc_value_t
time
;
char
psz_time
[
MSTRTIME_MAX_SIZE
];
var_Get
(
p_input
,
"time"
,
&
time
);
int64_t
t
=
var_GetInteger
(
p_input
,
"time"
);
mtime_t
dur
=
input_item_GetDuration
(
input_GetItem
(
p_input
));
// update total duration (right field)
...
...
@@ -560,8 +559,8 @@
NSString
*
o_total_time
;
if
([
o_streamLength_txt
timeRemaining
])
{
mtime_t
remaining
=
0
;
if
(
dur
>
t
ime
.
i_time
)
remaining
=
dur
-
t
ime
.
i_time
;
if
(
dur
>
t
)
remaining
=
dur
-
t
;
o_total_time
=
[
NSString
stringWithFormat
:
@"-%s"
,
secstotimestr
(
psz_time
,
(
remaining
/
1000000
))];
}
else
o_total_time
=
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
(
dur
/
1000000
))];
...
...
@@ -570,7 +569,7 @@
}
// update current position (left field)
NSString
*
o_playback_pos
=
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
(
time
.
i_time
/
1000000
)
)];
NSString
*
o_playback_pos
=
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
t
/
CLOCK_FREQ
)];
[
o_streamPosition_txt
setStringValue
:
o_playback_pos
];
vlc_object_release
(
p_input
);
...
...
modules/gui/macosx/playlist.m
View file @
ce80ca38
...
...
@@ -1026,7 +1026,7 @@
mtime_t
lastPos
=
(
mtime_t
)
lastPosition
.
intValue
*
1000000
;
msg_Dbg
(
VLCIntf
,
"continuing playback at %lld"
,
lastPos
);
var_Set
Time
(
p_input_thread
,
"time"
,
lastPos
);
var_Set
Integer
(
p_input_thread
,
"time"
,
lastPos
);
if
(
returnValue
==
NSAlertOtherReturn
)
config_PutInt
(
VLCIntf
,
"macosx-continue-playback"
,
1
);
...
...
@@ -1054,7 +1054,7 @@
NSMutableDictionary
*
mutDict
=
[[
NSMutableDictionary
alloc
]
initWithDictionary
:[
defaults
objectForKey
:
@"recentlyPlayedMedia"
]];
float
relativePos
=
var_GetFloat
(
p_input_thread
,
"position"
);
mtime_t
pos
=
var_Get
Time
(
p_input_thread
,
"time"
)
/
1000000
;
mtime_t
pos
=
var_Get
Integer
(
p_input_thread
,
"time"
)
/
CLOCK_FREQ
;
mtime_t
dur
=
input_item_GetDuration
(
p_item
)
/
1000000
;
NSMutableArray
*
mediaList
=
[[
defaults
objectForKey
:
@"recentlyPlayedMediaList"
]
mutableCopy
];
...
...
modules/gui/ncurses.c
View file @
ce80ca38
...
...
@@ -1098,10 +1098,10 @@ static int DrawStatus(intf_thread_t *intf)
repeat
,
random
,
loop
);
default:
va
r_Get
(
p_input
,
"time"
,
&
val
);
secstotimestr
(
buf1
,
val
.
i_
time
/
CLOCK_FREQ
);
va
r_Get
(
p_input
,
"length"
,
&
val
);
secstotimestr
(
buf2
,
val
.
i_
time
/
CLOCK_FREQ
);
va
l
.
i_int
=
var_GetInteger
(
p_input
,
"time"
);
secstotimestr
(
buf1
,
val
.
i_
int
/
CLOCK_FREQ
);
va
l
.
i_int
=
var_GetInteger
(
p_input
,
"length"
);
secstotimestr
(
buf2
,
val
.
i_
int
/
CLOCK_FREQ
);
mvnprintw
(
y
++
,
0
,
COLS
,
_
(
" Position : %s/%s"
),
buf1
,
buf2
);
...
...
modules/gui/qt4/dialogs/gototime.cpp
View file @
ce80ca38
...
...
@@ -88,8 +88,8 @@ void GotoTimeDialog::toggleVisible()
reset
();
if
(
!
isVisible
()
&&
THEMIM
->
getIM
()
->
hasInput
()
)
{
int64_t
i_time
=
var_Get
Time
(
THEMIM
->
getInput
(),
"time"
);
timeEdit
->
setTime
(
timeEdit
->
time
().
addSecs
(
i_time
/
1000000
)
);
int64_t
i_time
=
var_Get
Integer
(
THEMIM
->
getInput
(),
"time"
);
timeEdit
->
setTime
(
timeEdit
->
time
().
addSecs
(
i_time
/
CLOCK_FREQ
)
);
}
QVLCDialog
::
toggleVisible
();
if
(
isVisible
())
...
...
@@ -108,7 +108,7 @@ void GotoTimeDialog::close()
{
int64_t
i_time
=
(
int64_t
)
(
QTime
(
0
,
0
,
0
).
msecsTo
(
timeEdit
->
time
()
)
)
*
1000
;
var_Set
Time
(
THEMIM
->
getInput
(),
"time"
,
i_time
);
var_Set
Integer
(
THEMIM
->
getInput
(),
"time"
,
i_time
);
}
toggleVisible
();
}
...
...
modules/gui/qt4/input_manager.cpp
View file @
ce80ca38
...
...
@@ -171,8 +171,8 @@ void InputManager::delInput()
int64_t
i_time
=
-
1
;
if
(
f_pos
>=
0.05
f
&&
f_pos
<=
0.95
f
&&
var_Get
Time
(
p_input
,
"length"
)
>=
60
*
CLOCK_FREQ
)
i_time
=
var_Get
Time
(
p_input
,
"time"
);
&&
var_Get
Integer
(
p_input
,
"length"
)
>=
60
*
CLOCK_FREQ
)
i_time
=
var_Get
Integer
(
p_input
,
"time"
);
RecentsMRL
::
getInstance
(
p_intf
)
->
setTime
(
qfu
(
uri
),
i_time
);
free
(
uri
);
...
...
@@ -445,13 +445,10 @@ static int VbiEvent( vlc_object_t *, const char *,
void
InputManager
::
UpdatePosition
()
{
/* Update position */
int
i_length
;
int64_t
i_time
;
float
f_pos
;
i_length
=
var_GetTime
(
p_input
,
"length"
)
/
CLOCK_FREQ
;
i_time
=
var_GetTime
(
p_input
,
"time"
);
f_pos
=
var_GetFloat
(
p_input
,
"position"
);
emit
positionUpdated
(
f_pos
,
i_time
,
i_length
);
int64_t
i_length
=
var_GetInteger
(
p_input
,
"length"
);
int64_t
i_time
=
var_GetInteger
(
p_input
,
"time"
);
float
f_pos
=
var_GetFloat
(
p_input
,
"position"
);
emit
positionUpdated
(
f_pos
,
i_time
,
i_length
/
CLOCK_FREQ
);
}
void
InputManager
::
UpdateNavigation
()
...
...
@@ -982,12 +979,12 @@ void InputManager::setAtoB()
{
if
(
!
timeA
)
{
timeA
=
var_Get
Time
(
THEMIM
->
getInput
(),
"time"
);
timeA
=
var_Get
Integer
(
THEMIM
->
getInput
(),
"time"
);
}
else
if
(
!
timeB
)
{
timeB
=
var_Get
Time
(
THEMIM
->
getInput
(),
"time"
);
var_Set
Time
(
THEMIM
->
getInput
(),
"time"
,
timeA
);
timeB
=
var_Get
Integer
(
THEMIM
->
getInput
(),
"time"
);
var_Set
Integer
(
THEMIM
->
getInput
(),
"time"
,
timeA
);
CONNECT
(
this
,
positionUpdated
(
float
,
int64_t
,
int
),
this
,
AtoBLoop
(
float
,
int64_t
,
int
)
);
}
...
...
@@ -1005,7 +1002,7 @@ void InputManager::setAtoB()
void
InputManager
::
AtoBLoop
(
float
,
int64_t
i_time
,
int
)
{
if
(
timeB
&&
i_time
>=
timeB
)
var_Set
Time
(
THEMIM
->
getInput
(),
"time"
,
timeA
);
var_Set
Integer
(
THEMIM
->
getInput
(),
"time"
,
timeA
);
}
/**********************************************************************
...
...
@@ -1128,7 +1125,7 @@ void MainInputManager::prev()
void
MainInputManager
::
prevOrReset
()
{
if
(
!
p_input
||
var_Get
Time
(
p_input
,
"time"
)
<
10000
)
if
(
!
p_input
||
var_Get
Integer
(
p_input
,
"time"
)
<
INT64_C
(
10000
)
)
playlist_Prev
(
THEPL
);
else
getIM
()
->
sliderUpdate
(
0.0
);
...
...
modules/gui/qt4/main_interface.cpp
View file @
ce80ca38
...
...
@@ -434,7 +434,7 @@ void MainInterface::hideResumePanel()
void
MainInterface
::
resumePlayback
()
{
if
(
THEMIM
->
getIM
()
->
hasInput
()
)
{
var_Set
Time
(
THEMIM
->
getInput
(),
"time"
,
i_resumeTime
);
var_Set
Integer
(
THEMIM
->
getInput
(),
"time"
,
i_resumeTime
);
}
hideResumePanel
();
}
...
...
modules/gui/skins2/vars/time.cpp
View file @
ce80ca38
...
...
@@ -77,8 +77,8 @@ string StreamTime::getAsStringCurrTime( bool bShortFormat ) const
if
(
!
havePosition
()
)
return
"-:--:--"
;
mtime_t
time
=
var_Get
Time
(
getIntf
()
->
p_sys
->
p_input
,
"time"
);
return
formatTime
(
time
/
1000000
,
bShortFormat
);
mtime_t
time
=
var_Get
Integer
(
getIntf
()
->
p_sys
->
p_input
,
"time"
);
return
formatTime
(
time
/
CLOCK_FREQ
,
bShortFormat
);
}
...
...
@@ -87,10 +87,10 @@ string StreamTime::getAsStringTimeLeft( bool bShortFormat ) const
if
(
!
havePosition
()
)
return
"-:--:--"
;
mtime_t
time
=
var_Get
Time
(
getIntf
()
->
p_sys
->
p_input
,
"time"
),
duration
=
var_Get
Time
(
getIntf
()
->
p_sys
->
p_input
,
"length"
);
mtime_t
time
=
var_Get
Integer
(
getIntf
()
->
p_sys
->
p_input
,
"time"
),
duration
=
var_Get
Integer
(
getIntf
()
->
p_sys
->
p_input
,
"length"
);
return
formatTime
(
(
duration
-
time
)
/
1000000
,
bShortFormat
);
return
formatTime
(
(
duration
-
time
)
/
CLOCK_FREQ
,
bShortFormat
);
}
...
...
@@ -99,6 +99,6 @@ string StreamTime::getAsStringDuration( bool bShortFormat ) const
if
(
!
havePosition
()
)
return
"-:--:--"
;
mtime_t
time
=
var_Get
Time
(
getIntf
()
->
p_sys
->
p_input
,
"length"
);
return
formatTime
(
time
/
1000000
,
bShortFormat
);
mtime_t
time
=
var_Get
Integer
(
getIntf
()
->
p_sys
->
p_input
,
"length"
);
return
formatTime
(
time
/
CLOCK_FREQ
,
bShortFormat
);
}
share/lua/intf/cli.lua
View file @
ce80ca38
...
...
@@ -430,7 +430,7 @@ function get_time(var)
return
function
(
name
,
client
)
local
input
=
vlc
.
object
.
input
()
if
input
then
client
:
append
(
math.floor
(
vlc
.
var
.
get
(
input
,
var
)))
client
:
append
(
math.floor
(
vlc
.
var
.
get
(
input
,
var
)
/
1000000
))
else
client
:
append
(
""
)
end
...
...
share/lua/intf/modules/httprequests.lua
View file @
ce80ca38
...
...
@@ -456,8 +456,8 @@ getstatus = function (includecategories)
s
.
volume
=
vlc
.
volume
.
get
()
if
input
then
s
.
length
=
math.floor
(
vlc
.
var
.
get
(
input
,
"length"
))
s
.
time
=
math.floor
(
vlc
.
var
.
get
(
input
,
"time"
))
s
.
length
=
math.floor
(
vlc
.
var
.
get
(
input
,
"length"
)
/
1000000
)
s
.
time
=
math.floor
(
vlc
.
var
.
get
(
input
,
"time"
)
/
1000000
)
s
.
position
=
vlc
.
var
.
get
(
input
,
"position"
)
s
.
currentplid
=
vlc
.
playlist
.
current
()
s
.
audiodelay
=
vlc
.
var
.
get
(
input
,
"audio-delay"
)
...
...
share/lua/modules/common.lua
View file @
ce80ca38
...
...
@@ -160,9 +160,9 @@ function seek(value)
else
local posTime = parsetime(value)
if string.sub(value,1,1) == "
+
" or string.sub(value,1,1) == "
-
" then
vlc.var.set(input,"
time
",vlc.var.get(input,"
time
") +
posTime
)
vlc.var.set(input,"
time
",vlc.var.get(input,"
time
") +
(posTime * 1000000)
)
else
vlc.var.set(input,"
time
",posTime)
vlc.var.set(input,"
time
",posTime
* 1000000
)
end
end
end
...
...
src/input/control.c
View file @
ce80ca38
...
...
@@ -87,17 +87,17 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case
INPUT_GET_LENGTH
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
var_Get
Time
(
p_input
,
"length"
);
*
pi_64
=
var_Get
Integer
(
p_input
,
"length"
);
return
VLC_SUCCESS
;
case
INPUT_GET_TIME
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
var_Get
Time
(
p_input
,
"time"
);
*
pi_64
=
var_Get
Integer
(
p_input
,
"time"
);
return
VLC_SUCCESS
;
case
INPUT_SET_TIME
:
i_64
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
return
var_Set
Time
(
p_input
,
"time"
,
i_64
);
return
var_Set
Integer
(
p_input
,
"time"
,
i_64
);
case
INPUT_GET_RATE
:
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
...
...
src/input/event.c
View file @
ce80ca38
...
...
@@ -65,7 +65,7 @@ void input_SendEventPosition( input_thread_t *p_input, double f_position, mtime_
var_Change
(
p_input
,
"position"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
/* */
val
.
i_
time
=
i_time
;
val
.
i_
int
=
i_time
;
var_Change
(
p_input
,
"time"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
Trigger
(
p_input
,
INPUT_EVENT_POSITION
);
...
...
@@ -75,12 +75,12 @@ void input_SendEventLength( input_thread_t *p_input, mtime_t i_length )
vlc_value_t
val
;
/* FIXME ugly + what about meta change event ? */
if
(
var_Get
Time
(
p_input
,
"length"
)
==
i_length
)
if
(
var_Get
Integer
(
p_input
,
"length"
)
==
i_length
)
return
;
input_item_SetDuration
(
p_input
->
p
->
p_item
,
i_length
);
val
.
i_
time
=
i_length
;
val
.
i_
int
=
i_length
;
var_Change
(
p_input
,
"length"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
Trigger
(
p_input
,
INPUT_EVENT_LENGTH
);
...
...
src/input/input.c
View file @
ce80ca38
...
...
@@ -627,7 +627,7 @@ static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
/* Seek to start position */
if
(
p_input
->
p
->
i_start
>
0
)
{
val
.
i_
time
=
p_input
->
p
->
i_start
;
val
.
i_
int
=
p_input
->
p
->
i_start
;
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TIME
,
&
val
);
}
else
...
...
@@ -920,7 +920,7 @@ static void StartTitle( input_thread_t * p_input )
msg_Dbg
(
p_input
,
"starting at time: %ds"
,
(
int
)(
p_input
->
p
->
i_start
/
CLOCK_FREQ
)
);
s
.
i_
time
=
p_input
->
p
->
i_start
;
s
.
i_
int
=
p_input
->
p
->
i_start
;
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TIME
,
&
s
);
}
if
(
p_input
->
p
->
i_stop
>
0
&&
p_input
->
p
->
i_stop
<=
p_input
->
p
->
i_start
)
...
...
@@ -1674,7 +1674,7 @@ static bool Control( input_thread_t *p_input,
break
;
}
i_time
=
val
.
i_
time
;
i_time
=
val
.
i_
int
;
if
(
i_time
<
0
)
i_time
=
0
;
...
...
@@ -1894,7 +1894,7 @@ static bool Control( input_thread_t *p_input,
if
(
i_type
==
INPUT_CONTROL_SET_SEEKPOINT_PREV
)
{
int64_t
i_seekpoint_time
=
p_input
->
p
->
input
.
title
[
i_title
]
->
seekpoint
[
i_seekpoint
]
->
i_time_offset
;
int64_t
i_input_time
=
var_Get
Time
(
p_input
,
"time"
);
int64_t
i_input_time
=
var_Get
Integer
(
p_input
,
"time"
);
if
(
i_seekpoint_time
>=
0
&&
i_input_time
>=
0
)
{
if
(
i_input_time
<
i_seekpoint_time
+
3000000
)
...
...
@@ -2023,7 +2023,7 @@ static bool Control( input_thread_t *p_input,
break
;
}
val
.
i_
time
=
time_offset
;
val
.
i_
int
=
time_offset
;
b_force_update
=
Control
(
p_input
,
INPUT_CONTROL_SET_TIME
,
val
);
break
;
}
...
...
src/input/var.c
View file @
ce80ca38
...
...
@@ -147,7 +147,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
var_Create
(
p_input
,
"position-offset"
,
VLC_VAR_FLOAT
);
/* Time */
var_Create
(
p_input
,
"time"
,
VLC_VAR_TIME
);
var_Create
(
p_input
,
"time"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"time-offset"
,
VLC_VAR_TIME
);
/* relative */
/* Bookmark */
...
...
@@ -212,7 +212,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* Special read only objects variables for intf */
var_Create
(
p_input
,
"bookmarks"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"length"
,
VLC_VAR_TIME
);
var_Create
(
p_input
,
"length"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"bit-rate"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"sample-rate"
,
VLC_VAR_INTEGER
);
...
...
@@ -594,12 +594,12 @@ static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
else
{
/* Update "length" for better intf behavour */
const
mtime_t
i_length
=
var_GetTime
(
p_input
,
"length"
);
const
int64_t
i_length
=
var_GetInteger
(
p_input
,
"length"
);
if
(
i_length
>
0
&&
newval
.
f_float
>=
0
.
f
&&
newval
.
f_float
<=
1
.
f
)
{
vlc_value_t
val
;
val
.
i_
time
=
i_length
*
newval
.
f_float
;
val
.
i_
int
=
i_length
*
newval
.
f_float
;
var_Change
(
p_input
,
"time"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
}
...
...
@@ -616,12 +616,12 @@ static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED
(
psz_cmd
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_data
);
/* 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
)
const
int64_t
i_length
=
var_GetInteger
(
p_input
,
"length"
);
if
(
i_length
>
0
&&
newval
.
i_
int
>=
0
&&
newval
.
i_int
<=
i_length
)
{
vlc_value_t
val
;
val
.
f_float
=
(
double
)
newval
.
i_
time
/
(
double
)
i_length
;
val
.
f_float
=
(
double
)
newval
.
i_
int
/
(
double
)
i_length
;
var_Change
(
p_input
,
"position"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
/*
* Notify the intf that a new event has been occurred.
...
...
src/input/vlm.c
View file @
ce80ca38
...
...
@@ -1097,7 +1097,7 @@ static int vlm_ControlMediaInstanceGetTimePosition( vlm_t *p_vlm, int64_t id, co
return
VLC_EGENERIC
;
if
(
pi_time
)
*
pi_time
=
var_Get
Time
(
p_instance
->
p_input
,
"time"
);
*
pi_time
=
var_Get
Integer
(
p_instance
->
p_input
,
"time"
);
if
(
pd_position
)
*
pd_position
=
var_GetFloat
(
p_instance
->
p_input
,
"position"
);
return
VLC_SUCCESS
;
...
...
@@ -1115,7 +1115,7 @@ static int vlm_ControlMediaInstanceSetTimePosition( vlm_t *p_vlm, int64_t id, co
return
VLC_EGENERIC
;
if
(
i_time
>=
0
)
return
var_Set
Time
(
p_instance
->
p_input
,
"time"
,
i_time
);
return
var_Set
Integer
(
p_instance
->
p_input
,
"time"
,
i_time
);
else
if
(
d_position
>=
0
&&
d_position
<=
100
)
return
var_SetFloat
(
p_instance
->
p_input
,
"position"
,
d_position
);
return
VLC_EGENERIC
;
...
...
@@ -1141,8 +1141,8 @@ static int vlm_ControlMediaInstanceGets( vlm_t *p_vlm, int64_t id, vlm_media_ins
p_idsc
->
psz_name
=
strdup
(
p_instance
->
psz_name
);
if
(
p_instance
->
p_input
)
{
p_idsc
->
i_time
=
var_Get
Time
(
p_instance
->
p_input
,
"time"
);
p_idsc
->
i_length
=
var_Get
Time
(
p_instance
->
p_input
,
"length"
);
p_idsc
->
i_time
=
var_Get
Integer
(
p_instance
->
p_input
,
"time"
);
p_idsc
->
i_length
=
var_Get
Integer
(
p_instance
->
p_input
,
"length"
);
p_idsc
->
d_position
=
var_GetFloat
(
p_instance
->
p_input
,
"position"
);
if
(
var_GetInteger
(
p_instance
->
p_input
,
"state"
)
==
PAUSE_S
)
p_idsc
->
b_paused
=
true
;
...
...
src/input/vlmshell.c
View file @
ce80ca38
...
...
@@ -1347,8 +1347,8 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
vlm_MessageAdd( p_msg_instance, vlm_MessageNew( key, format, \
var_Get ## type( p_instance->p_input, key ) ) )
APPEND_INPUT_INFO
(
"position"
,
"%f"
,
Float
);
APPEND_INPUT_INFO
(
"time"
,
"%"
PRI
i64
,
Time
);
APPEND_INPUT_INFO
(
"length"
,
"%"
PRI
i64
,
Time
);
APPEND_INPUT_INFO
(
"time"
,
"%"
PRI
d64
,
Integer
);
APPEND_INPUT_INFO
(
"length"
,
"%"
PRI
d64
,
Integer
);
APPEND_INPUT_INFO
(
"rate"
,
"%f"
,
Float
);
APPEND_INPUT_INFO
(
"title"
,
"%"
PRId64
,
Integer
);
APPEND_INPUT_INFO
(
"chapter"
,
"%"
PRId64
,
Integer
);
...
...
src/text/strings.c
View file @
ce80ca38
...
...
@@ -690,7 +690,7 @@ char *str_format_meta(input_thread_t *input, const char *s)
{
assert
(
input
!=
NULL
);
write_duration
(
stream
,
input_item_GetDuration
(
item
)
-
var_Get
Time
(
input
,
"time"
));
-
var_Get
Integer
(
input
,
"time"
));
}
else
if
(
!
b_empty_if_na
)
fputs
(
"--:--:--"
,
stream
);
...
...
@@ -747,7 +747,7 @@ char *str_format_meta(input_thread_t *input, const char *s)
break
;
case
'T'
:
if
(
input
!=
NULL
)
write_duration
(
stream
,
var_Get
Time
(
input
,
"time"
));
write_duration
(
stream
,
var_Get
Integer
(
input
,
"time"
));
else
if
(
!
b_empty_if_na
)
fputs
(
"--:--:--"
,
stream
);
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