Commits

Anonymous committed 7eea011

initial commit - veejay pack 1.1

  • Participants

Comments (0)

Files changed (69)

+syntax: glob
+*.o
+*.dll

File veejayBathroom/FreeFrame.cpp

+///////////////////////////////////////////////////////////////////////////////////
+// FreeFrame.cpp
+//
+// FreeFrame Open Video Plugin Prototype
+// C Version
+//
+// Implementation of a plugin interface for the FreeFrame API
+//
+// www.freeframe.org
+// marcus@freeframe.org
+
+/*
+
+Copyright (c) 2002, Marcus Clements www.freeframe.org
+All rights reserved.
+
+FreeFrame 1.0 upgrade by Russell Blakeborough
+email: boblists@brightonart.org
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+   * Neither the name of FreeFrame nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////////////////
+//
+// includes 
+//
+
+#include "FreeFrame.h"
+#include "veejayBathroom.h"  // replace this with your plugins header
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// Windows DLL Entry point
+//
+// notes: we may want to capture hModule as the instance of the host...
+
+#ifdef WIN32
+BOOL APIENTRY DllMain( HANDLE hModule, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID lpReserved
+					 )
+{
+    return TRUE;
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////
+// plugMain - The one and only exposed function
+// parameters: 
+//	functionCode - tells the plugin which function is being called
+//  pParam - 32-bit parameter or 32-bit pointer to parameter structure
+//
+// PLUGIN DEVELOPERS:  you shouldn't need to change this function
+//
+// All parameters are cast as 32-bit untyped pointers and cast to appropriate
+// types here
+// 
+// All return values are cast to 32-bit untyped pointers here before return to 
+// the host
+//
+
+#ifdef WIN32
+ __declspec(dllexport) plugMainUnion __stdcall plugMain(DWORD functionCode, LPVOID pParam, LPVOID instanceID ) 
+#elif LINUX
+extern "C" {
+   plugMainUnion plugMain( DWORD functionCode, LPVOID pParam, LPVOID instanceID )
+#endif	
+{
+	plugMainUnion retval;
+
+	// declare pPlugObj - pointer to this instance
+	plugClass *pPlugObj;
+
+	// typecast LPVOID into pointer to a plugClass
+	pPlugObj = (plugClass*) instanceID;
+
+	switch(functionCode) {
+
+	case FF_GETINFO:
+		retval.PISvalue = getInfo();
+		break;
+	case FF_INITIALISE:
+		retval.ivalue = initialise();
+		break;
+	case FF_DEINITIALISE:
+		retval.ivalue = deInitialise();			// todo: pass on instance IDs etc
+		break;
+	case FF_GETNUMPARAMETERS:
+		retval.ivalue = getNumParameters();
+		break;
+	case FF_GETPARAMETERNAME:
+		retval.svalue =  getParameterName( (DWORD) pParam );
+		break;
+	case FF_GETPARAMETERDEFAULT:
+		retval.fvalue =  getParameterDefault( (DWORD) pParam );
+		break;
+	case FF_GETPARAMETERDISPLAY:
+		retval.svalue =  pPlugObj->getParameterDisplay( (DWORD) pParam );
+		break;	
+	// parameters are passed in here as a packed struct of two DWORDS:
+	// index and value
+	case FF_SETPARAMETER:
+		retval.ivalue=  pPlugObj->setParameter( (SetParameterStruct*) pParam );
+		break;
+	case FF_PROCESSFRAME:
+		retval.ivalue = pPlugObj->processFrame(pParam);
+		break;
+	case FF_GETPARAMETER:
+		retval.fvalue =  pPlugObj->getParameter((DWORD) pParam);
+		break;
+	case FF_GETPLUGINCAPS:
+		retval.ivalue = getPluginCaps( (DWORD) pParam);
+		break;
+
+// Russell - FF 1.0 upgrade in progress ...
+
+	case FF_INSTANTIATE:
+		retval.ivalue = (DWORD) instantiate( (VideoInfoStruct*) pParam);
+		break;
+	case FF_DEINSTANTIATE:
+		retval.ivalue = deInstantiate(pPlugObj);
+		break;
+	case FF_GETEXTENDEDINFO: 
+		retval.ivalue = (DWORD) getExtendedInfo();
+		break;
+	case FF_PROCESSFRAMECOPY:
+		retval.ivalue = pPlugObj->processFrameCopy((ProcessFrameCopyStruct*)pParam);
+		break;
+	case FF_GETPARAMETERTYPE:		
+		// not implemented yet
+		switch( (int) pParam) {
+			case 0:
+				retval.ivalue = FF_TYPE_STANDARD;
+				break;
+			case 1:
+				retval.ivalue = FF_TYPE_BOOLEAN;
+				break;
+			default:
+				retval.ivalue = FF_FAIL;
+				break;
+		}
+		break;
+
+// ....................................
+
+	default:
+		retval.ivalue = FF_FAIL;
+		break;
+	}
+	return retval;
+}
+#ifdef linux	
+
+} /* extern "C" */
+#endif

File veejayBathroom/FreeFrame.h

+#ifdef LINUX
+extern "C" {
+#include <string.h>
+#include <stdlib.h>
+#endif
+///////////////////////////////////////////////////////////////////////////////////
+// FreeFrame.h
+//
+// FreeFrame Open Video Plugin Prototype
+// C Version
+
+// www.freeframe.org
+// marcus@freeframe.org
+
+/*
+
+Copyright (c) 2002, Marcus Clements www.freeframe.org
+All rights reserved.
+
+FreeFrame 1.0 upgrade by Pete Warden
+www.petewarden.com
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+   * Neither the name of FreeFrame nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef __FREEFRAME_H__
+#define __FREEFRAME_H__
+
+//////////////////////////////////////////////////////////////////////////////////
+//
+// includes
+//
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+
+#elif defined LINUX
+
+//typedefs for linux - in windows these are defined in files included by windows.h
+typedef unsigned int DWORD;
+typedef void * LPVOID;
+typedef char BYTE;
+
+#endif
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// #defines
+
+#define FF_EFFECT				0
+#define FF_FAIL					0xFFFFFFFF
+#define FF_SUCCESS				0
+#define FF_TRUE					1
+#define FF_FALSE				0
+
+#define FF_GETINFO				0
+#define FF_INITIALISE			1
+#define FF_DEINITIALISE			2
+#define FF_PROCESSFRAME			3
+#define FF_GETNUMPARAMETERS		4
+#define FF_GETPARAMETERNAME		5
+#define FF_GETPARAMETERDEFAULT	6
+#define FF_GETPARAMETERDISPLAY	7
+#define FF_SETPARAMETER			8
+#define FF_GETPARAMETER			9
+#define FF_GETPLUGINCAPS		10
+#define FF_INSTANTIATE			11
+#define FF_DEINSTANTIATE		12
+#define FF_GETEXTENDEDINFO		13
+#define FF_PROCESSFRAMECOPY		14
+#define FF_GETPARAMETERTYPE		15
+
+#define FF_CAP_16BITVIDEO		0
+#define FF_CAP_24BITVIDEO		1
+#define FF_CAP_32BITVIDEO		2
+#define FF_CAP_PROCESSFRAMECOPY	3
+#define FF_CAP_MINIMUMINPUTFRAMES	10
+#define FF_CAP_MAXIMUMINPUTFRAMES	11
+#define FF_CAP_COPYORINPLACE		15
+
+#define FF_CAP_PREFER_NONE			0
+#define FF_CAP_PREFER_INPLACE		1
+#define FF_CAP_PREFER_COPY			2
+#define	FF_CAP_PREFER_BOTH			3
+
+#define FF_TYPE_BOOLEAN				0    
+#define FF_TYPE_EVENT				1
+#define FF_TYPE_RED					2 
+#define FF_TYPE_GREEN				3
+#define FF_TYPE_BLUE				4
+#define FF_TYPE_XPOS				5
+#define FF_TYPE_YPOS				6
+#define FF_TYPE_STANDARD			10
+#define FF_TYPE_TEXT				100
+
+/////////////////////////////////////////////////////////////////////////////////////////
+//
+// FreeFrame types
+
+#if TARGET_OS_MAC
+typedef unsigned int DWORD;
+typedef unsigned char BYTE;
+#endif // TARGET_OS_MAC 
+
+typedef struct PlugInfoStructTag {
+	DWORD	APIMajorVersion;
+	DWORD	APIMinorVersion;
+	BYTE	uniqueID[4];			// 4 chars uniqueID - not null terminated
+	BYTE	pluginName[16];			// 16 chars plugin friendly name - not null terminated
+	DWORD	pluginType;				// Effect or source
+} PlugInfoStruct;
+
+typedef struct PlugExtendedInfoStructTag {
+	DWORD PluginMajorVersion;
+	DWORD PluginMinorVersion;
+	char* Description;
+	char* About;
+	DWORD FreeFrameExtendedDataSize;
+	void* FreeFrameExtendedDataBlock;
+} PlugExtendedInfoStruct;
+
+typedef struct VideoInfoStructTag {
+	DWORD frameWidth;				// width of frame in pixels
+	DWORD frameHeight;				// height of frame in pixels
+	DWORD bitDepth;					// enumerated indicator of bit depth of video  0 = 16 bit 5-6-5   1 = 24bit packed   2 = 32bit
+	DWORD orientation;				// video frame orientation meaningful values: 1 = origin at top left 2 = origin at bottom left
+} VideoInfoStruct;
+
+typedef struct ProcessFrameCopyStructTag {
+	DWORD numInputFrames;
+	void** InputFrames;
+	void* OutputFrame;
+} ProcessFrameCopyStruct;
+
+typedef struct SetParameterStructTag {
+	DWORD index;
+	float value;
+} SetParameterStruct;
+
+typedef union plugMainUnionTag {
+	DWORD ivalue;
+	float fvalue;
+	VideoInfoStruct *VISvalue;
+	PlugInfoStruct *PISvalue;
+	char *svalue;
+} plugMainUnion;
+
+///////////////////////////////////////////////////////////////////////////////////////
+// Function prototypes
+//
+
+///////////////////////////////////////////////////////////////////////////////////////
+// plugMain - The one and only exposed function
+// parameters: 
+//	functionCode - tells the plugin which function is being called
+//  pParam - 32-bit parameter or 32-bit pointer to parameter structure
+//
+// PLUGIN DEVELOPERS:  you shouldn't need to change this function
+//
+// All parameters are cast as 32-bit untyped pointers and cast to appropriate
+// types here
+// 
+// All return values are cast to 32-bit untyped pointers here before return to 
+// the host
+//
+
+#ifdef WIN32
+
+BOOL APIENTRY DllMain( HANDLE hModule, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID lpReserved );
+
+__declspec(dllexport) void* __stdcall plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
+
+typedef __declspec(dllimport) void* (__stdcall *FF_Main_FuncPtr)(DWORD,LPVOID,DWORD);
+
+#elif LINUX
+plugMainUnion plugMain( DWORD functionCode, LPVOID pParam, DWORD 
+reserved);
+
+#elif TARGET_OS_MAC
+
+typedef void* (*FF_Main_FuncPtr)(DWORD,void*,DWORD);
+
+#endif
+
+
+#endif
+#ifdef LINUX
+}
+#endif

File veejayBathroom/veejayBathroom.cpp

+/*
+  * Linux VeeJay
+  *
+  * Copyright (C) 2002 Niels Elburg <elburg@hio.hen.nl>
+  * Copyright (C) 2006 Maciek Szczesniak <vvarp@visualvinyl.net>
+  *                  (ported to FreeFrame, see http://freeframe.visualvinyl.net)
+  *
+  * Includes code from gavl lib, see http://gmerlin.sourceforge.net   
+  * Copyright (c) 2001-2002 by Burkhard Plaum - plaum@ipf.uni-stuttgart.de
+  *
+  * 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; either version 2
+  * of the License , or (at your option) any later version.
+  *
+  * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
+  */
+
+
+#include "veejayBathroom.h"
+#include "FreeImage.h"
+#include <string.h>
+#include <stdio.h>
+
+PlugInfoStruct plugInfo;
+PlugExtendedInfoStruct plugExtInfo;
+ParamConstantsStruct paramConstants[NUM_PARAMS];
+
+PlugInfoStruct* getInfo() 
+{
+	plugInfo.APIMajorVersion = 1;		// number before decimal point in version nums
+	plugInfo.APIMinorVersion = 000;		// this is the number after the decimal point
+										// so version 0.511 has major num 0, minor num 501
+	char ID[5] = "VE01";		 // this *must* be unique to your plugin 
+								 // see www.freeframe.org for a list of ID's already taken
+	char name[17] = "veejayBathroom";
+	
+	memcpy(plugInfo.uniqueID, ID, 4);
+	memcpy(plugInfo.pluginName, name, 16);
+	plugInfo.pluginType = FF_EFFECT;
+
+	return &plugInfo;
+}
+
+DWORD initialise()
+{
+	paramConstants[0].defaultValue = 0.5f;
+	paramConstants[1].defaultValue = 0.0f;
+	
+	char tempName0[17] = "Size";
+	char tempName1[17] = "Orientation";
+	
+	memcpy(paramConstants[0].name, tempName0, 16);
+	memcpy(paramConstants[1].name, tempName1, 16);
+
+	return FF_SUCCESS;
+}
+
+DWORD deInitialise()
+{
+	return FF_SUCCESS;
+}
+
+DWORD getNumParameters()
+{
+	return NUM_PARAMS;  
+}
+
+char* getParameterName(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramConstants[index].name;
+	else
+		return "";
+}
+
+float getParameterDefault(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramConstants[index].defaultValue;
+	else
+		return (float)FF_FAIL;
+}
+
+void plugClass::init() {
+
+	paramDynamicData[0].value = paramConstants[0].defaultValue;
+	paramDynamicData[1].value = paramConstants[1].defaultValue;
+
+	frameSize = videoInfo.frameHeight * videoInfo.frameWidth;
+
+	tempFrame24 = new VideoPixel24bit[frameSize];
+	memset(tempFrame24, 0, frameSize * 3);
+
+	tempFrame32 = new VideoPixel32bit[frameSize];
+	memset(tempFrame32, 0, frameSize * 4);
+
+}
+
+char* plugClass::getParameterDisplay(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+	{
+		for (int n=0; n<16; n++) { paramDynamicData[index].displayValue[n] = ' '; }
+		sprintf(paramDynamicData[index].displayValue, "%f",paramDynamicData[index].value);
+		return paramDynamicData[index].displayValue;
+	}
+	else
+		return "";
+}
+
+DWORD plugClass::setParameter(SetParameterStruct* pParam)
+{
+	//check that the param index is valid
+	if(pParam->index >= 0 && pParam->index < NUM_PARAMS)
+	{
+		paramDynamicData[pParam->index].value = pParam->value;
+		return FF_SUCCESS;
+	}
+	else
+	{
+		return FF_FAIL;
+	}
+}
+
+float plugClass::getParameter(DWORD index)
+{
+	//check that the param index is valid
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramDynamicData[index].value;
+	else
+		return (float)FF_FAIL;
+}
+
+DWORD plugClass::processFrame(LPVOID pFrame)
+{
+	switch (videoInfo.bitDepth) {
+		case 1:
+			return processFrame24Bit(pFrame);
+		case 2:
+			return processFrame32Bit(pFrame);
+		default:
+			return FF_FAIL;
+	}
+
+}
+
+DWORD plugClass::processFrame24Bit(LPVOID pFrame)
+{
+	unsigned int i;
+	const unsigned int len = frameSize;
+	const unsigned int y_val = paramDynamicData[0].value * 128 + 1;
+	unsigned int x,y;
+	
+	VideoPixel24bit *pDest, *pTemp;
+	pDest = (VideoPixel24bit*) pFrame;
+
+	memcpy(tempFrame24, pDest, frameSize * 3); // 24
+	
+	if (paramDynamicData[1].value == 1) {
+	
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = (x + (x % y_val) - (y_val>>1)) + (y*videoInfo.frameWidth);
+				if (i < 0) { i = 0; }
+				if (i >= len) { i = len-1; }
+				
+				pTemp = (VideoPixel24bit*) tempFrame24;
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				
+				pDest++;
+			}
+		}
+		
+	} else {
+
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = ((y*videoInfo.frameWidth) + (y % y_val) - (y_val>>1)) + x;
+
+				if (i < 0) { i += videoInfo.frameWidth; }
+				pTemp = (VideoPixel24bit*) tempFrame24;
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				
+				pDest++;
+			}
+		}
+	
+	}
+	
+	return FF_SUCCESS;
+}
+
+DWORD plugClass::processFrame32Bit(LPVOID pFrame)
+{
+	unsigned int i;
+	const unsigned int len = frameSize;
+	const unsigned int y_val = paramDynamicData[0].value * 128 + 1;
+	unsigned int x,y;
+	
+	VideoPixel32bit *pDest, *pTemp;
+	pDest = (VideoPixel32bit*) pFrame;
+
+	memcpy(tempFrame32, pDest, frameSize * 4); // 24
+	
+	if (paramDynamicData[1].value == 1) {
+	
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = (x + (x % y_val) - (y_val>>1)) + (y*videoInfo.frameWidth);
+				if (i < 0) { i = 0; }
+				if (i >= len) { i = len-1; }
+				
+				pTemp = (VideoPixel32bit*) tempFrame32;
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				pDest->alpha = pTemp->alpha;
+				
+				pDest++;
+			}
+		}
+		
+	} else {
+
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = ((y*videoInfo.frameWidth) + (y % y_val) - (y_val>>1)) + x;
+
+				if (i < 0) { i += videoInfo.frameWidth; }
+				pTemp = (VideoPixel32bit*) tempFrame32;
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				pDest->alpha = pTemp->alpha;
+				
+				pDest++;
+			}
+		}
+	
+	}
+
+	return FF_SUCCESS;
+}
+
+DWORD plugClass::processFrameCopy(ProcessFrameCopyStruct* pFrameData)
+{
+	if (pFrameData->numInputFrames<NUM_INPUTS) {
+		return FF_FAIL;
+	}
+
+	switch (videoInfo.bitDepth) {
+		case 1:
+			return processFrameCopy24Bit(pFrameData);
+		case 2:
+			return processFrameCopy32Bit(pFrameData);
+		default:
+			return FF_FAIL;
+	}
+
+}
+
+DWORD plugClass::processFrameCopy24Bit(ProcessFrameCopyStruct* pFrameData)
+{
+
+	unsigned int i;
+	const unsigned int len = frameSize;
+	const unsigned int y_val = paramDynamicData[0].value * 128 + 1;
+	unsigned int x,y;
+	
+	VideoPixel24bit *pDest, *pTemp;
+	pDest = (VideoPixel24bit*) pFrameData->OutputFrame;
+
+	if (paramDynamicData[1].value == 1) {
+	
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = (x + (x % y_val) - (y_val>>1)) + (y*videoInfo.frameWidth);
+				if (i < 0) { i = 0; }
+				if (i >= len) { i = len-1; }
+				
+				pTemp = (VideoPixel24bit*) pFrameData->InputFrames[0];
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				
+				pDest++;
+			}
+		}
+		
+	} else {
+
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = ((y*videoInfo.frameWidth) + (y % y_val) - (y_val>>1)) + x;
+
+				if (i < 0) { i += videoInfo.frameWidth; }
+				pTemp = (VideoPixel24bit*) pFrameData->InputFrames[0];
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				
+				pDest++;
+			}
+		}
+	
+	}
+	
+	return FF_SUCCESS;
+}
+
+DWORD plugClass::processFrameCopy32Bit(ProcessFrameCopyStruct* pFrameData)
+{
+
+	unsigned int i;
+	const unsigned int len = frameSize;
+	const unsigned int y_val = paramDynamicData[0].value * 128 + 1;
+	unsigned int x,y;
+	
+	VideoPixel32bit *pDest, *pTemp;
+	pDest = (VideoPixel32bit*) pFrameData->OutputFrame;
+
+	if (paramDynamicData[1].value == 1) {
+	
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = (x + (x % y_val) - (y_val>>1)) + (y*videoInfo.frameWidth);
+				if (i < 0) { i = 0; }
+				if (i >= len) { i = len-1; }
+				
+				pTemp = (VideoPixel32bit*) pFrameData->InputFrames[0];
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				pDest->alpha = pTemp->alpha;
+				
+				pDest++;
+			}
+		}
+		
+	} else {
+
+		for(y=0; y < videoInfo.frameHeight; y++) {
+			for(x=0; x < videoInfo.frameWidth; x++) {
+				i = ((y*videoInfo.frameWidth) + (y % y_val) - (y_val>>1)) + x;
+
+				if (i < 0) { i += videoInfo.frameWidth; }
+				pTemp = (VideoPixel32bit*) pFrameData->InputFrames[0];
+				pTemp = pTemp + i;
+
+				pDest->blue = pTemp->blue;
+				pDest->green = pTemp->green;
+				pDest->red = pTemp->red;
+				pDest->alpha = pTemp->alpha;
+				
+				pDest++;
+			}
+		}
+	
+	}
+
+	return FF_SUCCESS;
+}
+
+DWORD getPluginCaps(DWORD index)
+{
+	switch (index) {
+
+	case FF_CAP_16BITVIDEO:
+		return FF_FALSE;
+
+	case FF_CAP_24BITVIDEO:
+		return FF_TRUE;
+
+	case FF_CAP_32BITVIDEO:
+		return FF_TRUE;
+
+	case FF_CAP_PROCESSFRAMECOPY:
+		return FF_TRUE;
+
+	case FF_CAP_MINIMUMINPUTFRAMES:
+		return NUM_INPUTS;
+
+	case FF_CAP_MAXIMUMINPUTFRAMES:
+		return NUM_INPUTS;
+
+	case FF_CAP_COPYORINPLACE:
+		return FF_CAP_PREFER_COPY;
+
+	default:
+		return FF_FALSE;
+	}
+}
+
+LPVOID instantiate(VideoInfoStruct* pVideoInfo)
+{
+	plugClass *pPlugObj;
+	pPlugObj = new plugClass;
+
+	pPlugObj->videoInfo.frameWidth = pVideoInfo->frameWidth;
+	pPlugObj->videoInfo.frameHeight = pVideoInfo->frameHeight;
+	pPlugObj->videoInfo.bitDepth = pVideoInfo->bitDepth;
+
+	pPlugObj->vidmode = pPlugObj->videoInfo.bitDepth;
+	if (pPlugObj->vidmode >2 || pPlugObj->vidmode < 0) {
+	  return (LPVOID) FF_FAIL;
+	}
+
+	pPlugObj->init();
+	
+	return (LPVOID) pPlugObj;
+}
+
+DWORD deInstantiate(LPVOID instanceID)
+{
+
+	plugClass *pPlugObj;
+	pPlugObj = (plugClass*) instanceID;
+
+	delete pPlugObj;
+	return FF_SUCCESS;
+}
+
+LPVOID getExtendedInfo()
+{
+
+	plugExtInfo.PluginMajorVersion = 1;
+	plugExtInfo.PluginMinorVersion = 000;
+
+	plugExtInfo.Description = "Bathroom Window";
+	plugExtInfo.About = "original by Niels Elburg [port by http://freeframe.visualvinyl.net]";
+
+	plugExtInfo.FreeFrameExtendedDataSize = 0;
+	plugExtInfo.FreeFrameExtendedDataBlock = NULL;
+
+	return (LPVOID) &plugExtInfo;
+
+}

File veejayBathroom/veejayBathroom.def

+LIBRARY			veejayBathroom
+DESCRIPTION		'veejayBathroom Plugin'
+EXPORTS			plugMain

File veejayBathroom/veejayBathroom.h

+#include "FreeFrame.h"
+
+#define NUM_PARAMS 2
+#define NUM_INPUTS 1
+
+typedef struct ParamConstsStructTag {
+	float defaultValue;
+	char name[16];
+} ParamConstantsStruct;
+
+typedef struct ParamDynamicDataStructTag {
+	float value;
+	char displayValue[16];
+} ParamDynamicDataStruct;
+
+typedef struct VideoPixel24bitTag {
+	BYTE blue;
+	BYTE green;
+	BYTE red;
+} VideoPixel24bit;
+
+typedef struct VideoPixel16bitTag {
+	BYTE fb;
+	BYTE sb;
+} VideoPixel16bit;
+
+typedef struct VideoPixel32bitTag {
+	BYTE blue;
+	BYTE green;
+	BYTE red;
+	BYTE alpha;
+} VideoPixel32bit;
+
+class plugClass {
+
+public:
+
+	void init();
+
+	char*	getParameterDisplay(DWORD index);			
+	DWORD	setParameter(SetParameterStruct* pParam);		
+	float	getParameter(DWORD index);					
+	DWORD	processFrame(LPVOID pFrame);
+	DWORD	processFrame24Bit(LPVOID pFrame);
+	DWORD	processFrame32Bit(LPVOID pFrame);
+	DWORD	processFrameCopy(ProcessFrameCopyStruct* pFrameData);
+	DWORD	processFrameCopy24Bit(ProcessFrameCopyStruct* pFrameData);
+	DWORD	processFrameCopy32Bit(ProcessFrameCopyStruct* pFrameData);
+	
+	ParamDynamicDataStruct paramDynamicData[NUM_PARAMS];
+	VideoInfoStruct videoInfo;
+	int vidmode;
+
+private:
+
+	VideoPixel24bit *tempFrame24;
+	VideoPixel32bit *tempFrame32;
+	long frameSize;
+
+};
+
+PlugInfoStruct*	getInfo();							
+DWORD	initialise();								
+DWORD	deInitialise();								
+DWORD	getNumParameters();							
+char*	getParameterName(DWORD index);				
+float	getParameterDefault(DWORD index);			
+DWORD	getPluginCaps(DWORD index);	
+LPVOID  instantiate(VideoInfoStruct* pVideoInfo);
+DWORD   deInstantiate(LPVOID instanceID);	
+LPVOID  getExtendedInfo();		

File veejayBathroom/veejayBathroom.vcproj

+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="veejayBathroom"
+	ProjectGUID="{03FFC94C-F8FF-48E7-96FB-5B9181DD2730}"
+	RootNamespace="veejayBathroom"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\Release"
+			IntermediateDirectory=".\Release"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Release/FreeFrame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="F:\dev\Libs\FreeImage\Dist"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREEFRAME_EXPORTS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/FreeFrame.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="2057"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../rel/g6/veejayBathroom.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="F:\dev\Libs\FreeImage\Dist"
+				ModuleDefinitionFile="veejayBathroom.def"
+				ProgramDatabaseFile=".\Release/veejayBathroom.pdb"
+				ImportLibrary=".\Release/veejayBathroom.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\Debug"
+			IntermediateDirectory=".\Debug"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Debug/FreeFrame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="F:\dev\Libs\FreeImage\Dist"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREEFRAME_EXPORTS"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				PrecompiledHeaderFile=".\Debug/FreeFrame.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="2057"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../testing/plugins/veejayBathroom_debug.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="F:\dev\Libs\FreeImage\Dist"
+				ModuleDefinitionFile=".\veejayBathroom.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/veejayBathroom_debug.pdb"
+				ImportLibrary=".\Debug/veejayBathroom_debug.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release-P4|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Release/FreeFrame.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="F:\dev\Libs\FreeImage\Dist"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREEFRAME_EXPORTS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/FreeFrame.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="2057"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="../../rel/g7/veejayBathroom.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="F:\dev\Libs\FreeImage\Dist"
+				ModuleDefinitionFile="veejayBathroom.def"
+				ProgramDatabaseFile=".\Release/veejayBathroom.pdb"
+				ImportLibrary=".\Release/veejayBathroom.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="veejayBathroom.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BasicRuntimeChecks="3"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-P4|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="veejayBathroom.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="FreeFrame.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BasicRuntimeChecks="3"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-P4|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FREEFRAME_EXPORTS;$(NoInherit)"
+						BrowseInformation="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="FreeFrame.h"
+				>
+			</File>
+			<File
+				RelativePath=".\veejayBathroom.def"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

File veejayBinOverlay/FreeFrame.cpp

+///////////////////////////////////////////////////////////////////////////////////
+// FreeFrame.cpp
+//
+// FreeFrame Open Video Plugin Prototype
+// C Version
+//
+// Implementation of a plugin interface for the FreeFrame API
+//
+// www.freeframe.org
+// marcus@freeframe.org
+
+/*
+
+Copyright (c) 2002, Marcus Clements www.freeframe.org
+All rights reserved.
+
+FreeFrame 1.0 upgrade by Russell Blakeborough
+email: boblists@brightonart.org
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+   * Neither the name of FreeFrame nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////////////////
+//
+// includes 
+//
+
+#include "FreeFrame.h"
+#include "veejayBinOverlay.h"  // replace this with your plugins header
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// Windows DLL Entry point
+//
+// notes: we may want to capture hModule as the instance of the host...
+
+#ifdef WIN32
+BOOL APIENTRY DllMain( HANDLE hModule, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID lpReserved
+					 )
+{
+    return TRUE;
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////
+// plugMain - The one and only exposed function
+// parameters: 
+//	functionCode - tells the plugin which function is being called
+//  pParam - 32-bit parameter or 32-bit pointer to parameter structure
+//
+// PLUGIN DEVELOPERS:  you shouldn't need to change this function
+//
+// All parameters are cast as 32-bit untyped pointers and cast to appropriate
+// types here
+// 
+// All return values are cast to 32-bit untyped pointers here before return to 
+// the host
+//
+
+#ifdef WIN32
+ __declspec(dllexport) plugMainUnion __stdcall plugMain(DWORD functionCode, LPVOID pParam, LPVOID instanceID ) 
+#elif LINUX
+extern "C" {
+   plugMainUnion plugMain( DWORD functionCode, LPVOID pParam, LPVOID instanceID )
+#endif	
+{
+	plugMainUnion retval;
+
+	// declare pPlugObj - pointer to this instance
+	plugClass *pPlugObj;
+
+	// typecast LPVOID into pointer to a plugClass
+	pPlugObj = (plugClass*) instanceID;
+
+	switch(functionCode) {
+
+	case FF_GETINFO:
+		retval.PISvalue = getInfo();
+		break;
+	case FF_INITIALISE:
+		retval.ivalue = initialise();
+		break;
+	case FF_DEINITIALISE:
+		retval.ivalue = deInitialise();			// todo: pass on instance IDs etc
+		break;
+	case FF_GETNUMPARAMETERS:
+		retval.ivalue = getNumParameters();
+		break;
+	case FF_GETPARAMETERNAME:
+		retval.svalue =  getParameterName( (DWORD) pParam );
+		break;
+	case FF_GETPARAMETERDEFAULT:
+		retval.fvalue =  getParameterDefault( (DWORD) pParam );
+		break;
+	case FF_GETPARAMETERDISPLAY:
+		retval.svalue =  pPlugObj->getParameterDisplay( (DWORD) pParam );
+		break;	
+	// parameters are passed in here as a packed struct of two DWORDS:
+	// index and value
+	case FF_SETPARAMETER:
+		retval.ivalue=  pPlugObj->setParameter( (SetParameterStruct*) pParam );
+		break;
+	case FF_PROCESSFRAME:
+		retval.ivalue = pPlugObj->processFrame(pParam);
+		break;
+	case FF_GETPARAMETER:
+		retval.fvalue =  pPlugObj->getParameter((DWORD) pParam);
+		break;
+	case FF_GETPLUGINCAPS:
+		retval.ivalue = getPluginCaps( (DWORD) pParam);
+		break;
+
+// Russell - FF 1.0 upgrade in progress ...
+
+	case FF_INSTANTIATE:
+		retval.ivalue = (DWORD) instantiate( (VideoInfoStruct*) pParam);
+		break;
+	case FF_DEINSTANTIATE:
+		retval.ivalue = deInstantiate(pPlugObj);
+		break;
+	case FF_GETEXTENDEDINFO: 
+		retval.ivalue = (DWORD) getExtendedInfo();
+		break;
+	case FF_PROCESSFRAMECOPY:
+		retval.ivalue = pPlugObj->processFrameCopy((ProcessFrameCopyStruct*)pParam);
+		break;
+	case FF_GETPARAMETERTYPE:		
+		// not implemented yet
+		switch( (int) pParam) {
+			case 0:
+				retval.ivalue = FF_TYPE_STANDARD;
+				break;
+			default:
+				retval.ivalue = FF_FAIL;
+				break;
+		}
+		break;
+
+// ....................................
+
+	default:
+		retval.ivalue = FF_FAIL;
+		break;
+	}
+	return retval;
+}
+#ifdef linux	
+
+} /* extern "C" */
+#endif

File veejayBinOverlay/FreeFrame.h

+#ifdef LINUX
+extern "C" {
+#include <string.h>
+#include <stdlib.h>
+#endif
+///////////////////////////////////////////////////////////////////////////////////
+// FreeFrame.h
+//
+// FreeFrame Open Video Plugin Prototype
+// C Version
+
+// www.freeframe.org
+// marcus@freeframe.org
+
+/*
+
+Copyright (c) 2002, Marcus Clements www.freeframe.org
+All rights reserved.
+
+FreeFrame 1.0 upgrade by Pete Warden
+www.petewarden.com
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+   * Neither the name of FreeFrame nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef __FREEFRAME_H__
+#define __FREEFRAME_H__
+
+//////////////////////////////////////////////////////////////////////////////////
+//
+// includes
+//
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+
+#elif defined LINUX
+
+//typedefs for linux - in windows these are defined in files included by windows.h
+typedef unsigned int DWORD;
+typedef void * LPVOID;
+typedef char BYTE;
+
+#endif
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// #defines
+
+#define FF_EFFECT				0
+#define FF_FAIL					0xFFFFFFFF
+#define FF_SUCCESS				0
+#define FF_TRUE					1
+#define FF_FALSE				0
+
+#define FF_GETINFO				0
+#define FF_INITIALISE			1
+#define FF_DEINITIALISE			2
+#define FF_PROCESSFRAME			3
+#define FF_GETNUMPARAMETERS		4
+#define FF_GETPARAMETERNAME		5
+#define FF_GETPARAMETERDEFAULT	6
+#define FF_GETPARAMETERDISPLAY	7
+#define FF_SETPARAMETER			8
+#define FF_GETPARAMETER			9
+#define FF_GETPLUGINCAPS		10
+#define FF_INSTANTIATE			11
+#define FF_DEINSTANTIATE		12
+#define FF_GETEXTENDEDINFO		13
+#define FF_PROCESSFRAMECOPY		14
+#define FF_GETPARAMETERTYPE		15
+
+#define FF_CAP_16BITVIDEO		0
+#define FF_CAP_24BITVIDEO		1
+#define FF_CAP_32BITVIDEO		2
+#define FF_CAP_PROCESSFRAMECOPY	3
+#define FF_CAP_MINIMUMINPUTFRAMES	10
+#define FF_CAP_MAXIMUMINPUTFRAMES	11
+#define FF_CAP_COPYORINPLACE		15
+
+#define FF_CAP_PREFER_NONE			0
+#define FF_CAP_PREFER_INPLACE		1
+#define FF_CAP_PREFER_COPY			2
+#define	FF_CAP_PREFER_BOTH			3
+
+#define FF_TYPE_BOOLEAN				0    
+#define FF_TYPE_EVENT				1
+#define FF_TYPE_RED					2 
+#define FF_TYPE_GREEN				3
+#define FF_TYPE_BLUE				4
+#define FF_TYPE_XPOS				5
+#define FF_TYPE_YPOS				6
+#define FF_TYPE_STANDARD			10
+#define FF_TYPE_TEXT				100
+
+/////////////////////////////////////////////////////////////////////////////////////////
+//
+// FreeFrame types
+
+#if TARGET_OS_MAC
+typedef unsigned int DWORD;
+typedef unsigned char BYTE;
+#endif // TARGET_OS_MAC 
+
+typedef struct PlugInfoStructTag {
+	DWORD	APIMajorVersion;
+	DWORD	APIMinorVersion;
+	BYTE	uniqueID[4];			// 4 chars uniqueID - not null terminated
+	BYTE	pluginName[16];			// 16 chars plugin friendly name - not null terminated
+	DWORD	pluginType;				// Effect or source
+} PlugInfoStruct;
+
+typedef struct PlugExtendedInfoStructTag {
+	DWORD PluginMajorVersion;
+	DWORD PluginMinorVersion;
+	char* Description;
+	char* About;
+	DWORD FreeFrameExtendedDataSize;
+	void* FreeFrameExtendedDataBlock;
+} PlugExtendedInfoStruct;
+
+typedef struct VideoInfoStructTag {
+	DWORD frameWidth;				// width of frame in pixels
+	DWORD frameHeight;				// height of frame in pixels
+	DWORD bitDepth;					// enumerated indicator of bit depth of video  0 = 16 bit 5-6-5   1 = 24bit packed   2 = 32bit
+	DWORD orientation;				// video frame orientation meaningful values: 1 = origin at top left 2 = origin at bottom left
+} VideoInfoStruct;
+
+typedef struct ProcessFrameCopyStructTag {
+	DWORD numInputFrames;
+	void** InputFrames;
+	void* OutputFrame;
+} ProcessFrameCopyStruct;
+
+typedef struct SetParameterStructTag {
+	DWORD index;
+	float value;
+} SetParameterStruct;
+
+typedef union plugMainUnionTag {
+	DWORD ivalue;
+	float fvalue;
+	VideoInfoStruct *VISvalue;
+	PlugInfoStruct *PISvalue;
+	char *svalue;
+} plugMainUnion;
+
+///////////////////////////////////////////////////////////////////////////////////////
+// Function prototypes
+//
+
+///////////////////////////////////////////////////////////////////////////////////////
+// plugMain - The one and only exposed function
+// parameters: 
+//	functionCode - tells the plugin which function is being called
+//  pParam - 32-bit parameter or 32-bit pointer to parameter structure
+//
+// PLUGIN DEVELOPERS:  you shouldn't need to change this function
+//
+// All parameters are cast as 32-bit untyped pointers and cast to appropriate
+// types here
+// 
+// All return values are cast to 32-bit untyped pointers here before return to 
+// the host
+//
+
+#ifdef WIN32
+
+BOOL APIENTRY DllMain( HANDLE hModule, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID lpReserved );
+
+__declspec(dllexport) void* __stdcall plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
+
+typedef __declspec(dllimport) void* (__stdcall *FF_Main_FuncPtr)(DWORD,LPVOID,DWORD);
+
+#elif LINUX
+plugMainUnion plugMain( DWORD functionCode, LPVOID pParam, DWORD 
+reserved);
+
+#elif TARGET_OS_MAC
+
+typedef void* (*FF_Main_FuncPtr)(DWORD,void*,DWORD);
+
+#endif
+
+
+#endif
+#ifdef LINUX
+}
+#endif

File veejayBinOverlay/veejayBinOverlay.cpp

+/*
+  * Linux VeeJay
+  *
+  * Copyright (C) 2002 Niels Elburg <elburg@hio.hen.nl>
+  * Copyright (C) 2006 Maciek Szczesniak <vvarp@visualvinyl.net>
+  *                  (ported to FreeFrame, see http://freeframe.visualvinyl.net)
+  *
+  * Includes code from gavl lib, see http://gmerlin.sourceforge.net   
+  * Copyright (c) 2001-2002 by Burkhard Plaum - plaum@ipf.uni-stuttgart.de
+  *
+  * 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; either version 2
+  * of the License , or (at your option) any later version.
+  *
+  * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
+  */
+
+#include "veejayBinOverlay.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+// colorspace conversion
+
+static int y_to_rgb[0x100];
+static int v_to_r[0x100];
+static int u_to_g[0x100];
+static int v_to_g[0x100];
+static int u_to_b[0x100];
+	
+static int r_to_y[0x100];
+static int g_to_y[0x100];
+static int b_to_y[0x100];
+	
+static int r_to_u[0x100];
+static int g_to_u[0x100];
+static int b_to_u[0x100];
+	
+static int r_to_v[0x100];
+static int g_to_v[0x100];
+static int b_to_v[0x100];
+
+void static InitTables()
+{
+	for(int i = 0; i < 0x100; i++)
+	{
+	    y_to_rgb[i] = (int)(i * 0x10000);
+	    
+	    v_to_r[i] = (int)( 1.40200 * (i - 0x80) * 0x10000);
+	    u_to_g[i] = (int)(-0.34414 * (i - 0x80) * 0x10000);
+	    v_to_g[i] = (int)(-0.71414 * (i - 0x80) * 0x10000);
+	    u_to_b[i] = (int)( 1.77200 * (i - 0x80) * 0x10000); 
+		
+	    r_to_y[i] = (int)((0.29900)*0x10000 * i);
+	    g_to_y[i] = (int)((0.58700)*0x10000 * i);
+	    b_to_y[i] = (int)((0.11400)*0x10000 * i);
+	    
+	    r_to_u[i] = (int)(-(0.16874)*0x10000 * i);
+	    g_to_u[i] = (int)(-(0.33126)*0x10000 * i);
+	    b_to_u[i] = (int)( (0.50000)*0x10000 * i + 0x800000);
+	    
+	    r_to_v[i] = (int)( (0.50000)*0x10000 * i);
+	    g_to_v[i] = (int)(-(0.41869)*0x10000 * i);
+	    b_to_v[i] = (int)(-(0.08131)*0x10000 * i + 0x800000); 
+	}
+}
+
+void static yuv_rgb24(VideoPixelYUV24 *src, VideoPixel24bit *dst, unsigned int size)
+{
+ 	int i_tmp, y, u, v;
+    for (int i=0; i<size; i++) {
+	    y = src[i].y;
+	    u = src[i].u;
+	    v = src[i].v;
+	    i_tmp = (y_to_rgb[y]+v_to_r[v])>>16;
+	    dst[i].red = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	    i_tmp = (y_to_rgb[y]+u_to_g[u]+v_to_g[v])>>16;
+	    dst[i].green = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	    i_tmp=(y_to_rgb[y]+u_to_b[u])>>16;
+	    dst[i].blue = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	}
+}
+
+void static rgb24_yuv(VideoPixel24bit *src, VideoPixelYUV24 *dst, unsigned int size)
+{
+ 	int r, g, b;
+    for (int i=0; i<size; i++) {
+	    r = src[i].red;
+	    g = src[i].green;
+	    b = src[i].blue;
+	    dst[i].y = (r_to_y[r]+g_to_y[g]+b_to_y[b])>>16;
+	    dst[i].u = (r_to_u[r]+g_to_u[g]+b_to_u[b])>>16;
+	    dst[i].v = (r_to_v[r]+g_to_v[g]+b_to_v[b])>>16;
+	}	 
+}
+
+void static yuv_rgb32(VideoPixelYUV32 *src, VideoPixel32bit *dst, unsigned int size)
+{
+ 	int i_tmp, y, u, v;
+    for (int i=0; i<size; i++) {
+	    y = src[i].y;
+	    u = src[i].u;
+	    v = src[i].v;
+	    i_tmp = (y_to_rgb[y]+v_to_r[v])>>16;
+	    dst[i].red = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	    i_tmp = (y_to_rgb[y]+u_to_g[u]+v_to_g[v])>>16;
+	    dst[i].green = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	    i_tmp=(y_to_rgb[y]+u_to_b[u])>>16;
+	    dst[i].blue = ((i_tmp>0xFF)?0xff:((i_tmp<0)?0:i_tmp));
+	}
+}
+
+void static rgb32_yuv(VideoPixel32bit *src, VideoPixelYUV32 *dst, unsigned int size)
+{
+ 	int r, g, b;
+    for (int i=0; i<size; i++) {
+	    r = src[i].red;
+	    g = src[i].green;
+	    b = src[i].blue;
+	    dst[i].y = (r_to_y[r]+g_to_y[g]+b_to_y[b])>>16;
+	    dst[i].u = (r_to_u[r]+g_to_u[g]+b_to_u[b])>>16;
+	    dst[i].v = (r_to_v[r]+g_to_v[g]+b_to_v[b])>>16;
+	}	 
+}
+
+// -------------
+
+PlugInfoStruct plugInfo;
+PlugExtendedInfoStruct plugExtInfo;
+ParamConstantsStruct paramConstants[NUM_PARAMS];
+
+PlugInfoStruct* getInfo() 
+{
+	plugInfo.APIMajorVersion = 1;
+	plugInfo.APIMinorVersion = 000;
+
+	char ID[5] = "VE07";
+	char name[17] = "veejayBinOverlay";
+	
+	memcpy(plugInfo.uniqueID, ID, 4);
+	memcpy(plugInfo.pluginName, name, 16);
+	plugInfo.pluginType = FF_EFFECT;
+	
+	return &plugInfo;
+}
+
+DWORD initialise()
+{
+	paramConstants[0].defaultValue = 0.0f;
+
+	char tempName0[17] = "Mode";
+	
+	memcpy(paramConstants[0].name, tempName0, 16);
+	
+	InitTables();
+
+	return FF_SUCCESS;
+}
+
+DWORD deInitialise()
+{
+	return FF_SUCCESS;
+}
+
+DWORD getNumParameters()
+{
+	return NUM_PARAMS;  
+}
+
+char* getParameterName(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramConstants[index].name;
+	else
+		return "";
+}
+
+float getParameterDefault(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramConstants[index].defaultValue;
+	else
+		return FF_FAIL;
+}
+
+void plugClass::init() {
+
+	paramDynamicData[0].value = paramConstants[0].defaultValue;
+
+	frameSize = videoInfo.frameHeight * videoInfo.frameWidth;
+	
+	tempFrame1 = (BYTE*)malloc(frameSize*4);
+	tempFrame2 = (BYTE*)malloc(frameSize*4);
+
+}
+
+plugClass::~plugClass() {
+    free(tempFrame1);
+    free(tempFrame2);
+}
+
+char* plugClass::getParameterDisplay(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+	{
+		for (int n=0; n<16; n++) { paramDynamicData[index].displayValue[n] = ' '; }
+		sprintf(paramDynamicData[index].displayValue, "%f",paramDynamicData[index].value);
+		return paramDynamicData[index].displayValue;
+	}
+	else
+		return "";
+}
+
+DWORD plugClass::setParameter(SetParameterStruct* pParam)
+{
+	if(pParam->index >= 0 && pParam->index < NUM_PARAMS)
+	{
+		paramDynamicData[pParam->index].value = pParam->value;
+		return FF_SUCCESS;
+	}
+	else
+	{
+		return FF_FAIL;
+	}
+}
+
+float plugClass::getParameter(DWORD index)
+{
+	if(index >= 0 && index < NUM_PARAMS)
+		return paramDynamicData[index].value;
+	else
+		return FF_FAIL;
+}
+
+DWORD plugClass::processFrame(LPVOID pFrame)
+{
+	switch (videoInfo.bitDepth) {
+		case 1:
+			return processFrame24Bit(pFrame);
+		case 2:
+			return processFrame32Bit(pFrame);
+		default:
+			return FF_FAIL;
+	}
+
+}
+
+DWORD plugClass::processFrame24Bit(LPVOID pFrame)
+{
+	return FF_SUCCESS;
+}
+
+DWORD plugClass::processFrame32Bit(LPVOID pFrame)
+{
+	return FF_SUCCESS;
+}
+
+DWORD plugClass::processFrameCopy(ProcessFrameCopyStruct* pFrameData)