ximagesink, xvimagesink: update for GstXOverlay -> GstVideoOverlay

This commit is contained in:
Tim-Philipp Müller 2011-08-08 10:44:17 +01:00
parent fd448502b9
commit 7f11e9bc30
2 changed files with 32 additions and 28 deletions

View file

@ -22,9 +22,9 @@
*
* XImageSink renders video frames to a drawable (XWindow) on a local or remote
* display. This element can receive a Window ID from the application through
* the XOverlay interface and will then render video frames in this drawable.
* If no Window ID was provided by the application, the element will create its
* own internal window and render into it.
* the #GstVideoOverlay interface and will then render video frames in this
* drawable. If no Window ID was provided by the application, the element will
* create its own internal window and render into it.
*
* <refsect2>
* <title>Scaling</title>
@ -105,7 +105,7 @@
/* Our interfaces */
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/xoverlay.h>
#include <gst/interfaces/videooverlay.h>
#include <gst/video/gstmetavideo.h>
@ -133,7 +133,7 @@ MotifWmHints, MwmHints;
static void gst_ximagesink_reset (GstXImageSink * ximagesink);
static void gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink);
static void gst_ximagesink_expose (GstXOverlay * overlay);
static void gst_ximagesink_expose (GstVideoOverlay * overlay);
static GstStaticPadTemplate gst_ximagesink_sink_template_factory =
GST_STATIC_PAD_TEMPLATE ("sink",
@ -169,11 +169,12 @@ enum
/* */
/* =========================================== */
static void gst_ximagesink_navigation_init (GstNavigationInterface * klass);
static void gst_ximagesink_xoverlay_init (GstXOverlayClass * klass);
static void gst_ximagesink_video_overlay_init (GstVideoOverlayIface * iface);
#define gst_ximagesink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstXImageSink, gst_ximagesink, GST_TYPE_VIDEO_SINK,
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION, gst_ximagesink_navigation_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_X_OVERLAY, gst_ximagesink_xoverlay_init));
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
gst_ximagesink_video_overlay_init));
/* ============================================================= */
/* */
@ -452,7 +453,8 @@ gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
gst_ximagesink_xwindow_decorate (ximagesink, xwindow);
gst_x_overlay_got_window_handle (GST_X_OVERLAY (ximagesink), xwindow->win);
gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (ximagesink),
xwindow->win);
return xwindow;
}
@ -659,7 +661,7 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
g_mutex_unlock (ximagesink->x_lock);
g_mutex_unlock (ximagesink->flow_lock);
gst_ximagesink_expose (GST_X_OVERLAY (ximagesink));
gst_ximagesink_expose (GST_VIDEO_OVERLAY (ximagesink));
g_mutex_lock (ximagesink->flow_lock);
g_mutex_lock (ximagesink->x_lock);
@ -1116,7 +1118,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
g_mutex_lock (ximagesink->flow_lock);
if (!ximagesink->xwindow) {
g_mutex_unlock (ximagesink->flow_lock);
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (ximagesink));
gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (ximagesink));
} else {
g_mutex_unlock (ximagesink->flow_lock);
}
@ -1562,7 +1564,7 @@ gst_ximagesink_navigation_init (GstNavigationInterface * iface)
}
static void
gst_ximagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
gst_ximagesink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
{
XID xwindow_id = id;
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
@ -1632,7 +1634,7 @@ gst_ximagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
}
static void
gst_ximagesink_expose (GstXOverlay * overlay)
gst_ximagesink_expose (GstVideoOverlay * overlay)
{
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
@ -1641,7 +1643,7 @@ gst_ximagesink_expose (GstXOverlay * overlay)
}
static void
gst_ximagesink_set_event_handling (GstXOverlay * overlay,
gst_ximagesink_set_event_handling (GstVideoOverlay * overlay,
gboolean handle_events)
{
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
@ -1677,7 +1679,7 @@ gst_ximagesink_set_event_handling (GstXOverlay * overlay,
}
static void
gst_ximagesink_xoverlay_init (GstXOverlayClass * iface)
gst_ximagesink_video_overlay_init (GstVideoOverlayIface * iface)
{
iface->set_window_handle = gst_ximagesink_set_window_handle;
iface->expose = gst_ximagesink_expose;
@ -1738,7 +1740,7 @@ gst_ximagesink_set_property (GObject * object, guint prop_id,
}
break;
case PROP_HANDLE_EVENTS:
gst_ximagesink_set_event_handling (GST_X_OVERLAY (ximagesink),
gst_ximagesink_set_event_handling (GST_VIDEO_OVERLAY (ximagesink),
g_value_get_boolean (value));
gst_ximagesink_manage_event_thread (ximagesink);
break;

View file

@ -115,7 +115,7 @@
/* Our interfaces */
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/xoverlay.h>
#include <gst/interfaces/videooverlay.h>
#include <gst/interfaces/colorbalance.h>
#include <gst/interfaces/propertyprobe.h>
/* Helper functions */
@ -146,7 +146,7 @@ MotifWmHints, MwmHints;
static void gst_xvimagesink_reset (GstXvImageSink * xvimagesink);
static void gst_xvimagesink_xwindow_update_geometry (GstXvImageSink *
xvimagesink);
static void gst_xvimagesink_expose (GstXOverlay * overlay);
static void gst_xvimagesink_expose (GstVideoOverlay * overlay);
/* Default template - initiated with class struct to allow gst-register to work
without X running */
@ -194,7 +194,7 @@ enum
/* */
/* =========================================== */
static void gst_xvimagesink_navigation_init (GstNavigationInterface * iface);
static void gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface);
static void gst_xvimagesink_video_overlay_init (GstVideoOverlayIface * iface);
static void gst_xvimagesink_colorbalance_init (GstColorBalanceClass * iface);
static void
gst_xvimagesink_property_probe_interface_init (GstPropertyProbeInterface *
@ -203,7 +203,8 @@ gst_xvimagesink_property_probe_interface_init (GstPropertyProbeInterface *
G_DEFINE_TYPE_WITH_CODE (GstXvImageSink, gst_xvimagesink, GST_TYPE_VIDEO_SINK,
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
gst_xvimagesink_navigation_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_X_OVERLAY, gst_xvimagesink_xoverlay_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
gst_xvimagesink_video_overlay_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
gst_xvimagesink_colorbalance_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_PROPERTY_PROBE,
@ -514,7 +515,8 @@ gst_xvimagesink_xwindow_new (GstXvImageSink * xvimagesink,
gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
gst_x_overlay_got_window_handle (GST_X_OVERLAY (xvimagesink), xwindow->win);
gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (xvimagesink),
xwindow->win);
return xwindow;
}
@ -791,7 +793,7 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
g_mutex_unlock (xvimagesink->x_lock);
g_mutex_unlock (xvimagesink->flow_lock);
gst_xvimagesink_expose (GST_X_OVERLAY (xvimagesink));
gst_xvimagesink_expose (GST_VIDEO_OVERLAY (xvimagesink));
g_mutex_lock (xvimagesink->flow_lock);
g_mutex_lock (xvimagesink->x_lock);
@ -1623,7 +1625,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
g_mutex_lock (xvimagesink->flow_lock);
if (!xvimagesink->xwindow) {
g_mutex_unlock (xvimagesink->flow_lock);
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (xvimagesink));
gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (xvimagesink));
} else {
g_mutex_unlock (xvimagesink->flow_lock);
}
@ -2090,7 +2092,7 @@ gst_xvimagesink_navigation_init (GstNavigationInterface * iface)
}
static void
gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
gst_xvimagesink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
{
XID xwindow_id = id;
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@ -2170,7 +2172,7 @@ gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
}
static void
gst_xvimagesink_expose (GstXOverlay * overlay)
gst_xvimagesink_expose (GstVideoOverlay * overlay)
{
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@ -2180,7 +2182,7 @@ gst_xvimagesink_expose (GstXOverlay * overlay)
}
static void
gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
gst_xvimagesink_set_event_handling (GstVideoOverlay * overlay,
gboolean handle_events)
{
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@ -2216,7 +2218,7 @@ gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
}
static void
gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
gst_xvimagesink_set_render_rectangle (GstVideoOverlay * overlay, gint x, gint y,
gint width, gint height)
{
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@ -2238,7 +2240,7 @@ gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
}
static void
gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface)
gst_xvimagesink_video_overlay_init (GstVideoOverlayIface * iface)
{
iface->set_window_handle = gst_xvimagesink_set_window_handle;
iface->expose = gst_xvimagesink_expose;
@ -2551,7 +2553,7 @@ gst_xvimagesink_set_property (GObject * object, guint prop_id,
xvimagesink->keep_aspect = g_value_get_boolean (value);
break;
case PROP_HANDLE_EVENTS:
gst_xvimagesink_set_event_handling (GST_X_OVERLAY (xvimagesink),
gst_xvimagesink_set_event_handling (GST_VIDEO_OVERLAY (xvimagesink),
g_value_get_boolean (value));
gst_xvimagesink_manage_event_thread (xvimagesink);
break;