/****************************************************
 *    Video Overlay vmethods implementation         *
 ****************************************************/
static void
_overlay_expose (GstVideoOverlay * overlay)
{
  GESPipeline *pipeline = GES_PIPELINE (overlay);

  gst_video_overlay_expose (GST_VIDEO_OVERLAY (pipeline->priv->playsink));
}
static gboolean
handle_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer user_data)
{
  GstVideoRectangle *r = &anim_state.rect;
  GtkStyleContext *style;
  GdkRGBA color;
  int width, height;

  width = gtk_widget_get_allocated_width (widget);
  height = gtk_widget_get_allocated_height (widget);

  style = gtk_widget_get_style_context (widget);

  gtk_style_context_get_color (style, 0, &color);
  gdk_cairo_set_source_rgba (cr, &color);

  /* we should only redraw outside of the video rect! */
  cairo_rectangle (cr, 0, 0, r->x, height);
  cairo_rectangle (cr, r->x + r->w, 0, width - (r->x + r->w), height);

  cairo_rectangle (cr, 0, 0, width, r->y);
  cairo_rectangle (cr, 0, r->y + r->h, width, height - (r->y + r->h));

  cairo_fill (cr);

  if (verbose) {
    g_print ("draw(%p)\n", widget);
  }
  gst_video_overlay_expose (anim_state.overlay);
  return FALSE;
}
static gboolean expose_cb(GtkWidget* widget, cairo_t *cr, GstElement* videosink)
{
    g_print ("expose %p\n", widget);
    g_print ("event mask: 0x%x, button_press 0x%x\n", gtk_widget_get_events (widget), GDK_BUTTON_PRESS_MASK);
    gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
    return FALSE;
}
Beispiel #4
0
G_MODULE_EXPORT gboolean
preview_draw_cb(
    GtkWidget *widget,
    cairo_t *cr,
    signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
#if GST_CHECK_VERSION(1, 0, 0)
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstVideoOverlay *vover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                vover = GST_VIDEO_OVERLAY(gst_bin_get_by_interface(
                                    GST_BIN(vsink), GST_TYPE_VIDEO_OVERLAY));
            else
                vover = GST_VIDEO_OVERLAY(vsink);
            gst_video_overlay_expose(vover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#else
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstXOverlay *xover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                xover = GST_X_OVERLAY(gst_bin_get_by_interface(
                                        GST_BIN(vsink), GST_TYPE_X_OVERLAY));
            else
                xover = GST_X_OVERLAY(vsink);
            gst_x_overlay_expose(xover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#endif
#endif

    if (ud->preview->pix != NULL)
    {
        _draw_pixbuf(cr, ud->preview->pix);
    }
    return FALSE;
}
/**
 * gst_player_video_overlay_video_renderer_expose:
 * @self: a #GstPlayerVideoOverlayVideoRenderer instance.
 *
 * Tell an overlay that it has been exposed. This will redraw the current frame
 * in the drawable even if the pipeline is PAUSED.
 */
void gst_player_video_overlay_video_renderer_expose
    (GstPlayerVideoOverlayVideoRenderer * self)
{
  g_return_if_fail (GST_IS_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER (self));

  if (self->video_overlay)
    gst_video_overlay_expose (self->video_overlay);
}
static void gst_native_surface_init (JNIEnv *env, jobject thiz, jobject surface) {
    CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
    if (!data) return;
    ANativeWindow *new_native_window = ANativeWindow_fromSurface(env, surface);
    GST_DEBUG ("Received surface %p (native window %p)", surface, new_native_window);

    if (data->native_window) {
        ANativeWindow_release (data->native_window);
        if (data->native_window == new_native_window) {
            GST_DEBUG ("New native window is the same as the previous one %p", data->native_window);
            if (data->video_sink) {
                gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->video_sink));
                gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->video_sink));
            }
            return;
        } else {
            GST_DEBUG ("Released previous native window %p", data->native_window);
            data->initialized = FALSE;
        }
    }
    data->native_window = new_native_window;

    check_initialization_complete (data);
}
static void
gst_gl_sink_bin_overlay_expose (GstVideoOverlay * overlay)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
  GstVideoOverlay *overlay_element = NULL;

  overlay_element =
      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_VIDEO_OVERLAY));

  if (overlay_element) {
    gst_video_overlay_expose (overlay_element);
    gst_object_unref (overlay_element);
  }
}
Beispiel #8
0
G_MODULE_EXPORT gboolean
delayed_expose_cb(signal_user_data_t *ud)
{
    GstElement *vsink;
    GstVideoOverlay *vover;

    if (!ud->preview->live_enabled)
        return FALSE;

    g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
    if (vsink == NULL)
        return FALSE;

    if (GST_IS_BIN(vsink))
        vover = GST_VIDEO_OVERLAY(gst_bin_get_by_interface(
                                GST_BIN(vsink), GST_TYPE_VIDEO_OVERLAY));
    else
        vover = GST_VIDEO_OVERLAY(vsink);
    gst_video_overlay_expose(vover);
    // This function is initiated by g_idle_add.  Must return false
    // so that it is not called again
    return FALSE;
}
Beispiel #9
0
//redraw the current frame in the drawable
void Pipeline::doExpose() const
{
    if (m_pipeline && m_glimagesink)
        gst_video_overlay_expose (GST_VIDEO_OVERLAY (m_glimagesink));
}
Beispiel #10
0
static gboolean draw_cb(GtkWidget* widget, cairo_t *cr, GstElement* videosink)
{
    g_print ("draw_cb\n");
    gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
    return FALSE;
}
Beispiel #11
0
int tsmf_window_resize(TSMFGstreamerDecoder *decoder, int x, int y, int width,
					   int height, int nr_rects, RDP_RECT *rects)
{
	if (decoder->media_type != TSMF_MAJOR_TYPE_VIDEO)
		return -3;
	else
	{
#if GST_VERSION_MAJOR > 0
		GstVideoOverlay *overlay = GST_VIDEO_OVERLAY(decoder->outsink);
#else
		GstXOverlay *overlay = GST_X_OVERLAY(decoder->outsink);
#endif
		struct X11Handle *hdl = (struct X11Handle *)decoder->platform;
		DEBUG_TSMF("resize: x=%d, y=%d, w=%d, h=%d", x, y, width, height);
		assert(decoder);
		assert(hdl);
#if GST_VERSION_MAJOR > 0

		if (!gst_video_overlay_set_render_rectangle(overlay, 0, 0, width, height))
		{
			DEBUG_WARN("Could not resize overlay!");
		}

		gst_video_overlay_expose(overlay);
#else
		if (!gst_x_overlay_set_render_rectangle(overlay, 0, 0, width, height))
		{
			DEBUG_WARN("Could not resize overlay!");
		}

		gst_x_overlay_expose(overlay);
#endif

		if (hdl->subwin)
		{
			XMoveResizeWindow(hdl->disp, hdl->subwin, x, y, width, height);
#if defined(WITH_XEXT)

			if (hdl->has_shape)
			{
				int i;
				XRectangle *xrects = calloc(nr_rects, sizeof(XRectangle));

				for (i=0; i<nr_rects; i++)
				{
					xrects[i].x = rects[i].x - x;
					xrects[i].y = rects[i].y - y;
					xrects[i].width = rects[i].width;
					xrects[i].height = rects[i].height;
				}

				XShapeCombineRectangles(hdl->disp, hdl->subwin, ShapeBounding, x, y, xrects, nr_rects, ShapeSet, 0);
				free(xrects);
			}

#endif
			XSync(hdl->disp, FALSE);
		}

		return 0;
	}
}