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
d7137586
Commit
d7137586
authored
Jan 17, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Audio{Format,Parser}: use shortcuts such as "dsd64" in log messages
parent
cd0c06ba
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
2 deletions
+39
-2
NEWS
NEWS
+1
-0
user.xml
doc/user.xml
+5
-1
AudioFormat.cxx
src/AudioFormat.cxx
+11
-0
AudioParser.cxx
src/AudioParser.cxx
+20
-0
TestAudioFormat.cxx
test/TestAudioFormat.cxx
+2
-1
No files found.
NEWS
View file @
d7137586
ver 0.20.3 (not yet released)
ver 0.20.3 (not yet released)
* protocol
* protocol
- "playlistadd" creates new playlist if it does not exist, as documented
- "playlistadd" creates new playlist if it does not exist, as documented
* use shortcuts such as "dsd64" in log messages
ver 0.20.2 (2017/01/15)
ver 0.20.2 (2017/01/15)
* input
* input
...
...
doc/user.xml
View file @
d7137586
...
@@ -598,7 +598,11 @@ systemctl start mpd.socket</programlisting>
...
@@ -598,7 +598,11 @@ systemctl start mpd.socket</programlisting>
<varname>
32
</varname>
(signed 32 bit integer
<varname>
32
</varname>
(signed 32 bit integer
samples),
<varname>
f
</varname>
(32 bit floating
samples),
<varname>
f
</varname>
(32 bit floating
point, -1.0 to 1.0), "
<varname>
dsd
</varname>
" means
point, -1.0 to 1.0), "
<varname>
dsd
</varname>
" means
DSD (Direct Stream Digital).
DSD (Direct Stream Digital). For DSD, there are
special cases such as "
<varname>
dsd64
</varname>
",
which allows you to omit the sample rate
(e.g.
<parameter>
dsd512:2
</parameter>
for stereo
DSD512, i.e. 22.5792 MHz).
</para>
</para>
<para>
<para>
The sample rate is special for DSD:
The sample rate is special for DSD:
...
...
src/AudioFormat.cxx
View file @
d7137586
...
@@ -45,6 +45,17 @@ StringBuffer<24>
...
@@ -45,6 +45,17 @@ StringBuffer<24>
ToString
(
const
AudioFormat
af
)
ToString
(
const
AudioFormat
af
)
{
{
StringBuffer
<
24
>
buffer
;
StringBuffer
<
24
>
buffer
;
if
(
af
.
format
==
SampleFormat
::
DSD
&&
af
.
sample_rate
>
0
&&
af
.
sample_rate
%
44100
==
0
)
{
/* use shortcuts such as "dsd64" which implies the
sample rate */
snprintf
(
buffer
.
data
(),
buffer
.
capacity
(),
"dsd%u:%u"
,
af
.
sample_rate
*
8
/
44100
,
af
.
channels
);
return
buffer
;
}
snprintf
(
buffer
.
data
(),
buffer
.
capacity
(),
"%u:%s:%u"
,
snprintf
(
buffer
.
data
(),
buffer
.
capacity
(),
"%u:%s:%u"
,
af
.
sample_rate
,
sample_format_to_string
(
af
.
format
),
af
.
sample_rate
,
sample_format_to_string
(
af
.
format
),
af
.
channels
);
af
.
channels
);
...
...
src/AudioParser.cxx
View file @
d7137586
...
@@ -137,6 +137,26 @@ ParseAudioFormat(const char *src, bool mask)
...
@@ -137,6 +137,26 @@ ParseAudioFormat(const char *src, bool mask)
AudioFormat
dest
;
AudioFormat
dest
;
dest
.
Clear
();
dest
.
Clear
();
if
(
strncmp
(
src
,
"dsd"
,
3
)
==
0
)
{
/* allow format specifications such as "dsd64" which
implies the sample rate */
char
*
endptr
;
auto
dsd
=
strtoul
(
src
+
3
,
&
endptr
,
10
);
if
(
endptr
>
src
+
3
&&
*
endptr
==
':'
&&
dsd
>=
32
&&
dsd
<=
4096
&&
dsd
%
2
==
0
)
{
dest
.
sample_rate
=
dsd
*
44100
/
8
;
dest
.
format
=
SampleFormat
::
DSD
;
src
=
endptr
+
1
;
dest
.
channels
=
ParseChannelCount
(
src
,
mask
,
&
src
);
if
(
*
src
!=
0
)
throw
FormatRuntimeError
(
"Extra data after channel count: %s"
,
src
);
return
dest
;
}
}
/* parse sample rate */
/* parse sample rate */
dest
.
sample_rate
=
ParseSampleRate
(
src
,
mask
,
&
src
);
dest
.
sample_rate
=
ParseSampleRate
(
src
,
mask
,
&
src
);
...
...
test/TestAudioFormat.cxx
View file @
d7137586
...
@@ -67,7 +67,8 @@ static constexpr AudioFormatStringTest af_string_tests[] = {
...
@@ -67,7 +67,8 @@ static constexpr AudioFormatStringTest af_string_tests[] = {
{
AudioFormat
(
44100
,
SampleFormat
::
S16
,
2
),
"44100:16:2"
},
{
AudioFormat
(
44100
,
SampleFormat
::
S16
,
2
),
"44100:16:2"
},
{
AudioFormat
(
48000
,
SampleFormat
::
S24_P32
,
6
),
"48000:24:6"
},
{
AudioFormat
(
48000
,
SampleFormat
::
S24_P32
,
6
),
"48000:24:6"
},
{
AudioFormat
(
192000
,
SampleFormat
::
FLOAT
,
2
),
"192000:f:2"
},
{
AudioFormat
(
192000
,
SampleFormat
::
FLOAT
,
2
),
"192000:f:2"
},
{
AudioFormat
(
352800
,
SampleFormat
::
DSD
,
2
),
"352800:dsd:2"
},
{
AudioFormat
(
352801
,
SampleFormat
::
DSD
,
2
),
"352801:dsd:2"
},
{
AudioFormat
(
352800
,
SampleFormat
::
DSD
,
2
),
"dsd64:2"
},
};
};
static
constexpr
AudioFormatStringTest
af_mask_tests
[]
=
{
static
constexpr
AudioFormatStringTest
af_mask_tests
[]
=
{
...
...
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