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
d1a8a448
Commit
d1a8a448
authored
Sep 19, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sndfile: support float and 16 bit samples
Support these PCM formats natively, instead of letting libsndfile convert everything to 32 bit.
parent
5921ffaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
NEWS
NEWS
+2
-0
SndfileDecoderPlugin.cxx
src/decoder/plugins/SndfileDecoderPlugin.cxx
+32
-4
No files found.
NEWS
View file @
d1a8a448
...
...
@@ -50,6 +50,8 @@ ver 0.19 (not yet released)
- dsf: fix noise at end of malformed file
- sndfile: support scanning remote files
- sndfile: support tags "comment", "album", "track", "genre"
- sndfile: native floating point playback
- sndfile: optimized 16 bit playback
- mp4v2: support playback of MP4 files.
* encoder:
- shine: new encoder plugin
...
...
src/decoder/plugins/SndfileDecoderPlugin.cxx
View file @
d1a8a448
...
...
@@ -150,14 +150,41 @@ gcc_pure
static
SampleFormat
sndfile_sample_format
(
const
SF_INFO
&
info
)
{
(
void
)
info
;
return
SampleFormat
::
S32
;
fprintf
(
stderr
,
"SNDFILE format=%d
\n
"
,
info
.
format
&
SF_FORMAT_SUBMASK
);
switch
(
info
.
format
&
SF_FORMAT_SUBMASK
)
{
case
SF_FORMAT_PCM_S8
:
case
SF_FORMAT_PCM_U8
:
case
SF_FORMAT_PCM_16
:
return
SampleFormat
::
S16
;
case
SF_FORMAT_FLOAT
:
case
SF_FORMAT_DOUBLE
:
return
SampleFormat
::
FLOAT
;
default:
return
SampleFormat
::
S32
;
}
}
static
sf_count_t
sndfile_read_frames
(
SNDFILE
*
sf
,
void
*
buffer
,
sf_count_t
n_frames
)
sndfile_read_frames
(
SNDFILE
*
sf
,
SampleFormat
format
,
void
*
buffer
,
sf_count_t
n_frames
)
{
return
sf_readf_int
(
sf
,
(
int
*
)
buffer
,
n_frames
);
switch
(
format
)
{
case
SampleFormat
:
:
S16
:
return
sf_readf_short
(
sf
,
(
short
*
)
buffer
,
n_frames
);
case
SampleFormat
:
:
S32
:
return
sf_readf_int
(
sf
,
(
int
*
)
buffer
,
n_frames
);
case
SampleFormat
:
:
FLOAT
:
return
sf_readf_float
(
sf
,
(
float
*
)
buffer
,
n_frames
);
default:
assert
(
false
);
gcc_unreachable
();
}
}
static
void
...
...
@@ -198,6 +225,7 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
do
{
sf_count_t
num_frames
=
sndfile_read_frames
(
sf
,
audio_format
.
format
,
buffer
,
read_frames
);
if
(
num_frames
<=
0
)
break
;
...
...
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