mmserv/tms/tmscallserver/inc/tmsipcallstream.h
branchRCL_3
changeset 17 60e492b28869
parent 11 3570217d8c21
child 19 095bea5f582e
equal deleted inserted replaced
15:ab526b8cacfb 17:60e492b28869
    54 class CIlbcEncoderIntfc;
    54 class CIlbcEncoderIntfc;
    55 #endif //__USE_GSTREAMER__
    55 #endif //__USE_GSTREAMER__
    56 
    56 
    57 namespace TMS {
    57 namespace TMS {
    58 
    58 
       
    59 /**
       
    60  *  TMSIPDevSoundObserver
       
    61   * An observer interface providing TMSIPCallStreamBase event notifications.
       
    62  */
       
    63 class TMSIPDevSoundObserver
       
    64     {
       
    65 public:
       
    66     virtual void DownlinkInitCompleted(gint status) = 0;
       
    67     virtual void UplinkInitCompleted(gint status) = 0;
       
    68     virtual void UplinkStarted(gint status) = 0;
       
    69     virtual void DownlinkStarted(gint status) = 0;
       
    70     };
       
    71 
    59 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    60 //  Class Name:  TMSIPCallStreamBase
    73 //  Class Name:  TMSIPCallStreamBase
    61 //
    74 //
    62 //  Base abstract class for creating VoIP uplink and downlink streams.
    75 //  Base abstract class for creating VoIP uplink and downlink streams.
    63 // -----------------------------------------------------------------------------
    76 // -----------------------------------------------------------------------------
    89     void SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue);
   102     void SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue);
    90     gint DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer);
   103     gint DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer);
    91     gint ConfigureMedia(const guint32 aCodecID);
   104     gint ConfigureMedia(const guint32 aCodecID);
    92 
   105 
    93 protected:
   106 protected:
       
   107     TMSIPCallStreamBase(TMSIPDevSoundObserver& observer);
       
   108 
    94 #ifndef __USE_GSTREAMER__
   109 #ifndef __USE_GSTREAMER__
    95     // From MDevSoundObserver
   110     // From MDevSoundObserver
    96     virtual void InitializeComplete(TInt aError) = 0;
   111     virtual void InitializeComplete(TInt aError) = 0;
    97     virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
   112     virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
    98     virtual void RecordError(TInt /*aError*/) {}
   113     virtual void RecordError(TInt /*aError*/) {}
   103     virtual void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {}
   118     virtual void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {}
   104     virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {}
   119     virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {}
   105 #endif //__USE_GSTREAMER__
   120 #endif //__USE_GSTREAMER__
   106 
   121 
   107 protected:
   122 protected:
   108 
   123     TMSIPDevSoundObserver& iObserver;
   109     CActiveScheduler* iActiveScheduler;
   124     CActiveScheduler* iActiveScheduler;
   110     TStreamState iStatus;
   125     TStreamState iStatus;
   111 
   126 
   112 #ifndef __USE_GSTREAMER__
   127 #ifndef __USE_GSTREAMER__
   113     CMMFDevSound* iDevSound;
   128     CMMFDevSound* iDevSound;
   143 
   158 
   144 #ifdef __USE_GSTREAMER__
   159 #ifdef __USE_GSTREAMER__
   145     static void cb_raw_playback_handoff(GstElement* appsrc, guint size);
   160     static void cb_raw_playback_handoff(GstElement* appsrc, guint size);
   146     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   161     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   147 #endif //__USE_GSTREAMER__
   162 #endif //__USE_GSTREAMER__
   148     static TMSIPDownlink* NewL(const guint32 codecID,
   163 
   149             const TMMFPrioritySettings priority);
   164     static TMSIPDownlink* NewL(TMSIPDevSoundObserver& observer,
   150     TMSIPDownlink();
   165             const guint32 codecID, const TMMFPrioritySettings priority);
   151     void ConstructL(const guint32 codecID,
       
   152             const TMMFPrioritySettings priority);
       
   153 
   166 
   154     gint SetCodecCi();
   167     gint SetCodecCi();
   155     void Start();
   168     void Start();
   156     void Stop();
   169     void Stop();
   157     void BufferFilled(const guint buflen);
   170     void BufferFilled(const guint buflen);
   176     gint BadLsfNextBuffer();
   189     gint BadLsfNextBuffer();
   177 
   190 
   178     void SetAudioDeviceL(TMSAudioOutput output);
   191     void SetAudioDeviceL(TMSAudioOutput output);
   179     void GetAudioDeviceL(TMSAudioOutput& output);
   192     void GetAudioDeviceL(TMSAudioOutput& output);
   180 
   193 
       
   194 protected:
       
   195     TMSIPDownlink(TMSIPDevSoundObserver& observer);
       
   196     void ConstructL(const guint32 codecID,
       
   197             const TMMFPrioritySettings priority);
       
   198 
   181 private:
   199 private:
   182     void SetCodecCiL();
   200     void SetCodecCiL();
   183 
   201 
   184 #ifdef __USE_GSTREAMER__
   202 #ifdef __USE_GSTREAMER__
   185     void BufferToBeFilled();
   203     void BufferToBeFilled();
   212     GstElement* iPipelinePlay;
   230     GstElement* iPipelinePlay;
   213     GstElement* iAppSrc;
   231     GstElement* iAppSrc;
   214     GstElement* iSink;
   232     GstElement* iSink;
   215     GstBus* iBusPlay;
   233     GstBus* iBusPlay;
   216 #endif //__USE_GSTREAMER__
   234 #endif //__USE_GSTREAMER__
   217 #ifdef _DEBUG
       
   218     gint iSamplesPlayedCount;
       
   219 #endif
       
   220 
   235 
   221 #ifdef __PLAY_WAV_FROM_FILE__
   236 #ifdef __PLAY_WAV_FROM_FILE__
   222     RFile iFile;
   237     RFile iFile;
   223     gint fsize;
   238     gint fsize;
   224     gint iReadSize;
   239     gint iReadSize;
   240 
   255 
   241 #ifdef __USE_GSTREAMER__
   256 #ifdef __USE_GSTREAMER__
   242     static void cb_record_raw_handoff(GstElement *sink);
   257     static void cb_record_raw_handoff(GstElement *sink);
   243     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   258     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   244 #endif //__USE_GSTREAMER__
   259 #endif //__USE_GSTREAMER__
   245     static TMSIPUplink* NewL(const guint32 codecID,
   260 
   246             const TMMFPrioritySettings priority);
   261     static TMSIPUplink* NewL(TMSIPDevSoundObserver& observer,
   247     TMSIPUplink();
   262             const guint32 codecID, const TMMFPrioritySettings priority);
   248     void ConstructL(const guint32 codecID,
       
   249             const TMMFPrioritySettings priority);
       
   250 
   263 
   251     gint SetCodecCi();
   264     gint SetCodecCi();
   252     void Start();
   265     void Start();
   253     void Stop();
   266     void Stop();
   254     void BufferEmptied();
   267     void BufferEmptied();
   266     gint SetBitrate(guint bitrate);
   279     gint SetBitrate(guint bitrate);
   267     gint GetBitrate(guint& bitrate);
   280     gint GetBitrate(guint& bitrate);
   268     gint SetVad(const TMSFormatType fmttype, const gboolean vad);
   281     gint SetVad(const TMSFormatType fmttype, const gboolean vad);
   269     gint GetVad(const TMSFormatType fmttype, gboolean& vad);
   282     gint GetVad(const TMSFormatType fmttype, gboolean& vad);
   270 
   283 
       
   284 protected:
       
   285     TMSIPUplink(TMSIPDevSoundObserver& observer);
       
   286     void ConstructL(const guint32 codecID,
       
   287             const TMMFPrioritySettings priority);
       
   288 
   271 private:
   289 private:
   272     void SetCodecCiL();
   290     void SetCodecCiL();
   273 
   291 
   274 #ifdef __USE_GSTREAMER__
   292 #ifdef __USE_GSTREAMER__
   275     void BufferToBeEmptied();
   293     void BufferToBeEmptied();
   298     GstElement* iPipelineRec;
   316     GstElement* iPipelineRec;
   299     GstElement* iSource;
   317     GstElement* iSource;
   300     GstElement* iAppSink;
   318     GstElement* iAppSink;
   301     GstBus* iBusRec;
   319     GstBus* iBusRec;
   302 #endif //__USE_GSTREAMER__
   320 #endif //__USE_GSTREAMER__
   303 #ifdef _DEBUG
       
   304     gint iSamplesRecCount;
       
   305 #endif
       
   306     };
   321     };
   307 
   322 
   308 } //namespace TMS
   323 } //namespace TMS
   309 
   324 
   310 #endif  //__IPCALLSTREAM_H
   325 #endif  //__IPCALLSTREAM_H