mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
sys/ximage/ximagesink.c: Renegotiate size on expose.
Original commit message from CVS: 2004-02-17 Julien MOUTTE <julien@moutte.net> * sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size), (gst_ximagesink_expose): Renegotiate size on expose. * sys/xvimage/xvimagesink.c: (gst_xvimagesink_expose): Update window size on expose.
This commit is contained in:
parent
a627711a3c
commit
f9afb0e75f
3 changed files with 49 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-02-17 Julien MOUTTE <julien@moutte.net>
|
||||
|
||||
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
|
||||
(gst_ximagesink_expose): Renegotiate size on expose.
|
||||
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_expose): Update window
|
||||
size on expose.
|
||||
|
||||
2004-02-16 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* testsuite/alsa/sinesrc.c:
|
||||
|
|
|
@ -402,11 +402,15 @@ gst_ximagesink_renegotiate_size (GstXImageSink *ximagesink,
|
|||
{
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* Window got resized or moved. We do caps negotiation again to get video
|
||||
scaler to fit that new size only if size of the window changed. */
|
||||
if (!ximagesink->xwindow)
|
||||
return;
|
||||
|
||||
if ( (ximagesink->xwindow->width != width) ||
|
||||
(ximagesink->xwindow->height != height) )
|
||||
/* Window got resized or moved. We do caps negotiation again to get video
|
||||
scaler to fit that new size only if size of the window differs from our
|
||||
size. */
|
||||
|
||||
if (GST_VIDEOSINK_WIDTH (ximagesink) != width ||
|
||||
GST_VIDEOSINK_HEIGHT (ximagesink) != height)
|
||||
{
|
||||
GstPadLinkReturn r;
|
||||
ximagesink->xwindow->width = width;
|
||||
|
@ -1230,10 +1234,30 @@ gst_ximagesink_get_desired_size (GstXOverlay *overlay,
|
|||
static void
|
||||
gst_ximagesink_expose (GstXOverlay *overlay)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
|
||||
|
||||
if (ximagesink->cur_image)
|
||||
if (!ximagesink->xwindow)
|
||||
return;
|
||||
|
||||
/* Update the window geometry */
|
||||
g_mutex_lock (ximagesink->x_lock);
|
||||
XGetWindowAttributes (ximagesink->xcontext->disp,
|
||||
ximagesink->xwindow->win, &attr);
|
||||
g_mutex_unlock (ximagesink->x_lock);
|
||||
|
||||
/* If window is 1x1 it's probably invisible */
|
||||
if (attr.width == 1 && attr.height == 1)
|
||||
return;
|
||||
|
||||
if (gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)))
|
||||
gst_ximagesink_renegotiate_size (ximagesink, attr.width, attr.height);
|
||||
|
||||
gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
||||
|
||||
if (ximagesink->cur_image) {
|
||||
gst_ximagesink_ximage_put (ximagesink, ximagesink->cur_image);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1485,7 +1485,20 @@ gst_xvimagesink_get_desired_size (GstXOverlay *overlay,
|
|||
static void
|
||||
gst_xvimagesink_expose (GstXOverlay *overlay)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
|
||||
|
||||
if (!xvimagesink->xwindow)
|
||||
return;
|
||||
|
||||
/* Update the window geometry */
|
||||
g_mutex_lock (xvimagesink->x_lock);
|
||||
XGetWindowAttributes (xvimagesink->xcontext->disp,
|
||||
xvimagesink->xwindow->win, &attr);
|
||||
g_mutex_unlock (xvimagesink->x_lock);
|
||||
|
||||
xvimagesink->xwindow->width = attr.width;
|
||||
xvimagesink->xwindow->height = attr.height;
|
||||
|
||||
if (xvimagesink->cur_image) {
|
||||
gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->cur_image);
|
||||
|
|
Loading…
Reference in a new issue