[MPlayer-cvslog] r25951 - in trunk: cfg-mplayer.h libmpdemux/demux_lavf.c libmpdemux/demux_mkv.c libmpdemux/demux_real.c libmpdemux/demuxer.c libmpdemux/demuxer.h

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Feb 7 22:40:36 CET 2008


Hello,
On Thu, Feb 07, 2008 at 11:16:05PM +0200, Uoti Urpala wrote:
> On Mon, 2008-02-04 at 19:13 +0200, Uoti Urpala wrote:
> > On Mon, 2008-02-04 at 09:45 +0100, Reimar Döffinger wrote:
> > > On Sun, Feb 03, 2008 at 10:45:56PM +0200, Uoti Urpala wrote:
> > > > Was there any need for this particular change? Can this code somehow be
> > > > executed before correct_pts has its final value?
> > > 
> > > Yes, demux_open calls ds_fill_buffer.
> > 
> > Then you broke the other places which can return "pts=unknown". They do
> > that by leaving the default value set by new_demux_packet in the field,
> > and new_demux_packet sets that depending on correct_pts.
> 
> Reimar, are you going to fix that yourself? Or think it doesn't require
> changes for some reason? I would have expected at least some response.

I intended to think of something better, but I just had no time to sit
down and think about it.
I did not think it is critical, both -correct-pts and -no-correct-pts are
still available but I noticed I actually did not do this right...
Currently attached patch is the least ugly, generally working approach I
could come up with.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: demuxer.c
===================================================================
--- demuxer.c	(revision 25957)
+++ demuxer.c	(working copy)
@@ -876,6 +876,7 @@
   int demuxer_force = 0, audio_demuxer_force = 0,
       sub_demuxer_force = 0;
 
+  correct_pts = user_correct_pts >= 0 ? user_correct_pts : 0;
   if ((demuxer_type = get_demuxer_type_from_name(demuxer_name, &demuxer_force)) < 0) {
     mp_msg(MSGT_DEMUXER,MSGL_ERR,"-demuxer %s does not exist.\n",demuxer_name);
   }
@@ -945,9 +946,6 @@
   else
     res = vd;
 
-  correct_pts = user_correct_pts;
-  if (correct_pts < 0)
-    correct_pts = demux_control(res, DEMUXER_CTRL_CORRECT_PTS, NULL) == DEMUXER_CTRL_OK;
   return res;
 }
 
Index: demuxer.h
===================================================================
--- demuxer.h	(revision 25957)
+++ demuxer.h	(working copy)
@@ -82,7 +82,6 @@
 #define DEMUXER_CTRL_RESYNC 13
 #define DEMUXER_CTRL_SWITCH_VIDEO 14
 #define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
-#define DEMUXER_CTRL_CORRECT_PTS 16
 
 #define SEEK_ABSOLUTE (1 << 0)
 #define SEEK_FACTOR   (1 << 1)
Index: demux_real.c
===================================================================
--- demux_real.c	(revision 25957)
+++ demux_real.c	(working copy)
@@ -743,7 +743,7 @@
                     break;
             }
             priv->audio_need_keyframe = 0;
-            priv->audio_timestamp[priv->sub_packet_cnt] = (priv->a_pts==timestamp) ? (user_correct_pts > 0 ? MP_NOPTS_VALUE : 0) : (timestamp/1000.0);
+            priv->audio_timestamp[priv->sub_packet_cnt] = (priv->a_pts==timestamp) ? (correct_pts > 0 ? MP_NOPTS_VALUE : 0) : (timestamp/1000.0);
             priv->a_pts = timestamp;
             if (priv->sub_packet_cnt == 0)
                 priv->audio_filepos = demuxer->filepos;
Index: demux_lavf.c
===================================================================
--- demux_lavf.c	(revision 25958)
+++ demux_lavf.c	(working copy)
@@ -456,6 +456,9 @@
     int i;
     char mp_filename[256]="mp:";
 
+    if (user_correct_pts < 0)
+        correct_pts = 1;
+
     memset(&ap, 0, sizeof(AVFormatParameters));
 
     stream_seek(demuxer->stream, 0);
@@ -464,7 +467,7 @@
 
     if (opt_cryptokey)
         parse_cryptokey(avfc, opt_cryptokey);
-    if (user_correct_pts != 0)
+    if (correct_pts != 0)
         avfc->flags |= AVFMT_FLAG_GENPTS;
     if (index_mode == 0)
         avfc->flags |= AVFMT_FLAG_IGNIDX;
@@ -645,8 +648,6 @@
     lavf_priv_t *priv = demuxer->priv;
 
     switch (cmd) {
-        case DEMUXER_CTRL_CORRECT_PTS:
-	    return DEMUXER_CTRL_OK;
         case DEMUXER_CTRL_GET_TIME_LENGTH:
 	    if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
 	        return DEMUXER_CTRL_DONTKNOW;
Index: demux_mkv.c
===================================================================
--- demux_mkv.c	(revision 25957)
+++ demux_mkv.c	(working copy)
@@ -1827,7 +1827,7 @@
               bih = realloc (bih, bih->biSize);
               memcpy (bih + 1, track->private_data, track->private_size);
             }
-          track->reorder_timecodes = user_correct_pts == 0;
+          track->reorder_timecodes = !correct_pts;
           if (!vi->id) {
               mp_msg (MSGT_DEMUX,MSGL_WARN, MSGTR_MPDEMUX_MKV_UnknownCodecID,
                       track->codec_id, track->tnum);
@@ -2285,6 +2285,8 @@
   int i, version, cont = 0;
   char *str;
 
+  if (user_correct_pts < 0)
+      correct_pts = 1;
   stream_seek(s, s->start_pos);
   str = ebml_read_header (s, &version);
   if (str == NULL || strcmp (str, "matroska") || version > 2)
@@ -3456,8 +3458,6 @@
   
   switch (cmd)
     {
-    case DEMUXER_CTRL_CORRECT_PTS:
-      return DEMUXER_CTRL_OK;
     case DEMUXER_CTRL_GET_TIME_LENGTH:
       if (mkv_d->duration == 0)
         return DEMUXER_CTRL_DONTKNOW;


More information about the MPlayer-cvslog mailing list