[FFmpeg-cvslog] r15206 - in trunk/libavformat: matroskadec.c matroskaenc.c

aurel subversion
Fri Sep 5 01:08:19 CEST 2008


Author: aurel
Date: Fri Sep  5 01:08:19 2008
New Revision: 15206

Log:
matroska: subtitle display duration must be stored in pkt->convergence_duration


Modified:
   trunk/libavformat/matroskadec.c
   trunk/libavformat/matroskaenc.c

Modified: trunk/libavformat/matroskadec.c
==============================================================================
--- trunk/libavformat/matroskadec.c	(original)
+++ trunk/libavformat/matroskadec.c	Fri Sep  5 01:08:19 2008
@@ -1583,7 +1583,10 @@ static int matroska_parse_block(Matroska
 
                 pkt->pts = timecode;
                 pkt->pos = pos;
-                pkt->duration = duration;
+                if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE)
+                    pkt->convergence_duration = duration;
+                else
+                    pkt->duration = duration;
 
                 dynarray_add(&matroska->packets, &matroska->num_packets, pkt);
             }

Modified: trunk/libavformat/matroskaenc.c
==============================================================================
--- trunk/libavformat/matroskaenc.c	(original)
+++ trunk/libavformat/matroskaenc.c	Fri Sep  5 01:08:19 2008
@@ -749,6 +749,7 @@ static int mkv_write_packet(AVFormatCont
     ByteIOContext *pb = s->pb;
     AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
     int keyframe = !!(pkt->flags & PKT_FLAG_KEY);
+    int duration = pkt->duration;
     int ret;
 
     // start a new cluster every 5 MB or 5 sec
@@ -781,8 +782,9 @@ static int mkv_write_packet(AVFormatCont
         mkv_write_block(s, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe << 7);
     } else {
         ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt));
+        duration = pkt->convergence_duration;
         mkv_write_block(s, MATROSKA_ID_BLOCK, pkt, 0);
-        put_ebml_uint(pb, MATROSKA_ID_DURATION, pkt->duration);
+        put_ebml_uint(pb, MATROSKA_ID_DURATION, duration);
         end_ebml_master(pb, blockgroup);
     }
 
@@ -791,7 +793,7 @@ static int mkv_write_packet(AVFormatCont
         if (ret < 0) return ret;
     }
 
-    mkv->duration = FFMAX(mkv->duration, pkt->pts + pkt->duration);
+    mkv->duration = FFMAX(mkv->duration, pkt->pts + duration);
     return 0;
 }
 




More information about the ffmpeg-cvslog mailing list