[cheese] webcam: manually expose the window if not PLAYING



commit b1d6e7b3da09ed46f1dfd41a4378a6c4ebce0eb7
Author: Filippo Argiolas <filippo argiolas gmail com>
Date:   Sat Jul 4 09:29:00 2009 +0200

    webcam: manually expose the window if not PLAYING
    
    Draw a black background if the pipeline is starting up and the overlay
    is still not ready to expose the drawing area.

 src/cheese-webcam.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/cheese-webcam.c b/src/cheese-webcam.c
index caada48..0b55092 100644
--- a/src/cheese-webcam.c
+++ b/src/cheese-webcam.c
@@ -203,11 +203,18 @@ static gboolean
 cheese_webcam_expose_cb (GtkWidget *widget, GdkEventExpose *event, CheeseWebcam *webcam)
 {
   CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
-
+  GstState state;
   GstXOverlay *overlay = GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (priv->pipeline),
                                                                   GST_TYPE_X_OVERLAY));
 
-  gst_x_overlay_expose (overlay);
+  gst_element_get_state (priv->pipeline, &state, NULL, 0);
+
+  if ((state < GST_STATE_PLAYING) || (overlay == NULL)) {
+    gdk_draw_rectangle (widget->window, widget->style->black_gc, TRUE,
+                        0, 0, widget->allocation.width, widget->allocation.height);
+  } else {
+    gst_x_overlay_expose (overlay);
+  }
 
   return FALSE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]