diff options
author | Max Kellermann <max@duempel.org> | 2012-03-21 19:37:33 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-03-22 00:42:12 +0100 |
commit | b99ecb4dc96f45c0e0ca4b47b82efea57a21f016 (patch) | |
tree | c3cf9e67fa24bfb8f0f82010c05fa1f5aead67aa /src | |
parent | 208a96b211e433a7064bdaa40b31f6a61bb60419 (diff) | |
download | mpd-b99ecb4dc96f45c0e0ca4b47b82efea57a21f016.tar.gz mpd-b99ecb4dc96f45c0e0ca4b47b82efea57a21f016.tar.xz mpd-b99ecb4dc96f45c0e0ca4b47b82efea57a21f016.zip |
audio_format: remove the packed S24 format
For simplicity, the MPD core should not have to deal with packing. It
is rarely used, and those plugins that need it should use the
pcm_export library instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_format.c | 3 | ||||
-rw-r--r-- | src/audio_format.h | 9 | ||||
-rw-r--r-- | src/audio_parser.c | 8 | ||||
-rw-r--r-- | src/decoder/flac_pcm.c | 1 | ||||
-rw-r--r-- | src/encoder/wave_encoder.c | 5 | ||||
-rw-r--r-- | src/output/alsa_output_plugin.c | 1 | ||||
-rw-r--r-- | src/output/oss_output_plugin.c | 1 | ||||
-rw-r--r-- | src/output/roar_output_plugin.c | 4 | ||||
-rw-r--r-- | src/output/winmm_output_plugin.c | 1 | ||||
-rw-r--r-- | src/pcm_convert.c | 48 | ||||
-rw-r--r-- | src/pcm_convert.h | 3 | ||||
-rw-r--r-- | src/pcm_format.c | 72 | ||||
-rw-r--r-- | src/pcm_mix.c | 2 | ||||
-rw-r--r-- | src/pcm_volume.c | 1 |
14 files changed, 4 insertions, 155 deletions
diff --git a/src/audio_format.c b/src/audio_format.c index 5a12a299c..73b11096a 100644 --- a/src/audio_format.c +++ b/src/audio_format.c @@ -63,9 +63,6 @@ sample_format_to_string(enum sample_format format) case SAMPLE_FORMAT_S16: return "16"; - case SAMPLE_FORMAT_S24: - return "24_3"; - case SAMPLE_FORMAT_S24_P32: return "24"; diff --git a/src/audio_format.h b/src/audio_format.h index 7170b9756..43d624243 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -32,11 +32,6 @@ enum sample_format { SAMPLE_FORMAT_S16, /** - * Signed 24 bit integer samples, without padding. - */ - SAMPLE_FORMAT_S24, - - /** * Signed 24 bit integer samples, packed in 32 bit integers * (the most significant byte is filled with the sign bit). */ @@ -175,7 +170,6 @@ audio_valid_sample_format(enum sample_format format) switch (format) { case SAMPLE_FORMAT_S8: case SAMPLE_FORMAT_S16: - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_S24_P32: case SAMPLE_FORMAT_S32: case SAMPLE_FORMAT_FLOAT: @@ -248,9 +242,6 @@ sample_format_size(enum sample_format format) case SAMPLE_FORMAT_S16: return 2; - case SAMPLE_FORMAT_S24: - return 3; - case SAMPLE_FORMAT_S24_P32: case SAMPLE_FORMAT_S32: case SAMPLE_FORMAT_FLOAT: diff --git a/src/audio_parser.c b/src/audio_parser.c index d2d8dc950..d5a3eb97e 100644 --- a/src/audio_parser.c +++ b/src/audio_parser.c @@ -116,11 +116,11 @@ parse_sample_format(const char *src, bool mask, break; case 24: - if (memcmp(endptr, "_3", 2) == 0) { - sample_format = SAMPLE_FORMAT_S24; + if (memcmp(endptr, "_3", 2) == 0) + /* for backwards compatibility */ endptr += 2; - } else - sample_format = SAMPLE_FORMAT_S24_P32; + + sample_format = SAMPLE_FORMAT_S24_P32; break; case 32: diff --git a/src/decoder/flac_pcm.c b/src/decoder/flac_pcm.c index 480fd6393..173213f9e 100644 --- a/src/decoder/flac_pcm.c +++ b/src/decoder/flac_pcm.c @@ -101,7 +101,6 @@ flac_convert(void *dest, position, end); break; - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_FLOAT: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: diff --git a/src/encoder/wave_encoder.c b/src/encoder/wave_encoder.c index 67c3ce085..9eeb4d513 100644 --- a/src/encoder/wave_encoder.c +++ b/src/encoder/wave_encoder.c @@ -122,11 +122,6 @@ wave_encoder_open(struct encoder *_encoder, encoder->bits = 16; break; - case SAMPLE_FORMAT_S24: - audio_format->format = SAMPLE_FORMAT_S24_P32; - encoder->bits = 24; - break; - case SAMPLE_FORMAT_S24_P32: encoder->bits = 24; break; diff --git a/src/output/alsa_output_plugin.c b/src/output/alsa_output_plugin.c index d7c8d74df..4825bce40 100644 --- a/src/output/alsa_output_plugin.c +++ b/src/output/alsa_output_plugin.c @@ -211,7 +211,6 @@ get_bitformat(enum sample_format sample_format) case SAMPLE_FORMAT_UNDEFINED: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: - case SAMPLE_FORMAT_S24: return SND_PCM_FORMAT_UNKNOWN; case SAMPLE_FORMAT_S8: diff --git a/src/output/oss_output_plugin.c b/src/output/oss_output_plugin.c index 4a0ea2470..0724ed4c2 100644 --- a/src/output/oss_output_plugin.c +++ b/src/output/oss_output_plugin.c @@ -434,7 +434,6 @@ sample_format_to_oss(enum sample_format format) case SAMPLE_FORMAT_FLOAT: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: - case SAMPLE_FORMAT_S24: return AFMT_QUERY; case SAMPLE_FORMAT_S8: diff --git a/src/output/roar_output_plugin.c b/src/output/roar_output_plugin.c index 7566834f7..1c2c48321 100644 --- a/src/output/roar_output_plugin.c +++ b/src/output/roar_output_plugin.c @@ -167,10 +167,6 @@ roar_use_audio_format(struct roar_audio_info *info, info->bits = 16; break; - case SAMPLE_FORMAT_S24: - info->bits = 24; - break; - case SAMPLE_FORMAT_S24_P32: info->bits = 32; audio_format->format = SAMPLE_FORMAT_S32; diff --git a/src/output/winmm_output_plugin.c b/src/output/winmm_output_plugin.c index ed0f7f2d4..4d95834b9 100644 --- a/src/output/winmm_output_plugin.c +++ b/src/output/winmm_output_plugin.c @@ -161,7 +161,6 @@ winmm_output_open(struct audio_output *ao, struct audio_format *audio_format, case SAMPLE_FORMAT_S16: break; - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_S24_P32: case SAMPLE_FORMAT_S32: case SAMPLE_FORMAT_UNDEFINED: diff --git a/src/pcm_convert.c b/src/pcm_convert.c index fbdfe5e91..03172b613 100644 --- a/src/pcm_convert.c +++ b/src/pcm_convert.c @@ -42,7 +42,6 @@ void pcm_convert_init(struct pcm_convert_state *state) pcm_dither_24_init(&state->dither); pcm_buffer_init(&state->format_buffer); - pcm_buffer_init(&state->pack_buffer); pcm_buffer_init(&state->channels_buffer); } @@ -52,7 +51,6 @@ void pcm_convert_deinit(struct pcm_convert_state *state) pcm_resample_deinit(&state->resample); pcm_buffer_deinit(&state->format_buffer); - pcm_buffer_deinit(&state->pack_buffer); pcm_buffer_deinit(&state->channels_buffer); } @@ -75,7 +73,6 @@ pcm_convert_channels(struct pcm_buffer *buffer, enum sample_format format, switch (format) { case SAMPLE_FORMAT_UNDEFINED: case SAMPLE_FORMAT_S8: - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_FLOAT: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: @@ -215,45 +212,6 @@ pcm_convert_24(struct pcm_convert_state *state, return buf; } -/** - * Convert to 24 bit packed samples (aka S24_3LE / S24_3BE). - */ -static const void * -pcm_convert_24_packed(struct pcm_convert_state *state, - const struct audio_format *src_format, - const void *src_buffer, size_t src_size, - const struct audio_format *dest_format, - size_t *dest_size_r, - GError **error_r) -{ - assert(dest_format->format == SAMPLE_FORMAT_S24); - - /* use the normal 24 bit conversion first */ - - struct audio_format audio_format; - audio_format_init(&audio_format, dest_format->sample_rate, - SAMPLE_FORMAT_S24_P32, dest_format->channels); - - const int32_t *buffer; - size_t buffer_size; - - buffer = pcm_convert_24(state, src_format, src_buffer, src_size, - &audio_format, &buffer_size, error_r); - if (buffer == NULL) - return NULL; - - /* now convert to packed 24 bit */ - - unsigned num_samples = buffer_size / 4; - size_t dest_size = num_samples * 3; - - uint8_t *dest = pcm_buffer_get(&state->pack_buffer, dest_size); - pcm_pack_24(dest, buffer, buffer + num_samples); - - *dest_size_r = dest_size; - return dest; -} - static const int32_t * pcm_convert_32(struct pcm_convert_state *state, const struct audio_format *src_format, @@ -395,12 +353,6 @@ pcm_convert(struct pcm_convert_state *state, dest_format, dest_size_r, error_r); - case SAMPLE_FORMAT_S24: - return pcm_convert_24_packed(state, - src_format, src, src_size, - dest_format, dest_size_r, - error_r); - case SAMPLE_FORMAT_S24_P32: return pcm_convert_24(state, src_format, src, src_size, diff --git a/src/pcm_convert.h b/src/pcm_convert.h index 2e69013ef..be11a6e41 100644 --- a/src/pcm_convert.h +++ b/src/pcm_convert.h @@ -42,9 +42,6 @@ struct pcm_convert_state { /** the buffer for converting the sample format */ struct pcm_buffer format_buffer; - /** the buffer for converting to/from packed samples */ - struct pcm_buffer pack_buffer; - /** the buffer for converting the channel count */ struct pcm_buffer channels_buffer; }; diff --git a/src/pcm_format.c b/src/pcm_format.c index f6d6011d6..06fc94472 100644 --- a/src/pcm_format.c +++ b/src/pcm_format.c @@ -69,33 +69,6 @@ pcm_allocate_8_to_16(struct pcm_buffer *buffer, return dest; } -static int32_t * -pcm_allocate_24_to_24p32(struct pcm_buffer *buffer, const uint8_t *src, - size_t src_size, size_t *dest_size_r) -{ - int32_t *dest; - *dest_size_r = src_size / 3 * sizeof(*dest); - dest = pcm_buffer_get(buffer, *dest_size_r); - pcm_unpack_24(dest, src, pcm_end_pointer(src, src_size)); - return dest; -} - -static int16_t * -pcm_allocate_24_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither, - const uint8_t *src, size_t src_size, size_t *dest_size_r) -{ - /* convert to S24_P32 first */ - size_t tmp_size; - int32_t *tmp = pcm_allocate_24_to_24p32(buffer, src, src_size, - &tmp_size); - - /* convert to 16 bit in-place */ - int16_t *dest = (int16_t *)tmp; - *dest_size_r = tmp_size / sizeof(*tmp) * sizeof(*dest); - pcm_convert_24_to_16(dither, dest, tmp, pcm_end_pointer(tmp, tmp_size)); - return dest; -} - static int16_t * pcm_allocate_24p32_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither, const int32_t *src, size_t src_size, @@ -159,10 +132,6 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither, *dest_size_r = src_size; return src; - case SAMPLE_FORMAT_S24: - return pcm_allocate_24_to_16(buffer, dither, - src, src_size, dest_size_r); - case SAMPLE_FORMAT_S24_P32: return pcm_allocate_24p32_to_16(buffer, dither, src, src_size, dest_size_r); @@ -279,10 +248,6 @@ pcm_convert_to_24(struct pcm_buffer *buffer, return pcm_allocate_16_to_24(buffer, src, src_size, dest_size_r); - case SAMPLE_FORMAT_S24: - return pcm_allocate_24_to_24p32(buffer, src, src_size, - dest_size_r); - case SAMPLE_FORMAT_S24_P32: *dest_size_r = src_size; return src; @@ -346,20 +311,6 @@ pcm_allocate_16_to_32(struct pcm_buffer *buffer, } static int32_t * -pcm_allocate_24_to_32(struct pcm_buffer *buffer, - const uint8_t *src, - size_t src_size, size_t *dest_size_r) -{ - /* convert to S24_P32 first */ - int32_t *dest = pcm_allocate_24_to_24p32(buffer, src, src_size, - dest_size_r); - - /* convert to 32 bit in-place */ - pcm_convert_24_to_32(dest, dest, pcm_end_pointer(dest, *dest_size_r)); - return dest; -} - -static int32_t * pcm_allocate_24p32_to_32(struct pcm_buffer *buffer, const int32_t *src, size_t src_size, size_t *dest_size_r) @@ -405,10 +356,6 @@ pcm_convert_to_32(struct pcm_buffer *buffer, return pcm_allocate_16_to_32(buffer, src, src_size, dest_size_r); - case SAMPLE_FORMAT_S24: - return pcm_allocate_24_to_32(buffer, src, src_size, - dest_size_r); - case SAMPLE_FORMAT_S24_P32: return pcm_allocate_24p32_to_32(buffer, src, src_size, dest_size_r); @@ -487,21 +434,6 @@ pcm_allocate_16_to_float(struct pcm_buffer *buffer, } static float * -pcm_allocate_24_to_float(struct pcm_buffer *buffer, - const uint8_t *src, - size_t src_size, size_t *dest_size_r) -{ - /* convert to S24_P32 first */ - int32_t *tmp = pcm_allocate_24_to_24p32(buffer, src, src_size, - dest_size_r); - - /* convert to float in-place */ - float *dest = (float *)tmp; - pcm_convert_24_to_float(dest, tmp, pcm_end_pointer(tmp, *dest_size_r)); - return dest; -} - -static float * pcm_allocate_24p32_to_float(struct pcm_buffer *buffer, const int32_t *src, size_t src_size, size_t *dest_size_r) @@ -542,10 +474,6 @@ pcm_convert_to_float(struct pcm_buffer *buffer, return pcm_allocate_16_to_float(buffer, src, src_size, dest_size_r); - case SAMPLE_FORMAT_S24: - return pcm_allocate_24_to_float(buffer, - src, src_size, dest_size_r); - case SAMPLE_FORMAT_S24_P32: return pcm_allocate_24p32_to_float(buffer, src, src_size, dest_size_r); diff --git a/src/pcm_mix.c b/src/pcm_mix.c index 45cc8fe9d..5119f5921 100644 --- a/src/pcm_mix.c +++ b/src/pcm_mix.c @@ -119,7 +119,6 @@ pcm_add_vol(void *buffer1, const void *buffer2, size_t size, { switch (format) { case SAMPLE_FORMAT_UNDEFINED: - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: /* not implemented */ @@ -230,7 +229,6 @@ pcm_add(void *buffer1, const void *buffer2, size_t size, { switch (format) { case SAMPLE_FORMAT_UNDEFINED: - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: /* not implemented */ diff --git a/src/pcm_volume.c b/src/pcm_volume.c index 42beeb9bd..a694d99e9 100644 --- a/src/pcm_volume.c +++ b/src/pcm_volume.c @@ -158,7 +158,6 @@ pcm_volume(void *buffer, size_t length, const void *end = pcm_end_pointer(buffer, length); switch (format) { case SAMPLE_FORMAT_UNDEFINED: - case SAMPLE_FORMAT_S24: case SAMPLE_FORMAT_DSD: case SAMPLE_FORMAT_DSD_OVER_USB: /* not implemented */ |