本文整理汇总了C++中CGolombBuffer::IsEOF方法的典型用法代码示例。如果您正苦于以下问题:C++ CGolombBuffer::IsEOF方法的具体用法?C++ CGolombBuffer::IsEOF怎么用?C++ CGolombBuffer::IsEOF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGolombBuffer
的用法示例。
在下文中一共展示了CGolombBuffer::IsEOF方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void CompositionObject::Dvb4PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, short& nX, short& nY)
{
bool bQuit = false;
while (!bQuit && !gb.IsEOF()) {
short nCount = 0;
BYTE nPaletteIndex = 0;
BYTE bTemp = (BYTE)gb.BitRead(4);
if (bTemp != 0) {
nPaletteIndex = bTemp;
nCount = 1;
} else {
if (gb.BitRead(1) == 0) { // switch_1
nCount = (short)gb.BitRead(3); // run_length_3-9
if (nCount != 0) {
nCount += 2;
} else {
bQuit = true;
}
} else {
if (gb.BitRead(1) == 0) { // switch_2
nCount = 4 + (short)gb.BitRead(2); // run_length_4-7
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
} else {
switch (gb.BitRead(2)) { // switch_3
case 0:
nCount = 1;
break;
case 1:
nCount = 2;
break;
case 2: // if (switch_3 == '10')
nCount = 9 + (short)gb.BitRead(4); // run_length_9-24
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
break;
case 3:
nCount = 25 + gb.ReadByte(); // run_length_25-280
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
break;
}
}
}
}
#if 0
if (nX + nCount > m_width) {
ASSERT(FALSE);
break;
}
#endif
if (nCount > 0) {
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例2: while
void CompositionObject::Dvb2PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, short& nX, short& nY)
{
BYTE bTemp;
BYTE nPaletteIndex = 0;
short nCount;
bool bQuit = false;
while (!bQuit && !gb.IsEOF()) {
nCount = 0;
nPaletteIndex = 0;
bTemp = (BYTE)gb.BitRead(2);
if (bTemp != 0) {
nPaletteIndex = bTemp;
nCount = 1;
} else {
if (gb.BitRead(1) == 1) { // switch_1
nCount = 3 + (short)gb.BitRead(3); // run_length_3-9
nPaletteIndex = (BYTE)gb.BitRead(2);
} else {
if (gb.BitRead(1) == 0) { // switch_2
switch (gb.BitRead(2)) { // switch_3
case 0:
bQuit = true;
break;
case 1:
nCount = 2;
break;
case 2: // if (switch_3 == '10')
nCount = 12 + (short)gb.BitRead(4); // run_length_12-27
nPaletteIndex = (BYTE)gb.BitRead(2); // 4-bit_pixel-code
break;
case 3:
nCount = 29 + gb.ReadByte(); // run_length_29-284
nPaletteIndex = (BYTE)gb.BitRead(2); // 4-bit_pixel-code
break;
}
} else {
nCount = 1;
}
}
}
if (nX + nCount > m_width) {
ASSERT(FALSE);
break;
}
if (nCount > 0) {
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例3: while
void CompositionObject::Dvb8PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, SHORT& nX, SHORT& nY)
{
BYTE bTemp;
BYTE nPaletteIndex = 0;
SHORT nCount;
bool bQuit = false;
while(!bQuit && !gb.IsEOF())
{
nCount = 0;
nPaletteIndex = 0;
bTemp = gb.ReadByte();
if(bTemp != 0)
{
nPaletteIndex = bTemp;
nCount = 1;
}
else
{
if(gb.BitRead(1) == 0) // switch_1
{
nCount = (SHORT)gb.BitRead(7); // run_length_1-127
if(nCount == 0)
bQuit = true;
}
else
{
nCount = (SHORT)gb.BitRead(7); // run_length_3-127
nPaletteIndex = gb.ReadByte();
}
}
if(nX + nCount > m_width)
{
ASSERT(FALSE);
break;
}
if(nCount > 0)
{
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例4: ParseSample
HRESULT CHdmvSub::ParseSample(IMediaSample* pSample)
{
CheckPointer (pSample, E_POINTER);
HRESULT hr;
REFERENCE_TIME rtStart = INVALID_TIME, rtStop = INVALID_TIME;
BYTE* pData = NULL;
int lSampleLen;
hr = pSample->GetPointer(&pData);
if(FAILED(hr) || pData == NULL) {
return hr;
}
lSampleLen = pSample->GetActualDataLength();
pSample->GetTime(&rtStart, &rtStop);
if (pData) {
CGolombBuffer SampleBuffer (pData, lSampleLen);
while (!SampleBuffer.IsEOF()) {
if (m_nCurSegment == NO_SEGMENT) {
HDMV_SEGMENT_TYPE nSegType = (HDMV_SEGMENT_TYPE)SampleBuffer.ReadByte();
USHORT nUnitSize = SampleBuffer.ReadShort();
lSampleLen -=3;
switch (nSegType) {
case PALETTE :
case OBJECT :
case PRESENTATION_SEG :
case END_OF_DISPLAY :
m_nCurSegment = nSegType;
AllocSegment (nUnitSize);
break;
case WINDOW_DEF :
case INTERACTIVE_SEG :
case HDMV_SUB1 :
case HDMV_SUB2 :
// Ignored stuff...
SampleBuffer.SkipBytes(nUnitSize);
break;
default :
return VFW_E_SAMPLE_REJECTED;
}
}
if (m_nCurSegment != NO_SEGMENT) {
if (m_nSegBufferPos < m_nSegSize) {
int nSize = min (m_nSegSize-m_nSegBufferPos, lSampleLen);
SampleBuffer.ReadBuffer (m_pSegBuffer+m_nSegBufferPos, nSize);
m_nSegBufferPos += nSize;
}
if (m_nSegBufferPos >= m_nSegSize) {
CGolombBuffer SegmentBuffer (m_pSegBuffer, m_nSegSize);
switch (m_nCurSegment) {
case PALETTE :
TRACE_HDMVSUB ("CHdmvSub:PALETTE rtStart=%10I64d\n", rtStart);
ParsePalette(&SegmentBuffer, m_nSegSize);
break;
case OBJECT :
//TRACE_HDMVSUB ("CHdmvSub:OBJECT %S\n", ReftimeToString(rtStart));
ParseObject(&SegmentBuffer, m_nSegSize);
break;
case PRESENTATION_SEG :
TRACE_HDMVSUB ("CHdmvSub:PRESENTATION_SEG %S (size=%d)\n", ReftimeToString(rtStart), m_nSegSize);
if (m_pCurrentObject) {
m_pCurrentObject->m_rtStop = rtStart;
m_pObjects.AddTail (m_pCurrentObject);
TRACE_HDMVSUB ("CHdmvSub:HDMV : %S => %S\n", ReftimeToString (m_pCurrentObject->m_rtStart), ReftimeToString(rtStart));
m_pCurrentObject = NULL;
}
if (ParsePresentationSegment(&SegmentBuffer) > 0) {
m_pCurrentObject->m_rtStart = rtStart;
m_pCurrentObject->m_rtStop = _I64_MAX;
}
break;
case WINDOW_DEF :
// TRACE_HDMVSUB ("CHdmvSub:WINDOW_DEF %S\n", ReftimeToString(rtStart));
break;
case END_OF_DISPLAY :
// TRACE_HDMVSUB ("CHdmvSub:END_OF_DISPLAY %S\n", ReftimeToString(rtStart));
break;
default :
TRACE_HDMVSUB ("CHdmvSub:UNKNOWN Seg %d rtStart=0x%10dd\n", m_nCurSegment, rtStart);
}
m_nCurSegment = NO_SEGMENT;
}
}
}
}
return hr;
}
示例5: ParseSample
HRESULT CDVBSub::ParseSample (IMediaSample* pSample)
{
CheckPointer (pSample, E_POINTER);
HRESULT hr;
BYTE* pData = NULL;
int nSize;
DVB_SEGMENT_TYPE nCurSegment;
hr = pSample->GetPointer(&pData);
if(FAILED(hr) || pData == NULL) {
return hr;
}
nSize = pSample->GetActualDataLength();
if (*((LONG*)pData) == 0xBD010000) {
CGolombBuffer gb (pData, nSize);
gb.SkipBytes(4);
WORD wLength = (WORD)gb.BitRead(16);
UNUSED_ALWAYS(wLength);
if (gb.BitRead(2) != 2) {
return E_FAIL; // type
}
gb.BitRead(2); // scrambling
gb.BitRead(1); // priority
gb.BitRead(1); // alignment
gb.BitRead(1); // copyright
gb.BitRead(1); // original
BYTE fpts = (BYTE)gb.BitRead(1); // fpts
BYTE fdts = (BYTE)gb.BitRead(1); // fdts
gb.BitRead(1); // escr
gb.BitRead(1); // esrate
gb.BitRead(1); // dsmtrickmode
gb.BitRead(1); // morecopyright
gb.BitRead(1); // crc
gb.BitRead(1); // extension
gb.BitRead(8); // hdrlen
if(fpts) {
BYTE b = (BYTE)gb.BitRead(4);
if(!(fdts && b == 3 || !fdts && b == 2)) {
ASSERT(0);
return(E_FAIL);
}
REFERENCE_TIME pts = 0;
pts |= gb.BitRead(3) << 30;
MARKER; // 32..30
pts |= gb.BitRead(15) << 15;
MARKER; // 29..15
pts |= gb.BitRead(15);
MARKER; // 14..0
pts = 10000*pts/90;
m_rtStart = pts;
m_rtStop = pts+1;
} else {
m_rtStart = INVALID_TIME;
m_rtStop = INVALID_TIME;
}
nSize -= 14;
pData += 14;
pSample->GetTime(&m_rtStart, &m_rtStop);
pSample->GetMediaTime(&m_rtStart, &m_rtStop);
} else if (SUCCEEDED (pSample->GetTime(&m_rtStart, &m_rtStop))) {
pSample->SetTime(&m_rtStart, &m_rtStop);
}
//FILE* hFile = fopen ("D:\\Sources\\mpc-hc\\A garder\\TestSubRip\\dvbsub.dat", "ab");
//if(hFile != NULL)
//{
// //BYTE Buff[5] = {48};
// //*((DWORD*)(Buff+1)) = lSampleLen;
// //fwrite (Buff, 1, sizeof(Buff), hFile);
// fwrite (pData, 1, lSampleLen, hFile);
// fclose(hFile);
//}
if (AddToBuffer (pData, nSize) == S_OK) {
CGolombBuffer gb (m_pBuffer+m_nBufferReadPos, m_nBufferWritePos-m_nBufferReadPos);
int nLastPos = 0;
while (!gb.IsEOF()) {
if (gb.ReadByte() == 0x0F) {
WORD wPageId;
WORD wSegLength;
nCurSegment = (DVB_SEGMENT_TYPE) gb.ReadByte();
wPageId = gb.ReadShort();
wSegLength = gb.ReadShort();
if (gb.RemainingSize() < wSegLength) {
hr = S_FALSE;
break;
}
//.........这里部分代码省略.........
示例6: ParseSample
HRESULT CHdmvSub::ParseSample(BYTE* pData, int lSampleLen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
HRESULT hr = S_OK;
if (pData) {
CGolombBuffer SampleBuffer (pData, lSampleLen);
while (!SampleBuffer.IsEOF()) {
if (m_nCurSegment == NO_SEGMENT) {
HDMV_SEGMENT_TYPE nSegType = (HDMV_SEGMENT_TYPE)SampleBuffer.ReadByte();
USHORT nUnitSize = SampleBuffer.ReadShort();
lSampleLen -=3;
switch (nSegType) {
case PALETTE :
case OBJECT :
case PRESENTATION_SEG :
case END_OF_DISPLAY :
m_nCurSegment = nSegType;
AllocSegment(nUnitSize);
break;
case WINDOW_DEF :
case INTERACTIVE_SEG :
case HDMV_SUB1 :
case HDMV_SUB2 :
// Ignored stuff...
SampleBuffer.SkipBytes(nUnitSize);
break;
default :
return VFW_E_SAMPLE_REJECTED;
}
}
if (m_nCurSegment != NO_SEGMENT) {
if (m_nSegBufferPos < m_nSegSize) {
int nSize = min(m_nSegSize - m_nSegBufferPos, lSampleLen);
SampleBuffer.ReadBuffer(m_pSegBuffer + m_nSegBufferPos, nSize);
m_nSegBufferPos += nSize;
}
if (m_nSegBufferPos >= m_nSegSize) {
CGolombBuffer SegmentBuffer(m_pSegBuffer, m_nSegSize);
switch (m_nCurSegment) {
case PALETTE :
TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : PALETTE\n"));
ParsePalette(&SegmentBuffer, m_nSegSize);
break;
case OBJECT :
TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : OBJECT\n"));
ParseObject(&SegmentBuffer, m_nSegSize);
break;
case PRESENTATION_SEG :
TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : PRESENTATION_SEG = [%10I64d], %s, size = %d\n"), rtStart, ReftimeToString(rtStart), m_nSegSize);
ParsePresentationSegment(&SegmentBuffer, rtStart);
break;
case WINDOW_DEF :
//TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : WINDOW_DEF = %10I64d, %S\n"), rtStart, ReftimeToString(rtStart));
break;
case END_OF_DISPLAY :
//TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : END_OF_DISPLAY = %10I64d, %S\n"), rtStart, ReftimeToString(rtStart));
break;
default :
TRACE_HDMVSUB(_T("CHdmvSub::ParseSample() : UNKNOWN Seg [%d] = [%10I64d], %s\n"), m_nCurSegment, rtStart, ReftimeToString(rtStart));
}
m_nCurSegment = NO_SEGMENT;
}
}
}
}
return hr;
}
示例7: ParseSample
HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
{
CheckPointer (pSample, E_POINTER);
HRESULT hr;
BYTE* pData = NULL;
int nSize;
DVB_SEGMENT_TYPE nCurSegment;
hr = pSample->GetPointer(&pData);
if (FAILED(hr) || pData == NULL) {
return hr;
}
nSize = pSample->GetActualDataLength();
if (*((LONG*)pData) == 0xBD010000) {
CGolombBuffer gb (pData, nSize);
gb.SkipBytes(4);
WORD wLength = (WORD)gb.BitRead(16);
UNREFERENCED_PARAMETER(wLength);
if (gb.BitRead(2) != 2) {
return E_FAIL; // type
}
gb.BitRead(2); // scrambling
gb.BitRead(1); // priority
gb.BitRead(1); // alignment
gb.BitRead(1); // copyright
gb.BitRead(1); // original
BYTE fpts = (BYTE)gb.BitRead(1); // fpts
BYTE fdts = (BYTE)gb.BitRead(1); // fdts
gb.BitRead(1); // escr
gb.BitRead(1); // esrate
gb.BitRead(1); // dsmtrickmode
gb.BitRead(1); // morecopyright
gb.BitRead(1); // crc
gb.BitRead(1); // extension
gb.BitRead(8); // hdrlen
if (fpts) {
BYTE b = (BYTE)gb.BitRead(4);
if (!(fdts && b == 3 || !fdts && b == 2)) {
ASSERT(0);
return(E_FAIL);
}
REFERENCE_TIME pts = 0;
pts |= gb.BitRead(3) << 30;
MARKER; // 32..30
pts |= gb.BitRead(15) << 15;
MARKER; // 29..15
pts |= gb.BitRead(15);
MARKER; // 14..0
pts = 10000*pts/90;
m_rtStart = pts;
m_rtStop = pts+1;
} else {
m_rtStart = INVALID_TIME;
m_rtStop = INVALID_TIME;
}
nSize -= 14;
pData += 14;
pSample->GetTime(&m_rtStart, &m_rtStop);
pSample->GetMediaTime(&m_rtStart, &m_rtStop);
} else if (SUCCEEDED (pSample->GetTime(&m_rtStart, &m_rtStop))) {
pSample->SetTime(&m_rtStart, &m_rtStop);
}
if (AddToBuffer (pData, nSize) == S_OK) {
CGolombBuffer gb (m_pBuffer+m_nBufferReadPos, m_nBufferWritePos-m_nBufferReadPos);
int nLastPos = 0;
while (!gb.IsEOF()) {
if (gb.ReadByte() == 0x0F) {
WORD wPageId;
WORD wSegLength;
nCurSegment = (DVB_SEGMENT_TYPE) gb.ReadByte();
wPageId = gb.ReadShort();
wSegLength = gb.ReadShort();
if (gb.RemainingSize() < wSegLength) {
hr = S_FALSE;
break;
}
TRACE_DVB (_T("DVB - ParseSample, Segment = [%ws], PageId = [%d], SegLength/Buffer = [%d]/[%d]\n"), GetSegmentType(nCurSegment), wPageId, wSegLength, gb.RemainingSize());
switch (nCurSegment) {
case PAGE : {
CAutoPtr<DVB_PAGE> pPage;
ParsePage(gb, wSegLength, pPage);
if (pPage->PageState == DPS_ACQUISITION || pPage->PageState == DPS_MODE) {
TRACE_DVB (_T("DVB - Page start\n"));
if (m_pCurrentPage != NULL) {
//.........这里部分代码省略.........