[FFmpeg-cvslog] r22372 - trunk/libavformat/matroskaenc.c

conrad subversion
Tue Mar 9 05:23:36 CET 2010


Author: conrad
Date: Tue Mar  9 05:23:36 2010
New Revision: 22372

Log:
mkvenc: Handle negative timestamps correctly

Modified:
   trunk/libavformat/matroskaenc.c

Modified: trunk/libavformat/matroskaenc.c
==============================================================================
--- trunk/libavformat/matroskaenc.c	Tue Mar  9 05:23:33 2010	(r22371)
+++ trunk/libavformat/matroskaenc.c	Tue Mar  9 05:23:36 2010	(r22372)
@@ -72,9 +72,9 @@ typedef struct MatroskaMuxContext {
     int64_t         segment_uid;
     ebml_master     cluster;
     int64_t         cluster_pos;        ///< file offset of the current cluster
-    uint64_t        cluster_pts;
+    int64_t         cluster_pts;
     int64_t         duration_offset;
-    uint64_t        duration;
+    int64_t         duration;
     mkv_seekhead    *main_seekhead;
     mkv_seekhead    *cluster_seekhead;
     mkv_cues        *cues;
@@ -355,6 +355,9 @@ static int mkv_add_cuepoint(mkv_cues *cu
     if (entries == NULL)
         return AVERROR(ENOMEM);
 
+    if (ts < 0)
+        return 0;
+
     entries[cues->num_entries  ].pts = ts;
     entries[cues->num_entries  ].tracknum = stream + 1;
     entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
@@ -883,8 +886,8 @@ static int mkv_write_packet(AVFormatCont
 
         mkv->cluster_pos = url_ftell(s->pb);
         mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
-        put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, ts);
-        mkv->cluster_pts = ts;
+        put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
+        mkv->cluster_pts = FFMAX(0, ts);
         av_md5_update(mkv->md5_ctx, pkt->data, FFMIN(200, pkt->size));
     }
 



More information about the ffmpeg-cvslog mailing list