Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
afc47bc0 by Steve Lhomme at 2024-04-03T20:41:03+00:00
vout_subpictures: keep the text region rendered at the last minute

Just like the other call to SpuRenderText.

- - - - -
d3531da8 by Steve Lhomme at 2024-04-03T20:41:03+00:00
vout_subpictures: don't cache the position of absolute subtitles

They are using absolute position inside the video, they should
always render in the same place.

- - - - -
88fc7594 by Steve Lhomme at 2024-04-03T20:41:03+00:00
vout_subpictures: find cached subtitle position from a const vector

- - - - -
2cb6980d by Steve Lhomme at 2024-04-03T20:41:03+00:00
vout_subpictures: check the cache positioning of subtitles worked

- - - - -


1 changed file:

- src/video_output/vout_subpictures.c


Changes:

=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -636,7 +636,7 @@ static void 
subtitles_positions_FinishUpdate(subtitles_positions_vector *subs)
 }
 
 static struct subtitle_position_cache *subtitles_positions_FindRegion(
-    subtitles_positions_vector *subs,
+    const subtitles_positions_vector *subs,
     const subpicture_t *subpic,
     const subpicture_region_t *region)
 {
@@ -1416,7 +1416,6 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t 
*spu,
             spu_area_t area;
 
             /* last minute text rendering */
-            subpicture_region_t *rendered_region = region;
             if (unlikely(subpicture_region_IsText( region )))
             {
                 subpicture_region_t *rendered_text =
@@ -1426,9 +1425,12 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t 
*spu,
                 if ( rendered_text  == NULL)
                     // not a rendering error for Text-To-Speech
                     continue;
-                rendered_region = rendered_text;
+                // replace the text region with the rendered region
+                vlc_list_replace(&region->node, &rendered_text->node);
+                subpicture_region_Delete(region);
+                region = rendered_text;
             }
-            region_FixFmt(rendered_region);
+            region_FixFmt(region);
 
             /* Compute region scale AR */
             vlc_rational_t region_sar = (vlc_rational_t) {
@@ -1463,23 +1465,21 @@ static vlc_render_subpicture 
*SpuRenderSubpictures(spu_t *spu,
 
             subpicture_t forced_subpic = *subpic;
             struct subtitle_position_cache *cache_pos =
-                subtitles_positions_FindRegion(&spu->p->subs_pos, subpic, 
rendered_region);
+                subtitles_positions_FindRegion(&spu->p->subs_pos, subpic, 
region);
             if (cache_pos != NULL)
             {
-                rendered_region->i_x = cache_pos->x;
-                rendered_region->i_y = cache_pos->y;
+                region->i_x = cache_pos->x;
+                region->i_y = cache_pos->y;
                 forced_subpic.b_absolute = true;
             }
 
             /* */
             output_last_ptr = SpuRenderRegion(spu, &area,
                             &forced_subpic, entry->channel_order,
-                            rendered_region, scale, !external_scale,
+                            region, scale, !external_scale,
                             chroma_list, output_width, output_height,
                             subtitle_area, subtitle_area_count,
                             subpic->b_subtitle ? render_subtitle_date : 
system_now);
-            if (rendered_region != region)
-                subpicture_region_Delete( rendered_region );
             if (unlikely(output_last_ptr == NULL))
                 continue;
 
@@ -1489,9 +1489,15 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t 
*spu,
                 output_last_ptr->place.y += video_position->y;
             }
 
+            if (cache_pos != NULL)
+            {
+                assert(output_last_ptr->place.x == cache_pos->x);
+                assert(output_last_ptr->place.y == cache_pos->y);
+            }
+
             vlc_vector_push(&output->regions, output_last_ptr);
 
-            if (subpic->b_subtitle) {
+            if (subpic->b_subtitle && !subpic->b_absolute) {
                 if (!external_scale)
                     area = spu_area_unscaled(area, scale);
                 if (subtitle_area)



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/d1d84260bca02036d3cc16db0a450163cf510650...2cb6980d38930081a67d9e61b3c89d62e098a2e7

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


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to