Rename exit_player() use outside core to exit_player_bad()
[mplayer.git] / stream / stream_dvd_common.c
blobffaf1d490c745982eabb9c62483d4ffaed7fd9f0
1 #include "config.h"
2 #include <inttypes.h>
3 #ifdef CONFIG_DVDREAD_INTERNAL
4 #include <dvdread/ifo_types.h>
5 #else
6 #include <libdvdread/ifo_types.h>
7 #endif
8 #include "stream_dvd_common.h"
10 /**
11 \brief Converts DVD time structure to milliseconds.
12 \param *dev the DVD time structure to convert
13 \return returns the time in milliseconds
15 int mp_dvdtimetomsec(dvd_time_t *dt)
17 static int framerates[4] = {0, 2500, 0, 2997};
18 int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
19 int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;
20 msec += (((dt->minute & 0xf0) >> 3) * 5 + (dt->minute & 0x0f)) * 60000;
21 msec += (((dt->second & 0xf0) >> 3) * 5 + (dt->second & 0x0f)) * 1000;
22 if(framerate > 0)
23 msec += (((dt->frame_u & 0x30) >> 3) * 5 + (dt->frame_u & 0x0f)) * 100000 / framerate;
24 return msec;