--- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500
@@ -1,19 +1,19 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Nokia Volume Ext Impl
+ *
+ */
#include "xanokiavolumeextitfadaptationmmf.h"
#include "xamediaplayeradaptctxmmf.h"
@@ -28,65 +28,77 @@
* @param XAboolean mute - status of mute value
* @return XAresult ret - Success value
*/
-XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx, XAboolean mute)
-{
+XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx,
+ XAboolean mute)
+ {
XAuint32 volume;
XAresult res = XA_RESULT_SUCCESS;
-
+
DEBUG_API("->XANokiaVolumeExtItfAdapt_SetMute");
- if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
- ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
- ctx->baseObj.ctxId != XARadioAdaptation ) )
- {
+ if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation
+ && ctx->baseObj.ctxId != XAMediaRecorderAdaptation
+ && ctx->baseObj.ctxId != XARadioAdaptation))
+ {
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute");
/* invalid parameter */
- return XA_RESULT_PARAMETER_INVALID;
- }
+ res = XA_RESULT_PARAMETER_INVALID;
+ return res;
+ }
- if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation )
- {
- if(mute)
+ if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation)
{
-
- mmf_volumeitf_get_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
- &volume);
- ((XAMediaPlayerAdaptationMMFCtx*)ctx)->premutevol = volume;
- mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
- 0);
- }
- else
- {
- mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
- ((XAMediaPlayerAdaptationMMFCtx*)ctx)->premutevol);
+ if (mute)
+ {
+
+ res = mmf_volumeitf_get_volume(
+ ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext,
+ &volume);
+ if(res == XA_RESULT_SUCCESS)
+ {
+ ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol = volume;
+ res = mmf_volumeitf_set_volume(
+ ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, 0);
+ }
+ }
+ else
+ {
+ res = mmf_volumeitf_set_volume(
+ ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext,
+ ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol);
+ }
}
- }
- else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation )
- {
- if(mute)
+ else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation)
{
-
- mmf_volumeitf_get_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext,
- &volume);
- ((XAMediaRecorderAdaptationMMFCtx*)ctx)->premutevol = volume;
- mmf_volumeitf_set_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext,
- 0);
+ if (mute)
+ {
+
+ res = mmf_volumeitf_get_volume(
+ ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext,
+ &volume);
+ if(res == XA_RESULT_SUCCESS)
+ {
+ ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol = volume;
+ res = mmf_volumeitf_set_volume(
+ ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext, 0);
+ }
+ }
+ else
+ {
+ res = mmf_volumeitf_set_volume(
+ ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext,
+ ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol);
+ }
}
- else
+ else if (ctx->baseObj.ctxId == XARadioAdaptation)
{
- mmf_volumeitf_set_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext,
- ((XAMediaRecorderAdaptationMMFCtx*)ctx)->premutevol);
- }
- }
- else if ( ctx->baseObj.ctxId == XARadioAdaptation )
- {
- mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);
- res = set_mute(cmmfradiobackendengine_init(), mute);
- }
-
+ mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);
+ res = set_mute(cmmfradiobackendengine_init(), mute);
+ }
+
DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute");
return res;
-}
+ }
/*
* XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(XAAdaptationBaseCtx *ctx, XAboolean enable)
@@ -94,35 +106,36 @@
* @param XAboolean enable - Enable Stereo Position
* @return XAresult - Success value
*/
-XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(XAAdaptationMMFCtx *ctx, XAboolean enable)
-{
+XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(
+ XAAdaptationMMFCtx *ctx, XAboolean enable)
+ {
+ XAresult res = XA_RESULT_SUCCESS;
DEBUG_API("->XANokiaVolumeExtItfAdapt_EnableStereoPosition");
- if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
- ctx->baseObj.ctxId != XAMediaRecorderAdaptation ) )
- {
- DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
- DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition");
+ if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation
+ && ctx->baseObj.ctxId != XAMediaRecorderAdaptation))
+ {
+ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition");
/* invalid parameter */
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
- if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation )
- {
+ if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+ else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+ else if (ctx->baseObj.ctxId == XARadioAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+ DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition");
+ return res;
}
- else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation )
- {
-
- }
- else if ( ctx->baseObj.ctxId == XARadioAdaptation )
- {
- return XA_RESULT_FEATURE_UNSUPPORTED;
- }
-
- DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition");
- return XA_RESULT_SUCCESS;
-}
/*
* XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx, XApermille stereoPosition)
@@ -131,42 +144,46 @@
* @return XAresult - Success value
*/
XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx,
- XApermille stereoPosition)
-{
+ XApermille stereoPosition)
+ {
+ XAresult res = XA_RESULT_SUCCESS;
DEBUG_API("->XANokiaVolumeExtItfAdapt_SetStereoPosition");
-
- if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
- ctx->baseObj.ctxId != XAMediaRecorderAdaptation ) )
- {
- DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
- DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition");
+
+ if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation
+ && ctx->baseObj.ctxId != XAMediaRecorderAdaptation))
+ {
+ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition");
return XA_RESULT_PARAMETER_INVALID;
+ }
+
+ if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+ else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+ else if (ctx->baseObj.ctxId == XARadioAdaptation)
+ {
+ res = XA_RESULT_FEATURE_UNSUPPORTED;
+ }
+
+ DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition");
+ return res;
}
- if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation )
- {
-
- }
- else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation )
+void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx,
+ XAboolean aMute)
{
-
+ XAAdaptEvent event =
+ {
+ XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED, 1, 0
+ };
+ if (ctx)
+ {
+ event.data = &aMute;
+ XAAdaptationBase_SendAdaptEvents(ctx, &event);
+ }
}
- else if ( ctx->baseObj.ctxId == XARadioAdaptation )
- {
- return XA_RESULT_FEATURE_UNSUPPORTED;
- }
- DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition");
- return XA_RESULT_SUCCESS;
-}
-
-void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, XAboolean aMute)
-{
- XAAdaptEvent event = {XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED,1,0};
- if (ctx)
- {
- event.data = &aMute;
- XAAdaptationBase_SendAdaptEvents(ctx, &event );
- }
-}
-