summaryrefslogtreecommitdiff
path: root/libavformat/sccdec.c
Commit message (Collapse)AuthorAge
* avformat/sccdec: Remove nonsense castAndreas Rheinhardt2021-10-07
| | | | | | | | In most contexts, arrays are automatically converted to a pointer to their first element; taking the address of the array just yields a pointer to an array of fixed-size arrays, which is not intended here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Avoid zero-terminating unnecessarilyAndreas Rheinhardt2021-10-02
| | | | | | | | ff_subtitles_queue_insert() does not require its events to be zero-terminated as it has a parameter for the length. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Make constants more intelligibleAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Fix position of returned subtitle packetsAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Remove redundant checkAndreas Rheinhardt2021-10-02
| | | | | | | The av_sscanf() will filter lines like "Scenarist_SCC V1.0" out. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Don't use uninitialized data, fix crash, simplify logicAndreas Rheinhardt2021-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, the scc demuxer not only read the line that it intends to process, but also the next line, in order to be able to calculate the duration of the current line. This approach leads to unnecessary complexity and also to bugs: For the last line, the timing of the next subtitle is not only logically indeterminate, but also uninitialized and the same applies to the duration of the last packet derived from it.* Worse yet, in case of e.g. an empty file, it is not only the duration that is uninitialized, but the whole timing as well as the line buffer itself.** The latter is used in av_strtok(), which could lead to crashes. Furthermore, the current code always outputs at least one packet, even for empty files. This commit fixes all of this: It stops using two lines at a time; instead only the current line is dealt with and in case there is a packet after that, the duration of the last packet is fixed up after having already parsed it; consequently the duration of the last packet is left in its default state (meaning "unknown/up until the next subtitle"). If no further line could be read, processing is stopped; in particular, no packet is output for an empty file. *: Due to stack reuse it seems to be zero quite often; for the same reason Valgrind does not report any errors for a normal input file. **: While ff_subtitles_read_line() claims to always zero-terminate the buffer like snprintf(), it doesn't do so if it didn't read anything. And even if it did, it would not necessarily help here: The current code jumps over 12 bytes that it deems to have read even when it hasn't. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/subtitles: Deduplicate subtitles' read_(packet|seek|close)Andreas Rheinhardt2021-07-18
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-08
| | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/sccdec: Use larger intermediate for ts/next_ts computationMichael Niedermayer2021-02-02
| | | | | | | | Fixes: signed integer overflow: 92237203 * 33 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SCC_fuzzer-6603769487949824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sccdec: Avoid variable that is always zeroAndreas Rheinhardt2020-06-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/sccdec: make splitting more robustPaul B Mahol2020-06-18
|
* avformat/sccdec: simplify demuxer a littlePaul B Mahol2020-06-17
|
* avformat/sccdec: unbreak previous commits to this filePaul B Mahol2020-06-15
|
* avformat/sccdec: Fix memleak upon read header failureAndreas Rheinhardt2020-06-15
| | | | | | | The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon reading a subsequent subtitle. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/sccdec: move pos variables outside of loopPaul B Mahol2020-06-13
| | | | Ensures that sub->pos is always correct.
* avformat/sccdec: split line with multiple subsPaul B Mahol2020-06-13
|
* avformat/sccdec: use av_sscanf() insteadPaul B Mahol2020-02-04
|
* avformat/sccdec: only change duration for last subtitlePaul B Mahol2019-12-23
|
* avformat/sccdec: fix sub->pos valuesPaul B Mahol2019-12-23
|
* avformat/sccdec: fix timestamp of last subtitlePaul B Mahol2019-12-23
| | | | Fixes -c:s copy case.
* avformat/sccdec: remove not needed codePaul B Mahol2019-09-13
|
* avformat/sccdec: display last caption even when there is no empty last linePaul B Mahol2019-06-27
|
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* avformat/sccdec: simplify 2 sscanf callsPaul B Mahol2017-01-30
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/sccdec: attempt to fix valgrind issuePaul B Mahol2017-01-28
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat: add Scenarist Closed Captions demuxerPaul B Mahol2017-01-25
Fixes #4767. Signed-off-by: Paul B Mahol <onemda@gmail.com>