[vlc-commits] codec: cc: add debugging

Francois Cartegnie git at videolan.org
Thu Jul 26 11:23:25 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 26 11:19:44 2018 +0200| [410f727756cb32bd7eae5ef284d835938b875586] | committer: Francois Cartegnie

codec: cc: add debugging

in the same way as 708

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=410f727756cb32bd7eae5ef284d835938b875586
---

 modules/codec/cc.c | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 45b187023c..8e1e3f7243 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -42,6 +42,12 @@
 #include "substext.h"
 #include "cea708.h"
 
+#if 0
+#define Debug(code) code
+#else
+#define Debug(code)
+#endif
+
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
@@ -558,6 +564,7 @@ static void Convert( decoder_t *p_dec, vlc_tick_t i_pts,
                  * see CEAv1.2zero.trp tests */
                 if( i_status & (EIA608_STATUS_DISPLAY | EIA608_STATUS_CHANGED) )
                 {
+                    Debug(printf("\n"));
                     subpicture_t *p_spu = Subtitle( p_dec, p_sys->p_eia608, i_spupts );
                     if( p_spu )
                         decoder_QueueSub( p_dec, p_spu );
@@ -763,6 +770,7 @@ static eia608_status_t Eia608ParseTextAttribute( eia608_t *h, uint8_t d2 )
     const int i_index = d2 - 0x20;
     assert( d2 >= 0x20 && d2 <= 0x2f );
 
+    Debug(printf("[TA %d]", i_index));
     h->color = pac2_attribs[i_index].i_color;
     h->font  = pac2_attribs[i_index].i_font;
     Eia608Cursor( h, 1 );
@@ -778,6 +786,7 @@ static eia608_status_t Eia608ParseSingle( eia608_t *h, const uint8_t dx )
 static eia608_status_t Eia608ParseDouble( eia608_t *h, uint8_t d2 )
 {
     assert( d2 >= 0x30 && d2 <= 0x3f );
+    Debug(printf("\033[0;33m%s\033[0m", d2 + 0x50));
     Eia608Write( h, d2 + 0x50 ); /* We use charaters 0x80...0x8f */
     return EIA608_STATUS_CHANGED;
 }
@@ -790,6 +799,7 @@ static eia608_status_t Eia608ParseExtended( eia608_t *h, uint8_t d1, uint8_t d2
     else
         d2 += 0x90; /* We use charaters 0xb0-0xcf */
 
+    Debug(printf("[EXT %x->'%c']", d2, d2));
     /* The extended characters replace the previous one with a more
      * advanced one */
     Eia608Cursor( h, -1 );
@@ -804,21 +814,26 @@ static eia608_status_t Eia608ParseCommand0x14( eia608_t *h, uint8_t d2 )
     switch( d2 )
     {
     case 0x20:  /* Resume caption loading */
+        Debug(printf("[RCL]"));
         h->mode = EIA608_MODE_POPUP;
         break;
     case 0x21:  /* Backspace */
+        Debug(printf("[BS]"));
         Eia608Erase( h );
         i_status = EIA608_STATUS_CHANGED;
         break;
     case 0x22:  /* Reserved */
     case 0x23:
+        Debug(printf("[ALARM %d]", d2 - 0x22));
         break;
     case 0x24:  /* Delete to end of row */
+        Debug(printf("[DER]"));
         Eia608EraseToEndOfRow( h );
         break;
     case 0x25:  /* Rollup 2 */
     case 0x26:  /* Rollup 3 */
     case 0x27:  /* Rollup 4 */
+        Debug(printf("[RU%d]", d2 - 0x23));
         if( h->mode == EIA608_MODE_POPUP || h->mode == EIA608_MODE_PAINTON )
         {
             Eia608EraseScreen( h, true );
@@ -841,31 +856,39 @@ static eia608_status_t Eia608ParseCommand0x14( eia608_t *h, uint8_t d2 )
         }
         break;
     case 0x28:  /* Flash on */
+        Debug(printf("[FON]"));
         /* TODO */
         break;
     case 0x29:  /* Resume direct captionning */
+        Debug(printf("[RDC]"));
         h->mode = EIA608_MODE_PAINTON;
         break;
     case 0x2a:  /* Text restart */
+        Debug(printf("[TR]"));
         /* TODO */
         break;
 
     case 0x2b: /* Resume text display */
+        Debug(printf("[RTD]"));
         h->mode = EIA608_MODE_TEXT;
         break;
 
     case 0x2c: /* Erase displayed memory */
+        Debug(printf("[EDM]"));
         Eia608EraseScreen( h, true );
         i_status = EIA608_STATUS_CHANGED | EIA608_STATUS_CAPTION_CLEARED;
         break;
     case 0x2d: /* Carriage return */
+        Debug(printf("[CR]"));
         Eia608RollUp(h);
         i_status = EIA608_STATUS_CHANGED;
         break;
     case 0x2e: /* Erase non displayed memory */
+        Debug(printf("[ENM]"));
         Eia608EraseScreen( h, false );
         break;
     case 0x2f: /* End of caption (flip screen if not paint on) */
+        Debug(printf("[EOC]"));
         if( h->mode != EIA608_MODE_PAINTON )
             h->i_screen = 1 - h->i_screen;
         h->mode = EIA608_MODE_POPUP;
@@ -883,13 +906,10 @@ static bool Eia608ParseCommand0x17( eia608_t *h, uint8_t d2 )
     switch( d2 )
     {
     case 0x21:  /* Tab offset 1 */
-        Eia608Cursor( h, 1 );
-        break;
     case 0x22:  /* Tab offset 2 */
-        Eia608Cursor( h, 2 );
-        break;
     case 0x23:  /* Tab offset 3 */
-        Eia608Cursor( h, 3 );
+        Debug(printf("[TO%d]", d2 - 0x20));
+        Eia608Cursor( h, d2 - 0x20 );
         break;
     }
     return false;
@@ -901,6 +921,7 @@ static bool Eia608ParsePac( eia608_t *h, uint8_t d1, uint8_t d2 )
     };
     const int i_row_index = ( (d1<<1) & 0x0e) | ( (d2>>5) & 0x01 );
 
+    Debug(printf("[PAC,%d]", i_row_index));
     assert( d2 >= 0x40 && d2 <= 0x7f );
 
     if( pi_row[i_row_index] <= 0 )
@@ -954,9 +975,14 @@ static eia608_status_t Eia608ParseData( eia608_t *h, uint8_t d1, uint8_t d2 )
 #undef ON
     if( d1 >= 0x20 )
     {
+        Debug(printf("\033[0;33m%c", d1));
         i_status = Eia608ParseSingle( h, d1 );
         if( d2 >= 0x20 )
+        {
+            Debug(printf("%c", d2));
             i_status |= Eia608ParseSingle( h, d2 );
+        }
+        Debug(printf("\033[0m"));
     }
 
     /* Ignore changes occuring to doublebuffer */



More information about the vlc-commits mailing list