Lines Matching full:overlay
44 * overlay at (0, 0) position filling the whole screen. It modifies
53 …! videoconvert ! rsvgoverlay name=overlay ! videoconvert ! autovideosink filesrc location=foo.svg …
88 #define GST_RSVG_LOCK(overlay) G_STMT_START { \ argument
89 GST_LOG_OBJECT (overlay, "Locking rsvgoverlay from thread %p", g_thread_self ()); \
90 g_mutex_lock (&overlay->rsvg_lock); \
91 GST_LOG_OBJECT (overlay, "Locked rsvgoverlay from thread %p", g_thread_self ()); \
94 #define GST_RSVG_UNLOCK(overlay) G_STMT_START { \ argument
95 GST_LOG_OBJECT (overlay, "Unlocking rsvgoverlay from thread %p", g_thread_self ()); \
96 g_mutex_unlock (&overlay->rsvg_lock); \
132 gst_rsvg_overlay_set_svg_data (GstRsvgOverlay * overlay, const gchar * data, in gst_rsvg_overlay_set_svg_data() argument
135 GstBaseTransform *btrans = GST_BASE_TRANSFORM (overlay); in gst_rsvg_overlay_set_svg_data()
139 if (overlay->handle) { in gst_rsvg_overlay_set_svg_data()
140 g_object_unref (overlay->handle); in gst_rsvg_overlay_set_svg_data()
141 overlay->handle = NULL; in gst_rsvg_overlay_set_svg_data()
151 overlay->handle = rsvg_handle_new_from_file (data, &error); in gst_rsvg_overlay_set_svg_data()
153 overlay->handle = in gst_rsvg_overlay_set_svg_data()
155 if (error || overlay->handle == NULL) { in gst_rsvg_overlay_set_svg_data()
157 GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s\n%s", in gst_rsvg_overlay_set_svg_data()
161 GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s", data); in gst_rsvg_overlay_set_svg_data()
166 rsvg_handle_get_dimensions (overlay->handle, &svg_dimension); in gst_rsvg_overlay_set_svg_data()
167 overlay->svg_width = svg_dimension.width; in gst_rsvg_overlay_set_svg_data()
168 overlay->svg_height = svg_dimension.height; in gst_rsvg_overlay_set_svg_data()
170 GST_INFO_OBJECT (overlay, "updated SVG, %d x %d", overlay->svg_width, in gst_rsvg_overlay_set_svg_data()
171 overlay->svg_height); in gst_rsvg_overlay_set_svg_data()
181 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (object); in gst_rsvg_overlay_set_property() local
183 GST_RSVG_LOCK (overlay); in gst_rsvg_overlay_set_property()
188 gst_rsvg_overlay_set_svg_data (overlay, g_value_get_string (value), in gst_rsvg_overlay_set_property()
194 gst_rsvg_overlay_set_svg_data (overlay, g_value_get_string (value), TRUE); in gst_rsvg_overlay_set_property()
200 overlay->x_offset = 0; in gst_rsvg_overlay_set_property()
201 overlay->y_offset = 0; in gst_rsvg_overlay_set_property()
202 overlay->x_relative = 0.0; in gst_rsvg_overlay_set_property()
203 overlay->y_relative = 0.0; in gst_rsvg_overlay_set_property()
204 overlay->width = 0; in gst_rsvg_overlay_set_property()
205 overlay->height = 0; in gst_rsvg_overlay_set_property()
206 overlay->width_relative = 1.0; in gst_rsvg_overlay_set_property()
207 overlay->height_relative = 1.0; in gst_rsvg_overlay_set_property()
209 overlay->width_relative = 0; in gst_rsvg_overlay_set_property()
210 overlay->height_relative = 0; in gst_rsvg_overlay_set_property()
216 overlay->x_offset = g_value_get_int (value); in gst_rsvg_overlay_set_property()
221 overlay->y_offset = g_value_get_int (value); in gst_rsvg_overlay_set_property()
226 overlay->x_relative = g_value_get_float (value); in gst_rsvg_overlay_set_property()
231 overlay->y_relative = g_value_get_float (value); in gst_rsvg_overlay_set_property()
237 overlay->width = g_value_get_int (value); in gst_rsvg_overlay_set_property()
242 overlay->height = g_value_get_int (value); in gst_rsvg_overlay_set_property()
247 overlay->width_relative = g_value_get_float (value); in gst_rsvg_overlay_set_property()
252 overlay->height_relative = g_value_get_float (value); in gst_rsvg_overlay_set_property()
263 GST_RSVG_UNLOCK (overlay); in gst_rsvg_overlay_set_property()
270 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (object); in gst_rsvg_overlay_get_property() local
274 g_value_set_int (value, overlay->x_offset); in gst_rsvg_overlay_get_property()
277 g_value_set_int (value, overlay->y_offset); in gst_rsvg_overlay_get_property()
280 g_value_set_float (value, overlay->x_relative); in gst_rsvg_overlay_get_property()
283 g_value_set_float (value, overlay->y_relative); in gst_rsvg_overlay_get_property()
287 g_value_set_int (value, overlay->width); in gst_rsvg_overlay_get_property()
290 g_value_set_int (value, overlay->height); in gst_rsvg_overlay_get_property()
293 g_value_set_float (value, overlay->width_relative); in gst_rsvg_overlay_get_property()
296 g_value_set_float (value, overlay->height_relative); in gst_rsvg_overlay_get_property()
300 g_value_set_boolean (value, (overlay->width_relative == 1.0 in gst_rsvg_overlay_get_property()
301 && overlay->height_relative == 1.0)); in gst_rsvg_overlay_get_property()
313 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (GST_PAD_PARENT (pad)); in gst_rsvg_overlay_data_sink_chain() local
315 gst_adapter_push (overlay->adapter, buffer); in gst_rsvg_overlay_data_sink_chain()
323 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (GST_PAD_PARENT (pad)); in gst_rsvg_overlay_data_sink_event() local
332 GST_RSVG_LOCK (overlay); in gst_rsvg_overlay_data_sink_event()
336 data_size = gst_adapter_available (overlay->adapter); in gst_rsvg_overlay_data_sink_event()
338 gst_rsvg_overlay_set_svg_data (overlay, in gst_rsvg_overlay_data_sink_event()
339 (const gchar *) gst_adapter_take (overlay->adapter, data_size), in gst_rsvg_overlay_data_sink_event()
341 gst_adapter_clear (overlay->adapter); in gst_rsvg_overlay_data_sink_event()
343 GST_RSVG_UNLOCK (overlay); in gst_rsvg_overlay_data_sink_event()
348 gst_adapter_clear (overlay->adapter); in gst_rsvg_overlay_data_sink_event()
364 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (vfilter); in gst_rsvg_overlay_transform_frame_ip() local
367 double applied_x_offset = (double) overlay->x_offset; in gst_rsvg_overlay_transform_frame_ip()
368 double applied_y_offset = (double) overlay->y_offset; in gst_rsvg_overlay_transform_frame_ip()
369 int applied_width = overlay->width; in gst_rsvg_overlay_transform_frame_ip()
370 int applied_height = overlay->height; in gst_rsvg_overlay_transform_frame_ip()
372 GST_RSVG_LOCK (overlay); in gst_rsvg_overlay_transform_frame_ip()
373 if (!overlay->handle) { in gst_rsvg_overlay_transform_frame_ip()
374 GST_RSVG_UNLOCK (overlay); in gst_rsvg_overlay_transform_frame_ip()
392 if (!applied_x_offset && overlay->x_relative) { in gst_rsvg_overlay_transform_frame_ip()
393 applied_x_offset = overlay->x_relative * GST_VIDEO_FRAME_WIDTH (frame); in gst_rsvg_overlay_transform_frame_ip()
395 if (!applied_y_offset && overlay->y_relative) { in gst_rsvg_overlay_transform_frame_ip()
396 applied_y_offset = overlay->y_relative * GST_VIDEO_FRAME_HEIGHT (frame); in gst_rsvg_overlay_transform_frame_ip()
398 if (!applied_width && overlay->width_relative) { in gst_rsvg_overlay_transform_frame_ip()
400 (int) (overlay->width_relative * GST_VIDEO_FRAME_WIDTH (frame)); in gst_rsvg_overlay_transform_frame_ip()
402 if (!applied_height && overlay->height_relative) { in gst_rsvg_overlay_transform_frame_ip()
404 (int) (overlay->height_relative * GST_VIDEO_FRAME_HEIGHT (frame)); in gst_rsvg_overlay_transform_frame_ip()
412 if ((applied_width || applied_height) && overlay->svg_width in gst_rsvg_overlay_transform_frame_ip()
413 && overlay->svg_height) { in gst_rsvg_overlay_transform_frame_ip()
417 applied_width = overlay->svg_width; in gst_rsvg_overlay_transform_frame_ip()
419 applied_height = overlay->svg_height; in gst_rsvg_overlay_transform_frame_ip()
421 cairo_scale (cr, (double) applied_width / overlay->svg_width, in gst_rsvg_overlay_transform_frame_ip()
422 (double) applied_height / overlay->svg_height); in gst_rsvg_overlay_transform_frame_ip()
424 rsvg_handle_render_cairo (overlay->handle, cr); in gst_rsvg_overlay_transform_frame_ip()
425 GST_RSVG_UNLOCK (overlay); in gst_rsvg_overlay_transform_frame_ip()
436 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (btrans); in gst_rsvg_overlay_stop() local
438 if (overlay->handle) { in gst_rsvg_overlay_stop()
439 g_object_unref (overlay->handle); in gst_rsvg_overlay_stop()
440 overlay->handle = NULL; in gst_rsvg_overlay_stop()
443 gst_adapter_clear (overlay->adapter); in gst_rsvg_overlay_stop()
462 gst_element_class_set_static_metadata (element_class, "RSVG overlay", in gst_rsvg_overlay_class_init()
522 gst_rsvg_overlay_init (GstRsvgOverlay * overlay) in gst_rsvg_overlay_init() argument
524 overlay->x_offset = 0; in gst_rsvg_overlay_init()
525 overlay->y_offset = 0; in gst_rsvg_overlay_init()
526 overlay->x_relative = 0.0; in gst_rsvg_overlay_init()
527 overlay->y_relative = 0.0; in gst_rsvg_overlay_init()
528 overlay->width = 0; in gst_rsvg_overlay_init()
529 overlay->height = 0; in gst_rsvg_overlay_init()
530 overlay->width_relative = 0.0; in gst_rsvg_overlay_init()
531 overlay->height_relative = 0.0; in gst_rsvg_overlay_init()
533 overlay->adapter = gst_adapter_new (); in gst_rsvg_overlay_init()
536 overlay->data_sinkpad = in gst_rsvg_overlay_init()
538 gst_pad_set_chain_function (overlay->data_sinkpad, in gst_rsvg_overlay_init()
540 gst_pad_set_event_function (overlay->data_sinkpad, in gst_rsvg_overlay_init()
542 gst_element_add_pad (GST_ELEMENT (overlay), overlay->data_sinkpad); in gst_rsvg_overlay_init()
548 GstRsvgOverlay *overlay = GST_RSVG_OVERLAY (object); in gst_rsvg_overlay_finalize() local
550 g_object_unref (overlay->adapter); in gst_rsvg_overlay_finalize()