aboutsummaryrefslogtreecommitdiff
path: root/pdp_freeframe
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-24 00:05:54 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-24 00:05:54 +0000
commit7367822bd9e67ef1e5e888f3302ded507ab4e68a (patch)
treeb58c71bf4068bdc60b395e24af54bd03a506dbad /pdp_freeframe
parenta6e6fcac6028fda93c43bcd6e3628e1e4f51499c (diff)
store plugindir as symbol in object's struct and use that with [plugindir( message; ported to Mac OS X
svn path=/trunk/externals/pdvjtools/; revision=9883
Diffstat (limited to 'pdp_freeframe')
-rw-r--r--pdp_freeframe/FreeFrame.h15
-rw-r--r--pdp_freeframe/pdp_freeframe.c25
2 files changed, 27 insertions, 13 deletions
diff --git a/pdp_freeframe/FreeFrame.h b/pdp_freeframe/FreeFrame.h
index 7ca7f75..c63d698 100644
--- a/pdp_freeframe/FreeFrame.h
+++ b/pdp_freeframe/FreeFrame.h
@@ -51,7 +51,7 @@ extern "C" {
* includes
*/
-#ifdef WIN32
+#ifdef _WIN32
#if _MSC_VER > 1000
#pragma once
@@ -60,17 +60,12 @@ extern "C" {
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h>
-#elif defined LINUX
+#elif defined(__linux__) || defined(__APPLE__)
typedef unsigned int DWORD;
typedef void *LPVOID;
typedef unsigned char BYTE;
-#elif defined MACOS
-
-typedef unsigned int DWORD;
-typedef unsigned char BYTE;
-
#endif
@@ -207,7 +202,7 @@ typedef plugMainUnion plugMainType(DWORD, LPVOID, DWORD);
*
*/
-#ifdef WIN32
+#ifdef _WIN32
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, DWORD lpReserved );
@@ -215,12 +210,12 @@ __declspec(dllexport) LPVOID __stdcall plugMain(DWORD functionCode, LPVOID pPara
typedef __declspec(dllimport) LPVOID (__stdcall *FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
-#elif LINUX
+#elif __linux__
plugMainUnion plugMain(DWORD functionCode, LPVOID pParam, DWORD reserved);
-#elif MACOS
+#elif __APPLE__
typedef LPVOID (*FF_Main_FuncPtr)(DWORD, LPVOID, DWORD);
diff --git a/pdp_freeframe/pdp_freeframe.c b/pdp_freeframe/pdp_freeframe.c
index 1398ad3..ed5c8f0 100644
--- a/pdp_freeframe/pdp_freeframe.c
+++ b/pdp_freeframe/pdp_freeframe.c
@@ -70,6 +70,7 @@ typedef struct pdp_freeframe_struct
int x_plugin;
int x_infosok;
char x_pdetails[FREEFRAME_PARAM_DETAILS_LENGTH];
+ t_symbol *plugindir;
PLUGIN *plugins;
@@ -188,6 +189,12 @@ void ff_freeplugins(t_pdp_freeframe *x)
x->plugins = NULL;
}
+static void pdp_freeframe_plugindir(t_pdp_freeframe *x, t_symbol *s)
+{
+ x->plugindir = s;
+ ff_loadplugins(x, x->plugindir);
+}
+
static void pdp_freeframe_process_rgb(t_pdp_freeframe *x)
{
t_pdp *header = pdp_packet_header(x->x_packet0);
@@ -213,7 +220,7 @@ static void pdp_freeframe_process_rgb(t_pdp_freeframe *x)
x->x_size = x->x_width*x->x_height;
//load the plugins
- ff_loadplugins(x, FF_PLUGIN_DIR);
+ ff_loadplugins(x, x->plugindir);
}
newheader->info.image.encoding = header->info.image.encoding;
@@ -429,8 +436,20 @@ void *pdp_freeframe_new(t_floatarg f)
//load the plugins
x->x_plugin_count = 0;
x->x_infosok = 0;
- //ff_loadplugins(x, FF_PLUGIN_DIR);
+ char ff_plugin_dir[FILENAME_MAX];
+ char *home = getenv("HOME");
+ int home_len;
+ if(home != NULL)
+ {
+ home_len = strlen(home);
+ if(home_len >= FILENAME_MAX)
+ home_len = FILENAME_MAX - 1;
+ memcpy(ff_plugin_dir, home, home_len);
+ ff_plugin_dir[home_len] = '\0';
+ strncpy(ff_plugin_dir, "/.frf", FILENAME_MAX - home_len);
+ pdp_freeframe_plugindir(x, gensym(ff_plugin_dir));
+ }
pdp_freeframe_plugin(x, f);
return (void *)x;
@@ -453,7 +472,7 @@ void pdp_freeframe_setup(void)
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)ff_loadplugins, gensym("plugindir"), A_SYMBOL, A_NULL);
+ class_addmethod(pdp_freeframe_class, (t_method)pdp_freeframe_plugindir, gensym("plugindir"), A_SYMBOL, A_NULL);
}