简体   繁体   中英

How to parse RTSP request and response headers?

I'm in the middle of building an RTSP server, and am creating two request/response objects named TRTSPRequest and TRTSPResponse similar to TWebRequest and TWebResponse but specific to RTSP. I have a feeling I'm re-inventing the wheel and that there's a much easier path I can take here. I've gotten 400 lines of code into creating this server, and most of it is just parsing the request headers.

Is there something in Delphi XE2 / Indy 10 I can re-use that can parse the RTSP headers for me? Or am I stuck having to parse it all myself?

Since RTSP is very similar to HTTP, can I use the HTTP request/response objects? Or will it get confused by the RTSP structure?

For example, can I use IdHTTPHeaderInfo.pas and tweak it all for RTSP and call it IdRTSPHeaderInfo.pas ?

According to RFC 2326 ...

Easy to parse: RTSP can be parsed by standard HTTP or MIME parsers.

and

HTTP-friendly: Where sensible, RTSP reuses HTTP concepts, so that the existing infrastructure can be reused. This infrastructure includes PICS (Platform for Internet Content Selection [15,16]) for associating labels with content. However, RTSP does not just add methods to HTTP since the controlling continuous media requires server state in most cases.

So how should I do this?

At this point I can only suggest useful documentation & libraries,

take a look at LIVE555 Streaming Media C++ Libraries which include full source code and examples on how to properly implement/build basic RTSP clients and servers, it's without doubt one of the very few websites that host as much valuable information about the RTSP standard.

Unfortunately this is all in C++ but it shouldn't stop you from checking out their incredibly well documented code as well as examples which vary from the most basic principle of RTSP communication between client and server to more advanced cases.

Another way might be to manipulate the openRTSP command line program in a way that would allow you to use it with your Delphi application.

On point, it doesn't seem there's any easy way to go about this, most if not all Delphi wrappers/translations for such Streaming libraries are not for free and are quite expensive

best of luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM