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
9d3a85d4
Commit
9d3a85d4
authored
Aug 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MusicChunk: use SignedSongTime for the time stamp
parent
147d301f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
10 deletions
+12
-10
MusicChunk.cxx
src/MusicChunk.cxx
+3
-3
MusicChunk.hxx
src/MusicChunk.hxx
+4
-2
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+2
-2
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+2
-2
No files found.
src/MusicChunk.cxx
View file @
9d3a85d4
...
...
@@ -41,17 +41,17 @@ MusicChunk::CheckFormat(const AudioFormat other_format) const
WritableBuffer
<
void
>
MusicChunk
::
Write
(
const
AudioFormat
af
,
float
data_time
,
uint16_t
_bit_rate
)
SongTime
data_time
,
uint16_t
_bit_rate
)
{
assert
(
CheckFormat
(
af
));
assert
(
length
==
0
||
audio_format
.
IsValid
());
if
(
length
==
0
)
{
/* if the chunk is empty, nobody has set bitRate and
time
s
yet */
time yet */
bit_rate
=
_bit_rate
;
time
s
=
data_time
;
time
=
data_time
;
}
const
size_t
frame_size
=
af
.
GetFrameSize
();
...
...
src/MusicChunk.hxx
View file @
9d3a85d4
...
...
@@ -20,6 +20,7 @@
#ifndef MPD_MUSIC_CHUNK_HXX
#define MPD_MUSIC_CHUNK_HXX
#include "Chrono.hxx"
#include "ReplayGainInfo.hxx"
#include "util/WritableBuffer.hxx"
...
...
@@ -62,7 +63,7 @@ struct MusicChunk {
uint16_t
bit_rate
;
/** the time stamp within the song */
float
times
;
SignedSongTime
time
;
/**
* An optional tag associated with this chunk (and the
...
...
@@ -128,7 +129,8 @@ struct MusicChunk {
* @return a writable buffer, or nullptr if the chunk is full
*/
WritableBuffer
<
void
>
Write
(
AudioFormat
af
,
float
data_time
,
uint16_t
bit_rate
);
SongTime
data_time
,
uint16_t
bit_rate
);
/**
* Increases the length of the chunk after the caller has written to
...
...
src/PlayerThread.cxx
View file @
9d3a85d4
...
...
@@ -499,7 +499,7 @@ Player::SendSilence()
partial frames */
unsigned
num_frames
=
sizeof
(
chunk
->
data
)
/
frame_size
;
chunk
->
time
s
=
-
1.0
;
/* undefined time stamp */
chunk
->
time
=
SignedSongTime
::
Negative
()
;
/* undefined time stamp */
chunk
->
length
=
num_frames
*
frame_size
;
memset
(
chunk
->
data
,
0
,
chunk
->
length
);
...
...
src/decoder/DecoderAPI.cxx
View file @
9d3a85d4
...
...
@@ -512,8 +512,8 @@ decoder_data(Decoder &decoder,
const
auto
dest
=
chunk
->
Write
(
dc
.
out_audio_format
,
decoder
.
timestamp
-
dc
.
song
->
GetStartTime
()
.
ToDoubleS
()
,
SongTime
::
FromS
(
decoder
.
timestamp
)
-
dc
.
song
->
GetStartTime
(),
kbit_rate
);
if
(
dest
.
IsNull
())
{
/* the chunk is full, flush it */
...
...
src/output/MultipleOutputs.cxx
View file @
9d3a85d4
...
...
@@ -341,10 +341,10 @@ MultipleOutputs::Check()
this chunk */
return
pipe
->
GetSize
();
if
(
chunk
->
length
>
0
&&
chunk
->
times
>=
0.0
)
if
(
chunk
->
length
>
0
&&
!
chunk
->
time
.
IsNegative
()
)
/* only update elapsed_time if the chunk
provides a defined value */
elapsed_time
=
SignedSongTime
::
FromS
(
chunk
->
times
)
;
elapsed_time
=
chunk
->
time
;
is_tail
=
chunk
->
next
==
nullptr
;
if
(
is_tail
)
...
...
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