init();
}
-PluginServer::PluginServer(MWindow *mwindow, char *path, int type)
+PluginServer::PluginServer(MWindow *mwindow, const char *path, int type)
{
char fpath[BCTEXTLEN];
init();
sprintf(fpath, "ff_%s", path);
path = fpath;
}
- set_path(path);
+ set_path(path);
}
PluginServer::PluginServer(PluginServer &that)
prompt = 0;
cleanup_plugin();
- lad_index = -1;
- lad_descriptor_function = 0;
- lad_descriptor = 0;
-
plugin_obj = 0;
client = 0;
new_plugin = 0;
lad_index = -1;
lad_descriptor_function = 0;
lad_descriptor = 0;
- use_opengl = 0;
ff_name = 0;
+ use_opengl = 0;
vdevice = 0;
plugin_type = 0;
start_auto = end_auto = 0;
return this->lad_index;
}
+int PluginServer::is_unknown()
+{
+ return plugin_type == PLUGIN_TYPE_UNKNOWN ? 1 : 0;
+}
+
+int PluginServer::is_executable()
+{
+ return plugin_type == PLUGIN_TYPE_EXECUTABLE ? 1 : 0;
+}
+
+int PluginServer::is_builtin()
+{
+ return plugin_type == PLUGIN_TYPE_BUILTIN ? 1 : 0;
+}
+
int PluginServer::is_ladspa()
{
return plugin_type == PLUGIN_TYPE_LADSPA ? 1 : 0;
return plugin_type == PLUGIN_TYPE_FFMPEG ? 1 : 0;
}
+int PluginServer::is_lv2()
+{
+ return plugin_type == PLUGIN_TYPE_LV2 ? 1 : 0;
+}
+
void PluginServer::set_path(const char *path)
{
delete [] this->path;
void PluginServer::set_title(const char *string)
{
- if(title) delete [] title;
+ delete [] title;
title = cstrdup(string);
}
this->preferences = preferences;
this->plugin = plugin;
this->edl = edl;
- if( plugin_type != PLUGIN_TYPE_FFMPEG && plugin_type != PLUGIN_TYPE_EXECUTABLE && !load_obj() ) {
-// If the load failed, can't use error to detect executable
-// because locale and language selection change the load_error()
+ if( !is_ffmpeg() && !is_lv2() && !is_executable() && !load_obj() ) {
+// If the load failed, can't use error string to detect executable
+// because locale and language selection changes the load_error() message
// if( !strstr(string, "executable") ) { set_title(path); plugin_type = PLUGIN_TYPE_EXECUTABLE; }
eprintf("PluginServer::open_plugin: load_obj %s = %s\n", path, load_error());
return PLUGINSERVER_NOT_RECOGNIZED;
}
- if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_BUILTIN ) {
+ if( is_unknown() || is_builtin() ) {
new_plugin =
(PluginClient* (*)(PluginServer*)) get_sym("new_plugin");
if( new_plugin )
plugin_type = PLUGIN_TYPE_BUILTIN;
}
- if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_LADSPA ) {
+ if( is_unknown() || is_ladspa() ) {
lad_descriptor_function =
(LADSPA_Descriptor_Function) get_sym("ladspa_descriptor");
if( lad_descriptor_function ) {
plugin_type = PLUGIN_TYPE_LADSPA;
}
}
- if( plugin_type == PLUGIN_TYPE_UNKNOWN ) {
+ if( is_unknown() ) {
fprintf(stderr, "PluginServer::open_plugin "
" %d: plugin undefined in %s\n", __LINE__, path);
return PLUGINSERVER_NOT_RECOGNIZED;
case PLUGIN_TYPE_BUILTIN:
client = new_plugin(this);
break;
+ case PLUGIN_TYPE_FFMPEG:
+ client = new_ffmpeg_plugin();
+ break;
case PLUGIN_TYPE_LADSPA:
client = new PluginAClientLAD(this);
break;
- case PLUGIN_TYPE_FFMPEG:
- client = new_ffmpeg_plugin();
+ case PLUGIN_TYPE_LV2:
+ client = new_lv2_plugin();
break;
default:
client = 0;
}
-int PluginServer::get_plugin_png_path(char *png_path, const char *plugin_icons)
+void PluginServer::get_plugin_png_name(char *png_name)
{
- char *pp = png_path, *ep = pp + BCTEXTLEN-1;
- pp += snprintf(pp, ep-pp, "%s/picon_%s/",
- File::get_plugin_path(), plugin_icons);
+ char *pp = png_name, *ep = pp + BCSTRLEN-1;
char *cp = strrchr(path, '/');
cp = !cp ? path : cp+1;
char *sp = strrchr(cp, '.');
if( !sp ) sp = cp+strlen(cp);
while( pp < ep && cp < sp ) *pp++ = *cp++;
snprintf(pp, ep-pp, ".png");
+}
+
+int PluginServer::get_plugin_png_path(char *png_path, const char *plugin_icons)
+{
+ char png_name[BCSTRLEN];
+ get_plugin_png_name(png_name);
+ char *pp = png_path, *ep = pp + BCTEXTLEN-1;
+ pp += snprintf(pp, ep-pp, "%s/picon/%s/%s",
+ File::get_plugin_path(), plugin_icons, png_name);
return access(png_path,R_OK) ? 1 : 0;
}
VFrame *PluginServer::get_plugin_images()
{
char png_path[BCTEXTLEN];
- if( get_plugin_png_path(png_path) ) return 0;
- return VFramePng::vframe_png(png_path,0,0);
+ if( !get_plugin_png_path(png_path) )
+ return VFramePng::vframe_png(png_path,0,0);
+ char png_name[BCSTRLEN];
+ get_plugin_png_name(png_name);
+ unsigned char *data = mwindow->theme->get_image_data(png_name, 0);
+ return data ? new VFramePng(data, 0.) : 0;
}
VFrame *PluginServer::get_picon()