Commit 86a0b361 authored by François Cartegnie's avatar François Cartegnie 🤞

codec: webvtt: fix regionless cues duplication

parent 69c297c5
......@@ -1519,6 +1519,7 @@ static void RenderRegions( decoder_t *p_dec, mtime_t i_start, mtime_t i_stop )
ApplyCSSRules( p_dec, p_dec->p_sys->p_css_rules, i_start );
#endif
bool b_has_regionless_cues = false;
for( const webvtt_dom_node_t *p_node = p_dec->p_sys->p_root->p_child;
p_node; p_node = p_node->p_next )
{
......@@ -1558,33 +1559,40 @@ static void RenderRegions( decoder_t *p_dec, mtime_t i_start, mtime_t i_stop )
| UPDT_REGION_EXTENT_X_IS_RATIO;
p_updtregion->p_segments = p_segments;
}
else if( p_node->type == NODE_CUE ) /* regionless cues */
else if ( p_node->type == NODE_CUE )
{
const webvtt_dom_cue_t *p_cue = (const webvtt_dom_cue_t *) p_node;
/* Variables */
struct render_variables_s v;
v.p_region = NULL;
v.i_left_offset = 0.0;
v.i_left = 0.0;
v.i_top_offset = 0.0;
v.i_top = 0.0;
/* !Variables */
text_segment_t *p_segments = ConvertCuesToSegments( p_dec, i_start, i_stop, &v, p_cue );
if( !p_segments )
continue;
b_has_regionless_cues = true;
}
}
/* regionless cues */
if ( b_has_regionless_cues )
{
const webvtt_dom_cue_t *p_cue = (const webvtt_dom_cue_t *) p_dec->p_sys->p_root->p_child;
/* Variables */
struct render_variables_s v;
v.p_region = NULL;
v.i_left_offset = 0.0;
v.i_left = 0.0;
v.i_top_offset = 0.0;
v.i_top = 0.0;
/* !Variables */
text_segment_t *p_segments = ConvertCuesToSegments( p_dec, i_start, i_stop, &v, p_cue );
if( p_segments )
{
CreateSpuOrNewUpdaterRegion( p_dec, &p_spu, &p_updtregion );
if( !p_spu || !p_updtregion )
{
text_segment_ChainDelete( p_segments );
continue;
}
else
{
p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
p_updtregion->inner_align = GetCueTextAlignment( p_cue );
p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
p_updtregion->inner_align = GetCueTextAlignment( p_cue );
p_updtregion->p_segments = p_segments;
p_updtregion->p_segments = p_segments;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment