资源简介
打包发送采用了两种方式
1.使用socket套接字发送RTP打包的H264
2.使用jrtplib发送RTP打包的H264
可以通过VLC或者MPlayer解码播放
详见博客:http://blog.csdn.net/caoshangpa/article/details/53009604
代码片段和文件信息
#include
#include
#include
#include
#include “h264.h“
#include “iostream“
#include
#include “rtpsession.h“
#include “rtpudpv4transmitter.h“
#include “rtpipv4address.h“
#include “rtpsessionparams.h“
#include “rtperrors.h“
#include “rtppacket.h“
using namespace jrtplib;
typedef struct
{
int startcodeprefix_len; //! 4 for parameter sets and first slice in picture 3 for everything else (suggested)
unsigned len; //! Length of the NAL unit (Excluding the start code which does not belong to the NALU)
unsigned max_size; //! Nal Unit Buffer size
int forbidden_bit; //! should be always FALSE
int nal_reference_idc; //! NALU_PRIORITY_xxxx
int nal_unit_type; //! NALU_TYPE_xxxx
char *buf; //! contains the first byte followed by the RBSP
unsigned short lost_packets; //! true if packet loss is detected
} NALU_t;
FILE *bits = NULL; //! the bit stream file
static int FindStartCode2(unsigned char *Buf);//查找开始字符0x000001
static int FindStartCode3(unsigned char *Buf);//查找开始字符0x00000001
static int info2=0 info3=0;
RTP_FIXED_HEADER *rtp_hdr;
NALU_HEADER *nalu_hdr;
FU_INDICATOR *fu_ind;
FU_HEADER *fu_hdr;
//为NALU_t结构体分配内存空间
NALU_t *AllocNALU(int buffersize)
{
NALU_t *n;
if ((n = (NALU_t*)calloc (1 sizeof (NALU_t))) == NULL)
{
printf(“AllocNALU: n“);
exit(0);
}
n->max_size=buffersize;
if ((n->buf = (char*)calloc (buffersize sizeof (char))) == NULL)
{
free (n);
printf (“AllocNALU: n->buf“);
exit(0);
}
return n;
}
//释放
void FreeNALU(NALU_t *n)
{
if (n)
{
if (n->buf)
{
free(n->buf);
n->buf=NULL;
}
free (n);
}
}
void OpenBitstreamFile (char *fn)
{
if (NULL == (bits=fopen(fn “rb“)))
{
printf(“open file error\n“);
exit(0);
}
}
//这个函数输入为一个NALU_t结构体,主要功能为得到一个完整的NALU并保存在NALU_t的buf中,
//获取他的长度,填充FIDCTYPE位。
//并且返回两个开始字符之间间隔的字节数,即包含有前缀的NALU的长度
int GetAnnexbNALU (NALU_t *nalu)
{
int pos = 0;
int StartCodeFound rewind;
unsigned char *Buf;
if ((Buf = (unsigned char*)calloc (nalu->max_size sizeof(char))) == NULL)
printf (“GetAnnexbNALU: Could not allocate Buf memory\n“);
nalu->startcodeprefix_len=3;//初始化码流序列的开始字符为3个字节
if (3 != fread (Buf 1 3 bits))//从码流中读3个字节
{
free(Buf);
return 0;
}
info2 = FindStartCode2 (Buf);//判断是否为0x000001
if(info2 != 1)
{
//如果不是,再读一个字节
if(1 != fread(Buf+3 1 1 bits))//读一个字节
{
free(Buf);
return 0;
}
info3 = FindStartCode3 (Buf);//判断是否为0x00000001
if (info3 != 1)//如果不是,返回-1
{
free(Buf);
retur
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 93550 2012-02-28 19:45 Qt RTP H264\SendH264ToVLCWithJrtplib\176144.264
文件 25821394 2016-11-07 12:00 Qt RTP H264\SendH264ToVLCWithJrtplib\480320.264
文件 845926 2016-01-14 15:08 Qt RTP H264\SendH264ToVLCWithJrtplib\debug\libjrtplib.dll
文件 48394 2016-01-14 14:10 Qt RTP H264\SendH264ToVLCWithJrtplib\debug\libjthread.dll
文件 150336 2016-11-07 15:36 Qt RTP H264\SendH264ToVLCWithJrtplib\debug\main.o
文件 183233 2016-11-07 15:36 Qt RTP H264\SendH264ToVLCWithJrtplib\debug\SendH264ToVLCWithJrtplib.exe
文件 2956 2016-11-04 12:32 Qt RTP H264\SendH264ToVLCWithJrtplib\h264.h
文件 3703 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpapppacket.h
文件 4049 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpbyepacket.h
文件 4164 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpcompoundpacket.h
文件 12166 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpcompoundpacketbuilder.h
文件 3001 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcppacket.h
文件 11786 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcppacketbuilder.h
文件 6533 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcprrpacket.h
文件 7359 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpscheduler.h
文件 8306 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpsdesinfo.h
文件 10914 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpsdespacket.h
文件 7947 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpsrpacket.h
文件 2811 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtcpunknownpacket.h
文件 3561 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpaddress.h
文件 3765 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpbyteaddress.h
文件 3224 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpcollisionlist.h
文件 2374 2015-11-25 14:24 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpconfig.h
文件 1876 2011-02-02 10:45 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpdebug.h
文件 3098 2011-02-02 10:45 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpdefines.h
文件 11016 2011-08-29 15:43 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtperrors.h
文件 9145 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpexternaltransmitter.h
文件 8556 2011-08-29 15:43 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtphashtable.h
文件 4690 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpinternalsourcedata.h
文件 4087 2011-08-29 15:03 Qt RTP H264\SendH264ToVLCWithJrtplib\include\jrtplib\rtpipv4address.h
............此处省略69个文件信息
- 上一篇:Qt加载百度离线地图
- 下一篇:Web安全攻防:渗透测试实战指南 PDF 全书
相关资源
- Qt加载百度离线地图
- QT5做的打地鼠
- Qt培训详细教程含2个项目源码
- 基于嵌入式QT界面GPS定位系统
- QT编程电子书,适合入门学习
- 软件打包小工具2.0版本
- vs2010+qt四则混合运算计算器
- STM32CubeMX通过ESP8266 AT指令MQTT上阿里云
- qt-vsaddin-msvc2019-2.5.1.vsix
- 点名抽答程序QT
- QT 串口助手软件加源码,有示波器功
- qtOpenCVTools v1.7.0.rar
- 利用VS2010 和qt 4.8.4编写的加法计算器
- QT电子词典
- QT5串口助手源码+动态库发布程序+打包
- emqttd-windows7-v2.3.0.zip
- 精通QT4编程QT4编程的经典书籍
- 用QT做一个简单的登录界面
- Qt实现的迷宫游戏_可执行程序迷宫生
-
MQTT单片机编程小工具(阿里云li
n - OpenCV 4.2.0 && Qt5.14.1 编译好的库
- Qt开发的海康威视摄像头开发
- 基于linux的QT4精彩分析上
- Qt基于librtmp推送H.264
- h.264和mpeg-4视频压缩--欧阳合译中文清
- QCefView.zip
- Qt书籍大全
- cef_binary_78.3.9+gc7345f2+chromium-78.0.3904.
- Qt实现的百度在线地图与离线地图利用
- 嵌入式Qt开发项目教程
评论
共有 条评论