changeset 37194:d773c8901dd8

demux_lavf: set stream_pts if possible.
author reimar
date Sun, 28 Sep 2014 12:21:42 +0000
parents 82a15e343f94
children ac6c37d85d65
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Sat Sep 27 18:44:47 2014 +0000
+++ b/libmpdemux/demux_lavf.c	Sun Sep 28 12:21:42 2014 +0000
@@ -640,6 +640,7 @@
     demux_packet_t *dp;
     demux_stream_t *ds;
     int id;
+    double stream_pts = MP_NOPTS_VALUE;
     mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_lavf_fill_buffer()\n");
 
     demux->filepos=stream_tell(demux->stream);
@@ -699,6 +700,9 @@
     }
     dp->pos=demux->filepos;
     dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY);
+    if (ds == demux->video &&
+        stream_control(demux->stream, STREAM_CTRL_GET_CURRENT_TIME, (void *)&stream_pts) != STREAM_UNSUPPORTED)
+        dp->stream_pts = stream_pts;
     // append packet to DS stream:
     ds_add_packet(ds,dp);
     return 1;