diff -r 6f7ceef7b1d1 -r ebf79c79991a khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 @@ -21,6 +21,37 @@ #include "cmmfbackendengine.h" #include "cmmfradiobackendengine.h" +XAresult XANokiaLinearVolumeItfAdapt_GetVolumeLevel(XAAdaptationMMFCtx *ctx, XAuint32* percentage) +{ + XAresult res = XA_RESULT_SUCCESS; + XAuint32 maxvol; + XAuint32 vol; + DEBUG_API("->XANokiaLinearVolumeItfAdapt_GetVolumeLevel"); + if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && + ctx->baseObj.ctxId != XAMediaRecorderAdaptation && + ctx->baseObj.ctxId != XARadioAdaptation) ) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel"); + /* invalid parameter */ + return XA_RESULT_PARAMETER_INVALID; + } + + if(ctx->baseObj.ctxId == XAMediaPlayerAdaptation) + { + mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, + &maxvol); + mmf_volumeitf_get_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, + &vol); + + *percentage = (vol * MAX_PERCENTAGE_VOLUME)/maxvol; + + } + + DEBUG_API_A1("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel %d", percentage); + return res; +} + /* * XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, * XAuint32 percentage)