[FFmpeg-devel] [PATCH] lavf/mkv: remove support for SRT.

Clément Bœsch ubitux at gmail.com
Wed Jan 2 13:01:03 CET 2013


SRT is deprecated since a while now, and SubRip markup can be muxed
properly without any hack since packets are clean.
---
 libavformat/matroska.c    |  1 -
 libavformat/matroskaenc.c | 37 -------------------------------------
 2 files changed, 38 deletions(-)

diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 64d0a45..ce6a82c 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -55,7 +55,6 @@ const CodecTags ff_mkv_codec_tags[]={
 
     {"S_TEXT/UTF8"      , AV_CODEC_ID_SUBRIP},
     {"S_TEXT/UTF8"      , AV_CODEC_ID_TEXT},
-    {"S_TEXT/UTF8"      , AV_CODEC_ID_SRT},
     {"S_TEXT/ASCII"     , AV_CODEC_ID_TEXT},
     {"S_TEXT/ASS"       , AV_CODEC_ID_SSA},
     {"S_TEXT/SSA"       , AV_CODEC_ID_SSA},
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1840f90..9669b73 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1122,41 +1122,6 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
         av_free(data);
 }
 
-static int srt_get_duration(uint8_t **buf)
-{
-    int i, duration = 0;
-
-    for (i=0; i<2 && !duration; i++) {
-        int s_hour, s_min, s_sec, s_hsec, e_hour, e_min, e_sec, e_hsec;
-        if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d",
-                   &s_hour, &s_min, &s_sec, &s_hsec,
-                   &e_hour, &e_min, &e_sec, &e_hsec) == 8) {
-            s_min  +=   60*s_hour;      e_min  +=   60*e_hour;
-            s_sec  +=   60*s_min;       e_sec  +=   60*e_min;
-            s_hsec += 1000*s_sec;       e_hsec += 1000*e_sec;
-            duration = e_hsec - s_hsec;
-        }
-        *buf += strcspn(*buf, "\n") + 1;
-    }
-    return duration;
-}
-
-static int mkv_write_srt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
-{
-    ebml_master blockgroup;
-    AVPacket pkt2 = *pkt;
-    int64_t duration = srt_get_duration(&pkt2.data);
-    pkt2.size -= pkt2.data - pkt->data;
-
-    blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP,
-                                   mkv_blockgroup_size(pkt2.size));
-    mkv_write_block(s, pb, MATROSKA_ID_BLOCK, &pkt2, 0);
-    put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
-    end_ebml_master(pb, blockgroup);
-
-    return duration;
-}
-
 static void mkv_flush_dynbuf(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
@@ -1208,8 +1173,6 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
         mkv_write_block(s, pb, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe << 7);
     } else if (codec->codec_id == AV_CODEC_ID_SSA) {
         duration = mkv_write_ass_blocks(s, pb, pkt);
-    } else if (codec->codec_id == AV_CODEC_ID_SRT) {
-        duration = mkv_write_srt_blocks(s, pb, pkt);
     } else {
         ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size));
         /* For backward compatibility, prefer convergence_duration. */
-- 
1.8.0.3



More information about the ffmpeg-devel mailing list