mmserv/tms/tmscallserver/inc/tmsipcallstream.h
changeset 31 8dfd592727cb
parent 14 80975da52420
child 53 eabc8c503852
equal deleted inserted replaced
22:128eb6a32b84 31:8dfd592727cb
    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 // -----------------------------------------------------------------------------
    76         };
    89         };
    77 
    90 
    78 public:
    91 public:
    79     virtual ~TMSIPCallStreamBase();
    92     virtual ~TMSIPCallStreamBase();
    80 
    93 
    81     virtual void Start() = 0;
    94     virtual void Start(const gint retrytime) = 0;
    82     virtual void Stop() = 0;
    95     virtual void Stop() = 0;
    83     virtual gint SetCodecCi() = 0;
    96     virtual gint SetCodecCi() = 0;
    84 
    97 
    85 #ifndef __USE_GSTREAMER__
    98 #ifndef __USE_GSTREAMER__
    86     void InitDevSoundL(const TMMFState aDevSoundState,
    99     void InitDevSoundL(const TMMFState aDevSoundState,
    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,
   166             const gint retrytime);
   152             const TMMFPrioritySettings priority);
       
   153 
   167 
   154     gint SetCodecCi();
   168     gint SetCodecCi();
   155     void Start();
   169     void Start(const gint retrytime);
   156     void Stop();
   170     void Stop();
   157     void BufferFilled(const guint buflen);
   171     void BufferFilled(const guint buflen);
   158     gint SetVolume(const guint volume);
   172     gint SetVolume(const guint volume);
   159     gint GetVolume(guint& volume);
   173     gint GetVolume(guint& volume);
   160     gint GetMaxVolume(guint& volume);
   174     gint GetMaxVolume(guint& volume);
   176     gint BadLsfNextBuffer();
   190     gint BadLsfNextBuffer();
   177 
   191 
   178     void SetAudioDeviceL(TMSAudioOutput output);
   192     void SetAudioDeviceL(TMSAudioOutput output);
   179     void GetAudioDeviceL(TMSAudioOutput& output);
   193     void GetAudioDeviceL(TMSAudioOutput& output);
   180 
   194 
       
   195 protected:
       
   196     TMSIPDownlink(TMSIPDevSoundObserver& observer);
       
   197     void ConstructL(const guint32 codecID,
       
   198             const TMMFPrioritySettings priority, const gint retrytime);
       
   199 
   181 private:
   200 private:
   182     void SetCodecCiL();
   201     void SetCodecCiL();
   183 
   202 
   184 #ifdef __USE_GSTREAMER__
   203 #ifdef __USE_GSTREAMER__
   185     void BufferToBeFilled();
   204     void BufferToBeFilled();
   212     GstElement* iPipelinePlay;
   231     GstElement* iPipelinePlay;
   213     GstElement* iAppSrc;
   232     GstElement* iAppSrc;
   214     GstElement* iSink;
   233     GstElement* iSink;
   215     GstBus* iBusPlay;
   234     GstBus* iBusPlay;
   216 #endif //__USE_GSTREAMER__
   235 #endif //__USE_GSTREAMER__
   217 #ifdef _DEBUG
       
   218     gint iSamplesPlayedCount;
       
   219 #endif
       
   220 
   236 
   221 #ifdef __PLAY_WAV_FROM_FILE__
   237 #ifdef __PLAY_WAV_FROM_FILE__
   222     RFile iFile;
   238     RFile iFile;
   223     gint fsize;
   239     gint fsize;
   224     gint iReadSize;
   240     gint iReadSize;
   240 
   256 
   241 #ifdef __USE_GSTREAMER__
   257 #ifdef __USE_GSTREAMER__
   242     static void cb_record_raw_handoff(GstElement *sink);
   258     static void cb_record_raw_handoff(GstElement *sink);
   243     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   259     static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
   244 #endif //__USE_GSTREAMER__
   260 #endif //__USE_GSTREAMER__
   245     static TMSIPUplink* NewL(const guint32 codecID,
   261 
   246             const TMMFPrioritySettings priority);
   262     static TMSIPUplink* NewL(TMSIPDevSoundObserver& observer,
   247     TMSIPUplink();
   263             const guint32 codecID, const TMMFPrioritySettings priority,
   248     void ConstructL(const guint32 codecID,
   264             const gint retrytime);
   249             const TMMFPrioritySettings priority);
       
   250 
   265 
   251     gint SetCodecCi();
   266     gint SetCodecCi();
   252     void Start();
   267     void Start(const gint retrytime);
   253     void Stop();
   268     void Stop();
   254     void BufferEmptied();
   269     void BufferEmptied();
   255     gint SetGain(const guint gain);
   270     gint SetGain(const guint gain);
   256     gint GetGain(guint& gain);
   271     gint GetGain(guint& gain);
   257     gint GetMaxGain(guint& gain);
   272     gint GetMaxGain(guint& gain);
   266     gint SetBitrate(guint bitrate);
   281     gint SetBitrate(guint bitrate);
   267     gint GetBitrate(guint& bitrate);
   282     gint GetBitrate(guint& bitrate);
   268     gint SetVad(const TMSFormatType fmttype, const gboolean vad);
   283     gint SetVad(const TMSFormatType fmttype, const gboolean vad);
   269     gint GetVad(const TMSFormatType fmttype, gboolean& vad);
   284     gint GetVad(const TMSFormatType fmttype, gboolean& vad);
   270 
   285 
       
   286 protected:
       
   287     TMSIPUplink(TMSIPDevSoundObserver& observer);
       
   288     void ConstructL(const guint32 codecID,
       
   289             const TMMFPrioritySettings priority, const gint retrytime);
       
   290 
   271 private:
   291 private:
   272     void SetCodecCiL();
   292     void SetCodecCiL();
   273 
   293 
   274 #ifdef __USE_GSTREAMER__
   294 #ifdef __USE_GSTREAMER__
   275     void BufferToBeEmptied();
   295     void BufferToBeEmptied();
   298     GstElement* iPipelineRec;
   318     GstElement* iPipelineRec;
   299     GstElement* iSource;
   319     GstElement* iSource;
   300     GstElement* iAppSink;
   320     GstElement* iAppSink;
   301     GstBus* iBusRec;
   321     GstBus* iBusRec;
   302 #endif //__USE_GSTREAMER__
   322 #endif //__USE_GSTREAMER__
   303 #ifdef _DEBUG
       
   304     gint iSamplesRecCount;
       
   305 #endif
       
   306     };
   323     };
   307 
   324 
   308 } //namespace TMS
   325 } //namespace TMS
   309 
   326 
   310 #endif  //__IPCALLSTREAM_H
   327 #endif  //__IPCALLSTREAM_H