Hi Klaus,
The new APIVERSION of 1.3.47 will cause lots of trouble as soon as
APIVERSION and VDRVERSION differ the first time, as this requires
updated Makefiles for all plugins. In best case, VDR wont find a plugin
because it has the wrong name, in worst case, an old version is used
without noticing.
On the other hand, its not too difficult to load plugins based on
APIVERSION and VDRVERSION alternatively. That way, plugins that still
use VDRVERSION continue to work. This even gives plugin authors the
ability to ignore APIVERSION compatibility if the plugin depends on
obscure differences between versions. The only drawback is that plugin
authors will be lazy adapting to APIVERSION.
The attached patch does the trick: It loads plugins using APIVERSION and
VDRVERSION, and gives VDRVERSION the precedence. The patch also prefers
VDRVERSION when loading "*". Feel free to use it if you want.
Cheers,
Udo
--- vdr-1.3.47-orig/plugin.c 2006-04-21 19:08:02.000000000 +0200
+++ vdr-1.3.47/plugin.c 2006-04-21 19:53:32.709327912 +0200
@@ -294,11 +294,26 @@
if (p) {
*p = 0;
p += strlen(SO_INDICATOR);
- if (strcmp(p, APIVERSION) == 0) {
+ if (strcmp(p, VDRVERSION) == 0) {
+ // VDRVERSION is always loaded
char *name = e->d_name + strlen(LIBVDR_PREFIX);
if (strcmp(name, "*") != 0) { // let's not get into a loop!
- AddPlugin(e->d_name + strlen(LIBVDR_PREFIX));
+ AddPlugin(name);
+ }
+ }
+ if (strcmp(p, APIVERSION) == 0) {
+ // APIVERSION found, check whether VDRVERSION exists too
+ char *name = e->d_name + strlen(LIBVDR_PREFIX);
+ char *buffer = NULL;
+ asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, name, SO_INDICATOR, VDRVERSION);
+ if (access(buffer,F_OK) != 0) {
+ // APIVERSION is the only existing one, use it
+ if (strcmp(name, "*") != 0) { // let's not get into a loop!
+ AddPlugin(name);
+ }
}
+ // else: skip APIVERSION, the loop will load VDRVERSION instead
+ free(buffer);
}
}
}
@@ -310,7 +325,11 @@
if (p)
*p = 0;
char *buffer = NULL;
- asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION);
+ asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION);
+ if (access(buffer,F_OK) != 0) { // Plugin not found using VDRVERSION, try APIVERSION instead
+ free(buffer);
+ asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION);
+ }
dlls.Add(new cDll(buffer, Args));
free(buffer);
free(s);