resampler: Clean up ffmpeg resampler buffering

buf in struct ffmpeg_data is reset() initially and freed, but never
actually used

when a new block is allocated ffmpeg_data->buf[c].length is used
(which is always 0) to compute the new block size

so, drop buf

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
modules: Make use of new function pa_modargs_get_sample_rate()

by using pa_modargs_get_sample_rate() we avoid inconsistant validity
checking of the sample rate in various places

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
module-sine: Add rate argument

useful for testing resampling

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
module-remap-sink: Add resample_method argument

the main intent is to make testing different sample rate resampling
implementations easier; so far there is only global control via
resample-method (command line argument and /etc/pulse/daemon.conf)

module-remap-*'s only purpose is resampling (comprising format conversion,
channel remapping, sample rate adjustment), it can easily be introduced
into any audio pipeline

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
module-remap-source: Add resample_method argument

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
bonjour-publish: Return ports in network byteorder

For DNS-SD (Bonjour) discovery, all ports should be set in network
byteorder instead of host byteorder. Without this, all ports on
little-endian systems (intel) are incorrect.

Documentation:
https://developer.apple.com/library/mac/documentation/networking/Reference/DNSServiceDiscovery_CRef/Reference/reference.html#//apple_ref/c/func/DNSServiceRegister
card: Move pa_card_add_profile() implementation to a more logical place

The old place was in the middle of pa_card_new_data functions, which
made no sense.
alsa: Disable timer-scheduling for PCMs with the BATCH flag

PCM Devices which have the BATCH flag set update the PCM pointer only with
period size granularity. Using timer based scheduling does not have any
advantage in this mode. For one devices which have that flag set usually update
the position pointer in software after getting the period interrupt. So
disabling the period interrupt is not possible for this kind of devices.
Furthermore writing to or reading from the buffer slice for the current period
is not possible since the position inside the buffer is not known. On the other
hand the tsched algorithm seems to get easily confused for this kind of
hardware, which results in garbled audio output. This typically means that timer
based scheduling needs to be manually disabled on systems with such devices.
Auto disabling tsched in this case allows these systems to run with the default
configuration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
core-util: Check that we actually have regexec before we use it

Thanks to Pierre Ossman for reporting the bug and providing an initial
fix on which this patch is based.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=69708
alsa: Log some output if we disable tsched for BATCH devices
modargs: Fix pa_modargs_get_sample_rate() if no "rate" is present in the modargs

see http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-December/019471.html

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: "poljar (Damir Jelić)" <poljarinho@gmail.com>
modargs: Do not modify alternate_rate in pa_modargs_get_alternate_sample_rate() on failure

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
bootstrap.sh: use /usr/bin/env to find bash

bootstrap.sh uses some non-POSIX features of bash, so we can't use
/bin/sh.  Unlike /bin/sh, bash can be installed anywhere in the path, so
we should use /usr/bin/env to find it.

This helps systems that have bash in /usr/local/bin, for example.
core-util: set_scheduler: check for RLIMIT_RTTIME

set_scheduler() assumes that if sys/resource.h was found then we will
find RLIMIT_RTTIME there, but this is a non-POSIX extension on Linux.

Change the check to ensure that RLIMIT_RTTIME is actually defined.
Linux indeed defines this as a macro, and POSIX specifies that the other
RLIMIT_ constants must be macros, so having this as an #ifdef seems
correct.
bluetooth: Fix profile priority comparison

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=72414
Add pa_sample_format_valid()

I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
the sample format value.
Add pa_sample_rate_valid()

I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
sample rate values.
Add pa_channels_valid()

I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
channel count values.
doc: Fix reference to pa_threaded_mainloop

Generating docs for file mainloop-api.h...
/home/pmeerw/src/pa-missing/src/pulse/mainloop-api.h:118: warning: Found unknown command `\pa_threaded_mainloop'

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
doc: Refer to seek parameter of pa_stream_write() in description of pa_stream_flush()

pa_stream_write() has no delta parameter, but a seek parameter

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>