本文整理汇总了C++中CGolombBuffer::ReadBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CGolombBuffer::ReadBuffer方法的具体用法?C++ CGolombBuffer::ReadBuffer怎么用?C++ CGolombBuffer::ReadBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGolombBuffer
的用法示例。
在下文中一共展示了CGolombBuffer::ReadBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: descriptor
HRESULT CMpeg2DataParser::ParseSDT(ULONG ulFreq)
{
HRESULT hr;
CComPtr<ISectionList> pSectionList;
DWORD dwLength;
PSECTION data;
WORD wTSID;
WORD wONID;
WORD wSectionLength;
CheckNoLog (m_pData->GetSection (PID_SDT, SI_SDT, &m_Filter, 5000, &pSectionList));
CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data));
CGolombBuffer gb ((BYTE*)data, dwLength);
// service_description_section()
CheckNoLog (ParseSIHeader (gb, SI_SDT, wSectionLength, wTSID));
wONID = gb.BitRead(16); // original_network_id
gb.BitRead(8); // reserved_future_use
while (gb.GetSize() - gb.GetPos() > 4) {
CDVBChannel Channel;
Channel.SetFrequency (ulFreq);
Channel.SetTSID (wTSID);
Channel.SetONID (wONID);
Channel.SetSID (gb.BitRead(16)); // service_id uimsbf
gb.BitRead(6); // reserved_future_use bslbf
gb.BitRead(1); // EIT_schedule_flag bslbf
Channel.SetNowNextFlag(!!gb.BitRead(1)); // EIT_present_following_flag bslbf
gb.BitRead(3); // running_status uimsbf
Channel.SetEncrypted (!!gb.BitRead(1)); // free_CA_mode bslbf
// Descriptors:
BeginEnumDescriptors(gb, nType, nLength) {
switch (nType) {
case DT_SERVICE :
gb.BitRead(8); // service_type
nLength = gb.BitRead(8); // service_provider_name_length
gb.ReadBuffer (DescBuffer, nLength); // service_provider_name
nLength = gb.BitRead(8); // service_name_length
gb.ReadBuffer (DescBuffer, nLength); // service_name
DescBuffer[nLength] = 0;
Channel.SetName (ConvertString (DescBuffer, nLength));
TRACE ("%15S %d\n", Channel.GetName(), Channel.GetSID());
break;
default :
SkipDescriptor (gb, nType, nLength); // descriptor()
break;
}
}
EndEnumDescriptors
if (!Channels.Lookup(Channel.GetSID())) {
Channels [Channel.GetSID()] = Channel;
}
}
return S_OK;
}
示例2: 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;
}
示例3: 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;
}