[resourcepolicy-plugin] Handle released by manager properly.

Signal resourcesReleasedByManager is different from signal
handleResourcesLost and needs to be handled separately.
Signal handleResourcesLost means some other client has acquired the
resources, thus the resources are lost from us, but if the other client
frees the resources, we will automatically get the resources back.
With resourcesReleasedByManager we lose the resources, and resource
manager releases them as well (same as if client would call release()),
so only way to re-acquire resources in latter case is calling acquire()
again.

This distinction is useful for example in cases where user is listening
to music with headphones connected and removes the headphones, then the
music player shouldn't continue playback until user requests so. But if
user is listening to music when phone call is received, it is convenient
to resume the playback automatically after the call.

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[resourcepolicy-plugin] Implement missing resources released.

Emit resourcesReleased signal when receiving corresponding signal from
libresource-qt.

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[resourcepolicy-plugin] Implement availability changed.

Availability changed is information whether resources the client is
interested in are available (no higher priority resource classes have
acquired the resources).

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[qsoundeffect] Play samples only when resources are available.

Since sound effects are something short and mixed with other audio, do
not acquire resources explicitly. Follow the resources availability
information to determine when it is ok to play the sound effects.

When client has registered itself to resource manager, client's streams
are classified properly. If no higher priority client has acquired the
resources, isAvailable() is true, and sound effects can be played. We
do not explicitly acquire the resources, since then other clients with
the same resource class would lose the resources, thus not possible to
have second client play music with QMediaPlayer class while our client
would just want to play simple sound effects.

Fix for 7460823b3b24424715ab0944a92c66b96c9e3897
[qaudiooutput] Close output before destroying resource policy.

Fix for 2b03c9b97a935aab91368c85a7b00584b78bf88d
[resourcepolicy-plugin] Check for isDestroyed() in destructor.

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[qgstreamerplayercontrol] Add resource release timer when pausing or stopping media.

If media is paused, stopped, or end of media, if state hasn't changed to
playing state, release the resources. The idea with the timer is that if
for example media player is playing one song which ends, there won't be
release()/acquire() unnecessarily if next song is immediately set as
media and started playing.
[qaudiooutput] Improvements to resource handling.

Fix for 2b03c9b97a935aab91368c85a7b00584b78bf88d
[qaudiooutput] Add release timer for resources.
[resourcepolicy-plugin] Add mechanism to change used resource class.

Check for environment for special variable, and if the variable has
proper data, use that as the resource class. Can be set with for example
qputenv("NEMO_RESOURCE_CLASS_OVERRIDE", "game");

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[resourcepolicy-plugin] Release only once when no client acquires.

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[resourcepolicy-plugin] Emit resourcesReleased on release

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6
[resourcepolicy-plugin] Only release when last client releases

Fix for cdeefb3657b98cdea45c7e735bbedc6e7b3ea8d6