gst_plugins_symbian/gst/devsound/devsoundsinkwrapper.cpp
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     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 
       
    19 #include "devsoundsinkwrapper.h"
       
    20 #include <mmcccodecinformation.h>
       
    21 #include "debugtracemacros.h"
       
    22 
       
    23 DevSoundWrapper::DevSoundWrapper()
       
    24     {
       
    25     init_complete = 0;
       
    26     dev_sound = NULL;
       
    27 
       
    28     buffersize = 0;
       
    29     dev_count = 0;
       
    30     caps.iRate = EMMFSampleRate8000Hz;
       
    31     caps.iEncoding = EMMFSoundEncoding16BitPCM;
       
    32     caps.iChannels = EMMFMono;
       
    33     fourcc = KMMFFourCCCodePCM16;
       
    34     eosReceived = false;
       
    35     iErrConcealmentIntfc = NULL;
       
    36     iG711DecoderIntfc = NULL;
       
    37     iG729DecoderIntfc = NULL;
       
    38     iIlbcDecoderIntfc = NULL;
       
    39     iCallbackError = KErrNone;
       
    40     iAudioOutput = NULL;
       
    41     }
       
    42 
       
    43 /*********************************************************/
       
    44 void DevSoundWrapper::InitializeComplete(TInt aError)
       
    45     {
       
    46     TRACE_PRN_FN_ENT;
       
    47     TRequestStatus* stat = &(AL->iStatus);
       
    48 
       
    49     if (aError == KErrNone)
       
    50         {
       
    51         init_complete = 1;
       
    52         }
       
    53     else
       
    54         {
       
    55         init_complete = 0;
       
    56         }
       
    57 
       
    58     User::RequestComplete(stat, aError);
       
    59     TRACE_PRN_IF_ERR(aError);
       
    60     TRACE_PRN_FN_EXT;
       
    61     }
       
    62 /************************************************************/
       
    63 
       
    64 void DevSoundWrapper::BufferToBeFilled(CMMFBuffer* aBuffer)
       
    65     {
       
    66 //    TRACE_PRN_FN_ENT;
       
    67     buffer = aBuffer;
       
    68     buffersize = aBuffer->RequestSize();
       
    69     TRACE_PRN_N1(_L("DevSoundWrapper::BufferToBeFilled->buffersize [%d]"), buffersize);
       
    70 
       
    71     TRequestStatus* stat = &(AL->iStatus);
       
    72 
       
    73     if (aBuffer)
       
    74         {
       
    75         User::RequestComplete(stat, KErrNone);
       
    76         iCallbackError = KErrNone;
       
    77         }
       
    78     else
       
    79         {
       
    80         User::RequestComplete(stat, KErrNotFound);
       
    81         iCallbackError = KErrNotFound;
       
    82         }
       
    83 
       
    84 //    TRACE_PRN_FN_EXT;
       
    85     }
       
    86 
       
    87 /***********************************************************/
       
    88 void DevSoundWrapper::PlayError(TInt aError)
       
    89     {
       
    90     TRequestStatus* stat = &(AL->iStatus);
       
    91     User::RequestComplete(stat, aError);
       
    92     iCallbackError = aError;
       
    93     }
       
    94 /*******************************************************/
       
    95 void DevSoundWrapper::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
       
    96     {
       
    97 
       
    98     }
       
    99 /********************************************************/
       
   100 void DevSoundWrapper::RecordError(TInt /*aError*/)
       
   101     {
       
   102 
       
   103     }
       
   104 /**********************************************************/
       
   105 void DevSoundWrapper::ConvertError(TInt /*aError*/)
       
   106     {
       
   107 
       
   108     }
       
   109 /***********************************************************/
       
   110 void DevSoundWrapper::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/)
       
   111     {
       
   112 
       
   113     }
       
   114 /***********************************************************/
       
   115 void DevSoundWrapper::SendEventToClient(const TMMFEvent& /*aEvent*/)
       
   116     {
       
   117 
       
   118     }
       
   119 /************************************************************/
       
   120 void DevSoundWrapper::ToneFinished(TInt /*aError*/)
       
   121     {
       
   122 
       
   123     }
       
   124 
       
   125 /***********************************************************
       
   126  *********C interface functions******************************
       
   127  ************************************************************/
       
   128 
       
   129 /******************************************************/
       
   130 int open_devsound(DevSoundWrapper **handle)
       
   131     {
       
   132     TRACE_PRN_FN_ENT;
       
   133     int ret = 0;
       
   134     *handle = new DevSoundWrapper();
       
   135     if (handle)
       
   136         {
       
   137         ret = open_device(handle);
       
   138         }
       
   139     else
       
   140         {
       
   141         ret = KErrNoMemory;
       
   142         }
       
   143     TRACE_PRN_FN_EXT;
       
   144     return ret;
       
   145     }
       
   146 
       
   147 /*********************************************************/
       
   148 
       
   149 int check_if_device_open(DevSoundWrapper *handle)
       
   150     {
       
   151     TRACE_PRN_FN_ENT;
       
   152 
       
   153     int ret;
       
   154     if ((handle->dev_count) == 1)
       
   155         {
       
   156         ret = 1;
       
   157         }
       
   158     else
       
   159         {
       
   160         ret = 0;
       
   161         }
       
   162 
       
   163     TRACE_PRN_FN_EXT;
       
   164     return ret;
       
   165     }
       
   166 
       
   167 /*********************************************************/
       
   168 int open_device(DevSoundWrapper **handle)
       
   169     {
       
   170     int retcode = KErrNone;
       
   171     TRACE_PRN_FN_ENT;
       
   172 
       
   173     (*handle)->dev_count++;
       
   174 
       
   175     (*handle)->as = CActiveScheduler::Current();
       
   176 
       
   177     if (!((*handle)->as))
       
   178         {
       
   179         (*handle)->as = new CActiveScheduler();
       
   180         if ((*handle)->as)
       
   181             {
       
   182             CActiveScheduler::Install((*handle)->as);
       
   183             }
       
   184 
       
   185         }
       
   186     (*handle)->AL = new CActiveListener;
       
   187     ((*handle)->AL)->asw = new CActiveSchedulerWait();
       
   188 
       
   189         TRAP( retcode,(*handle)->dev_sound = CMMFDevSound::NewL() );
       
   190 
       
   191     if (!(*handle)->AL || !((*handle)->AL)->asw || !(*handle)->dev_sound
       
   192             || !(*handle)->as)
       
   193         {
       
   194         retcode = KErrNoMemory;
       
   195         }
       
   196 
       
   197     TRACE_PRN_FN_EXT;
       
   198     return retcode;
       
   199     }
       
   200 
       
   201 /*******************************************************/
       
   202 int initialize_devsound(GstDevsoundSink* ds)
       
   203     {
       
   204     TRACE_PRN_FN_ENT;
       
   205     int ret = 0;
       
   206     DevSoundWrapper* handle = (DevSoundWrapper*) ds->handle;
       
   207 
       
   208     handle->AL->InitialiseActiveListener();
       
   209 
       
   210         TRAP (ret, handle->dev_sound->InitializeL(*handle, handle->fourcc, EMMFStatePlaying));
       
   211 
       
   212     if (ret)
       
   213         {
       
   214         TRACE_PRN_IF_ERR(ret);
       
   215         return ret;
       
   216         }
       
   217 
       
   218     handle->AL->StartActiveScheduler();
       
   219 
       
   220     if (handle->init_complete==1)
       
   221         {
       
   222         TMMFPrioritySettings temp;
       
   223         temp.iPref = (TMdaPriorityPreference)ds->preference;
       
   224         temp.iPriority = ds->priority;
       
   225         handle->dev_sound->SetPrioritySettings(temp);
       
   226 
       
   227         //set post initialize properties
       
   228         post_init_setconfig(handle);
       
   229         ret = KErrNone;
       
   230         }
       
   231     else
       
   232         {
       
   233         ret = KErrNotFound;
       
   234         }
       
   235 
       
   236     TRACE_PRN_IF_ERR(ret);
       
   237     TRACE_PRN_FN_EXT;
       
   238     return ret;
       
   239     }
       
   240 
       
   241 /************************************************************/
       
   242 
       
   243 int close_devsound(GstDevsoundSink *ds)
       
   244     {
       
   245     TRACE_PRN_FN_ENT;
       
   246 
       
   247     g_list_foreach(ds->fmt, (GFunc) g_free, NULL);
       
   248     g_list_free(ds->fmt);
       
   249     ds->fmt = NULL;
       
   250     delete ds->handle;
       
   251     TRACE_PRN_FN_EXT;
       
   252     return 0;
       
   253     }
       
   254 
       
   255 /************************************************************/
       
   256 
       
   257 int post_init_setconfig(DevSoundWrapper *handle)
       
   258     {
       
   259     TRACE_PRN_FN_ENT;
       
   260     int ret = 0;
       
   261 
       
   262         TRAP(ret, (handle->dev_sound)->SetConfigL(handle->caps) );
       
   263 
       
   264     if (ret)
       
   265         {
       
   266         TRACE_PRN_IF_ERR(ret);
       
   267         return ret;
       
   268         }
       
   269 
       
   270     (handle->caps)= (handle->dev_sound)->Config();
       
   271 
       
   272     if (handle->fourcc == KMccFourCCIdG711 ||
       
   273             handle->fourcc == KMccFourCCIdG729 ||
       
   274             handle->fourcc == KMccFourCCIdILBC ||
       
   275             handle->fourcc == KMccFourCCIdAMRNB)
       
   276         {
       
   277         if (!handle->iErrConcealmentIntfc)
       
   278             {
       
   279 
       
   280             TRAP(ret, handle->iErrConcealmentIntfc = CErrorConcealmentIntfc::NewL(*handle->dev_sound) );
       
   281             }
       
   282         }
       
   283     switch (handle->fourcc)
       
   284         {
       
   285         case KMccFourCCIdG711:
       
   286             {
       
   287             if (!handle->iG711DecoderIntfc)
       
   288                 {
       
   289 
       
   290                 TRAP(ret, handle->iG711DecoderIntfc = CG711DecoderIntfc::NewL(*handle->dev_sound) );
       
   291                 }
       
   292             break;
       
   293             }
       
   294         case KMccFourCCIdG729:
       
   295             {
       
   296             if (!handle->iG729DecoderIntfc)
       
   297                 {
       
   298 
       
   299                 TRAP(ret, handle->iG729DecoderIntfc = CG729DecoderIntfc::NewL(*handle->dev_sound) );
       
   300                 }
       
   301             break;
       
   302             }
       
   303         case KMccFourCCIdILBC:
       
   304             {
       
   305             if (!handle->iIlbcDecoderIntfc)
       
   306                 {
       
   307 
       
   308                 TRAP(ret, handle->iIlbcDecoderIntfc = CIlbcDecoderIntfc::NewL(*handle->dev_sound) );
       
   309                 }
       
   310             break;
       
   311             }
       
   312         case KMccFourCCIdAMRNB:
       
   313         case KMMFFourCCCodePCM16:
       
   314         default:
       
   315             {
       
   316             break;
       
   317             }
       
   318         }
       
   319    
       
   320     if (!handle->iAudioOutput)
       
   321         {
       
   322         TRAP(ret, handle->iAudioOutput = CAudioOutput::NewL(*handle->dev_sound) );
       
   323         }
       
   324     
       
   325     TRACE_PRN_IF_ERR(ret);
       
   326     TRACE_PRN_FN_EXT;
       
   327     return ret;
       
   328 
       
   329     }
       
   330 
       
   331 /*********************************************************/
       
   332 
       
   333 void conceal_error_for_next_buffer(DevSoundWrapper *handle)
       
   334     {
       
   335     TRACE_PRN_FN_ENT;
       
   336     if (handle->iErrConcealmentIntfc)
       
   337         {
       
   338         (handle->iErrConcealmentIntfc)->ConcealErrorForNextBuffer();
       
   339         }
       
   340     TRACE_PRN_FN_EXT;
       
   341     }
       
   342 
       
   343 /*********************************************************/
       
   344 void set_framemode(DevSoundWrapper *handle, gboolean mode)
       
   345     {
       
   346     TRACE_PRN_FN_ENT;
       
   347     if (handle->iErrConcealmentIntfc)
       
   348         {
       
   349         (handle->iErrConcealmentIntfc)->SetFrameMode(mode);
       
   350         }
       
   351     TRACE_PRN_FN_EXT;
       
   352     }
       
   353 
       
   354 /*********************************************************/
       
   355 int framemode_rqrd_for_ec(DevSoundWrapper *handle, gboolean* modereq)
       
   356     {
       
   357     TRACE_PRN_FN_ENT;
       
   358     int err = 0;
       
   359     if (handle->iErrConcealmentIntfc)
       
   360         {
       
   361         err = (handle->iErrConcealmentIntfc)->FrameModeRqrdForEC(*modereq);
       
   362         }
       
   363     TRACE_PRN_FN_EXT;
       
   364     return err;
       
   365     }
       
   366 
       
   367 /*********************************************************/
       
   368 int set_decodermode(DevSoundWrapper *handle, int aDecodeMode)
       
   369     {
       
   370     TRACE_PRN_FN_ENT;
       
   371     int err = 0;
       
   372     if (handle->iG711DecoderIntfc)
       
   373         {
       
   374         err = (handle->iG711DecoderIntfc)->SetDecoderMode(
       
   375                 (CG711DecoderIntfc::TDecodeMode) aDecodeMode);
       
   376         }
       
   377     TRACE_PRN_FN_EXT;
       
   378     return err;
       
   379     }
       
   380 
       
   381 /*********************************************************/
       
   382 
       
   383 int set_cng(DevSoundWrapper *handle, gboolean aCng)
       
   384     {
       
   385     TRACE_PRN_FN_ENT;
       
   386     int err = 0;
       
   387     if (handle->iG711DecoderIntfc)
       
   388         {
       
   389         err = (handle->iG711DecoderIntfc)->SetCng(aCng);
       
   390         }
       
   391     TRACE_PRN_FN_EXT;
       
   392     return err;
       
   393     }
       
   394 
       
   395 /*********************************************************/
       
   396 int get_cng(DevSoundWrapper *handle, gboolean* aCng)
       
   397     {
       
   398     TRACE_PRN_FN_ENT;
       
   399     int err = 0;
       
   400     if (handle->iG711DecoderIntfc)
       
   401         {
       
   402         err = (handle->iG711DecoderIntfc)->GetCng(*aCng);
       
   403         }
       
   404     TRACE_PRN_FN_EXT;
       
   405     return err;
       
   406     }
       
   407 
       
   408 /*********************************************************/
       
   409 int set_plc(DevSoundWrapper *handle, gboolean aPlc)
       
   410     {
       
   411     TRACE_PRN_FN_ENT;
       
   412     int err = 0;
       
   413     if (handle->iG711DecoderIntfc)
       
   414         {
       
   415         err = (handle->iG711DecoderIntfc)->SetPlc(aPlc);
       
   416         }
       
   417     TRACE_PRN_FN_EXT;
       
   418     return err;
       
   419     }
       
   420 /*********************************************************/
       
   421 //G729 custom interface
       
   422 gint badlsfnextbuffer(DevSoundWrapper *handle)
       
   423     {
       
   424     TRACE_PRN_FN_ENT;
       
   425     int err = 0;
       
   426     if (handle->iG729DecoderIntfc)
       
   427         {
       
   428         err = (handle->iG729DecoderIntfc)->BadLsfNextBuffer();
       
   429         }
       
   430     TRACE_PRN_FN_EXT;
       
   431     return err;
       
   432     }
       
   433 /*********************************************************/
       
   434 //Ilbc custom interace
       
   435 gint get_ilbccng(DevSoundWrapper *handle, gboolean* aCng)
       
   436     {
       
   437     TRACE_PRN_FN_ENT;
       
   438     int err = 0;
       
   439     if (handle->iIlbcDecoderIntfc)
       
   440         {
       
   441         err = (handle->iIlbcDecoderIntfc)->GetCng(*aCng);
       
   442         }
       
   443 
       
   444     TRACE_PRN_FN_EXT;
       
   445     return err;
       
   446     }
       
   447 /*********************************************************/
       
   448 gint set_ilbccng(DevSoundWrapper *handle, gboolean aCng)
       
   449     {
       
   450     TRACE_PRN_FN_ENT;
       
   451     int err = 0;
       
   452     if (handle->iIlbcDecoderIntfc)
       
   453         {
       
   454         err = (handle->iIlbcDecoderIntfc)->SetCng(aCng);
       
   455         }
       
   456     TRACE_PRN_FN_EXT;
       
   457     return err;
       
   458     }
       
   459 /*********************************************************/
       
   460 gint set_ilbcdecodermode(DevSoundWrapper *handle,
       
   461         enum TIlbcDecodeMode aDecodeMode)
       
   462     {
       
   463     TRACE_PRN_FN_ENT;
       
   464     int err = 0;
       
   465     if (handle->iIlbcDecoderIntfc)
       
   466         {
       
   467         err = (handle->iIlbcDecoderIntfc)->SetDecoderMode(
       
   468                 (CIlbcDecoderIntfc::TDecodeMode) aDecodeMode);
       
   469         }
       
   470     TRACE_PRN_FN_EXT;
       
   471     return err;
       
   472     }
       
   473 
       
   474 /*********************************************************/
       
   475 gint set_outputdevice(DevSoundWrapper *handle, gint outputDev)
       
   476     {
       
   477     TRACE_PRN_FN_ENT;
       
   478     int err = 0;
       
   479     if (handle->iAudioOutput)
       
   480         {
       
   481         (handle->iAudioOutput)->SetAudioOutputL(
       
   482                 (CAudioOutput::TAudioOutputPreference) outputDev);
       
   483         }
       
   484     TRACE_PRN_FN_EXT;
       
   485     return err;
       
   486     }
       
   487 
       
   488 /*********************************************************/
       
   489 gint get_outputdevice(DevSoundWrapper *handle, gint* outputDev)
       
   490     {
       
   491     TRACE_PRN_FN_ENT;
       
   492     int err = 0;
       
   493     if (handle->iAudioOutput)
       
   494         {
       
   495         *outputDev = (handle->iAudioOutput)->AudioOutput();
       
   496         }
       
   497     TRACE_PRN_FN_EXT;
       
   498     return err;
       
   499     }
       
   500 
       
   501 /**************************************************************/
       
   502 int reset_devsound(DevSoundWrapper* /*handle*/)
       
   503     {
       
   504     return 0;
       
   505     }
       
   506 /*****************************************************************/
       
   507 int get_rate(DevSoundWrapper *handle)
       
   508     {
       
   509     return handle->caps.iRate;
       
   510 
       
   511     }
       
   512 /*****************************************************************/
       
   513 int get_channels(DevSoundWrapper *handle)
       
   514     {
       
   515     return handle->caps.iChannels;
       
   516     }
       
   517 /********************************************************************/
       
   518 int get_encoding(DevSoundWrapper *handle)
       
   519     {
       
   520     return handle->caps.iEncoding;
       
   521 
       
   522     }
       
   523 /*******************************************************************/
       
   524 int get_size(DevSoundWrapper *handle)
       
   525     {
       
   526     return handle->caps.iBufferSize;
       
   527     }
       
   528 /******************************************************************/
       
   529 
       
   530 void set_rate(DevSoundWrapper *handle, int rate)
       
   531     {
       
   532     handle->caps.iRate = rate;
       
   533     }
       
   534 /******************************************************************/
       
   535 void set_channels(DevSoundWrapper *handle, int channels)
       
   536     {
       
   537     handle->caps.iChannels = channels;
       
   538     }
       
   539 /****************************************************************/
       
   540 void set_encoding(DevSoundWrapper *handle, int encoding)
       
   541     {
       
   542     handle->caps.iEncoding = encoding;
       
   543     }
       
   544 /*****************************************************************/
       
   545 void set_size(DevSoundWrapper *handle, int size)
       
   546     {
       
   547     handle->caps.iBufferSize = size;
       
   548     }
       
   549 /*****************************************************************/
       
   550 void set_fourcc(DevSoundWrapper *handle, int fourcc)
       
   551     {
       
   552     handle->fourcc = fourcc;
       
   553     }
       
   554 
       
   555 int get_ds_cb_error(DevSoundWrapper *handle)
       
   556     {
       
   557     return handle->iCallbackError;
       
   558     }
       
   559 /*******************************************************************/
       
   560 
       
   561 int playinit(DevSoundWrapper *handle)
       
   562     {
       
   563     TRACE_PRN_FN_ENT;
       
   564 
       
   565     ((handle)->AL)->InitialiseActiveListener();
       
   566     handle->eosReceived = false;
       
   567 
       
   568         TRAP(handle->iCallbackError,(handle->dev_sound)->PlayInitL());
       
   569     if (handle->iCallbackError == KErrNone)
       
   570         {
       
   571         ((handle)->AL)->StartActiveScheduler();
       
   572         }
       
   573 
       
   574     TRACE_PRN_IF_ERR(handle->iCallbackError);
       
   575     TRACE_PRN_FN_EXT;
       
   576     return handle->iCallbackError;
       
   577     }
       
   578 /******************************************************************/
       
   579 int write_data(DevSoundWrapper *handle, TUint8* gstPtr, int gstBufferSize,
       
   580         gboolean lastBuffer)
       
   581     {
       
   582     TRACE_PRN_FN_ENT;
       
   583 
       
   584     CMMFDataBuffer* buf = STATIC_CAST (CMMFDataBuffer*, handle->buffer);
       
   585 
       
   586     TRACE_PRN_N2(_L("***gstBufferSize:[%d], handle->buffersize:[%d]"), gstBufferSize, handle->buffersize);
       
   587 
       
   588     if ((lastBuffer == TRUE) && (gstBufferSize <= handle->buffersize))
       
   589         {
       
   590         buf->SetLastBuffer(ETrue);
       
   591         }
       
   592     
       
   593     TInt copySize = Min(gstBufferSize, handle->buffersize);
       
   594 
       
   595     if (copySize <= 0)
       
   596         {
       
   597         //will crash thread if not handled here
       
   598         return gstBufferSize;
       
   599         }
       
   600 
       
   601     TPtr8 srcPtr(gstPtr, copySize, copySize);
       
   602     TUint8* p = (TUint8*) (buf->Data().Ptr());
       
   603     TPtr8 destPtr(p, buf->Data().Length(), buf->Data().MaxLength());
       
   604 
       
   605     destPtr.Append(srcPtr);
       
   606     TRACE_PRN_N(_L("write_data->Append"));
       
   607     buf->Data().SetLength(buf->Data().Length() + copySize);
       
   608 
       
   609     gstBufferSize -= copySize;
       
   610     handle->buffersize -= copySize;
       
   611 
       
   612     if ((handle->buffersize == 0) || (buf->LastBuffer()))
       
   613         {
       
   614         play_data(handle);
       
   615         }
       
   616 
       
   617     TRACE_PRN_FN_EXT;
       
   618     return gstBufferSize;
       
   619     }
       
   620 
       
   621 /*******************************************************************/
       
   622 int play_data(DevSoundWrapper *handle)
       
   623     {
       
   624     TRACE_PRN_FN_ENT;
       
   625     (handle->AL)->InitialiseActiveListener();
       
   626 
       
   627     (handle->dev_sound)->PlayData();
       
   628 
       
   629     ((handle)->AL)->StartActiveScheduler();
       
   630 
       
   631     TRACE_PRN_FN_EXT;
       
   632     return KErrNone;
       
   633     }
       
   634 
       
   635 /*********************************************************************/
       
   636 
       
   637 int pre_init_setconf(GstDevsoundSink *ds)
       
   638     {
       
   639     TRACE_PRN_FN_ENT;
       
   640     int ret = 0;
       
   641 
       
   642     DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle);
       
   643 
       
   644     // NOTE: it is too late for setting prio/pref here
       
   645     if (ds->pending.preferenceupdate == 1 || ds->pending.priorityupdate == 1)
       
   646         {
       
   647         ds->pending.preferenceupdate = FALSE;
       
   648         ds->pending.priorityupdate = FALSE;
       
   649         }
       
   650     if (ds->pending.volumeupdate == 1)
       
   651         {
       
   652         (dsPtr->dev_sound)->SetVolume(ds->volume);
       
   653         ds->pending.volumeupdate = FALSE;
       
   654         }
       
   655     if (ds->pending.volumerampupdate == 1)
       
   656         {
       
   657         (dsPtr->dev_sound)->SetVolumeRamp(ds->volumeramp);
       
   658         ds->pending.volumerampupdate = FALSE;
       
   659         }
       
   660     if (ds->pending.leftbalanceupdate == 1 || ds->pending.rightbalanceupdate
       
   661             == 1)
       
   662         {
       
   663             TRAP( ret, (dsPtr->dev_sound)->SetPlayBalanceL(ds->leftbalance,ds->rightbalance) );
       
   664         ds->pending.leftbalanceupdate = FALSE;
       
   665         ds->pending.rightbalanceupdate = FALSE;
       
   666         }
       
   667     if(ds->pending.outputupdate == 1)
       
   668         {
       
   669         set_outputdevice(dsPtr,ds->output);
       
   670         ds->pending.outputupdate = FALSE;
       
   671         }
       
   672     TRACE_PRN_FN_EXT;
       
   673     return ret;
       
   674     }
       
   675 /*********************************************************/
       
   676 void getsupporteddatatypes(GstDevsoundSink *ds)
       
   677     {
       
   678     TRACE_PRN_FN_ENT;
       
   679     DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle);
       
   680         TRAP_IGNORE(dsPtr->GetDataTypesL(ds));
       
   681 
       
   682     TRACE_PRN_FN_EXT;
       
   683     }
       
   684 
       
   685 /*********************************************************/
       
   686 void DevSoundWrapper::GetDataTypesL(GstDevsoundSink *ds)
       
   687     {
       
   688     TRACE_PRN_FN_ENT;
       
   689 
       
   690     RArray<TFourCC> outputdatatypes;
       
   691     TMMFPrioritySettings prioritysettings;
       
   692     DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle);
       
   693 
       
   694     CleanupClosePushL(outputdatatypes);
       
   695 
       
   696     TRAP_IGNORE( (dsPtr->dev_sound)->GetSupportedOutputDataTypesL(outputdatatypes,prioritysettings) );
       
   697 
       
   698     for (TInt i = 0; i < outputdatatypes.Count(); i++)
       
   699         {
       
   700         TRACE_PRN_N2(_L("GstDevsoundSink supported Codec[%d]==[0x%x]"), i+1, outputdatatypes[i].FourCC());
       
   701         guint *ip = g_new (guint, 1);
       
   702         *ip = outputdatatypes[i].FourCC();
       
   703         ds->fmt = g_list_append(ds->fmt, ip);
       
   704         }
       
   705     CleanupStack::PopAndDestroy(&outputdatatypes);
       
   706     TRACE_PRN_FN_EXT;
       
   707     }
       
   708 
       
   709 /*********************************************************/
       
   710 void populateproperties(GstDevsoundSink *ds)
       
   711     {
       
   712     TRACE_PRN_FN_ENT;
       
   713     DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle);
       
   714     ds->samplesplayed = (dsPtr->dev_sound)->SamplesPlayed();
       
   715     get_outputdevice(dsPtr,&ds->output);
       
   716     TRACE_PRN_FN_EXT;
       
   717     }
       
   718 
       
   719 void initproperties(GstDevsoundSink* ds)
       
   720     {
       
   721     TRACE_PRN_FN_ENT;
       
   722     DevSoundWrapper* dsPtr=  STATIC_CAST(DevSoundWrapper*, ds->handle);
       
   723     ds->maxvolume     = (dsPtr->dev_sound)->MaxVolume();
       
   724     ds->volume        = (dsPtr->dev_sound)->Volume();
       
   725     framemode_rqrd_for_ec(dsPtr,&ds->framemodereq);   
       
   726     get_cng(dsPtr,&ds->g711cng);
       
   727     get_ilbccng(dsPtr,&ds->ilbccng);
       
   728     TRACE_PRN_FN_EXT;    
       
   729     }