View Full Version : how to import avisynth.dll
jonas
22nd August 2002, 17:03
Hi,
this might belong to the development section or even a c++ forum, but I wasn't sure, so I post it here.
How do it import the avisynth dll in order to make it open an .avs or accept the commands in an avs from me and give requested frames to me? (like in vdub)
So basicly, how can I be the one the frames are served to?
I looked at the vdub source, but didn't understand how it was done. I see it getting info from the registry (which I know is necessary), but I just do see whats going on.
I'd ge greatfull for any hint (maybe it's been discussed semewhere else and did'nt find it)
thanks
jonas
aquaplaning
22nd August 2002, 18:42
take a look at my hp.
there is a small delphi example that uses an intermediate c++ dll to access avisynth.dll.
http://aquaplaning.20m.com/vidframe_sources.zip
jonas
22nd August 2002, 21:48
thank you aquaplaning,
I actually want want to create an intermediate dll either.
I looked through your source and there are still quite a lot of questions....
I still don't see the avisynth dll loaded, but to me it seams like an old version (v1.0b is the oly sourcecode I'm a little familiar with) of avisynth with the added dll exports; is that so?
So, if it is, is there anyway of loading the avisynth.dll, rather than building it into the intermediate dll? becuase I don't want to be stuck to 1 version of avisynth.
hpe to get some more help from you :-)
jonas
dividee
22nd August 2002, 22:25
You should be able to open avisynth scripts, just like regular AVIs, through the VFW AVIFile API (http://msdn.microsoft.com/library/en-us/multimed/avifile_3uwj.asp), or whatever wrapper is available for the language you're using.
Another way, if you're doing C++ (or want to write a wrapper for your language), is to use the only function exported by all version of avisynth: CreateScriptEnvironment.
It returns a ScriptEnvironment pointer; with it you can do many things, in fact much more than simply opening a script (but you can do that too). Look in avisynth.h for details. The most useful method is probably Invoke, which allows you to call any script function or filter in avisynth directly (among others, the "Import" function to open AVS files).
jonas
23rd August 2002, 10:33
I noticed the CreateScriptEnvironment before, but wasn't quite sure how to use it, but I think I got it now.
Is the avisynth.dll always in the system32 dir? And the reg entries are only for windows AVIFile API?
Probabbly is like that, grr. I somehow got fixed on having to use the registry to get the position of avisynth.dll. And seeing that the registry key only keeps avisynth.dll as value I got even more confused, now it all makes sense, I hope.
thanks a lot
jonas
jonas
26th August 2002, 12:32
Hi,
I've been reading some avisynth sources over the last few days, but I failed to find the function that lets me open an avs file.
the Scriptparser is used for that, I belive, but in order to recieve frames I need a PClip I can call getFrame on, don't I, and I don't see how to get that....
sorry if this is a stupid question...
thanks
jonas
dividee
27th August 2002, 20:18
Here is how to obtain a PClip:
To import a script:
AVSValue args[] = { "test.avs" };
AVSValue script = env->Invoke("Import", AVSValue(args,1));
PClip result = script.AsClip();
Another example, from the avisynth source, which uses named args:
AVSValue args[2] = { error.msg, 0xff3333 };
static const char* arg_names[2] = { 0, "text_color" };
PClip filter_graph = env->Invoke("MessageClip", AVSValue(args, 2), arg_names).AsClip();
EDIT: Oops the first example above is probably wrong. I left it as is because it illustrates a difficulty to work with AVSValues;
the second line should be:
AVSValue script = env->Invoke("Import", AVSValue(&AVSValue(args,1),1));
AVSValues are a bit like variants in VB. The second argument of Invoke must be an AVSValue which should be an array of AVSValues. But the parameter string for Import is "s+". When a '+' or '*' appears, the indicated parameter is itself an array. That's why the second parameter of Invoke should be here an AVSValue which is an array of AVSValues which are themselves arrays of AVSValues (even if there is only one, like here). Confusing ? ;)
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.