View Single Post
Old 22nd July 2013, 00:41   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Do not use/target v2.6a3, not supported any more.

Use version 3 Avisynth.h for 2.5 and Version 5 for v2.6, version 4 header does NOT exist.
You can get both current headers from any of the 25&26 plugin zips in my sig, eg the ClipBlend zip.

v2.6 plugins cannot not be loaded in 2.58, v2.5 plugins work just fine in v2.6 although 2.6 colorspaces will be incorrectly identified as YV12
and filters will not process properly.

How I do it in ClipBlend plug (EDIT: although cannot guarantee that it is "correct way"):-

Code:
/*
	Compiling for both Avisynth v2.58 & v2.6 ProjectName under VS6, where ProjectName is the base name of the plugin.
	Create an additional project ProjectName26 and copy the
	project files into ProjectName folder. Add headers and source files to v2.6 project.
	You should have "avisynth25.h" in the ProjectName Header Files and
	"avisynth26.h" in the ProjectName26 Header Files.
	For the v2.58 project, add preprocessor definition to :-
		Menu/Project/Settings/All Configuration/C/C++, AVISYNTH_PLUGIN_25
*/

// Load header
#ifdef AVISYNTH_PLUGIN_25
	#include "avisynth25.h"     // Version 3 for Avisynth 2.5
#else
	#include "avisynth26.h"     // Version 5 for Avisynth 2.6a4
#endif


// In constructor
# ifdef AVISYNTH_PLUGIN_25
	if(vi.IsPlanar() && vi.pixel_type != 0xA0000008) { 				// Planar but NOT YV12, ie Avisynth v2.6+ ColorSpace
		// Here Planar but NOT YV12, v2.5 Plugin Does NOT support ANY v2.6+ ColorSpaces
		env->ThrowError("ClipBlend: ColorSpace unsupported in ClipBlend v2.5\n");
	}
# endif


// Plugin init
#ifdef AVISYNTH_PLUGIN_25
	extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) {
#else
	/* New 2.6 requirement!!! */
	// Declare and initialise server pointers static storage.
	const AVS_Linkage *AVS_linkage = 0;

	/* New 2.6 requirement!!! */
	// DLL entry point called from LoadPlugin() to setup a user plugin.
	extern "C" __declspec(dllexport) const char* __stdcall
			AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {

	/* New 2.6 requirment!!! */
	// Save the server pointers.
	AVS_linkage = vectors;
#endif
    env->AddFunction("ClipBlend",  "c[delay]i", Create_ClipBlend, 0);

    return "`ClipBlend' ClipBlend plugin";
	// A freeform name of the plugin.
}
Quote:
If possible I would prefer not to use "separate plugins ...
You have no choice, if you want to support v2.5, it will not load v2.6 plugins. If you want to support v2.6
colorspace, then you need a v2.6 plugin, no alternative.
(EDIT: Only exception is that 2.5 plugin could process Y8 (under avisynth v2.6) when established that RowSizeU/V is zero
ie no chroma, it is the chroma that is problematic).

Good luck.

EDIT: You might find these of interest too:-
http://forum.doom9.org/showthread.ph...36#post1617236

http://forum.doom9.org/showthread.ph...72#post1580772
__________________
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; 22nd July 2013 at 01:29.
StainlessS is offline   Reply With Quote