这篇教程C++ CreateFilter函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreateFilter函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateFilter函数的具体用法?C++ CreateFilter怎么用?C++ CreateFilter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreateFilter函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CreateFilterHRESULT 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;}
开发者ID:pics860,项目名称:callcenter,代码行数:35,
示例2: es_format_Initstatic 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 );}
开发者ID:Flameeyes,项目名称:vlc,代码行数:29,
示例3: CreateFilterHRESULT 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;}
开发者ID:pics860,项目名称:callcenter,代码行数:27,
示例4: CreateFilterstatic 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);}
开发者ID:LTNGlobal-opensource,项目名称:vlc-sdi,代码行数:7,
示例5: OnDoubleClickFiltervoid 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(); } } }}
开发者ID:JanChou,项目名称:mpc-hc,代码行数:30,
示例6: CreateAndInsertFilterHRESULT __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;}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:27,
示例7: Change_File_Sint 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; */}
开发者ID:DavideD,项目名称:BizHawk,代码行数:56,
示例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_FAILUREint 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;}
开发者ID:Scruf,项目名称:TestingFireWall,代码行数:59,
示例9: CreateFilterHRESULT 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;}
开发者ID:malpharo,项目名称:AiPI,代码行数:49,
示例10: ReleaseMoviePlayGraphHRESULT 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;}
开发者ID:enildne,项目名称:zest,代码行数:48,
示例11: LockcPidFilter *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;}
开发者ID:Saner2oo2,项目名称:descrambler,代码行数:16,
示例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();}
开发者ID:Remix99,项目名称:Arena_TC,代码行数:18,
示例13: getter_AddRefsnsresultnsBeckyFilters::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;}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:43,
示例14: LockcPidFilter *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;}
开发者ID:attuska,项目名称:Sasc-ng,代码行数:19,
示例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();}
开发者ID:Adiss,项目名称:wowserver,代码行数:21,
示例16: CreateFilterCC_FILE_ERROR FileIOFilter::SaveToFile(ccHObject* entities, const char* filename, CC_FILE_TYPES fType){ if (!entities || !filename || fType == UNKNOWN_FILE) return CC_FERR_BAD_ARGUMENT; FileIOFilter* fio = CreateFilter(fType); if (!fio) return CC_FERR_WRONG_FILE_TYPE; //if the file name has no extension, we had a default one! QString completeFileName(filename); if (QFileInfo(filename).suffix().isEmpty()) completeFileName += QString(".%1").arg(CC_FILE_TYPE_DEFAULT_EXTENSION[fType]); CC_FILE_ERROR result = fio->saveToFile(entities, qPrintable(completeFileName)); delete fio; fio = 0; return result;}
开发者ID:uplusplus,项目名称:cloudcompare,代码行数:21,
示例17: StopPreviewHRESULT CVideoRenderer::StartPreview(const RECT& rect, HWND hWnd){ StopPreview(); CComPtr<IBaseFilter> pSmartTee; m_pGraphBuilder->FindFilterByName( L"Smart Tee", &pSmartTee ); // Compressor CComPtr<IBaseFilter> pCompressor; CreateFilter( CLSID_H263Decoder, L"H.263 Decoder", &pCompressor ); CComPtr<IPin> pPinOut; pSmartTee->FindPin( L"Preview", &pPinOut ); if ( SUCCEEDED( m_pGraphBuilder->Render( pPinOut ) ) ) { PutIntoWindow( hWnd, rect, TRUE ); } return Run();}
开发者ID:pics860,项目名称:callcenter,代码行数:22,
示例18: CRtpReceiverFilterHRESULT CVideoRenderer::Connnect(){ HRESULT hr = S_OK; // Capture CRtpReceiverFilter* pReceiver = new CRtpReceiverFilter(NULL, &hr); VIDEOINFOHEADER vih; ZeroMemory( &vih, sizeof( vih ) ); vih.bmiHeader.biCompression = MAKEFOURCC('H','2','6','3'); pReceiver->SetupMediaType( &vih ); CComPtr<IBaseFilter> pCapture; pReceiver->QueryInterface( IID_IBaseFilter, (void**)&pCapture ); InstallFilter( pCapture, L"Video Receiver" ); // RenderStream CComPtr<IBaseFilter> pSmartTee; CreateFilter( CLSID_SmartTee, L"Smart Tee", &pSmartTee ); return ConnectFilter( pCapture, pSmartTee );}
开发者ID:pics860,项目名称:callcenter,代码行数:24,
示例19: LogSettingsDlgProcLRESULT CALLBACK LogSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch (uMsg) { case WM_INITDIALOG: { // Setup use log setting SendDlgItemMessage(hDlg, IDC_USELOGCB, BM_SETCHECK, uselog ? BST_CHECKED : BST_UNCHECKED, 0); SendMessage(hDlg, WM_COMMAND, IDC_USELOGCB, 0); // Setup log type setting SendDlgItemMessage(hDlg, IDC_LOGTYPECB, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_LOGTYPECB, CB_ADDSTRING, 0, (LPARAM)_16("Write to File")); SendDlgItemMessage(hDlg, IDC_LOGTYPECB, CB_ADDSTRING, 0, (LPARAM)_16("Write to Window")); SendDlgItemMessage(hDlg, IDC_LOGTYPECB, CB_SETCURSEL, logtype, 0); // Setup log filename setting SetDlgItemText(hDlg, IDC_LOGFILENAMEET, _16(logfilename)); // mini18n log settings SendDlgItemMessage(hDlg, IDC_USEMINI18NLOG, BM_SETCHECK, usemini18nlog ? BST_CHECKED : BST_UNCHECKED, 0); return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_USELOGCB: { if (SendDlgItemMessage(hDlg, LOWORD(wParam), BM_GETCHECK, 0, 0) == BST_CHECKED) { SendMessage(hDlg, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_LOGTYPECB, 0); EnableWindow(GetDlgItem(hDlg, IDC_LOGTYPECB), TRUE); } else { EnableWindow(GetDlgItem(hDlg, IDC_LOGTYPECB), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LOGFILENAMEET), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LOGBROWSEBT), FALSE); } return TRUE; } case IDC_LOGTYPECB: { switch(HIWORD(wParam)) { case CBN_SELCHANGE: { if (SendDlgItemMessage(hDlg, IDC_LOGTYPECB, CB_GETCURSEL, 0, 0) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_LOGFILENAMEET), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_LOGBROWSEBT), TRUE); } else { EnableWindow(GetDlgItem(hDlg, IDC_LOGFILENAMEET), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LOGBROWSEBT), FALSE); } return TRUE; } default: break; } return TRUE; } case IDC_LOGBROWSEBT: { WCHAR tempwstr[MAX_PATH]; WCHAR filter[1024]; OPENFILENAME ofn; // setup ofn structure ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hDlg; CreateFilter(filter, 1024, "Text Files", "*.txt", "All Files", "*.*", NULL); ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; GetDlgItemText(hDlg, IDC_LOGFILENAMEET, tempwstr, MAX_PATH); ofn.lpstrFile = tempwstr; ofn.nMaxFile = sizeof(tempwstr)/sizeof(WCHAR); ofn.Flags = OFN_OVERWRITEPROMPT; ofn.lpstrDefExt = _16("TXT"); if (GetSaveFileName(&ofn)) { SetDlgItemText(hDlg, IDC_LOGFILENAMEET, tempwstr); WideCharToMultiByte(CP_ACP, 0, tempwstr, -1, logfilename, MAX_PATH, NULL, NULL); } return TRUE; }//.........这里部分代码省略.........
开发者ID:DavideD,项目名称:BizHawk,代码行数:101,
示例20: DeleteFilterstatic picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic, video_format_t *p_fmt_in, video_format_t *p_fmt_out ){ picture_t *p_pif; if( !p_fmt_out->i_width && !p_fmt_out->i_height && p_fmt_out->i_sar_num && p_fmt_out->i_sar_den && p_fmt_out->i_sar_num * p_fmt_in->i_sar_den != p_fmt_out->i_sar_den * p_fmt_in->i_sar_num ) { p_fmt_out->i_width = p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den * p_fmt_in->i_width / p_fmt_in->i_sar_den / p_fmt_out->i_sar_num; p_fmt_out->i_visible_width = p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den * p_fmt_in->i_visible_width / p_fmt_in->i_sar_den / p_fmt_out->i_sar_num; } if( !p_fmt_out->i_chroma ) p_fmt_out->i_chroma = p_fmt_in->i_chroma; if( !p_fmt_out->i_width ) p_fmt_out->i_width = p_fmt_out->i_visible_width = p_fmt_in->i_width; if( !p_fmt_out->i_height ) p_fmt_out->i_height = p_fmt_out->i_visible_height = p_fmt_in->i_height; if( !p_fmt_out->i_sar_num ) p_fmt_out->i_sar_num = p_fmt_in->i_sar_num; if( !p_fmt_out->i_sar_den ) p_fmt_out->i_sar_den = p_fmt_in->i_sar_den; if( p_image->p_filter ) if( p_image->p_filter->fmt_in.video.i_chroma != p_fmt_in->i_chroma || p_image->p_filter->fmt_out.video.i_chroma != p_fmt_out->i_chroma ) { /* We need to restart a new filter */ DeleteFilter( p_image->p_filter ); p_image->p_filter = NULL; } /* Start a filter */ if( !p_image->p_filter ) { es_format_t fmt_in; es_format_Init( &fmt_in, VIDEO_ES, p_fmt_in->i_chroma ); fmt_in.video = *p_fmt_in; p_image->p_filter = CreateFilter( p_image->p_parent, &fmt_in, p_fmt_out ); 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_in; p_image->p_filter->fmt_out.video = *p_fmt_out; } picture_Hold( p_pic ); p_pif = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic ); if( p_fmt_in->i_chroma == p_fmt_out->i_chroma && p_fmt_in->i_width == p_fmt_out->i_width && p_fmt_in->i_height == p_fmt_out->i_height ) { /* Duplicate image */ picture_Release( p_pif ); /* XXX: Better fix must be possible */ p_pif = filter_NewPicture( p_image->p_filter ); if( p_pif ) picture_Copy( p_pif, p_pic ); } return p_pif;}
开发者ID:BossKing,项目名称:vlc,代码行数:76,
示例21: DeleteEncoderstatic block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic, video_format_t *p_fmt_in, video_format_t *p_fmt_out ){ block_t *p_block; /* Check if we can reuse the current encoder */ if( p_image->p_enc && ( p_image->p_enc->fmt_out.i_codec != p_fmt_out->i_chroma || p_image->p_enc->fmt_out.video.i_width != p_fmt_out->i_width || p_image->p_enc->fmt_out.video.i_height != p_fmt_out->i_height ) ) { DeleteEncoder( p_image->p_enc ); p_image->p_enc = 0; } /* Start an encoder */ if( !p_image->p_enc ) { p_image->p_enc = CreateEncoder( p_image->p_parent, p_fmt_in, p_fmt_out ); if( !p_image->p_enc ) return NULL; } /* Check if we need chroma conversion or resizing */ if( p_image->p_enc->fmt_in.video.i_chroma != p_fmt_in->i_chroma || p_image->p_enc->fmt_in.video.i_width != p_fmt_in->i_width || p_image->p_enc->fmt_in.video.i_height != p_fmt_in->i_height ) { picture_t *p_tmp_pic; if( p_image->p_filter ) if( p_image->p_filter->fmt_in.video.i_chroma != p_fmt_in->i_chroma || p_image->p_filter->fmt_out.video.i_chroma != p_image->p_enc->fmt_in.video.i_chroma ) { /* We need to restart a new filter */ DeleteFilter( p_image->p_filter ); p_image->p_filter = 0; } /* Start a filter */ if( !p_image->p_filter ) { es_format_t fmt_in; es_format_Init( &fmt_in, VIDEO_ES, p_fmt_in->i_chroma ); fmt_in.video = *p_fmt_in; p_image->p_filter = CreateFilter( p_image->p_parent, &fmt_in, &p_image->p_enc->fmt_in.video ); if( !p_image->p_filter ) { return NULL; } } else { /* Filters should handle on-the-fly size changes */ p_image->p_filter->fmt_in.i_codec = p_fmt_in->i_chroma; p_image->p_filter->fmt_out.video = *p_fmt_in; p_image->p_filter->fmt_out.i_codec =p_image->p_enc->fmt_in.i_codec; p_image->p_filter->fmt_out.video = p_image->p_enc->fmt_in.video; } picture_Hold( p_pic ); p_tmp_pic = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic ); if( likely(p_tmp_pic != NULL) ) { p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, p_tmp_pic ); picture_Release( p_tmp_pic ); } else p_block = NULL; } else { p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, p_pic ); } if( !p_block ) { msg_Dbg( p_image->p_parent, "no image encoded" ); return 0; } return p_block;}
开发者ID:BossKing,项目名称:vlc,代码行数:93,
示例22: DeleteDecoderstatic picture_t *ImageRead( image_handler_t *p_image, block_t *p_block, video_format_t *p_fmt_in, video_format_t *p_fmt_out ){ picture_t *p_pic = NULL, *p_tmp; /* Check if we can reuse the current decoder */ if( p_image->p_dec && p_image->p_dec->fmt_in.i_codec != p_fmt_in->i_chroma ) { DeleteDecoder( p_image->p_dec ); p_image->p_dec = 0; } /* Start a decoder */ if( !p_image->p_dec ) { p_image->p_dec = CreateDecoder( p_image->p_parent, p_fmt_in ); if( !p_image->p_dec ) { block_Release(p_block); return NULL; } } p_block->i_pts = p_block->i_dts = mdate(); while( (p_tmp = p_image->p_dec->pf_decode_video( p_image->p_dec, &p_block )) != NULL ) { if( p_pic != NULL ) picture_Release( p_pic ); p_pic = p_tmp; } if( p_pic == NULL ) { msg_Warn( p_image->p_parent, "no image decoded" ); return 0; } if( !p_fmt_out->i_chroma ) p_fmt_out->i_chroma = p_image->p_dec->fmt_out.video.i_chroma; if( !p_fmt_out->i_width && p_fmt_out->i_height ) p_fmt_out->i_width = (int64_t)p_image->p_dec->fmt_out.video.i_width * p_image->p_dec->fmt_out.video.i_sar_num * p_fmt_out->i_height / p_image->p_dec->fmt_out.video.i_height / p_image->p_dec->fmt_out.video.i_sar_den; if( !p_fmt_out->i_height && p_fmt_out->i_width ) p_fmt_out->i_height = (int64_t)p_image->p_dec->fmt_out.video.i_height * p_image->p_dec->fmt_out.video.i_sar_den * p_fmt_out->i_width / p_image->p_dec->fmt_out.video.i_width / p_image->p_dec->fmt_out.video.i_sar_num; if( !p_fmt_out->i_width ) p_fmt_out->i_width = p_image->p_dec->fmt_out.video.i_width; if( !p_fmt_out->i_height ) p_fmt_out->i_height = p_image->p_dec->fmt_out.video.i_height; if( !p_fmt_out->i_visible_width ) p_fmt_out->i_visible_width = p_fmt_out->i_width; if( !p_fmt_out->i_visible_height ) p_fmt_out->i_visible_height = p_fmt_out->i_height; /* Check if we need chroma conversion or resizing */ if( p_image->p_dec->fmt_out.video.i_chroma != p_fmt_out->i_chroma || p_image->p_dec->fmt_out.video.i_width != p_fmt_out->i_width || p_image->p_dec->fmt_out.video.i_height != p_fmt_out->i_height ) { if( p_image->p_filter ) if( p_image->p_filter->fmt_in.video.i_chroma != p_image->p_dec->fmt_out.video.i_chroma || p_image->p_filter->fmt_out.video.i_chroma != p_fmt_out->i_chroma ) { /* We need to restart a new filter */ DeleteFilter( p_image->p_filter ); p_image->p_filter = 0; } /* Start a filter */ if( !p_image->p_filter ) { p_image->p_filter = CreateFilter( p_image->p_parent, &p_image->p_dec->fmt_out, p_fmt_out ); if( !p_image->p_filter ) { picture_Release( p_pic ); return NULL; } } else { /* Filters should handle on-the-fly size changes */ p_image->p_filter->fmt_in = p_image->p_dec->fmt_out; p_image->p_filter->fmt_out = p_image->p_dec->fmt_out; p_image->p_filter->fmt_out.i_codec = p_fmt_out->i_chroma; p_image->p_filter->fmt_out.video = *p_fmt_out; }//.........这里部分代码省略.........
开发者ID:BossKing,项目名称:vlc,代码行数:101,
示例23: Openstatic int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys){ int err = VLC_EGENERIC; directx_sys_t *dx_sys; if (pix_fmt != AV_PIX_FMT_DXVA2_VLD) return VLC_EGENERIC; vlc_va_sys_t *sys = calloc(1, sizeof (*sys)); if (unlikely(sys == NULL)) return VLC_ENOMEM; /* Load dll*/ sys->hd3d9_dll = LoadLibrary(TEXT("D3D9.DLL")); if (!sys->hd3d9_dll) { msg_Warn(va, "cannot load d3d9.dll"); goto error; } dx_sys = &sys->dx_sys; dx_sys->pf_check_device = CheckDevice; dx_sys->pf_create_device = D3dCreateDevice; dx_sys->pf_destroy_device = D3dDestroyDevice; dx_sys->pf_create_device_manager = D3dCreateDeviceManager; dx_sys->pf_destroy_device_manager = D3dDestroyDeviceManager; dx_sys->pf_create_video_service = DxCreateVideoService; dx_sys->pf_destroy_video_service = DxDestroyVideoService; dx_sys->pf_create_decoder_surfaces = DxCreateVideoDecoder; dx_sys->pf_destroy_surfaces = DxDestroyVideoDecoder; dx_sys->pf_setup_avcodec_ctx = SetupAVCodecContext; dx_sys->pf_get_input_list = DxGetInputList; dx_sys->pf_setup_output = DxSetupOutput; dx_sys->pf_alloc_surface_pic = DxAllocPicture; dx_sys->psz_decoder_dll = TEXT("DXVA2.DLL"); va->sys = sys; dx_sys->d3ddev = NULL; if (p_sys!=NULL) IDirect3DSurface9_GetDevice(p_sys->surface, (IDirect3DDevice9**) &dx_sys->d3ddev ); err = directx_va_Open(va, &sys->dx_sys, ctx, fmt, true); if (err!=VLC_SUCCESS) goto error; if (p_sys == NULL) { sys->filter = CreateFilter( VLC_OBJECT(va), fmt, VLC_CODEC_YV12); if (sys->filter == NULL) goto error; } err = directx_va_Setup(va, &sys->dx_sys, ctx); if (err != VLC_SUCCESS) goto error; ctx->hwaccel_context = &sys->hw; /* TODO print the hardware name/vendor for debugging purposes */ va->description = DxDescribe(sys); va->setup = Setup; va->get = Get; va->release = directx_va_Release; va->extract = Extract; return VLC_SUCCESS;error: Close(va, ctx); return VLC_EGENERIC;}
开发者ID:joshkosh,项目名称:vlc,代码行数:72,
示例24: DeleteDecoder//.........这里部分代码省略......... int ret = p_image->p_dec->pf_decode( p_image->p_dec, p_block ); if( ret == VLCDEC_SUCCESS ) { /* Drain */ p_image->p_dec->pf_decode( p_image->p_dec, NULL ); p_pic = picture_fifo_Pop( p_image->outfifo ); unsigned lostcount = 0; picture_t *lostpic; while( ( lostpic = picture_fifo_Pop( p_image->outfifo ) ) != NULL ) { picture_Release( lostpic ); lostcount++; } if( lostcount > 0 ) msg_Warn( p_image->p_parent, "Image decoder output more than one " "picture (%d)", lostcount ); } if( p_pic == NULL ) { msg_Warn( p_image->p_parent, "no image decoded" ); return 0; } if( !p_fmt_out->i_chroma ) p_fmt_out->i_chroma = p_image->p_dec->fmt_out.video.i_chroma; if( !p_fmt_out->i_width && p_fmt_out->i_height ) p_fmt_out->i_width = (int64_t)p_image->p_dec->fmt_out.video.i_width * p_image->p_dec->fmt_out.video.i_sar_num * p_fmt_out->i_height / p_image->p_dec->fmt_out.video.i_height / p_image->p_dec->fmt_out.video.i_sar_den; if( !p_fmt_out->i_height && p_fmt_out->i_width ) p_fmt_out->i_height = (int64_t)p_image->p_dec->fmt_out.video.i_height * p_image->p_dec->fmt_out.video.i_sar_den * p_fmt_out->i_width / p_image->p_dec->fmt_out.video.i_width / p_image->p_dec->fmt_out.video.i_sar_num; if( !p_fmt_out->i_width ) p_fmt_out->i_width = p_image->p_dec->fmt_out.video.i_width; if( !p_fmt_out->i_height ) p_fmt_out->i_height = p_image->p_dec->fmt_out.video.i_height; if( !p_fmt_out->i_visible_width ) p_fmt_out->i_visible_width = p_fmt_out->i_width; if( !p_fmt_out->i_visible_height ) p_fmt_out->i_visible_height = p_fmt_out->i_height; /* Check if we need chroma conversion or resizing */ if( p_image->p_dec->fmt_out.video.i_chroma != p_fmt_out->i_chroma || p_image->p_dec->fmt_out.video.i_width != p_fmt_out->i_width || p_image->p_dec->fmt_out.video.i_height != p_fmt_out->i_height ) { if( p_image->p_filter ) if( p_image->p_filter->fmt_in.video.i_chroma != p_image->p_dec->fmt_out.video.i_chroma || p_image->p_filter->fmt_out.video.i_chroma != p_fmt_out->i_chroma ) { /* We need to restart a new filter */ DeleteFilter( p_image->p_filter ); p_image->p_filter = 0; } /* Start a filter */ if( !p_image->p_filter ) { p_image->p_filter = CreateFilter( p_image->p_parent, &p_image->p_dec->fmt_out, p_fmt_out ); if( !p_image->p_filter ) { picture_Release( p_pic ); return NULL; } } else { /* Filters should handle on-the-fly size changes */ p_image->p_filter->fmt_in = p_image->p_dec->fmt_out; p_image->p_filter->fmt_out = p_image->p_dec->fmt_out; p_image->p_filter->fmt_out.i_codec = p_fmt_out->i_chroma; p_image->p_filter->fmt_out.video = *p_fmt_out; } p_pic = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic ); video_format_Clean( p_fmt_out ); video_format_Copy( p_fmt_out, &p_image->p_filter->fmt_out.video ); } else { video_format_Clean( p_fmt_out ); video_format_Copy( p_fmt_out, &p_image->p_dec->fmt_out.video ); } return p_pic;}
开发者ID:tguillem,项目名称:vlc,代码行数:101,
注:本文中的CreateFilter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CreateFontIndirect函数代码示例 C++ CreateFileW函数代码示例 |