static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
{
- filter_t *text = vlc_custom_create(spu, sizeof(*text),
- VLC_OBJECT_GENERIC, "spu text");
+ filter_t *text = vlc_custom_create(spu, sizeof(*text), "spu text");
if (!text)
return NULL;
/* Create a few variables used for enhanced text rendering */
var_Create(text, "spu-elapsed", VLC_VAR_TIME);
var_Create(text, "text-rerender", VLC_VAR_BOOL);
- var_Create(text, "scale", VLC_VAR_INTEGER);
return text;
}
vlc_fourcc_t dst_chroma,
bool require_resize)
{
- filter_t *scale = vlc_custom_create(object, sizeof(*scale),
- VLC_OBJECT_GENERIC, "scale");
+ filter_t *scale = vlc_custom_create(object, sizeof(*scale), "scale");
if (!scale)
return NULL;
static void SpuRenderText(spu_t *spu, bool *rerender_text,
subpicture_region_t *region,
- mtime_t render_date)
+ const vlc_fourcc_t *chroma_list,
+ mtime_t elapsed_time)
{
filter_t *text = spu->p->text;
* least show up on screen, but the effect won't change
* the text over time.
*/
- var_SetTime(text, "spu-elapsed", render_date);
+ var_SetTime(text, "spu-elapsed", elapsed_time);
var_SetBool(text, "text-rerender", false);
if (text->pf_render_html && region->psz_html)
- text->pf_render_html(text, region, region);
+ text->pf_render_html(text, region, region, chroma_list);
else if (text->pf_render_text)
- text->pf_render_text(text, region, region);
+ text->pf_render_text(text, region, region, chroma_list);
*rerender_text = var_GetBool(text, "text-rerender");
}
static void SpuAreaFitInside(spu_area_t *area, const spu_area_t *boundary)
{
- spu_area_t a = spu_area_scaled(*area);
+ spu_area_t a = spu_area_scaled(*area);
- const int i_error_x = (a.x + a.width) - boundary->width;
- if (i_error_x > 0)
- a.x -= i_error_x;
- if (a.x < 0)
- a.x = 0;
+ const int i_error_x = (a.x + a.width) - boundary->width;
+ if (i_error_x > 0)
+ a.x -= i_error_x;
+ if (a.x < 0)
+ a.x = 0;
- const int i_error_y = (a.y + a.height) - boundary->height;
- if (i_error_y > 0)
- a.y -= i_error_y;
- if (a.y < 0)
- a.y = 0;
+ const int i_error_y = (a.y + a.height) - boundary->height;
+ if (i_error_y > 0)
+ a.y -= i_error_y;
+ if (a.y < 0)
+ a.y = 0;
- *area = spu_area_unscaled(a, area->scale);
+ *area = spu_area_unscaled(a, area->scale);
}
/**
/* Render text region */
if (region->fmt.i_chroma == VLC_CODEC_TEXT) {
SpuRenderText(spu, &restore_text, region,
- render_date);
+ chroma_list,
+ render_date - subpic->i_start);
/* Check if the rendering has failed ... */
if (region->fmt.i_chroma == VLC_CODEC_TEXT)
sys->text->fmt_out.video.i_height =
sys->text->fmt_out.video.i_visible_height = subpic->i_original_picture_height;
-
- var_SetInteger(sys->text, "scale", SCALE_UNIT);
}
/* Render all regions
*/
spu_t *spu_Create(vlc_object_t *object)
{
- spu_t *spu = vlc_custom_create(object, sizeof(spu_t) + sizeof(spu_private_t),
- VLC_OBJECT_GENERIC, "subpicture");
+ spu_t *spu = vlc_custom_create(object,
+ sizeof(spu_t) + sizeof(spu_private_t),
+ "subpicture");
if (!spu)
return NULL;