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
96eb0119
Commit
96eb0119
authored
Apr 12, 2008
by
Max Kellermann
Committed by
Eric Wong
Apr 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use unsigned integers and size_t in the flac plugin
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7324
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
14529af7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
_flac_common.h
src/inputPlugins/_flac_common.h
+2
-2
flac_plugin.c
src/inputPlugins/flac_plugin.c
+7
-2
No files found.
src/inputPlugins/_flac_common.h
View file @
96eb0119
...
@@ -144,9 +144,9 @@ typedef size_t flac_read_status_size_t;
...
@@ -144,9 +144,9 @@ typedef size_t flac_read_status_size_t;
typedef
struct
{
typedef
struct
{
unsigned
char
chunk
[
FLAC_CHUNK_SIZE
];
unsigned
char
chunk
[
FLAC_CHUNK_SIZE
];
in
t
chunk_length
;
size_
t
chunk_length
;
float
time
;
float
time
;
int
bitRate
;
unsigned
int
bitRate
;
FLAC__uint64
position
;
FLAC__uint64
position
;
OutputBuffer
*
cb
;
OutputBuffer
*
cb
;
DecoderControl
*
dc
;
DecoderControl
*
dc
;
...
...
src/inputPlugins/flac_plugin.c
View file @
96eb0119
...
@@ -216,15 +216,20 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
...
@@ -216,15 +216,20 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
FLAC__uint16
u16
;
FLAC__uint16
u16
;
unsigned
char
*
uc
;
unsigned
char
*
uc
;
unsigned
int
c_samp
,
c_chan
;
unsigned
int
c_samp
,
c_chan
;
int
i
;
unsigned
int
i
;
float
timeChange
;
float
timeChange
;
FLAC__uint64
newPosition
=
0
;
FLAC__uint64
newPosition
=
0
;
assert
(
data
->
dc
->
audioFormat
.
bits
>
0
);
timeChange
=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
timeChange
=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
data
->
time
+=
timeChange
;
data
->
time
+=
timeChange
;
flac_get_decode_position
(
dec
,
&
newPosition
);
flac_get_decode_position
(
dec
,
&
newPosition
);
if
(
data
->
position
)
{
if
(
data
->
position
)
{
assert
(
newPosition
>=
data
->
position
);
assert
(
timeChange
>=
0
);
data
->
bitRate
=
data
->
bitRate
=
((
newPosition
-
data
->
position
)
*
8
.
0
/
timeChange
)
((
newPosition
-
data
->
position
)
*
8
.
0
/
timeChange
)
/
1000
+
0
.
5
;
/
1000
+
0
.
5
;
...
@@ -236,7 +241,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
...
@@ -236,7 +241,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
c_chan
++
)
{
c_chan
++
)
{
u16
=
buf
[
c_chan
][
c_samp
];
u16
=
buf
[
c_chan
][
c_samp
];
uc
=
(
unsigned
char
*
)
&
u16
;
uc
=
(
unsigned
char
*
)
&
u16
;
for
(
i
=
0
;
i
<
(
data
->
dc
->
audioFormat
.
bits
/
8
);
i
++
)
{
for
(
i
=
0
;
i
<
(
unsigned
)(
data
->
dc
->
audioFormat
.
bits
/
8
);
i
++
)
{
if
(
data
->
chunk_length
>=
FLAC_CHUNK_SIZE
)
{
if
(
data
->
chunk_length
>=
FLAC_CHUNK_SIZE
)
{
if
(
flacSendChunk
(
data
)
<
0
)
{
if
(
flacSendChunk
(
data
)
<
0
)
{
return
return
...
...
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