[vlc-commits] [Git][videolan/vlc][master] 11 commits: freetype: fully fix the SAR forwarding

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 9 13:56:29 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6ae0c055 by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: fully fix the SAR forwarding

cfd849f0e318a458c7734e4e0cf71516078876fc was modifying the input format rather than
the one from the region we setup in the case of YUVP.

- - - - -
49b9a60f by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: pass the draw functions as a const pointer

Rather than passing the structure in each function.

- - - - -
b960e0b5 by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: simplify the video_format_t usage on rendering

- - - - -
e90cfce3 by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: avoid passing unused parameters in local functions

RenderYUVP and RenderAXYZ are different anyway

- - - - -
90d4d0ce by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: constify the FT_BBOX parameters

- - - - -
19aba7ae by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: constify line_desc_t parameters

- - - - -
e2e4df68 by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: position the output region once it's settled

The region position is not used when rendering it.

- - - - -
e8247d8f by Steve Lhomme at 2023-11-09T12:55:09+00:00
freetype: separate input and output region internally

- - - - -
ea6bf194 by Steve Lhomme at 2023-11-09T12:55:09+00:00
text_renderer/svg: remove redundant check

The same check is done at the beginning of the function.

- - - - -
77b7e531 by Steve Lhomme at 2023-11-09T12:55:09+00:00
text_renderer/svg: use the input region to compute the width/height

- - - - -
75d83e35 by Steve Lhomme at 2023-11-09T12:55:09+00:00
vlc_filter: pass the input text region as const

- - - - -


10 changed files:

- include/vlc_filter.h
- modules/text_renderer/freetype/blend/blend.h
- modules/text_renderer/freetype/freetype.c
- modules/text_renderer/nsspeechsynthesizer.m
- modules/text_renderer/sapi.cpp
- modules/text_renderer/svg.c
- modules/text_renderer/tdummy.c
- test/src/input/decoder/input_decoder.c
- test/src/input/decoder/input_decoder.h
- test/src/input/decoder/input_decoder_scenarios.c


Changes:

=====================================
include/vlc_filter.h
=====================================
@@ -102,7 +102,7 @@ struct vlc_filter_operations
 
         /** Render text (text renderer) */
         int (*render)(filter_t *, subpicture_region_t *,
-                      subpicture_region_t *, const vlc_fourcc_t *);
+                      const subpicture_region_t *, const vlc_fourcc_t *);
     };
 
     union


=====================================
modules/text_renderer/freetype/blend/blend.h
=====================================
@@ -68,13 +68,13 @@ static void BlendAXYZLine( picture_t *p_picture,
                            int i_a, int i_x, int i_y, int i_z,
                            const line_character_t *p_current,
                            const line_character_t *p_next,
-                           ft_drawing_functions draw )
+                           const ft_drawing_functions *draw )
 {
     int i_line_width = p_current->p_glyph->bitmap.width;
     if( p_next )
         i_line_width = p_next->p_glyph->left - p_current->p_glyph->left;
 
-    draw.fill( p_picture,
+    draw->fill( p_picture,
                i_a, i_x, i_y, i_z,
                i_picture_x, i_picture_y + p_current->i_line_offset,
                i_line_width, p_current->i_line_thickness );


=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -342,13 +342,12 @@ error:
  *****************************************************************************
  * This function merges the previously rendered freetype glyphs into a picture
  *****************************************************************************/
-static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
-                       line_desc_t *p_line,
-                       FT_BBox *p_regionbbox, FT_BBox *p_paddedbbox,
-                       FT_BBox *p_bbox )
+static int RenderYUVP( const subpicture_region_t *p_region_in,
+                       subpicture_region_t *p_region,
+                       const line_desc_t *p_line,
+                       const FT_BBox *p_regionbbox,
+                       const FT_BBox *p_bbox )
 {
-    VLC_UNUSED(p_filter);
-    VLC_UNUSED(p_paddedbbox);
     static const uint8_t pi_gamma[16] =
         {0x00, 0x52, 0x84, 0x96, 0xb8, 0xca, 0xdc, 0xee, 0xff,
           0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -365,22 +364,23 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
     fmt.i_visible_width  = p_regionbbox->xMax - p_regionbbox->xMin + 4;
     fmt.i_height         =
     fmt.i_visible_height = p_regionbbox->yMax - p_regionbbox->yMin + 4;
-    const unsigned regionnum = p_region->fmt.i_sar_num;
-    const unsigned regionden = p_region->fmt.i_sar_den;
     fmt.i_sar_num = fmt.i_sar_den = 1;
-    fmt.transfer  = p_region->fmt.transfer;
-    fmt.primaries = p_region->fmt.primaries;
-    fmt.space     = p_region->fmt.space;
-    fmt.mastering = p_region->fmt.mastering;
+    fmt.transfer  = p_region_in->fmt.transfer;
+    fmt.primaries = p_region_in->fmt.primaries;
+    fmt.space     = p_region_in->fmt.space;
+    fmt.mastering = p_region_in->fmt.mastering;
 
     assert( !p_region->p_picture );
     p_region->p_picture = picture_NewFromFormat( &fmt );
     if( !p_region->p_picture )
         return VLC_EGENERIC;
-    fmt.p_palette = p_region->fmt.p_palette ? p_region->fmt.p_palette : malloc(sizeof(*fmt.p_palette));
+    fmt.p_palette = p_region_in->fmt.p_palette ? p_region_in->fmt.p_palette : malloc(sizeof(*fmt.p_palette));
+
+    const unsigned regionnum = p_region_in->fmt.i_sar_num;
+    const unsigned regionden = p_region_in->fmt.i_sar_den;
     p_region->fmt = fmt;
-    fmt.i_sar_num = regionnum;
-    fmt.i_sar_den = regionden;
+    p_region->fmt.i_sar_num = regionnum;
+    p_region->fmt.i_sar_den = regionden;
 
     /* Calculate text color components
      * Only use the first color */
@@ -412,7 +412,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
 
     for( ; p_line != NULL; p_line = p_line->p_next )
     {
-        FT_Vector offset = GetAlignedOffset( p_line, p_bbox, p_region->i_align );
+        FT_Vector offset = GetAlignedOffset( p_line, p_bbox, p_region_in->i_align );
 
         for( i = 0; i < p_line->i_character_count; i++ )
         {
@@ -467,17 +467,17 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
  * This function merges the previously rendered freetype glyphs into a picture
  *****************************************************************************/
 
-static void RenderBackground( subpicture_region_t *p_region,
-                                     line_desc_t *p_line_head,
-                                     FT_BBox *p_regionbbox,
-                                     FT_BBox *p_paddedbbox,
-                                     FT_BBox *p_textbbox,
+static void RenderBackground( const subpicture_region_t *p_region_in,
+                                     const line_desc_t *p_line_head,
+                                     const FT_BBox *p_regionbbox,
+                                     const FT_BBox *p_paddedbbox,
+                                     const FT_BBox *p_textbbox,
                                      picture_t *p_picture,
-                                     ft_drawing_functions draw )
+                                     const ft_drawing_functions *draw )
 {
     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->text_flags & SUBPICTURE_ALIGN_MASK );
+        FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region_in->text_flags & SUBPICTURE_ALIGN_MASK );
 
         FT_BBox linebgbox = p_line->bbox;
         linebgbox.xMin += offset.x;
@@ -531,7 +531,7 @@ static void RenderBackground( subpicture_region_t *p_region,
             if( p_char->p_style->i_style_flags & STYLE_BACKGROUND )
             {
                 uint8_t i_x, i_y, i_z;
-                draw.extract( p_char->p_style->i_background_color,
+                draw->extract( p_char->p_style->i_background_color,
                                  &i_x, &i_y, &i_z );
                 const uint8_t i_alpha = p_char->p_style->i_background_alpha;
 
@@ -543,13 +543,13 @@ static void RenderBackground( subpicture_region_t *p_region,
                     {
                         .xMin = __MAX(0, segmentbgbox.xMin - p_regionbbox->xMin),
                         .xMax = VLC_CLIP(segmentbgbox.xMax - p_regionbbox->xMin,
-                                         0, p_region->fmt.i_visible_width),
+                                         0, p_region_in->fmt.i_visible_width),
                         .yMin = VLC_CLIP(p_regionbbox->yMax - segmentbgbox.yMin,
-                                         0, p_region->fmt.i_visible_height),
+                                         0, p_region_in->fmt.i_visible_height),
                         .yMax = __MAX(0, p_regionbbox->yMax - segmentbgbox.yMax),
                     };
 
-                    draw.fill( p_picture, i_alpha, i_x, i_y, i_z,
+                    draw->fill( p_picture, i_alpha, i_x, i_y, i_z,
                                absbox.xMin, absbox.yMax,
                                absbox.xMax - absbox.xMin, absbox.yMin - absbox.yMax );
                 }
@@ -569,7 +569,7 @@ static void RenderCharAXYZ( filter_t *p_filter,
                            int i_offset_x,
                            int i_offset_y,
                            int g,
-                           ft_drawing_functions draw )
+                           const ft_drawing_functions *draw )
 {
     VLC_UNUSED(p_filter);
     /* Render all glyphs and underline/strikethrough */
@@ -617,12 +617,12 @@ static void RenderCharAXYZ( filter_t *p_filter,
             continue;
 
         uint8_t i_x, i_y, i_z;
-        draw.extract( i_color, &i_x, &i_y, &i_z );
+        draw->extract( i_color, &i_x, &i_y, &i_z );
 
         int i_glyph_y = i_offset_y - p_glyph->top;
         int i_glyph_x = i_offset_x + p_glyph->left;
 
-        draw.blend( p_picture, i_glyph_x, i_glyph_y,
+        draw->blend( p_picture, i_glyph_x, i_glyph_y,
                     i_a, i_x, i_y, i_z, p_glyph );
 
         /* underline/strikethrough are only rendered for the normal glyph */
@@ -637,14 +637,14 @@ static void RenderCharAXYZ( filter_t *p_filter,
 }
 
 static inline int RenderAXYZ( filter_t *p_filter,
+                              const subpicture_region_t *p_region_in,
                               subpicture_region_t *p_region,
-                              line_desc_t *p_line_head,
-                              FT_BBox *p_regionbbox,
-                              FT_BBox *p_paddedtextbbox,
-                              FT_BBox *p_textbbox,
+                              const line_desc_t *p_line_head,
+                              const FT_BBox *p_regionbbox,
+                              const FT_BBox *p_paddedtextbbox,
+                              const FT_BBox *p_textbbox,
                               vlc_fourcc_t i_chroma,
-                              const video_format_t *fmt_out,
-                              ft_drawing_functions draw )
+                              const ft_drawing_functions *draw )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
 
@@ -655,18 +655,18 @@ static inline int RenderAXYZ( filter_t *p_filter,
     fmt.i_visible_width  = p_regionbbox->xMax - p_regionbbox->xMin;
     fmt.i_height         =
     fmt.i_visible_height = p_regionbbox->yMax - p_regionbbox->yMin;
-    const unsigned regionnum = p_region->fmt.i_sar_num;
-    const unsigned regionden = p_region->fmt.i_sar_den;
     fmt.i_sar_num = fmt.i_sar_den = 1;
-    fmt.transfer  = fmt_out->transfer;
-    fmt.primaries = fmt_out->primaries;
-    fmt.space     = fmt_out->space;
-    fmt.mastering = fmt_out->mastering;
+    fmt.transfer  = p_region_in->fmt.transfer;
+    fmt.primaries = p_region_in->fmt.primaries;
+    fmt.space     = p_region_in->fmt.space;
+    fmt.mastering = p_region_in->fmt.mastering;
 
     picture_t *p_picture = p_region->p_picture = picture_NewFromFormat( &fmt );
     if( !p_region->p_picture )
         return VLC_EGENERIC;
 
+    const unsigned regionnum = p_region_in->fmt.i_sar_num;
+    const unsigned regionden = p_region_in->fmt.i_sar_den;
     p_region->fmt = fmt;
     p_region->fmt.i_sar_num = regionnum;
     p_region->fmt.i_sar_den = regionden;
@@ -675,19 +675,19 @@ 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->text_flags & VLC_SUBPIC_TEXT_FLAG_NO_REGION_BG) {
+    if (p_region_in->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,
+        draw->fill( p_picture, STYLE_ALPHA_TRANSPARENT, 0x00, 0x00, 0x00,
                    0, 0, fmt.i_visible_width, fmt.i_visible_height );
     } else {
         /* Render background under entire subpicture block */
-        draw.extract( p_style->i_background_color, &i_x, &i_y, &i_z );
-        draw.fill( p_picture, p_style->i_background_alpha, i_x, i_y, i_z,
+        draw->extract( p_style->i_background_color, &i_x, &i_y, &i_z );
+        draw->fill( p_picture, p_style->i_background_alpha, i_x, i_y, i_z,
                    0, 0, fmt.i_visible_width, fmt.i_visible_height );
     }
 
     /* Render text's background (from decoder) if any */
-    RenderBackground(p_region, p_line_head,
+    RenderBackground(p_region_in, p_line_head,
                      p_regionbbox, p_paddedtextbbox, p_textbbox,
                      p_picture, draw);
 
@@ -695,9 +695,9 @@ static inline int RenderAXYZ( filter_t *p_filter,
     for( int g = 0; g < 3; g++ )
     {
         /* Render all lines */
-        for( line_desc_t *p_line = p_line_head; p_line != NULL; p_line = p_line->p_next )
+        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->text_flags & SUBPICTURE_ALIGN_MASK );
+            FT_Vector offset = GetAlignedOffset( p_line, p_textbbox, p_region_in->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;
@@ -976,7 +976,7 @@ static size_t SegmentsToTextAndStyles( filter_t *p_filter, const text_segment_t
  * the vout method by this module
  */
 static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
-                         subpicture_region_t *p_region_in,
+                         const subpicture_region_t *p_region_in,
                          const vlc_fourcc_t *p_chroma_list )
 {
     if( !p_region_in || !p_region_in->p_text )
@@ -1117,68 +1117,70 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
         *        but update offsets to keep position and have same rendering */
 //        if( (bboxcolor & 0xFF) == 0 )
     {
-        p_region_out->i_x = (paddedbbox.xMin - regionbbox.xMin) + p_region_in->i_x;
-        p_region_out->i_y = (regionbbox.yMax - paddedbbox.yMax) + p_region_in->i_y;
         regionbbox = paddedbbox;
     }
-//        else /* case where the bounding box is larger and visible */
-//        {
-//            p_region_out->i_x = p_region_in->i_x;
-//            p_region_out->i_y = p_region_in->i_y;
-//        }
-
-    enum
-    {
-        DRAW_YUVA = 0,
-        DRAW_RGBA,
-        DRAW_ARGB,
-    };
-
-    const ft_drawing_functions drawfuncs[] =
-    {
-        [DRAW_YUVA] = { .extract = YUVFromXRGB,
-                        .fill =    FillYUVAPicture,
-                        .blend =   BlendGlyphToYUVA },
-        [DRAW_RGBA] = { .extract = RGBFromXRGB,
-                        .fill =    FillRGBAPicture,
-                        .blend =   BlendGlyphToRGBA },
-        [DRAW_ARGB] = { .extract = RGBFromXRGB,
-                        .fill =    FillARGBPicture,
-                        .blend =   BlendGlyphToARGB },
-    };
 
     rv = VLC_EGENERIC;
     for( const vlc_fourcc_t *p_chroma = p_chroma_list; *p_chroma != 0; p_chroma++ )
     {
         if( *p_chroma == VLC_CODEC_YUVP )
-            rv = RenderYUVP( p_filter, p_region_out, text_block.p_laid,
-                                &regionbbox, &paddedbbox, &bbox );
-        else if( *p_chroma == VLC_CODEC_YUVA )
-            rv = RenderAXYZ( p_filter, p_region_out, text_block.p_laid,
-                                &regionbbox, &paddedbbox, &bbox,
-                                VLC_CODEC_YUVA,
-                                &p_region_out->fmt,
-                                drawfuncs[DRAW_YUVA] );
-        else if( *p_chroma == VLC_CODEC_RGBA
-                || *p_chroma == VLC_CODEC_BGRA )
-            rv = RenderAXYZ( p_filter, p_region_out, text_block.p_laid,
-                                &regionbbox, &paddedbbox, &bbox,
-                                *p_chroma,
-                                &p_region_out->fmt,
-                                drawfuncs[DRAW_RGBA] );
-        else if( *p_chroma == VLC_CODEC_ARGB
-                || *p_chroma == VLC_CODEC_ABGR)
-            rv = RenderAXYZ( p_filter, p_region_out, text_block.p_laid,
-                                &regionbbox, &paddedbbox, &bbox,
-                                *p_chroma,
-                                &p_region_out->fmt,
-                                drawfuncs[DRAW_ARGB] );
+            rv = RenderYUVP( p_region_in, p_region_out, text_block.p_laid,
+                             &regionbbox, &bbox );
         else
-            continue;
+        {
+            const ft_drawing_functions *func;
+            if( *p_chroma == VLC_CODEC_YUVA )
+            {
+                static const ft_drawing_functions DRAW_YUVA =
+                    { .extract = YUVFromXRGB,
+                      .fill =    FillYUVAPicture,
+                      .blend =   BlendGlyphToYUVA };
+                func = &DRAW_YUVA;
+            }
+            else if( *p_chroma == VLC_CODEC_RGBA
+                  || *p_chroma == VLC_CODEC_BGRA )
+            {
+                static const ft_drawing_functions DRAW_RGBA =
+                    { .extract = RGBFromXRGB,
+                      .fill =    FillRGBAPicture,
+                      .blend =   BlendGlyphToRGBA };
+                func = &DRAW_RGBA;
+            }
+            else if( *p_chroma == VLC_CODEC_ARGB
+                  || *p_chroma == VLC_CODEC_ABGR)
+            {
+                static const ft_drawing_functions DRAW_ARGB =
+                    { .extract = RGBFromXRGB,
+                      .fill =    FillARGBPicture,
+                      .blend =   BlendGlyphToARGB };
+                func = &DRAW_ARGB;
+            }
+            else
+                continue;
+
+            rv = RenderAXYZ( p_filter, p_region_in, p_region_out, text_block.p_laid,
+                             &regionbbox, &paddedbbox, &bbox,
+                             *p_chroma,
+                             func );
+        }
 
         if( rv == VLC_SUCCESS )
         {
             subpicture_region_TextMarkRendered( p_region_out );
+
+            /* Avoid useless pixels:
+                *        reshrink/trim Region Box to padded text one,
+                *        but update offsets to keep position and have same rendering */
+//          if( (bboxcolor & 0xFF) == 0 )
+            {
+                p_region_out->i_x = (paddedbbox.xMin - regionbbox.xMin) + p_region_in->i_x;
+                p_region_out->i_y = (regionbbox.yMax - paddedbbox.yMax) + p_region_in->i_y;
+            }
+//          else /* case where the bounding box is larger and visible */
+//          {
+//              p_region_out->i_x = p_region_in->i_x;
+//              p_region_out->i_y = p_region_in->i_y;
+//          }
             break;
         }
     }


=====================================
modules/text_renderer/nsspeechsynthesizer.m
=====================================
@@ -39,7 +39,7 @@ static int Create (filter_t *);
 static void Destroy(filter_t *);
 static int RenderText(filter_t *,
                       subpicture_region_t *,
-                      subpicture_region_t *,
+                      const subpicture_region_t *,
                       const vlc_fourcc_t *);
 
 vlc_module_begin ()
@@ -99,12 +99,12 @@ static NSString * languageCodeForString(NSString *string) {
 
 static int RenderText(filter_t *p_filter,
                       subpicture_region_t *p_region_out,
-                      subpicture_region_t *p_region_in,
+                      const subpicture_region_t *p_region_in,
                       const vlc_fourcc_t *p_chroma_list)
 {
     @autoreleasepool {
         filter_sys_t *p_sys = p_filter->p_sys;
-        text_segment_t *p_segment = p_region_in->p_text;
+        const text_segment_t *p_segment = p_region_in->p_text;
 
         if (!p_segment)
             return VLC_EGENERIC;


=====================================
modules/text_renderer/sapi.cpp
=====================================
@@ -58,7 +58,7 @@ static int Create (filter_t *);
 static void Destroy(filter_t *);
 static int RenderText(filter_t *,
                       subpicture_region_t *,
-                      subpicture_region_t *,
+                      const subpicture_region_t *,
                       const vlc_fourcc_t *);
 }
 
@@ -100,7 +100,7 @@ struct filter_sapi
         union {
             struct {
                 int result;
-                subpicture_region_t *region;
+                const subpicture_region_t *region;
             } render_text;
         };
     } cmd;
@@ -125,10 +125,10 @@ struct MTAGuard
 }
 
 static int RenderTextMTA(filter_t *p_filter,
-        subpicture_region_t * p_region_in)
+        const subpicture_region_t * p_region_in)
 {
     struct filter_sapi *p_sys = static_cast<struct filter_sapi *>( p_filter->p_sys );
-    text_segment_t *p_segment = p_region_in->p_text;
+    const text_segment_t *p_segment = p_region_in->p_text;
 
     if (!p_segment)
         return VLC_EGENERIC;
@@ -215,7 +215,7 @@ error:
 
 static int RenderText(filter_t *p_filter,
         subpicture_region_t *,
-        subpicture_region_t *region_in,
+        const subpicture_region_t *region_in,
         const vlc_fourcc_t *)
 {
     auto *sys = static_cast<struct filter_sapi *>( p_filter->p_sys );


=====================================
modules/text_renderer/svg.c
=====================================
@@ -50,7 +50,7 @@
 static int  Create    ( filter_t * );
 static void Destroy   ( filter_t * );
 static int  RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
-                        subpicture_region_t *p_region_in,
+                        const subpicture_region_t *p_region_in,
                         const vlc_fourcc_t * );
 
 typedef struct
@@ -329,7 +329,7 @@ static char * SegmentsToSVG( text_segment_t *p_segment, int i_height, int *pi_to
 }
 
 static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
-                       subpicture_region_t *p_region_in,
+                       const subpicture_region_t *p_region_in,
                        const vlc_fourcc_t *p_chroma_list )
 {
     /* Sanity check */
@@ -348,12 +348,12 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
     p_region_out->i_y = p_region_in->i_y;
 
     unsigned i_width = p_filter->fmt_out.video.i_visible_width;
-    if( (unsigned) p_region_out->i_x <= i_width )
-        i_width -= p_region_out->i_x;
+    if( (unsigned) p_region_in->i_x <= i_width )
+        i_width -= p_region_in->i_x;
 
     unsigned i_height = p_filter->fmt_out.video.i_visible_height;
-    if( (unsigned) p_region_out->i_y <= i_height )
-        i_height -= p_region_out->i_y;
+    if( (unsigned) p_region_in->i_y <= i_height )
+        i_height -= p_region_in->i_y;
 
     if( i_height == 0 || i_width == 0 )
         return VLC_EGENERIC;
@@ -361,7 +361,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
     char *psz_svg;
     /* Check if the data is SVG or pure text. In the latter case,
        convert the text to SVG. FIXME: find a better test */
-    if( p_region_in->p_text && strstr( p_region_in->p_text->psz_text, "<svg" ) )
+    if( strstr( p_region_in->p_text->psz_text, "<svg" ) )
     {
         psz_svg = strdup( p_region_in->p_text->psz_text );
     }


=====================================
modules/text_renderer/tdummy.c
=====================================
@@ -38,7 +38,7 @@ vlc_module_end ()
 
 
 static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
-                       subpicture_region_t *p_region_in,
+                       const subpicture_region_t *p_region_in,
                        const vlc_fourcc_t *p_chroma_list )
 {
     VLC_UNUSED(p_filter); VLC_UNUSED(p_region_out); VLC_UNUSED(p_region_in);


=====================================
test/src/input/decoder/input_decoder.c
=====================================
@@ -256,7 +256,7 @@ static int OpenWindow(vlc_window_t *wnd)
 }
 
 static int TextRendererRender(filter_t *filter, subpicture_region_t *region_out,
-                              subpicture_region_t *region_in,
+                              const subpicture_region_t *region_in,
                               const vlc_fourcc_t *chroma_list)
 {
     (void) region_out; (void) chroma_list;


=====================================
test/src/input/decoder/input_decoder.h
=====================================
@@ -43,7 +43,7 @@ struct input_decoder_scenario {
     vlc_frame_t * (*packetizer_getcc)(decoder_t *, decoder_cc_desc_t *);
     void (*decoder_flush)(decoder_t *);
     void (*display_prepare)(vout_display_t *vd, picture_t *pic);
-    void (*text_renderer_render)(filter_t *filter, subpicture_region_t *region_in);
+    void (*text_renderer_render)(filter_t *filter, const subpicture_region_t *region_in);
     void (*player_setup_before_start)(vlc_player_t *);
     void (*interface_setup)(intf_thread_t *intf);
     int (*sout_filter_send)(sout_stream_t *stream, void *id, block_t *block);


=====================================
test/src/input/decoder/input_decoder_scenarios.c
=====================================
@@ -505,7 +505,7 @@ static void display_prepare_noop(vout_display_t *vd, picture_t *pic)
     (void)vd; (void) pic;
 }
 
-static void cc_text_renderer_render(filter_t *filter, subpicture_region_t *region_in)
+static void cc_text_renderer_render(filter_t *filter, const subpicture_region_t *region_in)
 {
     (void) filter;
     assert(strcmp(region_in->p_text->psz_text, cc_block_decoded) == 0);
@@ -542,7 +542,7 @@ static int cc_decoder_decode_channel(decoder_t *dec, vlc_frame_t *in)
 }
 
 static void cc_text_renderer_render_708_1064(filter_t *filter,
-                                             subpicture_region_t *region_in)
+                                             const subpicture_region_t *region_in)
 {
     (void) filter;
     /* Make sure each tracks are rendered once */
@@ -597,7 +597,7 @@ static void cc_decoder_setup_608(decoder_t *dec)
 }
 
 static void cc_text_renderer_render_608_02(filter_t *filter,
-                                           subpicture_region_t *region_in)
+                                           const subpicture_region_t *region_in)
 {
     (void) filter;
     assert(strcmp(region_in->p_text->psz_text, "cc02_dec") == 0);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5f449148afe3cea25a369c039bbad8b5c60dbe1c...75d83e3501d9e79bb9f080477f8481928da06edd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5f449148afe3cea25a369c039bbad8b5c60dbe1c...75d83e3501d9e79bb9f080477f8481928da06edd
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