mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
xoverlay: change new set_render_rectangle() vfunc to take four arguments so we don't depend on libgstvideo
Don't make libgstinterfaces (and thus libgstaudio etc.) indirectly depend on libgstvideo by using the GstVideoRectangle helper structure in the API, which causes undesirable dependencies, esp. with the gobject-introspection (people will point and laugh at us if they find out that libgstaudio depends on libgstvideo). Instead, pass the x, y, width and height parameters directly to the function. Re-fixes #610249.
This commit is contained in:
parent
133f804d2d
commit
37d000d175
5 changed files with 31 additions and 22 deletions
gst-libs/gst/interfaces
sys/xvimage
tests/icles
|
@ -56,8 +56,7 @@ nodist_libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES = \
|
|||
$(built_sources) \
|
||||
interfaces-marshal.h
|
||||
|
||||
# only need base cflags here, xoverlay includes videosink.h for a struct */
|
||||
libgstinterfaces_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstinterfaces_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstinterfaces_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(LIBM)
|
||||
libgstinterfaces_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
||||
|
||||
|
@ -90,13 +89,10 @@ GstInterfaces-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstinterfaces-@G
|
|||
-I$(top_srcdir)/gst-libs \
|
||||
-I$(top_builddir)/gst-libs \
|
||||
--add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
|
||||
--add-include-path=$(builddir)/../video \
|
||||
--library=gstinterfaces-0.10 \
|
||||
--include=Gst-0.10 \
|
||||
--include=GstVideo-0.10 \
|
||||
--libtool="$(top_builddir)/libtool" \
|
||||
--pkg gstreamer-0.10 \
|
||||
--pkg gstreamer-video-0.10 \
|
||||
--output $@ \
|
||||
$(gir_headers) \
|
||||
$(gir_sources)
|
||||
|
|
|
@ -462,18 +462,21 @@ gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
|
|||
/**
|
||||
* gst_x_overlay_set_render_rectangle:
|
||||
* @overlay: a #GstXOverlay
|
||||
* @rect: the target area inside the window
|
||||
* @x: the horizontal offset of the render area inside the window
|
||||
* @y: the vertical offset of the render area inside the window
|
||||
* @width: the width of the render area inside the window
|
||||
* @height: the height of the render 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.
|
||||
* gst_x_overlay_expose() to force a redraw. To unset the region pass -1 for
|
||||
* the @x, @y, @width, and @height parameters.
|
||||
*
|
||||
* This method is needed for non fullscreen video overlay in UI toolkits that do
|
||||
* not support subwindows.
|
||||
* This method is needed for non fullscreen video overlay in UI toolkits that
|
||||
* do not support subwindows.
|
||||
*
|
||||
* Returns: %FALSE if not supported by the sink.
|
||||
*
|
||||
|
@ -481,17 +484,19 @@ gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
|
|||
*/
|
||||
gboolean
|
||||
gst_x_overlay_set_render_rectangle (GstXOverlay * overlay,
|
||||
GstVideoRectangle * rect)
|
||||
gint x, gint y, gint width, gint height)
|
||||
{
|
||||
GstXOverlayClass *klass;
|
||||
|
||||
g_return_val_if_fail (overlay != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_X_OVERLAY (overlay), FALSE);
|
||||
g_return_val_if_fail ((x == -1 && y == -1 && width == -1 && height == -1) ||
|
||||
(x >= 0 && y >= 0 && width > 0 && height > 0), FALSE);
|
||||
|
||||
klass = GST_X_OVERLAY_GET_CLASS (overlay);
|
||||
|
||||
if (klass->set_render_rectangle) {
|
||||
klass->set_render_rectangle (overlay, rect);
|
||||
klass->set_render_rectangle (overlay, x, y, width, height);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#define __GST_X_OVERLAY_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/gstvideosink.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -56,7 +55,7 @@ typedef struct _GstXOverlayClass GstXOverlayClass;
|
|||
* @set_xwindow_id: virtual method to configure the XWindow id
|
||||
* @expose: virtual method to handle expose events
|
||||
* @handle_events: virtual method to handle events
|
||||
* @set_render_rectangle: virtual method to set the render rectange (since 0.10.29)
|
||||
* @set_render_rectangle: virtual method to set the render rectangle (since 0.10.29)
|
||||
*
|
||||
* #GstXOverlay interface
|
||||
*/
|
||||
|
@ -73,7 +72,9 @@ struct _GstXOverlayClass {
|
|||
gboolean handle_events);
|
||||
|
||||
void (* set_render_rectangle) (GstXOverlay *overlay,
|
||||
GstVideoRectangle *rect);
|
||||
gint x, gint y,
|
||||
gint width, gint height);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING - 2];
|
||||
};
|
||||
|
@ -85,7 +86,8 @@ void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay,
|
|||
gulong xwindow_id);
|
||||
|
||||
gboolean gst_x_overlay_set_render_rectangle (GstXOverlay *overlay,
|
||||
GstVideoRectangle *rect);
|
||||
gint x, gint y,
|
||||
gint width, gint height);
|
||||
|
||||
void gst_x_overlay_expose (GstXOverlay *overlay);
|
||||
|
||||
|
|
|
@ -2858,16 +2858,21 @@ gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay,
|
||||
GstVideoRectangle * rect)
|
||||
gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
|
||||
gint width, gint height)
|
||||
{
|
||||
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
|
||||
|
||||
if (rect) {
|
||||
memcpy (&xvimagesink->render_rect, rect, sizeof (GstVideoRectangle));
|
||||
/* FIXME: how about some locking? */
|
||||
if (x >= 0 && y >= 0 && width >= 0 && height >= 0) {
|
||||
xvimagesink->render_rect.x = x;
|
||||
xvimagesink->render_rect.y = y;
|
||||
xvimagesink->render_rect.w = width;
|
||||
xvimagesink->render_rect.h = height;
|
||||
xvimagesink->have_render_rect = TRUE;
|
||||
} else {
|
||||
xvimagesink->render_rect.x = xvimagesink->render_rect.y = 0;
|
||||
xvimagesink->render_rect.x = 0;
|
||||
xvimagesink->render_rect.y = 0;
|
||||
xvimagesink->render_rect.w = xvimagesink->xwindow->width;
|
||||
xvimagesink->render_rect.h = xvimagesink->xwindow->height;
|
||||
xvimagesink->have_render_rect = FALSE;
|
||||
|
|
|
@ -72,7 +72,8 @@ animate_render_rect (gpointer user_data)
|
|||
r->h = anim_state.h / 2;
|
||||
r->y = (r->h - (r->h / 2)) + s * (r->h / 2);
|
||||
|
||||
gst_x_overlay_set_render_rectangle (anim_state.overlay, r);
|
||||
gst_x_overlay_set_render_rectangle (anim_state.overlay, r->x, r->y,
|
||||
r->w, r->h);
|
||||
gtk_widget_queue_draw (anim_state.widget);
|
||||
}
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue