Revision: 9884 http://pure-data.svn.sourceforge.net/pure-data/?rev=9884&view=rev Author: eighthave Date: 2008-05-23 17:07:14 -0700 (Fri, 23 May 2008)
Log Message: ----------- ran emacs' auto indent to make Pd-style indentation
Modified Paths: -------------- trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c
Modified: trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h =================================================================== --- trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h 2008-05-24 00:05:54 UTC (rev 9883) +++ trunk/externals/pdvjtools/pdp_freeframe/FreeFrame.h 2008-05-24 00:07:14 UTC (rev 9884) @@ -62,9 +62,9 @@
#elif defined(__linux__) || defined(__APPLE__)
-typedef unsigned int DWORD; -typedef void *LPVOID; -typedef unsigned char BYTE; + typedef unsigned int DWORD; + typedef void *LPVOID; + typedef unsigned char BYTE;
#endif
@@ -127,59 +127,59 @@ * FreeFrame types */
-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 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 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 */ + 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; + } VideoInfoStruct;
-typedef struct ProcessFrameCopyStructTag { - DWORD numInputFrames; - void** InputFrames; - void* OutputFrame; -} ProcessFrameCopyStruct; + typedef struct ProcessFrameCopyStructTag { + DWORD numInputFrames; + void** InputFrames; + void* OutputFrame; + } ProcessFrameCopyStruct;
-typedef struct SetParameterStructTag { - DWORD index; - float value; -} SetParameterStruct; + typedef struct SetParameterStructTag { + DWORD index; + float value; + } SetParameterStruct;
-typedef union { - DWORD ivalue; - float fvalue; - char *svalue; -} ParameterValue; + typedef union { + DWORD ivalue; + float fvalue; + char *svalue; + } ParameterValue;
-typedef union plugMainUnionTag { - DWORD ivalue; - float fvalue; - VideoInfoStruct *VISvalue; - PlugInfoStruct *PISvalue; - char *svalue; -} plugMainUnion; + typedef union plugMainUnionTag { + DWORD ivalue; + float fvalue; + VideoInfoStruct *VISvalue; + PlugInfoStruct *PISvalue; + char *svalue; + } plugMainUnion;
-typedef plugMainUnion plugMainType(DWORD, LPVOID, DWORD); + typedef plugMainUnion plugMainType(DWORD, LPVOID, DWORD);
/* * Function prototypes @@ -204,20 +204,20 @@
#ifdef _WIN32
-BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, DWORD lpReserved ); + BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, DWORD lpReserved );
-__declspec(dllexport) LPVOID __stdcall plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved); + __declspec(dllexport) LPVOID __stdcall plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
-typedef __declspec(dllimport) LPVOID (__stdcall *FF_Main_FuncPtr)(DWORD, LPVOID, DWORD); + typedef __declspec(dllimport) LPVOID (__stdcall *FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
#elif __linux__
-plugMainUnion plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved); + plugMainUnion plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
#elif __APPLE__
-typedef LPVOID (*FF_Main_FuncPtr)(DWORD, LPVOID, DWORD); + typedef LPVOID (*FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
#endif
Modified: trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c =================================================================== --- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 00:05:54 UTC (rev 9883) +++ trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 00:07:14 UTC (rev 9884) @@ -92,7 +92,7 @@ { x->x_filename_count = scandir(plugindir, &x->x_filename_list, selector, alphasort); if (x->x_filename_count < 0) - x->x_filename_count = 0; + x->x_filename_count = 0; }
void ff_loadplugins(t_pdp_freeframe *x, t_symbol *plugindirsymbol) @@ -111,7 +111,7 @@ x->plugins = (PLUGIN *)getbytes(x->x_filename_count*sizeof(PLUGIN)); if (x->plugins == NULL) { - panic("no memory for loading plugins\n"); + panic("no memory for loading plugins\n"); } else { @@ -120,51 +120,51 @@
for (i=0; i<x->x_filename_count; i++) { - pluginname = x->x_filename_list[i]->d_name; + pluginname = x->x_filename_list[i]->d_name; - snprintf(libname, PATH_MAX, "%s/%s", plugindir, pluginname); + snprintf(libname, PATH_MAX, "%s/%s", plugindir, pluginname); - plugin_handle = dlopen(libname, RTLD_NOW); - dlerror(); - plugmain = (plugMainType *)(unsigned)dlsym(plugin_handle, "plugMain"); - if (plugmain == NULL) - panic("plugin %s: %s", x->x_filename_list[i]->d_name, dlerror()); + plugin_handle = dlopen(libname, RTLD_NOW); + dlerror(); + plugmain = (plugMainType *)(unsigned)dlsym(plugin_handle, "plugMain"); + if (plugmain == NULL) + panic("plugin %s: %s", x->x_filename_list[i]->d_name, dlerror()); - PlugInfoStruct *pis = (plugmain(FF_GETINFO, NULL, 0)).PISvalue; + PlugInfoStruct *pis = (plugmain(FF_GETINFO, NULL, 0)).PISvalue;
- if ((plugmain(FF_GETPLUGINCAPS, (LPVOID)FF_CAP_V_BITS_VIDEO, 0)).ivalue != FF_TRUE) - panic("plugin %s: no 24 bit support", pluginname); + if ((plugmain(FF_GETPLUGINCAPS, (LPVOID)FF_CAP_V_BITS_VIDEO, 0)).ivalue != FF_TRUE) + panic("plugin %s: no 24 bit support", pluginname);
- if (pis->APIMajorVersion < 1) - panic("plugin %s: old api version", pluginname); + if (pis->APIMajorVersion < 1) + panic("plugin %s: old api version", pluginname); - if ((plugmain(FF_INITIALISE, NULL, 0)).ivalue == FF_FAIL) - panic("plugin %s: init failed", pluginname); + if ((plugmain(FF_INITIALISE, NULL, 0)).ivalue == FF_FAIL) + panic("plugin %s: init failed", pluginname); - VideoInfoStruct vidinfo; - vidinfo.frameWidth = x->x_width; - vidinfo.frameHeight = x->x_height; - vidinfo.orientation = 1; - vidinfo.bitDepth = FF_CAP_V_BITS_VIDEO; + VideoInfoStruct vidinfo; + vidinfo.frameWidth = x->x_width; + vidinfo.frameHeight = x->x_height; + vidinfo.orientation = 1; + vidinfo.bitDepth = FF_CAP_V_BITS_VIDEO;
- instance = plugmain(FF_INSTANTIATE, &vidinfo, 0).ivalue; - if (instance == FF_FAIL) - panic("plugin %s: init failed", pluginname); + instance = plugmain(FF_INSTANTIATE, &vidinfo, 0).ivalue; + if (instance == FF_FAIL) + panic("plugin %s: init failed", pluginname); - numparameters = plugmain(FF_GETNUMPARAMETERS, NULL, 0).ivalue; - if (numparameters == FF_FAIL) - panic("plugin %s: numparameters failed", pluginname); + numparameters = plugmain(FF_GETNUMPARAMETERS, NULL, 0).ivalue; + if (numparameters == FF_FAIL) + panic("plugin %s: numparameters failed", pluginname); - x->plugins[x->x_plugin_count].plugmain = plugmain; + x->plugins[x->x_plugin_count].plugmain = plugmain; - strncpy(x->plugins[x->x_plugin_count].name, (char *)(pis->pluginName), 16); - x->plugins[x->x_plugin_count].name[16] = 0; + strncpy(x->plugins[x->x_plugin_count].name, (char *)(pis->pluginName), 16); + x->plugins[x->x_plugin_count].name[16] = 0; - x->plugins[x->x_plugin_count].instance = instance; - x->plugins[x->x_plugin_count].numparameters = numparameters; + x->plugins[x->x_plugin_count].instance = instance; + x->plugins[x->x_plugin_count].numparameters = numparameters; - post("%s [%s] is loaded", x->plugins[x->x_plugin_count].name, pluginname); - x->x_plugin_count++; + post("%s [%s] is loaded", x->plugins[x->x_plugin_count].name, pluginname); + x->x_plugin_count++; } }
@@ -175,14 +175,14 @@
void ff_freeplugins(t_pdp_freeframe *x) { - t_int i; + t_int i;
for (i=0; i<x->x_plugin_count; i++) { - plugMainType *plugmain = x->plugins[i].plugmain; + plugMainType *plugmain = x->plugins[i].plugmain;
- plugmain(FF_DEINITIALISE, NULL, 0); - plugmain(FF_DEINSTANTIATE, NULL, x->plugins[i].instance); + plugmain(FF_DEINITIALISE, NULL, 0); + plugmain(FF_DEINSTANTIATE, NULL, x->plugins[i].instance); } post("freeing plugin resources : %x", x->plugins); freebytes( x->plugins, x->x_filename_count*sizeof(PLUGIN) ); @@ -203,9 +203,9 @@ short int *newdata = (short int *)pdp_packet_data(x->x_packet1);
if ( x->x_plugin_count <= 0 ) - { - return; - } + { + return; + }
if ((x->x_width != (t_int)header->info.image.width) || (x->x_height != (t_int)header->info.image.height)) @@ -236,7 +236,7 @@
static void pdp_freeframe_param(t_pdp_freeframe *x, t_floatarg f1, t_floatarg f2) { - int i=0; + int i=0; plugMainType *plugmain = x->plugins[x->x_plugin].plugmain; unsigned instance = x->plugins[x->x_plugin].instance; unsigned numparameters = x->plugins[x->x_plugin].numparameters; @@ -252,9 +252,9 @@
//post ("%d param.value %d", i, sps.value); - //if((f2<=1)&&(f2>=0)) - sps.value = f2; - //sps.value += .01; + //if((f2<=1)&&(f2>=0)) + sps.value = f2; + //sps.value += .01; //if (sps.value > 1.0) sps.value = 1.0; //else //if (sps.value < 0.0) sps.value = 0.0; @@ -266,51 +266,51 @@
static void pdp_freeframe_plugin(t_pdp_freeframe *x, t_floatarg f) { - unsigned pi; - char *parname; - int partype; - float pardefault; - t_atom plist[2]; - t_atom tlist[2]; - t_atom vlist[2]; + unsigned pi; + char *parname; + int partype; + float pardefault; + t_atom plist[2]; + t_atom tlist[2]; + t_atom vlist[2];
if ( x->x_plugin_count <= 0 ) { - post( "freeframe : no plugins loaded, check your plugin directory setup" ); - return; + post( "freeframe : no plugins loaded, check your plugin directory setup" ); + return; } if((f<x->x_plugin_count)&&(f>-1)) { - x->x_plugin = f; + x->x_plugin = f; } else { - post( "freeframe : plugin out of range : %d", (t_int)f ); - return; + post( "freeframe : plugin out of range : %d", (t_int)f ); + return; } post ("pdp_freeframe :: %s selected, %d parameters", x->plugins[x->x_plugin].name, x->plugins[x->x_plugin].numparameters); outlet_symbol(x->x_pname, gensym( x->plugins[x->x_plugin].name ) ); outlet_float(x->x_nparams, (float)x->plugins[x->x_plugin].numparameters); for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) { - parname = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERNAME, (LPVOID)pi, 0)).svalue; - SETFLOAT(&plist[0], pi); - SETSYMBOL(&plist[1], gensym(parname) ); - outlet_list( x->x_parname, &s_list, 2, &plist[0] ); + parname = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERNAME, (LPVOID)pi, 0)).svalue; + SETFLOAT(&plist[0], pi); + SETSYMBOL(&plist[1], gensym(parname) ); + outlet_list( x->x_parname, &s_list, 2, &plist[0] ); } for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) { - partype = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERTYPE, (LPVOID)pi, 0)).ivalue; - SETFLOAT(&tlist[0], pi); - SETFLOAT(&tlist[1], partype ); - outlet_list( x->x_partype, &s_list, 2, &tlist[0] ); - if ( ( partype != FF_TYPE_TEXT ) && ( partype > 0 ) ) - { - pardefault = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERDEFAULT, (LPVOID)pi, 0)).fvalue; - SETFLOAT(&vlist[0], pi); - SETFLOAT(&vlist[1], pardefault ); - outlet_list( x->x_pardefault, &s_list, 2, &vlist[0] ); - } + partype = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERTYPE, (LPVOID)pi, 0)).ivalue; + SETFLOAT(&tlist[0], pi); + SETFLOAT(&tlist[1], partype ); + outlet_list( x->x_partype, &s_list, 2, &tlist[0] ); + if ( ( partype != FF_TYPE_TEXT ) && ( partype > 0 ) ) + { + pardefault = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERDEFAULT, (LPVOID)pi, 0)).fvalue; + SETFLOAT(&vlist[0], pi); + SETFLOAT(&vlist[1], pardefault ); + outlet_list( x->x_pardefault, &s_list, 2, &vlist[0] ); + } } }
@@ -326,62 +326,62 @@
static void pdp_freeframe_process(t_pdp_freeframe *x) { - int encoding; - t_pdp *header = 0; - char *parname; - unsigned pi; - int partype; - float pardefault; - t_atom plist[2]; - t_atom tlist[2]; - t_atom vlist[2]; + int encoding; + t_pdp *header = 0; + char *parname; + unsigned pi; + int partype; + float pardefault; + t_atom plist[2]; + t_atom tlist[2]; + t_atom vlist[2];
- /* check if image data packets are compatible */ - if ( (header = pdp_packet_header(x->x_packet0)) - && (PDP_BITMAP == header->type)){ + /* check if image data packets are compatible */ + if ( (header = pdp_packet_header(x->x_packet0)) + && (PDP_BITMAP == header->type)){
- /* pdp_freeframe_process inputs and write into active inlet */ - switch(pdp_packet_header(x->x_packet0)->info.image.encoding){ + /* pdp_freeframe_process inputs and write into active inlet */ + switch(pdp_packet_header(x->x_packet0)->info.image.encoding){
- case PDP_BITMAP_RGB: + case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); pdp_queue_add(x, pdp_freeframe_process_rgb, pdp_freeframe_sendpacket, &x->x_queue_id); - break; + break;
- default: - /* don't know the type, so dont pdp_freeframe_process */ - break; + default: + /* don't know the type, so dont pdp_freeframe_process */ + break; - } + } }
// hack to display infos of first loaded plugin if ( (x->x_plugin_count > 0) && (!x->x_infosok) ) { - x->x_infosok = 1; - outlet_symbol(x->x_pname, gensym( x->plugins[x->x_plugin].name ) ); - outlet_float(x->x_nparams, (float)x->plugins[x->x_plugin].numparameters); - for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) - { - parname = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERNAME, (LPVOID)pi, 0)).svalue; - SETFLOAT(&plist[0], pi); - SETSYMBOL(&plist[1], gensym(parname) ); - outlet_list( x->x_parname, &s_list, 2, &plist[0] ); - } - for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) - { - partype = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERTYPE, (LPVOID)pi, 0)).ivalue; - SETFLOAT(&tlist[0], pi); - SETFLOAT(&tlist[1], partype ); - outlet_list( x->x_partype, &s_list, 2, &tlist[0] ); - if ( ( partype != FF_TYPE_TEXT ) && ( partype > 0 ) ) - { - pardefault = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERDEFAULT, (LPVOID)pi, 0)).fvalue; - SETFLOAT(&vlist[0], pi); - SETFLOAT(&vlist[1], pardefault ); - outlet_list( x->x_pardefault, &s_list, 2, &vlist[0] ); - } - } + x->x_infosok = 1; + outlet_symbol(x->x_pname, gensym( x->plugins[x->x_plugin].name ) ); + outlet_float(x->x_nparams, (float)x->plugins[x->x_plugin].numparameters); + for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) + { + parname = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERNAME, (LPVOID)pi, 0)).svalue; + SETFLOAT(&plist[0], pi); + SETSYMBOL(&plist[1], gensym(parname) ); + outlet_list( x->x_parname, &s_list, 2, &plist[0] ); + } + for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) + { + partype = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERTYPE, (LPVOID)pi, 0)).ivalue; + SETFLOAT(&tlist[0], pi); + SETFLOAT(&tlist[1], partype ); + outlet_list( x->x_partype, &s_list, 2, &tlist[0] ); + if ( ( partype != FF_TYPE_TEXT ) && ( partype > 0 ) ) + { + pardefault = (x->plugins[x->x_plugin].plugmain(FF_GETPARAMETERDEFAULT, (LPVOID)pi, 0)).fvalue; + SETFLOAT(&vlist[0], pi); + SETFLOAT(&vlist[1], pardefault ); + outlet_list( x->x_pardefault, &s_list, 2, &vlist[0] ); + } + } } }
@@ -390,7 +390,7 @@ /* if this is a register_ro message or register_rw message, register with packet factory */
if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") );
if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { @@ -401,7 +401,7 @@
static void pdp_freeframe_free(t_pdp_freeframe *x) { - int i; + int i;
pdp_queue_finish(x->x_queue_id); pdp_packet_mark_unused(x->x_packet0); @@ -462,20 +462,20 @@ #endif
-void pdp_freeframe_setup(void) -{ + void pdp_freeframe_setup(void) + {
- post( "pdp_freeframe :: FreeFrame host for Pure Data Packet version 0.3\n by Lluis Gomez i Bigorda (lluis@artefacte.org) \n & Yves Degoyon (ydegoyon@free.fr)\n using GPL code from http://freeframe.sf.net%5Cn and Pete Warden http://petewarden.com" ); - pdp_freeframe_class = class_new(gensym("pdp_freeframe"), (t_newmethod)pdp_freeframe_new, - (t_method)pdp_freeframe_free, sizeof(t_pdp_freeframe), 0, A_DEFFLOAT, A_NULL); + post( "pdp_freeframe :: FreeFrame host for Pure Data Packet version 0.3\n by Lluis Gomez i Bigorda (lluis@artefacte.org) \n & Yves Degoyon (ydegoyon@free.fr)\n using GPL code from http://freeframe.sf.net%5Cn and Pete Warden http://petewarden.com" ); + pdp_freeframe_class = class_new(gensym("pdp_freeframe"), (t_newmethod)pdp_freeframe_new, + (t_method)pdp_freeframe_free, sizeof(t_pdp_freeframe), 0, A_DEFFLOAT, A_NULL);
- class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); - class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugin, gensym("plugin"), A_FLOAT, A_NULL); - class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_param, gensym("param"), A_FLOAT, A_FLOAT, A_NULL); - class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugindir, gensym("plugindir"), A_SYMBOL, A_NULL); + class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugin, gensym("plugin"), A_FLOAT, A_NULL); + class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_param, gensym("param"), A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugindir, gensym("plugindir"), A_SYMBOL, A_NULL);
-} + }
#ifdef __cplusplus }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.