本文整理汇总了C++中CBuffer::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::Length方法的具体用法?C++ CBuffer::Length怎么用?C++ CBuffer::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::Length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillBuffer
HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
{
try
{
CDeMultiplexer& demux = m_pTsReaderFilter->GetDemultiplexer();
CBuffer* buffer = NULL;
bool earlyStall = false;
//get file-duration and set m_rtDuration
GetDuration(NULL);
do
{
//Check if we need to wait for a while
DWORD timeNow = GET_TIME_NOW();
while (timeNow < (m_LastFillBuffTime + m_FillBuffSleepTime))
{
Sleep(1);
timeNow = GET_TIME_NOW();
}
m_LastFillBuffTime = timeNow;
//did we reach the end of the file
if (demux.EndOfFile())
{
int ACnt, VCnt;
demux.GetBufferCounts(&ACnt, &VCnt);
if (ACnt <= 0 && VCnt <= 0) //have we used all the data ?
{
LogDebug("vidPin:set eof");
m_FillBuffSleepTime = 5;
CreateEmptySample(pSample);
m_bInFillBuffer = false;
return S_FALSE; //S_FALSE will notify the graph that end of file has been reached
}
}
//if the filter is currently seeking to a new position
//or this pin is currently seeking to a new position then
//we dont try to read any packets, but simply return...
if (m_pTsReaderFilter->IsSeeking() || m_pTsReaderFilter->IsStopping() || demux.m_bFlushRunning || !m_pTsReaderFilter->m_bStreamCompensated)
{
m_FillBuffSleepTime = 5;
CreateEmptySample(pSample);
m_bInFillBuffer = false;
if (demux.m_bFlushRunning || !m_pTsReaderFilter->m_bStreamCompensated)
{
//Force discon on next good sample
m_sampleCount = 0;
m_bDiscontinuity=true;
}
return NOERROR;
}
else
{
m_FillBuffSleepTime = 1;
m_bInFillBuffer = true;
}
// Get next video buffer from demultiplexer
buffer=demux.GetVideo(earlyStall);
if (buffer == NULL)
{
m_FillBuffSleepTime = 5;
}
else if (buffer->Length() > m_bufferSize)
{
//discard buffer
delete buffer;
demux.EraseVideoBuff();
m_bDiscontinuity = TRUE; //Next good sample will be discontinuous
buffer = NULL;
m_FillBuffSleepTime = 1;
LogDebug("vidPin : Error - buffer too large for sample") ;
}
else
{
m_bPresentSample = true ;
CRefTime RefTime, cRefTime;
double fTime = 0.0;
double clock = 0.0;
double stallPoint = VIDEO_STALL_POINT;
//check if it has a timestamp
bool HasTimestamp=buffer->MediaTime(RefTime);
if (HasTimestamp)
{
bool ForcePresent = false;
CRefTime compTemp = m_pTsReaderFilter->GetCompensation();
if (m_pTsReaderFilter->m_bFastSyncFFDShow && (compTemp != m_llLastComp))
{
m_bDiscontinuity = true;
}
m_llLastComp = compTemp;
cRefTime = RefTime;
cRefTime -= m_rtStart;
//adjust the timestamp with the compensation
cRefTime -= compTemp;
cRefTime -= m_pTsReaderFilter->m_ClockOnStart.m_time;
//.........这里部分代码省略.........