mirror of https://github.com/mpv-player/mpv
Add priority support for OS/2 and factorize the Windows priority support.
patch by KO Myung-Hun, komh chollian net git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28520 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
97e427039d
commit
cdfafa6999
|
@ -732,9 +732,9 @@ Particularly useful on slow terminals or broken ones which do not properly
|
|||
handle carriage return (i.e.\& \\r).
|
||||
.
|
||||
.TP
|
||||
.B \-priority <prio> (Windows only)
|
||||
.B \-priority <prio> (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 <prio>:
|
||||
.RSs
|
||||
idle|belownormal|normal|abovenormal|high|realtime
|
||||
|
|
1
Makefile
1
Makefile
|
@ -433,6 +433,7 @@ SRCS_COMMON-$(NETWORK) += stream/stream_netstream.c \
|
|||
stream/realrtsp/xbuffer.c \
|
||||
|
||||
SRCS_COMMON-$(PNG) += libmpcodecs/vd_mpng.c
|
||||
SRCS_COMMON-$(PRIORITY) += osdep/priority.c
|
||||
SRCS_COMMON-$(PVR) += stream/stream_pvr.c
|
||||
SRCS_COMMON-$(QTX_CODECS) += libmpcodecs/ad_qtaudio.c \
|
||||
libmpcodecs/vd_qtvideo.c
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "osdep/priority.h"
|
||||
|
||||
// ------------------------- common options --------------------
|
||||
{"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
|
||||
{"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
|
||||
|
@ -17,7 +19,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},
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
#ifdef CONFIG_PRIORITY
|
||||
{"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},
|
||||
|
|
19
cfg-common.h
19
cfg-common.h
|
@ -350,25 +350,6 @@ const m_option_t msgl_config[]={
|
|||
|
||||
};
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
struct {
|
||||
char* name;
|
||||
int prio;
|
||||
} priority_presets_defs[] = {
|
||||
{ "realtime", REALTIME_PRIORITY_CLASS},
|
||||
{ "high", HIGH_PRIORITY_CLASS},
|
||||
#ifdef ABOVE_NORMAL_PRIORITY_CLASS
|
||||
{ "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
|
||||
#endif
|
||||
{ "normal", NORMAL_PRIORITY_CLASS},
|
||||
#ifdef BELOW_NORMAL_PRIORITY_CLASS
|
||||
{ "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
|
||||
#endif
|
||||
{ "idle", IDLE_PRIORITY_CLASS},
|
||||
{ NULL, NORMAL_PRIORITY_CLASS} /* default */
|
||||
};
|
||||
#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
|
||||
|
||||
extern const m_option_t noconfig_opts[];
|
||||
|
||||
extern const m_option_t lavc_decode_opts_conf[];
|
||||
|
|
|
@ -718,8 +718,10 @@ _ass=auto
|
|||
_rpath=no
|
||||
_asmalign_pot=auto
|
||||
_stream_cache=yes
|
||||
_priority=no
|
||||
def_dos_paths="#define HAVE_DOS_PATHS 0"
|
||||
def_stream_cache="#define CONFIG_STREAM_CACHE 1"
|
||||
def_priority="#undef CONFIG_PRIORITY"
|
||||
def_pthread_cache="#undef PTHREAD_CACHE"
|
||||
_need_shmem=yes
|
||||
for ac_option do
|
||||
|
@ -1433,7 +1435,9 @@ if win32 ; then
|
|||
_ld_extra="$_ld_extra -lwinmm"
|
||||
_pe_executable=yes
|
||||
_timer=timer-win2.c
|
||||
_priority=yes
|
||||
def_dos_paths="#define HAVE_DOS_PATHS 1"
|
||||
def_priority="#define CONFIG_PRIORITY 1"
|
||||
fi
|
||||
|
||||
if mingw32 ; then
|
||||
|
@ -1456,7 +1460,9 @@ if os2 ; then
|
|||
_exesuf=".exe"
|
||||
_getch=getch2-os2.c
|
||||
_need_shmem=no
|
||||
_priority=yes
|
||||
def_dos_paths="#define HAVE_DOS_PATHS 1"
|
||||
def_priority="#define CONFIG_PRIORITY 1"
|
||||
fi
|
||||
|
||||
for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
|
||||
|
@ -8090,6 +8096,7 @@ OSS = $_ossaudio
|
|||
PE_EXECUTABLE = $_pe_executable
|
||||
PNG = $_png
|
||||
PNM = $_pnm
|
||||
PRIORITY = $_priority
|
||||
PULSE = $_pulse
|
||||
PVR = $_pvr
|
||||
QTX_CODECS = $_qtx
|
||||
|
@ -8355,6 +8362,7 @@ $def_macosx_bundle
|
|||
$def_macosx_finder
|
||||
$def_maemo
|
||||
$def_named_asm_args
|
||||
$def_priority
|
||||
$def_quicktime
|
||||
$def_restrict_keyword
|
||||
$def_rtc
|
||||
|
|
17
mencoder.c
17
mencoder.c
|
@ -139,9 +139,7 @@ double cur_video_time_usage=0;
|
|||
double cur_vout_time_usage=0;
|
||||
int benchmark=0;
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
char * proc_priority=NULL;
|
||||
#endif
|
||||
#include "osdep/priority.h"
|
||||
|
||||
// A-V sync:
|
||||
int delay_corrected=1;
|
||||
|
@ -479,17 +477,8 @@ if (frameno_filename) {
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
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,MSGTR_SettingProcessPriority,
|
||||
priority_presets_defs[i].name);
|
||||
SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
|
||||
}
|
||||
#ifdef CONFIG_PRIORITY
|
||||
set_priority();
|
||||
#endif
|
||||
|
||||
// check font
|
||||
|
|
19
mplayer.c
19
mplayer.c
|
@ -84,9 +84,7 @@ int quiet=0;
|
|||
int enable_mouse_movements=0;
|
||||
float start_volume = -1;
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
char * proc_priority=NULL;
|
||||
#endif
|
||||
#include "osdep/priority.h"
|
||||
|
||||
char *heartbeat_cmd;
|
||||
|
||||
|
@ -2596,17 +2594,12 @@ int gui_no_filename=0;
|
|||
SetErrorMode(0x8003);
|
||||
// request 1ms timer resolution
|
||||
timeBeginPeriod(1);
|
||||
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,MSGTR_SettingProcessPriority,
|
||||
priority_presets_defs[i].name);
|
||||
SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PRIORITY
|
||||
set_priority();
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_GUI
|
||||
if(use_gui){
|
||||
mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui);
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* implementation of '-priority' for OS/2 and Win32
|
||||
*
|
||||
* Copyright (c) 2009 by KO Myung-Hun (komh@chollian.net)
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MPlayer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifdef __OS2__
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
||||
#define REALTIME_PRIORITY_CLASS MAKESHORT(0, PRTYC_TIMECRITICAL)
|
||||
#define HIGH_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR)
|
||||
#define ABOVE_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR)
|
||||
#define NORMAL_PRIORITY_CLASS MAKESHORT(0, PRTYC_REGULAR)
|
||||
#define BELOW_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_IDLETIME)
|
||||
#define IDLE_PRIORITY_CLASS MAKESHORT(0, PRTYC_IDLETIME)
|
||||
|
||||
#else
|
||||
|
||||
/* Disable non-underscored versions of non-ANSI functions
|
||||
* as otherwise int eof would conflict with eof(). */
|
||||
#define _UWIN 1
|
||||
#include <windows.h>
|
||||
|
||||
#endif /* __OS2__ */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "help_mp.h"
|
||||
|
||||
#include "priority.h"
|
||||
|
||||
char *proc_priority = NULL;
|
||||
|
||||
void set_priority(void)
|
||||
{
|
||||
struct {
|
||||
char* name;
|
||||
int prio;
|
||||
} priority_presets_defs[] = {
|
||||
{ "realtime", REALTIME_PRIORITY_CLASS},
|
||||
{ "high", HIGH_PRIORITY_CLASS},
|
||||
#ifdef ABOVE_NORMAL_PRIORITY_CLASS
|
||||
{ "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
|
||||
#endif
|
||||
{ "normal", NORMAL_PRIORITY_CLASS},
|
||||
#ifdef BELOW_NORMAL_PRIORITY_CLASS
|
||||
{ "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
|
||||
#endif
|
||||
{ "idle", IDLE_PRIORITY_CLASS},
|
||||
{ NULL, NORMAL_PRIORITY_CLASS} /* default */
|
||||
};
|
||||
|
||||
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, 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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* header for implementation of '-priority'
|
||||
*
|
||||
* Copyright (c) 2009 by KO Myung-Hun (komh@chollian.net)
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MPlayer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_PRIORITY_H
|
||||
#define MPLAYER_PRIORITY_H
|
||||
|
||||
extern char *proc_priority;
|
||||
|
||||
void set_priority(void);
|
||||
|
||||
#endif /* MPLAYER_PRIORITY_H */
|
||||
|
Loading…
Reference in New Issue