16,471
社区成员
发帖
与我相关
我的任务
分享
hr = m_pCapGB->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, capfilter, NULL, xfilter);
class XVideoInputPin : public CBaseInputPin
{
public:
XVideoInputPin(XFilter *pFilter, HRESULT *phr, LPCWSTR pName, unsigned int pinNumber);
~XVideoInputPin();
HRESULT CheckMediaType(const CMediaType *);
STDMETHODIMP Receive(IMediaSample *pSample);
protected:
XFilter* m_pFilter;
};
HRESULT XVideoInputPin::CheckMediaType(const CMediaType *pmt)
{
if(pmt->majortype == MEDIATYPE_Video){
//.............
//打印帧率代码省略.......
return S_OK;
}
return VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT XVideoInputPin::Receive(IMediaSample *pSample)
{
HRESULT hr = CBaseInputPin::Receive(pSample);
if (SUCCEEDED(hr)){
LONG InputLength;
unsigned char *pInputBuffer;
REFERENCE_TIME StartTime, EndTime;
InputLength = pSample->GetActualDataLength();
pSample->GetPointer(&pInputBuffer);
pSample->GetTime(&StartTime, &EndTime);
//打印帧间隔
static UINT ptk = 0;
TRACE(_T("v tk is %d\n"), StartTime/10000 - ptk);
ptk = StartTime/10000;
}
return S_OK;
}