[MPlayer-dev-eng] [PATCH] xmms plugins in ~
Nicolas George
nicolas.george at ens.fr
Mon Feb 19 17:21:49 CET 2007
[ I mistakenly posted this mail to mencoder-users. I re-post it in the
proper place, with a patch updated according to remarks from Ivo. ]
Hi.
If mplayer is compiled with support of the xmms library, it looks for
plugins itself. That is done in libmpdemux/demux_xmms.c, function
init_plugins. The function explores the directory XMMS_INPUT_PLUGIN_DIR,
which will be something like /usr/lib/xmms/Input.
The problem is that xmms plugins can live in ~/.xmms/Plugins too. It is
especially necessary for people who do not have write privileges in the
global plugin directory.
The attached patch adds probing of this directory.
According to Ivo's suggestion, I made it probe the plugins in ~ first, so
they override global plugins.
Regards,
--
Nicolas George
-------------- next part --------------
--- libmpdemux/demux_xmms.c.orig 2007-02-19 16:10:37.318771949 +0100
+++ libmpdemux/demux_xmms.c 2007-02-19 17:12:41.546230118 +0100
@@ -155,19 +155,17 @@
xmms_length=length;
}
-static void init_plugins(){
+static void init_plugins_from_dir(const char *plugin_dir){
DIR *dir;
struct dirent *ent;
- no_plugins=0;
-
- dir = opendir(XMMS_INPUT_PLUGIN_DIR);
+ dir = opendir(plugin_dir);
if (!dir) return;
while ((ent = readdir(dir)) != NULL){
- char filename[strlen(XMMS_INPUT_PLUGIN_DIR)+strlen(ent->d_name)+4];
+ char filename[strlen(plugin_dir)+strlen(ent->d_name)+4];
void* handle;
- sprintf(filename,XMMS_INPUT_PLUGIN_DIR "/%s",ent->d_name);
+ sprintf(filename, "%s/%s", plugin_dir, ent->d_name);
handle=dlopen(filename, RTLD_NOW);
if(handle){
void *(*gpi) (void);
@@ -190,6 +188,21 @@
closedir(dir);
}
+static void init_plugins(){
+ char *home;
+
+ no_plugins=0;
+
+ home = getenv("HOME");
+ if(home != NULL) {
+ char xmms_home[strlen(home) + 15];
+ sprintf(xmms_home, "%s/.xmms/Plugins", home);
+ init_plugins_from_dir(xmms_home);
+ }
+
+ init_plugins_from_dir(XMMS_INPUT_PLUGIN_DIR);
+}
+
static void cleanup_plugins(){
while(no_plugins>0){
--no_plugins;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070219/d1a0b1c3/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list