*
* XSync (disp, FALSE);
*
- * gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
+ * gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
* win);
*
* gst_message_unref (message);
* usually the case when the application creates the videosink to use
* (e.g. #xvimagesink, #ximagesink, etc.) itself; in this case, the application
* can just create the videosink element, create and realize the window to
- * render the video on and then call gst_x_overlay_set_xwindow_id() directly
+ * render the video on and then call gst_x_overlay_set_window_handle() directly
* with the XID or native window handle, before starting up the pipeline.
* </para>
* <para>
* </para>
* <para>
* As response to the prepare-xwindow-id element message in the bus sync
- * handler, the application may use gst_x_overlay_set_xwindow_id() to tell
+ * handler, the application may use gst_x_overlay_set_window_handle() to tell
* the video sink to render onto an existing window surface. At this point the
* application should already have obtained the window handle / XID, so it
* just needs to set it. It is generally not advisable to call any GUI toolkit
*
* // GST_MESSAGE_SRC (message) will be the video sink element
* xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
- * gst_x_overlay_set_xwindow_id (xoverlay, video_window_xid);
+ * gst_x_overlay_set_window_handle (xoverlay, video_window_xid);
* } else {
* g_warning ("Should have obtained video_window_xid by now!");
* }
* window.show();
*
* WId xwinid = window.winId();
- * gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
+ * gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
*
* // run the pipeline
*
static void
gst_x_overlay_base_init (gpointer g_class)
{
- GstXOverlayClass *overlay_class = (GstXOverlayClass *) g_class;
- overlay_class->set_xwindow_id = NULL;
}
/**
* use this method to tell to a XOverlay to display video output to a
* specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
* stop using that window and create an internal one.
+ *
+ * Deprecated: Use gst_x_overlay_set_window_handle() instead.
*/
+#ifndef GST_REMOVE_DEPRECATED
+#ifdef GST_DISABLE_DEPRECATED
+void gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
+#endif
void
gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
+{
+ GST_WARNING_OBJECT (overlay,
+ "Using deprecated gst_x_overlay_set_xwindow_id()");
+ gst_x_overlay_set_window_handle (overlay, xwindow_id);
+}
+#endif
+
+/**
+ * gst_x_overlay_set_window_handle:
+ * @overlay: a #GstXOverlay to set the XWindow on.
+ * @xwindow_id: a #XID referencing the XWindow.
+ *
+ * This will call the video overlay's set_window_handle method. You
+ * should use this method to tell to a XOverlay to display video output to a
+ * specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
+ * stop using that window and create an internal one.
+ *
+ * Since: 0.10.31
+ */
+void
+gst_x_overlay_set_window_handle (GstXOverlay * overlay, guintptr handle)
{
GstXOverlayClass *klass;
klass = GST_X_OVERLAY_GET_CLASS (overlay);
- if (klass->set_xwindow_id) {
- klass->set_xwindow_id (overlay, xwindow_id);
+ if (klass->set_window_handle) {
+ klass->set_window_handle (overlay, handle);
+ } else {
+#ifndef GST_REMOVE_DEPRECATED
+#ifdef GST_DISABLE_DEPRECATED
+#define set_xwindow_id set_xwindow_id_disabled
+#endif
+ if (sizeof (guintptr) <= sizeof (gulong) && klass->set_xwindow_id) {
+ GST_WARNING_OBJECT (overlay,
+ "Calling deprecated set_xwindow_id() method");
+ klass->set_xwindow_id (overlay, handle);
+ } else {
+ g_warning ("Refusing to cast guintptr to smaller gulong");
+ }
+#endif
}
}
* This will post a "have-xwindow-id" element message on the bus.
*
* This function should only be used by video overlay plugin developers.
+ *
+ * Deprecated: Use gst_x_overlay_got_window_handle() instead.
*/
+#ifndef GST_REMOVE_DEPRECATED
+#ifdef GST_DISABLE_DEPRECATED
+void gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
+#endif
void
gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
+{
+ GST_WARNING_OBJECT (overlay,
+ "Using deprecated gst_x_overlay_got_xwindow_id()");
+ gst_x_overlay_got_xwindow_id (overlay, xwindow_id);
+}
+#endif
+
+/**
+ * gst_x_overlay_got_window_handle:
+ * @overlay: a #GstXOverlay which got a window
+ * @handle: a platform-specific handle referencing the window
+ *
+ * This will post a "have-xwindow-id" element message on the bus.
+ *
+ * This function should only be used by video overlay plugin developers.
+ */
+void
+gst_x_overlay_got_window_handle (GstXOverlay * overlay, guintptr handle)
{
GstStructure *s;
GstMessage *msg;
g_return_if_fail (overlay != NULL);
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
- GST_LOG_OBJECT (GST_OBJECT (overlay), "xwindow_id = %lu", xwindow_id);
- s = gst_structure_new ("have-xwindow-id", "xwindow-id", G_TYPE_ULONG,
- xwindow_id, NULL);
+ GST_LOG_OBJECT (GST_OBJECT (overlay), "xwindow_id = %" G_GUINTPTR_FORMAT,
+ handle);
+ s = gst_structure_new ("have-xwindow-id",
+ "xwindow-id", G_TYPE_ULONG, (unsigned long) handle,
+ "window-handle", G_TYPE_UINT64, (guint64) handle, NULL);
msg = gst_message_new_element (GST_OBJECT (overlay), s);
gst_element_post_message (GST_ELEMENT (overlay), msg);
}
* @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
+ * gst_x_overlay_set_window_handle(). 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
GTypeInterface klass;
/* virtual functions */
+#ifndef GST_DISABLE_DEPRECATED
void (* set_xwindow_id) (GstXOverlay *overlay,
gulong xwindow_id);
+#else
+ void (* set_xwindow_id_disabled) (GstXOverlay *overlay,
+ gulong xwindow_id);
+#endif /* not GST_DISABLE_DEPRECATED */
void (* expose) (GstXOverlay *overlay);
gint x, gint y,
gint width, gint height);
+ void (* set_window_handle) (GstXOverlay *overlay,
+ guintptr handle);
/*< private >*/
- gpointer _gst_reserved[GST_PADDING - 2];
+ gpointer _gst_reserved[GST_PADDING - 3];
};
GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */
+#ifndef GST_DISABLE_DEPRECATED
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay,
gulong xwindow_id);
+#endif
gboolean gst_x_overlay_set_render_rectangle (GstXOverlay *overlay,
gint x, gint y,
void gst_x_overlay_handle_events (GstXOverlay *overlay,
gboolean handle_events);
+void gst_x_overlay_set_window_handle (GstXOverlay *overlay,
+ guintptr handle);
/* public methods to dispatch bus messages */
+#ifndef GST_DISABLE_DEPRECATED
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
+#endif
+
+void gst_x_overlay_got_window_handle (GstXOverlay *overlay,
+ guintptr handle);
void gst_x_overlay_prepare_xwindow_id (GstXOverlay *overlay);
GMutex *mutex;
};
-static void gst_v4l_xoverlay_set_xwindow_id (GstXOverlay * overlay,
- XID xwindow_id);
+static void gst_v4l_xoverlay_set_window_handle (GstXOverlay * overlay,
+ guintptr xwindow_id);
void
gst_v4l_xoverlay_interface_init (GstXOverlayClass * klass)
{
/* default virtual functions */
- klass->set_xwindow_id = gst_v4l_xoverlay_set_xwindow_id;
+ klass->set_window_handle = gst_v4l_xoverlay_set_window_handle;
GST_DEBUG_CATEGORY_INIT (v4lxv_debug, "v4lxv", 0,
"V4L XOverlay interface debugging");
v4lelement->xv = v4lxv;
if (v4lelement->xwindow_id) {
- gst_v4l_xoverlay_set_xwindow_id (GST_X_OVERLAY (v4lelement),
+ gst_v4l_xoverlay_set_window_handle (GST_X_OVERLAY (v4lelement),
v4lelement->xwindow_id);
}
}
return;
if (v4lelement->xwindow_id) {
- gst_v4l_xoverlay_set_xwindow_id (GST_X_OVERLAY (v4lelement), 0);
+ gst_v4l_xoverlay_set_window_handle (GST_X_OVERLAY (v4lelement), 0);
}
XCloseDisplay (v4lxv->dpy);
}
static void
-gst_v4l_xoverlay_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
+gst_v4l_xoverlay_set_window_handle (GstXOverlay * overlay, guintptr id)
{
+ XID xwindow_id = id;
GstV4lElement *v4lelement = GST_V4LELEMENT (overlay);
GstV4lXv *v4lxv;
XWindowAttributes attr;
gst_ximagesink_xwindow_decorate (ximagesink, xwindow);
- gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (ximagesink), xwindow->win);
+ gst_x_overlay_got_window_handle (GST_X_OVERLAY (ximagesink), xwindow->win);
return xwindow;
}
}
static void
-gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
+gst_ximagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
{
+ XID xwindow_id = id;
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
GstXWindow *xwindow = NULL;
XWindowAttributes attr;
static void
gst_ximagesink_xoverlay_init (GstXOverlayClass * iface)
{
- iface->set_xwindow_id = gst_ximagesink_set_xwindow_id;
+ iface->set_window_handle = gst_ximagesink_set_window_handle;
iface->expose = gst_ximagesink_expose;
iface->handle_events = gst_ximagesink_set_event_handling;
}
gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
- gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (xvimagesink), xwindow->win);
+ gst_x_overlay_got_window_handle (GST_X_OVERLAY (xvimagesink), xwindow->win);
return xwindow;
}
}
static void
-gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
+gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
{
+ XID xwindow_id = id;
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
GstXWindow *xwindow = NULL;
static void
gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface)
{
- iface->set_xwindow_id = gst_xvimagesink_set_xwindow_id;
+ iface->set_window_handle = gst_xvimagesink_set_window_handle;
iface->expose = gst_xvimagesink_expose;
iface->handle_events = gst_xvimagesink_set_event_handling;
iface->set_render_rectangle = gst_xvimagesink_set_render_rectangle;
video_window_xwindow = gtk_widget_get_window (video_window);
embed_xid = GDK_WINDOW_XID (video_window_xwindow);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
/* run the pipeline */
window.show();
WId xwinid = window.winId();
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
/* run the pipeline */
* just set it directly here now (instead of waiting for a prepare-xwindow-id
* element message in a sync bus handler and setting it there) */
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (sret == GST_STATE_CHANGE_FAILURE) {
* shouldn't be done from a non-GUI thread without explicit locking). */
g_assert (embed_xid != 0);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (element), embed_xid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid);
}
return GST_BUS_PASS;
}
* shouldn't be done from a non-GUI thread without explicit locking). */
g_assert (embed_xid != 0);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (element), embed_xid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid);
}
return GST_BUS_PASS;
}
XSync (disp, FALSE);
- gst_x_overlay_set_xwindow_id (ov, win);
+ gst_x_overlay_set_window_handle (ov, win);
if (old_win) {
XDestroyWindow (disp, old_win);
* just set it directly here now (instead of waiting for a prepare-xwindow-id
* element message in a sync bus handler and setting it there) */
g_print ("setting XID %lu\n", embed_xid);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
g_idle_add (start_pipeline, pipeline);
gtk_main ();
/* we know what the video sink is in this case (xvimagesink), so we can
* just set it directly here now (instead of waiting for a prepare-xwindow-id
* element message in a sync bus handler and setting it there) */
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
+ gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
anim_state.overlay = GST_X_OVERLAY (sink);
anim_state.widget = video_window;
gst_video_orientation_set_vflip
gst_x_overlay_expose
gst_x_overlay_get_type
+ gst_x_overlay_got_window_handle
gst_x_overlay_got_xwindow_id
gst_x_overlay_handle_events
gst_x_overlay_prepare_xwindow_id
gst_x_overlay_set_render_rectangle
+ gst_x_overlay_set_window_handle
gst_x_overlay_set_xwindow_id