资源简介
通过ffmpeg把分出264的包,在通过jrtplib库分成rtp包发送出去,供学习用
代码片段和文件信息
/*
* Copyright (c) 2013 Stefano Sabatini
*
* Permission is hereby granted free of charge to any person obtaining a copy
* of this software and associated documentation files (the “Software“) to deal
* in the Software without restriction including without limitation the rights
* to use copy modify merge publish distribute sublicense and/or sell
* copies of the Software and to permit persons to whom the Software is
* furnished to do so subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
* IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @file
* libavformat/libavcodec demuxing and muxing API example.
*
* Remux streams from one container format to another.
* @example remuxing.c
*/
#include
#include
#include
#include
#include
extern “C“
{
#include
#include
#include
}
#define SSRC 100
#define DEST_IP_STR “127.0.0.1“
#define DEST_PORT 1234
#define base_PORT 2222
#define MAX_RTP_PKT_LENGTH 1360
#define H264 96
using namespace jrtplib;
using namespace std;
bool CheckError(int rtperr);
class CRTPSender :
public RTPSession
{
public:
CRTPSender(void);
~CRTPSender(void);
protected:
void OnAPPPacket(RTCPAPPPacket *apppacket const RTPTime &receivetime const RTPAddress *senderaddress);
void OnBYEPacket(RTPSourceData *srcdat);
void OnBYETimeout(RTPSourceData *srcdat);
public:
void SendH264Nalu(unsigned char* m_h264Buf int buflen);
void SetParamsForSendingH264();
};
bool CheckError(int rtperr)
{
if (rtperr < 0)
{
std::cout << “ERROR: “ << RTPGetErrorString(rtperr) << std::endl;
return false;
}
return true;
}
CRTPSender::CRTPSender(void)
{
}
CRTPSender::~CRTPSender(void)
{
}
void CRTPSender::SendH264Nalu(unsigned char* m_h264Buf int buflen)
{
unsigned char *pSendbuf; //发送数据指针
pSendbuf = m_h264Buf;
cout << “1111\n“;
//去除起始码0x000001 或者0x00000001
if( 0x01 == m_h264Buf[2] )
{
pSendbuf = &m_h264Buf[3];
buflen -= 3;
}
else
{
pSendbuf = &m_h264Buf[4];
buflen -= 4;
}
char sendbuf[1430]; //发送的数据缓冲
memset(sendbuf 0 1430);
int status;
printf(“send packet length %d \n“ buflen);
if (buflen <= MAX_RTP_PKT_LENGTH)
{
memcpy(se
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-07-23 20:49 rtp\
目录 0 2019-07-23 20:53 rtp\build\
目录 0 2019-07-23 22:53 rtp\build\rtp\
目录 0 2019-07-23 20:54 rtp\build\rtp\.vs\
目录 0 2019-07-23 20:54 rtp\build\rtp\.vs\rtp\
目录 0 2019-07-23 20:54 rtp\build\rtp\.vs\rtp\v14\
文件 35840 2019-07-23 22:53 rtp\build\rtp\.vs\rtp\v14\.suo
目录 0 2019-07-23 22:52 rtp\build\rtp\Debug\
文件 903674 2019-07-23 22:52 rtp\build\rtp\Debug\main.obj
文件 657 2019-07-23 21:37 rtp\build\rtp\Debug\rtp.Build.CppClean.log
文件 705536 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.exe
文件 2814772 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.ilk
文件 488 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.log
文件 6344704 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.pdb
目录 0 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\
文件 546 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\CL.command.1.tlog
文件 38696 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\CL.read.1.tlog
文件 260 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\CL.write.1.tlog
文件 2194 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\li
文件 3880 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\li
文件 742 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\li
文件 183 2019-07-23 22:52 rtp\build\rtp\Debug\rtp.tlog\rtp.lastbuildstate
文件 1117184 2019-07-23 22:52 rtp\build\rtp\Debug\vc140.idb
文件 970752 2019-07-23 22:52 rtp\build\rtp\Debug\vc140.pdb
文件 17448 2019-07-23 22:52 rtp\build\rtp\main.cpp
文件 39313408 2019-07-23 22:53 rtp\build\rtp\rtp.VC.db
文件 1287 2019-07-23 20:54 rtp\build\rtp\rtp.sln
文件 20064 2019-07-23 21:40 rtp\build\rtp\rtp.vcxproj
文件 22292 2019-07-23 21:36 rtp\build\rtp\rtp.vcxproj.filters
文件 165 2019-07-23 20:54 rtp\build\rtp\rtp.vcxproj.user
目录 0 2019-07-23 21:40 rtp\include\
............此处省略197个文件信息
相关资源
- 从零开始学习音视频编程技术十一
- FFmpeg开发包,适用VS各版本
- ffmpeg一键安装包
- ffmpeg 点播
- Linux 下RTP实时打包发送H.264码流
- 从零开始学习音视频编程技术41 H.26
- live555-20181214基于ARM-linux从网络摄像机
- 局域网音视频广播软件
- ScreenReceiver46接收rtp流解析并解码播放
- Qt+FFMPEG 实现简单的视频播放器
- ffmpeg音频处理
- ffmpeg稳定版本,ffmpeg开发所需库文件
- opencv_3rdparty-ffmpeg-master_20161202.zip
- GES SRTP OPC Server
- 视频服务器 ffmpeg 解决vulkan-1.dll缺失等
- ffmpeg中文手册
- osg通过ffmpeg插件加载视频需要的全部
- ffmpeg转码工具
- ffmpeg工具包
- FFMPEG官方文档
- 从零开始学习音视频编程技术41 H.26
- ffmpeg-3.4.
- ffmpeg实现dxva2硬件加速
- Qt实现RTSP视频流播放器
- Qt基于ffmpeg的rtsp视频流接收播放工具
- 从零开始学习音视频编程技术二十一
- 从零开始学习音视频编程技术二十 之
- 从零开始学习音视频编程技术十一
- 从零开始学习音视频编程技术八 FFM
- Qt+FFMPEG+SDL实现的视频播放器
评论
共有 条评论