mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp
changeset 25 6f7ceef7b1d1
parent 20 b67dd1fc57c5
equal deleted inserted replaced
21:2ed61feeead6 25:6f7ceef7b1d1
    16  */
    16  */
    17 
    17 
    18 #include <tms.h>
    18 #include <tms.h>
    19 #include <tmsclientsourceobsrvr.h>
    19 #include <tmsclientsourceobsrvr.h>
    20 #include "tmscallproxy.h"
    20 #include "tmscallproxy.h"
       
    21 #include "tmsglobalcontext.h"
    21 #include "tmsmembuffer.h"
    22 #include "tmsmembuffer.h"
    22 #include "tmsqueuehandler.h"
    23 #include "tmsqueuehandler.h"
    23 #include "tmsclientsourcebodyimpl.h"
    24 #include "tmsclientsourcebodyimpl.h"
    24 
    25 
    25 using namespace TMS;
    26 using namespace TMS;
    72         ret = TMS_RESULT_ALREADY_EXIST;
    73         ret = TMS_RESULT_ALREADY_EXIST;
    73         }
    74         }
    74     return ret;
    75     return ret;
    75     }
    76     }
    76 
    77 
    77 /**
       
    78  * Remove a stream observer from this stream.
       
    79  *
       
    80  * This function can be called at any time. It is recommended to remove
       
    81  * observer after calling Deinit() on stream. Else observer may receive
       
    82  * a callback that is alread dispatched.
       
    83  *
       
    84  * @param  obsrvr
       
    85  *      The listener to remove.
       
    86  *
       
    87  * @return
       
    88  *      TMS_RESULT_SUCCESS if the obsrvr is removed successfully from list.
       
    89  *      TMS_RESULT_DOES_NOT_EXIST if obsrvr is not already in the list.
       
    90  *
       
    91  */
       
    92 gint TMSClientSourceBodyImpl::RemoveObserver(TMSClientSourceObserver& obsrvr)
    78 gint TMSClientSourceBodyImpl::RemoveObserver(TMSClientSourceObserver& obsrvr)
    93     {
    79     {
    94     gint ret(TMS_RESULT_SUCCESS);
    80     gint ret(TMS_RESULT_SUCCESS);
    95     if (&obsrvr == iObserver)
    81     if (&obsrvr == iObserver)
    96         {
    82         {
   109 // Option 2 is to have overloaded function with another parameter.
    95 // Option 2 is to have overloaded function with another parameter.
   110 gint TMSClientSourceBodyImpl::BufferFilled(TMSBuffer& buffer)
    96 gint TMSClientSourceBodyImpl::BufferFilled(TMSBuffer& buffer)
   111     {
    97     {
   112     // TODO send stream attributes here
    98     // TODO send stream attributes here
   113     gint ret(TMS_RESULT_SUCCESS);
    99     gint ret(TMS_RESULT_SUCCESS);
   114     ret = iProxy->BufferFilled(TMS_CALL_IP, TMS_STREAM_DOWNLINK, iStreamId,
   100     ret = iProxy->BufferFilled(iContext->CallType, iContext->StreamType,
   115             buffer);
   101             iContext->StreamId, buffer);
   116     return ret;
   102     return ret;
   117     }
   103     }
   118 
   104 
   119 // Push mode
   105 // Push mode
   120 gint TMSClientSourceBodyImpl::ProcessBuffer(TMSBuffer* /*buffer*/)
   106 gint TMSClientSourceBodyImpl::ProcessBuffer(TMSBuffer* /*buffer*/)
   152     gint ret(TMS_RESULT_SUCCESS);
   138     gint ret(TMS_RESULT_SUCCESS);
   153     sourcetype = TMS_SOURCE_CLIENT;
   139     sourcetype = TMS_SOURCE_CLIENT;
   154     return ret;
   140     return ret;
   155     }
   141     }
   156 
   142 
   157 void TMSClientSourceBodyImpl::SetProxy(TMSCallProxy* aProxy, gint strmid,
   143 void TMSClientSourceBodyImpl::SetProxy(TMSGlobalContext* context,
   158         gpointer queuehandler)
   144         gpointer queuehandler)
   159     {
   145     {
   160     iProxy = aProxy;
   146     iProxy = context->CallProxy;
   161     iStreamId = strmid;
   147     iContext = context;
   162     static_cast<TMSQueueHandler*>(queuehandler)->AddObserver(*this,
   148     if (queuehandler)
   163             TMS_SOURCE_CLIENT);
   149         {
       
   150         static_cast<TMSQueueHandler*>(queuehandler)->AddObserver(*this,
       
   151                 TMS_SOURCE_CLIENT);
       
   152         }
   164     }
   153     }
   165 
   154 
   166 void TMSClientSourceBodyImpl::QueueEvent(TInt aEventType, TInt aError,
   155 void TMSClientSourceBodyImpl::QueueEvent(TInt aEventType, TInt aError,
   167         void* user_data)
   156         void* user_data)
   168     {
   157     {