CoglPipeline * cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt) { CoglGstVideoSinkPrivate *priv; g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), NULL); priv = vt->priv; if (priv->pipeline == NULL) { priv->pipeline = cogl_pipeline_new (priv->ctx); cogl_gst_video_sink_setup_pipeline (vt, priv->pipeline); cogl_gst_video_sink_attach_frame (vt, priv->pipeline); priv->frame_dirty = FALSE; } else if (priv->frame_dirty) { CoglPipeline *pipeline = cogl_pipeline_copy (priv->pipeline); cogl_object_unref (priv->pipeline); priv->pipeline = pipeline; cogl_gst_video_sink_attach_frame (vt, pipeline); priv->frame_dirty = FALSE; } return priv->pipeline; }
static void paint (CoglFramebuffer *fb, const CoglGstRectangle *video_output, void *user_data) { Data *data = user_data; CoglPipeline *pipeline; pipeline = cogl_pipeline_copy (data->pipeline); cogl_gst_video_sink_attach_frame (data->sink, pipeline); cogl_object_unref (data->pipeline); data->pipeline = pipeline; if (data->last_output_width != video_output->width || data->last_output_height != video_output->height) { int location = cogl_pipeline_get_uniform_location (pipeline, "pixel_step"); if (location != -1) { float value[2] = { 1.0f / video_output->width, 1.0f / video_output->height }; cogl_pipeline_set_uniform_float (pipeline, location, 2, /* n_components */ 1, /* count */ value); } data->last_output_width = video_output->width; data->last_output_height = video_output->height; } borders_draw (data->borders, fb, video_output); cogl_framebuffer_draw_rectangle (fb, pipeline, video_output->x, video_output->y, video_output->x + video_output->width, video_output->y + video_output->height); }