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
ba6ba7d4
Commit
ba6ba7d4
authored
Aug 27, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderControl: use std::chrono::duration for Seek()
parent
58e6f660
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+3
-3
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+2
-3
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+3
-2
DecoderInternal.hxx
src/decoder/DecoderInternal.hxx
+1
-1
No files found.
src/PlayerThread.cxx
View file @
ba6ba7d4
...
@@ -567,7 +567,7 @@ Player::SeekDecoder()
...
@@ -567,7 +567,7 @@ Player::SeekDecoder()
if
(
where
<
0.0
)
if
(
where
<
0.0
)
where
=
0.0
;
where
=
0.0
;
if
(
!
dc
.
Seek
(
where
+
start_ms
/
1000.0
))
{
if
(
!
dc
.
Seek
(
SongTime
::
FromS
(
where
)
+
SongTime
::
FromMS
(
start_ms
)
))
{
/* decoder failure */
/* decoder failure */
player_command_finished
(
pc
);
player_command_finished
(
pc
);
return
false
;
return
false
;
...
...
src/decoder/DecoderAPI.cxx
View file @
ba6ba7d4
...
@@ -196,7 +196,7 @@ decoder_command_finished(Decoder &decoder)
...
@@ -196,7 +196,7 @@ decoder_command_finished(Decoder &decoder)
dc
.
pipe
->
Clear
(
*
dc
.
buffer
);
dc
.
pipe
->
Clear
(
*
dc
.
buffer
);
decoder
.
timestamp
=
dc
.
seek_
where
;
decoder
.
timestamp
=
dc
.
seek_
time
.
ToDoubleS
()
;
}
}
dc
.
command
=
DecoderCommand
::
NONE
;
dc
.
command
=
DecoderCommand
::
NONE
;
...
@@ -218,7 +218,7 @@ decoder_seek_time(Decoder &decoder)
...
@@ -218,7 +218,7 @@ decoder_seek_time(Decoder &decoder)
decoder
.
seeking
=
true
;
decoder
.
seeking
=
true
;
return
SongTime
::
FromS
(
dc
.
seek_where
)
;
return
dc
.
seek_time
;
}
}
uint64_t
uint64_t
...
@@ -236,7 +236,7 @@ decoder_seek_where_frame(Decoder &decoder)
...
@@ -236,7 +236,7 @@ decoder_seek_where_frame(Decoder &decoder)
decoder
.
seeking
=
true
;
decoder
.
seeking
=
true
;
return
uint64_t
(
dc
.
seek_where
*
dc
.
in_audio_format
.
sample_rate
);
return
dc
.
seek_time
.
ToScale
<
uint64_t
>
(
dc
.
in_audio_format
.
sample_rate
);
}
}
void
decoder_seek_error
(
Decoder
&
decoder
)
void
decoder_seek_error
(
Decoder
&
decoder
)
...
...
src/decoder/DecoderControl.cxx
View file @
ba6ba7d4
...
@@ -105,16 +105,15 @@ DecoderControl::Stop()
...
@@ -105,16 +105,15 @@ DecoderControl::Stop()
}
}
bool
bool
DecoderControl
::
Seek
(
double
where
)
DecoderControl
::
Seek
(
SongTime
t
)
{
{
assert
(
state
!=
DecoderState
::
START
);
assert
(
state
!=
DecoderState
::
START
);
assert
(
where
>=
0.0
);
if
(
state
==
DecoderState
::
STOP
||
if
(
state
==
DecoderState
::
STOP
||
state
==
DecoderState
::
ERROR
||
!
seekable
)
state
==
DecoderState
::
ERROR
||
!
seekable
)
return
false
;
return
false
;
seek_
where
=
where
;
seek_
time
=
t
;
seek_error
=
false
;
seek_error
=
false
;
LockSynchronousCommand
(
DecoderCommand
::
SEEK
);
LockSynchronousCommand
(
DecoderCommand
::
SEEK
);
...
...
src/decoder/DecoderControl.hxx
View file @
ba6ba7d4
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "thread/Mutex.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "thread/Cond.hxx"
#include "thread/Thread.hxx"
#include "thread/Thread.hxx"
#include "Chrono.hxx"
#include "util/Error.hxx"
#include "util/Error.hxx"
#include <assert.h>
#include <assert.h>
...
@@ -107,7 +108,7 @@ struct DecoderControl {
...
@@ -107,7 +108,7 @@ struct DecoderControl {
bool
seek_error
;
bool
seek_error
;
bool
seekable
;
bool
seekable
;
double
seek_wher
e
;
SongTime
seek_tim
e
;
/** the format of the song file */
/** the format of the song file */
AudioFormat
in_audio_format
;
AudioFormat
in_audio_format
;
...
@@ -365,7 +366,7 @@ public:
...
@@ -365,7 +366,7 @@ public:
void
Stop
();
void
Stop
();
bool
Seek
(
double
where
);
bool
Seek
(
SongTime
t
);
void
Quit
();
void
Quit
();
...
...
src/decoder/DecoderInternal.hxx
View file @
ba6ba7d4
...
@@ -57,7 +57,7 @@ struct Decoder {
...
@@ -57,7 +57,7 @@ struct Decoder {
bool
initial_seek_running
;
bool
initial_seek_running
;
/**
/**
* This flag is set by decoder_seek_
wher
e(), and checked by
* This flag is set by decoder_seek_
tim
e(), and checked by
* decoder_command_finished(). It is used to clean up after
* decoder_command_finished(). It is used to clean up after
* seeking.
* seeking.
*/
*/
...
...
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