View Full Version : Use of a second Default Clip parameter
vcmohan
26th September 2005, 14:45
I think that this question has been answered before. But my search "default clip"in either doom9 forum or Avisynth.org site did not get the answer I am looking for. So I regret but had to make this post.
In my plugin I have the parameter specification in add function as
"c[sf]i[ef]i[equal]b[mclip]c[window]i[w]i[h]i"
User really require the mclip only if equal=false.
If I omit the mclip entry in calling this function then I get an error stating that system-exception, access violation.
If I include a code in the create function as below
PClip c1= args[0].AsClip();
PClip c2= args[4].Defined ? args[4].AsClip() : c1;
......
return new xxx(args[0].AsClip(),
args[1].AsInt(0), // Start Frame Number
args[2].AsInt(vi.num_frames-1), // End Frame Number. In case of test number of times to test
args[3].AsBool(true),
c2,
.............
env);
still I get an error.
Is it not possible to name a clip parameter and use as above?
Is there any other way? Or a dummy clip need to be specified by the user? Is it that Defined can be used only for unnamed parameters?
Wilbert
26th September 2005, 15:08
If I omit the mclip entry in calling this function then I get an error stating that system-exception, access violation.
Thus for example calling Plugin(clip,2,2,true,window=1) gives that error?
mg262
26th September 2005, 15:18
args[4].Defined should be args[4].Defined() .
Bidoche
26th September 2005, 17:52
Super simple solution :
Make 2 functions instead of one, one for equal = true and the other for equal = false.
mg262
26th September 2005, 18:09
If you do that, can you give them the same name? Ie, does the parser support overloading?
Bidoche
26th September 2005, 18:14
I forgot :p
Just try
Fizick
26th September 2005, 19:00
In vaguedenoiser i use auxclip
mg262
26th September 2005, 20:54
Putting in the brackets will sort it. The problem is that currently Defined is being evaluated as a function pointer, typecast to bool, evaluating as true (because it's not the 0 pointer) and consequently selecting the first argument in all cases.
The question of how to set things up to have the tidiest syntax is quite separate. Remember that (leading overloading aside) you can use ? to match against any kind of argument -- see the original AVISynth documentation. There have been times when I have been tempted to set up syntactic sugar similar to this:
1. A filter Equal, taking no arguments and returning an integer.
2. "c[sf]i[ef]i[mclip]?[window]i[w]i[h]i"
Then you could either write
Filter(10, 20, someclip,...)
Or in the case when they were equal
Filter(10, 20, Equal,...)
-- and in the relevant function you would test whether the argument was a clip or integer, and behave accordingly. In this case it's probably the case that what Bidoche suggested is more appropriate -- just add both
"c[sf]i[ef]i[mclip]c[window]i[w]i[h]i"
And
"c[sf]i[ef]i[window]i[w]i[h]i"
(I think I've tested overloading before and it seems to work... but then so does reading past the end of the frame!)
vcmohan
27th September 2005, 03:39
Thus for example calling Plugin(clip,2,2,true,window=1) gives that error?
Yes. It gives same error.
Thanks for the suggestions. Overloading is an option, but I find several complaints with users that the plugin gives an error while loading as the number of functions for autoload has exceeded a limit. So using multiple functions may have its own added problems. May be use of ? will be a solution which I will explore.
Incidentally there are lots more informative pages at Avisynth.org site than what can be accessed by links provided on the home page. (once I was given a link and could access an unlisted page). How does one access them?
Wilbert
27th September 2005, 19:45
Didn't adding "()" do the job as mg262 suggested?
Incidentally there are lots more informative pages at Avisynth.org site than what can be accessed by links provided on the home page. (once I was given a link and could access an unlisted page). How does one access them?
Could you be more specific? What was on that page?
vcmohan
28th September 2005, 03:17
Didn't adding "()" do the job as mg262 suggested?
It looks it will do the job. Meanwhile I altered the structure of my plugin and so I did a partial test. But I will do next time and report if it does not work.
[QUOTE}Could you be more specific? What was on that page?[/QUOTE]
Please blame my memory. Offhand I do not remember, but such a page existed.
How does one access the instructions and example for plugin development on that site? I have been using a copy of some page about 2 years old.
Wilbert
28th September 2005, 09:21
How does one access the instructions and example for plugin development on that site? I have been using a copy of some page about 2 years old.
On the first page of avisynth.org under the Dev. section: "Filter SDK - AviSynth plugin programming tips."
vcmohan
29th September 2005, 05:02
I checked using Define() for the default clip. It worked . Thanks.
Now I see the filtersdk. Actually on my monitor the page initially shows up to Tips and tricks only. I had to scroll to view down. I did not notice the scroll buttons. So my unnecessary concern. You can blame on my age. Thanks for taking trouble in pointing out.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.