在做RTP发送实时流前,要做一个测试,用一个从摄像头实时流编码得到的264文件来做模拟,面临读入文件的问题,要把文件中的0x03识别出来,
1晨不变(595024447) 19:54:55
在函数EBSPtoRBSP里
QQ群友提供了一个信息,所以
jm86
//ldecod/inc/defines.h
//Start code and Emulation Prevention need this to be defined in identical manner at encoder and decoder
#define ZEROBYTES_SHORTSTARTCODE 2 //indicates the number of zero bytes in the short start-code prefix
//ldecod\src\nal.c
int EBSPtoRBSP(byte *streamBuffer, int end_bytepos, int begin_bytepos)
{
int i, j, count;
count = 0;
if(end_bytepos < begin_bytepos)
return end_bytepos;
j = begin_bytepos;
for(i = begin_bytepos; i < end_bytepos; i++)
{ //starting from begin_bytepos to avoid header information
if(count == ZEROBYTES_SHORTSTARTCODE && streamBuffer[i] == 0x03)
{
i++;
count = 0;
}
streamBuffer[j] = streamBuffer[i];
if(streamBuffer[i] == 0x00)
count++;
else
count = 0;
j++;
}
return j;
}