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
f02998b1
Commit
f02998b1
authored
Aug 28, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderControl: use std::chrono::duration for start_ms and end_ms
parent
127fe6ec
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
30 deletions
+19
-30
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+5
-15
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+3
-3
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+9
-10
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+1
-1
No files found.
src/PlayerThread.cxx
View file @
f02998b1
...
@@ -296,7 +296,7 @@ Player::StartDecoder(MusicPipe &_pipe)
...
@@ -296,7 +296,7 @@ Player::StartDecoder(MusicPipe &_pipe)
start_time
+=
pc
.
seek_time
;
start_time
+=
pc
.
seek_time
;
dc
.
Start
(
new
DetachedSong
(
*
pc
.
next_song
),
dc
.
Start
(
new
DetachedSong
(
*
pc
.
next_song
),
start_time
.
ToMS
(),
pc
.
next_song
->
GetEndTime
().
ToMS
(),
start_time
,
pc
.
next_song
->
GetEndTime
(),
buffer
,
_pipe
);
buffer
,
_pipe
);
}
}
...
...
src/decoder/DecoderAPI.cxx
View file @
f02998b1
...
@@ -179,7 +179,7 @@ decoder_command_finished(Decoder &decoder)
...
@@ -179,7 +179,7 @@ decoder_command_finished(Decoder &decoder)
assert
(
dc
.
pipe
->
IsEmpty
());
assert
(
dc
.
pipe
->
IsEmpty
());
decoder
.
initial_seek_running
=
false
;
decoder
.
initial_seek_running
=
false
;
decoder
.
timestamp
=
dc
.
start_
ms
/
1000.
;
decoder
.
timestamp
=
dc
.
start_
time
.
ToDoubleS
()
;
dc
.
Unlock
();
dc
.
Unlock
();
return
;
return
;
}
}
...
@@ -212,7 +212,7 @@ decoder_seek_time(Decoder &decoder)
...
@@ -212,7 +212,7 @@ decoder_seek_time(Decoder &decoder)
assert
(
dc
.
pipe
!=
nullptr
);
assert
(
dc
.
pipe
!=
nullptr
);
if
(
decoder
.
initial_seek_running
)
if
(
decoder
.
initial_seek_running
)
return
SongTime
(
dc
.
start_ms
)
;
return
dc
.
start_time
;
assert
(
dc
.
command
==
DecoderCommand
::
SEEK
);
assert
(
dc
.
command
==
DecoderCommand
::
SEEK
);
...
@@ -226,17 +226,7 @@ decoder_seek_where_frame(Decoder &decoder)
...
@@ -226,17 +226,7 @@ decoder_seek_where_frame(Decoder &decoder)
{
{
const
DecoderControl
&
dc
=
decoder
.
dc
;
const
DecoderControl
&
dc
=
decoder
.
dc
;
assert
(
dc
.
pipe
!=
nullptr
);
return
decoder_seek_time
(
decoder
).
ToScale
<
uint64_t
>
(
dc
.
in_audio_format
.
sample_rate
);
if
(
decoder
.
initial_seek_running
)
return
uint64_t
(
dc
.
start_ms
)
*
dc
.
in_audio_format
.
sample_rate
/
1000
;
assert
(
dc
.
command
==
DecoderCommand
::
SEEK
);
decoder
.
seeking
=
true
;
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
)
...
@@ -553,8 +543,8 @@ decoder_data(Decoder &decoder,
...
@@ -553,8 +543,8 @@ decoder_data(Decoder &decoder,
decoder
.
timestamp
+=
(
double
)
nbytes
/
decoder
.
timestamp
+=
(
double
)
nbytes
/
dc
.
out_audio_format
.
GetTimeToSize
();
dc
.
out_audio_format
.
GetTimeToSize
();
if
(
dc
.
end_
ms
>
0
&&
if
(
dc
.
end_
time
.
IsPositive
()
&&
decoder
.
timestamp
>=
dc
.
end_
ms
/
1000.0
)
decoder
.
timestamp
>=
dc
.
end_
time
.
ToDoubleS
()
)
/* the end of this range has been reached:
/* the end of this range has been reached:
stop decoding */
stop decoding */
return
DecoderCommand
::
STOP
;
return
DecoderCommand
::
STOP
;
...
...
src/decoder/DecoderControl.cxx
View file @
f02998b1
...
@@ -70,7 +70,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const
...
@@ -70,7 +70,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const
void
void
DecoderControl
::
Start
(
DetachedSong
*
_song
,
DecoderControl
::
Start
(
DetachedSong
*
_song
,
unsigned
_start_ms
,
unsigned
_end_ms
,
SongTime
_start_time
,
SongTime
_end_time
,
MusicBuffer
&
_buffer
,
MusicPipe
&
_pipe
)
MusicBuffer
&
_buffer
,
MusicPipe
&
_pipe
)
{
{
assert
(
_song
!=
nullptr
);
assert
(
_song
!=
nullptr
);
...
@@ -78,8 +78,8 @@ DecoderControl::Start(DetachedSong *_song,
...
@@ -78,8 +78,8 @@ DecoderControl::Start(DetachedSong *_song,
delete
song
;
delete
song
;
song
=
_song
;
song
=
_song
;
start_
ms
=
_start_ms
;
start_
time
=
_start_time
;
end_
ms
=
_end_ms
;
end_
time
=
_end_time
;
buffer
=
&
_buffer
;
buffer
=
&
_buffer
;
pipe
=
&
_pipe
;
pipe
=
&
_pipe
;
...
...
src/decoder/DecoderControl.hxx
View file @
f02998b1
...
@@ -127,21 +127,20 @@ struct DecoderControl {
...
@@ -127,21 +127,20 @@ struct DecoderControl {
DetachedSong
*
song
;
DetachedSong
*
song
;
/**
/**
* The initial seek position
(in milliseconds), e.g. to the
* The initial seek position
, e.g. to the start of a sub-track
*
start of a sub-track
described by a CUE file.
* described by a CUE file.
*
*
* This attribute is set by Start().
* This attribute is set by Start().
*/
*/
unsigned
start_ms
;
SongTime
start_time
;
/**
/**
* The decoder will stop when it reaches this position (in
* The decoder will stop when it reaches this position. 0
* milliseconds). 0 means don't stop before the end of the
* means don't stop before the end of the file.
* file.
*
*
* This attribute is set by Start().
* This attribute is set by Start().
*/
*/
unsigned
end_ms
;
SongTime
end_time
;
float
total_time
;
float
total_time
;
...
@@ -356,12 +355,12 @@ public:
...
@@ -356,12 +355,12 @@ public:
*
*
* @param song the song to be decoded; the given instance will be
* @param song the song to be decoded; the given instance will be
* owned and freed by the decoder
* owned and freed by the decoder
* @param start_
ms
see #DecoderControl
* @param start_
time
see #DecoderControl
* @param end_
ms
see #DecoderControl
* @param end_
time
see #DecoderControl
* @param pipe the pipe which receives the decoded chunks (owned by
* @param pipe the pipe which receives the decoded chunks (owned by
* the caller)
* the caller)
*/
*/
void
Start
(
DetachedSong
*
song
,
unsigned
start_ms
,
unsigned
end_ms
,
void
Start
(
DetachedSong
*
song
,
SongTime
start_time
,
SongTime
end_time
,
MusicBuffer
&
buffer
,
MusicPipe
&
pipe
);
MusicBuffer
&
buffer
,
MusicPipe
&
pipe
);
void
Stop
();
void
Stop
();
...
...
src/decoder/DecoderThread.cxx
View file @
f02998b1
...
@@ -360,7 +360,7 @@ static void
...
@@ -360,7 +360,7 @@ static void
decoder_run_song
(
DecoderControl
&
dc
,
decoder_run_song
(
DecoderControl
&
dc
,
const
DetachedSong
&
song
,
const
char
*
uri
,
Path
path_fs
)
const
DetachedSong
&
song
,
const
char
*
uri
,
Path
path_fs
)
{
{
Decoder
decoder
(
dc
,
dc
.
start_
ms
>
0
,
Decoder
decoder
(
dc
,
dc
.
start_
time
.
IsPositive
()
,
new
Tag
(
song
.
GetTag
()));
new
Tag
(
song
.
GetTag
()));
int
ret
;
int
ret
;
...
...
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