Commit Graph

52 Commits

Author SHA1 Message Date
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
James Almer
28d5a3a74a lavu: rename and move ff_parity to av_parity
av_popcount is not defined in intmath.h.

Reviewed-by: ubitux
Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-07 20:04:24 -03:00
Clément Bœsch
00e96613f3 lavc/ccaption_dec: use ff_parity() 2016-01-07 22:51:36 +01:00
Clément Bœsch
d64fe951c2 lavc/ccaption_dec: fix always true condition
No idea why this wasn't ever detected by a static analyzer.
2016-01-07 22:42:39 +01:00
Aman Gupta
3ec5d8fe0f libavcodec/ccaption_dec: rewrite packet handler as case statement; remove COR3 macro
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-06 22:33:42 +01:00
Aman Gupta
55ca79f526 libavcodec/ccaption_dec: clean up and standardize white space
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-06 22:33:14 +01:00
Aman Gupta
e7271e6d07 libavcodec/ccaption_dec: remove unnecessary include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-05 18:10:34 +01:00
Ronald S. Bultje
229843aa35 Replace av_dlog with ff_dlog.
ff_dlog checks compilability, and is non-public. av_dlog is deprecated
and no longer exists if FF_API_DLOG=0.
2015-08-18 10:24:01 -04:00
Anshul Maheshwari
a6b630e9b6 avcodec/ccaption_dec: correcting line breaks in cc
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-03 23:38:57 +02:00
Pranav Vaish
f669d8c1b7 avcodec/ccaption_dec: Remove the GOTO statement 2015-04-02 00:06:44 +02:00
Anshul Maheshwari
f05efd42af avcodec/ccaption_dec: Added Debug logs
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-07 06:01:31 +01:00
Anshul Maheshwari
5647286e67 avcodec/ccaption_dec: handle error from ass_sub api
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-07 05:51:17 +01:00
Anshul Maheshwari
bf30161a8d avcodec/ccaption_dec: Added Roll up functionality
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-07 05:51:10 +01:00
Anshul Maheshwari
93fac23b80 avcodec/ccaption_dec: Adding color and fonts for future use in screen
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-30 00:04:51 +01:00
Anshul Maheshwari
1013c15f72 changed name of erase_display_memory to screen_changed
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-20 14:40:07 +01:00
Anshul Maheshwari
d6d354254f Initilaize array to known size
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-20 14:39:39 +01:00
Anshul Maheshwari
88ba88e887 CHAR_DEBUG to av_dlog
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-20 14:39:32 +01:00
Anshul Maheshwari
012559f2bb Cosmetic changes in cc_caption
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-20 14:39:15 +01:00