统一成员变量命名风格

This commit is contained in:
xiongziliang
2018-10-24 15:43:52 +08:00
parent 97567ec36d
commit 39baaebc55
74 changed files with 2048 additions and 2048 deletions

View File

@@ -37,19 +37,19 @@ H264Parser::~H264Parser(){
}
void H264Parser::inputH264(const string &h264,uint32_t dts){
m_parser.SetStream((const uint8_t *)h264.data(), h264.size());
_parser.SetStream((const uint8_t *)h264.data(), h264.size());
while (true) {
if(media::H264Parser::kOk != m_parser.AdvanceToNextNALU(&m_nalu)){
if(media::H264Parser::kOk != _parser.AdvanceToNextNALU(&_nalu)){
break;
}
switch (m_nalu.nal_unit_type) {
switch (_nalu.nal_unit_type) {
case media::H264NALU::kNonIDRSlice:
case media::H264NALU::kIDRSlice:{
if(media::H264Parser::kOk == m_parser.ParseSliceHeader(m_nalu, &m_shdr)){
const media::H264SPS *pPps = m_parser.GetSPS(m_shdr.pic_parameter_set_id);
if(media::H264Parser::kOk == _parser.ParseSliceHeader(_nalu, &_shdr)){
const media::H264SPS *pPps = _parser.GetSPS(_shdr.pic_parameter_set_id);
if (pPps) {
m_poc.ComputePicOrderCnt(pPps, m_shdr, &m_iNowPOC);
_poc.ComputePicOrderCnt(pPps, _shdr, &_iNowPOC);
computePts(dts);
}
}
@@ -57,12 +57,12 @@ void H264Parser::inputH264(const string &h264,uint32_t dts){
break;
case media::H264NALU::kSPS:{
int sps_id;
m_parser.ParseSPS(&sps_id);
_parser.ParseSPS(&sps_id);
}
break;
case media::H264NALU::kPPS:{
int pps_id;
m_parser.ParsePPS(&pps_id);
_parser.ParsePPS(&pps_id);
}
break;
default:
@@ -72,33 +72,33 @@ void H264Parser::inputH264(const string &h264,uint32_t dts){
}
void H264Parser::computePts(uint32_t iNowDTS) {
auto iPOCInc = m_iNowPOC - m_iLastPOC;
if (m_shdr.slice_type % 5 == 1) {
auto iPOCInc = _iNowPOC - _iLastPOC;
if (_shdr.slice_type % 5 == 1) {
//这是B帧
m_iNowPTS = m_iLastPTS + m_iMsPerPOC * (iPOCInc);
_iNowPTS = _iLastPTS + _iMsPerPOC * (iPOCInc);
} else {
//这是I帧或者P帧
m_iNowPTS = iNowDTS;
_iNowPTS = iNowDTS;
//计算每一POC的时间
if(iPOCInc == 0){
WarnL << "iPOCInc = 0," << m_iNowPOC << " " << m_iLastPOC;
WarnL << "iPOCInc = 0," << _iNowPOC << " " << _iLastPOC;
}else{
m_iMsPerPOC = (m_iNowPTS - m_iLastPTS) / iPOCInc;
_iMsPerPOC = (_iNowPTS - _iLastPTS) / iPOCInc;
}
m_iLastPTS = m_iNowPTS;
m_iLastPOC = m_iNowPOC;
_iLastPTS = _iNowPTS;
_iLastPOC = _iNowPOC;
}
// DebugL << m_shdr.slice_type
// DebugL << _shdr.slice_type
// <<"\r\nNOW:"
// << m_iNowPOC << " "
// << m_iNowPTS << " "
// << _iNowPOC << " "
// << _iNowPTS << " "
// << iNowDTS << " "
// << "\r\nLST:"
// << m_iLastPOC << " "
// << m_iLastPTS << " "
// << m_iMsPerPOC << endl;
// << _iLastPOC << " "
// << _iLastPTS << " "
// << _iMsPerPOC << endl;
}

View File

@@ -44,29 +44,29 @@ public:
void inputH264(const string &h264,uint32_t dts);
int32_t getPOC() const{
return m_iNowPOC;
return _iNowPOC;
}
int getSliceType() const{
return m_shdr.slice_type;
return _shdr.slice_type;
}
int getNaluType() const{
return m_nalu.nal_unit_type;
return _nalu.nal_unit_type;
}
uint32_t getPts() const{
return m_iNowPTS;
return _iNowPTS;
}
private:
media::H264Parser m_parser;
media::H264POC m_poc;
media::H264NALU m_nalu;
media::H264SliceHeader m_shdr;
media::H264Parser _parser;
media::H264POC _poc;
media::H264NALU _nalu;
media::H264SliceHeader _shdr;
int32_t m_iNowPOC = INT32_MAX;
int32_t m_iLastPOC = INT32_MAX;
int32_t _iNowPOC = INT32_MAX;
int32_t _iLastPOC = INT32_MAX;
uint32_t m_iNowPTS = INT32_MAX;
uint32_t m_iLastPTS = INT32_MAX;
int32_t m_iMsPerPOC = 30;
uint32_t _iNowPTS = INT32_MAX;
uint32_t _iLastPTS = INT32_MAX;
int32_t _iMsPerPOC = 30;
void computePts(uint32_t dts);