avformat/sccdec: fix sub->pos values

This commit is contained in:
Paul B Mahol 2019-12-23 22:39:46 +01:00
parent 9da7536ce2
commit 13bffa7969
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}