main-volume-policy: Introduce module-main-volume-policy

The module allows configuring the main volume and mute policy. The
configuration is read from configuration file main-volume-policy.conf.
If the file doesn't exist, the module does nothing.

There can (potentially, in the future) be many models for managing the
main volume and mute. In this initial version there are two models
implemented: "none" and "by-active-main-volume-context". The model is
configured separately for output and input volume and mute, i.e. there
are four model variables.

The "none" model is the default, and does nothing.

The "by-active-main-volume-context" model involves the "main volume
context" concept, which is provided by the libmain-volume-policy.so
library. Each context has four variables: main_output_volume_control,
main_input_volume_control, main_output_mute_control and
main_input_mute_control. When a context is activated, the system's
main volume and mute controls are bound to the context variables. The
context variables get their values from the configuration file, and
may be bound further to other objects. Which context to activate is
not decided by module-main-volume-policy. That decision needs to come
from outside (for example, from the Murphy module).

An idea for another model would be "by-default-device", which would
bind the main volume and mute to the current default sink and source.

Here's an example of the configuration file syntax:

[General]
output-volume-model = by-active-main-volume-context
input-volume-model = by-active-main-volume-context
output-mute-model = none
input-mute-model = none
main-volume-contexts = x-example-call-main-volume-context x-example-default-main-volume-context

[MainVolumeContext x-example-call-main-volume-context]
description = Call main volume context
main-output-volume-control = bind:AudioGroup:x-example-call-downlink-audio-group
main-input-volume-control = bind:AudioGroup:x-example-call-uplink-audio-group
main-output-mute-control = none
main-input-mute-control = none

[MainVolumeContext x-example-default-main-volume-context]
description = Default main volume context
main-output-volume-control = bind:AudioGroup:x-example-default-output-audio-group
main-input-volume-control = bind:AudioGroup:x-example-default-input-audio-group
main-output-mute-control = none
main-input-mute-control = none
main-volume-policy: (temporary commit) Mock Murphy

This adds a mock policy for choosing the active main volume context.
I used this for testing the module-main-volume-policy functionality.

When there are streams with "phone" role, the active context is
"x-example-call-main-volume-context" and otherwise the active context
is "x-example-default-main-volume-context".
audio-groups: Fix a crash in config parsing

I got a segfault on this line:

    for (i = 0, p = streams; *p; p++) {

If the configuration file doesn't set the "streams" option, streams
will be NULL and dereferencing p will crash.

Fix this by checking if streams is NULL where necessary.
audio-groups: Fix a memory leak in config parsing

"streams = pa_xstrdup(streams)" leaks the original string. The string
copying is not really necessary, so let's just skip that.
audio-groups: Search configuration from the user configuration directory too

Also change "audio_groups.ini" to "audio-groups.conf", because the
latter is more consistent with other configuration file names.
audio-groups: Unref pa_tizen_volume_api after use
audio-groups: Delay audio group control creation

I had a crash when pa_volume_control_new() was called with NULL
description. The configuration parser assumed that the audio group
description is always set before setting the volume control for the
audio group. In my configuration I had no description set at all. This
patch delays volume and mute control creation until the whole
configuration has been read.

This patch also replaces the custom binding handling code with
pa_binding.
audio-groups: Don't assume that stream->rule is set

I had two different crashes related to this, because in my
configuration I try to set the stream matching with
"match-property:media.role = equals:phone", which is unsupported
syntax.
audio-groups: Set module userdata

Not setting it resulted in skipping all module uninitialization code.