]> git.sesse.net Git - vlc/blobdiff - modules/codec/cc.c
mediacodec: fix deprecated calls if API >= 21
[vlc] / modules / codec / cc.c
index 6ea07fd557f43e54787e20b0c243db85b605086b..678f9b902977ada8c942d665da9b950e9fa91e8d 100644 (file)
@@ -167,16 +167,16 @@ static int Open( vlc_object_t *p_this )
 
     switch( p_dec->fmt_in.i_codec )
     {
-        case VLC_FOURCC('c','c','1',' '):
+        case VLC_CODEC_EIA608_1:
             i_field = 0; i_channel = 1;
             break;
-        case VLC_FOURCC('c','c','2',' '):
+        case VLC_CODEC_EIA608_2:
             i_field = 0; i_channel = 2;
             break;
-        case VLC_FOURCC('c','c','3',' '):
+        case VLC_CODEC_EIA608_3:
             i_field = 1; i_channel = 1;
             break;
-        case VLC_FOURCC('c','c','4',' '):
+        case VLC_CODEC_EIA608_4:
             i_field = 1; i_channel = 2;
             break;
 
@@ -305,6 +305,8 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
     if( i_pts <= VLC_TS_INVALID )
     {
         msg_Warn( p_dec, "subtitle without a date" );
+        free( psz_subtitle );
+        free( psz_html );
         return NULL;
     }
 
@@ -333,6 +335,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
     p_spu_sys->text  = psz_subtitle;
     p_spu_sys->html  = psz_html;
     p_spu_sys->i_font_height_percent = 5;
+    p_spu_sys->renderbg = true;
 
     return p_spu;
 }
@@ -936,12 +939,16 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_
     /* Search the start */
     i_start = 0;
 
+    /* Ensure we get a monospaced font (required for accurate positioning */
+    if( b_html )
+        CAT( "<tt>" );
+
     /* Convert leading spaces to non-breaking so that they don't get
        stripped by the RenderHtml routine as regular whitespace */
     while( i_start < EIA608_SCREEN_COLUMNS && p_char[i_start] == ' ' ) {
-       Eia608TextUtf8( utf8, 0x89 );
-       CAT( utf8 );
-       i_start++;
+        Eia608TextUtf8( utf8, 0x89 );
+        CAT( utf8 );
+        i_start++;
     }
 
     /* Search the end */
@@ -1041,6 +1048,7 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_
             CAT( "</i>" );
         if( last_color != EIA608_COLOR_DEFAULT )
             CAT( "</font>" );
+        CAT( "</tt>" );
     }
 #undef CAT
 }