From: Jaska Uimonen Date: Wed, 7 Nov 2012 12:57:55 +0000 (+0200) Subject: murphy support: setting the media.role property of pulseaudio streams X-Git-Tag: submit/2.0alpha/20121127.195601~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9760cbfa917853c9708e76671e7fedf22d0c7dc4;p=profile%2Fivi%2Favsystem.git murphy support: setting the media.role property of pulseaudio streams --- diff --git a/avsys-audio-pasimple.c b/avsys-audio-pasimple.c index 4f762c4..07918d9 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 @@ -83,6 +83,10 @@ int avsys_audio_pasimple_open_device(const int mode, const unsigned int format, int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT; int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT; +#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); @@ -119,6 +123,45 @@ 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, handle->gain_setting.vol_type); + +#ifdef MURPHY_SUPPORT + switch (handle->gain_setting.vol_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: + case AVSYS_AUDIO_VOLUME_TYPE_MEDIA_HL: + 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, "phone"); @@ -134,6 +177,7 @@ int avsys_audio_pasimple_open_device(const int mode, const unsigned int format, pa_proplist_sets(proplist, PA_PROP_MEDIA_POLICY, "auto"); } } +#endif handle->handle_route = policy;