将CoCreateInstance DSP作为DMO并将其添加到DMO包装器过滤器使用IWMResizerProps :: SetFullCropRegion初始化DSP 连接输入引脚 通过IMediaObject :: SetOutputType设置输出类型 IGraphBuilder :: ConnectDirect输出引脚我这样写://Create Resizer DMOhr := CoCreateInstance(CLSID_DMOWrapperFilter, NIL, CLSCTX_ALL,IID_IBaseFilter, FResizerDMO);if FAILED(hr) then EXIT;//CLSID_CVideoResizerDMO = '{1ea1ea14-48f4-4054-ad1a-e8aee10ac805}'Hr := (FResizerDMO as IDMOWrapperFilter).Init( CLSID_CVideoResizerDMO, DMOCATEGORY_VIDEO_EFFECT );if FAILED(Hr) then EXIT;//Add filter to graph(fgRender as IGraphBuilder).AddFilter( FResizerDMO, 'Resizer' );if FAILED(Hr) then EXIT; // end create FResizerDMO in my graph// Set output type via IMediaObject::SetOutputType and create structure ZeroMemory(@mt, sizeof(DMO_MEDIA_TYPE));mt.majortype := MEDIATYPE_Video;mt.subtype := MEDIASUBTYPE_RGB32;mt.formattype := FORMAT_VideoInfo; mt.lSampleSize := pVIH.bmiHeader.biSize;FillChar(pVIH, SizeOf(TVideoInfoHeader), 0);mt.pbFormat := CoTaskMemAlloc(sizeof(VIDEOINFOHEADER));pVIH := TVideoInfoHeader(mt.pbFormat^);pVIH.bmiHeader.biWidth := 720;pVIH.bmiHeader.biHeight := 576;pVIH.bmiHeader.biXPelsPerMeter:=9;pVIH.bmiHeader.biYPelsPerMeter:=16;pVIH.bmiHeader.biSize := SizeOf(TBitmapInfoHeader);pVIH.bmiHeader.biSizeImage := 720 * 576 * 4;// connect pin and nexthr := (FResizerDMO as IMediaObject).SetOutputType(0,@mt,DMO_SET_TYPEF_CLEAR);在我收到 DMO_E_TYPE_NOT_ACCEPTED 的过程中.我哪里出问题了?谁能帮我?谢谢.解决方案对不起,我的英语.我写得很少以避免错误. videowindow1是pl_Win_DSPack的免费组件. videowindows1 =视频混合渲染器9.hr := CoCreateInstance(CLSID_CaptureGraphBuilder2, nil,CLSCTX_INPROC_SERVER,IID_ICaptureGraphBuilder2, ICapGraph);ICapGraph.SetFilterGraph(fgRender as IGraphBuilder); //*****************hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, FResizerDMO);hr := (FResizerDMO as IMediaObject).SetOutputType(0,@(pMT^),0);// or pMT DeleteMediaType(pMT);hr := ICapGraph.RenderStream(nil, nil, FResizerDMO, nil, VideoWindow1 as IBaseFilter);fgRender.Play;mc.Run; 1)使用此代码,视频不会调整大小.我在videowindow1中看到带有视频运行的小方块,videowindow1较大.2)使用GraphStudioNext,我建立了许多组合.只有ffdshow Video Decoder与ResizerDMO连接,并且在属性过滤器ResizerDMO中,我可以更改参数,但视频不会调整大小.不好意思,谢谢您的帮助I am using Video Resizer DSP Video Resizer DSP to resize my video.I work with Lazarus Free Pascal and DSPack.This site explains how to use: http://alax.info/blog/1371CoCreateInstance the DSP as DMO and add it to DMO Wrapper FilterUse IWMResizerProps::SetFullCropRegion to initialize the DSPConnect input pinSet output type via IMediaObject::SetOutputTypeIGraphBuilder::ConnectDirect output pinI write this://Create Resizer DMOhr := CoCreateInstance(CLSID_DMOWrapperFilter, NIL, CLSCTX_ALL,IID_IBaseFilter, FResizerDMO);if FAILED(hr) then EXIT;//CLSID_CVideoResizerDMO = '{1ea1ea14-48f4-4054-ad1a-e8aee10ac805}'Hr := (FResizerDMO as IDMOWrapperFilter).Init( CLSID_CVideoResizerDMO, DMOCATEGORY_VIDEO_EFFECT );if FAILED(Hr) then EXIT;//Add filter to graph(fgRender as IGraphBuilder).AddFilter( FResizerDMO, 'Resizer' );if FAILED(Hr) then EXIT; // end create FResizerDMO in my graph// Set output type via IMediaObject::SetOutputType and create structure ZeroMemory(@mt, sizeof(DMO_MEDIA_TYPE));mt.majortype := MEDIATYPE_Video;mt.subtype := MEDIASUBTYPE_RGB32;mt.formattype := FORMAT_VideoInfo; mt.lSampleSize := pVIH.bmiHeader.biSize;FillChar(pVIH, SizeOf(TVideoInfoHeader), 0);mt.pbFormat := CoTaskMemAlloc(sizeof(VIDEOINFOHEADER));pVIH := TVideoInfoHeader(mt.pbFormat^);pVIH.bmiHeader.biWidth := 720;pVIH.bmiHeader.biHeight := 576;pVIH.bmiHeader.biXPelsPerMeter:=9;pVIH.bmiHeader.biYPelsPerMeter:=16;pVIH.bmiHeader.biSize := SizeOf(TBitmapInfoHeader);pVIH.bmiHeader.biSizeImage := 720 * 576 * 4;// connect pin and nexthr := (FResizerDMO as IMediaObject).SetOutputType(0,@mt,DMO_SET_TYPEF_CLEAR);in hr i receive DMO_E_TYPE_NOT_ACCEPTED.where I go wrong? can anyone help me? thank you. 解决方案 sorry for my english. I write little to avoid errors. videowindow1 is component of pl_Win_DSPack for free pascal. videowindows1 = Video Mixing Renderer 9.hr := CoCreateInstance(CLSID_CaptureGraphBuilder2, nil,CLSCTX_INPROC_SERVER,IID_ICaptureGraphBuilder2, ICapGraph);ICapGraph.SetFilterGraph(fgRender as IGraphBuilder); //*****************hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, FResizerDMO);hr := (FResizerDMO as IMediaObject).SetOutputType(0,@(pMT^),0);// or pMT DeleteMediaType(pMT);hr := ICapGraph.RenderStream(nil, nil, FResizerDMO, nil, VideoWindow1 as IBaseFilter);fgRender.Play;mc.Run; 1)with this code, video does not resize.I see in videowindow1, small square with video run, videowindow1 is bigger.2)with GraphStudioNext i have established many combinations. Only ffdshow Video Decoder connects with ResizerDMO and in property filter ResizerDMO i change parameters but the video does not resize.excuse me, and thanks for your help 这篇关于如何使用AMMediaType进行视频过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-20 14:47