summaryrefslogtreecommitdiff
path: root/src/pcm
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-31 16:12:26 +0200
committerMax Kellermann <max@duempel.org>2014-08-31 16:12:26 +0200
commite5a28bfd8d07fe5ca5dee1bfb55ce414c8f7e9fc (patch)
tree304e2b5bfa829d95d2c756449f010bcc76762eac /src/pcm
parent6e04d66a354c02910ebd849f2233e52de8b6e3c4 (diff)
output/alsa, pcm: rename "DSD over USB" to "DoP"
The standard has been renamed since the early draft that was implemented in MPD.
Diffstat (limited to 'src/pcm')
-rw-r--r--src/pcm/PcmDop.cxx (renamed from src/pcm/PcmDsdUsb.cxx)12
-rw-r--r--src/pcm/PcmDop.hxx (renamed from src/pcm/PcmDsdUsb.hxx)11
-rw-r--r--src/pcm/PcmExport.cxx22
-rw-r--r--src/pcm/PcmExport.hxx14
4 files changed, 29 insertions, 30 deletions
diff --git a/src/pcm/PcmDsdUsb.cxx b/src/pcm/PcmDop.cxx
index 9b854ad07..b2096d9e4 100644
--- a/src/pcm/PcmDsdUsb.cxx
+++ b/src/pcm/PcmDop.cxx
@@ -18,7 +18,7 @@
*/
#include "config.h"
-#include "PcmDsdUsb.hxx"
+#include "PcmDop.hxx"
#include "PcmBuffer.hxx"
#include "AudioFormat.hxx"
#include "util/ConstBuffer.hxx"
@@ -27,20 +27,20 @@
constexpr
static inline uint32_t
-pcm_two_dsd_to_usb_marker1(uint8_t a, uint8_t b)
+pcm_two_dsd_to_dop_marker1(uint8_t a, uint8_t b)
{
return 0xff050000 | (a << 8) | b;
}
constexpr
static inline uint32_t
-pcm_two_dsd_to_usb_marker2(uint8_t a, uint8_t b)
+pcm_two_dsd_to_dop_marker2(uint8_t a, uint8_t b)
{
return 0xfffa0000 | (a << 8) | b;
}
ConstBuffer<uint32_t>
-pcm_dsd_to_usb(PcmBuffer &buffer, unsigned channels,
+pcm_dsd_to_dop(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> _src)
{
assert(audio_valid_channel_count(channels));
@@ -65,7 +65,7 @@ pcm_dsd_to_usb(PcmBuffer &buffer, unsigned channels,
/* each 24 bit sample has 16 DSD sample bits
plus the magic 0x05 marker */
- *dest++ = pcm_two_dsd_to_usb_marker1(src[0], src[channels]);
+ *dest++ = pcm_two_dsd_to_dop_marker1(src[0], src[channels]);
/* seek the source pointer to the next
channel */
@@ -80,7 +80,7 @@ pcm_dsd_to_usb(PcmBuffer &buffer, unsigned channels,
/* each 24 bit sample has 16 DSD sample bits
plus the magic 0xfa marker */
- *dest++ = pcm_two_dsd_to_usb_marker2(src[0], src[channels]);
+ *dest++ = pcm_two_dsd_to_dop_marker2(src[0], src[channels]);
/* seek the source pointer to the next
channel */
diff --git a/src/pcm/PcmDsdUsb.hxx b/src/pcm/PcmDop.hxx
index 5e05c009b..03161c456 100644
--- a/src/pcm/PcmDsdUsb.hxx
+++ b/src/pcm/PcmDop.hxx
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_PCM_DSD_USB_HXX
-#define MPD_PCM_DSD_USB_HXX
+#ifndef MPD_PCM_DOP_HXX
+#define MPD_PCM_DOP_HXX
#include "check.h"
@@ -30,12 +30,11 @@ template<typename T> struct ConstBuffer;
/**
* Pack DSD 1 bit samples into (padded) 24 bit PCM samples for
- * playback over USB, according to the proposed standard by
- * dCS and others:
- * http://www.sonore.us/DoP_openStandard_1v1.pdf
+ * playback over USB, according to the DoP standard:
+ * http://dsd-guide.com/dop-open-standard
*/
ConstBuffer<uint32_t>
-pcm_dsd_to_usb(PcmBuffer &buffer, unsigned channels,
+pcm_dsd_to_dop(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> src);
#endif
diff --git a/src/pcm/PcmExport.cxx b/src/pcm/PcmExport.cxx
index 5f567f3c6..ef099ba71 100644
--- a/src/pcm/PcmExport.cxx
+++ b/src/pcm/PcmExport.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "PcmExport.hxx"
-#include "PcmDsdUsb.hxx"
+#include "PcmDop.hxx"
#include "PcmPack.hxx"
#include "util/ByteReverse.hxx"
#include "util/ConstBuffer.hxx"
@@ -28,15 +28,15 @@
void
PcmExport::Open(SampleFormat sample_format, unsigned _channels,
- bool _dsd_usb, bool _shift8, bool _pack, bool _reverse_endian)
+ bool _dop, bool _shift8, bool _pack, bool _reverse_endian)
{
assert(audio_valid_sample_format(sample_format));
- assert(!_dsd_usb || audio_valid_channel_count(_channels));
+ assert(!_dop || audio_valid_channel_count(_channels));
channels = _channels;
- dsd_usb = _dsd_usb && sample_format == SampleFormat::DSD;
- if (dsd_usb)
- /* after the conversion to DSD-over-USB, the 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;
@@ -64,7 +64,7 @@ PcmExport::GetFrameSize(const AudioFormat &audio_format) const
/* packed 24 bit samples (3 bytes per sample) */
return audio_format.channels * 3;
- if (dsd_usb)
+ 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
@@ -77,8 +77,8 @@ PcmExport::GetFrameSize(const AudioFormat &audio_format) const
ConstBuffer<void>
PcmExport::Export(ConstBuffer<void> data)
{
- if (dsd_usb)
- data = pcm_dsd_to_usb(dsd_buffer, channels,
+ if (dop)
+ data = pcm_dsd_to_dop(dop_buffer, channels,
ConstBuffer<uint8_t>::FromVoid(data))
.ToVoid();
@@ -125,8 +125,8 @@ PcmExport::CalcSourceSize(size_t size) const
/* 32 bit to 24 bit conversion (4 to 3 bytes) */
size = (size / 3) * 4;
- if (dsd_usb)
- /* DSD over USB doubles the transport size */
+ if (dop)
+ /* DoP doubles the transport size */
size /= 2;
return size;
diff --git a/src/pcm/PcmExport.hxx b/src/pcm/PcmExport.hxx
index 8169dad7b..b99a35835 100644
--- a/src/pcm/PcmExport.hxx
+++ b/src/pcm/PcmExport.hxx
@@ -35,11 +35,11 @@ template<typename T> struct ConstBuffer;
struct PcmExport {
/**
* The buffer is used to convert DSD samples to the
- * DSD-over-USB format.
+ * DoP format.
*
- * @see #dsd_usb
+ * @see #dop
*/
- PcmBuffer dsd_buffer;
+ PcmBuffer dop_buffer;
/**
* The buffer is used to pack samples, removing padding.
@@ -61,11 +61,11 @@ struct PcmExport {
uint8_t channels;
/**
- * Convert DSD to DSD-over-USB? Input format must be
+ * Convert DSD to DSD-over-PCM (DoP)? Input format must be
* SampleFormat::DSD and output format must be
* SampleFormat::S24_P32.
*/
- bool dsd_usb;
+ bool dop;
/**
* Convert (padded) 24 bit samples to 32 bit by shifting 8
@@ -93,10 +93,10 @@ struct PcmExport {
*
* This function cannot fail.
*
- * @param channels the number of channels; ignored unless dsd_usb is set
+ * @param channels the number of channels; ignored unless dop is set
*/
void Open(SampleFormat sample_format, unsigned channels,
- bool dsd_usb, bool shift8, bool pack, bool reverse_endian);
+ bool dop, bool shift8, bool pack, bool reverse_endian);
/**
* Calculate the size of one output frame.