diff options
author | Matthew Waters <matthew@centricular.com> | 2015-05-29 18:03:52 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2015-05-31 16:04:13 +1000 |
commit | fac0cdc7ac76ee50dcb8e3376923e3945af490cc (patch) | |
tree | 4149c03ea24a57d59f76ba62c48421777a3f1cc4 /ext | |
parent | 2442c240f5dd669803aa22fda665296d39b7e07b (diff) | |
download | gstreamer-plugins-bad-fac0cdc7ac76ee50dcb8e3376923e3945af490cc.tar.gz |
glwindow: handle gst_video_overlay_set_render_rectangle
Diffstat (limited to 'ext')
-rw-r--r-- | ext/gl/gstglimagesink.c | 32 | ||||
-rw-r--r-- | ext/gl/gstglimagesink.h | 6 |
2 files changed, 35 insertions, 3 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 648b8dac3..30ff74fda 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -351,9 +351,9 @@ static void gst_glimage_sink_video_overlay_init (GstVideoOverlayInterface * static void gst_glimage_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id); static void gst_glimage_sink_expose (GstVideoOverlay * overlay); - -static void -gst_glimage_sink_handle_events (GstVideoOverlay * overlay, +static void gst_glimage_sink_set_render_rectangle (GstVideoOverlay * overlay, + gint x, gint y, gint width, gint height); +static void gst_glimage_sink_handle_events (GstVideoOverlay * overlay, gboolean handle_events); static GstStaticPadTemplate gst_glimage_sink_template = @@ -761,6 +761,12 @@ _ensure_gl_setup (GstGLImageSink * gl_sink) g_signal_connect (window, "mouse-event", G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink); + if (gl_sink->x >= 0 && gl_sink->y >= 0 && gl_sink->width > 0 && + gl_sink->height > 0) { + gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y, + gl_sink->width, gl_sink->height); + } + if (other_context) gst_object_unref (other_context); gst_object_unref (window); @@ -1234,6 +1240,7 @@ static void gst_glimage_sink_video_overlay_init (GstVideoOverlayInterface * iface) { iface->set_window_handle = gst_glimage_sink_set_window_handle; + iface->set_render_rectangle = gst_glimage_sink_set_render_rectangle; iface->handle_events = gst_glimage_sink_handle_events; iface->expose = gst_glimage_sink_expose; } @@ -1288,6 +1295,25 @@ gst_glimage_sink_handle_events (GstVideoOverlay * overlay, } } +static void +gst_glimage_sink_set_render_rectangle (GstVideoOverlay * overlay, + gint x, gint y, gint width, gint height) +{ + GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (overlay); + + if (G_LIKELY (glimage_sink->context)) { + GstGLWindow *window; + window = gst_gl_context_get_window (glimage_sink->context); + gst_gl_window_set_render_rectangle (window, x, y, width, height); + gst_object_unref (window); + } + + glimage_sink->x = x; + glimage_sink->y = y; + glimage_sink->width = width; + glimage_sink->height = height; +} + static gboolean gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) { diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h index 52db017bc..03e81365c 100644 --- a/ext/gl/gstglimagesink.h +++ b/ext/gl/gstglimagesink.h @@ -56,6 +56,12 @@ struct _GstGLImageSink gulong mouse_sig_id; gulong key_sig_id; + /* GstVideoOverlay::set_render_rectangle() cache */ + gint x; + gint y; + gint width; + gint height; + //caps GstVideoInfo info; GstCaps *caps; |