raop: Cosmetic fixes / Match coding style
raop: Add pulsecore/core-utils a pa_str_in_list function
raop: Parse server capabilities on discovery

During the discovery phase, raop servers send theirs capabilities
(supported encryption, audio codec...). These should be passed to the
raop sink via module's arguments.
rtp: New pa_rtsp_options function

Add a function performing a call to the OPTIONS request.
rtp: Allow transport parameters to be ovewritten

In some special cases, tuning transport parameters is required (default:
"RTP/AVP/TCP;unicast;interleaved=0-1;mode=record") ! The RAOP client for
example needs to overwrite them.
rtp: Random seq number at the beginning of the session
raop: Recognize transport protocol type

There are two versions in the RAOP protocol; one uses TCP and the
other uses UDP. Current raop implementation only supports TCP
version.

This patch recognizes the transport protocol type announced from
the server side. It also introduces a flag representing the protocol
type.

Protocol parameters are based on Matrin Blanchard's implementation.
raop: Rename client functions

Client side functions now have `pa_raop_client_` prefix.

This modification is based on Martin Blanchard's work.
raop: Introduce sink_get_latency for latency calculation

Latency calculation will be shared between TCP and UDP protocol
implementations, so move it to an external function.
raop: Move RTSP announce to an external function

Since the RTSP announce logic is shared among both TCP and UDP
implementations, it's better to move it to an external function.
raop: Use server name to construct a sink name

Patch edited by Hajime Fujita.
raop: Add UDP protocol handling

This patch adds an initial UDP protocol support for RAOP.
It is based on Martin Blanchard's work
(http://repo.or.cz/w/pulseaudio-raopUDP.git/shortlog/refs/heads/raop)
which is inspired by Christophe Fergeau's work
(https://github.com/zx2c4/pulseaudio-raop2).

Matrin's modifications were edited by Hajime Fujita, so that it
would support both TCP and UDP protocol in a single module.
raop: Code renaming for protocol specific IDs

Rename the entire code so that protocol-specific identifiers have
`tcp_` and `udp_` prefix.
raop: Add dummy handler for RTSP OPTIONS

The TCP implementation does not handle OPTIONS state but include
the value in the switch so that compiler feels happy
raop: Use two port numbers for timing/control port

Both client (PulseAudio) and server (Airplay device) use timing
port and control port for communication, and generally client and
server have their own port number.

This patch introduces additional port numbers so that PulseAudio
can correctly handle the case where client port and server port
are different.
raop: Honor encryption capability given by a remote device

Some AirPlay device (likely a third-party one) may not support
RSA encryption. In such a case we fall back to no encryption mode.
raop: Resume smoother for correct latency calculation

When a state transits to PA_SINK_RUNNING, the previous state could be
PA_SINK_IDLE. The previous code failed to resume smoother in such a case.
Failure to resume smoother led to calculate wrong latency in sink_get_latency(),
because pa_smoother_get() returned a garbage value.

In fact, it is safe to call pa_smoother_resume() regardless of the current
smoother suspension state. It checks the suspension state and does nothing
if already resumed.

This patch always resumes smoother at PA_SINK_RUNNING, so that
sink_get_latency() caluculates correct (or at least, somewhat reasonable)
latency values.
raop: Set precise wake up timer for rtpoll

Due to timer precision limitation, poll(2) may sleep longer or shorter
than originally specified. Therefore it is not safe to always specify
the fixed sleep interval for poll(2) (pa_rtpoll_set_timer_relative())
when executing some periodic tasks that are sensitive to precise timing.

This patch calculates when the thread should wake up to transmit
the next audio packet, and try to amortize the jitter caused by the
actual poll sleep duration.

This patch eliminates the audio glitch issue in Pioneer VSX-43 (and
possibly in other devices as well).
raop: Set poll timer when entering the RUNNING state

When pausing music, the raop module enters the IDLE state.
If you resume the music right after pausing, the module enters the RUNNING
state but the poll timer is left expired.
This prevents the main thread loop from sending audio packets.

To avoid this situation, set the poll timer again when the module enters
the RUNNING state.
raop: Cleanup pollfd when the RTSP state enters TEARDOWN

It seems that STATE_DISCONNECTED never happens in usual cases,
which left pollfd uncleaned even after the socket fds were closed in
the previous version. This led to PulseAudio hang up when starting music
after the previous connection is torn down.

This patch fixed the issue, thus fixes the hang up issue in such a case.