[MPlayer-cvslog] r20867 - in trunk: libmpdemux/demux_mpg.c libmpdemux/demuxer.c stream/stream_dvd.c stream/stream_dvdnav.c

nicodvb subversion at mplayerhq.hu
Sun Nov 12 18:19:57 CET 2006


Author: nicodvb
Date: Sun Nov 12 18:19:56 2006
New Revision: 20867

Modified:
   trunk/libmpdemux/demux_mpg.c
   trunk/libmpdemux/demuxer.c
   trunk/stream/stream_dvd.c
   trunk/stream/stream_dvdnav.c

Log:
consistency fix: STREAM_CTRL_GET_TIME_LENGTH and STREAM_CTRL_GET_CURRENT_TIME now return time in (double) seconds

Modified: trunk/libmpdemux/demux_mpg.c
==============================================================================
--- trunk/libmpdemux/demux_mpg.c	(original)
+++ trunk/libmpdemux/demux_mpg.c	Sun Nov 12 18:19:56 2006
@@ -802,15 +802,11 @@
 
 int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
     mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv;
-    int msec = 0;
 
     switch(cmd) {
 	case DEMUXER_CTRL_GET_TIME_LENGTH:
-            msec = stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, arg);
-            if(msec != STREAM_UNSUPORTED) {
-              msec = *((unsigned int*)arg);
-              *((double *)arg)=(double)msec/1000.0f;
-              mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, stream len: %d (%.3lf)\r\n", msec, *((double*)arg));
+            if(stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, arg) != STREAM_UNSUPORTED) {
+              mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, (%.3lf)\r\n", *((double*)arg));
               return DEMUXER_CTRL_GUESS;
             }
             if (mpg_d && mpg_d->has_valid_timestamps) {

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	(original)
+++ trunk/libmpdemux/demuxer.c	Sun Nov 12 18:19:56 2006
@@ -881,7 +881,7 @@
     demux_stream_t *d_video=demuxer->video;
     sh_audio_t *sh_audio=d_audio->sh;
     sh_video_t *sh_video=d_video->sh;
-    unsigned int tmp = 0;
+    double tmp = 0;
     double pts;
 
 if(!demuxer->seekable){
@@ -916,13 +916,13 @@
     else {
       if(stream_control(demuxer->stream, STREAM_CTRL_GET_CURRENT_TIME, &tmp) == STREAM_UNSUPORTED)
         goto dmx_seek;
-      pts = (double)tmp / 1000.0f;
+      pts = tmp;
     }
 
     if(flags & 2) {  // percent seek
       if(stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, &tmp) == STREAM_UNSUPORTED)
         goto dmx_seek;
-      pts += (double)tmp / 1000.0f * rel_seek_secs;
+      pts += tmp * rel_seek_secs;
     } else
       pts += rel_seek_secs;
 
@@ -1032,10 +1032,10 @@
  */
 int demuxer_get_current_time(demuxer_t *demuxer){
     double get_time_ans = 0;
-    unsigned tm;
+    double tm;
     sh_video_t *sh_video = demuxer->video->sh;
     if(stream_control(demuxer->stream, STREAM_CTRL_GET_CURRENT_TIME,(void *)&tm)!=STREAM_UNSUPORTED) {
-        get_time_ans = (double) tm / 1000.0f;
+        get_time_ans = tm;
     } else if(sh_video) get_time_ans = sh_video->pts;
     return (int) get_time_ans;
 }

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	(original)
+++ trunk/stream/stream_dvd.c	Sun Nov 12 18:19:56 2006
@@ -633,7 +633,7 @@
     {
         case STREAM_CTRL_GET_TIME_LENGTH:
         {
-            *((unsigned int *)arg) = mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title-1);
+            *((double *)arg) = (double) mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title-1)/1000.0;
             return 1;
         }
         case STREAM_CTRL_GET_NUM_CHAPTERS:
@@ -663,8 +663,7 @@
             if(stream_cache_size > 0) return STREAM_UNSUPORTED;
             tm = dvd_get_current_time(stream, 0);
             if(tm != -1) {
-              tm *= 1000.0f;
-              *((unsigned int *)arg) = (unsigned int) tm;
+              *((double *)arg) = tm;
               return 1;
             }
             break;

Modified: trunk/stream/stream_dvdnav.c
==============================================================================
--- trunk/stream/stream_dvdnav.c	(original)
+++ trunk/stream/stream_dvdnav.c	Sun Nov 12 18:19:56 2006
@@ -279,7 +279,7 @@
     {
       if(priv->duration)
       {
-        *((unsigned int *)arg) = priv->duration;
+        *((double *)arg) = (double)priv->duration / 1000.0;
         return 1;
       }
       break;



More information about the MPlayer-cvslog mailing list