windows priority support patch by Rune Petersen <runner at mail.tele.dk> with the freedom to shoot yourself in the foot

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15043 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
faust3 2005-04-02 18:29:16 +00:00
parent a97a94b929
commit 14ecebe920
4 changed files with 65 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);