audio_format: remove SAMPLE_FORMAT_DSD_OVER_USB
DSD-over-USB should not be a MPD core format, because it is not a "natural" format; it is just a temnporary over-the-wire format. This format has been implemented in pcm_export, and does not need to be supported by pcm_convert.
This commit is contained in:
parent
2803ec2e96
commit
a2b5db0003
@ -29,15 +29,6 @@ audio_format_mask_apply(struct audio_format *af,
|
|||||||
assert(audio_format_valid(af));
|
assert(audio_format_valid(af));
|
||||||
assert(audio_format_mask_valid(mask));
|
assert(audio_format_mask_valid(mask));
|
||||||
|
|
||||||
if (af->format == SAMPLE_FORMAT_DSD &&
|
|
||||||
mask->format == SAMPLE_FORMAT_DSD_OVER_USB &&
|
|
||||||
mask->sample_rate == 0)
|
|
||||||
/* each DSD-over-USB sample contains 2 DSD bytes (16
|
|
||||||
DSD bits), which means the sample rate must be
|
|
||||||
halved; this is not the real 1 bit sample rate, but
|
|
||||||
MPD's point of view */
|
|
||||||
af->sample_rate /= 2;
|
|
||||||
|
|
||||||
if (mask->sample_rate != 0)
|
if (mask->sample_rate != 0)
|
||||||
af->sample_rate = mask->sample_rate;
|
af->sample_rate = mask->sample_rate;
|
||||||
|
|
||||||
@ -74,9 +65,6 @@ sample_format_to_string(enum sample_format format)
|
|||||||
|
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
return "dsd";
|
return "dsd";
|
||||||
|
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
return "dsdusb";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unreachable */
|
/* unreachable */
|
||||||
|
@ -50,13 +50,6 @@ enum sample_format {
|
|||||||
* byte (8 samples) per channel.
|
* byte (8 samples) per channel.
|
||||||
*/
|
*/
|
||||||
SAMPLE_FORMAT_DSD,
|
SAMPLE_FORMAT_DSD,
|
||||||
|
|
||||||
/**
|
|
||||||
* DSD packed in 24 bit samples (padded to 32 bit), according
|
|
||||||
* to the dCS suggested standard:
|
|
||||||
* http://www.dcsltd.co.uk/page/assets/DSDoverUSB.pdf
|
|
||||||
*/
|
|
||||||
SAMPLE_FORMAT_DSD_OVER_USB,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned MAX_CHANNELS = 8;
|
static const unsigned MAX_CHANNELS = 8;
|
||||||
@ -174,7 +167,6 @@ audio_valid_sample_format(enum sample_format format)
|
|||||||
case SAMPLE_FORMAT_S32:
|
case SAMPLE_FORMAT_S32:
|
||||||
case SAMPLE_FORMAT_FLOAT:
|
case SAMPLE_FORMAT_FLOAT:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
@ -245,7 +237,6 @@ sample_format_size(enum sample_format format)
|
|||||||
case SAMPLE_FORMAT_S24_P32:
|
case SAMPLE_FORMAT_S24_P32:
|
||||||
case SAMPLE_FORMAT_S32:
|
case SAMPLE_FORMAT_S32:
|
||||||
case SAMPLE_FORMAT_FLOAT:
|
case SAMPLE_FORMAT_FLOAT:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
|
@ -87,12 +87,6 @@ parse_sample_format(const char *src, bool mask,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(src, "dsdusb", 6) == 0) {
|
|
||||||
*sample_format_r = SAMPLE_FORMAT_DSD_OVER_USB;
|
|
||||||
*endptr_r = src + 6;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(src, "dsd", 3) == 0) {
|
if (memcmp(src, "dsd", 3) == 0) {
|
||||||
*sample_format_r = SAMPLE_FORMAT_DSD;
|
*sample_format_r = SAMPLE_FORMAT_DSD;
|
||||||
*endptr_r = src + 3;
|
*endptr_r = src + 3;
|
||||||
|
@ -103,7 +103,6 @@ flac_convert(void *dest,
|
|||||||
|
|
||||||
case SAMPLE_FORMAT_FLOAT:
|
case SAMPLE_FORMAT_FLOAT:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
/* unreachable */
|
/* unreachable */
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -227,7 +227,6 @@ get_bitformat(enum sample_format sample_format)
|
|||||||
switch (sample_format) {
|
switch (sample_format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
return SND_PCM_FORMAT_UNKNOWN;
|
return SND_PCM_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
|
@ -433,7 +433,6 @@ sample_format_to_oss(enum sample_format format)
|
|||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_FLOAT:
|
case SAMPLE_FORMAT_FLOAT:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
return AFMT_QUERY;
|
return AFMT_QUERY;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "pcm_channels.h"
|
#include "pcm_channels.h"
|
||||||
#include "pcm_format.h"
|
#include "pcm_format.h"
|
||||||
#include "pcm_pack.h"
|
#include "pcm_pack.h"
|
||||||
#include "pcm_dsd_usb.h"
|
|
||||||
#include "audio_format.h"
|
#include "audio_format.h"
|
||||||
#include "glib_compat.h"
|
#include "glib_compat.h"
|
||||||
|
|
||||||
@ -76,7 +75,6 @@ pcm_convert_channels(struct pcm_buffer *buffer, enum sample_format format,
|
|||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
case SAMPLE_FORMAT_FLOAT:
|
case SAMPLE_FORMAT_FLOAT:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
g_set_error(error_r, pcm_convert_quark(), 0,
|
g_set_error(error_r, pcm_convert_quark(), 0,
|
||||||
"Channel conversion not implemented for format '%s'",
|
"Channel conversion not implemented for format '%s'",
|
||||||
sample_format_to_string(format));
|
sample_format_to_string(format));
|
||||||
@ -326,40 +324,6 @@ pcm_convert(struct pcm_convert_state *state,
|
|||||||
size_t *dest_size_r,
|
size_t *dest_size_r,
|
||||||
GError **error_r)
|
GError **error_r)
|
||||||
{
|
{
|
||||||
struct audio_format usb_format;
|
|
||||||
|
|
||||||
if (src_format->format == SAMPLE_FORMAT_DSD &&
|
|
||||||
dest_format->format == SAMPLE_FORMAT_DSD_OVER_USB) {
|
|
||||||
size_t u_size;
|
|
||||||
const uint32_t *u = pcm_dsd_to_usb(&state->dsd.buffer,
|
|
||||||
src_format->channels,
|
|
||||||
src, src_size,
|
|
||||||
&u_size);
|
|
||||||
if (u == NULL) {
|
|
||||||
g_set_error_literal(error_r, pcm_convert_quark(), 0,
|
|
||||||
"DSD to USB conversion failed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb_format = *src_format;
|
|
||||||
usb_format.format = SAMPLE_FORMAT_DSD_OVER_USB;
|
|
||||||
|
|
||||||
/* each DSD-over-USB sample contains 2 DSD bytes (16
|
|
||||||
DSD bits), which means the sample rate must be
|
|
||||||
halved; this is not the real 1 bit sample rate, but
|
|
||||||
MPD's point of view */
|
|
||||||
usb_format.sample_rate = usb_format.sample_rate / 2;
|
|
||||||
|
|
||||||
if (audio_format_equals(&usb_format, dest_format)) {
|
|
||||||
*dest_size_r = u_size;
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
|
|
||||||
src_format = &usb_format;
|
|
||||||
src = u;
|
|
||||||
src_size = u_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct audio_format float_format;
|
struct audio_format float_format;
|
||||||
if (src_format->format == SAMPLE_FORMAT_DSD) {
|
if (src_format->format == SAMPLE_FORMAT_DSD) {
|
||||||
size_t f_size;
|
size_t f_size;
|
||||||
|
@ -54,7 +54,7 @@ pcm_export_open(struct pcm_export_state *state,
|
|||||||
sample_format = SAMPLE_FORMAT_S24_P32;
|
sample_format = SAMPLE_FORMAT_S24_P32;
|
||||||
|
|
||||||
state->shift8 = shift8 && sample_format == SAMPLE_FORMAT_S24_P32;
|
state->shift8 = shift8 && sample_format == SAMPLE_FORMAT_S24_P32;
|
||||||
state->pack24 = pack && (sample_format == SAMPLE_FORMAT_S24_P32 || sample_format == SAMPLE_FORMAT_DSD_OVER_USB);
|
state->pack24 = pack && sample_format == SAMPLE_FORMAT_S24_P32;
|
||||||
|
|
||||||
assert(!state->shift8 || !state->pack24);
|
assert(!state->shift8 || !state->pack24);
|
||||||
|
|
||||||
|
@ -121,7 +121,6 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
|
|||||||
switch (src_format) {
|
switch (src_format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
@ -237,7 +236,6 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
|
|||||||
switch (src_format) {
|
switch (src_format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
@ -345,7 +343,6 @@ pcm_convert_to_32(struct pcm_buffer *buffer,
|
|||||||
switch (src_format) {
|
switch (src_format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
@ -463,7 +460,6 @@ pcm_convert_to_float(struct pcm_buffer *buffer,
|
|||||||
switch (src_format) {
|
switch (src_format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAMPLE_FORMAT_S8:
|
case SAMPLE_FORMAT_S8:
|
||||||
|
@ -120,7 +120,6 @@ pcm_add_vol(void *buffer1, const void *buffer2, size_t size,
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -230,7 +229,6 @@ pcm_add(void *buffer1, const void *buffer2, size_t size,
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -159,7 +159,6 @@ pcm_volume(void *buffer, size_t length,
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case SAMPLE_FORMAT_UNDEFINED:
|
case SAMPLE_FORMAT_UNDEFINED:
|
||||||
case SAMPLE_FORMAT_DSD:
|
case SAMPLE_FORMAT_DSD:
|
||||||
case SAMPLE_FORMAT_DSD_OVER_USB:
|
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user