changeset 23993:2107f38b6ca1

Moved dvdtimetomsec to stream_dvd_common.c.
author cehoyos
date Sat, 04 Aug 2007 21:59:26 +0000
parents 46148e1b6cd0
children 8572d2ef5263
files stream/Makefile stream/stream_dvd.c stream/stream_dvd_common.c stream/stream_dvd_common.h
diffstat 4 files changed, 27 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/stream/Makefile	Sat Aug 04 21:26:54 2007 +0000
+++ b/stream/Makefile	Sat Aug 04 21:59:26 2007 +0000
@@ -14,7 +14,7 @@
 SRCS_COMMON-$(CDDB)              += stream_cddb.c
 SRCS_COMMON-$(DVBIN)             += dvb_tune.c stream_dvb.c
 SRCS_COMMON-$(DVDNAV)            += stream_dvdnav.c
-SRCS_COMMON-$(DVDREAD)           += stream_dvd.c
+SRCS_COMMON-$(DVDREAD)           += stream_dvd.c stream_dvd_common.c
 SRCS_COMMON-$(FTP)               += stream_ftp.c
 SRCS_COMMON-$(LIBSMBCLIENT)      += stream_smb.c
 SRCS_COMMON-$(MPLAYER_NETWORK)   += stream_netstream.c     \
--- a/stream/stream_dvd.c	Sat Aug 04 21:26:54 2007 +0000
+++ b/stream/stream_dvd.c	Sat Aug 04 21:59:26 2007 +0000
@@ -34,6 +34,7 @@
 #include "m_struct.h"
 
 #include "stream_dvd.h"
+#include "stream_dvd_common.h"
 #include "libmpdemux/demuxer.h"
 
 extern int stream_cache_size;
@@ -512,23 +513,6 @@
   dvd_close(s->priv);
 }
 
-/** 
-\brief Converts DVD time structure to milliseconds.
-\param *dev the DVD time structure to convert
-\return returns the time in milliseconds
-*/
-static int 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;
-}
-
 static int mp_get_titleset_length(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no)
 {
     int vts_ttn;  ///< title number within video title set
@@ -543,7 +527,7 @@
     {
             vts_ttn = tt_srpt->title[title_no].vts_ttn - 1;
             pgc_no = vts_file->vts_ptt_srpt->title[vts_ttn].ptt[0].pgcn - 1;
-            msec = dvdtimetomsec(&vts_file->vts_pgcit->pgci_srp[pgc_no].pgc->playback_time);
+            msec = mp_dvdtimetomsec(&vts_file->vts_pgcit->pgci_srp[pgc_no].pgc->playback_time);
     }
     return msec;
 }
@@ -618,7 +602,7 @@
             if(!(pgc->cell_playback[cell-1].block_type == BLOCK_TYPE_ANGLE_BLOCK &&
                  pgc->cell_playback[cell-1].block_mode != BLOCK_MODE_FIRST_CELL)
             )
-                t += dvdtimetomsec(&pgc->cell_playback[cell-1].playback_time);
+                t += mp_dvdtimetomsec(&pgc->cell_playback[cell-1].playback_time);
             cell++;
         }
     }
@@ -639,7 +623,7 @@
           continue;
         tm += d->cell_times_table[i];
     }
-    tm += dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm);
+    tm += mp_dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm);
 
     return (double)tm/1000.0;
 }
@@ -680,7 +664,7 @@
     stream_seek(stream, pos);
     do {
       stream_skip(stream, 2048);
-      t = dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm);
+      t = mp_dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm);
     } while(!t);
     tm = dvd_get_current_time(stream, 0);
 
@@ -1099,7 +1083,7 @@
     if(d->cell_times_table == NULL)
       return STREAM_UNSUPORTED;
     for(k=0; k<d->cur_pgc->nr_of_cells; k++)
-      d->cell_times_table[k] = dvdtimetomsec(&d->cur_pgc->cell_playback[k].playback_time);
+      d->cell_times_table[k] = mp_dvdtimetomsec(&d->cur_pgc->cell_playback[k].playback_time);
     list_chapters(d->cur_pgc);
 
     // ... (unimplemented)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stream/stream_dvd_common.c	Sat Aug 04 21:59:26 2007 +0000
@@ -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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stream/stream_dvd_common.h	Sat Aug 04 21:59:26 2007 +0000
@@ -0,0 +1,1 @@
+int mp_dvdtimetomsec(dvd_time_t *dt);