[MPlayer-cvslog] r30828 - in trunk/osdep: osdep.h priority.c

komh subversion at mplayerhq.hu
Thu Mar 4 13:55:30 CET 2010


Author: komh
Date: Thu Mar  4 13:55:30 2010
New Revision: 30828

Log:
1. Move the macros for priority classes for OS/2 from priority.c to osdep.h
2. Define SetPriorityClass() and GetCurrentProcess() in osdep.h
3. Include osdep.h in priority.c

This removes OS2-platform check in priority.c

Modified:
   trunk/osdep/osdep.h
   trunk/osdep/priority.c

Modified: trunk/osdep/osdep.h
==============================================================================
--- trunk/osdep/osdep.h	Thu Mar  4 02:02:24 2010	(r30827)
+++ trunk/osdep/osdep.h	Thu Mar  4 13:55:30 2010	(r30828)
@@ -27,7 +27,24 @@
 #define INCL_DOS
 #define INCL_DOSDEVIOCTL
 #include <os2.h>
-#endif
+
+#include <process.h>    /* getpid() */
+
+#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)
+
+#define SetPriorityClass(pid, prio) \
+            DosSetPriority(PRTYS_PROCESS, \
+                           HIBYTE(prio), \
+                           LOBYTE(prio), \
+                           pid)
+
+#define GetCurrentProcess() getpid()
+#endif /* __OS2__ */
 
 #endif /* MPLAYER_OSDEP_H */
 

Modified: trunk/osdep/priority.c
==============================================================================
--- trunk/osdep/priority.c	Thu Mar  4 02:02:24 2010	(r30827)
+++ trunk/osdep/priority.c	Thu Mar  4 13:55:30 2010	(r30828)
@@ -20,23 +20,11 @@
  * 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
+#include "osdep.h"
 
+#ifdef _WIN32
 #include <windows.h>
-
-#endif /* __OS2__ */
+#endif
 
 #include <string.h>
 
@@ -76,13 +64,6 @@ void set_priority(void)
         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
     }
 }


More information about the MPlayer-cvslog mailing list