[vlc-devel] [PATCH] cc: Only reset line position if rollup mode changed
Devin Heitmueller
dheitmueller at ltnglobal.com
Fri Jul 20 20:40:29 CEST 2018
The EIA-608 parser was always resetting the line position whenever
it received a rollup code. However this would cause the text to
be rendered improperly if the rollup code was received in the
middle of an existing line and the mode was unchanged.
Only reset the line position if the rollup mode changes from the
existing value.
This problem was exhibited in streams from the "Steve Harvey show"
where whatever EIA-608 encoder they are using would sometimes send
rollup codes mid-row (causing the leading characters on that line to
be overwritten by whatever characters followed the rollup code).
Signed-off-by: Devin Heitmueller <dheitmueller at ltnglobal.com>
---
modules/codec/cc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 72b209aff7..45b187023c 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -799,6 +799,7 @@ static eia608_status_t Eia608ParseExtended( eia608_t *h, uint8_t d1, uint8_t d2
static eia608_status_t Eia608ParseCommand0x14( eia608_t *h, uint8_t d2 )
{
eia608_status_t i_status = EIA608_STATUS_DEFAULT;
+ eia608_mode_t proposed_mode;
switch( d2 )
{
@@ -826,14 +827,18 @@ static eia608_status_t Eia608ParseCommand0x14( eia608_t *h, uint8_t d2 )
}
if( d2 == 0x25 )
- h->mode = EIA608_MODE_ROLLUP_2;
+ proposed_mode = EIA608_MODE_ROLLUP_2;
else if( d2 == 0x26 )
- h->mode = EIA608_MODE_ROLLUP_3;
+ proposed_mode = EIA608_MODE_ROLLUP_3;
else
- h->mode = EIA608_MODE_ROLLUP_4;
+ proposed_mode = EIA608_MODE_ROLLUP_4;
- h->cursor.i_column = 0;
- h->cursor.i_row = h->i_row_rollup;
+ if ( proposed_mode != h->mode )
+ {
+ h->mode = proposed_mode;
+ h->cursor.i_column = 0;
+ h->cursor.i_row = h->i_row_rollup;
+ }
break;
case 0x28: /* Flash on */
/* TODO */
--
2.13.2
More information about the vlc-devel
mailing list