📄 outputpin.cpp
字号:
/***************************************************************************************
* Directshow Filter Integrateion source code is developped by Mr. Xie Haijun.
*
* DHCODEC is authorized to use this code for free.
*
* Date: 2007-April-02.
*
*****************************************************************************************/
// OutputPin.cpp: implementation of the COutputPin class.
//
//////////////////////////////////////////////////////////////////////
#include "OutputPin.h"
#include "MyFilter.h"
#include "guid.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
COutputPin::COutputPin(CArbitrateFilter *pFilter,HRESULT *phr)
:CBaseOutputPin(NAME("Net_Stream"),pFilter,&pFilter->mFilterLock,phr, L"s264压缩数据")
{
pMyFilter=pFilter;
}
COutputPin::~COutputPin()
{
}
HRESULT COutputPin::CheckMediaType(const CMediaType *mtIn)
{
ASSERT(pMyFilter->mInputPin != NULL);
/* if ((pMyFilter->mInputPin->IsConnected() == FALSE))
{
return E_INVALIDARG;
}
*/
CheckPointer(mtIn,E_POINTER);
// Check this is a VIDEOINFO type
if(*mtIn->FormatType() != FORMAT_s264CodeInfo)
{
return E_INVALIDARG;
}
// Is this a palettised format
if((IsEqualGUID(*mtIn->Type(), MEDIATYPE_s264Code)) &&
(IsEqualGUID(*mtIn->Subtype(), MEDIASUBTYPE_s264Code)))
{
// MessageBox(NULL,"CheckMediaType success",NULL,NULL);
return NOERROR;
}
// MessageBox(NULL,"CheckMediaType fail",NULL,NULL);
return E_FAIL;
}
HRESULT COutputPin::DecideBufferSize(IMemAllocator *pAlloc,ALLOCATOR_PROPERTIES * pprop)
{
// MessageBox(NULL,"DecideBufferSize",NULL,NULL);
pprop->cbBuffer=320*240*3/2;
pprop->cBuffers=1;
pprop->cbAlign=1;
ALLOCATOR_PROPERTIES Actual;
HRESULT hr=pAlloc->SetProperties(pprop,&Actual);
return hr;
return NOERROR;
}
HRESULT COutputPin::GetMediaType(int iPosition,CMediaType *pMediaType)
{
if(iPosition < 0)
{
return E_INVALIDARG;
}
if(iPosition > 0)
{
return VFW_S_NO_MORE_ITEMS;
}
CheckPointer(pMediaType,E_POINTER);
pMediaType->SetFormatType(&FORMAT_s264CodeInfo);
pMediaType->SetType(&MEDIATYPE_s264Code);
pMediaType->SetSubtype(&MEDIASUBTYPE_s264Code);
return NOERROR;
}
STDMETHODIMP COutputPin::NonDelegatingQueryInterface(REFIID riid,void **ppv)
{
CheckPointer(ppv,E_POINTER);
return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -