Log in

View Full Version : A Question about "avisynth_c.dll" access


Inc
19th December 2005, 10:01
Hi,

Im working under Purebasic and so for accessing frames using avisynth directly (without vfw) the avisynth_c interface option for me looks quite interesting.

I had a look at the api reference ...
http://kevin.atkinson.dhs.org/avisynth_c/api.html
and at the avisynth_c.h out of the stdcall package from kevin atkinson which to me it seems that this equals? to the avisynth_c interface in the recent avisynth builds from shodan?

So for accessing frames I googled a bit and found this site where the developer himself posted an example:
http://www.mail-archive.com/wine-devel@winehq.org/msg00458.html

To me the most importand lines for getting the "invoke" command working seem to be these ones:
AVS_ScriptEnvironment * env =
avs_create_script_environment(AVISYNTH_INTERFACE_VERSION);
AVS_Value arg0 = avs_new_value_string(argv[1]);
AVS_Value args = avs_new_value_array(&arg0, 1);
AVS_Value res = avs_invoke(env, "avisource", args, 0);
...
...
...
...
AVS_Clip * clip = avs_take_clip(res, env)
AVS_VideoFrame * f = avs_get_frame(clip, i)

So that code above seems to be equal to
Avisource("xxxxxxxxx.yyy")

So "argv[1]" seems to be 1 argument to the videoclip if I understood right and that argument is a string including "xxxxxxxxx.yyy".

Now what about sending more then one argument to the "invoke" command, like Levels(5,1.0,250,0,255,coring="false")

?

Thanks for all kinds of assistance.
Inc.

Wilbert
19th December 2005, 11:17
Just guessing ...

AVS_Value arg0 = avs_new_value_string(argv[1]);
AVS_Value arg1 = avs_new_value_int(argv[2]);
AVS_Value arg2 = avs_new_value_float(argv[3]);
...
AVS_Value arg5 = avs_new_value_int(argv[6]);
AVS_Value arg6 = avs_new_value_bool(argv[7]);
AVS_Value filter_args[7] = { arg0, ..., arg6 };
AVS_Value res = avs_invoke(env, "Levels", AVSValue(filter_args,7), 0);


Does something like this work?

Inc
19th December 2005, 11:53
Thanks Wilbert,
right now I'm at work, so I'll try this evening :)

To me it seems that passing the array "filter_args[int size]" in the c interface is handled as "avs_new_value_array(AVS_Value * v0, int size)"

so maybe for the levels example above ...

AVS_Value arg0 = avs_new_value_int(5);
AVS_Value arg1 = avs_new_value_float(1.0);
AVS_Value arg2 = avs_new_value_int(250);
AVS_Value arg3 = avs_new_value_int(0);
AVS_Value arg4 = avs_new_value_int(255);
AVS_Value arg5 = avs_new_value_string("false");

AVS_Value args = avs_new_value_array(&arg0, 6) // <--- provide adress only from arg0??
AVS_Value res = avs_invoke(env, "Levels", args, 0);

Well let's see ....

Wilbert
30th January 2006, 11:02
Did you solve this?

Inc
30th January 2006, 11:36
Hi Wilbert :)

Actually I do use the c++ approach to access the avisynth.dll.
I took the avsredirect.dll from mobilehackers and added some stuff as to be found in the development section.

But after that dll-mod is ready and stable, I'll go a bit more into the C Interface as Ill want to port the header to PureBasic.