summaryrefslogtreecommitdiff
path: root/libavformat/sccdec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-12-23 22:39:46 +0100
committerPaul B Mahol <onemda@gmail.com>2019-12-23 22:39:46 +0100
commit13bffa79698e8bfe08634a1aefa9650dc74a58a2 (patch)
tree20a56ad3473644c68d34af9c24ed96cb7e635ca1 /libavformat/sccdec.c
parent9da7536ce25e0f8e1d882d1ff83d7dbf66187b9a (diff)
downloadffmpeg-13bffa79698e8bfe08634a1aefa9650dc74a58a2.tar.gz
avformat/sccdec: fix sub->pos values
Diffstat (limited to 'libavformat/sccdec.c')
-rw-r--r--libavformat/sccdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c
index 37570e0fb0..0cf09c458a 100644
--- a/libavformat/sccdec.c
+++ b/libavformat/sccdec.c
@@ -78,13 +78,14 @@ static int scc_read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_EIA_608;
while (!ff_text_eof(&tr)) {
- const int64_t pos = ff_text_pos(&tr);
+ int64_t current_pos, next_pos;
char *saveptr = NULL, *lline;
int hh1, mm1, ss1, fs1, i;
int hh2, mm2, ss2, fs2;
AVPacket *sub;
if (count == 0) {
+ current_pos = ff_text_pos(&tr);
while (!ff_text_eof(&tr)) {
len = ff_subtitles_read_line(&tr, line, sizeof(line));
if (len > 13)
@@ -99,6 +100,7 @@ static int scc_read_header(AVFormatContext *s)
ts_start = (hh1 * 3600LL + mm1 * 60LL + ss1) * 1000LL + fs1 * 33;
+ next_pos = ff_text_pos(&tr);
while (!ff_text_eof(&tr)) {
len2 = ff_subtitles_read_line(&tr, line2, sizeof(line2));
if (len2 > 13)
@@ -135,10 +137,11 @@ try_again:
if (!sub)
return AVERROR(ENOMEM);
- sub->pos = pos;
+ sub->pos = current_pos;
sub->pts = ts_start;
sub->duration = FFMAX(1200, ts_end - ts_start);
memmove(line, line2, sizeof(line));
+ current_pos = next_pos;
line2[0] = 0;
}