2008-05-31 13:42:09 +00:00
|
|
|
#include "config.h"
|
2007-08-15 11:47:22 +00:00
|
|
|
#include <inttypes.h>
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_DVDREAD_INTERNAL
|
2008-08-30 12:22:21 +00:00
|
|
|
#include "libdvdread/ifo_types.h"
|
2008-05-31 12:52:55 +00:00
|
|
|
#else
|
2008-08-30 12:22:21 +00:00
|
|
|
#include <dvdread/ifo_types.h>
|
2008-05-31 12:52:55 +00:00
|
|
|
#endif
|
2007-08-04 21:59:26 +00:00
|
|
|
#include "stream_dvd_common.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
\brief Converts DVD time structure to milliseconds.
|
|
|
|
\param *dev the DVD time structure to convert
|
|
|
|
\return returns the time in milliseconds
|
|
|
|
*/
|
|
|
|
int mp_dvdtimetomsec(dvd_time_t *dt)
|
|
|
|
{
|
|
|
|
static int framerates[4] = {0, 2500, 0, 2997};
|
|
|
|
int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
|
|
|
|
int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;
|
|
|
|
msec += (((dt->minute & 0xf0) >> 3) * 5 + (dt->minute & 0x0f)) * 60000;
|
|
|
|
msec += (((dt->second & 0xf0) >> 3) * 5 + (dt->second & 0x0f)) * 1000;
|
|
|
|
if(framerate > 0)
|
|
|
|
msec += (((dt->frame_u & 0x30) >> 3) * 5 + (dt->frame_u & 0x0f)) * 100000 / framerate;
|
|
|
|
return msec;
|
|
|
|
}
|