aboutsummaryrefslogtreecommitdiff
path: root/src/pcm_export.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-03-27 00:03:44 +0200
committerMax Kellermann <max@duempel.org>2012-03-27 01:17:11 +0200
commitebfdd37451cea0151de74005d83db5ac31fcaf77 (patch)
treee87c20dc2951cdb617d78201d14e0b65476d2b2c /src/pcm_export.h
parentf6d6110aaaf6ba3e252323c2bf6360ea9782dff2 (diff)
pcm_export: support DSD to DSD-over-USB conversion
Prepare for removing SAMPLE_FORMAT_DSD_OVER_USB.
Diffstat (limited to 'src/pcm_export.h')
-rw-r--r--src/pcm_export.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/pcm_export.h b/src/pcm_export.h
index 7ce35c09..c132c716 100644
--- a/src/pcm_export.h
+++ b/src/pcm_export.h
@@ -35,6 +35,14 @@ struct audio_format;
*/
struct pcm_export_state {
/**
+ * The buffer is used to convert DSD samples to the
+ * DSD-over-USB format.
+ *
+ * @see #dsd_usb
+ */
+ struct pcm_buffer dsd_buffer;
+
+ /**
* The buffer is used to pack samples, removing padding.
*
* @see #pack24
@@ -49,6 +57,18 @@ struct pcm_export_state {
struct pcm_buffer reverse_buffer;
/**
+ * The number of channels.
+ */
+ uint8_t channels;
+
+ /**
+ * Convert DSD to DSD-over-USB? Input format must be
+ * SAMPLE_FORMAT_DSD and output format must be
+ * SAMPLE_FORMAT_S24_P32.
+ */
+ bool dsd_usb;
+
+ /**
* Pack 24 bit samples?
*/
bool pack24;
@@ -80,11 +100,13 @@ pcm_export_deinit(struct pcm_export_state *state);
* times to reuse the object, until pcm_export_deinit() is called.
*
* This function cannot fail.
+ *
+ * @param channels the number of channels; ignored unless dsd_usb is set
*/
void
pcm_export_open(struct pcm_export_state *state,
- enum sample_format sample_format,
- bool pack, bool reverse_endian);
+ enum sample_format sample_format, unsigned channels,
+ bool dsd_usb, bool pack, bool reverse_endian);
/**
* Export a PCM buffer.
@@ -99,4 +121,13 @@ const void *
pcm_export(struct pcm_export_state *state, const void *src, size_t src_size,
size_t *dest_size_r);
+/**
+ * Converts the number of consumed bytes from the pcm_export()
+ * destination buffer to the according number of bytes from the
+ * pcm_export() source buffer.
+ */
+G_GNUC_PURE
+size_t
+pcm_export_source_size(const struct pcm_export_state *state, size_t dest_size);
+
#endif