这个是实现缓冲数的Dspack一种替代办法 很笨的方法。。征求更好的方法
WMP应该可以用那两个接口
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DSPack, ExtCtrls,DirectShow9,DsUtil;
type
TForm1 = class(TForm)
VideoWindow1: TVideoWindow;
FilterGraph1: TFilterGraph;
OpenDialog1: TOpenDialog;
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
LoadLong :int64;
AllLong
ouble;
Current
ouble;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
If Form1.OpenDialog1.Execute then
begin
Form1.FilterGraph1.RenderFile(Form1.OpenDialog1.FileName);
Form1.FilterGraph1.Play;
with FilterGraph1 as IMediaPositiondo
get_Duration(AllLong);
Form1.Timer1.Enabled:=true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
with FilterGraph1 as IMediaSeekingdo
GetStopPosition(LoadLong);
with FilterGraph1 as IMediaPositiondo
get_CurrentPosition(Current);
If (Trunc(AllLong)<>Trunc(LoadLong/100000)) then
Form1.Caption:='缓冲;('+intToStr(Trunc(LoadLong/AllLong/100000))+'%)';
If Current<>0 then
begin
Form1.Timer1.Enabled:=False;
Form1.Caption:='开始播放';
end;
end;
end.