[vlc-commits] [Git][videolan/vlc][master] vlc_subpicture: save all sizing params in updater config
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Wed Mar 18 20:26:52 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
cf515e41 by François Cartegnie at 2026-03-18T20:05:24+01:00
vlc_subpicture: save all sizing params in updater config
- - - - -
12 changed files:
- include/vlc_subpicture.h
- modules/codec/arib/libaribcaption.c
- modules/codec/arib/substext.h
- modules/codec/kate.c
- modules/codec/libass.c
- modules/codec/spudec/parse.c
- modules/codec/substext.h
- modules/codec/ttml/imageupdater.h
- src/misc/subpicture.c
- src/video_output/video_epg.c
- src/video_output/video_text.c
- src/video_output/video_widgets.c
Changes:
=====================================
include/vlc_subpicture.h
=====================================
@@ -169,17 +169,15 @@ VLC_API void vlc_spu_regions_Clear( vlc_spu_regions * );
struct vlc_spu_updater_configuration
{
- // source video format of the video under the SPU
- const video_format_t *video_src;
- // scaled video format of the video under the SPU
- const video_format_t *video_dst;
- unsigned display_width;
- unsigned display_height;
-
- // source video format of the previous vlc_spu_updater_ops.update call
- const video_format_t *prev_src;
- // scaled video format of the previous vlc_spu_updater_ops.update call
- const video_format_t *prev_dst;
+ struct
+ {
+ // source video format of the video under the SPU
+ const video_format_t *video_src;
+ // scaled video format of the video under the SPU
+ const video_format_t *video_dst;
+ unsigned display_width;
+ unsigned display_height;
+ } current, previous; // the previous vlc_spu_updater_ops.update call
// timestamp when the SPU will be displayed, between i_start and i_stop
// for subtitles
=====================================
modules/codec/arib/libaribcaption.c
=====================================
@@ -111,12 +111,12 @@ static void SubpictureUpdate(subpicture_t *p_subpic,
{
libaribcaption_spu_updater_sys_t *p_spusys = p_subpic->updater.sys;
decoder_sys_t *p_sys = p_spusys->p_dec_sys;
- const video_format_t *p_src_format = cfg->video_src;
- const video_format_t *p_dst_format = cfg->video_dst;
+ const video_format_t *p_src_format = cfg->current.video_src;
+ const video_format_t *p_dst_format = cfg->current.video_dst;
- bool b_src_changed = p_src_format->i_visible_width != cfg->prev_src->i_visible_width ||
- p_src_format->i_visible_height != cfg->prev_src->i_visible_height;
- bool b_dst_changed = !video_format_IsSimilar(cfg->prev_dst, p_dst_format);
+ bool b_src_changed = p_src_format->i_visible_width != cfg->previous.video_src->i_visible_width ||
+ p_src_format->i_visible_height != cfg->previous.video_src->i_visible_height;
+ bool b_dst_changed = !video_format_IsSimilar(cfg->previous.video_dst, p_dst_format);
unsigned i_render_area_width = p_dst_format->i_visible_width;
unsigned i_render_area_height = p_src_format->i_visible_height * p_dst_format->i_visible_width /
=====================================
modules/codec/arib/substext.h
=====================================
@@ -50,7 +50,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
const struct vlc_spu_updater_configuration *cfg)
{
arib_spu_updater_sys_t *sys = subpic->updater.sys;
- const video_format_t *fmt_dst = cfg->video_dst;
+ const video_format_t *fmt_dst = cfg->current.video_dst;
if ( !sys->first )
return;
=====================================
modules/codec/kate.c
=====================================
@@ -804,15 +804,15 @@ static void TigerUpdateSubpicture( subpicture_t *p_subpic,
{
kate_spu_updater_sys_t *p_spusys = p_subpic->updater.sys;
decoder_sys_t *p_sys = p_spusys->p_dec_sys;
- const video_format_t *p_fmt_src = cfg->video_src;
- const video_format_t *p_fmt_dst = cfg->video_dst;
+ const video_format_t *p_fmt_src = cfg->current.video_src;
+ const video_format_t *p_fmt_dst = cfg->current.video_dst;
plane_t *p_plane;
/* time in seconds from the start of the stream */
kate_float t = secf_from_vlc_tick( p_spusys->i_start + cfg->pts - p_subpic->i_start );
bool new_regions = false;
- if( !video_format_IsSimilar(cfg->prev_src, p_fmt_src) ||
- !video_format_IsSimilar(cfg->prev_dst, p_fmt_dst) )
+ if( !video_format_IsSimilar(cfg->previous.video_src, p_fmt_src) ||
+ !video_format_IsSimilar(cfg->previous.video_dst, p_fmt_dst) )
new_regions = true;
if (!new_regions)
=====================================
modules/codec/libass.c
=====================================
@@ -417,12 +417,12 @@ static void SubpictureUpdate( subpicture_t *p_subpic,
{
libass_spu_updater_sys_t *p_spusys = p_subpic->updater.sys;
decoder_sys_t *p_sys = p_spusys->p_dec_sys;
- const video_format_t *p_fmt_src = cfg->video_src;
- const video_format_t *p_fmt_dst = cfg->video_dst;
+ const video_format_t *p_fmt_src = cfg->current.video_src;
+ const video_format_t *p_fmt_dst = cfg->current.video_dst;
- bool b_fmt_src = p_fmt_src->i_visible_width != cfg->prev_src->i_visible_width ||
- p_fmt_src->i_visible_height != cfg->prev_src->i_visible_height;
- bool b_fmt_dst = !video_format_IsSimilar(cfg->prev_dst, p_fmt_dst);
+ bool b_fmt_src = p_fmt_src->i_visible_width != cfg->previous.video_src->i_visible_width ||
+ p_fmt_src->i_visible_height != cfg->previous.video_src->i_visible_height;
+ bool b_fmt_dst = !video_format_IsSimilar(cfg->previous.video_dst, p_fmt_dst);
vlc_mutex_lock( &p_sys->lock );
=====================================
modules/codec/spudec/parse.c
=====================================
@@ -190,8 +190,8 @@ static void ParsePXCTLI( decoder_t *p_dec, const subpicture_data_t *p_spu_data,
static void UpdateDvdSpu(subpicture_t * p_spu,
const struct vlc_spu_updater_configuration * cfg)
{
- p_spu->i_original_picture_width = cfg->video_src->i_visible_width;
- p_spu->i_original_picture_height = cfg->video_src->i_visible_height;
+ p_spu->i_original_picture_width = cfg->current.video_src->i_visible_width;
+ p_spu->i_original_picture_height = cfg->current.video_src->i_visible_height;
}
/*****************************************************************************
=====================================
modules/codec/substext.h
=====================================
@@ -103,11 +103,12 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
const struct vlc_spu_updater_configuration *cfg)
{
subtext_updater_sys_t *sys = subpic->updater.sys;
- const video_format_t *fmt_src = cfg->video_src;
- const video_format_t *fmt_dst = cfg->video_dst;
+ const video_format_t *fmt_src = cfg->current.video_src;
+ const video_format_t *fmt_dst = cfg->current.video_dst;
- if (fmt_src->i_visible_height == cfg->prev_src->i_visible_height &&
- video_format_IsSimilar(cfg->prev_dst, fmt_dst) &&
+ if (fmt_src->i_visible_width == cfg->previous.video_src->i_visible_width &&
+ fmt_src->i_visible_height == cfg->previous.video_src->i_visible_height &&
+ video_format_IsSimilar(cfg->previous.video_dst, fmt_dst) &&
(sys->i_next_update == VLC_TICK_INVALID || sys->i_next_update > cfg->pts))
return;
@@ -154,8 +155,8 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
if ( p_updtregion->b_in_window )
{
- subpic->i_original_picture_width = cfg->display_width;
- subpic->i_original_picture_height = cfg->display_height;
+ subpic->i_original_picture_width = cfg->current.display_width;
+ subpic->i_original_picture_height = cfg->current.display_height;
}
else if( sys->region.flags & UPDT_REGION_USES_GRID_COORDINATES )
{
@@ -174,8 +175,8 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
if (p_updtregion->b_in_window)
{
render_fmt.i_x_offset = render_fmt.i_y_offset = 0;
- render_fmt.i_width = render_fmt.i_visible_width = cfg->display_width;
- render_fmt.i_height = render_fmt.i_visible_height = cfg->display_height;
+ render_fmt.i_width = render_fmt.i_visible_width = cfg->current.display_width;
+ render_fmt.i_height = render_fmt.i_visible_height = cfg->current.display_height;
}
for( substext_updater_region_t *update_region = &sys->region;
=====================================
modules/codec/ttml/imageupdater.h
=====================================
@@ -77,10 +77,10 @@ static void TTML_ImageSpuUpdate(subpicture_t *p_spu,
const struct vlc_spu_updater_configuration *cfg)
{
ttml_image_updater_sys_t *p_sys = p_spu->updater.sys;
- const video_format_t *p_fmt_dst = cfg->video_dst;
+ const video_format_t *p_fmt_dst = cfg->current.video_dst;
- if (p_fmt_dst->i_visible_width == cfg->prev_dst->i_visible_width &&
- p_fmt_dst->i_visible_height == cfg->prev_dst->i_visible_height)
+ if (p_fmt_dst->i_visible_width == cfg->previous.video_dst->i_visible_width &&
+ p_fmt_dst->i_visible_height == cfg->previous.video_dst->i_visible_height)
return;
vlc_spu_regions_Clear( &p_spu->regions );
=====================================
src/misc/subpicture.c
=====================================
@@ -40,6 +40,8 @@ struct subpicture_private_t
{
video_format_t src;
video_format_t dst;
+ unsigned display_width;
+ unsigned display_height;
};
subpicture_t *subpicture_New( const subpicture_updater_t *p_upd )
@@ -64,6 +66,8 @@ subpicture_t *subpicture_New( const subpicture_updater_t *p_upd )
}
video_format_Init( &p_private->src, 0 );
video_format_Init( &p_private->dst, 0 );
+ p_private->display_width = 0;
+ p_private->display_height = 0;
p_subpic->updater = *p_upd;
p_subpic->p_private = p_private;
@@ -185,12 +189,18 @@ void subpicture_Update( subpicture_t *p_subpicture,
return;
struct vlc_spu_updater_configuration cfg = {
- .prev_src = &p_private->src,
- .prev_dst = &p_private->dst,
- .display_width = display_width,
- .display_height = display_height,
- .video_src = p_fmt_src,
- .video_dst = p_fmt_dst,
+ .current = {
+ .display_width = display_width,
+ .display_height = display_height,
+ .video_src = p_fmt_src,
+ .video_dst = p_fmt_dst,
+ },
+ .previous = {
+ .display_width = p_private->display_width,
+ .display_height = p_private->display_height,
+ .video_src = &p_private->src,
+ .video_dst = &p_private->dst,
+ },
.pts = i_ts,
};
p_upd->ops->update( p_subpicture, &cfg );
=====================================
src/video_output/video_epg.c
=====================================
@@ -501,9 +501,9 @@ static void OSDEpgUpdate(subpicture_t *subpic,
const struct vlc_spu_updater_configuration *cfg)
{
epg_spu_updater_sys_t *sys = subpic->updater.sys;
- const video_format_t *fmt_dst = cfg->video_dst;
+ const video_format_t *fmt_dst = cfg->current.video_dst;
- if (video_format_IsSimilar(cfg->prev_dst, fmt_dst))
+ if (video_format_IsSimilar(cfg->previous.video_dst, fmt_dst))
return;
vlc_spu_regions_Clear( &subpic->regions );
=====================================
src/video_output/video_text.c
=====================================
@@ -41,9 +41,9 @@ static void OSDTextUpdate(subpicture_t *subpic,
const struct vlc_spu_updater_configuration *cfg)
{
osd_spu_updater_sys_t *sys = subpic->updater.sys;
- const video_format_t *fmt_dst = cfg->video_dst;
+ const video_format_t *fmt_dst = cfg->current.video_dst;
- if (video_format_IsSimilar(cfg->prev_dst, fmt_dst))
+ if (video_format_IsSimilar(cfg->previous.video_dst, fmt_dst))
return;
vlc_spu_regions_Clear( &subpic->regions );
=====================================
src/video_output/video_widgets.c
=====================================
@@ -265,12 +265,12 @@ static void OSDWidgetUpdate(subpicture_t *subpic,
vlc_spu_regions_Clear( &subpic->regions );
- subpic->i_original_picture_width = cfg->display_width;
- subpic->i_original_picture_height = cfg->display_height;
+ subpic->i_original_picture_width = cfg->current.display_width;
+ subpic->i_original_picture_height = cfg->current.display_height;
if (sys->type == OSD_HOR_SLIDER || sys->type == OSD_VERT_SLIDER)
- p_region = OSDSlider(sys->type, sys->value, cfg->display_width, cfg->display_height);
+ p_region = OSDSlider(sys->type, sys->value, cfg->current.display_width, cfg->current.display_height);
else
- p_region = OSDIcon(sys->type, cfg->display_width, cfg->display_height);
+ p_region = OSDIcon(sys->type, cfg->current.display_width, cfg->current.display_height);
if (p_region)
{
p_region->b_absolute = true;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/cf515e41c8fa359f20017f994c3c78efc5e3e495
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/cf515e41c8fa359f20017f994c3c78efc5e3e495
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list