cleanup: Silence compilation warnings on MinGW-w64
[mplayer.git] / osdep / priority.c
blob0803a3299e457819e6a36c6b739e0e1601a0faf2
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 #include "osdep.h"
25 #if defined(__MINGW32__) || defined(__CYGWIN__)
26 #include <windows.h>
27 #endif
29 #include <string.h>
31 #include "mp_msg.h"
33 #include "priority.h"
35 char *proc_priority = NULL;
37 void set_priority(void)
39 struct {
40 char* name;
41 int prio;
42 } priority_presets_defs[] = {
43 { "realtime", REALTIME_PRIORITY_CLASS},
44 { "high", HIGH_PRIORITY_CLASS},
45 #ifdef ABOVE_NORMAL_PRIORITY_CLASS
46 { "abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
47 #endif
48 { "normal", NORMAL_PRIORITY_CLASS},
49 #ifdef BELOW_NORMAL_PRIORITY_CLASS
50 { "belownormal", BELOW_NORMAL_PRIORITY_CLASS},
51 #endif
52 { "idle", IDLE_PRIORITY_CLASS},
53 { NULL, NORMAL_PRIORITY_CLASS} /* default */
56 if (proc_priority) {
57 int i;
59 for (i = 0; priority_presets_defs[i].name; i++) {
60 if (strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
61 break;
63 mp_tmsg(MSGT_CPLAYER, MSGL_STATUS, "Setting process priority: %s\n",
64 priority_presets_defs[i].name);
66 SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);