summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.113
-rw-r--r--cfg-common.h19
-rw-r--r--mencoder.c17
-rw-r--r--mplayer.c16
4 files changed, 65 insertions, 0 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index cf45049b7e..2eabb31afb 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -433,6 +433,19 @@ Particularly useful on slow terminals or broken ones which do not properly
handle carriage return (i.e.\& \\r).
.
.TP
+.B \-priority <prio> (Windows only)
+Set process priority for MPlayer according to Windows predefined priorities.
+.sp 1
+Possible values of <prio>:
+.RSs
+idle|belownormal|normal|abovenormal|high|realtime
+.sp 1
+.I Warning:
+.br
+Using realtime priority can cause system lockup.
+.RE
+.
+.TP
.B \-v, \-verbose
Increment verbose level (more \-v means more verbosity).
.PD 0
diff --git a/cfg-common.h b/cfg-common.h
index 636f8aad71..1bc7f573ed 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -6,6 +6,7 @@
{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL},
{"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
{"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL},
+ {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
// ------------------------- stream options --------------------
@@ -470,6 +471,24 @@ m_option_t audio_filter_conf[]={
{NULL, NULL, 0, 0, 0, 0, NULL}
};
+#ifdef WIN32
+
+extern char * proc_priority;
+
+struct {
+ char* name;
+ int prio;
+} priority_presets_defs[] = {
+ { "realtime", REALTIME_PRIORITY_CLASS},
+ { "high", HIGH_PRIORITY_CLASS},
+ { "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
+ { "normal", NORMAL_PRIORITY_CLASS},
+ { "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
+ { "idle", IDLE_PRIORITY_CLASS},
+ { NULL, NORMAL_PRIORITY_CLASS} /* default */
+};
+#endif /* WIN32 */
+
#ifdef USE_LIBAVCODEC
extern m_option_t lavc_decode_opts_conf[];
#endif
diff --git a/mencoder.c b/mencoder.c
index 359f3a64a1..10fea81283 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -153,6 +153,10 @@ double cur_video_time_usage=0;
double cur_vout_time_usage=0;
int benchmark=0;
+#ifdef WIN32
+char * proc_priority=NULL;
+#endif
+
// A-V sync:
int delay_corrected=1;
static float default_max_pts_correction=-1;//0.01f;
@@ -479,6 +483,19 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
mp_msg_set_level(verbose+MSGL_STATUS);
+#ifdef WIN32
+ if(proc_priority){
+ int i;
+ for(i=0; priority_presets_defs[i].name; i++){
+ if(strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
+ break;
+ }
+ mp_msg(MSGT_CPLAYER,MSGL_STATUS,"Setting process priority: %s\n",
+ priority_presets_defs[i].name);
+ SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
+ }
+#endif
+
// check font
#ifdef USE_OSD
#ifdef HAVE_FREETYPE
diff --git a/mplayer.c b/mplayer.c
index 19cdd0daa8..55339a2e7e 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -88,6 +88,10 @@ int verbose=0;
int identify=0;
int quiet=0;
+#ifdef WIN32
+char * proc_priority=NULL;
+#endif
+
#define ABS(x) (((x)>=0)?(x):(-(x)))
#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
@@ -1145,6 +1149,18 @@ int gui_no_filename=0;
}
}
+#ifdef WIN32
+ if(proc_priority){
+ int i;
+ for(i=0; priority_presets_defs[i].name; i++){
+ if(strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
+ break;
+ }
+ mp_msg(MSGT_CPLAYER,MSGL_STATUS,"Setting process priority: %s\n",
+ priority_presets_defs[i].name);
+ SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
+ }
+#endif
#ifndef HAVE_NEW_GUI
if(use_gui){
mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui);