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
dcaf2998
Commit
dcaf2998
authored
Feb 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/export: add #ifdef ENABLE_DSD
parent
ab2e00bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
PcmExport.cxx
src/pcm/PcmExport.cxx
+15
-1
PcmExport.hxx
src/pcm/PcmExport.hxx
+4
-0
No files found.
src/pcm/PcmExport.cxx
View file @
dcaf2998
...
...
@@ -20,11 +20,14 @@
#include "config.h"
#include "PcmExport.hxx"
#include "Order.hxx"
#include "PcmDop.hxx"
#include "PcmPack.hxx"
#include "util/ByteReverse.hxx"
#include "util/ConstBuffer.hxx"
#ifdef ENABLE_DSD
#include "PcmDop.hxx"
#endif
#include <iterator>
void
...
...
@@ -39,11 +42,16 @@ PcmExport::Open(SampleFormat sample_format, unsigned _channels,
alsa_channel_order
=
_alsa_channel_order
?
sample_format
:
SampleFormat
::
UNDEFINED
;
#ifdef ENABLE_DSD
dop
=
_dop
&&
sample_format
==
SampleFormat
::
DSD
;
if
(
dop
)
/* after the conversion to DoP, the DSD
samples are stuffed inside fake 24 bit samples */
sample_format
=
SampleFormat
::
S24_P32
;
#else
(
void
)
_dop
;
#endif
shift8
=
_shift8
&&
sample_format
==
SampleFormat
::
S24_P32
;
pack24
=
_pack
&&
sample_format
==
SampleFormat
::
S24_P32
;
...
...
@@ -69,12 +77,14 @@ PcmExport::GetFrameSize(const AudioFormat &audio_format) const
/* packed 24 bit samples (3 bytes per sample) */
return
audio_format
.
channels
*
3
;
#ifdef ENABLE_DSD
if
(
dop
)
/* the DSD-over-USB draft says that DSD 1-bit samples
are enclosed within 24 bit samples, and MPD's
representation of 24 bit is padded to 32 bit (4
bytes per sample) */
return
channels
*
4
;
#endif
return
audio_format
.
GetFrameSize
();
}
...
...
@@ -86,10 +96,12 @@ PcmExport::Export(ConstBuffer<void> data)
data
=
ToAlsaChannelOrder
(
order_buffer
,
data
,
alsa_channel_order
,
channels
);
#ifdef ENABLE_DSD
if
(
dop
)
data
=
pcm_dsd_to_dop
(
dop_buffer
,
channels
,
ConstBuffer
<
uint8_t
>::
FromVoid
(
data
))
.
ToVoid
();
#endif
if
(
pack24
)
{
const
auto
src
=
ConstBuffer
<
int32_t
>::
FromVoid
(
data
);
...
...
@@ -134,9 +146,11 @@ PcmExport::CalcSourceSize(size_t size) const
/* 32 bit to 24 bit conversion (4 to 3 bytes) */
size
=
(
size
/
3
)
*
4
;
#ifdef ENABLE_DSD
if
(
dop
)
/* DoP doubles the transport size */
size
/=
2
;
#endif
return
size
;
}
src/pcm/PcmExport.hxx
View file @
dcaf2998
...
...
@@ -40,6 +40,7 @@ struct PcmExport {
*/
PcmBuffer
order_buffer
;
#ifdef ENABLE_DSD
/**
* The buffer is used to convert DSD samples to the
* DoP format.
...
...
@@ -47,6 +48,7 @@ struct PcmExport {
* @see #dop
*/
PcmBuffer
dop_buffer
;
#endif
/**
* The buffer is used to pack samples, removing padding.
...
...
@@ -77,12 +79,14 @@ struct PcmExport {
*/
SampleFormat
alsa_channel_order
;
#ifdef ENABLE_DSD
/**
* Convert DSD to DSD-over-PCM (DoP)? Input format must be
* SampleFormat::DSD and output format must be
* SampleFormat::S24_P32.
*/
bool
dop
;
#endif
/**
* Convert (padded) 24 bit samples to 32 bit by shifting 8
...
...
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