mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
xoverlay: add new vmethod ::set_render_rectangle()
Add set_render_rectangle() vmethod to the interface to better support windowless toolkits (e.g. qt graphicsview or video on canvas in general). Right now we always fill the widget to 100%. With the patch we can use a rectangular target region. Fixes #610249. API: GstXOverlay::set_render_rectangle()
This commit is contained in:
parent
7b13aeee32
commit
7269bc26d0
4 changed files with 63 additions and 12 deletions
|
@ -790,6 +790,7 @@ gst_x_overlay_got_xwindow_id
|
||||||
gst_x_overlay_prepare_xwindow_id
|
gst_x_overlay_prepare_xwindow_id
|
||||||
gst_x_overlay_expose
|
gst_x_overlay_expose
|
||||||
gst_x_overlay_handle_events
|
gst_x_overlay_handle_events
|
||||||
|
gst_x_overlay_set_render_rectangle
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GST_TYPE_X_OVERLAY
|
GST_TYPE_X_OVERLAY
|
||||||
GST_X_OVERLAY
|
GST_X_OVERLAY
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
lib_LTLIBRARIES = libgstinterfaces-@GST_MAJORMINOR@.la
|
lib_LTLIBRARIES = libgstinterfaces-@GST_MAJORMINOR@.la
|
||||||
libgstinterfacesincludedir = \
|
libgstinterfacesincludedir = \
|
||||||
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/interfaces
|
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/interfaces \
|
||||||
|
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video
|
||||||
|
|
||||||
headers_interfaces = \
|
headers_interfaces = \
|
||||||
colorbalance.h \
|
colorbalance.h \
|
||||||
|
@ -89,10 +90,13 @@ GstInterfaces-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstinterfaces-@G
|
||||||
-I$(top_srcdir)/gst-libs \
|
-I$(top_srcdir)/gst-libs \
|
||||||
-I$(top_builddir)/gst-libs \
|
-I$(top_builddir)/gst-libs \
|
||||||
--add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
|
--add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
|
||||||
|
--add-include-path=$(builddir)/../video \
|
||||||
--library=gstinterfaces-0.10 \
|
--library=gstinterfaces-0.10 \
|
||||||
--include=Gst-0.10 \
|
--include=Gst-0.10 \
|
||||||
|
--include=GstVideo-0.10 \
|
||||||
--libtool="$(top_builddir)/libtool" \
|
--libtool="$(top_builddir)/libtool" \
|
||||||
--pkg gstreamer-0.10 \
|
--pkg gstreamer-0.10 \
|
||||||
|
--pkg gstreamer-video-0.10 \
|
||||||
--output $@ \
|
--output $@ \
|
||||||
$(gir_headers) \
|
$(gir_headers) \
|
||||||
$(gir_sources)
|
$(gir_sources)
|
||||||
|
|
|
@ -456,3 +456,41 @@ gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
|
||||||
klass->handle_events (overlay, handle_events);
|
klass->handle_events (overlay, handle_events);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_x_overlay_set_render_rectangle:
|
||||||
|
* @overlay: a #GstXOverlay
|
||||||
|
* @rect: the target area inside the window
|
||||||
|
*
|
||||||
|
* Configure a subregion as a video target within the window set by
|
||||||
|
* gst_x_overlay_set_xwindow_id(). If this is not used or not supported
|
||||||
|
* the video will fill the area of the window set as the overlay to 100%.
|
||||||
|
* By specifying the rectangle, the video can be overlayed to a specific region
|
||||||
|
* of that window only. After setting the new rectangle one should call
|
||||||
|
* gst_x_overlay_expose() to force a redraw. To unset the region pass %NULL for
|
||||||
|
* the @rect parameter.
|
||||||
|
*
|
||||||
|
* This method is needed for non fullscreen video overlay in UI toolkits that do
|
||||||
|
* not support subwindows.
|
||||||
|
*
|
||||||
|
* Return: %FALSE if not supported by the sink.
|
||||||
|
*
|
||||||
|
* Since: 0.10.27
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_x_overlay_set_render_rectangle (GstXOverlay * overlay,
|
||||||
|
GstVideoRectangle * rect)
|
||||||
|
{
|
||||||
|
GstXOverlayClass *klass;
|
||||||
|
|
||||||
|
g_return_val_if_fail (overlay != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_X_OVERLAY (overlay), FALSE);
|
||||||
|
|
||||||
|
klass = GST_X_OVERLAY_GET_CLASS (overlay);
|
||||||
|
|
||||||
|
if (klass->set_render_rectangle) {
|
||||||
|
klass->set_render_rectangle (overlay, rect);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#define __GST_X_OVERLAY_H__
|
#define __GST_X_OVERLAY_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/video/gstvideosink.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -62,27 +63,34 @@ struct _GstXOverlayClass {
|
||||||
GTypeInterface klass;
|
GTypeInterface klass;
|
||||||
|
|
||||||
/* virtual functions */
|
/* virtual functions */
|
||||||
void (* set_xwindow_id) (GstXOverlay *overlay,
|
void (* set_xwindow_id) (GstXOverlay *overlay,
|
||||||
gulong xwindow_id);
|
gulong xwindow_id);
|
||||||
|
|
||||||
void (* expose) (GstXOverlay *overlay);
|
void (* expose) (GstXOverlay *overlay);
|
||||||
|
|
||||||
void (* handle_events) (GstXOverlay *overlay,
|
void (* handle_events) (GstXOverlay *overlay,
|
||||||
gboolean handle_events);
|
gboolean handle_events);
|
||||||
|
|
||||||
/*< private >*/
|
void (* set_render_rectangle) (GstXOverlay *overlay,
|
||||||
gpointer _gst_reserved[GST_PADDING - 1];
|
GstVideoRectangle *rect);
|
||||||
|
/*< private >*/
|
||||||
|
gpointer _gst_reserved[GST_PADDING - 2];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_x_overlay_get_type (void);
|
GType gst_x_overlay_get_type (void);
|
||||||
|
|
||||||
/* virtual class function wrappers */
|
/* virtual class function wrappers */
|
||||||
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
|
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay,
|
||||||
|
gulong xwindow_id);
|
||||||
|
|
||||||
void gst_x_overlay_expose (GstXOverlay *overlay);
|
gboolean gst_x_overlay_set_render_rectangle (GstXOverlay *overlay,
|
||||||
|
GstVideoRectangle *rect);
|
||||||
|
|
||||||
|
void gst_x_overlay_expose (GstXOverlay *overlay);
|
||||||
|
|
||||||
|
void gst_x_overlay_handle_events (GstXOverlay *overlay,
|
||||||
|
gboolean handle_events);
|
||||||
|
|
||||||
void gst_x_overlay_handle_events (GstXOverlay *overlay,
|
|
||||||
gboolean handle_events);
|
|
||||||
|
|
||||||
/* public methods to dispatch bus messages */
|
/* public methods to dispatch bus messages */
|
||||||
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
|
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
|
||||||
|
|
Loading…
Reference in a new issue