summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvd_common.c
diff options
context:
space:
mode:
authorcehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-08-04 21:59:26 +0000
committercehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-08-04 21:59:26 +0000
commite5a6eae2cf10658e64c8ba0ba49a6d60f5d3a5f0 (patch)
tree2ed1bb8627bdfb89c95613050f2618f6f299025d /stream/stream_dvd_common.c
parent5acbb3c611036c5fb7f786c63460b69ab021b383 (diff)
downloadmpv-e5a6eae2cf10658e64c8ba0ba49a6d60f5d3a5f0.tar.bz2
mpv-e5a6eae2cf10658e64c8ba0ba49a6d60f5d3a5f0.tar.xz
Moved dvdtimetomsec to stream_dvd_common.c.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24013 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/stream_dvd_common.c')
-rw-r--r--stream/stream_dvd_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/stream/stream_dvd_common.c b/stream/stream_dvd_common.c
new file mode 100644
index 0000000000..63a00c1cff
--- /dev/null
+++ b/stream/stream_dvd_common.c
@@ -0,0 +1,19 @@
+#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;
+}