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
0f2a7226
Commit
0f2a7226
authored
Aug 27, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlayerControl: use std::chrono::duration for Seek()
parent
f8d0ebe9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
PlayerControl.cxx
src/PlayerControl.cxx
+2
-2
PlayerControl.hxx
src/PlayerControl.hxx
+3
-2
PlayerThread.cxx
src/PlayerThread.cxx
+10
-9
PlaylistControl.cxx
src/queue/PlaylistControl.cxx
+2
-1
No files found.
src/PlayerControl.cxx
View file @
0f2a7226
...
...
@@ -221,7 +221,7 @@ PlayerControl::EnqueueSong(DetachedSong *song)
}
bool
PlayerControl
::
Seek
(
DetachedSong
*
song
,
float
seek_time
)
PlayerControl
::
Seek
(
DetachedSong
*
song
,
SongTime
t
)
{
assert
(
song
!=
nullptr
);
...
...
@@ -229,7 +229,7 @@ PlayerControl::Seek(DetachedSong *song, float seek_time)
delete
next_song
;
next_song
=
song
;
seek_
where
=
seek_time
;
seek_
time
=
t
;
SynchronousCommand
(
PlayerCommand
::
SEEK
);
Unlock
();
...
...
src/PlayerControl.hxx
View file @
0f2a7226
...
...
@@ -26,6 +26,7 @@
#include "thread/Thread.hxx"
#include "util/Error.hxx"
#include "CrossFade.hxx"
#include "Chrono.hxx"
#include <stdint.h>
...
...
@@ -161,7 +162,7 @@ struct PlayerControl {
*/
DetachedSong
*
next_song
;
double
seek_wher
e
;
SongTime
seek_tim
e
;
CrossFadeSettings
cross_fade
;
...
...
@@ -434,7 +435,7 @@ public:
* @return true on success, false on failure (e.g. if MPD isn't
* playing currently)
*/
bool
Seek
(
DetachedSong
*
song
,
float
seek_time
);
bool
Seek
(
DetachedSong
*
song
,
SongTime
t
);
void
SetCrossFade
(
float
cross_fade_seconds
);
...
...
src/PlayerThread.cxx
View file @
0f2a7226
...
...
@@ -293,7 +293,7 @@ Player::StartDecoder(MusicPipe &_pipe)
unsigned
start_ms
=
pc
.
next_song
->
GetStartMS
();
if
(
pc
.
command
==
PlayerCommand
::
SEEK
)
start_ms
+=
(
unsigned
)(
pc
.
seek_where
*
1000
);
start_ms
+=
pc
.
seek_time
.
ToMS
(
);
dc
.
Start
(
new
DetachedSong
(
*
pc
.
next_song
),
start_ms
,
pc
.
next_song
->
GetEndMS
(),
...
...
@@ -561,19 +561,20 @@ Player::SeekDecoder()
/* send the SEEK command */
double
where
=
pc
.
seek_where
;
if
(
pc
.
total_time
>
0
&&
where
>
pc
.
total_time
)
where
=
pc
.
total_time
-
0.1
;
if
(
where
<
0.0
)
where
=
0.0
;
SongTime
where
=
pc
.
seek_time
;
if
(
pc
.
total_time
>
0
)
{
const
SongTime
total_time
=
SongTime
::
FromS
(
pc
.
total_time
);
if
(
where
>
total_time
)
where
=
total_time
;
}
if
(
!
dc
.
Seek
(
SongTime
::
FromS
(
where
)
+
SongTime
::
FromMS
(
start_ms
)))
{
if
(
!
dc
.
Seek
(
where
+
SongTime
::
FromMS
(
start_ms
)))
{
/* decoder failure */
player_command_finished
(
pc
);
return
false
;
}
elapsed_time
=
where
;
elapsed_time
=
where
.
ToDoubleS
()
;
player_command_finished
(
pc
);
...
...
@@ -923,7 +924,7 @@ Player::Run()
pc
.
state
=
PlayerState
::
PLAY
;
if
(
pc
.
command
==
PlayerCommand
::
SEEK
)
elapsed_time
=
pc
.
seek_
where
;
elapsed_time
=
pc
.
seek_
time
.
ToDoubleS
()
;
pc
.
CommandFinished
();
...
...
src/queue/PlaylistControl.cxx
View file @
0f2a7226
...
...
@@ -215,7 +215,8 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
queued_song
=
nullptr
;
}
if
(
!
pc
.
Seek
(
new
DetachedSong
(
queue
.
GetOrder
(
i
)),
seek_time
))
{
if
(
!
pc
.
Seek
(
new
DetachedSong
(
queue
.
GetOrder
(
i
)),
SongTime
::
FromS
(
seek_time
)))
{
UpdateQueuedSong
(
pc
,
queued_song
);
return
PlaylistResult
::
NOT_PLAYING
;
...
...
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