// RtstClientTest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "RtspRequest.h"
#include "Rtp.h"
RtspRequest g_RtspRequest;
int _tmain(int argc, _TCHAR* argv[])
{
// 接收 ========================================================
string url = "rtsp://192.168.1.1:554/aacAudioTest";
string setupName = "aacAudioTest";
INT rtpPort = 8080;
INT rtcpPort = rtpPort + 2;
string sdp;
INT64 sess;
g_RtspRequest.Open(url.c_str(), "127.0.0.0", 0);
g_RtspRequest.RequestOptions();
g_RtspRequest.RequestDescribe(&sdp);
g_RtspRequest.RequestSetup(setupName.c_str(), transportModeRtpUdp, rtpPort , rtcpPort , &sess);
g_RtspRequest.RequestPlay();
Rtp* pRtp = new Rtp();
pRtp->Open("127.0.0.0", rtpPort);

本文提供了一个C++实现的RTSP客户端样例,通过打开、请求、播放、暂停和关闭一系列操作来接收RTSP流。示例中展示了如何连接到指定URL,设置端口,读取RTP数据包并处理接收到的数据。

2万+

被折叠的 条评论
为什么被折叠?



