[MPlayer-dev-eng] pts and mencoder

Michael Niedermayer michaelni at gmx.at
Wed Jan 25 02:42:45 CET 2006


Hi

passing correct timestamps from encoder to muxer, is that really so hard?
no, iam not interrested in any unrelated philosophical issues that it must
be with "correct" timebases or how to pass them through the filter chain
iam just talking about encoder->muxer ...

what about the attached patch (yeah its just outlining the idea it wont
compile)

-- 
Michael
-------------- next part --------------
Index: muxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.c,v
retrieving revision 1.13
diff -u -r1.13 muxer.c
--- muxer.c	9 Jan 2006 19:35:44 -0000	1.13
+++ muxer.c	25 Jan 2006 01:34:01 -0000
@@ -52,9 +52,12 @@
 /* buffer frames until we either:
  * (a) have at least one frame from each stream
  * (b) run out of memory */
-void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags) {
+void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double dts, double pts) {
+    if(isnan(dts)) dts= s->timer;
+    if(isnan(pts)) pts= s->timer;
+
     if (s->muxer->muxbuf_skip_buffer) {
-      s->muxer->cont_write_chunk(s, len, flags);
+      s->muxer->cont_write_chunk(s, len, flags, dts, pts);
     }
     else {
       int num = s->muxer->muxbuf_num++;
@@ -70,7 +73,8 @@
       
       /* buffer this frame */
       buf->stream = s;
-      buf->timer = s->timer;
+      buf->dts= dts;
+      buf->pts= pts;
       buf->len = len;
       buf->flags = flags;
       buf->buffer = malloc(len * sizeof (unsigned char));
@@ -119,7 +123,7 @@
           /* 2. move stored timer and buffer into stream and mux it */
           s->timer = buf->timer;
           s->buffer = buf->buffer;
-          s->muxer->cont_write_chunk(s, buf->len, buf->flags);
+          s->muxer->cont_write_chunk(s, buf->len, buf->flags, buf->dts, buf->pts);
           
           /* 3. restore saved timer and buffer */
           s->timer = tmp_buf->timer;



More information about the MPlayer-dev-eng mailing list