-
大小: 15.22MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2023-08-01
- 語(yǔ)言: 其他
- 標(biāo)簽: H264ffmpeg??
資源簡(jiǎn)介
Jrtplib發(fā)送H264數(shù)據(jù),ffmpeg解碼+VFW播放視頻
代碼片段和文件信息
//?My01.cpp?:?定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//
#include?“stdafx.h“
#include?“rtpsession.h“
#include?“rtpudpv4transmitter.h“
#include?“rtpipv4address.h“
#include?“rtpsessionparams.h“
#include?“rtperrors.h“
#include?“rtplibraryversion.h“
#include?
#include?
#include?
#include?
using?namespace?jrtplib;
//jrtplib應(yīng)用需鏈接的lib??
#pragma?comment(lib“ws2_32.lib“)??
#pragma?comment(lib?“jrtplib_d.lib“)??
#define?MAXLEN (RTP_DEFAULTPACKETSIZE?-?100)??//默認(rèn)值是1400
//
//?This?function?checks?if?there?was?a?RTP?error.?If?so?it?displays?an?error
//?message?and?exists.
//
void?checkerror(int?rtperr)
{
if?(rtperr?0)
{
std::cout?<“ERROR:?“?< exit(-1);
}
}
class?MyRTPSession?:?public?RTPSession
{
???public:??
??MyRTPSession(void);??
??~MyRTPSession(void);?
??void?SendH264Nalu(RTPSession*?sessuint8_t*?m_h264Bufint?buflen);???
???protected:??
};
MyRTPSession::MyRTPSession(void){}??
MyRTPSession::~MyRTPSession(void){}
void?MyRTPSession::SendH264Nalu(RTPSession*?sessuint8_t?*h264bufint?buflen){??
int?status;??
uint8_t?*pSendbuf;?
pSendbuf?=?h264buf;??
if(buflen?<=?MAXLEN)
{???
sess->SetDefaultMark(true);??
status?=?sess->SendPacket((void?*)&pSendbuf[0]buflen);??
checkerror(status);
printf(“send_packt?0?len?=?%d\n“buflen);??
}????
else?if(buflen?>?MAXLEN)
{??
int?send_packet?=?0;
int?all_packet??=?0;
int?over_data???=?0;
int?iSendLen;??
all_packet??=?buflen?/?MAXLEN;??
over_data???=?buflen?%?MAXLEN;??????
send_packet?=?0;???
while((send_packet?0)))????
{????
printf(“send_packet?=?%d?\n“send_packet);
/*?the?first?packet?or?the?second?last?packet?*/
if((0?==?send_packet)?||?(send_packet {??
sess->SetDefaultMark(false);??
status?=?sess->SendPacket((void?*)&pSendbuf[send_packet*MAXLEN]MAXLEN);??
checkerror(status);??
//printf(“send_packet?=?%d?\n“send_packet);
send_packet++;??
}??
/*?the?last?packet?*/
else?if(((all_packet==send_packet)?&&?over_data>0)?||?((send_packet==?(all_packet-1))&&?over_data==0))??
{??
sess->SetDefaultMark(true);???//表示分包的最后一包
if?(?over_data?>?0)??
{??
iSendLen?=?buflen?-?send_packet*MAXLEN;??
}??
else
{
iSendLen?=?MAXLEN;??
}
status?=?sess->SendPacket((void?*)&pSendbuf[send_packet*MAXLEN]iSendLen);??
checkerror(status);??
send_packet++;??
printf(“send_packet?=?%d?\n“send_packet);
}??
}??
}??
}?
int?_tmain(int?argc?_TCHAR*?argv[])
{
#ifdef?RTP_SOCKETTYPE_WINSOCK
WSADATA?dat;
WSAStartup(MAKEWORD(22)&dat);
#endif?//?RTP_SOCKETTYPE_WINSOCK
int?i;
int?num;
int?status;
RTPSession?sess;
MyRTPSession?sender;
uint16_t?portbase?=?12348;??
uint16_t?destport?=?12346;???//目的端口
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????2908??2017-07-04?14:39??VFW_?show_H264\rtpSender\My01\Include\rtpconfig.h
?????文件???????1777??2017-07-04?14:39??VFW_?show_H264\rtpSender\My01\Include\rtplibraryversioninternal.h
?????文件????????254??2017-07-04?14:39??VFW_?show_H264\rtpSender\My01\Include\rtptypes.h
?????文件????2276790??2017-07-04?14:49??VFW_?show_H264\rtpSender\My01\Lib\jrtplib.lib
?????文件????7672032??2017-07-04?14:47??VFW_?show_H264\rtpSender\My01\Lib\jrtplib_d.lib
?????文件??????12446??2017-07-04?14:12??VFW_?show_H264\rtpSender\My01\Lib\jthread.lib
?????文件??????58882??2017-07-04?14:11??VFW_?show_H264\rtpSender\My01\Lib\jthread_d.lib
?????文件???????5233??2017-07-22?16:11??VFW_?show_H264\rtpSender\My01\My01.cpp
?????文件???????4515??2017-07-05?10:47??VFW_?show_H264\rtpSender\My01\My01.vcxproj
?????文件???????1308??2017-07-05?10:41??VFW_?show_H264\rtpSender\My01\My01.vcxproj.filters
?????文件????????143??2017-07-05?10:41??VFW_?show_H264\rtpSender\My01\My01.vcxproj.user
?????文件???????1532??2017-07-05?10:41??VFW_?show_H264\rtpSender\My01\ReadMe.txt
?????文件???????3907??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\CMakeLists.txt
?????文件????????481??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\errcodecommand
?????文件??????34279??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\extratransmitters\rtpfaketransmitter.cpp
?????文件???????9009??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\extratransmitters\rtpfaketransmitter.h
?????文件????????757??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\reformaterrors.py
?????文件???????2697??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpapppacket.cpp
?????文件???????3703??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpapppacket.h
?????文件???????2943??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpbyepacket.cpp
?????文件???????4049??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpbyepacket.h
?????文件???????5897??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpcompoundpacket.cpp
?????文件???????4164??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpcompoundpacket.h
?????文件??????22746??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpcompoundpacketbuilder.cpp
?????文件??????12166??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcpcompoundpacketbuilder.h
?????文件???????2224??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcppacket.cpp
?????文件???????3001??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcppacket.h
?????文件??????18777??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcppacketbuilder.cpp
?????文件??????11786??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcppacketbuilder.h
?????文件???????3209??2017-03-28?18:59??VFW_?show_H264\rtpSender\My01\src\rtcprrpacket.cpp
............此處省略420個(gè)文件信息
評(píng)論
共有 條評(píng)論