[vlc-commits] [Git][videolan/vlc][master] 5 commits: dynamicoverlay: don't use VLC_CODEC_TEXT as a chroma

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 28 11:13:57 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
be719c10 by Steve Lhomme at 2023-10-28T10:56:57+00:00
dynamicoverlay: don't use VLC_CODEC_TEXT as a chroma

A chroma of 0 in the format is considered a text-based source.

- - - - -
981a0f17 by Steve Lhomme at 2023-10-28T10:56:57+00:00
subpicture: group text-based region flags into a single field

- - - - -
64b0b0e8 by Steve Lhomme at 2023-10-28T10:56:57+00:00
subpicture: invert the text region balanced flags

It's cleaner to have the default value at 0 and set a flag when it's needed.

- - - - -
4a09ac18 by Steve Lhomme at 2023-10-28T10:56:57+00:00
subpicture: merge the text align and text flags

Flags are more efficient in an int and we save space. The VLC_SUBPIC_TEXT_FLAG_xxx
flags don't overlap with the SUBPICTURE_ALIGN_xxx flags.

- - - - -
c73d6436 by Steve Lhomme at 2023-10-28T10:56:57+00:00
subpicture: mark regions that are text based

Rather than setting VLC_CODEC_TEXT in i_chroma when it's not a chroma.

- - - - -


15 changed files:

- include/vlc_subpicture.h
- modules/codec/dvbsub.c
- modules/codec/substext.h
- modules/codec/t140.c
- modules/codec/webvtt/encvtt.c
- modules/spu/dynamicoverlay/dynamicoverlay.c
- modules/spu/dynamicoverlay/dynamicoverlay_commands.c
- modules/spu/subsdelay.c
- modules/stream_out/transcode/spu.c
- modules/text_renderer/freetype/freetype.c
- modules/text_renderer/svg.c
- src/misc/subpicture.c
- src/video_output/video_epg.c
- src/video_output/video_text.c
- src/video_output/vout_subpictures.c


Changes:

=====================================
include/vlc_subpicture.h
=====================================
@@ -48,6 +48,15 @@ typedef struct subpicture_region_private_t subpicture_region_private_t;
 typedef struct vlc_spu_highlight_t vlc_spu_highlight_t;
 typedef struct filter_t vlc_blender_t;
 
+/**< render background under text only */
+#define VLC_SUBPIC_TEXT_FLAG_NO_REGION_BG      (1 << 4)
+/** if the decoder sends row/cols based output */
+#define VLC_SUBPIC_TEXT_FLAG_GRID_MODE         (1 << 5)
+/** don't try to balance wrapped text lines */
+#define VLC_SUBPIC_TEXT_FLAG_TEXT_NOT_BALANCED (1 << 6)
+/** mark the subpicture region as a text flag */
+#define VLC_SUBPIC_TEXT_FLAG_IS_TEXT           (1 << 7)
+
 /**
  * Video subtitle region
  *
@@ -67,10 +76,7 @@ struct subpicture_region_t
 
     /* Parameters for text regions (p_picture to be rendered) */
     text_segment_t  *p_text;         /**< subtitle text, made of a list of segments */
-    int             i_text_align;    /**< alignment flags of region content */
-    bool            b_noregionbg;    /**< render background under text only */
-    bool            b_gridmode;      /** if the decoder sends row/cols based output */
-    bool            b_balanced_text; /** try to balance wrapped text lines */
+    int             text_flags;      /**< VLC_SUBPIC_TEXT_FLAG_xxx and SUBPICTURE_ALIGN_xxx */
     int             i_max_width;     /** horizontal rendering/cropping target/limit */
     int             i_max_height;    /** vertical rendering/cropping target/limit */
 
@@ -150,6 +156,18 @@ VLC_API void subpicture_region_ChainDelete( subpicture_region_t *p_head );
  */
 VLC_API subpicture_region_t *subpicture_region_Copy( subpicture_region_t *p_region );
 
+/**
+ * Tells if the region is a text-based region.
+ */
+#define subpicture_region_IsText(r)  \
+    (((r)->text_flags & VLC_SUBPIC_TEXT_FLAG_IS_TEXT) != 0)
+
+/**
+ * Marks a text-based region as rendered into the p_picture.
+ */
+#define subpicture_region_TextMarkRendered(r)  \
+    ((r)->text_flags &= ~VLC_SUBPIC_TEXT_FLAG_IS_TEXT)
+
 /**
  *
  */


=====================================
modules/codec/dvbsub.c
=====================================
@@ -1959,7 +1959,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
     /* Sanity check */
     if( !p_region ) return NULL;
 
-    if( ( p_region->fmt.i_chroma != VLC_CODEC_TEXT ) &&
+    if( (!subpicture_region_IsText( p_region )) &&
         ( p_region->fmt.i_chroma != VLC_CODEC_YUVP ) )
     {
         msg_Err( p_enc, "chroma %4.4s not supported", (char *)&p_region->fmt.i_chroma );
@@ -2182,8 +2182,7 @@ static void encode_region_composition( encoder_t *p_enc, bs_t *s,
          p_region = p_region->p_next, i_region++ )
     {
         int i_entries = 4, i_depth = 0x1, i_bg = 0;
-        bool b_text =
-            ( p_region->fmt.i_chroma == VLC_CODEC_TEXT );
+        bool b_text = subpicture_region_IsText( p_region );
 
         if( !b_text )
         {
@@ -2267,15 +2266,12 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
         bs_write( s, 4, p_sys->i_region_ver++ );
 
         /* object coding method */
-        switch( p_region->fmt.i_chroma )
-        {
-        case VLC_CODEC_YUVP:
-            bs_write( s, 2, 0 );
-            break;
-        case VLC_CODEC_TEXT:
+        if (subpicture_region_IsText( p_region ))
             bs_write( s, 2, 1 );
-            break;
-        default:
+        else if ( p_region->fmt.i_chroma == VLC_CODEC_YUVP )
+            bs_write( s, 2, 0 );
+        else
+        {
             msg_Err( p_enc, "FOURCC %4.4s not supported by encoder.",
                      (const char*)&p_region->fmt.i_chroma );
             continue;
@@ -2284,7 +2280,7 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
         bs_write( s, 1, 0 ); /* non modifying color flag */
         bs_write( s, 1, 0 ); /* Reserved */
 
-        if( p_region->fmt.i_chroma == VLC_CODEC_TEXT )
+        if(subpicture_region_IsText( p_region ))
         {
             int i_size, i;
 


=====================================
modules/codec/substext.h
=====================================
@@ -138,7 +138,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
         return;
 
     video_format_t fmt;
-    video_format_Init(&fmt, VLC_CODEC_TEXT);
+    video_format_Init(&fmt, 0);
 
     /* NOTE about fmt_dst:
      * fmt_dst area and A/R will change to display once WxH of the
@@ -176,15 +176,18 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
 
         r->p_text = text_segment_Copy( p_updtregion->p_segments );
         r->i_align = p_updtregion->align;
-        r->i_text_align = p_updtregion->inner_align;
-        r->b_noregionbg = (p_updtregion->flags & UPDT_REGION_IGNORE_BACKGROUND) != 0;
-        r->b_gridmode = (p_updtregion->flags & UPDT_REGION_USES_GRID_COORDINATES) != 0;
+        r->text_flags |= p_updtregion->inner_align & SUBPICTURE_ALIGN_MASK;
+        if (p_updtregion->flags & UPDT_REGION_IGNORE_BACKGROUND)
+            r->text_flags |= VLC_SUBPIC_TEXT_FLAG_NO_REGION_BG;
+        bool b_gridmode = (p_updtregion->flags & UPDT_REGION_USES_GRID_COORDINATES) != 0;
+        if (b_gridmode)
+            r->text_flags |= VLC_SUBPIC_TEXT_FLAG_GRID_MODE;
 
         if (!(p_updtregion->flags & UPDT_REGION_FIXED_DONE))
         {
             const float margin_ratio = sys->margin_ratio;
-            const int   margin_h     = margin_ratio * (( r->b_gridmode ) ? subpic->i_original_picture_width
-                                                                         : fmt_dst->i_visible_width );
+            const int   margin_h     = margin_ratio * ( b_gridmode ? subpic->i_original_picture_width
+                                                                   : fmt_dst->i_visible_width );
             const int   margin_v     = margin_ratio * fmt_dst->i_visible_height;
 
             /* subpic invisible margins sizes */


=====================================
modules/codec/t140.c
=====================================
@@ -85,7 +85,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
 
     p_region = p_spu->p_region;
     if( ( p_region == NULL )
-     || ( p_region->fmt.i_chroma != VLC_CODEC_TEXT )
+     || (!subpicture_region_IsText( p_region ))
      || ( p_region->p_text == NULL )
      || ( p_region->p_text->psz_text == NULL) )
         return NULL;


=====================================
modules/codec/webvtt/encvtt.c
=====================================
@@ -87,7 +87,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
     for( subpicture_region_t *p_region = p_spu->p_region;
                               p_region; p_region = p_region->p_next )
     {
-        if( p_region->fmt.i_chroma != VLC_CODEC_TEXT ||
+        if(!subpicture_region_IsText( p_region )||
             p_region->p_text == NULL ||
             p_region->p_text->psz_text == NULL )
             continue;
@@ -159,7 +159,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
 
         /* Settings */
 
-        if( (p_region->i_text_align & (SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT)) ||
+        if( (p_region->text_flags & (SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT)) ||
                 (p_region->i_align & SUBPICTURE_ALIGN_TOP) )
         {
             size_t i_start = bo_size( &box );
@@ -167,9 +167,9 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
             bo_add_32be( &box, 0 );
             bo_add_fourcc( &box, "sttg" );
 
-            if( p_region->i_text_align & SUBPICTURE_ALIGN_LEFT )
+            if( p_region->text_flags & SUBPICTURE_ALIGN_LEFT )
                 bo_add_mem( &box, 10, "align:left" );
-            else if( p_region->i_text_align & SUBPICTURE_ALIGN_RIGHT )
+            else if( p_region->text_flags & SUBPICTURE_ALIGN_RIGHT )
                 bo_add_mem( &box, 11, "align:right" );
 
             if( p_region->i_align & SUBPICTURE_ALIGN_TOP )


=====================================
modules/spu/dynamicoverlay/dynamicoverlay.c
=====================================
@@ -351,7 +351,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
     {
         subpicture_region_t *p_region;
 
-        if( p_overlay->format.i_chroma == VLC_CODEC_TEXT )
+        if( p_overlay->format.i_chroma == 0 )
             p_region = subpicture_region_NewText();
         else
             p_region = subpicture_region_ForPicture( &p_overlay->format, p_overlay->data.p_pic );
@@ -365,7 +365,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
                  (char*)&p_overlay->format.i_chroma, p_overlay->i_x, p_overlay->i_y,
                  p_overlay->i_alpha );
 
-        if( p_overlay->format.i_chroma == VLC_CODEC_TEXT )
+        if( p_overlay->format.i_chroma == 0 )
         {
             video_format_Copy( &p_region->fmt, &p_overlay->format );
             p_region->p_text = text_segment_New( p_overlay->data.p_text );


=====================================
modules/spu/dynamicoverlay/dynamicoverlay_commands.c
=====================================
@@ -54,7 +54,7 @@ overlay_t *OverlayCreate( void )
     p_ovl->i_x = p_ovl->i_y = 0;
     p_ovl->i_alpha = 0xFF;
     p_ovl->b_active = false;
-    video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
+    video_format_Setup( &p_ovl->format, 0, 0, 0,
                         0, 0, 1, 1 );
     p_ovl->p_fontstyle = text_style_Create( STYLE_NO_DEFAULTS );
     p_ovl->data.p_text = NULL;
@@ -474,7 +474,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
             return VLC_ENOMEM;
         }
 
-        video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
+        video_format_Setup( &p_ovl->format, 0,
                             0, 0, 0, 0, 0, 1 );
 
         p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );


=====================================
modules/spu/subsdelay.c
=====================================
@@ -1328,7 +1328,7 @@ static int SubsdelayGetTextRank( char *psz_text )
  *****************************************************************************/
 static bool SubsdelayIsTextEmpty( const subpicture_region_t *p_region )
 {
-    if ( p_region->fmt.i_chroma != VLC_CODEC_TEXT )
+    if (!subpicture_region_IsText( p_region ))
         return true;
     const text_segment_t *p_segment = p_region->p_text;
     while ( p_segment )


=====================================
modules/stream_out/transcode/spu.c
=====================================
@@ -216,7 +216,7 @@ int transcode_spu_process( sout_stream_t *p_stream,
             block_t *p_block;
 
             es_format_t fmt;
-            es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_TEXT );
+            es_format_Init( &fmt, VIDEO_ES, 0 );
 
             unsigned w, h;
             if( id->pf_get_output_dimensions == NULL ||


=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -477,7 +477,7 @@ static void RenderBackground( subpicture_region_t *p_region,
 {
     for( const line_desc_t *p_line = p_line_head; p_line != NULL; p_line = p_line->p_next )
     {
-        FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region->i_text_align );
+        FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region->text_flags & SUBPICTURE_ALIGN_MASK );
 
         FT_BBox linebgbox = p_line->bbox;
         linebgbox.xMin += offset.x;
@@ -675,7 +675,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
     const text_style_t *p_style = p_sys->p_default_style;
     uint8_t i_x, i_y, i_z;
 
-    if (p_region->b_noregionbg) {
+    if (p_region->text_flags & VLC_SUBPIC_TEXT_FLAG_NO_REGION_BG) {
         /* Render the background just under the text */
         draw.fill( p_picture, STYLE_ALPHA_TRANSPARENT, 0x00, 0x00, 0x00,
                    0, 0, fmt.i_visible_width, fmt.i_visible_height );
@@ -697,7 +697,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
         /* Render all lines */
         for( line_desc_t *p_line = p_line_head; p_line != NULL; p_line = p_line->p_next )
         {
-            FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region->i_text_align );
+            FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region->text_flags & SUBPICTURE_ALIGN_MASK );
 
             int i_glyph_offset_y = offset.y + p_regionbbox->yMax + p_line->origin.y;
             int i_glyph_offset_x = offset.x - p_regionbbox->xMin;
@@ -983,7 +983,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
         return VLC_EGENERIC;
 
     filter_sys_t *p_sys = p_filter->p_sys;
-    bool b_grid = p_region_in->b_gridmode;
+    bool b_grid = (p_region_in->text_flags & VLC_SUBPIC_TEXT_FLAG_GRID_MODE) != 0;
     p_sys->i_scale = ( b_grid ) ? 100 : var_InheritInteger( p_filter, "sub-text-scale");
 
     UpdateDefaultLiveStyles( p_filter );
@@ -1002,8 +1002,8 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     }
 
     layout_text_block_t text_block = { 0 };
-    text_block.b_balanced = p_region_in->b_balanced_text;
-    text_block.b_grid = p_region_in->b_gridmode;
+    text_block.b_balanced = (p_region_in->text_flags & VLC_SUBPIC_TEXT_FLAG_TEXT_NOT_BALANCED) == 0;
+    text_block.b_grid = b_grid;
     text_block.i_count = SegmentsToTextAndStyles( p_filter, p_region_in->p_text,
                                                   &text_block );
     if( text_block.i_count == 0 )
@@ -1045,7 +1045,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     const vlc_fourcc_t p_chroma_list_yuvp[] = { VLC_CODEC_YUVP, 0 };
     const vlc_fourcc_t p_chroma_list_rgba[] = { VLC_CODEC_RGBA, 0 };
 
-    int i_margin = (p_sys->p_default_style->i_background_alpha > 0 && !p_region_in->b_gridmode)
+    int i_margin = (p_sys->p_default_style->i_background_alpha > 0 && !b_grid)
                     ? i_max_face_height / 4 : 0;
 
     if( (unsigned)i_margin * 2 >= i_max_width || (unsigned)i_margin * 2 >= i_max_height )
@@ -1084,9 +1084,9 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     unsigned outertext_w = (regionbbox.xMax - regionbbox.xMin);
     if( outertext_w < (unsigned) p_region_in->i_max_width )
     {
-        if( p_region_in->i_text_align & SUBPICTURE_ALIGN_RIGHT )
+        if( p_region_in->text_flags & SUBPICTURE_ALIGN_RIGHT )
             regionbbox.xMin -= (p_region_in->i_max_width - outertext_w);
-        else if( p_region_in->i_text_align & SUBPICTURE_ALIGN_LEFT )
+        else if( p_region_in->text_flags & SUBPICTURE_ALIGN_LEFT )
             regionbbox.xMax += (p_region_in->i_max_width - outertext_w);
         else
         {
@@ -1098,9 +1098,9 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     unsigned outertext_h = (regionbbox.yMax - regionbbox.yMin);
     if( outertext_h < (unsigned) p_region_in->i_max_height )
     {
-        if( p_region_in->i_text_align & SUBPICTURE_ALIGN_TOP )
+        if( p_region_in->text_flags & SUBPICTURE_ALIGN_TOP )
             regionbbox.yMin -= (p_region_in->i_max_height - outertext_h);
-        else if( p_region_in->i_text_align & SUBPICTURE_ALIGN_BOTTOM )
+        else if( p_region_in->text_flags & SUBPICTURE_ALIGN_BOTTOM )
             regionbbox.yMax += (p_region_in->i_max_height - outertext_h);
         else
         {
@@ -1177,7 +1177,10 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
             continue;
 
         if( rv == VLC_SUCCESS )
+        {
+            subpicture_region_TextMarkRendered( p_region_out );
             break;
+        }
     }
 
 done:


=====================================
modules/text_renderer/svg.c
=====================================
@@ -390,6 +390,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         p_region_out->p_picture = p_picture;
         video_format_Clean( &p_region_out->fmt );
         video_format_Copy( &p_region_out->fmt, &p_picture->format );
+        subpicture_region_TextMarkRendered(p_region_out);
         return VLC_SUCCESS;
     }
     return VLC_EGENERIC;


=====================================
src/misc/subpicture.c
=====================================
@@ -210,7 +210,6 @@ static subpicture_region_t * subpicture_region_NewInternal( void )
     p_region->zoom_h.den = p_region->zoom_h.num = 1;
     p_region->zoom_v.den = p_region->zoom_v.num = 1;
     p_region->i_alpha = 0xff;
-    p_region->b_balanced_text = true;
 
     return p_region;
 }
@@ -259,7 +258,9 @@ subpicture_region_t *subpicture_region_NewText( void )
     if( !p_region )
         return NULL;
 
-    video_format_Init( &p_region->fmt, VLC_CODEC_TEXT );
+    p_region->text_flags |= VLC_SUBPIC_TEXT_FLAG_IS_TEXT;
+
+    video_format_Init( &p_region->fmt, 0 );
 
     return p_region;
 }
@@ -363,10 +364,7 @@ subpicture_region_t* subpicture_region_Copy( subpicture_region_t *p_region_src )
     p_region_dst->i_align  = p_region_src->i_align;
     p_region_dst->i_alpha  = p_region_src->i_alpha;
 
-    p_region_dst->i_text_align    = p_region_src->i_text_align;
-    p_region_dst->b_noregionbg    = p_region_src->b_noregionbg;
-    p_region_dst->b_gridmode      = p_region_src->b_gridmode;
-    p_region_dst->b_balanced_text = p_region_src->b_balanced_text;
+    p_region_dst->text_flags      = p_region_src->text_flags;
     p_region_dst->i_max_width     = p_region_src->i_max_width;
     p_region_dst->i_max_height    = p_region_src->i_max_height;
     p_region_dst->p_text = text_segment_Copy( p_region_src->p_text );


=====================================
src/video_output/video_epg.c
=====================================
@@ -265,10 +265,10 @@ static subpicture_region_t * vout_OSDTextRegion(text_segment_t *p_segment,
     region->fmt.i_sar_den = 1;
     region->p_text   = p_segment;
     region->i_align  = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
-    region->i_text_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
+    region->text_flags |= SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
+    region->text_flags |= VLC_SUBPIC_TEXT_FLAG_TEXT_NOT_BALANCED;
     region->i_x      = x;
     region->i_y      = y;
-    region->b_balanced_text = false;
 
     return region;
 }


=====================================
src/video_output/video_text.c
=====================================
@@ -78,7 +78,7 @@ static void OSDTextUpdate(subpicture_t *subpic,
     const int   margin_h     = margin_ratio * fmt_dst->i_visible_width;
     const int   margin_v     = margin_ratio * fmt_dst->i_visible_height;
 
-    r->i_text_align = sys->position;
+    r->text_flags |= sys->position & SUBPICTURE_ALIGN_MASK;
     r->i_align = sys->position;
     r->i_x = 0;
     if (r->i_align & SUBPICTURE_ALIGN_LEFT)


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -320,7 +320,7 @@ static int SpuRenderText(spu_t *spu,
                           const vlc_fourcc_t *chroma_list)
 {
     spu_private_t *sys = spu->p;
-    assert(region->fmt.i_chroma == VLC_CODEC_TEXT);
+    assert(subpicture_region_IsText( region ));
 
     vlc_mutex_lock(&sys->textlock);
     filter_t *text = sys->text;
@@ -806,13 +806,13 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
     *dst_area = spu_area_create(0,0, 0,0, scale_size);
 
     /* Render text region */
-    if (region->fmt.i_chroma == VLC_CODEC_TEXT)
+    if (subpicture_region_IsText( region ))
     {
         if(SpuRenderText(spu, region,
                       i_original_width, i_original_height,
                       chroma_list) != VLC_SUCCESS)
             return NULL;
-        assert(region->fmt.i_chroma != VLC_CODEC_TEXT);
+        assert(!subpicture_region_IsText( region ));
     }
 
     video_format_AdjustColorSpace(&region->fmt);
@@ -1245,7 +1245,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
             /* Check scale validity */
             assert(scale.w != 0 && scale.h != 0);
 
-            const bool do_external_scale = external_scale && region->fmt.i_chroma != VLC_CODEC_TEXT;
+            const bool do_external_scale = external_scale && !subpicture_region_IsText( region );
             spu_scale_t virtual_scale = external_scale ? (spu_scale_t){ SCALE_UNIT, SCALE_UNIT } : scale;
 
             /* */
@@ -1519,7 +1519,7 @@ static void spu_PrerenderText(spu_t *spu, subpicture_t *p_subpic,
     subpicture_region_t *region;
     for (region = p_subpic->p_region; region != NULL; region = region->p_next)
     {
-        if(region->fmt.i_chroma != VLC_CODEC_TEXT)
+        if(!subpicture_region_IsText( region ))
             continue;
         SpuRenderText(spu, region,
                       i_original_picture_width, i_original_picture_height,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4946185a1135488a9dde934cab02e397d75c17fb...c73d6436fd7919091df9398d52eb74529bf17ccd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4946185a1135488a9dde934cab02e397d75c17fb...c73d6436fd7919091df9398d52eb74529bf17ccd
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list