faceoverlay: don't make rsvgoverlay reload the SVG for every single frame
Only set location on rsvgoverlay if it has changed.
This commit is contained in:
parent
549447d288
commit
3bbb0387c4
@ -174,6 +174,7 @@ gst_face_overlay_change_state (GstElement * element, GstStateChange transition)
|
|||||||
"facedetect element or rsvgoverlay"));
|
"facedetect element or rsvgoverlay"));
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
}
|
}
|
||||||
|
filter->update_svg = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -237,11 +238,16 @@ gst_face_overlay_handle_faces (GstFaceOverlay * filter, GstStructure * s)
|
|||||||
svg_width = (int) width *filter->w;
|
svg_width = (int) width *filter->w;
|
||||||
svg_height = (int) height *filter->h;
|
svg_height = (int) height *filter->h;
|
||||||
|
|
||||||
GST_LOG_OBJECT (filter, "setting overlay to %d x %d @ %d,%d (file: %s)",
|
if (filter->update_svg) {
|
||||||
svg_width, svg_height, svg_x, svg_y, GST_STR_NULL (filter->location));
|
GST_DEBUG_OBJECT (filter, "set rsvgoverlay location=%s", filter->location);
|
||||||
|
g_object_set (filter->svg_overlay, "location", filter->location, NULL);
|
||||||
|
filter->update_svg = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (filter, "overlay dimensions: %d x %d @ %d,%d",
|
||||||
|
svg_width, svg_height, svg_x, svg_y);
|
||||||
|
|
||||||
g_object_set (filter->svg_overlay,
|
g_object_set (filter->svg_overlay,
|
||||||
"location", filter->location,
|
|
||||||
"x", svg_x, "y", svg_y, "width", svg_width, "height", svg_height, NULL);
|
"x", svg_x, "y", svg_y, "width", svg_width, "height", svg_height, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,6 +353,7 @@ gst_face_overlay_set_property (GObject * object, guint prop_id,
|
|||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
filter->location = g_value_dup_string (value);
|
filter->location = g_value_dup_string (value);
|
||||||
|
filter->update_svg = TRUE;
|
||||||
break;
|
break;
|
||||||
case PROP_X:
|
case PROP_X:
|
||||||
filter->x = g_value_get_float (value);
|
filter->x = g_value_get_float (value);
|
||||||
|
@ -73,6 +73,8 @@ struct _GstFaceOverlay
|
|||||||
|
|
||||||
gboolean process_message;
|
gboolean process_message;
|
||||||
|
|
||||||
|
gboolean update_svg;
|
||||||
|
|
||||||
gchar *location;
|
gchar *location;
|
||||||
gfloat x;
|
gfloat x;
|
||||||
gfloat y;
|
gfloat y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user