aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-14 20:30:27 +0200
committerClément Bœsch <u@pkh.me>2014-09-30 20:21:14 +0200
commit55180b3299c61e5e3d16f1e9ea58dba8b787cc8e (patch)
tree9984561f4546525c823dfad5051c749533aa46a9 /libavformat
parentd5ddcb5f8e7b14974fabd5e95e6420c6e9b12991 (diff)
downloadffmpeg-55180b3299c61e5e3d16f1e9ea58dba8b787cc8e.tar.gz
Kill timed SRT
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroska.c1
-rw-r--r--libavformat/matroskaenc.c45
-rw-r--r--libavformat/srtenc.c11
-rw-r--r--libavformat/version.h2
4 files changed, 6 insertions, 53 deletions
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 272d235fe6..bc5007a433 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -66,7 +66,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_ASS},
{"S_TEXT/SSA" , AV_CODEC_ID_ASS},
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3fa4babbdb..4af2d6eb97 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1589,47 +1589,6 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
}
}
-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 += ff_subtitles_next_line(*buf);
- }
- 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 int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
{
MatroskaMuxContext *mkv = s->priv_data;
@@ -1757,9 +1716,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
if (ret < 0) return ret;
}
} else {
- if (codec->codec_id == AV_CODEC_ID_SRT) {
- duration = mkv_write_srt_blocks(s, pb, pkt);
- } else if (codec->codec_id == AV_CODEC_ID_WEBVTT) {
+ if (codec->codec_id == AV_CODEC_ID_WEBVTT) {
duration = mkv_write_vtt_blocks(s, pb, pkt);
} else {
ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP,
diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
index b43504bdc4..9bb83d645d 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -45,8 +45,7 @@ static int srt_write_header(AVFormatContext *avf)
return AVERROR(EINVAL);
}
if (avf->streams[0]->codec->codec_id != AV_CODEC_ID_TEXT &&
- avf->streams[0]->codec->codec_id != AV_CODEC_ID_SUBRIP &&
- avf->streams[0]->codec->codec_id != AV_CODEC_ID_SRT) {
+ avf->streams[0]->codec->codec_id != AV_CODEC_ID_SUBRIP) {
av_log(avf, AV_LOG_ERROR,
"Unsupported subtitles codec: %s\n",
avcodec_get_name(avf->streams[0]->codec->codec_id));
@@ -60,9 +59,8 @@ static int srt_write_header(AVFormatContext *avf)
static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
{
SRTContext *srt = avf->priv_data;
- int write_ts = avf->streams[0]->codec->codec_id != AV_CODEC_ID_SRT;
- if (write_ts) {
+ // TODO: reindent
int64_t s = pkt->pts, e, d = pkt->duration;
int size, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
const uint8_t *p;
@@ -94,10 +92,9 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
avio_printf(avf->pb, " X1:%03d X2:%03d Y1:%03d Y2:%03d",
x1, x2, y1, y2);
avio_printf(avf->pb, "\n");
- }
+
avio_write(avf->pb, pkt->data, pkt->size);
- if (write_ts)
- avio_write(avf->pb, "\n\n", 2);
+ avio_write(avf->pb, "\n\n", 2);
srt->index++;
return 0;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 0bf2aac167..2835f05cab 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 7
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \