Einzelnen Beitrag anzeigen

Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#1

AVISYNTH_C Port

  Alt 29. Jan 2006, 17:27
Myrsloik hat AVISYNTH_C nach Delphi portiert. In der Source sind auch 2 Beispiel-DLLs enthalten. Somit ist es nun auch möglich Filter für AVISynth in Delphi leichter zu coden.

Hier noch mal der original Text zu diesem Port:
Zitat:
Myrsloik: One day I got bored and tried to do a conversion. It failed. Then I continued just to not let the computer win (then they'll think they can win every time) and finished it after figuring out how records are passed.

This should allow you to write filters in delphi and free pascal using the avisynth_c interface. It was tested with delphi 7 and free pascal 2.0 but will probably work in earlier versions of both. A conversion of the invert sample from avisynth_c is also included to show how it's used.
Hier die Download-Links zu der Source:

avisynth_pascal v3

Myrsloik hat noch ein paar Beispiele gecodet. Somit ist es einfacher für Euch avisynth_c in Euer Programm einzubauen.

Wie man AVISYNTH_C in Delphi benützt:
Delphi-Quellcode:
uses avisynth_c

var avsval:AVS_Value;
begin
  if OpenDialog1.Execute then
  begin
    //call avisouce with the selected filename
    avsval:=avs_invoke(env,'AVISource',avs_new_value_string(PChar(OpenDialog1.FileName)));

    //check for errors, only AVS_Values containing clips need to be freed
    //which it won't here if it's an error
    if avs_is_error(avsval) then
      raise EAviSynthCException.Create(avs_as_error(avsval));

    //get a clip from the AVS_Value
    clip:=avs_take_clip(avsval,env);

    //release the AVS_Value since it contained a clip, releasing an AVS_Value
    //without a clip does nothing
    avs_release_value(avsval);

    //get video information and adjust window
    vi:=avs_get_video_info(clip);

    TrackBar1.Max:=vi.num_frames-1;
    ClientWidth:=vi.width;
    ClientHeight:=vi.height+TrackBar1.Height;

    with Image1.Picture.Bitmap do
    begin
      Width:=vi.width;
      Height:=vi.height;

      if avs_is_rgb32(vi) then
        PixelFormat:=pf32bit
      else if avs_is_rgb24(vi) then
        PixelFormat:=pf24bit
    end;

    TrackBar1Change(nil);
  end;
end;
Beispiele von Myrsloik
  Mit Zitat antworten Zitat