本文整理汇总了C++中CheckPointer函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckPointer函数的具体用法?C++ CheckPointer怎么用?C++ CheckPointer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckPointer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocaleID
STDMETHODIMP GetLocaleID(LCID* pLocaleID)
{
CheckPointer(pLocaleID, E_POINTER);
*pLocaleID = ::GetUserDefaultLCID();
return S_OK;
}
示例2: IterateKeff
void IterateKeff()
{
long ptr, mode, skip, ncyc, idx, fix;
double nsf, fiss, capt, nuxn, leak, L0, L1, val, f, keff, val0;
/* Check mode */
if ((mode = (long)RDB[DATA_ITER_MODE]) == ITER_MODE_NONE)
return;
/* Get fix mode */
fix = (long)RDB[DATA_ITER_FIX];
/* Number of cycles and actual number of skip cycles (setoptimization.c) */
ncyc = (long)RDB[DATA_ITER_NCYC];
idx = (long)RDB[DATA_CYCLE_IDX];
if (fix == YES)
skip = (long)((RDB[DATA_CRIT_SKIP] - RDB[DATA_ITER_NCYC])/2.0);
else
skip = (long)(RDB[DATA_CRIT_SKIP] - RDB[DATA_ITER_NCYC]);
/* Check cycles */
if ((idx < skip) || ((fix == YES) && (idx > skip + ncyc)))
return;
/* Reduce scoring buffer */
ReduceBuffer();
/* Collect MPI parallel data */
CollectBuf();
/* Check mode */
if (mode == ITER_MODE_ALBEDO)
{
/***********************************************************************/
/***** Albedo iteration ************************************************/
/* Get k-eff */
keff = RDB[DATA_ITER_KEFF];
CheckValue(FUNCTION_NAME, "keff", "", keff, 0.1, 2.5);
/* Fission nubar */
ptr = (long)RDB[RES_TOT_NSF];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
nsf = BufVal(ptr, 0);
/* Fission term */
ptr = (long)RDB[RES_TOT_FISSRATE];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
fiss = BufVal(ptr, 0);
/* Total capture rate */
ptr = (long)RDB[RES_TOT_CAPTRATE];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
capt = BufVal(ptr, 0);
/* Scattering production rate */
ptr = (long)RDB[RES_TOT_INLPRODRATE];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
nuxn = BufVal(ptr, 0);
/* Physical leakage rate */
ptr = (long)RDB[RES_TOT_NEUTRON_LEAKRATE];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
leak = BufVal(ptr, 0);
/* Get previous albedo leakage rate */
ptr = (long)RDB[RES_ALB_NEUTRON_LEAKRATE];
CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr);
L0 = BufVal(ptr, 0);
/* Calculate estimate for new albedo leakage rate */
L1 = nsf/keff - capt - fiss - leak + nuxn;
/* Avoid compiler warning */
val = -1.0;
/* Get previous value */
if ((val0 = RDB[DATA_ITER_VAL]) < 0.0)
{
/* Not set, use initial guess */
//.........这里部分代码省略.........
示例3: CheckPointer
// we need to return an addrefed allocator, even if it is the preferred
// one, since he doesn't know whether it is the preferred one or not.
STDMETHODIMP
CAsyncOutputPin::RequestAllocator(
IMemAllocator* pPreferred,
ALLOCATOR_PROPERTIES* pProps,
IMemAllocator ** ppActual)
{
CheckPointer(pPreferred,E_POINTER);
CheckPointer(pProps,E_POINTER);
CheckPointer(ppActual,E_POINTER);
ASSERT(m_pIo);
// we care about alignment but nothing else
if(!pProps->cbAlign || !m_pIo->IsAligned(pProps->cbAlign))
{
m_pIo->Alignment(&pProps->cbAlign);
}
ALLOCATOR_PROPERTIES Actual;
HRESULT hr;
if(pPreferred)
{
hr = pPreferred->SetProperties(pProps, &Actual);
if(SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign))
{
pPreferred->AddRef();
*ppActual = pPreferred;
return S_OK;
}
}
// create our own allocator
IMemAllocator* pAlloc;
hr = InitAllocator(&pAlloc);
if(FAILED(hr))
{
return hr;
}
//...and see if we can make it suitable
hr = pAlloc->SetProperties(pProps, &Actual);
if(SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign))
{
// we need to release our refcount on pAlloc, and addref
// it to pass a refcount to the caller - this is a net nothing.
*ppActual = pAlloc;
return S_OK;
}
// failed to find a suitable allocator
pAlloc->Release();
// if we failed because of the IsAligned test, the error code will
// not be failure
if(SUCCEEDED(hr))
{
hr = VFW_E_BADALIGN;
}
return hr;
}
示例4: CheckPointer
HRESULT xDSVideoRenderer::FillRGBWithYUY2(IMediaSample * pSample)
{
unsigned char* pDstData = NULL;
unsigned char* pSrcData = NULL;
IVideoRenderTarget::VRT_LockRect RTRect;
int lDstPitch = 0;
int lSrcPitch = 0;
int Bbp = 0;
if(m_pRenderTarget == NULL)
return S_OK;
m_pRenderTarget->onStartRender();
m_pRenderTarget->lock(RTRect);
pDstData = RTRect.mPixel;
CheckPointer(pSample,E_POINTER);
pSample->GetPointer( &pSrcData);
lDstPitch = RTRect.mPicth ;
lSrcPitch = m_lVidWidth * 2;//m_lVidPitch;
Bbp = RTRect.mBytePerPixel;
unsigned char* pSrcLine = pSrcData;
unsigned char* pDstLine = pDstData;// + (RTRect.mHeight - 1) * RTRect.mWidth * Bbp;
////if(m_pRenderTarget->flipY())
//{
// pDstLine += (RTRect.mHeight - 1) * lDstPitch;
// lDstPitch =- lDstPitch;
//}
int _R = 0 , _G = 1 , _B = 2, _A = 3;
//if(m_pRenderTarget->flipRGBA() )
//{
// _B = 0; _G = 1; _R = 2; _A = 3;
//}
if(pSrcData == NULL || pDstData == NULL)
{
#ifdef _DEBUG
OutputDebugString(L"CVideoRender DoSampler 的Buffer为空\n");
#endif
m_pRenderTarget->unlock();
return E_FAIL;
}
unsigned int c_y = 0;
int c_u = 0;
int c_v = 0;
if(Bbp == 3)
{
_A = 0;
}
if(Bbp == 3 || Bbp == 4)
{
for(int y = 0 ; y < RTRect.mHeight ; ++y)
{
for(int x = 0 ; x < RTRect.mWidth ; ++x)
{
int src_y_idx = 2 * x;
c_y = pSrcLine[src_y_idx];
if(x%2)
{
c_u = ((unsigned char*)pSrcLine)[src_y_idx-1];
c_v = ((unsigned char*)pSrcLine)[src_y_idx+1];
}
else
{
c_u = ((unsigned char*)pSrcLine)[src_y_idx+1];
c_v = ((unsigned char*)pSrcLine)[src_y_idx+3];
}
int r = (int)(1.f * (c_y - 16) + 1.14f * (c_v - 128) ); //R
int g = (int)(1.f * (c_y - 16) - 0.390f * (c_u - 128) - 0.58f * (c_v - 128) ); //G
int b = (int)(1.f * (c_y - 16) + 2.03f * (c_u - 128) ); //B
pDstLine[Bbp * x + _A] = 255;
pDstLine[Bbp * x + _R] = CLIP(r);
pDstLine[Bbp * x + _G] = CLIP(g);
pDstLine[Bbp * x + _B] = CLIP(b);
}
pSrcLine += lSrcPitch;
pDstLine += lDstPitch;
}
}
else
{
m_pRenderTarget->unlock();
m_pRenderTarget->onEndRender(false);
return E_FAIL;
}
//.........这里部分代码省略.........
示例5: CheckPointer
HRESULT StaticSourceVideoPin::FillBuffer(IMediaSample * pSample)
{
CheckPointer(pSample, E_POINTER);
HRESULT hr = S_OK;
DWORD frameDataCount;
BYTE * frameData;
//Nastavenie hodnoty casu zaciatku a konca snimky
REFERENCE_TIME rtStart = this->m_rtLastFrame;
REFERENCE_TIME rtStop = rtStart + this->m_pFilter->m_params->m_rtFrameLength;
pSample->SetTime(&rtStart, &rtStop);
if (this->m_pFilter->m_rtStop > 0 && rtStop >= this->m_pFilter->m_rtStop)
{
//Ak je nastaveny cas konca a prekroci sa, ukonci sa stream
hr = S_FALSE;
goto done;
}
this->m_rtLastFrame = rtStop;
CHECK_HR(hr = pSample->GetPointer(&frameData));
frameDataCount = pSample->GetSize();
//Ak je nastavena bitmapa, pouzi tu, inak nastav sum
if (this->m_pFilter->m_params->m_bitmapData == NULL)
{
for (DWORD i = 0; i < frameDataCount; i++)
frameData[i] = (BYTE)(rand() % 256);
}
else
{
if (this->m_mt.subtype == MEDIASUBTYPE_RGB32)
{
//Na vystup ide RGB32 typ
if (this->m_pFilter->m_params->m_bitmapInfo.biBitCount == 32)
{
CopyMemory(frameData, this->m_pFilter->m_params->m_bitmapData, frameDataCount);
}
else
{
BITMAPINFOHEADER dstBmi = this->m_pFilter->m_params->m_bitmapInfo;
dstBmi.biBitCount = 32;
RGBtoRGB(this->m_pFilter->m_params->m_bitmapInfo, this->m_pFilter->m_params->m_bitmapData, frameData, dstBmi);
}
}
else if (this->m_mt.subtype == MEDIASUBTYPE_RGB24)
{
//Na vystup ide RGB24 typ
if (this->m_pFilter->m_params->m_bitmapInfo.biBitCount == 24)
{
CopyMemory(frameData, this->m_pFilter->m_params->m_bitmapData, frameDataCount);
}
else
{
BITMAPINFOHEADER dstBmi = this->m_pFilter->m_params->m_bitmapInfo;
dstBmi.biBitCount = 24;
RGBtoRGB(this->m_pFilter->m_params->m_bitmapInfo, this->m_pFilter->m_params->m_bitmapData, frameData, dstBmi);
}
}
else if (this->m_mt.subtype == MEDIASUBTYPE_YUY2)
{
//Na vystup ide YUY2 typ
RGBtoYUY2(this->m_pFilter->m_params->m_bitmapInfo, this->m_pFilter->m_params->m_bitmapData, frameData);
}
else if (this->m_mt.subtype == MEDIASUBTYPE_YV12)
{
//Na vystup ide YV12 typ
RGBtoYV12(this->m_pFilter->m_params->m_bitmapInfo, this->m_pFilter->m_params->m_bitmapData, frameData);
}
}
CHECK_HR(hr = pSample->SetSyncPoint(TRUE));
CHECK_HR(hr = pSample->SetActualDataLength(frameDataCount));
done:
return hr;
}
示例6: CheckPointer
STDMETHODIMP CBaseSplitterFilter::get_MarkerCount(long* pMarkerCount)
{
CheckPointer(pMarkerCount, E_POINTER);
*pMarkerCount = (long)ChapGetCount();
return S_OK;
}
示例7: CheckPointer
STDMETHODIMP CDSMSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
CheckPointer(m_pFile, E_UNEXPECTED);
nKFs = (UINT)m_pFile->m_sps.GetCount();
return S_OK;
}
示例8: StartCounter
HRESULT CPushPinDesktop::FillBuffer(IMediaSample *pSample)
{
__int64 startThisRound = StartCounter();
BYTE *pData;
CheckPointer(pSample, E_POINTER);
if(m_bReReadRegistry) {
reReadCurrentPosition(1);
}
// Access the sample's data buffer
pSample->GetPointer(&pData);
// Make sure that we're still using video format
ASSERT(m_mt.formattype == FORMAT_VideoInfo);
VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*) m_mt.pbFormat;
// for some reason the timings are messed up initially, as there's no start time at all for the first frame (?) we don't start in State_Running ?
// race condition?
// so don't do some calculations unless we're in State_Running
FILTER_STATE myState;
CSourceStream::m_pFilter->GetState(INFINITE, &myState);
bool fullyStarted = myState == State_Running;
boolean gotNew = false;
while(!gotNew) {
CopyScreenToDataBlock(hScrDc, pData, (BITMAPINFO *) &(pVih->bmiHeader), pSample);
if(m_bDeDupe) {
if(memcmp(pData, pOldData, pSample->GetSize())==0) { // took desktop: 10ms for 640x1152, still 100 fps uh guess...
Sleep(m_millisToSleepBeforePollForChanges);
} else {
gotNew = true;
memcpy( /* dest */ pOldData, pData, pSample->GetSize()); // took 4ms for 640x1152, but it's worth it LOL.
// LODO memcmp and memcpy in the same loop LOL.
}
} else {
// it's always new for everyone else!
gotNew = true;
}
}
// capture how long it took before we add in our own arbitrary delay to enforce fps...
long double millisThisRoundTook = GetCounterSinceStartMillis(startThisRound);
fastestRoundMillis = min(millisThisRoundTook, fastestRoundMillis); // keep stats :)
sumMillisTook += millisThisRoundTook;
CRefTime now;
CRefTime endFrame;
CSourceStream::m_pFilter->StreamTime(now);
// wait until we "should" send this frame out...
if((now > 0) && (now < previousFrameEndTime)) { // now > 0 to accomodate for if there is no reference graph clock at all...also boot strap time ignore it :P
while(now < previousFrameEndTime) { // guarantees monotonicity too :P
Sleep(1);
CSourceStream::m_pFilter->StreamTime(now);
}
// avoid a tidge of creep since we sleep until [typically] just past the previous end.
endFrame = previousFrameEndTime + m_rtFrameLength;
previousFrameEndTime = endFrame;
} else {
if(show_performance)
LocalOutput("it missed a frame--can't keep up %d", countMissed++); // we don't miss time typically I don't think, unless de-dupe is turned on, or aero, or slow computer, buffering problems downstream, etc.
// have to add a bit here, or it will always be "it missed some time" for the next round...forever!
endFrame = now + m_rtFrameLength;
// most of this stuff I just made up because it "sounded right"
//LocalOutput("checking to see if I can catch up again now: %llu previous end: %llu subtr: %llu %i", now, previousFrameEndTime, previousFrameEndTime - m_rtFrameLength, previousFrameEndTime - m_rtFrameLength);
if(now > (previousFrameEndTime - (long long) m_rtFrameLength)) { // do I need a long long cast?
// let it pretend and try to catch up, it's not quite a frame behind
previousFrameEndTime = previousFrameEndTime + m_rtFrameLength;
} else {
endFrame = now + m_rtFrameLength/2; // ?? seems to work...I guess...
previousFrameEndTime = endFrame;
}
}
previousFrameEndTime = max(0, previousFrameEndTime);// avoid startup negatives, which would kill our math on the next loop...
// LocalOutput("marking frame with timestamps: %llu %llu", now, endFrame);
pSample->SetTime((REFERENCE_TIME *) &now, (REFERENCE_TIME *) &endFrame);
//pSample->SetMediaTime((REFERENCE_TIME *)&now, (REFERENCE_TIME *) &endFrame); //useless seemingly
if(fullyStarted) {
m_iFrameNumber++;
}
// Set TRUE on every sample for uncompressed frames http://msdn.microsoft.com/en-us/library/windows/desktop/dd407021%28v=vs.85%29.aspx
pSample->SetSyncPoint(TRUE);
// only set discontinuous for the first...I think...
pSample->SetDiscontinuity(m_iFrameNumber <= 1);
// the swprintf costs like 0.04ms (25000 fps LOL)
m_fFpsSinceBeginningOfTime = ((double) m_iFrameNumber)/(GetTickCount() - globalStart)*1000;
swprintf(out, L"done frame! total frames: %d this one %dx%d -> (%dx%d) took: %.02Lfms, %.02f ave fps (%.02f is the theoretical max fps based on this round, ave. possible fps %.02f, fastest round fps %.02f, negotiated fps %.06f), frame missed %d",
m_iFrameNumber, m_iCaptureConfigHeight, m_iCaptureConfigWidth, getNegotiatedFinalWidth(), getNegotiatedFinalHeight(), millisThisRoundTook, m_fFpsSinceBeginningOfTime, 1.0*1000/millisThisRoundTook,
/* average */ 1.0*1000*m_iFrameNumber/sumMillisTook, 1.0*1000/fastestRoundMillis, GetFps(), countMissed);
//#ifdef _DEBUG // probably not worth it but we do hit this a lot...hmm...
//.........这里部分代码省略.........
开发者ID:dkaminski,项目名称:screen-capture-recorder-to-video-windows-free,代码行数:101,代码来源:PushSourceDesktop.cpp
示例9: CheckPointer
//
// DecideBufferSize
//
// This will always be called after the format has been sucessfully
// negotiated (this is negotiatebuffersize). So we have a look at m_mt to see what size image we agreed.
// Then we can ask for buffers of the correct size to contain them.
//
HRESULT CPushPinDesktop::DecideBufferSize(IMemAllocator *pAlloc,
ALLOCATOR_PROPERTIES *pProperties)
{
CheckPointer(pAlloc,E_POINTER);
CheckPointer(pProperties,E_POINTER);
CAutoLock cAutoLock(m_pFilter->pStateLock());
HRESULT hr = NOERROR;
VIDEOINFO *pvi = (VIDEOINFO *) m_mt.Format();
BITMAPINFOHEADER header = pvi->bmiHeader;
ASSERT(header.biPlanes == 1); // sanity check
// ASSERT(header.biCompression == 0); // meaning "none" sanity check, unless we are allowing for BI_BITFIELDS [?]
// now try to avoid this crash [XP, VLC 1.1.11]: vlc -vvv dshow:// :dshow-vdev="screen-capture-recorder" :dshow-adev --sout "#transcode{venc=theora,vcodec=theo,vb=512,scale=0.7,acodec=vorb,ab=128,channels=2,samplerate=44100,audio-sync}:standard{access=file,mux=ogg,dst=test.ogv}" with 10x10 or 1000x1000
// LODO check if biClrUsed is passed in right for 16 bit [I'd guess it is...]
// pProperties->cbBuffer = pvi->bmiHeader.biSizeImage; // too small. Apparently *way* too small.
int bytesPerLine;
// there may be a windows method that would do this for us...GetBitmapSize(&header); but might be too small for VLC? LODO try it :)
// some pasted code...
int bytesPerPixel = (header.biBitCount/8);
if(m_bConvertToI420) {
bytesPerPixel = 32/8; // we convert from a 32 bit to i420, so need more space in this case
}
bytesPerLine = header.biWidth * bytesPerPixel;
/* round up to a dword boundary */
if (bytesPerLine & 0x0003)
{
bytesPerLine |= 0x0003;
++bytesPerLine;
}
ASSERT(header.biHeight > 0); // sanity check
ASSERT(header.biWidth > 0); // sanity check
// NB that we are adding in space for a final "pixel array" (http://en.wikipedia.org/wiki/BMP_file_format#DIB_Header_.28Bitmap_Information_Header.29) even though we typically don't need it, this seems to fix the segfaults
// maybe somehow down the line some VLC thing thinks it might be there...weirder than weird.. LODO debug it LOL.
int bitmapSize = 14 + header.biSize + (long)(bytesPerLine)*(header.biHeight) + bytesPerLine*header.biHeight;
pProperties->cbBuffer = bitmapSize;
//pProperties->cbBuffer = max(pProperties->cbBuffer, m_mt.GetSampleSize()); // didn't help anything
if(m_bConvertToI420) {
pProperties->cbBuffer = header.biHeight * header.biWidth*3/2; // necessary to prevent an "out of memory" error for FMLE. Yikes. Oh wow yikes.
}
pProperties->cBuffers = 1; // 2 here doesn't seem to help the crashes...
// Ask the allocator to reserve us some sample memory. NOTE: the function
// can succeed (return NOERROR) but still not have allocated the
// memory that we requested, so we must check we got whatever we wanted.
ALLOCATOR_PROPERTIES Actual;
hr = pAlloc->SetProperties(pProperties,&Actual);
if(FAILED(hr))
{
return hr;
}
// Is this allocator unsuitable?
if(Actual.cbBuffer < pProperties->cbBuffer)
{
return E_FAIL;
}
// now some "once per run" setups
// LODO reset aer with each run...somehow...somehow...Stop method or something...
OSVERSIONINFOEX version;
ZeroMemory(&version, sizeof(OSVERSIONINFOEX));
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFO)&version);
if(version.dwMajorVersion >= 6) { // meaning vista +
if(read_config_setting(TEXT("disable_aero_for_vista_plus_if_1"), 0) == 1)
turnAeroOn(false);
else
turnAeroOn(true);
}
if(pOldData) {
free(pOldData);
pOldData = NULL;
}
pOldData = (BYTE *) malloc(max(pProperties->cbBuffer*pProperties->cBuffers, bitmapSize)); // we convert from a 32 bit to i420, so need more space, hence max
memset(pOldData, 0, pProperties->cbBuffer*pProperties->cBuffers); // reset it just in case :P
// create a bitmap compatible with the screen DC
if(hRawBitmap)
DeleteObject (hRawBitmap);
hRawBitmap = CreateCompatibleBitmap(hScrDc, getNegotiatedFinalWidth(), getNegotiatedFinalHeight());
return NOERROR;
} // DecideBufferSize
开发者ID:dkaminski,项目名称:screen-capture-recorder-to-video-windows-free,代码行数:98,代码来源:PushSourceDesktop.cpp
示例10: CheckPointer
HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
{
CheckPointer(pSample, E_POINTER);
HRESULT hr;
BYTE* pData = nullptr;
int nSize;
DVB_SEGMENT_TYPE nCurSegment;
hr = pSample->GetPointer(&pData);
if (FAILED(hr) || pData == nullptr) {
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.RemainingSize() >= 6) { // Ensure there is enough data to parse the entire segment header
if (gb.ReadByte() == 0x0F) {
TRACE_DVB(_T("DVB - ParseSample\n"));
WORD wPageId;
WORD wSegLength;
nCurSegment = (DVB_SEGMENT_TYPE)gb.ReadByte();
wPageId = gb.ReadShort();
wSegLength = gb.ReadShort();
if (gb.RemainingSize() < wSegLength) {
hr = S_FALSE;
break;
}
switch (nCurSegment) {
case PAGE: {
if (m_pCurrentPage != nullptr) {
TRACE_DVB(_T("DVB - Force End display"));
EnqueuePage(m_rtStart);
}
UpdateTimeStamp(m_rtStart);
CAutoPtr<DVB_PAGE> pPage;
//.........这里部分代码省略.........
示例11: CheckPointer
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);
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;
}
switch (nCurSegment)
{
//.........这里部分代码省略.........
示例12: CheckPointer
STDMETHODIMP CLAVSubtitleFrame::GetBitmapCount(int *count)
{
CheckPointer(count, E_POINTER);
*count = m_NumBitmaps;
return S_OK;
}
示例13: CheckPointer
STDMETHODIMP CSubPicAllocatorPresenterImpl::GetBin(LPCSTR field, LPVOID* value, int* size)
{
CheckPointer(value, E_POINTER);
CheckPointer(size, E_POINTER);
return E_INVALIDARG;
}
示例14: GetLength
// INSSBuffer3
HRESULT STDMETHODCALLTYPE GetLength(DWORD *pdwLength) { CheckPointer(pdwLength, E_POINTER); *pdwLength = m_dwLength; return S_OK; }
示例15: GetBuffer
HRESULT STDMETHODCALLTYPE GetBuffer(BYTE **ppdwBuffer) { CheckPointer(ppdwBuffer, E_POINTER); *ppdwBuffer = m_pData; return S_OK; }