+ vlc_value_t val;
+
+ /* Setup 3 variables which can be used to render time-dependent
+ * text (and effects). The first indicates the total amount of
+ * time the text will be on screen, the second the amount of time
+ * it has already been on screen (can be a negative value as text
+ * is layed out before it is rendered) and the third is a feedback
+ * variable from the renderer - if the renderer sets it then this
+ * particular text is time-dependent, eg. the visual progress bar
+ * inside the text in karaoke and the text needs to be rendered
+ * multiple times in order for the effect to work - we therefore
+ * need to return the region to its original state at the end of
+ * the loop, instead of leaving it in YUVA or YUVP
+ * Any renderer which is unaware of how to render time-dependent
+ * text can happily ignore the variables and render the text the
+ * same as usual - it should at least show up on screen, but the
+ * effect won't change the text over time.
+ */
+
+ var_Create( p_spu->p_text, "spu-duration", VLC_VAR_TIME );
+ val.i_time = p_subpic->i_stop - p_subpic->i_start;
+ var_Set( p_spu->p_text, "spu-duration", val );
+
+ var_Create( p_spu->p_text, "spu-elapsed", VLC_VAR_TIME );
+ val.i_time = mdate() - p_subpic->i_start;
+ var_Set( p_spu->p_text, "spu-elapsed", val );
+
+ var_Create( p_spu->p_text, "text-rerender", VLC_VAR_BOOL );
+ var_SetBool( p_spu->p_text, "text-rerender", VLC_FALSE );