Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
75a89c59
Commit
75a89c59
authored
Aug 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlayerThread: use SongTime for elapsed_time
parent
22899686
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
PlayerControl.hxx
src/PlayerControl.hxx
+2
-2
PlayerThread.cxx
src/PlayerThread.cxx
+8
-8
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+2
-2
PlaylistControl.cxx
src/queue/PlaylistControl.cxx
+1
-1
PlaylistState.cxx
src/queue/PlaylistState.cxx
+4
-4
No files found.
src/PlayerControl.hxx
View file @
75a89c59
...
...
@@ -90,7 +90,7 @@ struct player_status {
uint16_t
bit_rate
;
AudioFormat
audio_format
;
SignedSongTime
total_time
;
float
elapsed_time
;
SongTime
elapsed_time
;
};
struct
PlayerControl
{
...
...
@@ -152,7 +152,7 @@ struct PlayerControl {
uint16_t
bit_rate
;
AudioFormat
audio_format
;
SignedSongTime
total_time
;
float
elapsed_time
;
SongTime
elapsed_time
;
/**
* The next queued song.
...
...
src/PlayerThread.cxx
View file @
75a89c59
...
...
@@ -129,7 +129,7 @@ class Player {
* value; the output thread can estimate the elapsed time more
* precisely.
*/
float
elapsed_time
;
SongTime
elapsed_time
;
public
:
Player
(
PlayerControl
&
_pc
,
DecoderControl
&
_dc
,
...
...
@@ -146,7 +146,7 @@ public:
cross_fading
(
false
),
cross_fade_chunks
(
0
),
cross_fade_tag
(
nullptr
),
elapsed_time
(
0.0
)
{}
elapsed_time
(
SongTime
::
zero
()
)
{}
private
:
void
ClearAndDeletePipe
()
{
...
...
@@ -342,7 +342,7 @@ Player::WaitForDecoder()
delete
song
;
song
=
pc
.
next_song
;
elapsed_time
=
0.0
;
elapsed_time
=
SongTime
::
zero
()
;
/* set the "starting" flag, which will be cleared by
player_check_decoder_startup() */
...
...
@@ -574,7 +574,7 @@ Player::SeekDecoder()
return
false
;
}
elapsed_time
=
where
.
ToDoubleS
()
;
elapsed_time
=
where
;
player_command_finished
(
pc
);
...
...
@@ -674,9 +674,9 @@ Player::ProcessCommand()
pc
.
Lock
();
}
pc
.
elapsed_time
=
pc
.
outputs
.
GetElapsedTime
()
;
if
(
pc
.
elapsed_time
<
0.0
)
pc
.
elapsed_time
=
elapsed_time
;
pc
.
elapsed_time
=
pc
.
outputs
.
GetElapsedTime
()
>=
0
?
SongTime
::
FromS
(
pc
.
outputs
.
GetElapsedTime
()
)
:
elapsed_time
;
pc
.
CommandFinished
();
break
;
...
...
@@ -924,7 +924,7 @@ Player::Run()
pc
.
state
=
PlayerState
::
PLAY
;
if
(
pc
.
command
==
PlayerCommand
::
SEEK
)
elapsed_time
=
pc
.
seek_time
.
ToDoubleS
()
;
elapsed_time
=
pc
.
seek_time
;
pc
.
CommandFinished
();
...
...
src/command/PlayerCommands.cxx
View file @
75a89c59
...
...
@@ -175,11 +175,11 @@ handle_status(Client &client,
COMMAND_STATUS_TIME
": %i:%i
\n
"
"elapsed: %1.3f
\n
"
COMMAND_STATUS_BITRATE
": %u
\n
"
,
(
int
)(
player_status
.
elapsed_time
+
0.5
),
player_status
.
elapsed_time
.
RoundS
(
),
player_status
.
total_time
.
IsNegative
()
?
0u
:
unsigned
(
player_status
.
total_time
.
RoundS
()),
player_status
.
elapsed_time
,
player_status
.
elapsed_time
.
ToDoubleS
()
,
player_status
.
bit_rate
);
if
(
player_status
.
audio_format
.
IsDefined
())
{
...
...
src/queue/PlaylistControl.cxx
View file @
75a89c59
...
...
@@ -252,7 +252,7 @@ playlist::SeekCurrent(PlayerControl &pc,
status
.
state
!=
PlayerState
::
PAUSE
)
return
PlaylistResult
::
NOT_PLAYING
;
seek_time
+=
SignedSongTime
::
FromS
(
status
.
elapsed_time
)
;
seek_time
+=
status
.
elapsed_time
;
if
(
seek_time
.
IsNegative
())
seek_time
=
SignedSongTime
::
zero
();
}
...
...
src/queue/PlaylistState.cxx
View file @
75a89c59
...
...
@@ -77,8 +77,8 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
}
os
.
Format
(
PLAYLIST_STATE_FILE_CURRENT
"%i
\n
"
,
playlist
.
queue
.
OrderToPosition
(
playlist
.
current
));
os
.
Format
(
PLAYLIST_STATE_FILE_TIME
"%
i
\n
"
,
(
int
)
player_status
.
elapsed_time
);
os
.
Format
(
PLAYLIST_STATE_FILE_TIME
"%
f
\n
"
,
player_status
.
elapsed_time
.
ToDoubleS
()
);
}
else
{
os
.
Write
(
PLAYLIST_STATE_FILE_STATE_STOP
"
\n
"
);
...
...
@@ -150,7 +150,7 @@ playlist_state_restore(const char *line, TextFile &file,
while
((
line
=
file
.
ReadLine
())
!=
nullptr
)
{
if
(
StringStartsWith
(
line
,
PLAYLIST_STATE_FILE_TIME
))
{
unsigned
seconds
=
atoi
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]
));
double
seconds
=
atof
(
line
+
strlen
(
PLAYLIST_STATE_FILE_TIME
));
seek_time
=
SongTime
::
FromS
(
seconds
);
}
else
if
(
StringStartsWith
(
line
,
PLAYLIST_STATE_FILE_REPEAT
))
{
playlist
.
SetRepeat
(
pc
,
...
...
@@ -229,7 +229,7 @@ playlist_state_get_hash(const playlist &playlist,
return
playlist
.
queue
.
version
^
(
player_status
.
state
!=
PlayerState
::
STOP
?
(
(
int
)
player_status
.
elapsed_time
<<
8
)
?
(
player_status
.
elapsed_time
.
ToS
()
<<
8
)
:
0
)
^
(
playlist
.
current
>=
0
?
(
playlist
.
queue
.
OrderToPosition
(
playlist
.
current
)
<<
16
)
...
...
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