khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c
changeset 16 43d09473c595
child 20 b67dd1fc57c5
equal deleted inserted replaced
14:80975da52420 16:43d09473c595
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <gst.h>
       
    19 #include <mixer.h>
       
    20 #include "xaadaptationgst.h"
       
    21 #include "xavolumeitfadaptation.h"
       
    22 #include "xamediaplayeradaptctx.h"
       
    23 
       
    24 #include "xaoutputmixadaptctx.h"
       
    25 #include "xamediarecorderadaptctx.h"
       
    26 
       
    27 /*
       
    28  * XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationGstCtx *ctx)
       
    29  */
       
    30 XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationGstCtx *ctx)
       
    31 {
       
    32     DEBUG_API("->XAVolumeItfAdapt_FlushBin");
       
    33     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation ))
       
    34     {
       
    35         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    36         /* invalid parameter */
       
    37         return XA_RESULT_PARAMETER_INVALID;
       
    38     }
       
    39     if (GST_STATE(ctx->bin) != GST_STATE_PLAYING)
       
    40     {
       
    41         gint64 position = 0;
       
    42         GstFormat format = GST_FORMAT_TIME;
       
    43 
       
    44         if (! gst_element_query_position( GST_ELEMENT(ctx->bin), &format, &position  ))
       
    45             {
       
    46                 DEBUG_ERR("Gst: Failed to get position");
       
    47 				return XA_RESULT_INTERNAL_ERROR;
       
    48             }
       
    49         XAAdaptationGst_PrepareAsyncWait(ctx);
       
    50         /* in effect seeks to current position and flushing the buffer, due to
       
    51          * gstreamer implementation actual position might change, if stopped, seek to beginning
       
    52          */
       
    53         if(!gst_element_seek( ctx->bin, ((XAMediaPlayerAdaptationCtx*)ctx)->playrate, GST_FORMAT_TIME,
       
    54                             (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
       
    55                             GST_SEEK_TYPE_SET, position,
       
    56                             GST_SEEK_TYPE_NONE, (gint64)GST_CLOCK_TIME_NONE))
       
    57         {
       
    58             DEBUG_ERR("WARN: gst reports seek not handled");
       
    59         }
       
    60         /* flushed seeks always asynchronous */
       
    61         XAAdaptationGst_StartAsyncWait(ctx);
       
    62         DEBUG_INFO("Bin flushed.");
       
    63         ctx->waitingasyncop = XA_BOOLEAN_FALSE;
       
    64     }
       
    65     DEBUG_API("<-XAVolumeItfAdapt_FlushBin");
       
    66     return XA_RESULT_SUCCESS;
       
    67 }
       
    68 
       
    69 /*
       
    70  * XAresult XAVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId,
       
    71  *                                          XAmillibel level)
       
    72  * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID
       
    73  * XAmillibel level - Requested volume level, in between XA_MILLIBEL_MIN and XA_MILLIBEL_MAX
       
    74  * @return XAresult ret - Success value
       
    75  */
       
    76 XAresult XAVolumeItfAdapt_SetVolumeLevel(XAAdaptationGstCtx *ctx, XAmillibel level)
       
    77 {
       
    78     GstElement *vol=NULL, *audiopp=NULL;
       
    79     gdouble gstVolume = 0;
       
    80     XAmillibel tempVolumeLevel = 0;
       
    81     XAresult res = XA_RESULT_SUCCESS;
       
    82 
       
    83     DEBUG_API_A1("->XAVolumeItfAdapt_SetVolumeLevel (level %d)", level);
       
    84     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
       
    85                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
       
    86                  ctx->baseObj.ctxId != XAOutputMixAdaptation) )
       
    87     {
       
    88         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    89         DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel");
       
    90         /* invalid parameter */
       
    91         return XA_RESULT_PARAMETER_INVALID;
       
    92     }
       
    93 
       
    94     if( level <= MIN_SUPPORT_VOLUME_LEVEL )
       
    95     {
       
    96         tempVolumeLevel = MIN_SUPPORT_VOLUME_LEVEL;
       
    97     }
       
    98     else if( level >= MAX_SUPPORT_VOLUME_LEVEL )
       
    99     {
       
   100         tempVolumeLevel = MAX_SUPPORT_VOLUME_LEVEL;
       
   101     }
       
   102     else
       
   103     {
       
   104         tempVolumeLevel = level;
       
   105     }
       
   106     gstVolume = ( ( (gdouble)(VOLUME_LEVEL_RATIO + tempVolumeLevel)/ VOLUME_LEVEL_RATIO) );
       
   107 
       
   108     if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation )
       
   109     {
       
   110         XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx;
       
   111         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" );
       
   112         if(audiopp)
       
   113         {
       
   114             vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   115         }
       
   116         if(vol)
       
   117         {
       
   118             DEBUG_INFO_A1("Setting gst level to %f",gstVolume);
       
   119             g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL );
       
   120 
       
   121             XAVolumeItfAdapt_FlushBin(ctx);
       
   122         }
       
   123         else
       
   124         {
       
   125             DEBUG_ERR("Could not find gst volume controller element!!");
       
   126         }
       
   127     }
       
   128     else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation )
       
   129     {
       
   130         XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx;
       
   131         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" );
       
   132         if(audiopp)
       
   133         {
       
   134             vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   135         }
       
   136         if(vol)
       
   137         {
       
   138             DEBUG_INFO_A1("Setting gst level to %f",gstVolume);
       
   139             g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL );
       
   140         }
       
   141         else
       
   142         {
       
   143             DEBUG_ERR("Could not find gst volume controller element!!");
       
   144         }
       
   145     }
       
   146     else if (ctx->baseObj.ctxId == XAOutputMixAdaptation )
       
   147     {
       
   148         XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx;
       
   149         guint iterator = 0;
       
   150         for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ )
       
   151         {
       
   152             GstBin* basebin = NULL;
       
   153             XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx;
       
   154             if(!bCtx)
       
   155             {
       
   156                 DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator);
       
   157                 DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel");
       
   158                 return XA_RESULT_INTERNAL_ERROR;
       
   159             }
       
   160 
       
   161             basebin = GST_BIN(bCtx->bin);
       
   162             if(!basebin)
       
   163             {
       
   164                 DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator);
       
   165                 DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel");
       
   166                 return XA_RESULT_INTERNAL_ERROR;
       
   167             }
       
   168 
       
   169             audiopp = gst_bin_get_by_name( basebin, "audiopp" );
       
   170             if(audiopp)
       
   171             {
       
   172                 vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   173             }
       
   174             if(vol)
       
   175             {
       
   176                 DEBUG_INFO_A1("Setting gst level to %f",gstVolume);
       
   177                 g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL );
       
   178 
       
   179                 XAVolumeItfAdapt_FlushBin(bCtx);
       
   180             }
       
   181             else
       
   182             {
       
   183                 DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator);
       
   184             }
       
   185         }
       
   186     }
       
   187     DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel");
       
   188     return res;
       
   189 }
       
   190 
       
   191 /*
       
   192  * XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId,
       
   193                                             XAmillibel *pMaxLevel)
       
   194  * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter
       
   195  * @param AdaptationContextIDS ctx->baseObj.ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type.
       
   196  * XAmillibel *pMaxLevel - Maximum volume level
       
   197  * @return XAresult ret - Success value
       
   198  */
       
   199 XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationGstCtx *ctx, XAmillibel *pMaxLevel)
       
   200 {
       
   201     DEBUG_API("->XAVolumeItfAdapt_GetMaxVolumeLevel");
       
   202 
       
   203     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
       
   204                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
       
   205                  ctx->baseObj.ctxId != XAOutputMixAdaptation) )
       
   206     {
       
   207         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   208         DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel");
       
   209         /* invalid parameter */
       
   210         return XA_RESULT_PARAMETER_INVALID;
       
   211     }
       
   212 
       
   213     *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL;
       
   214 
       
   215     DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel");
       
   216 
       
   217     return XA_RESULT_SUCCESS;
       
   218 }
       
   219 
       
   220 /*
       
   221  * XAresult XAVolumeItfAdapt_SetMute(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, XAboolean mute)
       
   222  * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter
       
   223  * @param AdaptationContextIDS ctx->baseObj.ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type.
       
   224  * @param XAboolean mute - status of mute value
       
   225  * @return XAresult ret - Success value
       
   226  */
       
   227 XAresult XAVolumeItfAdapt_SetMute(XAAdaptationGstCtx *ctx, XAboolean mute)
       
   228 {
       
   229     GstElement *vol=NULL, *audiopp=NULL;
       
   230     gboolean gmute = 0;
       
   231 
       
   232     DEBUG_API("->XAVolumeItfAdapt_SetMute");
       
   233     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
       
   234                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
       
   235                  ctx->baseObj.ctxId != XAOutputMixAdaptation ) )
       
   236     {
       
   237         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   238         DEBUG_API("<-XAVolumeItfAdapt_SetMute");
       
   239         /* invalid parameter */
       
   240         return XA_RESULT_PARAMETER_INVALID;
       
   241     }
       
   242 
       
   243     if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation )
       
   244     {
       
   245         XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx;
       
   246         context->mute = mute;
       
   247         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" );
       
   248         if(audiopp)
       
   249         {
       
   250             vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   251         }
       
   252         if(vol)
       
   253         {
       
   254             if ( mute )
       
   255             {
       
   256                 gmute = 1;
       
   257             }
       
   258             else
       
   259             {
       
   260                 gmute = 0;
       
   261             }
       
   262             g_object_set( G_OBJECT(vol), "mute", gmute, NULL );
       
   263         }
       
   264         else
       
   265         {
       
   266             DEBUG_ERR("Could not find gst volume controller element!!");
       
   267         }
       
   268     }
       
   269     else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation )
       
   270     {
       
   271         XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx;
       
   272         context->mute = mute;
       
   273         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" );
       
   274         if(audiopp)
       
   275         {
       
   276             vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   277         }
       
   278         if(vol)
       
   279         {
       
   280             if ( mute )
       
   281             {
       
   282                 gmute = 1;
       
   283             }
       
   284             else
       
   285             {
       
   286                 gmute = 0;
       
   287             }
       
   288             g_object_set( G_OBJECT(vol), "mute", gmute, NULL );
       
   289         }
       
   290         else
       
   291         {
       
   292             DEBUG_ERR("Could not find gst volume controller element!!");
       
   293         }
       
   294     }
       
   295     else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation )
       
   296     {
       
   297         XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx;
       
   298         guint iterator = 0;
       
   299         context->mute = mute;
       
   300         for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ )
       
   301         {
       
   302             GstBin* basebin = NULL;
       
   303             XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx;
       
   304             if(!bCtx)
       
   305             {
       
   306                 DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator);
       
   307                 DEBUG_API("<-XAVolumeItfAdapt_SetMute");
       
   308                 return XA_RESULT_INTERNAL_ERROR;
       
   309             }
       
   310 
       
   311             basebin = GST_BIN(bCtx->bin);
       
   312             if(!basebin)
       
   313             {
       
   314                 DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator);
       
   315                 DEBUG_API("<-XAVolumeItfAdapt_SetMute");
       
   316                 return XA_RESULT_INTERNAL_ERROR;
       
   317             }
       
   318 
       
   319             audiopp = gst_bin_get_by_name( basebin, "audiopp" );
       
   320             if(audiopp)
       
   321             {
       
   322                 vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" );
       
   323             }
       
   324             if(vol)
       
   325             {
       
   326                 if ( mute )
       
   327                 {
       
   328                     gmute = 1;
       
   329                 }
       
   330                 else
       
   331                 {
       
   332                     gmute = 0;
       
   333                 }
       
   334                 g_object_set( G_OBJECT(vol), "mute", gmute, NULL );
       
   335             }
       
   336             else
       
   337             {
       
   338                 DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator);
       
   339             }
       
   340         }
       
   341     }
       
   342     DEBUG_API("<-XAVolumeItfAdapt_SetMute");
       
   343     return XA_RESULT_SUCCESS;
       
   344 }
       
   345 
       
   346 /*
       
   347  * XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationGstCtx *ctx, XAboolean enable)
       
   348  * @param XAAdaptationGstCtx *ctx - Adaptation context
       
   349  * @param XAboolean enable - Enable Stereo Position
       
   350  * @return XAresult - Success value
       
   351  */
       
   352 XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationGstCtx *ctx, XAboolean enable)
       
   353 {
       
   354     DEBUG_API("->XAVolumeItfAdapt_EnableStereoPosition");
       
   355 
       
   356     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
       
   357                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
       
   358                  ctx->baseObj.ctxId != XAOutputMixAdaptation ) )
       
   359     {
       
   360         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   361         DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition");
       
   362         /* invalid parameter */
       
   363         return XA_RESULT_PARAMETER_INVALID;
       
   364     }
       
   365 
       
   366     if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation  )
       
   367     {
       
   368         XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx;
       
   369         context->isStereoPosition = enable;
       
   370     }
       
   371     else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation  )
       
   372     {
       
   373         XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx;
       
   374         context->isStereoPosition = enable;
       
   375     }
       
   376     else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation  )
       
   377     {
       
   378         XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx;
       
   379         context->isStereoPosition = enable;
       
   380     }
       
   381 
       
   382     DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition");
       
   383     return XA_RESULT_SUCCESS;
       
   384 }
       
   385 
       
   386 /*
       
   387  * XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationGstCtx *ctx, XApermille stereoPosition)
       
   388  * @param XAAdaptationGstCtx *ctx - Adaptation context
       
   389  * @param XApermille stereoPosition - Stereo Position to be set
       
   390  * @return XAresult - Success value
       
   391  */
       
   392 XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationGstCtx *ctx,
       
   393                                             XApermille stereoPosition)
       
   394 {
       
   395     GstElement *audiopp = NULL, *pan = NULL;
       
   396     gfloat gstPosition = 0.0;
       
   397 
       
   398     DEBUG_API("->XAVolumeItfAdapt_SetStereoPosition");
       
   399     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
       
   400                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
       
   401                  ctx->baseObj.ctxId != XAOutputMixAdaptation) )
       
   402     {
       
   403         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
   404         DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   405         return XA_RESULT_PARAMETER_INVALID;
       
   406     }
       
   407 
       
   408     gstPosition = ( (gfloat)stereoPosition / STEREO_POSITION_RATIO );
       
   409 
       
   410     if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation  )
       
   411     {
       
   412         XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx;
       
   413 
       
   414         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp");
       
   415         if( !audiopp )
       
   416         {
       
   417             DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   418             DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   419             return XA_RESULT_INTERNAL_ERROR;
       
   420         }
       
   421 
       
   422         pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" );
       
   423         if( !pan )
       
   424         {
       
   425             DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   426             DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   427             return XA_RESULT_INTERNAL_ERROR;
       
   428         }
       
   429 
       
   430         g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL );
       
   431 
       
   432         XAVolumeItfAdapt_FlushBin(ctx);
       
   433     }
       
   434     else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation  )
       
   435     {
       
   436         XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx;
       
   437 
       
   438         audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp");
       
   439         if( !audiopp )
       
   440         {
       
   441             DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   442             DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   443             return XA_RESULT_INTERNAL_ERROR;
       
   444         }
       
   445 
       
   446         pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" );
       
   447         if( !pan )
       
   448         {
       
   449             DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   450             DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   451             return XA_RESULT_INTERNAL_ERROR;
       
   452         }
       
   453 
       
   454         g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL );
       
   455     }
       
   456 
       
   457     else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation )
       
   458     {
       
   459         XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx;
       
   460         guint iterator = 0;
       
   461         for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ )
       
   462         {
       
   463             GstBin* basebin = NULL;
       
   464             XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx;
       
   465             if(!bCtx)
       
   466             {
       
   467                 DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator);
       
   468                 return XA_RESULT_INTERNAL_ERROR;
       
   469             }
       
   470 
       
   471             basebin = GST_BIN(bCtx->bin);
       
   472             if(!basebin)
       
   473             {
       
   474                 DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator);
       
   475                 return XA_RESULT_INTERNAL_ERROR;
       
   476             }
       
   477 
       
   478             audiopp = gst_bin_get_by_name( basebin, "audiopp" );
       
   479             if( !audiopp )
       
   480             {
       
   481                 DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   482                 DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   483                 return XA_RESULT_INTERNAL_ERROR;
       
   484             }
       
   485             pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" );
       
   486             if( !pan )
       
   487             {
       
   488                 DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");
       
   489                 DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   490                 return XA_RESULT_INTERNAL_ERROR;
       
   491             }
       
   492             g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL );
       
   493 
       
   494             XAVolumeItfAdapt_FlushBin(bCtx);
       
   495         }
       
   496     }
       
   497 
       
   498     DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition");
       
   499     return XA_RESULT_SUCCESS;
       
   500 }
       
   501 
       
   502