static void gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay) { GstVideoOverlayComposition *comp; GstVideoOverlayRectangle *rect; GstVideoMeta *overlay_meta; gint x, y, width, height; gint video_width = GST_VIDEO_INFO_WIDTH (&GST_VIDEO_FILTER (overlay)->in_info); gint video_height = GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_FILTER (overlay)->in_info); if (overlay->comp) { gst_video_overlay_composition_unref (overlay->comp); overlay->comp = NULL; } if (overlay->alpha == 0.0 || overlay->pixels == NULL) return; overlay_meta = gst_buffer_get_video_meta (overlay->pixels); x = overlay->offset_x < 0 ? video_width + overlay->offset_x - overlay_meta->width + (overlay->relative_x * overlay_meta->width) : overlay->offset_x + (overlay->relative_x * overlay_meta->width); y = overlay->offset_y < 0 ? video_height + overlay->offset_y - overlay_meta->height + (overlay->relative_y * overlay_meta->height) : overlay->offset_y + (overlay->relative_y * overlay_meta->height); width = overlay->overlay_width; if (width == 0) width = overlay_meta->width; height = overlay->overlay_height; if (height == 0) height = overlay_meta->height; GST_DEBUG_OBJECT (overlay, "overlay image dimensions: %d x %d, alpha=%.2f", overlay_meta->width, overlay_meta->height, overlay->alpha); GST_DEBUG_OBJECT (overlay, "properties: x,y: %d,%d (%g%%,%g%%) - WxH: %dx%d", overlay->offset_x, overlay->offset_y, overlay->relative_x * 100.0, overlay->relative_y * 100.0, overlay->overlay_height, overlay->overlay_width); GST_DEBUG_OBJECT (overlay, "overlay rendered: %d x %d @ %d,%d (onto %d x %d)", width, height, x, y, video_width, video_height); rect = gst_video_overlay_rectangle_new_raw (overlay->pixels, x, y, width, height, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); if (overlay->alpha != 1.0) gst_video_overlay_rectangle_set_global_alpha (rect, overlay->alpha); comp = gst_video_overlay_composition_new (rect); gst_video_overlay_rectangle_unref (rect); overlay->comp = comp; }
static void gst_video_flip_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstVideoFlip *videoflip; GstVideoFilter *videofilter; g_return_if_fail (GST_IS_VIDEO_FLIP (object)); videoflip = GST_VIDEO_FLIP (object); videofilter = GST_VIDEO_FILTER (object); switch (prop_id) { case ARG_METHOD: { GstVideoFlipMethod method; method = g_value_get_enum (value); if (method != videoflip->method) { GstBaseTransform *btrans = GST_BASE_TRANSFORM (videoflip); g_mutex_lock (btrans->transform_lock); gst_pad_set_caps (btrans->sinkpad, NULL); gst_pad_set_caps (btrans->srcpad, NULL); g_mutex_unlock (btrans->transform_lock); videoflip->method = method; } } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_video_filter_init (GstVideoFilter * instance) { GstVideoFilter *videofilter = GST_VIDEO_FILTER (instance); GST_DEBUG_OBJECT (videofilter, "gst_video_filter_init"); videofilter->negotiated = FALSE; /* enable QoS */ gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videofilter), TRUE); }