[vlc-devel] [PATCH 3/6] cea708: Render the correct number of lines in BT mode

Devin Heitmueller dheitmueller at ltnglobal.com
Wed Jan 23 23:09:12 CET 2019


The existing logic was making the decision on which lines to
render based exclusively on the i_firstrow/i_lastrow attributes,
which may be larger than the rowcount specified when the window
is created.  This can result in more lines being rendered than
requested by the sender.

Take into account the window rowcount property to render the
correct number of lines, and in cases where that number is less
than the delta between first/last, make sure to render the
correct subset of lines (i.e. the last N lines in the case of
TB).

Signed-off-by: Devin Heitmueller <dheitmueller at ltnglobal.com>
---
 modules/codec/cea708.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/modules/codec/cea708.c b/modules/codec/cea708.c
index 34b2f37d4a..0a4b40ab64 100644
--- a/modules/codec/cea708.c
+++ b/modules/codec/cea708.c
@@ -987,8 +987,27 @@ static void CEA708SpuConvert( const cea708_window_t *p_w,
     if( p_region == NULL && !(p_region = SubpictureUpdaterSysRegionNew()) )
         return;
 
+    int first, last;
+
+    if (p_w->style.scroll_direction == CEA708_WA_DIRECTION_BT) {
+        /* BT is a bit of a special case since we need to grab the last N
+           rows between first and last, rather than the first... */
+        last = p_w->i_lastrow;
+        if (p_w->i_lastrow - p_w->i_row_count < p_w->i_firstrow)
+            first = p_w->i_firstrow;
+        else
+            first = p_w->i_lastrow - p_w->i_row_count + 1;
+
+    } else {
+        first = p_w->i_firstrow;
+        if (p_w->i_firstrow + p_w->i_row_count > p_w->i_lastrow)
+            last = p_w->i_lastrow;
+        else
+            last = p_w->i_firstrow + p_w->i_row_count - 1;
+    }
+
     text_segment_t **pp_last = &p_region->p_segments;
-    for( uint8_t i=p_w->i_firstrow; i<=p_w->i_lastrow; i++ )
+    for( uint8_t i=first; i<=last; i++ )
     {
         if( !p_w->rows[i] )
             continue;
-- 
2.13.2



More information about the vlc-devel mailing list