annotate stream/stream_dvd_common.c @ 23993:2107f38b6ca1

Moved dvdtimetomsec to stream_dvd_common.c.
author cehoyos
date Sat, 04 Aug 2007 21:59:26 +0000
parents stream/stream_dvd.c@cfdea6a164da
children de28f9e8cb00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23993
2107f38b6ca1 Moved dvdtimetomsec to stream_dvd_common.c.
cehoyos
parents: 23691
diff changeset
1 #include <dvdread/ifo_types.h>
2107f38b6ca1 Moved dvdtimetomsec to stream_dvd_common.c.
cehoyos
parents: 23691
diff changeset
2 #include "stream_dvd_common.h"
15518
9391bf60ccdf ported dvd:// to the new stream api
nicodvb
parents:
diff changeset
3
16544
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
4 /**
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
5 \brief Converts DVD time structure to milliseconds.
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
6 \param *dev the DVD time structure to convert
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
7 \return returns the time in milliseconds
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
8 */
23993
2107f38b6ca1 Moved dvdtimetomsec to stream_dvd_common.c.
cehoyos
parents: 23691
diff changeset
9 int mp_dvdtimetomsec(dvd_time_t *dt)
16544
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
10 {
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
11 static int framerates[4] = {0, 2500, 0, 2997};
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
12 int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
13 int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
14 msec += (((dt->minute & 0xf0) >> 3) * 5 + (dt->minute & 0x0f)) * 60000;
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
15 msec += (((dt->second & 0xf0) >> 3) * 5 + (dt->second & 0x0f)) * 1000;
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
16 if(framerate > 0)
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
17 msec += (((dt->frame_u & 0x30) >> 3) * 5 + (dt->frame_u & 0x0f)) * 100000 / framerate;
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
18 return msec;
a10adcba312f Prints the number of titles, DVD disk ID, the numbers of chapters and
gpoirier
parents: 15551
diff changeset
19 }