view stream/stream_dvd_common.c @ 24213:29fe677d8a19

warning fixes: realcodecs/14_4.c: In function 'RAInitDecoder': realcodecs/14_4.c:238: warning: unused variable 'temp2' realcodecs/14_4.c:237: warning: unused variable 'temp' realcodecs/14_4.c: In function 'RASetFlavor': realcodecs/14_4.c:273: warning: unused variable 'property' realcodecs/14_4.c:272: warning: unused variable 'flavor' realcodecs/14_4.c:272: warning: unused variable 'numflavors' realcodecs/14_4.c:271: warning: unused variable 'result1' realcodecs/14_4.c:271: warning: unused variable 'numprop'
author diego
date Mon, 27 Aug 2007 10:55:27 +0000
parents de28f9e8cb00
children bae68d1afda2
line wrap: on
line source

#include <inttypes.h>
#include <dvdread/ifo_types.h>
#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;
}