本文整理汇总了C++中CreateFilter函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateFilter函数的具体用法?C++ CreateFilter怎么用?C++ CreateFilter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateFilter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFilter
HRESULT CVideoCapture::ConnnectTo(LPCWSTR lpszCapture)
{
HRESULT hr = S_OK;
// Capture
CComPtr<IBaseFilter> pCapture;
CreateFilter( lpszCapture, L"Video Capture", &pCapture );
// Compressor
CComPtr<IBaseFilter> pCompressor;
CreateFilter( CLSID_H263Encoder, L"H.263 Encoder", &pCompressor );
// Renderer
CRtpSenderFilter* pSender = new CRtpSenderFilter(NULL, &hr);
VIDEOINFOHEADER vih;
ZeroMemory( &vih, sizeof( vih ) );
vih.bmiHeader.biCompression = MAKEFOURCC('H','2','6','3');
pSender->SetupMediaType( &vih );
CComPtr<IBaseFilter> pRenderer;
pSender->QueryInterface( IID_IBaseFilter, (void**)&pRenderer );
InstallFilter( pRenderer, L"Video Sender" );
// RenderStream
if ( SUCCEEDED(hr) ) hr =
m_pCapGraphBuilder->RenderStream( &PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video, pCapture, pCompressor, pRenderer );
Run(); return hr;
}
示例2: es_format_Init
static picture_t *ImageFilter( image_handler_t *p_image, picture_t *p_pic,
video_format_t *p_fmt, const char *psz_module )
{
/* Start a filter */
if( !p_image->p_filter )
{
es_format_t fmt;
es_format_Init( &fmt, VIDEO_ES, p_fmt->i_chroma );
fmt.video = *p_fmt;
p_image->p_filter =
CreateFilter( p_image->p_parent, &fmt, &fmt.video, psz_module );
if( !p_image->p_filter )
{
return NULL;
}
}
else
{
/* Filters should handle on-the-fly size changes */
p_image->p_filter->fmt_in.video = *p_fmt;
p_image->p_filter->fmt_out.video = *p_fmt;
}
picture_Hold( p_pic );
return p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
}
示例3: CreateFilter
HRESULT CGraphRender::RenderPreview(LPCWSTR lpszCapture, WAVEFORMATEX& pwfx, DWORD nReserved)
{
HRESULT hr = S_OK;
// Capture
CComPtr<IBaseFilter> pCapture;
hr = CreateFilter( lpszCapture, L"Audio Renderer", &pCapture );
// Renderer
CComPtr<IBaseFilter> pRenderer;
if ( SUCCEEDED(hr) && pCapture && FAILED(
hr = m_pGraphBuilder->FindFilterByName( L"Audio Receiver", &pRenderer )) )
{
hr = InstallRender( new CRtpReceiverFilter(Payload_Alaw, &pwfx, this), L"Audio Receiver", &pRenderer );
}
// RenderStream
CComPtr<IPin> pPinOut;
pRenderer->FindPin( L"Preview", &pPinOut );
hr = m_pGraphBuilder->Render( pPinOut );
return hr;
}
示例4: CreateFilter
static filter_t *FindResampler (vlc_object_t *obj,
const audio_sample_format_t *infmt,
const audio_sample_format_t *outfmt)
{
return CreateFilter (obj, "audio resampler", "$audio-resampler", NULL,
infmt, outfmt);
}
示例5: OnDoubleClickFilter
void CPPageExternalFilters::OnDoubleClickFilter()
{
if (FilterOverride* f = GetCurFilter()) {
CComPtr<IBaseFilter> pBF;
CString name;
if (f->type == FilterOverride::REGISTERED) {
CStringW namew;
if (CreateFilter(f->dispname, &pBF, namew)) {
name = namew;
}
} else if (f->type == FilterOverride::EXTERNAL) {
if (SUCCEEDED(LoadExternalFilter(f->path, f->clsid, &pBF))) {
name = f->name;
}
}
if (CComQIPtr<ISpecifyPropertyPages> pSPP = pBF) {
CComPropertySheet ps(name, this);
if (ps.AddPages(pSPP) > 0) {
CComPtr<IFilterGraph> pFG;
if (SUCCEEDED(pFG.CoCreateInstance(CLSID_FilterGraph))) {
pFG->AddFilter(pBF, L"");
}
ps.DoModal();
}
}
}
}
示例6: CreateAndInsertFilter
HRESULT __fastcall CreateAndInsertFilter( IGraphBuilder *pFilterGraph,
REFGUID clsidFilter,
IBaseFilter** ppBaseFilter,
LPCWSTR lpcwstrName)
{
HRESULT hr=S_OK;
if(!pFilterGraph || !ppBaseFilter )
{
return E_POINTER;
}
*ppBaseFilter = NULL;
hr = CreateFilter(clsidFilter, ppBaseFilter);
if(SUCCEEDED(hr))
{
hr = pFilterGraph->AddFilter(*ppBaseFilter, lpcwstrName);
if(FAILED(hr))
{ // all or nothing:
(*ppBaseFilter)->Release();
*ppBaseFilter = NULL;
}
}
return hr;
}
示例7: Change_File_S
int Change_File_S(char *Dest, char *Dir, char *Titre, char *Filter, char *Ext, HWND hwnd)
{
WCHAR filter[1024];
OPENFILENAME ofn;
CreateFilter(filter, 1024,
"Watchlist", "*.wch",
"All files (*.*)", "*.*", NULL);
SetupOFN(&ofn, OFN_DEFAULTSAVE, hwnd, filter,
watchfilename, sizeof(watchfilename)/sizeof(TCHAR));
ofn.lpstrDefExt = (LPCWSTR)_16(Ext);
if (GetSaveFileName(&ofn)) {
char text[1024];
WideCharToMultiByte(CP_ACP, 0, watchfilename, -1, text, sizeof(text), NULL, NULL);
strcpy(Dest, text);
return 1;
}
return 0;
/*
OPENFILENAME ofn;
SetCurrentDirectory(Gens_Path);
if (!strcmp(Dest, ""))
{
strcpy(Dest, "default.");
strcat(Dest, Ext);
}
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = y_hInstance;
ofn.lpstrFile = Dest;
ofn.nMaxFile = 2047;
ofn.lpstrFilter = Filter;
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = Dir;
ofn.lpstrTitle = Titre;
ofn.lpstrDefExt = Ext;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
if (GetSaveFileName(&ofn)) return 1;
return 0;
*/
}
示例8: main
/// The main function. Creates a filter, configures it, launches the
/// filtering thread, handles user input, and cleans up resources when
/// exiting. The intention is to run this program with a command line
/// argument specifying the configuration file to use.
/// @param argc Number of command line arguments
/// @param argv Command line arguments
/// @return EXIT_SUCCESS or EXIT_FAILURE
int main(int argc, char* argv[])
{
// TODO: implement function
char input[20];
short mode;
pthread_t filterThread;
int rc;
if (argc != 2){
fprintf(stderr, "usage: firewall <config_file>\n");
return EXIT_SUCCESS;
}
IpPktFilter filter = CreateFilter();
if (!ConfigureFilter(filter, argv[1])){
return EXIT_FAILURE;
}
rc = pthread_create(&filterThread, NULL, FilterThread, (void*) filter);
if (rc){
fprintf(stderr, "Could not create filter thread");
return EXIT_FAILURE;
}
DisplayMenu();
while(Mode){
printf("> ");
char* s = fgets(input, 20 , stdin);
if (s){};
mode = ((short) input[0]) -48;
if (mode == MODE_BLOCK_ALL){
Mode = MODE_BLOCK_ALL;
}
else if (mode == MODE_ALLOW_ALL){
Mode = MODE_ALLOW_ALL;
}
else if (mode == MODE_FILTER){
Mode = MODE_FILTER;
}
else if (mode == 0){
Mode = 0;
pthread_join(filterThread, NULL);
break;
}
}
DestroyFilter(filter);
return EXIT_SUCCESS;
}
示例9: CreateFilter
HRESULT CMediaPlayerDlg::RenderWMFile(LPCWSTR wFile)
{
HRESULT hr=S_OK;
IFileSourceFilter *pFS=NULL;
IBaseFilter *pReader=NULL;
// Load the improved ASF reader filter by CLSID
hr = CreateFilter(CLSID_WMAsfReader, &pReader);
if(FAILED(hr))
{
MPRetailOutput(TEXT("Failed to create WMAsfWriter filter! hr=0x%x\n"), hr);
return hr;
}
// Add the ASF reader filter to the graph. For ASF/WMV/WMA content,
// this filter is NOT the default and must be added explicitly.
hr = pGB_MP->AddFilter(pReader, L"ASF Reader");
if(FAILED(hr))
{
MPRetailOutput(TEXT("Failed to add ASF reader filter to graph! hr=0x%x\n"), hr);
pReader->Release();
return hr;
}
//
// Windows Media 9 Series (code named 'Corona') no longer requires
// a stub library. If using WMF9, we don't need to provide a CKeyProvider
// implementation, and we don't need to link with the WMStub.lib library.
//
#ifndef TARGET_WMF9
// Create the key provider that will be used to unlock the WM SDK
JIF(AddKeyProvider(pGB_MP));
#endif
// Set its source filename
JIF(pReader->QueryInterface(IID_IFileSourceFilter, (void **) &pFS));
JIF(pFS->Load(wFile, NULL));
pFS->Release();
CLEANUP:
// If there was a rendering error, make sure that the reader is released
//
// Otherwise, wince the graph is built and the filters are added to
// the graph, the WM ASF reader interface can be released.
SAFE_RELEASE(pReader);
return hr;
}
示例10: ReleaseMoviePlayGraph
HRESULT CDShowControl::CreateMoviePlayGraph(HWND hWnd, CString fileName)
{
HRESULT hr;
CComPtr<IEnumPins> pEnumPins, pEnumPins2;
IPin *pPin = NULL;
PIN_DIRECTION direction;
BOOL isSuccess = FALSE;
CComPtr<IBaseFilter> pWMVReader;
ReleaseMoviePlayGraph();
RETURNIF(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED));
RETURNIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&m_moviePlayGraph));
CoUninitialize();
RETURNIF(CreateFilter(L"WM ASF Reader",&pWMVReader,FILTERCG_DSHOW));
CComQIPtr<IFileSourceFilter> pFileSrcFilter(pWMVReader);
pFileSrcFilter->Load(fileName.AllocSysString(),NULL);
RETURNIF(m_moviePlayGraph->AddFilter(pWMVReader,L"WMVReader"));
RETURNIF(pWMVReader->EnumPins(&pEnumPins));
while (pEnumPins->Next(1, &pPin, 0) == S_OK)
{
RETURNIF(pPin->QueryDirection(&direction));
if (direction == PINDIR_OUTPUT)
{
m_moviePlayGraph->Render(pPin);
}
SAFE_RELEASE(pPin);
}
CComQIPtr<IVideoWindow>pVW(m_moviePlayGraph);
if (pVW != NULL)
{
CComQIPtr<IBasicVideo> pBV(m_moviePlayGraph);
CRect rect,videoRect;
RETURNIF(pVW->put_Owner((OAHWND)hWnd));
RETURNIF(pVW->put_WindowStyle(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS));
RETURNIF(pVW->put_MessageDrain((long)hWnd));
CRect ClientRect;
::GetClientRect(hWnd, &ClientRect);
pVW->SetWindowPosition(0, 0, ClientRect.Width(), ClientRect.Height());
pVW->put_AutoShow(OATRUE);
pVW->put_Visible(OATRUE);
}
return S_OK;
}
示例11: Lock
cPidFilter *cAction::NewFilter(int IdleTime)
{
Lock();
cPidFilter *filter=CreateFilter(unique++,IdleTime);
if(filter) {
if(!Active()) {
Start();
PRINTF(L_CORE_ACTION,"%s: started",id);
}
filters.Add(filter);
}
else
PRINTF(L_CORE_ACTION,"%s: failed to create filter",id);
Unlock();
return filter;
}
示例12: _polyLength
////////////////// PathGenerator //////////////////
PathGenerator::PathGenerator(const Unit* owner) :
_polyLength(0), _type(PATHFIND_BLANK),
_useStraightPath(false), _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH),
_sourceUnit(owner), _navMesh(NULL), _navMeshQuery(NULL), _endPosition(Vector3::zero())
{
sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow());
uint32 mapId = _sourceUnit->GetMapId();
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
_navMesh = mmap->GetNavMesh(mapId);
_navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId());
}
CreateFilter();
}
示例13: getter_AddRefs
nsresult
nsBeckyFilters::ParseFilterFile(nsIFile *aFile, bool aIncoming)
{
nsresult rv;
nsCOMPtr<nsILineInputStream> lineStream;
rv = nsBeckyUtils::CreateLineInputStream(aFile, getter_AddRefs(lineStream));
NS_ENSURE_SUCCESS(rv, rv);
bool more = true;
nsAutoCString line;
nsCOMPtr<nsIMsgFilter> filter;
while (NS_SUCCEEDED(rv) && more) {
rv = lineStream->ReadLine(line, &more);
switch (line.CharAt(0)) {
case ':':
if (line.EqualsLiteral(":Begin \"\"")) {
CreateFilter(aIncoming, getter_AddRefs(filter));
} else if (line.EqualsLiteral(":End \"\"")) {
if (filter)
AppendFilter(filter);
filter = nullptr;
}
break;
case '!':
SetRuleAction(line, filter);
break;
case '@':
SetSearchTerm(line, filter);
break;
case '$': // $X: disabled
if (StringBeginsWith(line, NS_LITERAL_CSTRING("$X")) && filter) {
filter->SetEnabled(false);
}
break;
default:
break;
}
}
return NS_OK;
}
示例14: Lock
cPidFilter *cAction::NewFilter(int IdleTime)
{
Lock();
cPidFilter *filter=CreateFilter(id,unique++,dvbNum,IdleTime);
if(filter && filter->Open()) {
if(!Active()) {
Start();
PRINTF(L_CORE_ACTION,"%s: started",id);
}
filters.Add(filter);
}
else {
PRINTF(L_CORE_ACTION,"%s: filter '%s' failed to open",id,filter?filter->id:"XxX");
delete filter;
filter=0;
}
Unlock();
return filter;
}
示例15: _polyLength
////////////////// PathGenerator //////////////////
PathGenerator::PathGenerator(const Unit* owner) :
_polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false),
_forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), _straightLine(false),
_endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL),
_navMeshQuery(NULL)
{
memset(_pathPolyRefs, 0, sizeof(_pathPolyRefs));
TC_LOG_DEBUG("maps", "++ PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow());
uint32 mapId = _sourceUnit->GetMapId();
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
_navMesh = mmap->GetNavMesh(mapId);
_navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId());
}
CreateFilter();
}