changeset 901:c1a07d63a66d libavformat

pts fix by (Bryan Mayland / bmayland O leoninedev o com)
author michael
date Thu, 19 Jan 2006 00:54:10 +0000
parents 04509c9a1b7a
children 5d1bcf01ce28
files ffm.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ffm.c	Mon Jan 16 14:59:54 2006 +0000
+++ b/ffm.c	Thu Jan 19 00:54:10 2006 +0000
@@ -44,6 +44,7 @@
 
     /* read and write */
     int first_packet; /* true if first packet, needed to set the discontinuity tag */
+    int first_frame_in_packet; /* true if first frame in packet, needed to know if PTS information is valid */
     int packet_size;
     int frame_offset;
     int64_t pts;
@@ -347,6 +348,7 @@
             get_be16(pb); /* PACKET_ID */
             fill_size = get_be16(pb);
             ffm->pts = get_be64(pb);
+            ffm->first_frame_in_packet = 1;
             frame_offset = get_be16(pb);
             get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
             ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
@@ -614,7 +616,11 @@
             av_free_packet(pkt);
             return -EAGAIN;
         }
-        pkt->pts = ffm->pts;
+        if (ffm->first_frame_in_packet)
+        {
+            pkt->pts = ffm->pts;
+            ffm->first_frame_in_packet = 0;
+        }
         pkt->duration = duration;
         break;
     }