当前位置:网站首页>RTP 发送PS流工具(已经开源)
RTP 发送PS流工具(已经开源)
2022-06-27 04:42:00 【qianbo_insist】
RTP接收和发送程序
实时传输协议一直在构建之中,此次听雨堂RTP程序增加了一个PS流发送,以便于GB28181 程序作为测试。
对RTP协议的理解越深,越想自己建立一个实时传输协议。
程序界面还是比较粗糙的,等我更新吧,如果做一个界面,可能还是使用QT,因为界面比较繁复,所以暂时没有做这个的打算,还是先使用MFC来做这个。
发送程序
接收程序
增加了几个选项,目前实现了ps流的发送。
代码地址
https://gitee.com/guanzhi0319/rtp。
ps流的发送
CString audio_device_id = audio_device_index_[cb_select_audio_.GetCurSel()];
CString video_device_id = video_device_index_[cb_select_video_.GetCurSel()];
CWnd *pWnd = GetDlgItem(IDC_VIDEO_PRIVIEW);
CRect rc;
pWnd->GetClientRect(&rc);
CString tmp_str;
edit_ip_.GetWindowText(tmp_str);
std::string ipaddress = CStringA(tmp_str).GetString();
edit_port_.GetWindowText(tmp_str);
int port = _ttoi(tmp_str);
live_ts_encoder_ = new LiveRTPUdpEncoder(audio_device_id, video_device_id, 640, 480,
(OAHWND)pWnd->GetSafeHwnd(), rc.right, rc.bottom, ipaddress,
port);
live_ts_encoder_->setStreamType(0);
live_ts_encoder_->Start();
其中setStreamType是最近修改的主要内容,可以设置成为以下几种方式发送,注意还没有写完,目前实现了rtp ovre udp , ps rtp over udp
typedef enum en_stream_type
{
en_rtp,
en_ts_over_rtp,
en_ps_over_rtp,
en_rtmp,
en_rtsp
}en_stream_type;
void LiveRTPUdpEncoder::OnCaptureVideoBuffer(uint8_t *data, int len, unsigned int timestamp, bool isKeyframe)
{
#define D(x) *(data+x)
if (SimpleThread::IsStop()) return;
#if 0
char buffer[32];
sprintf_s(buffer, "QB:%02x %02x %02x %02x %02x %02x",
D(0), D(1), D(2), D(3), D(4), D(5));
OutputDebugStringA(buffer);
return;
#endif
uint8_t* odata = NULL;
int olen = 0;
uint8_t n = D(4) & 0x1f;
int isIFrame = n == 0x07;
switch (v_stream_type)
{
case en_rtp:
odata = data;
olen = len;
break;
case en_ps_over_rtp:
uint8_t* odata;
int olen;
v_ps.packagingPs(isIFrame, timestamp, data, len, &odata, &olen);
break;
}
//timestamp = GetTimestamp();
{
Lock lock(this);
v_rtp.send_video(odata, olen, convertToRTPTimestamp(), isKeyframe);
if (!gVideoBegin)
gVideoBegin = true;
}
if (v_stream_type == en_ps_over_rtp)
delete[]odata;
}
需要修正的:
1 程序启动先把摄像头打开,可以直接显示
2 在没有摄像头的情况下,可以把窗口直播出去。
以上两点会在近期更新
需要增加的
1 需要增加rtmp发送和rtsp发送。
2 接收程序增加存储到磁盘IO的功能,以利于调试。
边栏推荐
- halcon常用仿射变换算子
- Advanced Mathematics (Seventh Edition) Tongji University exercises 1-10 personal solutions
- Building lightweight target detection based on mobilenet-yolov4
- 010 C language foundation: C function
- 015 basics of C language: C structure and common body
- Kotlin Compose 隐式传参 CompositionLocalProvider
- 微服务系统设计——服务熔断和降级设计
- 百度飞桨“万有引力”2022首站落地苏州,全面启动中小企业赋能计划
- leetcode-20. Valid parentheses -js version
- py2neo基本语法
猜你喜欢

Qchart note 2: add rollover display

1.5 use of CONDA

Microservice system design -- service registration, discovery and configuration design

leetcode-20. Valid parentheses -js version

Why does C throw exceptions when accessing null fields?
![[unity] button of UI interactive component & summary of optional base classes](/img/9f/be9005f03ad9a2bc8da0f910f064c5.png)
[unity] button of UI interactive component & summary of optional base classes

Matlab | visualization of mathematical properties related to three interesting circles

系统架构设计——互联网金融的架构设计

neo4j图数据库基本概念

Redis高可用集群(哨兵、集群)
随机推荐
Common programming abbreviations for orbit attitude
Learn crypto from Buu (Zhou Geng)
Building lightweight target detection based on mobilenet-yolov4
Kotlin Compose compositionLocalOf 与 staticCompositionLocalOf
百度飞桨“万有引力”2022首站落地苏州,全面启动中小企业赋能计划
011 C language basics: C scope rules
008 C language foundation: C judgment
Laptop does not have WiFi option solution
[C language] keyword supplement
MobileNet系列(4):MobileNetv3网络详解
011 C语言基础:C作用域规则
021 basics of C language: recursion, variable parameters
Office VR porn, coquettish operation! The father of Microsoft hololens resigns!
Penetration test - file upload / download / include
pycharm 如何安装 package
Chapter 2 Introduction to key technologies
List of best reading materials for machine learning in communication
Tri rapide (non récursif) et tri de fusion
[station B up dr_can learning notes] Kalman filter 2
016 C语言基础:C语言枚举类型