[vlc-commits] [Git][videolan/vlc][master] 2 commits: bluray: pass a NULL video format to subpicture_region_ForPicture()

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon May 19 14:18:52 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e00b1292 by Steve Lhomme at 2025-05-19T13:58:18+00:00
bluray: pass a NULL video format to subpicture_region_ForPicture()

All the regions pushed to the internal regions are created with
subpicture_region_New(),
so the picture has the same video_format_t as the region video_format_t.
These video formats in the internal regions are never modified either.

- - - - -
87b3968a by Steve Lhomme at 2025-05-19T13:58:18+00:00
vlc_subpicture: remove always NULL format in subpicture_region_ForPicture()

This makes the code less confusing.

- - - - -


10 changed files:

- include/vlc_subpicture.h
- modules/access/bluray.c
- modules/codec/ttml/imageupdater.h
- modules/spu/dynamicoverlay/dynamicoverlay.c
- modules/spu/logo.c
- modules/spu/mosaic.c
- modules/spu/rss.c
- modules/text_renderer/svg.c
- src/misc/subpicture.c
- src/video_output/vout_spuregion_helper.h


Changes:

=====================================
include/vlc_subpicture.h
=====================================
@@ -147,11 +147,9 @@ VLC_API subpicture_region_t * subpicture_region_NewText( void );
  * The dimensions of the format should not exceed the ones of the picture. This
  * is not checked explicitly in the function.
  *
- * \param p_fmt format for the subpicture cropping/SAR (may be NULL)
- *
  * \note if p_fmt is NULL, the format of the picture will be used.
  */
-VLC_API subpicture_region_t * subpicture_region_ForPicture( const video_format_t *p_fmt, picture_t *pic );
+VLC_API subpicture_region_t * subpicture_region_ForPicture( picture_t *pic );
 
 /**
  * This function will destroy a subpicture region allocated by


=====================================
modules/access/bluray.c
=====================================
@@ -1611,7 +1611,7 @@ static void subpictureUpdaterUpdate(subpicture_t *p_subpic,
     const subpicture_region_t *p_src;
     subpicture_region_t *p_dst;
     vlc_spu_regions_foreach_const(p_src, &p_overlay->regions) {
-        p_dst = subpicture_region_ForPicture(&p_src->fmt, p_src->p_picture);
+        p_dst = subpicture_region_ForPicture(p_src->p_picture);
         if (p_dst == NULL)
             break;
 


=====================================
modules/codec/ttml/imageupdater.h
=====================================
@@ -91,7 +91,7 @@ static void TTML_ImageSpuUpdate(subpicture_t *p_spu,
     for(ttml_image_updater_region_t *p_updtregion = p_sys->p_regions;
                                      p_updtregion; p_updtregion = p_updtregion->p_next)
     {
-        subpicture_region_t *r = subpicture_region_ForPicture(NULL, p_updtregion->p_pic);
+        subpicture_region_t *r = subpicture_region_ForPicture(p_updtregion->p_pic);
         if (unlikely(r == NULL))
             return;
 


=====================================
modules/spu/dynamicoverlay/dynamicoverlay.c
=====================================
@@ -360,7 +360,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
         if( p_overlay->type == OVERLAY_IS_TEXT )
             p_region = subpicture_region_NewText();
         else
-            p_region = subpicture_region_ForPicture( NULL, p_overlay->data.p_pic );
+            p_region = subpicture_region_ForPicture( p_overlay->data.p_pic );
         if( unlikely(p_region == NULL) )
         {
             break;


=====================================
modules/spu/logo.c
=====================================
@@ -361,7 +361,7 @@ static subpicture_t *FilterSub( filter_t *p_filter, vlc_tick_t date )
         goto exit;
 
     /* Create new SPU region */
-    p_region = subpicture_region_ForPicture( NULL, p_pic );
+    p_region = subpicture_region_ForPicture( p_pic );
     if( !p_region )
     {
         msg_Err( p_filter, "cannot allocate SPU region" );


=====================================
modules/spu/mosaic.c
=====================================
@@ -644,7 +644,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
             }
         }
 
-        p_region = subpicture_region_ForPicture( NULL, p_converted );
+        p_region = subpicture_region_ForPicture( p_converted );
         if( !p_sys->b_keep )
             picture_Release( p_converted );
 


=====================================
modules/spu/rss.c
=====================================
@@ -500,7 +500,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
         /* Display the feed's image */
         picture_t *p_pic = p_feed->p_pic;
 
-        subpicture_region_t *p_region = subpicture_region_ForPicture( NULL, p_pic );
+        subpicture_region_t *p_region = subpicture_region_ForPicture( p_pic );
         if( likely(p_region) )
         {
             p_region->i_x = region->i_x;


=====================================
modules/text_renderer/svg.c
=====================================
@@ -385,7 +385,7 @@ static subpicture_region_t *RenderText( filter_t *p_filter,
     if (p_picture == NULL)
         return NULL;
 
-    subpicture_region_t *p_region_out = subpicture_region_ForPicture(NULL, p_picture);
+    subpicture_region_t *p_region_out = subpicture_region_ForPicture(p_picture);
     picture_Release(p_picture);
     if (unlikely(p_region_out == NULL))
         return NULL;


=====================================
src/misc/subpicture.c
=====================================
@@ -151,7 +151,7 @@ subpicture_t *subpicture_NewFromPicture( vlc_object_t *p_obj,
     p_subpic->i_original_picture_width  = fmt_out.i_visible_width;
     p_subpic->i_original_picture_height = fmt_out.i_visible_height;
 
-    subpicture_region_t *p_region = subpicture_region_ForPicture( NULL, p_pip );
+    subpicture_region_t *p_region = subpicture_region_ForPicture( p_pip );
     picture_Release( p_pip );
 
     if (likely(p_region == NULL))
@@ -313,20 +313,13 @@ subpicture_region_t *subpicture_region_NewText( void )
     return p_region;
 }
 
-subpicture_region_t *subpicture_region_ForPicture( const video_format_t *p_fmt, picture_t *pic )
+subpicture_region_t *subpicture_region_ForPicture( picture_t *pic )
 {
-    assert( !p_fmt || video_format_IsSameChroma( p_fmt, &pic->format ) );
-    if ( p_fmt && !video_format_IsSameChroma( p_fmt, &pic->format ) )
-        return NULL;
-
     subpicture_region_t *p_region = subpicture_region_NewInternal( );
     if( !p_region )
         return NULL;
 
-    if (p_fmt == NULL)
-        p_fmt = &pic->format;
-
-    video_format_Copy( &p_region->fmt, p_fmt );
+    video_format_Copy( &p_region->fmt, &pic->format );
     if ( pic->format.i_chroma == VLC_CODEC_YUVP || pic->format.i_chroma == VLC_CODEC_RGBP )
     {
         /* YUVP/RGBP should have a palette */


=====================================
src/video_output/vout_spuregion_helper.h
=====================================
@@ -84,7 +84,7 @@ spuregion_CreateFromPicture( vlc_object_t *p_this, video_format_t *p_fmt,
     if(!p_pic)
         return NULL;
 
-    subpicture_region_t *region = subpicture_region_ForPicture(NULL, p_pic);
+    subpicture_region_t *region = subpicture_region_ForPicture(p_pic);
     picture_Release( p_pic );
 
     return region;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd2c8fb5520e688a27a251adafcfa8b5b0eb9f6c...87b3968aea8f1c258dd3961e2eda890fdee9c05c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd2c8fb5520e688a27a251adafcfa8b5b0eb9f6c...87b3968aea8f1c258dd3961e2eda890fdee9c05c
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