Einzelnen Beitrag anzeigen

calibra301

Registriert seit: 20. Mär 2009
95 Beiträge
 
Delphi XE8 Professional
 
#6

AW: TFilterGraph in einer DLL

  Alt 2. Nov 2012, 12:04
Leider auch ne Niete.

Hier mal alles:
Delphi-Quellcode:
library MyVideo;

uses
  ShareMem ,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,DSPack,dsutil,DirectShow9,ExtCtrls;


var
 FilterGraph : TFilterGraph;
 Videowindow : TVideowindow;
 Videoform:TForm;

function PlayVideo:Boolean; stdcall;
begin

  Videoform:=TForm.Create(nil);
  Videoform.Left:=100; //Mon.Left - Videoform.Monitor.Left;
  Videoform.Top :=100; // Mon.Top - Videoform.Monitor.Top;
  Videoform.Width := 256;//screen.Monitors[0].Width;
  Videoform.Height:= 256;//screen.Monitors[0].height;
  Videoform.BorderStyle:=bsnone;
  Videoform.Color:=clblack;
  Videoform.Visible:=true;

  FilterGraph := TFilterGraph.Create(nil);
  FilterGraph.Mode := gmNormal;
  FilterGraph.Name := 'FilterGraph';

  VideoWindow := TVideoWindow.Create(nil);
  VideoWindow.Parent := Videoform;
  VideoWindow.Left := 10;
  VideoWindow.Top := 10;
  VideoWindow.FilterGraph := FilterGraph;
  VideoWindow.Name := 'form1';
  VideoWindow.VMROptions.Mode := vmrWindowed;
  VideoWindow.Visible := true;

  VideoWindow.FilterGraph := FilterGraph;
  VideoWindow.FilterGraph.Active := false;
  VideoWindow.FilterGraph.AutoCreate := false;
  VideoWindow.FilterGraph.GraphEdit := false;
  VideoWindow.FilterGraph.Mode := gmNormal;
  VideoWindow.FullScreen := false;
  VideoWindow.Mode := vmNormal;

  FilterGraph.ClearGraph;
  FilterGraph.Active := false;
  FilterGraph.Active := true;
  FilterGraph.RenderFile('C:\Test.avi');
  FilterGraph.Play;

  PlayVideo:=true;
end;


exports
  PlayVideo;
begin

end.

Aufruf:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

  procedure PlayVideo; external 'Project1.dll'

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 PlayVideo;
end;

Wie gesagt...als Form-Anwendung tuts der Code (mit **.create(self) );

Gruss
Guido
  Mit Zitat antworten Zitat