From 9158819765c528b1dfacff22e3d5ca03846dafb9 Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Wed, 7 Nov 2012 14:57:55 +0200 Subject: [PATCH] murphy support: setting the media.role property of pulseaudio streams --- avsys-audio-pasimple.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/avsys-audio-pasimple.c b/avsys-audio-pasimple.c index 7bbe983..bc71eb4 100644 --- a/avsys-audio-pasimple.c +++ b/avsys-audio-pasimple.c @@ -27,7 +27,7 @@ #include "avsys-error.h" #include "avsys-debug.h" -#ifdef MURPHY_SUPPORT +#ifndef MURPHY_SUPPORT #define PA_PROP_MEDIA_POLICY "media.policy" #endif @@ -97,6 +97,10 @@ int avsys_audio_pasimple_open_device(const int mode, const unsigned int format, if(count) p_count = atoi(count); +#ifdef MURPHY_SUPPORT + const char *media_role; +#endif + avsys_info(AVAUDIO, ">>>[%s] mode=%d, format=%d, channel=%d, samplerate=%d\n", __func__, mode, format, channel, samplerate); avsys_assert(handle != NULL); @@ -135,6 +139,44 @@ int avsys_audio_pasimple_open_device(const int mode, const unsigned int format, /* Set policy property */ avsys_info(AVAUDIO, ">>>[%s] policy=[%d], vol_type=[%d]\n", __func__, policy, vol_conf_type); + +#ifdef MURPHY_SUPPORT + switch (vol_conf_type) { + + case AVSYS_AUDIO_VOLUME_TYPE_SYSTEM: + media_role = "system"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_NOTIFICATION: + media_role = "event"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_ALARM: + media_role = "alarm"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_RINGTONE: + media_role = "ringtone"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_MEDIA: + media_role = "music"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_CALL: + media_role = "phone"; + break; + + case AVSYS_AUDIO_VOLUME_TYPE_FIXED: + case AVSYS_AUDIO_VOLUME_TYPE_EXT_SYSTEM_JAVA: + default: + media_role = "music"; + break; + } + + avsys_info(AVAUDIO, ": set media role to '%s'\n", media_role); + pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, media_role); +#else if (policy == AVSYS_AUDIO_HANDLE_ROUTE_HANDSET_ONLY) { avsys_info(AVAUDIO, ": set media plicy to PHONE\n"); pa_proplist_sets(proplist, PA_PROP_MEDIA_POLICY, MEDIA_POLICY_PHONE); @@ -161,6 +203,7 @@ int avsys_audio_pasimple_open_device(const int mode, const unsigned int format, break; } } +#endif handle->handle_route = policy; -- 2.7.4