Index: DOCS/man/en/mplayer.1 =================================================================== --- DOCS/man/en/mplayer.1 (revision 27458) +++ DOCS/man/en/mplayer.1 (working copy) @@ -731,9 +731,9 @@ handle carriage return (i.e.\& \\r). . .TP -.B \-priority (Windows only) +.B \-priority (Windows and OS/2 only) Set process priority for MPlayer according to the predefined -priorities available under Windows. +priorities available under Windows and OS/2. Possible values of : .RSs idle|belownormal|normal|abovenormal|high|realtime Index: mplayer.c =================================================================== --- mplayer.c (revision 27458) +++ mplayer.c (working copy) @@ -6,6 +6,11 @@ #include #include "config.h" +#ifdef __OS2__ +#define INCL_DOS +#include +#endif + #ifdef WIN32 #define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ #include @@ -87,7 +92,7 @@ int quiet=0; int enable_mouse_movements=0; -#ifdef WIN32 +#if defined(WIN32) || defined(__OS2__) char * proc_priority=NULL; #endif @@ -2631,9 +2640,11 @@ } #endif +#if defined(WIN32) || defined(__OS2__) #ifdef WIN32 // request 1ms timer resolution timeBeginPeriod(1); +#endif if(proc_priority){ int i; for(i=0; priority_presets_defs[i].name; i++){ @@ -2642,7 +2653,14 @@ } mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_SettingProcessPriority, priority_presets_defs[i].name); + #ifdef __OS2__ + DosSetPriority(PRTYS_PROCESS, + HIBYTE(priority_presets_defs[i].prio), + LOBYTE(priority_presets_defs[i].prio), + 0 ); + #else SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio); + #endif } #endif #ifndef CONFIG_GUI Index: cfg-common.h =================================================================== --- cfg-common.h (revision 27458) +++ cfg-common.h (working copy) @@ -368,6 +368,19 @@ { "idle", IDLE_PRIORITY_CLASS}, { NULL, NORMAL_PRIORITY_CLASS} /* default */ }; +#elif defined(__OS2__) +struct { + char* name; + int prio; +} priority_presets_defs[] = { + { "realtime", MAKESHORT(0, PRTYC_TIMECRITICAL)}, + { "high", MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR)}, + { "abovenormal", MAKESHORT(15, PRTYC_REGULAR)}, + { "normal", MAKESHORT(0, PRTYC_REGULAR)}, + { "belownormal", MAKESHORT(PRTYD_MAXIMUM, PRTYC_IDLETIME)}, + { "idle", MAKESHORT(0, PRTYC_IDLETIME)}, + { NULL, MAKESHORT(0, PRTYC_REGULAR)} /* default */ +}; #endif /* WIN32 */ extern const m_option_t noconfig_opts[]; Index: cfg-common-opts.h =================================================================== --- cfg-common-opts.h (revision 27458) +++ cfg-common-opts.h (working copy) @@ -15,7 +15,7 @@ {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, #endif {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, -#ifdef WIN32 +#if defined(WIN32) || defined(__OS2__) {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif {"noconfig", noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL}, Index: mencoder.c =================================================================== --- mencoder.c (revision 27458) +++ mencoder.c (working copy) @@ -25,6 +25,11 @@ #include #include "config.h" +#ifdef __OS2__ +#define INCL_DOS +#include +#endif + #ifdef __MINGW32__ #define SIGHUP 1 #define SIGQUIT 3 @@ -143,7 +148,7 @@ double cur_vout_time_usage=0; int benchmark=0; -#ifdef WIN32 +#if defined(WIN32) || defined(__OS2__) char * proc_priority=NULL; #endif @@ -516,7 +525,7 @@ } } -#ifdef WIN32 +#if defined(WIN32) || defined(__OS2__) if(proc_priority){ int i; for(i=0; priority_presets_defs[i].name; i++){ @@ -525,7 +534,14 @@ } mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_SettingProcessPriority, priority_presets_defs[i].name); +#ifdef __OS2__ + DosSetPriority(PRTYS_PROCESS, + HIBYTE(priority_presets_defs[i].prio), + LOBYTE(priority_presets_defs[i].prio), + 0 ); +#else SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio); +#endif } #endif