1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

69 Commits

Author SHA1 Message Date
Paul B Mahol
c0974355c7 avcodec/ccaption_dec: do not modify pkt data and stop removing parity bit twice 2020-06-17 00:38:08 +02:00
Paul B Mahol
9887bcc6c6 avcodec/ccaption_dec: remove usage of extra buffer 2020-06-16 17:11:38 +02:00
Paul B Mahol
d5b1760665 avcodec/ccaption_dec: fix some small style issues 2020-06-16 17:11:38 +02:00
Paul B Mahol
3615b58693 avcodec/ccaption_dec: remove pts parameter from handle_char() 2020-06-16 17:11:38 +02:00
Paul B Mahol
cb98483ea0 avcodec/ccaption_dec: add support for colors 2020-06-15 19:27:20 +02:00
Paul B Mahol
0c2623d3aa avcodec/ccaption_dec: switch active screen in end of caption early
Fixes dropping of last caption.
2020-06-13 12:02:44 +02:00
Paul B Mahol
847d0b99de avcodec/ccaption_dec: remove unused arguments from function 2020-06-13 12:02:44 +02:00
Paul B Mahol
6995ea3506 avcodec/ccaption_dec: check for error codes 2020-06-13 12:02:44 +02:00
Michael Niedermayer
f17e8e90bb avcodec/ccaption_dec: Add a blank like at the end to avoid rollup reading from outside
Fixes: index 20 out of bounds for type 'const char *[4][128]'
Fixes: 14367/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CCAPTION_fuzzer-5718819672162304

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-04-21 23:29:04 +02:00
Paul B Mahol
b4a13d442a avcodecc/ccaption_dec: remove extra word from long codec description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-25 12:00:02 +01:00
Michael Niedermayer
752e6dfa3e avcodec/ccaption_dec: Use simple array instead of AVBuffer
This is simpler and fixes an out of array read, fixing it with AVBuffers
would be more complex

Fixes: e00d9e6e50e5495cc93fea41147b97bb/asan_heap-oob_12dcdbb_8798_b32a97ea722dd37bb5066812cc674552.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-09 11:01:24 +02:00
Aman Gupta
a49ed9e32d avcodec/ccaption_dec: default rollup to row 10
This ensures that captions are written towards the bottom of the screen
when tuning into mid-stream. The row will be reset on the receipt of the
next PAC command. Row 10 was chosen as it corresponds to the value of
"0" in a PAC (see row_map in handle_pac()).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 01:34:56 +02:00
Aman Gupta
9ca9671458 avcodec/ccaption_dec: implement positioning for closed captions
Positioning math is based on the guidelines in https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 01:31:25 +02:00
Aman Gupta
309322ef65 avcodec/ccaption_dec: change write_char() to void as return value is unused
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 20:16:22 +02:00
Michael Niedermayer
6cc4c42226 avcodec/ccaption_dec: Fix mixed declaration and statement.
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 02:33:03 +02:00
Aman Gupta
4448f16ef5 avcodec/ccaption_dec: implement tab offset commands
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 01:52:31 +02:00
Clément Bœsch
d8620158c7 lavc/ccaption_dec: remove usage of avctx->time_base
lavc/utils already rescales avpkt->pts to sub->pts in AV_TIME_BASE_Q
before calling the decode callback. This prevents from rescaling again
into the decoder, and avoid the use of avctx->time_base which will
disappear in the incoming codecpar merge.

This commit also replaces the use of "20 centisecond" (ass time base)
with "200 ms".
2016-04-02 19:03:06 +02:00
Clément Bœsch
30e7685360 lavc/options: add ass_ro_flush_noop to flags2 2016-02-26 21:53:32 +01:00
Clément Bœsch
2941282124 lavc: allow subtitle text format to be ASS without timing 2016-02-26 21:49:34 +01:00
Aman Gupta
5f5467e749 lavc/ccaption_dec: implement special and extended character sets
character sets implemented as defined in https://en.wikipedia.org/wiki/EIA-608#Characters
2016-02-17 21:32:18 +01:00
Aman Gupta
2f26b67d55 lavc/ccaption_dec: do not ignore repeated character commands
control codes in a cc stream can be repeated, and must be ignored.
however, repeated characters must not be ignored. the code attempted to
wipe prev_cmd in handle_char to allow repeated characters to be
processed, but prev_cmd would previously get reset _after_ handle_char()

i also moved the prev_cmd reset out from handle_char() so it can be
re-used for special character sets, which _must_ be ignored when
repeated.
2016-02-17 21:32:18 +01:00
Michael Niedermayer
22f64c2324 avcodec/ccaption_dec: Fix mixed declarations and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-19 13:48:21 +01:00
Aman Gupta
3a0e5cfcee lavc/ccaption_dec: clear all unused rows during rollup
Sometimes rollup captions can move around the screen. This fixes "ghost"
captions from below the current rollup area from continuing to be
captured when a rollup moves higher up on the screen.
2016-01-14 23:13:15 +01:00
Aman Gupta
9027806e3c lavc/ccaption_dec: clean up whitespace 2016-01-14 23:13:09 +01:00
Aman Gupta
5c041e2ccc lavc/ccaption_dec: implement real_time option
This new mode is useful for realtime decoding of closed captions so they
can be display along with mpeg2 frames.

Closed caption streams contain two major types of captions:

- POPON captions, which are buffered off-screen and displayed
  only after EOC (end of caption, aka display buffer)

- PAINTON/ROLLUP captions, which are written to the display as soon as
  they arrive.

In a typical real-time eia608 decoder, commands like EOC (end of
caption; display buffer), EDM (erase display memory) and EBM (erase
buffered memory) perform their expected functions as soon as the
commands are processed. This is implemented in the real_time branches
added in this commit.

Before this commit, and in the !real_time branches after this commit,
the decoder cleverly implements its own version of the decoder which is
specifically geared towards buffered decoding. It does so by actively
ignoring commands like EBM (erase buffered memory), and then re-using
the non-display buffer to hold the previous caption while the new one is
received. This is the opposite of the real-time decoder, which uses the
non-display buffer to hold the new caption while the display buffer is
still showing the current caption.

In addition to ignoring EBM, the buffered decoder also has custom
implementations for EDM and EOC. An EDM (erase display memory) command
flushes the existing contents before clearing the screen, and EOC
similarly always flushes the active buffer (the previous subtitle)
before flipping buffers.
2016-01-14 22:41:41 +01:00
Aman Gupta
260e368717 lavc/ccaption_dec: flush context on seek 2016-01-14 22:08:59 +01:00
Clément Bœsch
6d32628bf3 lavc/ccaption_dec: improve default style
Use monospaced font, and a black box outline.
2016-01-10 16:28:14 +01:00
Clément Bœsch
a43deea861 lavc/ccaption_dec: fix ASS tags 2016-01-10 14:07:45 +01:00
Clément Bœsch
0948e0f553 lavc/ccaption_dec: simplify rollup cases 2016-01-09 12:44:10 +01:00
Clément Bœsch
22765140fa lavc/ccaption_dec: check for bprint completeness outside the loop 2016-01-09 12:40:50 +01:00
Clément Bœsch
31bff21d2c lavc/ccaption_dec: mark row and font as const in capture_screen() 2016-01-09 12:38:36 +01:00
Clément Bœsch
d587fbb676 lavc/ccaption_dec: fix mixed declarations and code warning 2016-01-09 12:37:30 +01:00
Clément Bœsch
5ae07914d0 lavc/ccaption_dec: check for bprint completeness only at the end 2016-01-09 12:37:11 +01:00
Aman Gupta
b7e64be8fb lavc/ccaption_dec: implement font styles 2016-01-09 12:32:27 +01:00
Aman Gupta
086093c77c lavc/ccaption_dec: simplify by incrementing cursor_column inside write_char() 2016-01-09 12:30:15 +01:00
Aman Gupta
811ce8f9c5 lavc/ccaption_dec: simplify by passing screen into write_char() 2016-01-09 12:29:19 +01:00
Aman Gupta
080de371d8 lavc/ccaption_dec: extract capture_screen() for future use
unlike reap_screen(), capture_screen() can be used to populate buffer
without touching the timestamps. this is useful for upcoming commits
which implement a real time caption stream.
2016-01-09 12:24:49 +01:00
Aman Gupta
e521a32af2 lavc/ccaption_dec: clear buffer before populating with screen contents 2016-01-09 12:23:54 +01:00
Aman Gupta
7def844be8 lavc/ccaption_dec: centralize buffer_changed=1 into reap_screen 2016-01-09 11:54:05 +01:00
Aman Gupta
c75b869516 lavc/ccaption_dec: rename screen_changed to buffer_changed 2016-01-09 11:54:00 +01:00
Aman Gupta
8fd7f03c56 lavc/ccaption_dec: extract ass time base into constant 2016-01-09 11:53:56 +01:00
Aman Gupta
6049b15c0a lavc/ccaption_dec: combine ROLLUP modes as they are identical 2016-01-09 11:53:52 +01:00
Aman Gupta
2693275c02 Revert "lavc/ccaption_dec: reap_screen() is responsible for clearing output buffer and signaling screen_changed"
This reverts commit 53ee84f811.
2016-01-09 11:53:47 +01:00
Aman Gupta
578b911b5e Revert "lavc/ccaption_dec: implement "erase non displayed memory""
This reverts commit 26abdd61a3.
2016-01-09 11:53:40 +01:00
Aman Gupta
23a50c8ab9 Revert "lavc/ccaption_dec: reap_screen is not necessary when clearing screen or buffer"
This reverts commit fe225b113b.
2016-01-09 11:53:37 +01:00
Aman Gupta
fe225b113b lavc/ccaption_dec: reap_screen is not necessary when clearing screen or buffer 2016-01-08 20:39:55 +01:00
Aman Gupta
26abdd61a3 lavc/ccaption_dec: implement "erase non displayed memory" 2016-01-08 20:24:49 +01:00
Aman Gupta
53ee84f811 lavc/ccaption_dec: reap_screen() is responsible for clearing output buffer and signaling screen_changed
moves the screen_changed bit and the bprint_clear into reap_screen() so
the logic is centralized and callers do not need to touch the bit or the
buffer before calling reap_screen()
2016-01-08 20:23:47 +01:00
Aman Gupta
5695c85332 lavc/ccaption_dec: remove unused return value from internal functions 2016-01-08 20:07:00 +01:00
Aman Gupta
b261749f70 lavc/ccaption_dec: clean up whitespace 2016-01-08 20:06:31 +01:00