From ebfdd37451cea0151de74005d83db5ac31fcaf77 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 27 Mar 2012 00:03:44 +0200 Subject: pcm_export: support DSD to DSD-over-USB conversion Prepare for removing SAMPLE_FORMAT_DSD_OVER_USB. --- src/pcm_export.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src/pcm_export.h') diff --git a/src/pcm_export.h b/src/pcm_export.h index 7ce35c096..c132c7169 100644 --- a/src/pcm_export.h +++ b/src/pcm_export.h @@ -34,6 +34,14 @@ struct audio_format; * representation which are not supported by the pcm_convert library. */ 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. * @@ -48,6 +56,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? */ @@ -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 -- cgit v1.2.3