添加H265相关接口

This commit is contained in:
xiongziliang 2019-11-01 15:40:21 +08:00
parent 0bff2ad176
commit a30a83d665
2 changed files with 39 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "Util/TimeTicker.h"
#include "Extension/AAC.h"
#include "Extension/H264.h"
#include "Extension/H265.h"
using namespace toolkit;
@ -106,6 +107,24 @@ void DevChannel::inputH264(const char* pcData, int iDataLen, uint32_t dts,uint32
inputFrame(std::make_shared<H264FrameNoCacheAble>((char *)pcData,iDataLen,dts,pts,prefixeSize));
}
void DevChannel::inputH265(const char* pcData, int iDataLen, uint32_t dts,uint32_t pts) {
if(dts == 0){
dts = (uint32_t)_aTicker[0].elapsedTime();
}
if(pts == 0){
pts = dts;
}
int prefixeSize;
if (memcmp("\x00\x00\x00\x01", pcData, 4) == 0) {
prefixeSize = 4;
} else if (memcmp("\x00\x00\x01", pcData, 3) == 0) {
prefixeSize = 3;
} else {
prefixeSize = 0;
}
inputFrame(std::make_shared<H265FrameNoCacheAble>((char *)pcData,iDataLen,dts,pts,prefixeSize));
}
void DevChannel::inputAAC(const char* pcData, int iDataLen, uint32_t uiStamp,bool withAdtsHeader) {
if(withAdtsHeader){
inputAAC(pcData+7,iDataLen-7,uiStamp,pcData);
@ -135,6 +154,11 @@ void DevChannel::initVideo(const VideoInfo& info) {
addTrack(std::make_shared<H264Track>());
}
void DevChannel::initH265Video(const VideoInfo &info){
_video = std::make_shared<VideoInfo>(info);
addTrack(std::make_shared<H265Track>());
}
void DevChannel::initAudio(const AudioInfo& info) {
_audio = std::make_shared<AudioInfo>(info);
addTrack(std::make_shared<AACTrack>());

View File

@ -88,6 +88,12 @@ public:
*/
void initVideo(const VideoInfo &info);
/**
* h265视频Track
* @param info
*/
void initH265Video(const VideoInfo &info);
/**
* aac音频Track
* MultiMediaSourceMuxer::addTrack(AACTrack::Ptr );
@ -104,6 +110,15 @@ public:
*/
void inputH264(const char *pcData, int iDataLen, uint32_t dts,uint32_t pts = 0);
/**
* 265
* @param pcData 265
* @param iDataLen
* @param dts 0
* @param pts 0dts
*/
void inputH265(const char *pcData, int iDataLen, uint32_t dts,uint32_t pts = 0);
/**
* adts头的aac帧
* @param pcDataWithAdts adts头的aac帧