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
b9d456a0
Commit
b9d456a0
authored
Nov 03, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_api: no CamelCase
Renamed variables.
parent
b54348a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
34 deletions
+32
-34
decoder_api.c
src/decoder_api.c
+32
-34
No files found.
src/decoder_api.c
View file @
b9d456a0
...
...
@@ -91,12 +91,12 @@ void decoder_seek_error(struct decoder * decoder)
}
size_t
decoder_read
(
struct
decoder
*
decoder
,
struct
input_stream
*
i
nStream
,
struct
input_stream
*
i
s
,
void
*
buffer
,
size_t
length
)
{
size_t
nbytes
;
assert
(
i
nStream
!=
NULL
);
assert
(
i
s
!=
NULL
);
assert
(
buffer
!=
NULL
);
while
(
true
)
{
...
...
@@ -107,8 +107,8 @@ size_t decoder_read(struct decoder *decoder,
dc
.
command
!=
DECODE_COMMAND_NONE
)
return
0
;
nbytes
=
input_stream_read
(
i
nStream
,
buffer
,
length
);
if
(
nbytes
>
0
||
input_stream_eof
(
i
nStream
))
nbytes
=
input_stream_read
(
i
s
,
buffer
,
length
);
if
(
nbytes
>
0
||
input_stream_eof
(
i
s
))
return
nbytes
;
/* sleep for a fraction of a second! */
...
...
@@ -122,14 +122,13 @@ size_t decoder_read(struct decoder *decoder,
* one.
*/
static
enum
decoder_command
need_chunks
(
struct
input_stream
*
i
nStream
)
need_chunks
(
struct
input_stream
*
i
s
)
{
if
(
dc
.
command
==
DECODE_COMMAND_STOP
||
dc
.
command
==
DECODE_COMMAND_SEEK
)
return
dc
.
command
;
if
(
!
inStream
||
input_stream_buffer
(
inStream
)
<=
0
)
{
if
(
is
==
NULL
||
input_stream_buffer
(
is
)
<=
0
)
{
notify_wait
(
&
dc
.
notify
);
notify_signal
(
&
pc
.
notify
);
}
...
...
@@ -139,50 +138,49 @@ need_chunks(struct input_stream *inStream)
enum
decoder_command
decoder_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
i
nStream
,
void
*
dataIn
,
size_t
dataInLen
,
struct
input_stream
*
i
s
,
void
*
_data
,
size_t
length
,
float
data_time
,
uint16_t
bitRate
,
ReplayGainInfo
*
replayGainI
nfo
)
ReplayGainInfo
*
replay_gain_i
nfo
)
{
static
char
*
conv_buffer
;
static
size_t
conv_buffer_size
;
size_t
nbytes
;
char
*
data
;
size_t
datalen
;
static
char
*
convBuffer
;
static
size_t
convBufferLen
;
if
(
audio_format_equals
(
&
dc
.
in_audio_format
,
&
dc
.
out_audio_format
))
{
data
=
dataIn
;
datalen
=
dataInLen
;
data
=
_data
;
}
else
{
datalen
=
pcm_convert_size
(
&
dc
.
in_audio_format
,
dataInLen
,
&
dc
.
out_audio_format
);
if
(
datalen
>
convBufferLen
)
{
if
(
conv
B
uffer
!=
NULL
)
free
(
conv
B
uffer
);
conv
Buffer
=
xmalloc
(
datalen
);
conv
BufferLen
=
datalen
;
length
=
pcm_convert_size
(
&
dc
.
in_audio_format
,
length
,
&
dc
.
out_audio_format
);
if
(
length
>
conv_buffer_size
)
{
if
(
conv
_b
uffer
!=
NULL
)
free
(
conv
_b
uffer
);
conv
_buffer
=
xmalloc
(
length
);
conv
_buffer_size
=
length
;
}
data
=
convBuffer
;
datalen
=
pcm_convert
(
&
dc
.
in_audio_format
,
dataIn
,
dataInLen
,
&
dc
.
out_audio_format
,
data
,
&
decoder
->
conv_state
);
data
=
conv_buffer
;
length
=
pcm_convert
(
&
dc
.
in_audio_format
,
_data
,
length
,
&
dc
.
out_audio_format
,
data
,
&
decoder
->
conv_state
);
}
if
(
replay
GainI
nfo
!=
NULL
&&
(
replayGainState
!=
REPLAYGAIN_OFF
))
doReplayGain
(
replay
GainInfo
,
data
,
datalen
,
if
(
replay
_gain_i
nfo
!=
NULL
&&
(
replayGainState
!=
REPLAYGAIN_OFF
))
doReplayGain
(
replay
_gain_info
,
data
,
length
,
&
dc
.
out_audio_format
);
else
if
(
normalizationEnabled
)
normalizeData
(
data
,
datalen
,
&
dc
.
out_audio_format
);
normalizeData
(
data
,
length
,
&
dc
.
out_audio_format
);
while
(
datalen
>
0
)
{
nbytes
=
music_pipe_append
(
data
,
datalen
,
while
(
length
>
0
)
{
nbytes
=
music_pipe_append
(
data
,
length
,
&
dc
.
out_audio_format
,
data_time
,
bitRate
);
datalen
-=
nbytes
;
length
-=
nbytes
;
data
+=
nbytes
;
if
(
datalen
>
0
)
{
enum
decoder_command
cmd
=
need_chunks
(
i
nStream
);
if
(
length
>
0
)
{
enum
decoder_command
cmd
=
need_chunks
(
i
s
);
if
(
cmd
!=
DECODE_COMMAND_NONE
)
return
cmd
;
}
...
...
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