Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
13th November 2011, 22:08 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Avisynth CPP Interface for C Programmers. - 03 Jan 2019
v0.60, 03 Jan 2019. Moved to VS2008, Added Version resource, + x64. Requires VS2008 CPP runtimes.
Zip source is probably a little different to these old posts. There Follows five pages of what will I hope become a useful guide for C programmers on the intricacies of the Avisynth C Plus Plus interface. It is not intended to be any kind of course in programming in either C or C++, just a crash (and burn) course for C programmers. I will undoubtably have made many mistakes, & it is for you fellows to gratuitously point them out as cruelly as you can, but that's OK, as I am after all, a HeartlessS Userer. Page 1, The Intro:- Page 2, The Class Definition:- Page 3, Class Member Functions Part_1:- Page 4, Class Member Functions Part_2:- Page 5, Avisynth registration and Filter Creation:- ----------------------------------------------- Page 1, The Intro:- Code:
/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // Example() Plugin for Avisynth v2.5 & v2.6 // ---------------------------------------------------------------- // Compiling for Avisynth v2.58 & v2.60/x86, v2.60/x64, under VS2008 // // For AVS+, also need additional Avisynth+ headers somewhere in an AVS directory, // // AVS // alignment.h // avisynth.h // capi.h // config.h // cpuid.h // minmax.h // types.h // win.h // // Point Menu/Tools/Options/Projects and Solutions/VC Directories/ :Include Files: Win32 and x64, to the AVS Parent. // // For x64, add '_WIN64' to Preprocessor Definitions (for both C++/Preprocessor & Resources/General). // (Do NOT delete any 'WIN32' entry). // For Avs v2.5, Add 'AVISYNTH_PLUGIN_25' to Preprocessor Definitions (for both C++/Preprocessor & Resources/General). // Avs v2.5 includes AVISYNTH_INTERFACE_VERSION=3 as avisynth25.h // Avs+ v2.6/x86/x64 includes AVISYNTH_INTERFACE_VERSION=6 as avisynth.h /* http://forum.doom9.org/showthread.php?p=1538557#post1538557 v0.0 - 10 Nov 2011, StainlessS. Feel free to correct and update. v0.1 - 13 Nov 2011, Fixed Aborting message. v0.2 - 19 Nov 2011, InfoF.h moved to active Example() source. Formatted print member fn DrawFStr() added with FULL string & screen/layout formatting. (the above function implemented for the first time for this Example() but the demo-ing screen/layout output string was partially robbed from DDigitTest() plugin). v0.3 - 30 Jan 2012 Added 'bool "show"' [default true]. Shows text on-screen. Added Bouncing walls demo when 'int bounce' non zero. int "bounce", default -1, 0 == Off, -1 == Auto, <= -2 == Variable, 1 -> 64 == Fixed bounce step size (limited to max 64). v0.5, 31 March 2015. Added Compiler.h. Added v2.6 dll. Added Avsynth Version 6 Header for v2.6 dll. Slight mods and fixes. Compiled dll's via VS 2008 Express. This is not intended to give any kind of detailed information on the C++ language, for that, it would take considerable time to both write and read, there are many tombs that are quite competent in that field already. Intention here, is to give simple explanation as to what all of the fluffy CPP stuff does in a filter class declaration and the Avisynth filter registration and creation code. Intended for those that speak C but for whom CPP is a mystery. This is to the best of my understanding, what it means / how it works but should perhaps not be taken as absolute gospel. I'm just a beginner too, it is based on memories of about a decade and a half ago (then a beginner also). It is not a very useful nor exciting plugin, you may not even bother to compile it (I wouldn't), just take what info you may find in it and jump in and have a go yourself. The example plugin is made deliberately boring & non functional so as not to obscure the supposed information content. This text is not intended to show how to manipulate frames in any way, it is only to try to clarify the fluff, for frame manipulation see the SimpleSample sources. (v0.3, added bouncing walls demo to GetFrame() so it is not quite as boring as it was). In addition to the fluff, I thought it might be worthwhile to also show how textual information may be displayed on-screen either on the video frame or in a DebugView window (Google). Both of these output methods could be of use in getting to grips with plug development, and in v0.2, I have added a header which allows screen/layout formatted print to a video frame and added a member function to use the InfoF.h for fully formatted print (string & screen/layout). If InfoF.h header is not supplied with this file, it can be obtained from the DDigitTest() plugin which supplies source for "DDigit text renderer for Plugin writers" (as can Info.h), see here:- http://forum.doom9.org/showthread.php?t=156888 Dont get too caught up in the fluffy stuff, if it is not explained, then just copy what you see, you can look into the un-explained fragments in other sources, in some cases, you may not find those parts being used at all by anybody. usage: Example(clip,intarg=42,version=true,show=true,bounce=-1) # defaults given. # ------------------------------------------------------- # Test AVS file. ColorBars() #ConvertToYV12() #ConvertToYUY2() #ConvertToRGB32() #ConvertToRGB24() #ConvertToY8() Example() # Default Example(intarg=42,version=true,show=true,bounce=-1) #Example(intarg=27,version=false,show=true,bounce=32) # Fixed bounce at 32 #Example(intarg=76,version=true,show=true,bounce=-1) # Fixed bounce Auto assigned #Example(intarg=33,version=false,show=true,bounce=-2) # Variable bounce #Example(intarg=64,version=true,show=true,bounce=0) # Bounce Off #Example(version=false,show=false,bounce=-1) # Bounce Auto, text OFF #ConvertToRGB32() # If Y8 # # This should work with Text Off in v2.6, or should work with Text On if compiled for v2.6. #ConvertToYV24().Example(version=false,show=false,bounce=-1).ConvertToRGB32() return last # ------------------------------------------------------- The filter class definition will follow shortly near the beginning of this file, whereas the code that registers the filter with Avisynth and to create an instance of the filter class is at the end of this file (usual practice in most sources). You may also like to see the "AviSynth 2.5/FilterSDK/BensAviSynthDocs.htm" file installed with 2.58/2.6 when Filter SDK is selected during install, or can find it online here:- http://www.neuron2.net/www.math.berkeley.edu/benrg/avisynth-extensions.html DebugView from SysInternals (Microsoft) can be found here: http://technet.microsoft.com/en-gb/sysinternals/bb545027 To filter out the rubbish in DebugView, set the filter to 'Example:'. */ Dll's for avs v2.58, avs/+ 2.60 x86 and x64, requires VS2008 CPP Runtimes. Supplied with 3 dll's, source + full project files for VS 2008 Express & simple build. [EDIT: Build is as simple as opening the solution in VS2008, select menu Batch Build, click rebuild. 3 dll's are produced]. EDIT: Small (29 page) intro of C++ for C programmers:- (AQuickIntroductiontoCPP.PDF) See MediaFire in sig below, DEVELOPER FOLDER
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 3rd January 2019 at 06:48. Reason: update |
|
|