sys/xvimage/xvimagesink.*: After a caps change, redraw our borders to avoid garbage...
authorJan Schmidt <thaytan@mad.scientist.com>
Fri, 13 Jul 2007 16:05:17 +0000 (16:05 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Fri, 13 Jul 2007 16:05:17 +0000 (16:05 +0000)
Original commit message from CVS:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_setcaps):
* sys/xvimage/xvimagesink.h:
After a caps change, redraw our borders to avoid garbage left there
when the image format changes to a smaller size, like 16:9 -> 4:3
Also, hold the flow_lock a bit longer in the set_caps while we're
fiddling with the xcontext.

ChangeLog
sys/xvimage/xvimagesink.c
sys/xvimage/xvimagesink.h

index edf1f47..7c58a8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2007-07-13  Jan Schmidt  <thaytan@mad.scientist.com>
 
+       * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
+       (gst_xvimagesink_setcaps):
+       * sys/xvimage/xvimagesink.h:
+       After a caps change, redraw our borders to avoid garbage left there
+       when the image format changes to a smaller size, like 16:9 -> 4:3
+       Also, hold the flow_lock a bit longer in the set_caps while we're
+       fiddling with the xcontext.
+
+2007-07-13  Jan Schmidt  <thaytan@mad.scientist.com>
+
        * Makefile.am:
        * configure.ac:
        * tests/Makefile.am:
index a2635ff..0ea4a0f 100644 (file)
@@ -740,9 +740,10 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
   }
 
   /* Draw borders when displaying the first frame. After this
-     draw borders only on expose event. */
-  if (!xvimagesink->cur_image) {
+     draw borders only on expose event or after a size change. */
+  if (!xvimagesink->cur_image || xvimagesink->draw_border) {
     draw_border = TRUE;
+    xvimagesink->draw_border = FALSE;
   }
 
   /* Store a reference to the last image we put, lose the previous one */
@@ -2025,7 +2026,10 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
         GST_VIDEO_SINK_WIDTH (xvimagesink),
         GST_VIDEO_SINK_HEIGHT (xvimagesink));
   }
-  g_mutex_unlock (xvimagesink->flow_lock);
+
+  /* After a resize, we want to redraw the borders in case the new frame size 
+   * doesn't cover the same area */
+  xvimagesink->draw_border = TRUE;
 
   /* We renew our xvimage only if size or format changed;
    * the xvimage is the same size as the video pixel size */
@@ -2044,6 +2048,8 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 
   xvimagesink->xcontext->im_format = im_format;
 
+  g_mutex_unlock (xvimagesink->flow_lock);
+
   return TRUE;
 }
 
index 767a15a..3ccbb37 100644 (file)
@@ -252,6 +252,7 @@ struct _GstXvImageSink {
 
   gboolean synchronous;
   gboolean keep_aspect;
+  gboolean draw_border;
   gboolean handle_events;
 
   gint brightness;