changeset 21809:2c473e083c70

Make ds_get_next_pts return MP_NOPTS_VALUE instead of -1 on error, -1 could be a perfectly valid pts.
author reimar
date Fri, 05 Jan 2007 15:24:38 +0000
parents eaf6ed9cb5ab
children 7a36d3332133
files libmpdemux/demuxer.c libmpdemux/video.c
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Fri Jan 05 11:57:06 2007 +0000
+++ b/libmpdemux/demuxer.c	Fri Jan 05 15:24:38 2007 +0000
@@ -567,15 +567,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;
 }
--- a/libmpdemux/video.c	Fri Jan 05 11:57:06 2007 +0000
+++ b/libmpdemux/video.c	Fri Jan 05 15:24:38 2007 +0000
@@ -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;
         }