[vlc-commits] [Git][videolan/vlc][master] 4 commits: video_epg: avoid calling vout_OSDRegionConstrain with NULL value
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Aug 5 12:20:12 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
610ad85d by Steve Lhomme at 2023-08-05T12:03:43+00:00
video_epg: avoid calling vout_OSDRegionConstrain with NULL value
We already test for NULL after the calls.
- - - - -
6032d1ac by Steve Lhomme at 2023-08-05T12:03:43+00:00
subpicture: ensure RGBP has a palette too
Outside of YUVP and RGBP there should be no palette.
Plus some code moving/cleaning.
- - - - -
23b5047c by Steve Lhomme at 2023-08-05T12:03:43+00:00
subpicture: constify spu_PrerenderText()
- - - - -
7e4a7621 by Steve Lhomme at 2023-08-05T12:03:43+00:00
subpictures: mark text rendering without a text renderer as rare
- - - - -
3 changed files:
- src/misc/subpicture.c
- src/video_output/video_epg.c
- src/video_output/vout_subpictures.c
Changes:
=====================================
src/misc/subpicture.c
=====================================
@@ -204,21 +204,19 @@ void subpicture_region_private_Delete( subpicture_region_private_t *p_private )
subpicture_region_t * subpicture_region_NewInternal( const video_format_t *p_fmt )
{
subpicture_region_t *p_region = calloc( 1, sizeof(*p_region ) );
- if( !p_region )
+ if( unlikely(p_region == NULL) )
return NULL;
- p_region->zoom_h.den = p_region->zoom_h.num = 1;
- p_region->zoom_v.den = p_region->zoom_v.num = 1;
-
- if ( p_fmt->i_chroma == VLC_CODEC_YUVP )
+ video_format_Copy( &p_region->fmt, p_fmt );
+ if ( p_fmt->i_chroma == VLC_CODEC_YUVP || p_fmt->i_chroma == VLC_CODEC_RGBP )
{
- video_format_Copy( &p_region->fmt, p_fmt );
- /* YUVP should have a palette */
+ /* YUVP/RGBP should have a palette */
if( p_region->fmt.p_palette == NULL )
{
p_region->fmt.p_palette = calloc( 1, sizeof(*p_region->fmt.p_palette) );
if( p_region->fmt.p_palette == NULL )
{
+ video_format_Clean( &p_region->fmt );
free( p_region );
return NULL;
}
@@ -226,10 +224,11 @@ subpicture_region_t * subpicture_region_NewInternal( const video_format_t *p_fmt
}
else
{
- p_region->fmt = *p_fmt;
- p_region->fmt.p_palette = NULL;
+ assert(p_fmt->p_palette == NULL);
}
+ 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;
=====================================
src/video_output/video_epg.c
=====================================
@@ -244,11 +244,8 @@ static subpicture_region_t * vout_OSDImage( vlc_object_t *p_obj,
static void vout_OSDRegionConstrain(subpicture_region_t *p_region, int w, int h)
{
- if( p_region )
- {
- p_region->i_max_width = w;
- p_region->i_max_height = h;
- }
+ p_region->i_max_width = w;
+ p_region->i_max_height = h;
}
static subpicture_region_t * vout_OSDTextRegion(text_segment_t *p_segment,
@@ -356,10 +353,12 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys,
x,
y + height * OSDEPG_ROW(2),
height * EPGOSD_TEXTSIZE_PROG);
- /* region rendering limits */
- vout_OSDRegionConstrain(*last_ptr, width, 0);
if(*last_ptr)
+ {
+ /* region rendering limits */
+ vout_OSDRegionConstrain(*last_ptr, width, 0);
last_ptr = &(*last_ptr)->p_next;
+ }
}
/* NEXT EVENT */
@@ -369,10 +368,12 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys,
x,
y + height * OSDEPG_ROW(5),
height * EPGOSD_TEXTSIZE_PROG);
- /* region rendering limits */
- vout_OSDRegionConstrain(*last_ptr, width, 0);
if(*last_ptr)
+ {
+ /* region rendering limits */
+ vout_OSDRegionConstrain(*last_ptr, width, 0);
last_ptr = &(*last_ptr)->p_next;
+ }
}
if(p_sys->time && p_sys->epg->p_current)
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -325,7 +325,7 @@ static int SpuRenderText(spu_t *spu,
vlc_mutex_lock(&sys->textlock);
filter_t *text = sys->text;
- if(!text)
+ if(unlikely(text == NULL))
{
vlc_mutex_unlock(&sys->textlock);
return VLC_EGENERIC;
@@ -1479,8 +1479,8 @@ static void spu_PrerenderSync(spu_private_t *sys, const subpicture_t *p_subpic)
}
static void spu_PrerenderText(spu_t *spu, subpicture_t *p_subpic,
- video_format_t *fmtsrc, video_format_t *fmtdst,
- vlc_fourcc_t *chroma_list)
+ const video_format_t *fmtsrc, const video_format_t *fmtdst,
+ const vlc_fourcc_t *chroma_list)
{
if (p_subpic->i_original_picture_width == 0 ||
p_subpic->i_original_picture_height == 0) {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5d248af24e56956205bda2b8c599fc84f90120d...7e4a7621f2be635306381202837a4e299be588d9
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5d248af24e56956205bda2b8c599fc84f90120d...7e4a7621f2be635306381202837a4e299be588d9
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