[MPlayer-dev-eng] [PATCH] adjusting nice level from config/command line

Wojtek Kaniewski wojtekka at bydg.pdi.net
Sat May 25 19:30:42 CEST 2002


it adds ,,-nice'' which can change mplayer's priority. along with
the suid bit (or some kernel module like capsel[1]), it allows to
decrease other processes' impact on framedrops. at least theoreticaly,
because it also depends on many others conditions.

regards,
wojtek

[1] http://freshmeat.net/projects/capsel/
-------------- next part --------------
diff -uNr DOCS/mplayer.1.orig DOCS/mplayer.1
--- DOCS/mplayer.1.orig	Mon May 20 20:06:16 2002
+++ DOCS/mplayer.1	Tue May 21 18:25:33 2002
@@ -778,6 +778,9 @@
 .B \-loop <num>
 Loops movie playback <num> times. 0 means forever
 .TP
+.B \-nice <num>
+Sets process nice level to <num>.
+.TP
 .B \-nojoystick
 Turns off joystick support. Default is on, if compiled in
 .TP
diff -uNr cfg-mplayer.h.orig cfg-mplayer.h
--- cfg-mplayer.h.orig	Mon May 20 20:06:05 2002
+++ cfg-mplayer.h	Tue May 21 18:20:42 2002
@@ -5,6 +5,7 @@
 #include "cfg-common.h"
 
 extern int use_stdin;
+extern int nice_level;
 
 #ifdef HAVE_FBDEV
 extern char *fb_dev_name;
@@ -331,6 +332,8 @@
 
 	{"slave", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
 	{"use-stdin", &use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+	
+	{"nice", &nice_level, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
 
 #define MAIN_CONF
 #include "cfg-common.h"
diff -uNr mplayer.c.orig mplayer.c
--- mplayer.c.orig	Mon May 20 20:06:08 2002
+++ mplayer.c	Tue May 21 18:23:42 2002
@@ -169,6 +169,8 @@
 static int auto_quality=0;
 static int output_quality=0;
 
+int nice_level=0;
+
 int use_gui=0;
 
 int osd_level=2;
@@ -612,6 +614,9 @@
     }
 #endif
 
+    if(nice_level)
+      nice(nice_level);
+
     if(vo_plugin_args && vo_plugin_args[0] && strcmp(vo_plugin_args[0],"help")==0){
       mp_msg(MSGT_CPLAYER, MSGL_INFO, "Available video output plugins:\n");
       vf_list_plugins();


More information about the MPlayer-dev-eng mailing list