[MPlayer-dev-eng] [PATCH] fix ds_get_next_pts to return MP_NOPTS_VALUE on error

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Dec 21 18:49:59 CET 2006


Hello,
do you think attached patch is correct?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/video.c
===================================================================
--- libmpdemux/video.c	(revision 21669)
+++ libmpdemux/video.c	(working copy)
@@ -581,8 +581,8 @@
       case DEMUXER_TYPE_VIVO:
       case DEMUXER_TYPE_OGG:
       case DEMUXER_TYPE_ASF: {
-        float next_pts = ds_get_next_pts(d_video);
-        float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1;
+        double next_pts = ds_get_next_pts(d_video);
+        double d= (next_pts != MP_NOPTS_VALUE) ? next_pts - d_video->pts : d_video->pts-pts1;
         if(d>=0){
           if(d>0){
             if((int)sh_video->fps==1000)
@@ -599,8 +599,8 @@
       break;
       case DEMUXER_TYPE_LAVF:
         if((int)sh_video->fps==1000 || (int)sh_video->fps<=1){
-          float next_pts = ds_get_next_pts(d_video);
-          float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1;
+          double next_pts = ds_get_next_pts(d_video);
+          double d= (next_pts != MP_NOPTS_VALUE) ? next_pts - d_video->pts : d_video->pts-pts1;
           if(d>=0){
             frame_time = d;
           } 
@@ -609,7 +609,7 @@
       case DEMUXER_TYPE_REAL:
         {
           double next_pts = ds_get_next_pts(d_video);
-          float d = next_pts > 0 ? next_pts - d_video->pts : d_video->pts - pts1;
+          double d = (next_pts != MP_NOPTS_VALUE) ? next_pts - d_video->pts : d_video->pts - pts1;
 
           frame_time = (d >= 0 && pts1 > 0) ? d : 0.001;
         }
Index: libmpdemux/demuxer.c
===================================================================
--- libmpdemux/demuxer.c	(revision 21713)
+++ libmpdemux/demuxer.c	(working copy)
@@ -563,15 +563,15 @@
     if(demux->audio->packs>=MAX_PACKS || demux->audio->bytes>=MAX_PACK_BYTES){
       mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyAudioInBuffer,demux->audio->packs,demux->audio->bytes);
       mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
-      return -1;
+      return MP_NOPTS_VALUE;
     }
     if(demux->video->packs>=MAX_PACKS || demux->video->bytes>=MAX_PACK_BYTES){
       mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyVideoInBuffer,demux->video->packs,demux->video->bytes);
       mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
-      return -1;
+      return MP_NOPTS_VALUE;
     }
     if(!demux_fill_buffer(demux,ds))
-      return -1;
+      return MP_NOPTS_VALUE;
   }
   return ds->first->pts;
 }


More information about the MPlayer-dev-eng mailing list