[MEncoder-users] [PATCH] xmms plugins in ~

Nicolas George nicolas.george at ens.fr
Mon Feb 19 16:21:50 CET 2007


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.

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 16:17:56.536839224 +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,22 @@
     closedir(dir);
 }
 
+static void init_plugins(){
+    DIR *dir;
+    struct dirent *ent;
+    char *home;
+    
+    no_plugins=0;
+
+    init_plugins_from_dir(XMMS_INPUT_PLUGIN_DIR);
+    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);
+    }
+}
+
 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/mencoder-users/attachments/20070219/73c92eb0/attachment.pgp>


More information about the MEncoder-users mailing list