Mercurial > mplayer.hg
annotate osdep/timer-win2.c @ 28992:947ef23ba798
Test if create_vdp_decoder() might succeed by calling it from config()
with a small value for max_reference_frames.
This does not make automatic recovery by using software decoder possible,
but lets MPlayer fail more graciously on - actually existing - buggy
hardware that does not support certain H264 widths when using
hardware accelerated decoding (784, 864, 944, 1024, 1808, 1888 pixels on
NVIDIA G98) and if the user tries to hardware-decode more samples at
the same time than supported.
Might break playback of H264 Intra-Only samples on hardware with very
little video memory.
author | cehoyos |
---|---|
date | Sat, 21 Mar 2009 20:11:05 +0000 |
parents | 5cfef41a1771 |
children | 0f1b5b68af32 |
rev | line source |
---|---|
28744 | 1 /* |
2 * precise timer routines for Windows | |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
20 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
21 #include <windows.h> |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
22 #include <mmsystem.h> |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
23 #include "timer.h" |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
24 |
12954 | 25 const char *timer_name = "Windows native"; |
26 | |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
27 // Returns current time in microseconds |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
28 unsigned int GetTimer(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
29 { |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
30 return timeGetTime() * 1000; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
31 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
32 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
33 // Returns current time in milliseconds |
28234
8d6c3abed492
timer-win2.c: Fix "voi" (void) typo breaking Windows compilation
uau
parents:
28232
diff
changeset
|
34 unsigned int GetTimerMS(void) |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
35 { |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
36 return timeGetTime() ; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
37 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
38 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
39 int usec_sleep(int usec_delay){ |
11480
1d5205bab61a
Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents:
9983
diff
changeset
|
40 // Sleep(0) won't sleep for one clocktick as the unix usleep |
1d5205bab61a
Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents:
9983
diff
changeset
|
41 // instead it will only make the thread ready |
1d5205bab61a
Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents:
9983
diff
changeset
|
42 // it may take some time until it actually starts to run again |
1d5205bab61a
Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents:
9983
diff
changeset
|
43 if(usec_delay<1000)usec_delay=1000; |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
44 Sleep( usec_delay/1000); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
45 return 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
46 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
47 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
48 static DWORD RelativeTime = 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
49 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
50 float GetRelativeTime(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
51 { |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
52 DWORD t, r; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
53 t = GetTimer(); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
54 r = t - RelativeTime; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
55 RelativeTime = t; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
56 return (float) r *0.000001F; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
57 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
58 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
59 void InitTimer(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
12954
diff
changeset
|
60 { |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
61 GetRelativeTime(); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
62 } |