]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_subpictures.c
Remove more evil characters with filename_sanitize() (fix #5309)
[vlc] / src / video_output / vout_subpictures.c
index f46de3ec57466b870bfba77ddf0aa0daf38773d5..0ec72b3f253b2537afbb1459c4ec0e6d82dd6cf0 100644 (file)
@@ -200,8 +200,7 @@ static int spu_get_attachments(filter_t *filter,
 
 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;
 
@@ -223,7 +222,6 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
     /* 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;
 }
@@ -233,8 +231,7 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object,
                                              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;
 
@@ -258,7 +255,8 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object,
 
 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;
 
@@ -286,13 +284,13 @@ static void SpuRenderText(spu_t *spu, bool *rerender_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");
 }
 
@@ -446,21 +444,21 @@ static void SpuAreaFixOverlap(spu_area_t *dst,
 
 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);
 }
 
 /**
@@ -692,7 +690,8 @@ static void SpuRenderRegion(spu_t *spu,
     /* 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)
@@ -1031,8 +1030,6 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
 
             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
@@ -1206,8 +1203,9 @@ static void SubSourceAllocationClean(filter_t *filter)
  */
 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;