unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, DSFilters, DirectShow, StdCtrls, OleServer, dspack, ExtCtrls,
ComCtrls;
type
TForm1 = class(TForm)
FilterGraph: TDSFilterGraph2;
Button1: TButton;
DSVideoWindow1: TDSVideoWindow;
Image1: TImage;
FilterSampleGrabber: TFilterSampleGrabber;
OpenDialog: TOpenDialog;
StatusBar1: TStatusBar;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure Button1Click(Sender: TObject);
procedure FilterSampleGrabberBuffer(sender: TComponent;
Buffer: TBufferCB);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
FilterGraph.Disconnect;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog.Execute then
begin
FilterGraph.ClearGraph;
FilterGraph.FilterGraph2.AddFilter(FilterSampleGrabber.BaseFilter, 'Grabber');
FilterSampleGrabber.SetBMPCompatible(nil,24);
FilterGraph.FilterGraph2.RenderFile(StringToOleStr(Opendialog.FileName),nil);
FilterGraph.QueryInterfaces;
FilterGraph.MediaControl.Run;
end;
end;
procedure TForm1.FilterSampleGrabberBuffer(sender: TComponent;
Buffer: TBufferCB);
begin
FilterSampleGrabber.GetBitmap(image1.Picture.Bitmap,Buffer);
StatusBar1.SimpleText := floattostr(buffer.SampleTime);
end;
end.