live555异步rtsp客户端

发布于 2024-09-01 14:21:57 字数 1436 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事↓在人 2024-09-08 14:21:58

live555 API 中同步和异步之间的主要区别在于您现在必须在 RTSP 请求中指定处理程序。一旦 DESCRIBE 请求完成,您的处理程序将从 live555 事件循环中调用。

在 RTSPClient.hh 中,responseHandler 定义为:

typedef void (responseHandler)(RTSPClient* rtspClient,
             int resultCode, char* resultString);

当调用您的处理程序时,live555 将为您提供以下信息:

  • 发出命令的 RTSP 客户端 ->这允许您随后调用下一个 RTSP 方法。

  • 结果代码,成功时为 0,如果服务器返回 RTSP 错误代码,则为正;如果发生某些网络/套接字错误,则结果代码为负。

使用此信息来决定如何在处理程序中继续进行。查看 RTSPClient.hh,其中解释了所有这些内容。

例如,这意味着当您想要调用 sendDescribeCommand 方法时:

unsigned sendDescribeCommand(responseHandler* responseHandler, 
         Authenticator* authenticator = NULL);

您必须指定一旦 DESCRIBE 完成,将调用哪个处理程序(签名responseHandler)。然后,在处理程序中,您必须根据结果代码决定是否要执行 SETUP(再次指定处理程序)或终止(如果发生某些错误)。

正如 jenseb 所建议的,openRTSP 客户端提供了一个非常好的起点。

The main difference between synchronous and asynchronous in the live555 API is that you must now specify a handler in an RTSP request. Your handler will be called from the live555 eventloop once the DESCRIBE request has completed.

In RTSPClient.hh responseHandler is defined as:

typedef void (responseHandler)(RTSPClient* rtspClient,
             int resultCode, char* resultString);

When your handler is called, live555 will give you the following information:

  • The RTSP client on which the command was issued -> this allows you to subsequently call the next RTSP method.

  • The result code which is 0 on success, positive if an RTSP error code was returned by the server, and negative if some network/socket error occurred.

Use this info to decide how to proceed in your handler. Have a look at RTSPClient.hh where all of this is explained.

E.g. This means that when you want to call the sendDescribeCommand method:

unsigned sendDescribeCommand(responseHandler* responseHandler, 
         Authenticator* authenticator = NULL);

You must specify which handler (of signature responseHandler) will be called once the DESCRIBE has been completed. In your handler you must then decide based on the result code, whether you want to do a SETUP (again specifying a handler) or terminate (if some error occurred).

As jenseb suggested the openRTSP client provides a very good starting point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文