[MPlayer-cvslog] r31338 - trunk/libmpdemux/demuxer.c

reimar subversion at mplayerhq.hu
Sun Jun 6 15:59:45 CEST 2010


Author: reimar
Date: Sun Jun  6 15:59:44 2010
New Revision: 31338

Log:
Fix ds_get_next_pts to also work for the first packet of a stream.

Modified:
   trunk/libmpdemux/demuxer.c

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sun Jun  6 15:53:18 2010	(r31337)
+++ trunk/libmpdemux/demuxer.c	Sun Jun  6 15:59:44 2010	(r31338)
@@ -812,7 +812,9 @@ int ds_get_packet_sub(demux_stream_t *ds
 double ds_get_next_pts(demux_stream_t *ds)
 {
     demuxer_t *demux = ds->demuxer;
-    while (!ds->first) {
+    // if we have not read from the "current" packet, consider it
+    // as the next, otherwise we never get the pts for the first packet.
+    while (!ds->first && (!ds->current || ds->buffer_pos)) {
         if (demux->audio->packs >= MAX_PACKS
             || demux->audio->bytes >= MAX_PACK_BYTES) {
             mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyAudioInBuffer,
@@ -830,6 +832,9 @@ double ds_get_next_pts(demux_stream_t *d
         if (!demux_fill_buffer(demux, ds))
             return MP_NOPTS_VALUE;
     }
+    // take pts from "current" if we never read from it.
+    if (ds->current && !ds->buffer_pos)
+        return ds->current->pts;
     return ds->first->pts;
 }
 


More information about the MPlayer-cvslog mailing list