您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CheckPointer函数代码示例

51自学网 2021-06-01 20:10:34
  C++
这篇教程C++ CheckPointer函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CheckPointer函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckPointer函数的具体用法?C++ CheckPointer怎么用?C++ CheckPointer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CheckPointer函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetLocaleID

	STDMETHODIMP GetLocaleID(LCID* pLocaleID)	{		CheckPointer(pLocaleID, E_POINTER);		*pLocaleID = ::GetUserDefaultLCID();		return S_OK;	}
开发者ID:Strongc,项目名称:playasa,代码行数:6,


示例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 *///.........这里部分代码省略.........
开发者ID:LMKerby,项目名称:SerpentCouplerII,代码行数:101,


示例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;}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:63,


示例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;    }//.........这里部分代码省略.........
开发者ID:wangscript,项目名称:evolution3d,代码行数:101,


示例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;}
开发者ID:tomaspsenak,项目名称:hmc,代码行数:80,


示例6: CheckPointer

STDMETHODIMP CBaseSplitterFilter::get_MarkerCount(long* pMarkerCount){	CheckPointer(pMarkerCount, E_POINTER);	*pMarkerCount = (long)ChapGetCount();	return S_OK;}
开发者ID:334151798,项目名称:dwindow,代码行数:6,


示例7: CheckPointer

STDMETHODIMP CDSMSplitterFilter::GetKeyFrameCount(UINT& nKFs){    CheckPointer(m_pFile, E_UNEXPECTED);    nKFs = (UINT)m_pFile->m_sps.GetCount();    return S_OK;}
开发者ID:Blitzker,项目名称:mpc-hc,代码行数:6,


示例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,


示例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,


示例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;//.........这里部分代码省略.........
开发者ID:DanHenebry,项目名称:mpc-hc,代码行数:101,


示例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)				{//.........这里部分代码省略.........
开发者ID:Fluffiest,项目名称:splayer,代码行数:101,


示例12: CheckPointer

STDMETHODIMP CLAVSubtitleFrame::GetBitmapCount(int *count){  CheckPointer(count, E_POINTER);  *count = m_NumBitmaps;  return S_OK;}
开发者ID:Brijen,项目名称:LAVFilters,代码行数:6,


示例13: CheckPointer

STDMETHODIMP CSubPicAllocatorPresenterImpl::GetBin(LPCSTR field, LPVOID* value, int* size){    CheckPointer(value, E_POINTER);    CheckPointer(size, E_POINTER);    return E_INVALIDARG;}
开发者ID:JanChou,项目名称:mpc-hc,代码行数:6,


示例14: GetLength

 // INSSBuffer3 HRESULT STDMETHODCALLTYPE GetLength(DWORD *pdwLength) { CheckPointer(pdwLength, E_POINTER); *pdwLength = m_dwLength; return S_OK; }
开发者ID:3s3s,项目名称:lavfilters,代码行数:2,


示例15: GetBuffer

 HRESULT STDMETHODCALLTYPE GetBuffer(BYTE **ppdwBuffer) { CheckPointer(ppdwBuffer, E_POINTER); *ppdwBuffer = m_pData; return S_OK; }
开发者ID:3s3s,项目名称:lavfilters,代码行数:1,


示例16: DbgLog

HRESULT CDXVA2SurfaceAllocator::Alloc(){  DbgLog((LOG_TRACE, 10, L"CDXVA2SurfaceAllocator::Alloc()"));  HRESULT hr = S_OK;  IDirectXVideoDecoderService *pDXVA2Service = nullptr;  if (!m_pDec)    return E_FAIL;  CheckPointer(m_pDec->m_pD3DDevMngr, E_UNEXPECTED);  hr = m_pDec->m_pD3DDevMngr->GetVideoService (m_pDec->m_hDevice, IID_IDirectXVideoDecoderService, (void**)&pDXVA2Service);  CheckPointer (pDXVA2Service, E_UNEXPECTED);  CAutoLock lock(this);  hr = __super::Alloc();  if (SUCCEEDED(hr)) {    DbgLog((LOG_TRACE, 10, L"-> Releasing old resources"));    // Free the old resources.    m_pDec->FlushFromAllocator();    Free();    m_nSurfaceArrayCount = m_lCount;    // Allocate a new array of pointers.    m_ppRTSurfaceArray = new IDirect3DSurface9*[m_lCount];    if (m_ppRTSurfaceArray == nullptr) {      hr = E_OUTOFMEMORY;    } else {      ZeroMemory(m_ppRTSurfaceArray, sizeof(IDirect3DSurface9*) * m_lCount);    }  }  // Allocate the surfaces.  if (SUCCEEDED(hr)) {    DbgLog((LOG_TRACE, 10, L"-> Allocating surfaces"));    hr = pDXVA2Service->CreateSurface(      m_pDec->m_dwSurfaceWidth,      m_pDec->m_dwSurfaceHeight,      m_lCount - 1,      m_pDec->m_eSurfaceFormat,      D3DPOOL_DEFAULT,      0,      DXVA2_VideoDecoderRenderTarget,      m_ppRTSurfaceArray,      nullptr      );  }  if (SUCCEEDED(hr)) {    DbgLog((LOG_TRACE, 10, L"-> Creating samples"));    // Important : create samples in reverse order !    for (int i = m_lCount-1; i >= 0; i--) {      CDXVA2Sample *pSample = new CDXVA2Sample(this, &hr);      if (pSample == nullptr) {        hr = E_OUTOFMEMORY;        break;      }      if (FAILED(hr)) {        break;      }      // Assign the Direct3D surface pointer and the index.      pSample->SetSurface(i, m_ppRTSurfaceArray[i]);      // Add to the sample list.      m_lFree.Add(pSample);    }    hr = m_pDec->CreateDXVA2Decoder(m_lCount, m_ppRTSurfaceArray);    if (FAILED (hr)) {      Free();    }  }  m_lAllocated = m_lCount;  if (SUCCEEDED(hr)) {    m_bChanged = FALSE;  }  SafeRelease(&pDXVA2Service);  return hr;}
开发者ID:1pi,项目名称:LAVFilters,代码行数:82,


示例17: CheckPointer

HRESULT CHdmvSub::ParseSample(IMediaSample* pSample){    CheckPointer(pSample, E_POINTER);    HRESULT hr;    REFERENCE_TIME rtStart = INVALID_TIME, rtStop = INVALID_TIME;    BYTE* pData = nullptr;    int lSampleLen;    hr = pSample->GetPointer(&pData);    if (FAILED(hr) || pData == nullptr) {        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();                unsigned short 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:PALETTE            rtStart=%10I64d/n"), rtStart);                            ParsePalette(&SegmentBuffer, m_nSegSize);                            break;                        case OBJECT:                            TRACE_HDMVSUB(_T("CHdmvSub:OBJECT             %s/n"), ReftimeToString(rtStart));                            ParseObject(&SegmentBuffer, m_nSegSize);                            break;                        case PRESENTATION_SEG:                            TRACE_HDMVSUB(_T("CHdmvSub:PRESENTATION_SEG   %s (size=%d)/n"), ReftimeToString(rtStart), m_nSegSize);                            // Enqueue the current presentation segment if any                            EnqueuePresentationSegment(rtStart);                            // Parse the new presentation segment                            ParsePresentationSegment(rtStart, &SegmentBuffer);                            break;                        case WINDOW_DEF:                            //TRACE_HDMVSUB(_T("CHdmvSub:WINDOW_DEF         %s/n"), ReftimeToString(rtStart));                            break;                        case END_OF_DISPLAY:                            //TRACE_HDMVSUB(_T("CHdmvSub:END_OF_DISPLAY     %s/n"), ReftimeToString(rtStart));                            break;                        default:                            TRACE_HDMVSUB(_T("CHdmvSub:UNKNOWN Seg %d     rtStart=0x%10dd/n"), m_nCurSegment, rtStart);                    }                    m_nCurSegment = NO_SEGMENT;                }            }        }    }    return hr;}
开发者ID:Azzuro,项目名称:MediaPortal-1,代码行数:91,


示例18: CheckPointer

HRESULT STDMETHODCALLTYPE CGraphConnector::GetInputFilter( IBaseFilter **InputFilter ){ 	CheckPointer(InputFilter,E_POINTER);	return m_pInputFilter->NonDelegatingQueryInterface( __uuidof( IBaseFilter ), (void**)InputFilter );}
开发者ID:Tudi,项目名称:Directshow-filters,代码行数:5,


示例19: CheckPointer

BOOL CScreenSnap::GetScreenData(BYTE* pScreenData,DWORD &dwScreenData){	CDC dc;	dc.CreateDC("DISPLAY",NULL,NULL,NULL);	CheckPointer(dc.GetSafeHdc(),FALSE);		CBitmap bm;	int nWidth	= GetSystemMetrics(SM_CXSCREEN);	int nHeight	= GetSystemMetrics(SM_CYSCREEN);	if(!bm.CreateCompatibleBitmap(&dc,nWidth,nHeight))	{		dc.DeleteDC();		return FALSE;	}	CDC tdc;	if(!tdc.CreateCompatibleDC(&dc))	{		dc.DeleteDC();		return FALSE;	}	CBitmap*pOld = tdc.SelectObject(&bm);	if(pOld == NULL)	{		tdc.DeleteDC();		dc.DeleteDC();		return FALSE;	}	tdc.BitBlt(0,0,nWidth,nHeight,&dc,0,0,SRCCOPY);	tdc.SelectObject(pOld);		BITMAP btm;	bm.GetBitmap(&btm);	DWORD nSize  = btm.bmWidthBytes * btm.bmHeight;//	LPSTR lpData = (LPSTR)GlobalAllocPtr(GPTR,nSize);//	if(lpData == NULL)//	{//		tdc.DeleteDC();//		dc.DeleteDC();//		return FALSE;//	}	//--------------------------------------------------------	BITMAPINFOHEADER bih;	bih.biBitCount		= btm.bmBitsPixel;	bih.biClrImportant	= 0;	bih.biClrUsed		= 0;	bih.biCompression	= 0;	bih.biHeight		= btm.bmHeight;	bih.biPlanes		= 1;	bih.biSize			= sizeof(BITMAPINFOHEADER);	bih.biSizeImage		= nSize;	bih.biWidth			= btm.bmWidth;	bih.biXPelsPerMeter	= 0;	bih.biYPelsPerMeter	= 0;	//--------------------------------------------------------	//得到DIB色彩表	if(!GetDIBits(dc,bm,0,bih.biHeight,(pScreenData + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)),(BITMAPINFO*)&bih,DIB_RGB_COLORS))	{		tdc.DeleteDC();		dc.DeleteDC();		return FALSE;	}			//--------------------------------------------------------		BITMAPFILEHEADER bfh;	bfh.bfReserved1	= bfh.bfReserved2 = 0;	bfh.bfType		= ((WORD)('M'<< 8)|'B');	bfh.bfSize		= 54 + nSize;	bfh.bfOffBits	= 54;		memcpy(pScreenData,&bfh,sizeof(BITMAPFILEHEADER));	dwScreenData = sizeof(BITMAPFILEHEADER);		memcpy(pScreenData + dwScreenData,&bih,sizeof(BITMAPINFOHEADER));	dwScreenData += sizeof(BITMAPINFOHEADER);	//	memcpy(pScreenData,lpData,nSize);	dwScreenData += nSize;//	GlobalFreePtr(lpData);	tdc.DeleteDC();	dc.DeleteDC();	return TRUE;}
开发者ID:smallfishincup,项目名称:biyesheji,代码行数:92,


示例20: CheckPointer

//// GetMediaType//// Prefer 5 formats - 8, 16 (*2), 24 or 32 bits per pixel//// Prefered types should be ordered by quality, with zero as highest quality.// Therefore, iPosition =//      0    Return a 32bit mediatype//      1    Return a 24bit mediatype//      2    Return 16bit RGB565//      3    Return a 16bit mediatype (rgb555)//      4    Return 8 bit palettised format//      >4   Invalid//HRESULT CVCamPin::GetMediaType(int iPosition, CMediaType *pmt){    CheckPointer(pmt,E_POINTER);    CAutoLock cAutoLock(m_pFilter->pStateLock());    if(iPosition < 0)        return E_INVALIDARG;    // Have we run off the end of types?    if(iPosition > 4)        return VFW_S_NO_MORE_ITEMS;    VIDEOINFO *pvi = (VIDEOINFO *) pmt->AllocFormatBuffer(sizeof(VIDEOINFO));    if(NULL == pvi)        return(E_OUTOFMEMORY);    // Initialize the VideoInfo structure before configuring its members    ZeroMemory(pvi, sizeof(VIDEOINFO));    switch(iPosition)    {        case 0:        {                // Return our highest quality 32bit format            // Since we use RGB888 (the default for 32 bit), there is            // no reason to use BI_BITFIELDS to specify the RGB            // masks. Also, not everything supports BI_BITFIELDS            pvi->bmiHeader.biCompression = BI_RGB;            pvi->bmiHeader.biBitCount    = 32;            break;        }        case 1:        {   // Return our 24bit format            pvi->bmiHeader.biCompression = BI_RGB;            pvi->bmiHeader.biBitCount    = 24;            break;        }        case 2:        {                   // 16 bit per pixel RGB565            // Place the RGB masks as the first 3 doublewords in the palette area            for(int i = 0; i < 3; i++)                pvi->TrueColorInfo.dwBitMasks[i] = bits565[i];            pvi->bmiHeader.biCompression = BI_BITFIELDS;            pvi->bmiHeader.biBitCount    = 16;            break;        }        case 3:        {   // 16 bits per pixel RGB555            // Place the RGB masks as the first 3 doublewords in the palette area            for(int i = 0; i < 3; i++)                pvi->TrueColorInfo.dwBitMasks[i] = bits555[i];            pvi->bmiHeader.biCompression = BI_BITFIELDS;            pvi->bmiHeader.biBitCount    = 16;            break;        }        case 4:        {   // 8 bit palettised            pvi->bmiHeader.biCompression = BI_RGB;            pvi->bmiHeader.biBitCount    = 8;            pvi->bmiHeader.biClrUsed     = iPALETTE_COLORS;            break;        }    }    // Adjust the parameters common to all formats    pvi->bmiHeader.biSize       = sizeof(BITMAPINFOHEADER);    pvi->bmiHeader.biWidth      = m_iImageWidth;    pvi->bmiHeader.biHeight     = m_iImageHeight;    pvi->bmiHeader.biPlanes     = 1;    pvi->bmiHeader.biSizeImage  = GetBitmapSize(&pvi->bmiHeader);    pvi->bmiHeader.biClrImportant = 0;    SetRectEmpty(&(pvi->rcSource)); // we want the whole image area rendered.    SetRectEmpty(&(pvi->rcTarget)); // no particular destination rectangle//.........这里部分代码省略.........
开发者ID:yedaoq,项目名称:YedaoqToolSpace,代码行数:101,


示例21: ProcessDecaySrc

void ProcessDecaySrc(){    long mat, iso, nuc, ptr, src;  double vol, adens, lambda, tot, prev, I;  fprintf(out, "Processing decay source.../n");    /* Check total source rate */    if (RDB[DATA_TOT_PHOTON_SRC_RATE] == 0.0)    Error(0, "Total photon source rate is zero in decay source mode");  /* Loop over materials */  mat = (long)RDB[DATA_PTR_M0];  while (mat > VALID_PTR)    {      /* Get volume */      vol = RDB[mat + MATERIAL_VOLUME];      /* Check total photon source rate */	        if ((vol == 0.0) || ((RDB[mat + MATERIAL_PHOTON_SRC_RATE]/			    RDB[DATA_TOT_PHOTON_SRC_RATE]) < 1E-19))	{	  /* Next material */	  	  mat = NextItem(mat);	  /* Cycle loop */	  continue;	}      /* Check that pointer is not defined (NOTE: T
C++ CheckResult函数代码示例
C++ CheckPlayersFrostResist函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。