资源简介
最简RTSP客户端程序 详细见博客:http://blog.csdn.net/li_wen01/article/details/70260895
代码片段和文件信息
/*=============================================================================
# FileName: rtspRequest.c
# Desc: client connect to RTSP server
# Author: licaibiao
# LastChange: 2017-04-19
=============================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MAXBUF 1024
void Handel_OPTION(char *inbuffer);
void Handel_DESCRIBE(char *inbuffer int sockfd);
void Handel_SETUP(char *inbuffer int sockfd);
void Handel_PLAY(char *inbuffer int sockfdchar *sessionId);
void Handle_PAUSE(char *inbufferint sockfd char *sessionId);
void Handel_Teardown(char *inbuffer int sockfdchar *sessionId);
int intsearch(char * buf char * searchStr int len);
int strsearch(char * buf char * searchStr int lenchar *dest);
int init_udpsocket(int port struct sockaddr_in *servaddr char *mcast_addr);
void release_udpsocket(int socket_fd char *mcast_addr);
void proc_udpsocket(int socket_fd struct sockaddr_in servaddrint flag);
char sendOPTRequstStr[] = “OPTIONS rtsp://192.168.0.6:8554/testStream RTSP/1.0\r\n“;
char userAgentStr[] = “virtual client player\r\n“;
char successfullyReplyStr[] = “RTSP/1.0 200 OK\r\n“;
char sendDESRequstStr[] = “DESCRIBE rtsp://192.168.0.6:8554/testStream RTSP/1.0\r\n“;
char sendSETUPRequstStr[] = “SETUP rtsp://192.168.0.6:8554/testStream/track1 RTSP/1.0\r\n“;
char sendPLAYRequstStr[] = “PLAY rtsp://192.168.0.6:8554/testStream/ RTSP/1.0\r\n“;
char sendTeardownRequestStr[]=“TEARDOWN rtsp://192.168.0.6:8554/testStream/ RTSP/1.0\r\n“;
char sendPauseRequestStr[]=“PAUSE rtsp://192.168.0.6:8554/testStream/ RTSP/1.0\r\n“;
char CseqHeadStr[] = “Cseq: “;
char UserHeadStr[] = “User-Agent: “;
char ApplicationHeadStr[] = “Accept: “;
char TransportHeadStr[] = “Transport: “;
char SessionHeadStr[] = “Session: “;
char RangeHeadStr[] = “Range: “;
int cseqCount=0;
int main(int argc char **argv)
{
int sockfdrtpsockfdrtcpsockfd len;
struct sockaddr_in dest;
struct sockaddr_in RTPAddr;
struct sockaddr_in RTCPAddr;
char serverIP[]=“192.168.0.6“;
char mcast_addr[] = “232.231.110.2“;
char buffer[MAXBUF + 1] = {0};
int serverPort=8554;
int udpPort=0;
cseqCount=0;
/* creat socket for rtsp */
if ((sockfd = socket(AF_INET SOCK_STREAM 0)) < 0) {
perror(“Socket“);
exit(errno);
}
printf(“socket created\n“);
/* init server add and port */
bzero(&dest sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = htons(serverPort);
if (inet_pton(AF_INET serverIP &dest.sin_addr) < 0 ) {
perror(serverIP);
exit(errno);
}
printf(“address created\n“);
/* connect to server */
- 上一篇:最简 jrtplib 收发数据
- 下一篇:ZigBee智能路灯控制系统
相关资源
- 最简 jrtplib 收发数据
- linux下的实时语音聊天程序源码adpcm编
- rocon_devices_kinetic
- rtsp协议详解中文.pdf
- 如何实现最小的RTSP服务器
- mitty多普达smartphone刷机工具
- linux 语音实时对讲
- RTPC sar面目标成像
- rtp/rtcp协议实现源码
- VS2017下用OpenCV实时播放RTSP视频流并截
- 水杉导出pmx插件 ExportPMX
- Rtsp流媒体PC端和手机网页直播代码
- rtsp解析实现音视频实时传输
- linux c下acc打包成RTP并在VLC上播放
- Live555基于h264嵌入式linux下rtsp项目的裁
- QT编写的RTSP播放器各QT版本可完整编译
- onvif设备发现+鉴权认证+RTSP地址获取
- Codejock ChartPro vfp 使用
- rtp解包组包.zip
- 从网络抓包中提取RTP包,RTP解包为H
- infoteam OpenPCS _SmartPLC/Redundant.zip
- RTSPVGA录制,以及推流小工具
- 基于easydarwin实现rtsp拉流新
- RTP流传输音视频
- 将H264码流打成RTP包UDP发送-vlc播放
- h264 h265 rtp打包
- RTSP服务器及客户端测试源代码
- 海思hi3520 rtsp源码
- RTSP Server and Client
- RtspServer实现的源码
评论
共有 条评论