summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2004-02-03 23:05:46 +0000
committerJulien Moutte <julien@moutte.net>2004-02-03 23:05:46 +0000
commitd1f51a277381a84644b6e6b526ee8c65b3ad4566 (patch)
tree94096a2ce4e1e09106e61ed1e69dcc3ce7b62c35
parentbc966f3c487e6b2f1d6d80640ae2ed9980c3921a (diff)
downloadgstreamer-plugins-base-d1f51a277381a84644b6e6b526ee8c65b3ad4566.tar.gz
gst-libs/gst/xoverlay/xoverlay.*: Adding the _expose method to tell an overlay to redraw the image because it has bee...
Original commit message from CVS: 2004-02-04 Julien MOUTTE <julien@moutte.net> * gst-libs/gst/xoverlay/xoverlay.c: (gst_x_overlay_expose): * gst-libs/gst/xoverlay/xoverlay.h: Adding the _expose method to tell an overlay to redraw the image because it has been exposed. * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put), (gst_ximagesink_expose), (gst_ximagesink_xoverlay_init), (gst_ximagesink_init): * sys/ximage/ximagesink.h: Implement expose method from XOverlay interface * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put), (gst_xvimagesink_expose), (gst_xvimagesink_xoverlay_init), (gst_xvimagesink_init): * sys/xvimage/xvimagesink.h: Implement expose method from XOverlay interface
-rw-r--r--ChangeLog16
-rw-r--r--gst-libs/gst/interfaces/xoverlay.c17
-rw-r--r--gst-libs/gst/interfaces/xoverlay.h2
-rw-r--r--gst-libs/gst/xoverlay/xoverlay.c17
-rw-r--r--gst-libs/gst/xoverlay/xoverlay.h2
-rw-r--r--sys/ximage/ximagesink.c19
-rw-r--r--sys/ximage/ximagesink.h1
-rw-r--r--sys/xvimage/xvimagesink.c20
-rw-r--r--sys/xvimage/xvimagesink.h1
9 files changed, 95 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e8c5eb948..0d81d3b18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2004-02-04 Julien MOUTTE <julien@moutte.net>
+
+ * gst-libs/gst/xoverlay/xoverlay.c: (gst_x_overlay_expose):
+ * gst-libs/gst/xoverlay/xoverlay.h: Adding the _expose method to tell
+ an overlay to redraw the image because it has been exposed.
+ * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_destroy),
+ (gst_ximagesink_ximage_put), (gst_ximagesink_expose),
+ (gst_ximagesink_xoverlay_init), (gst_ximagesink_init):
+ * sys/ximage/ximagesink.h: Implement expose method from XOverlay
+ interface
+ * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_destroy),
+ (gst_xvimagesink_xvimage_put), (gst_xvimagesink_expose),
+ (gst_xvimagesink_xoverlay_init), (gst_xvimagesink_init):
+ * sys/xvimage/xvimagesink.h: Implement expose method from XOverlay
+ interface
+
2004-02-03 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_type_find):
diff --git a/gst-libs/gst/interfaces/xoverlay.c b/gst-libs/gst/interfaces/xoverlay.c
index 2efe29666..73004f68a 100644
--- a/gst-libs/gst/interfaces/xoverlay.c
+++ b/gst-libs/gst/interfaces/xoverlay.c
@@ -183,3 +183,20 @@ gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
g_signal_emit (G_OBJECT (overlay),
gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
}
+
+/**
+ * gst_x_overlay_expose:
+ * @overlay: a #GstXOverlay to expose.
+ *
+ * Tell an overlay that it has been exposed. This will redraw the current frame
+ * in the drawable even if the pipeline is PAUSED.
+ */
+void
+gst_x_overlay_expose (GstXOverlay *overlay)
+{
+ GstXOverlayClass *klass = GST_X_OVERLAY_GET_CLASS (overlay);
+
+ if (klass->expose) {
+ klass->expose (overlay);
+ }
+}
diff --git a/gst-libs/gst/interfaces/xoverlay.h b/gst-libs/gst/interfaces/xoverlay.h
index 4c6848705..d92dc5ff0 100644
--- a/gst-libs/gst/interfaces/xoverlay.h
+++ b/gst-libs/gst/interfaces/xoverlay.h
@@ -54,6 +54,7 @@ typedef struct _GstXOverlayClass {
void (* get_desired_size) (GstXOverlay *overlay,
guint *width,
guint *height);
+ void (* expose) (GstXOverlay *overlay);
/* signals */
void (*have_xwindow_id) (GstXOverlay *overlay,
@@ -70,6 +71,7 @@ GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
+void gst_x_overlay_expose (GstXOverlay *overlay);
/* public methods to fire signals */
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
diff --git a/gst-libs/gst/xoverlay/xoverlay.c b/gst-libs/gst/xoverlay/xoverlay.c
index 2efe29666..73004f68a 100644
--- a/gst-libs/gst/xoverlay/xoverlay.c
+++ b/gst-libs/gst/xoverlay/xoverlay.c
@@ -183,3 +183,20 @@ gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
g_signal_emit (G_OBJECT (overlay),
gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
}
+
+/**
+ * gst_x_overlay_expose:
+ * @overlay: a #GstXOverlay to expose.
+ *
+ * Tell an overlay that it has been exposed. This will redraw the current frame
+ * in the drawable even if the pipeline is PAUSED.
+ */
+void
+gst_x_overlay_expose (GstXOverlay *overlay)
+{
+ GstXOverlayClass *klass = GST_X_OVERLAY_GET_CLASS (overlay);
+
+ if (klass->expose) {
+ klass->expose (overlay);
+ }
+}
diff --git a/gst-libs/gst/xoverlay/xoverlay.h b/gst-libs/gst/xoverlay/xoverlay.h
index 4c6848705..d92dc5ff0 100644
--- a/gst-libs/gst/xoverlay/xoverlay.h
+++ b/gst-libs/gst/xoverlay/xoverlay.h
@@ -54,6 +54,7 @@ typedef struct _GstXOverlayClass {
void (* get_desired_size) (GstXOverlay *overlay,
guint *width,
guint *height);
+ void (* expose) (GstXOverlay *overlay);
/* signals */
void (*have_xwindow_id) (GstXOverlay *overlay,
@@ -70,6 +71,7 @@ GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
+void gst_x_overlay_expose (GstXOverlay *overlay);
/* public methods to fire signals */
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
index 8e5d39192..0d47b7b64 100644
--- a/sys/ximage/ximagesink.c
+++ b/sys/ximage/ximagesink.c
@@ -221,6 +221,10 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
g_return_if_fail (ximagesink != NULL);
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
+ /* If the destroyed image is the current one we destroy our reference too */
+ if (ximagesink->cur_image == ximage)
+ ximagesink->cur_image = NULL;
+
g_mutex_lock (ximagesink->x_lock);
#ifdef HAVE_XSHM
@@ -262,6 +266,10 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
g_return_if_fail (ximagesink != NULL);
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
+ /* Store a reference to the last image we put */
+ if (ximagesink->cur_image != ximage)
+ ximagesink->cur_image = ximage;
+
/* We center the image in the window */
x = MAX (0, (ximagesink->xwindow->width - ximage->width) / 2);
y = MAX (0, (ximagesink->xwindow->height- ximage->height) / 2);
@@ -1210,10 +1218,20 @@ gst_ximagesink_get_desired_size (GstXOverlay *overlay,
}
static void
+gst_ximagesink_expose (GstXOverlay *overlay)
+{
+ GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
+
+ if (ximagesink->cur_image)
+ gst_ximagesink_ximage_put (ximagesink, ximagesink->cur_image);
+}
+
+static void
gst_ximagesink_xoverlay_init (GstXOverlayClass *iface)
{
iface->set_xwindow_id = gst_ximagesink_set_xwindow_id;
iface->get_desired_size = gst_ximagesink_get_desired_size;
+ iface->expose = gst_ximagesink_expose;
}
/* =========================================== */
@@ -1318,6 +1336,7 @@ gst_ximagesink_init (GstXImageSink *ximagesink)
ximagesink->xcontext = NULL;
ximagesink->xwindow = NULL;
ximagesink->ximage = NULL;
+ ximagesink->cur_image = NULL;
ximagesink->framerate = 0;
diff --git a/sys/ximage/ximagesink.h b/sys/ximage/ximagesink.h
index fba3360f6..b30de8e9a 100644
--- a/sys/ximage/ximagesink.h
+++ b/sys/ximage/ximagesink.h
@@ -111,6 +111,7 @@ struct _GstXImageSink {
GstXContext *xcontext;
GstXWindow *xwindow;
GstXImage *ximage;
+ GstXImage *cur_image;
gdouble framerate;
GMutex *x_lock;
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index 19d817d5d..1c5e5b596 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -233,6 +233,10 @@ gst_xvimagesink_xvimage_destroy (GstXvImageSink *xvimagesink,
g_return_if_fail (xvimagesink != NULL);
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
+ /* If the destroyed image is the current one we destroy our reference too */
+ if (xvimagesink->cur_image == xvimage)
+ xvimagesink->cur_image = NULL;
+
g_mutex_lock (xvimagesink->x_lock);
#ifdef HAVE_XSHM
@@ -272,6 +276,10 @@ gst_xvimagesink_xvimage_put (GstXvImageSink *xvimagesink, GstXvImage *xvimage)
g_return_if_fail (xvimagesink != NULL);
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
+ /* Store a reference to the last image we put */
+ if (xvimagesink->cur_image != xvimage)
+ xvimagesink->cur_image = xvimage;
+
g_mutex_lock (xvimagesink->x_lock);
/* We scale to the window's geometry */
@@ -1468,10 +1476,21 @@ gst_xvimagesink_get_desired_size (GstXOverlay *overlay,
}
static void
+gst_xvimagesink_expose (GstXOverlay *overlay)
+{
+ GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
+
+ if (xvimagesink->cur_image) {
+ gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->cur_image);
+ }
+}
+
+static void
gst_xvimagesink_xoverlay_init (GstXOverlayClass *iface)
{
iface->set_xwindow_id = gst_xvimagesink_set_xwindow_id;
iface->get_desired_size = gst_xvimagesink_get_desired_size;
+ iface->expose = gst_xvimagesink_expose;
}
static const GList *
@@ -1712,6 +1731,7 @@ gst_xvimagesink_init (GstXvImageSink *xvimagesink)
xvimagesink->xcontext = NULL;
xvimagesink->xwindow = NULL;
xvimagesink->xvimage = NULL;
+ xvimagesink->cur_image = NULL;
xvimagesink->hue = xvimagesink->saturation = 0;
xvimagesink->contrast = xvimagesink->brightness = 0;
diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h
index 5329ead01..2645bf722 100644
--- a/sys/xvimage/xvimagesink.h
+++ b/sys/xvimage/xvimagesink.h
@@ -127,6 +127,7 @@ struct _GstXvImageSink {
GstXContext *xcontext;
GstXWindow *xwindow;
GstXvImage *xvimage;
+ GstXvImage *cur_image;
gdouble framerate;