rtspstack
Class RtspMsgParser


class RtspMsgParser


Constructor Summary
RtspMsgParser()
           

Method Summary
 static Sptr< RtspMsg >createRtspMsg(const char * data, int bytesNeedtoDecode)
          create the corresponding RtspMsg according the data's first word
 static Sptr< RtspMsg >preParse(const char * data, int bytesNeedtoDecode, int & bytesDecode, Sptr< RtspMsg > savedMsg)
          If the savedMsg is null, it parses the given RTSP data and returns a RtspMsg object with preparsed info filed in.

Constructor Detail

RtspMsgParser

public RtspMsgParser()
Method Detail

createRtspMsg

public static Sptr< RtspMsg > createRtspMsg(const char * data, int bytesNeedtoDecode)
create the corresponding RtspMsg according the data's first word
Parameters:
data - the raw data from TCP stream
oaram bytesNeedtoDecode the bytes available for decoding

preParse

public static Sptr< RtspMsg > preParse(const char * data, int bytesNeedtoDecode, int & bytesDecode, Sptr< RtspMsg > savedMsg)
throws RtspBadDataException
If the savedMsg is null, it parses the given RTSP data and returns a RtspMsg object with preparsed info filed in. The RtspMsg object is allocated in the call and it is the responsibility of the caller to free the memory The returned RtspMsg can be an incomplete rtsp msg to wait for completion; If the savedMsg is not null, it append the savedMsg with more data or complete it and return it after it parses the data.
Parameters:
data - the TcpBufferData get from TCP stream
bytesNeedtoDecode - bytes need to be decoded
bytesDecode - bytes has been decoded after this function
savedMsg - the msg that incomplete from last preparse