[vlc-commits] codec: webvtt: fix regionless cues duplication
Francois Cartegnie
git at videolan.org
Wed Dec 13 20:45:24 CET 2017
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 13 15:52:13 2017 +0100| [c929f6155cbaaec462d98cff678ef89b89319ade] | committer: Francois Cartegnie
codec: webvtt: fix regionless cues duplication
(cherry picked from commit 86a0b361d91c20d88ed7ce5979ed24d1411e5c73)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c929f6155cbaaec462d98cff678ef89b89319ade
---
modules/codec/webvtt/subsvtt.c | 46 +++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c
index 31e73713c8..92ce6a52bf 100644
--- a/modules/codec/webvtt/subsvtt.c
+++ b/modules/codec/webvtt/subsvtt.c
@@ -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;
+ }
}
}
More information about the vlc-commits
mailing list