delphi开发mp3播放器的问题 ( 积分: 200 )

  • 主题发起人 主题发起人 para
  • 开始时间 开始时间
P

para

Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi的dspack开发一个简单的mp3播放器,使用RenderFile自动组织链路播放mp3一切正常,用自定义链路的方式(和自动时候的链路一样)播放没问题,就是收不到播放完毕的事件通知,不知何故,望高手指点一二
相关代码:
...
var
ISF: IBaseFilter;

pin_in,pin_out: IPin;

...
//创建链路
case self.nRenderMode of
1:
begin

self.FilterGraph_Media.RenderFile(sFile);

end;


2:
begin

(self.FilterGraph_Media as IGraphBuilder).AddSourceFilter(StringToOleStr(sFile), StringToOleStr( "{E436EBB5-524F-11CE-9F53-0020AF0BA770} "), ISF);

ISF.FindPin( "Output ",pin_out);

(self.FilterGraph_Media as IGraphBuilder).AddFilter(self.Filter_Splitter as IBaseFilter, "Splitter ");

(self.Filter_Splitter as IBaseFilter).FindPin( "Input ", pin_in);

(self.FilterGraph_Media as IGraphBuilder).Connect(pin_out, pin_In);

(self.Filter_Splitter as IBaseFilter).FindPin( "Audio ", pin_out);

(self.FilterGraph_Media as IGraphBuilder).AddFilter(self.Filter_Decoder as IBaseFilter, "Decoder ");

(self.Filter_Decoder as IBaseFilter).FindPin( "In ", pin_in);

(self.FilterGraph_Media as IGraphBuilder).Connect(pin_out, pin_In);

(self.Filter_Decoder as IBaseFilter).FindPin( "Out ", pin_Out);

(self.FilterGraph_Media as IGraphBuilder).AddFilter(self.Filter_Render as IBaseFilter, "Render ");

(self.Filter_Render as IBaseFilter).FindPin( "Audio Input pin (rendered) ", pin_In);

(self.FilterGraph_Media as IGraphBuilder).Connect(pin_out, pin_In);

end;


end;


...
FilterGraph,Filter是放在一个数据模块里的,其中
Filter_Splitter - > {336475D0-942A-11CE-A870-00AA002FEAB5}
Filter_Decoder - > {38BE3000-DBF4-11D0-860E-00A024CFEF6D}
Filter_Render - > Default DirectSound Device

nRenderMode=1 时正常,可以收到媒体播放完毕的消息
NRenderMode=2 是不能收到,其他都正常
 
发个程序来看看,帮改
41426277@163.com
 
感谢41426277,问题已经解决,是因为调AddFilter没有必要
 

Similar threads

D
回复
0
查看
924
DelphiTeacher的专栏
D
D
回复
0
查看
879
DelphiTeacher的专栏
D
D
回复
0
查看
851
DelphiTeacher的专栏
D
后退
顶部