本文整理汇总了C++中Packet::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::GetCount方法的具体用法?C++ Packet::GetCount怎么用?C++ Packet::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::GetCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
void CPacketQueue::Add(CAutoPtr<Packet> p)
{
CAutoLock cAutoLock(this);
if (p) {
m_size += p->GetDataSize();
if (p->bAppendable && !p->bDiscontinuity && !p->pmt
&& p->rtStart == Packet::INVALID_TIME
&& !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME) {
Packet* tail = GetTail();
size_t oldsize = tail->GetCount();
size_t newsize = tail->GetCount() + p->GetCount();
tail->SetCount(newsize, std::max(1024, (int)newsize)); // doubles the reserved buffer size
memcpy(tail->GetData() + oldsize, p->GetData(), p->GetCount());
/*
GetTail()->Append(*p); // too slow
*/
return;
}
}
AddTail(p);
}
示例2: FillBuffer
//.........这里部分代码省略.........
return ERROR_NO_DATA;
}
} // comparemediatypes
}
} // lock ends
m_rtTitleDuration = buffer->rtTitleDuration;
if (checkPlaybackState)
{
buffer->nNewSegment = 0;
m_pCachedBuffer = buffer;
CheckPlaybackState();
LogDebug("vid: cached push %6.3f clip: %d playlist: %d", m_pCachedBuffer->rtStart / 10000000.0, m_pCachedBuffer->nClipNumber, m_pCachedBuffer->nPlaylist);
return ERROR_NO_DATA;
}
bool hasTimestamp = buffer->rtStart != Packet::INVALID_TIME;
REFERENCE_TIME rtCorrectedStartTime = 0;
REFERENCE_TIME rtCorrectedStopTime = 0;
if (hasTimestamp)
{
if (m_bZeroTimeStream)
{
m_rtStreamTimeOffset = buffer->rtStart - buffer->rtClipStartTime;
m_bZeroTimeStream = false;
}
if (m_bDiscontinuity || buffer->bDiscontinuity)
{
LogDebug("vid: set discontinuity");
pSample->SetDiscontinuity(true);
pSample->SetMediaType(buffer->pmt);
m_bDiscontinuity = false;
}
rtCorrectedStartTime = buffer->rtStart - m_rtStreamTimeOffset;
rtCorrectedStopTime = buffer->rtStop - m_rtStreamTimeOffset;
pSample->SetTime(&rtCorrectedStartTime, &rtCorrectedStopTime);
if (m_bInitDuration)
{
m_pFilter->SetTitleDuration(m_rtTitleDuration);
m_pFilter->ResetPlaybackOffset(buffer->rtPlaylistTime - rtCorrectedStartTime);
m_bInitDuration = false;
}
m_pFilter->OnPlaybackPositionChange();
}
else // Buffer has no timestamp
pSample->SetTime(NULL, NULL);
pSample->SetSyncPoint(buffer->bSyncPoint);
{
CAutoLock lock(&m_csDeliver);
if (!m_bFlushing)
{
BYTE* pSampleBuffer;
pSample->SetActualDataLength(buffer->GetDataSize());
pSample->GetPointer(&pSampleBuffer);
memcpy(pSampleBuffer, buffer->GetData(), buffer->GetDataSize());
m_bFirstSample = false;
#ifdef LOG_VIDEO_PIN_SAMPLES
LogDebug("vid: %6.3f corr %6.3f playlist time %6.3f clip: %d playlist: %d size: %d", buffer->rtStart / 10000000.0, rtCorrectedStartTime / 10000000.0,
buffer->rtPlaylistTime / 10000000.0, buffer->nClipNumber, buffer->nPlaylist, buffer->GetCount());
#endif
}
else
{
LogDebug("vid: dropped sample as flush is active!");
return ERROR_NO_DATA;
}
}
//static int iFrameNumber = 0;
//LogMediaSample(pSample, iFrameNumber++);
delete buffer;
}
} while (!buffer);
return NOERROR;
}
catch(...)
{
LogDebug("vid: FillBuffer exception");
}
return S_OK;
}