[FFmpeg-cvslog] avformat/sccdec: fix sub->pos values
Paul B Mahol
git at videolan.org
Tue Dec 24 00:13:51 EET 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Dec 23 22:39:46 2019 +0100| [13bffa79698e8bfe08634a1aefa9650dc74a58a2] | committer: Paul B Mahol
avformat/sccdec: fix sub->pos values
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13bffa79698e8bfe08634a1aefa9650dc74a58a2
---
libavformat/sccdec.c | 7 +++++--
1 file 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;
}
More information about the ffmpeg-cvslog
mailing list