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
1adca2ab
Commit
1adca2ab
authored
Feb 26, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bitrate reporting to flac
git-svn-id:
https://svn.musicpd.org/mpd/trunk@63
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
9d4bc4ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
flac_decode.c
src/flac_decode.c
+17
-2
No files found.
src/flac_decode.c
View file @
1adca2ab
...
@@ -33,6 +33,8 @@ typedef struct {
...
@@ -33,6 +33,8 @@ typedef struct {
unsigned
char
chunk
[
CHUNK_SIZE
];
unsigned
char
chunk
[
CHUNK_SIZE
];
int
chunk_length
;
int
chunk_length
;
float
time
;
float
time
;
int
bitRate
;
FLAC__uint64
position
;
Buffer
*
cb
;
Buffer
*
cb
;
AudioFormat
*
af
;
AudioFormat
*
af
;
DecoderControl
*
dc
;
DecoderControl
*
dc
;
...
@@ -57,6 +59,8 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
...
@@ -57,6 +59,8 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
data
.
chunk_length
=
0
;
data
.
chunk_length
=
0
;
data
.
time
=
0
;
data
.
time
=
0
;
data
.
position
=
0
;
data
.
bitRate
=
0
;
data
.
cb
=
cb
;
data
.
cb
=
cb
;
data
.
af
=
af
;
data
.
af
=
af
;
data
.
dc
=
dc
;
data
.
dc
=
dc
;
...
@@ -106,6 +110,7 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
...
@@ -106,6 +110,7 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
{
{
data
.
time
=
((
float
)
sampleToSeek
)
/
data
.
time
=
((
float
)
sampleToSeek
)
/
af
->
sampleRate
;
af
->
sampleRate
;
data
.
position
=
0
;
}
}
dc
->
seek
=
0
;
dc
->
seek
=
0
;
}
}
...
@@ -189,7 +194,7 @@ int flacSendChunk(FlacData * data) {
...
@@ -189,7 +194,7 @@ int flacSendChunk(FlacData * data) {
CHUNK_SIZE
);
CHUNK_SIZE
);
data
->
cb
->
chunkSize
[
data
->
cb
->
end
]
=
data
->
chunk_length
;
data
->
cb
->
chunkSize
[
data
->
cb
->
end
]
=
data
->
chunk_length
;
data
->
cb
->
times
[
data
->
cb
->
end
]
=
data
->
time
;
data
->
cb
->
times
[
data
->
cb
->
end
]
=
data
->
time
;
data
->
cb
->
bitRate
[
data
->
cb
->
end
]
=
0
;
data
->
cb
->
bitRate
[
data
->
cb
->
end
]
=
data
->
bitRate
;
data
->
cb
->
end
++
;
data
->
cb
->
end
++
;
if
(
data
->
cb
->
end
>=
buffered_chunks
)
{
if
(
data
->
cb
->
end
>=
buffered_chunks
)
{
...
@@ -207,8 +212,18 @@ FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *dec, const FLA
...
@@ -207,8 +212,18 @@ FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *dec, const FLA
unsigned
char
*
uc
;
unsigned
char
*
uc
;
int
c_samp
,
c_chan
,
d_samp
;
int
c_samp
,
c_chan
,
d_samp
;
int
i
;
int
i
;
float
timeChange
;
FLAC__uint64
newPosition
=
0
;
data
->
time
+=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
timeChange
=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
data
->
time
+=
timeChange
;
FLAC__file_decoder_get_decode_position
(
dec
,
&
newPosition
);
if
(
data
->
position
)
{
data
->
bitRate
=
((
newPosition
-
data
->
position
)
*
8
.
0
/
timeChange
)
/
1024
+
0
.
5
;
}
data
->
position
=
newPosition
;
for
(
c_samp
=
d_samp
=
0
;
c_samp
<
frame
->
header
.
blocksize
;
c_samp
++
)
{
for
(
c_samp
=
d_samp
=
0
;
c_samp
<
frame
->
header
.
blocksize
;
c_samp
++
)
{
for
(
c_chan
=
0
;
c_chan
<
frame
->
header
.
channels
;
for
(
c_chan
=
0
;
c_chan
<
frame
->
header
.
channels
;
...
...
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