summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2018-01-23 15:04:21 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2018-01-29 16:26:09 +0000
commite368b3105b965fb972d8084b59f1fffb50d263dd (patch)
treeef2de57df667f2045524631214a7a8749f510676 /sys
parentc70dd75f1259e5181fcd37edfe1b7cfdcf1627ee (diff)
downloadgst-plugins-base-e368b3105b965fb972d8084b59f1fffb50d263dd.tar.gz
gst-plugins-base-e368b3105b965fb972d8084b59f1fffb50d263dd.tar.xz
xvimagesink: Allow changing render-rectangle through property
This also enables setting the render rectangle before the window is provided or created. https://bugzilla.gnome.org/show_bug.cgi?id=792798
Diffstat (limited to 'sys')
-rw-r--r--sys/xvimage/xvimagesink.c25
-rw-r--r--sys/xvimage/xvimagesink.h4
2 files changed, 26 insertions, 3 deletions
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index 54f35950b..322117cc6 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -185,7 +185,8 @@ enum
PROP_COLORKEY,
PROP_DRAW_BORDERS,
PROP_WINDOW_WIDTH,
- PROP_WINDOW_HEIGHT
+ PROP_WINDOW_HEIGHT,
+ PROP_LAST
};
/* ============================================================= */
@@ -792,6 +793,13 @@ gst_xv_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_VIDEO_SINK_HEIGHT (xvimagesink));
}
+ if (xvimagesink->pending_render_rect) {
+ xvimagesink->pending_render_rect = FALSE;
+ gst_xwindow_set_render_rectangle (xvimagesink->xwindow,
+ xvimagesink->render_rect.x, xvimagesink->render_rect.y,
+ xvimagesink->render_rect.w, xvimagesink->render_rect.h);
+ }
+
xvimagesink->info = info;
/* After a resize, we want to redraw the borders in case the new frame size
@@ -1271,9 +1279,16 @@ gst_xv_image_sink_set_render_rectangle (GstVideoOverlay * overlay, gint x,
GstXvImageSink *xvimagesink = GST_XV_IMAGE_SINK (overlay);
g_mutex_lock (&xvimagesink->flow_lock);
- if (G_LIKELY (xvimagesink->xwindow))
+ if (G_LIKELY (xvimagesink->xwindow)) {
gst_xwindow_set_render_rectangle (xvimagesink->xwindow, x, y, width,
height);
+ } else {
+ xvimagesink->render_rect.x = x;
+ xvimagesink->render_rect.y = y;
+ xvimagesink->render_rect.w = width;
+ xvimagesink->render_rect.h = height;
+ xvimagesink->pending_render_rect = TRUE;
+ }
g_mutex_unlock (&xvimagesink->flow_lock);
}
@@ -1623,7 +1638,8 @@ gst_xv_image_sink_set_property (GObject * object, guint prop_id,
xvimagesink->draw_borders = g_value_get_boolean (value);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ if (!gst_video_overlay_set_property (object, PROP_LAST, prop_id, value))
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -1933,6 +1949,9 @@ gst_xv_image_sink_class_init (GstXvImageSinkClass * klass)
g_param_spec_string ("device-name", "Adaptor name",
"The name of the video adaptor", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ gst_video_overlay_install_properties (gobject_class, PROP_LAST);
+
/**
* GstXvImageSink:handle-expose
*
diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h
index 11779032c..9bf4d79c8 100644
--- a/sys/xvimage/xvimagesink.h
+++ b/sys/xvimage/xvimagesink.h
@@ -120,6 +120,10 @@ struct _GstXvImageSink
/* stream metadata */
gchar *media_title;
+
+ /* saved render rectangle until we have a window */
+ gboolean pending_render_rect;
+ GstVideoRectangle render_rect;
};
struct _GstXvImageSinkClass