diff --git a/ChangeLog b/ChangeLog index cfb7cf9a84..23f628a96a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-20 Julien MOUTTE + + * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put): + * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put): + Patch by: Stefan Kost + Try to redraw borders only when needed. Apparently this consumes + resources on small devices... :-O (#363607) + 2006-10-20 Michael Smith * gst/tcp/gstmultifdsink.c: diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 711451b71b..d90e4640e0 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -628,6 +628,7 @@ static void gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) { GstVideoRectangle src, dst, result; + gboolean draw_border = FALSE; g_return_if_fail (GST_IS_XIMAGESINK (ximagesink)); @@ -635,6 +636,12 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) concurrently from the data flow thread */ g_mutex_lock (ximagesink->flow_lock); + /* Draw borders when displaying the first frame. After this + draw borders only on expose event. */ + if (!ximagesink->cur_image) { + draw_border = TRUE; + } + /* Store a reference to the last image we put, lose the previous one */ if (ximage && ximagesink->cur_image != ximage) { if (ximagesink->cur_image) { @@ -648,6 +655,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) /* Expose sends a NULL image, we take the latest frame */ if (!ximage) { + draw_border = TRUE; if (ximagesink->cur_image) { ximage = ximagesink->cur_image; } else { @@ -667,8 +675,10 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) g_mutex_lock (ximagesink->x_lock); - gst_ximagesink_xwindow_draw_borders (ximagesink, ximagesink->xwindow, result); - + if (draw_border) { + gst_ximagesink_xwindow_draw_borders (ximagesink, ximagesink->xwindow, + result); + } #ifdef HAVE_XSHM if (ximagesink->xcontext->use_xshm) { GST_LOG_OBJECT (ximagesink, diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 1606fc4278..1ea83775fc 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -671,6 +671,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstXvImageBuffer * xvimage) { GstVideoRectangle src, dst, result; + gboolean draw_border = FALSE; g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink)); g_return_if_fail (xvimagesink->xwindow != NULL); @@ -679,6 +680,12 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, concurrently from the data flow thread */ g_mutex_lock (xvimagesink->flow_lock); + /* Draw borders when displaying the first frame. After this + draw borders only on expose event. */ + if (!xvimagesink->cur_image) { + draw_border = TRUE; + } + /* Store a reference to the last image we put, lose the previous one */ if (xvimage && xvimagesink->cur_image != xvimage) { if (xvimagesink->cur_image) { @@ -692,6 +699,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, /* Expose sends a NULL image, we take the latest frame */ if (!xvimage) { + draw_border = TRUE; if (xvimagesink->cur_image) { xvimage = xvimagesink->cur_image; } else { @@ -719,8 +727,10 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, g_mutex_lock (xvimagesink->x_lock); - gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow, - result); + if (draw_border) { + gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow, + result); + } /* We scale to the window's geometry */ #ifdef HAVE_XSHM