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
b6ea410c
Commit
b6ea410c
authored
Nov 04, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wavpack: no CamelCase
Renamed functions and variables.
parent
c1dfa52c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
43 deletions
+45
-43
wavpack_plugin.c
src/decoder/wavpack_plugin.c
+43
-41
decoder_list.c
src/decoder_list.c
+2
-2
No files found.
src/decoder/wavpack_plugin.c
View file @
b6ea410c
...
...
@@ -53,13 +53,14 @@ static struct {
* wavpack.com. Modifications were required because mpd only handles
* max 16 bit samples.
*/
static
void
format_samples_int
(
int
Bps
,
void
*
buffer
,
uint32_t
samcnt
)
static
void
format_samples_int
(
int
bytes_per_sample
,
void
*
buffer
,
uint32_t
samcnt
)
{
int32_t
temp
;
uchar
*
dst
=
(
uchar
*
)
buffer
;
int32_t
*
src
=
(
int32_t
*
)
buffer
;
switch
(
Bps
)
{
switch
(
bytes_per_sample
)
{
case
1
:
while
(
samcnt
--
)
*
dst
++
=
*
src
++
;
...
...
@@ -109,7 +110,7 @@ static void format_samples_int(int Bps, void *buffer, uint32_t samcnt)
/*
* This function converts floating point sample data to 16 bit integer.
*/
static
void
format_samples_float
(
mpd_unused
int
Bps
,
void
*
buffer
,
static
void
format_samples_float
(
mpd_unused
int
bytes_per_sample
,
void
*
buffer
,
uint32_t
samcnt
)
{
int16_t
*
dst
=
(
int16_t
*
)
buffer
;
...
...
@@ -129,13 +130,14 @@ static void wavpack_decode(struct decoder * decoder,
ReplayGainInfo
*
replayGainInfo
)
{
struct
audio_format
audio_format
;
void
(
*
format_samples
)(
int
Bps
,
void
*
buffer
,
uint32_t
samcnt
);
void
(
*
format_samples
)(
int
bytes_per_sample
,
void
*
buffer
,
uint32_t
samcnt
);
char
chunk
[
CHUNK_SIZE
];
float
file_time
;
int
samplesreq
,
samplesgot
;
int
allsamples
;
int
position
,
outsamplesize
;
int
Bps
;
int
bytes_per_sample
;
audio_format
.
sample_rate
=
WavpackGetSampleRate
(
wpc
);
audio_format
.
channels
=
WavpackGetReducedChannels
(
wpc
);
...
...
@@ -155,9 +157,9 @@ static void wavpack_decode(struct decoder * decoder,
ERROR("decoding without wvc\n");
*/
allsamples
=
WavpackGetNumSamples
(
wpc
);
Bps
=
WavpackGetBytesPerSample
(
wpc
);
bytes_per_sample
=
WavpackGetBytesPerSample
(
wpc
);
outsamplesize
=
Bps
;
outsamplesize
=
bytes_per_sample
;
if
(
outsamplesize
>
2
)
outsamplesize
=
2
;
outsamplesize
*=
audio_format
.
channels
;
...
...
@@ -197,7 +199,7 @@ static void wavpack_decode(struct decoder * decoder,
position
+=
samplesgot
;
file_time
=
(
float
)
position
/
audio_format
.
sample_rate
;
format_samples
(
Bps
,
chunk
,
format_samples
(
bytes_per_sample
,
chunk
,
samplesgot
*
audio_format
.
channels
);
decoder_data
(
decoder
,
NULL
,
chunk
,
...
...
@@ -231,45 +233,45 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
static
char
replaygain_album_gain
[]
=
"replaygain_album_gain"
;
static
char
replaygain_track_peak
[]
=
"replaygain_track_peak"
;
static
char
replaygain_album_peak
[]
=
"replaygain_album_peak"
;
ReplayGainInfo
*
replay
GainI
nfo
;
ReplayGainInfo
*
replay
_gain_i
nfo
;
bool
found
=
false
;
char
*
value
;
replay
GainI
nfo
=
newReplayGainInfo
();
replay
_gain_i
nfo
=
newReplayGainInfo
();
value
=
wavpack_tag
(
wpc
,
replaygain_track_gain
);
if
(
value
)
{
replay
GainI
nfo
->
trackGain
=
atof
(
value
);
replay
_gain_i
nfo
->
trackGain
=
atof
(
value
);
free
(
value
);
found
=
true
;
}
value
=
wavpack_tag
(
wpc
,
replaygain_album_gain
);
if
(
value
)
{
replay
GainI
nfo
->
albumGain
=
atof
(
value
);
replay
_gain_i
nfo
->
albumGain
=
atof
(
value
);
free
(
value
);
found
=
true
;
}
value
=
wavpack_tag
(
wpc
,
replaygain_track_peak
);
if
(
value
)
{
replay
GainI
nfo
->
trackPeak
=
atof
(
value
);
replay
_gain_i
nfo
->
trackPeak
=
atof
(
value
);
free
(
value
);
found
=
true
;
}
value
=
wavpack_tag
(
wpc
,
replaygain_album_peak
);
if
(
value
)
{
replay
GainI
nfo
->
albumPeak
=
atof
(
value
);
replay
_gain_i
nfo
->
albumPeak
=
atof
(
value
);
free
(
value
);
found
=
true
;
}
if
(
found
)
return
replay
GainI
nfo
;
return
replay
_gain_i
nfo
;
freeReplayGainInfo
(
replay
GainI
nfo
);
freeReplayGainInfo
(
replay
_gain_i
nfo
);
return
NULL
;
}
...
...
@@ -333,16 +335,16 @@ static struct tag *wavpack_tagdup(const char *fname)
*/
/* This struct is needed for per-stream last_byte storage. */
typedef
struc
t
{
struct
wavpack_inpu
t
{
struct
decoder
*
decoder
;
struct
input_stream
*
is
;
/* Needed for push_back_byte() */
int
last_byte
;
}
InputStreamPlus
;
};
static
int32_t
read_bytes
(
void
*
id
,
void
*
data
,
int32_t
bcount
)
{
InputStreamPlus
*
isp
=
(
InputStreamPlus
*
)
id
;
struct
wavpack_input
*
isp
=
(
struct
wavpack_input
*
)
id
;
uint8_t
*
buf
=
(
uint8_t
*
)
data
;
int32_t
i
=
0
;
...
...
@@ -357,35 +359,35 @@ static int32_t read_bytes(void *id, void *data, int32_t bcount)
static
uint32_t
get_pos
(
void
*
id
)
{
return
((
InputStreamPlus
*
)
id
)
->
is
->
offset
;
return
((
struct
wavpack_input
*
)
id
)
->
is
->
offset
;
}
static
int
set_pos_abs
(
void
*
id
,
uint32_t
pos
)
{
return
input_stream_seek
(((
InputStreamPlus
*
)
id
)
->
is
,
pos
,
SEEK_SET
)
return
input_stream_seek
(((
struct
wavpack_input
*
)
id
)
->
is
,
pos
,
SEEK_SET
)
?
0
:
-
1
;
}
static
int
set_pos_rel
(
void
*
id
,
int32_t
delta
,
int
mode
)
{
return
input_stream_seek
(((
InputStreamPlus
*
)
id
)
->
is
,
delta
,
mode
)
return
input_stream_seek
(((
struct
wavpack_input
*
)
id
)
->
is
,
delta
,
mode
)
?
0
:
-
1
;
}
static
int
push_back_byte
(
void
*
id
,
int
c
)
{
((
InputStreamPlus
*
)
id
)
->
last_byte
=
c
;
((
struct
wavpack_input
*
)
id
)
->
last_byte
=
c
;
return
1
;
}
static
uint32_t
get_length
(
void
*
id
)
{
return
((
InputStreamPlus
*
)
id
)
->
is
->
size
;
return
((
struct
wavpack_input
*
)
id
)
->
is
->
size
;
}
static
int
can_seek
(
void
*
id
)
{
return
((
InputStreamPlus
*
)
id
)
->
is
->
seekable
;
return
((
struct
wavpack_input
*
)
id
)
->
is
->
seekable
;
}
static
WavpackStreamReader
mpd_is_reader
=
{
...
...
@@ -400,7 +402,7 @@ static WavpackStreamReader mpd_is_reader = {
};
static
void
initInputStreamPlus
(
InputStreamPlus
*
isp
,
struct
decoder
*
decoder
,
wavpack_input_init
(
struct
wavpack_input
*
isp
,
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
{
isp
->
decoder
=
decoder
;
...
...
@@ -415,9 +417,9 @@ static bool wavpack_trydecode(struct input_stream *is)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
InputStreamPlus
isp
;
struct
wavpack_input
isp
;
initInputStreamPlus
(
&
isp
,
NULL
,
is
);
wavpack_input_init
(
&
isp
,
NULL
,
is
);
wpc
=
WavpackOpenFileInputEx
(
&
mpd_is_reader
,
&
isp
,
NULL
,
error
,
OPEN_STREAMING
,
0
);
if
(
wpc
==
NULL
)
...
...
@@ -501,14 +503,14 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
WavpackContext
*
wpc
;
struct
input_stream
is_wvc
;
int
open_flags
=
OPEN_2CH_MAX
|
OPEN_NORMALIZE
/*| OPEN_STREAMING*/
;
InputStreamPlus
isp
,
isp_wvc
;
struct
wavpack_input
isp
,
isp_wvc
;
if
(
wavpack_open_wvc
(
decoder
,
&
is_wvc
))
{
initInputStreamPlus
(
&
isp_wvc
,
decoder
,
&
is_wvc
);
wavpack_input_init
(
&
isp_wvc
,
decoder
,
&
is_wvc
);
open_flags
|=
OPEN_WVC
;
}
initInputStreamPlus
(
&
isp
,
decoder
,
is
);
wavpack_input_init
(
&
isp
,
decoder
,
is
);
wpc
=
WavpackOpenFileInputEx
(
&
mpd_is_reader
,
&
isp
,
&
isp_wvc
,
error
,
open_flags
,
15
);
...
...
@@ -535,7 +537,7 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
ReplayGainInfo
*
replay
GainI
nfo
;
ReplayGainInfo
*
replay
_gain_i
nfo
;
wpc
=
WavpackOpenFileInput
(
fname
,
error
,
OPEN_TAGS
|
OPEN_WVC
|
...
...
@@ -545,28 +547,28 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
return
false
;
}
replay
GainI
nfo
=
wavpack_replaygain
(
wpc
);
replay
_gain_i
nfo
=
wavpack_replaygain
(
wpc
);
wavpack_decode
(
decoder
,
wpc
,
1
,
replay
GainI
nfo
);
wavpack_decode
(
decoder
,
wpc
,
1
,
replay
_gain_i
nfo
);
if
(
replay
GainI
nfo
)
freeReplayGainInfo
(
replay
GainI
nfo
);
if
(
replay
_gain_i
nfo
)
freeReplayGainInfo
(
replay
_gain_i
nfo
);
WavpackCloseFile
(
wpc
);
return
true
;
}
static
char
const
*
const
wavpack
S
uffixes
[]
=
{
"wv"
,
NULL
};
static
char
const
*
const
wavpack
MimeT
ypes
[]
=
{
"audio/x-wavpack"
,
NULL
};
static
char
const
*
const
wavpack
_s
uffixes
[]
=
{
"wv"
,
NULL
};
static
char
const
*
const
wavpack
_mime_t
ypes
[]
=
{
"audio/x-wavpack"
,
NULL
};
const
struct
decoder_plugin
wavpack
P
lugin
=
{
const
struct
decoder_plugin
wavpack
_p
lugin
=
{
.
name
=
"wavpack"
,
.
try_decode
=
wavpack_trydecode
,
.
stream_decode
=
wavpack_streamdecode
,
.
file_decode
=
wavpack_filedecode
,
.
tag_dup
=
wavpack_tagdup
,
.
stream_types
=
INPUT_PLUGIN_STREAM_FILE
|
INPUT_PLUGIN_STREAM_URL
,
.
suffixes
=
wavpack
S
uffixes
,
.
mime_types
=
wavpack
MimeT
ypes
.
suffixes
=
wavpack
_s
uffixes
,
.
mime_types
=
wavpack
_mime_t
ypes
};
src/decoder_list.c
View file @
b6ea410c
...
...
@@ -29,7 +29,7 @@ extern const struct decoder_plugin audiofilePlugin;
extern
const
struct
decoder_plugin
mp4_plugin
;
extern
const
struct
decoder_plugin
aacPlugin
;
extern
const
struct
decoder_plugin
mpcPlugin
;
extern
const
struct
decoder_plugin
wavpack
P
lugin
;
extern
const
struct
decoder_plugin
wavpack
_p
lugin
;
extern
const
struct
decoder_plugin
modPlugin
;
extern
const
struct
decoder_plugin
ffmpeg_plugin
;
...
...
@@ -59,7 +59,7 @@ static const struct decoder_plugin *const decoder_plugins[] = {
&
mpcPlugin
,
#endif
#ifdef HAVE_WAVPACK
&
wavpack
P
lugin
,
&
wavpack
_p
lugin
,
#endif
#ifdef HAVE_MIKMOD
&
modPlugin
,
...
...
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