subreader: fix some of ASS parser issues
[mplayer.git] / osdep / priority.c
blobdfa2c54ff5c5a72c7dbc5e79cfe481ace646b9ba
1 /*
2 * implementation of '-priority' for OS/2 and Win32
4 * Copyright (c) 2009 by KO Myung-Hun (komh@chollian.net)
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #if defined(__MINGW32__) || defined(__CYGWIN__)
24 #include <windows.h>
25 #endif
27 #include <string.h>
29 #include "mp_msg.h"
31 #include "priority.h"
33 char *proc_priority = NULL;
35 void set_priority(void)
37 struct {
38 char* name;
39 int prio;
40 } priority_presets_defs[] = {
41 { "realtime", REALTIME_PRIORITY_CLASS},
42 { "high", HIGH_PRIORITY_CLASS},
43 #ifdef ABOVE_NORMAL_PRIORITY_CLASS
44 { "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
45 #endif
46 { "normal", NORMAL_PRIORITY_CLASS},
47 #ifdef BELOW_NORMAL_PRIORITY_CLASS
48 { "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
49 #endif
50 { "idle", IDLE_PRIORITY_CLASS},
51 { NULL, NORMAL_PRIORITY_CLASS} /* default */
54 if (proc_priority) {
55 int i;
57 for (i = 0; priority_presets_defs[i].name; i++) {
58 if (strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
59 break;
61 mp_tmsg(MSGT_CPLAYER, MSGL_STATUS, "Setting process priority: %s\n",
62 priority_presets_defs[i].name);
64 SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);