Es handelt sich um Avisynth. Avisynth ist ein Frameserver, welcher als avisynth.dll im sys32 Verzeichnis liegt. Erstellt man ein Textscript mit .avs als Endung, wird dieses Script als Avisynth Frameserverfile von mediaplayern erkannt und wiedergegeben. Innerhalb eines solches scriptes existiert am anfang eine Mediandatei-Import-Line und darauffolgende Filter calls.
Ich kann ein avs script via vfw API öffnen, wiedergeben oder Informationen beziehen.
Nun möchte ich aber nicht über vfw, sondern DIREKT die Avisynth.dll ansprechen und am Ende den Videoframe im Speicher an meine Applikation übergeben.
Hier deer Thread:
http://forum.doom9.org/showthread.php?t=103195
Hier ein c++ Beispiel, wie man einen Frame aus einem "Script.avs" via avisynth.dll und dessen API Befehl "Invoke("import"....)" herausfischt.
Code: Alles auswählen
int main(int argc, char* argv[])
{
HINSTANCE hDLL;
IScriptEnvironment* (__stdcall *CreateEnv)(int);
IScriptEnvironment *env;
PClip Video;
PVideoFrame src;
// load avisynth.dll
hDLL = LoadLibrary("avisynth");
if (!hDLL)
{
fprintf(stderr,"Couldn't load Avisynth.dll\n");
exit(1);
}
// retrieve address of createscriptenvironment function
CreateEnv = (IScriptEnvironment *(__stdcall *)(int))GetProcAddress(hDLL,
"CreateScriptEnvironment");
if (!CreateEnv)
{
fprintf(stderr, "Couldn't access CreateScriptEnvironment\n");
exit(1);
}
// create a new scriptenvironment
env = CreateEnv(AVISYNTH_INTERFACE_VERSION);
if (!env)
{
fprintf(stderr, "Couldn't create scriptenvironment\n");
exit(1);
}
// load the script and add converttorgb24 if not already outputting rgb24
AVSValue args[1] = { "script.avs" };
try {
Video = env->Invoke("Import",AVSValue(args,1)).AsClip();
if (!Video->GetVideoInfo().IsRGB24())
{
AVSValue args_conv[1] = { Video };
Video = env->Invoke("ConvertToRGB24", AVSValue(args_conv, 1)).AsClip();
}
}
catch (AvisynthError e) {
fprintf(stderr, "Error (Avisynth Error) loading avisynth script!\n");
fprintf(stderr, "%s.\n", e.msg);
delete env;
exit(1);
}
catch (...) {
fprintf(stderr, "Error (Unknown) loading avisynth script!\n");
delete env;
exit(1);
}
// request a frame
src = Video->GetFrame(frameNum, env);
// copy to output
env->BitBlt(bufferVidOut, outPitch, src->GetReadPtr(), src->GetPitch(),
src->GetRowSize(), src->GetHeight());
// request some audio samples (will be copied directly into output buffer)
if (Video->GetVideoInfo().HasAudio())
Video->GetAudio(bufferAudOut, SamplePos, SampleCount, env);
// clean up and finish
delete env;
FreeLibrary(hDLL);
exit(0);
}Mir ist klar, dass ich ebenso das "Avisynth.h" Headerfile in PB umschreiben müsste, was ich auch bereits angefangen habe, da es auch schon in delphi übersetzt wurde, demnach schonmal einen Hauch übersichtlicher.
Man könnte somit in PB dann auch Videofilter für Avisynth programmieren, was imho viele VideoAppl.-Entwickler auf die Seite von PB ziehen könnte
Tausend Dank!
Inc.