有调过DSPack的demo中的AsyncEx的朋友吗?发现在GraphEdit中一切正常,放在程序就出错了.(200)

  • 主题发起人 主题发起人 kivens
  • 开始时间 开始时间
K

kivens

Unregistered / Unconfirmed
GUEST, unregistred user!
我直接用的DSPACK下的那个AsyncEx的例子,未做任何修改,编译注册后用GraphEdit手动连接一切正常,但用代码来连接就不行了,以前从未接触过DSHOW,调试了两天,感觉非常困惑,望有经验的朋友帮忙看看到底是哪里的问题.非常感谢.测试的代码如下,SourceFilter直接用的Demo中的,未做修改:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DirectShow9, ActiveX, StdCtrls;type TForm1 = class(TForm) Button1: TButton;
procedure Button1Click(Sender: TObject);
private { Private declarations } public { Public declarations } end;
const CLSID_AsyncEx: TGUID = '{3E0FA044-926C-42D9-BA12-EF16E980913B}';var Form1: TForm1;
GraphID: Integer;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var pGraphBuilder: IGraphBuilder;
pFileStream: IBaseFilter;
EnumPins: IEnumPins;
OutPin: IPin;
hr: HRESULT;
pLoader: IFileSourceFilter;
fetched: ULONG;
begin
CoInitialize(nil);
hr := CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, IID_IGraphBuilder, pGraphBuilder);
//用CLSID_AsyncReader结果正确,如果用CLSID_AsyncEx,则最后Render时会返回 0x8004025F的错误 hr := CoCreateInstance(CLSID_AsyncEx, nil, CLSCTX_INPROC_SERVER, IID_IBaseFilter, pFileStream);
pGraphBuilder.AddFilter(pFileStream, 'SourceFilter');
pFileStream.QueryInterface(IID_IFileSourceFilter, pLoader);
hr := pLoader.Load('C:/WINDOWS/clock.avi', nil);
EnumPins := nil;
pFileStream.EnumPins(EnumPins);
EnumPins.Reset;
EnumPins.Next(1, OutPin, @fetched);
EnumPins := nil;
hr := pGraphBuilder.Render(OutPin);
//此处不成功 OutPin := nil;
IGraphBuilder := nil;
IBaseFilter := nil;
CoUninitialize();
end;

end.
 
已经OK了,在DSPACK的网站上找到调用的方法了
 
接分来了。
 
接受答案了.
 
后退
顶部