[SCM] libav/experimental: matroska: subtitle display duration must be stored in pkt->convergence_duration

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:29:30 UTC 2013


The following commit has been merged in the experimental branch:
commit 62c24705c84204fdcd44318d20caace076636eb1
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Thu Sep 4 23:08:19 2008 +0000

    matroska: subtitle display duration must be stored in pkt->convergence_duration
    
    Originally committed as revision 15206 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index b947a50..437ac37 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1583,7 +1583,10 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
 
                 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);
             }
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index db090be..ef3140e 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -749,6 +749,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
     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(AVFormatContext *s, AVPacket *pkt)
         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(AVFormatContext *s, AVPacket *pkt)
         if (ret < 0) return ret;
     }
 
-    mkv->duration = FFMAX(mkv->duration, pkt->pts + pkt->duration);
+    mkv->duration = FFMAX(mkv->duration, pkt->pts + duration);
     return 0;
 }
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list