diff options
Diffstat (limited to '')
-rw-r--r-- | src/output/ao_plugin.c | 5 | ||||
-rw-r--r-- | src/output/httpd_internal.h | 2 | ||||
-rw-r--r-- | src/output/httpd_output_plugin.c | 2 | ||||
-rw-r--r-- | src/output/jack_output_plugin.c | 14 | ||||
-rw-r--r-- | src/output/mvp_plugin.c | 2 | ||||
-rw-r--r-- | src/output/oss_plugin.c | 23 | ||||
-rw-r--r-- | src/output_control.c | 1 | ||||
-rw-r--r-- | src/output_thread.c | 5 |
8 files changed, 43 insertions, 11 deletions
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index 21d60eb58..71e06bad9 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -26,6 +26,9 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "ao" +/* An ao_sample_format, with all fields set to zero: */ +static const ao_sample_format OUR_AO_FORMAT_INITIALIZER; + static unsigned ao_output_ref; struct ao_data { @@ -167,7 +170,7 @@ static bool ao_output_open(void *data, struct audio_format *audio_format, GError **error) { - ao_sample_format format; + ao_sample_format format = OUR_AO_FORMAT_INITIALIZER; struct ao_data *ad = (struct ao_data *)data; switch (audio_format->format) { diff --git a/src/output/httpd_internal.h b/src/output/httpd_internal.h index d9c764bfd..67396b667 100644 --- a/src/output/httpd_internal.h +++ b/src/output/httpd_internal.h @@ -111,7 +111,7 @@ struct httpd_output { char buffer[32768]; /** - * The maximum and current number of clients connected + * The maximum and current number of clients connected * at the same time. */ guint clients_max, clients_cnt; diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c index bcc27f884..7fde676c5 100644 --- a/src/output/httpd_output_plugin.c +++ b/src/output/httpd_output_plugin.c @@ -36,6 +36,7 @@ #include <errno.h> #ifdef HAVE_LIBWRAP +#include <sys/socket.h> /* needed for AF_UNIX */ #include <tcpd.h> #endif @@ -123,6 +124,7 @@ httpd_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, /* initialize metadata */ httpd->metadata = NULL; + httpd->unflushed_input = 0; /* initialize encoder */ diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c index 8ea5cb2fd..4df84fd23 100644 --- a/src/output/jack_output_plugin.c +++ b/src/output/jack_output_plugin.c @@ -40,7 +40,7 @@ enum { MAX_PORTS = 16, }; -static const size_t sample_size = sizeof(jack_default_audio_sample_t); +static const size_t jack_sample_size = sizeof(jack_default_audio_sample_t); struct jack_data { /** @@ -103,9 +103,9 @@ mpd_jack_available(const struct jack_data *jd) min = current; } - assert(min % sample_size == 0); + assert(min % jack_sample_size == 0); - return min / sample_size; + return min / jack_sample_size; } static int @@ -123,7 +123,7 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) const jack_nframes_t available = mpd_jack_available(jd); for (unsigned i = 0; i < jd->audio_format.channels; ++i) jack_ringbuffer_read_advance(jd->ringbuffer[i], - available * sample_size); + available * jack_sample_size); /* generate silence while MPD is paused */ @@ -144,7 +144,7 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) for (unsigned i = 0; i < jd->audio_format.channels; ++i) { out = jack_port_get_buffer(jd->ports[i], nframes); jack_ringbuffer_read(jd->ringbuffer[i], - (char *)out, available * sample_size); + (char *)out, available * jack_sample_size); for (jack_nframes_t f = available; f < nframes; ++f) /* ringbuffer underrun, fill with silence */ @@ -675,7 +675,7 @@ mpd_jack_play(void *data, const void *chunk, size_t size, GError **error_r) space = space1; } - if (space >= frame_size) + if (space >= jack_sample_size) break; /* XXX do something more intelligent to @@ -683,7 +683,7 @@ mpd_jack_play(void *data, const void *chunk, size_t size, GError **error_r) g_usleep(1000); } - space /= sample_size; + space /= jack_sample_size; if (space < size) size = space; diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c index 64fc77016..be4c8dbc0 100644 --- a/src/output/mvp_plugin.c +++ b/src/output/mvp_plugin.c @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* +/* * Media MVP audio output based on code from MVPMC project: * http://mvpmc.sourceforge.net/ */ diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c index bd3ccb774..d7df594d3 100644 --- a/src/output/oss_plugin.c +++ b/src/output/oss_plugin.c @@ -41,6 +41,15 @@ # include <sys/soundcard.h> #endif /* !(defined(__OpenBSD__) || defined(__NetBSD__) */ +/* We got bug reports from FreeBSD users who said that the two 24 bit + formats generate white noise on FreeBSD, but 32 bit works. This is + a workaround until we know what exactly is expected by the kernel + audio drivers. */ +#ifndef __linux__ +#undef AFMT_S24_PACKED +#undef AFMT_S24_NE +#endif + struct oss_data { int fd; const char *device; @@ -347,7 +356,7 @@ oss_setup_sample_rate(int fd, struct audio_format *audio_format, case SUCCESS: if (!audio_valid_sample_rate(sample_rate)) break; - + audio_format->sample_rate = sample_rate; return true; @@ -461,6 +470,12 @@ oss_setup_sample_format(int fd, struct audio_format *audio_format, break; audio_format->format = mpd_format; + +#ifdef AFMT_S24_PACKED + if (oss_format == AFMT_S24_PACKED) + audio_format->reverse_endian = + G_BYTE_ORDER != G_LITTLE_ENDIAN; +#endif return true; case ERROR: @@ -502,6 +517,12 @@ oss_setup_sample_format(int fd, struct audio_format *audio_format, break; audio_format->format = mpd_format; + +#ifdef AFMT_S24_PACKED + if (oss_format == AFMT_S24_PACKED) + audio_format->reverse_endian = + G_BYTE_ORDER != G_LITTLE_ENDIAN; +#endif return true; case ERROR: diff --git a/src/output_control.c b/src/output_control.c index d4bfc241c..8efe08f05 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -139,6 +139,7 @@ audio_output_open(struct audio_output *ao, { bool open; + assert(audio_format_valid(audio_format)); assert(mp != NULL); if (ao->fail_timer != NULL) { diff --git a/src/output_thread.c b/src/output_thread.c index 7d47baf46..21096eb04 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -96,6 +96,8 @@ ao_filter_open(struct audio_output *ao, struct audio_format *audio_format, GError **error_r) { + assert(audio_format_valid(audio_format)); + /* the replay_gain filter cannot fail here */ if (ao->replay_gain_filter != NULL) filter_open(ao->replay_gain_filter, audio_format, error_r); @@ -137,6 +139,7 @@ ao_open(struct audio_output *ao) assert(!ao->open); assert(ao->pipe != NULL); assert(ao->chunk == NULL); + assert(audio_format_valid(&ao->in_audio_format)); if (ao->fail_timer != NULL) { /* this can only happen when this @@ -165,6 +168,8 @@ ao_open(struct audio_output *ao) return; } + assert(audio_format_valid(filter_audio_format)); + ao->out_audio_format = *filter_audio_format; audio_format_mask_apply(&ao->out_audio_format, &ao->config_audio_format); |