vaapisink: recalculate render rect only if caps are negotiated.
authorHolger Kaelberer <holger.k@elberer.de>
Tue, 7 Feb 2012 14:21:05 +0000 (15:21 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Apr 2012 11:33:13 +0000 (13:33 +0200)
Fix gst_vaapisink_xoverlay_set_window_handle() when it is called before
caps got negotiated. Besides, when a foreign window is provided by the
user, so should the render rect.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
NEWS
gst/vaapi/gstvaapisink.c
gst/vaapi/gstvaapisink.h

diff --git a/NEWS b/NEWS
index 608ba1c..292a1b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,11 @@
-gst-vaapi NEWS -- summary of changes.  2012-04-02
+gst-vaapi NEWS -- summary of changes.  2012-04-DD
 Copyright (C) 2010-2011 Splitted-Desktop Systems
 Copyright (C) 2011-2012 Intel Corporation
 Copyright (C) 2011 Collabora
 
+Version 0.3.7 - DD.Apr.2012
+* Recalculate render rect only if caps are negotiated (Holger Kaelberer)
+
 Version 0.3.6 - 02.Apr.2012
 * Add support for decoding MPEG-2 interlaced streams
 * Add support for interlaced streams with FFmpeg decoders (Holger Kaelberer)
index 6769be2..6ae5f2a 100644 (file)
@@ -240,6 +240,8 @@ gst_vaapisink_destroy(GstVaapiSink *sink)
         g_object_unref(sink->display);
         sink->display = NULL;
     }
+
+    gst_caps_replace(&sink->caps, NULL);
 }
 
 /* Checks whether a ConfigureNotify event is in the queue */
@@ -300,6 +302,10 @@ gst_vaapisink_ensure_render_rect(GstVaapiSink *sink, guint width, guint height)
     guint num, den, display_par_n, display_par_d;
     gboolean success;
 
+    /* Return success if caps are not set yet */
+    if (!sink->caps)
+        return TRUE;
+
     GST_DEBUG("ensure render rect within %ux%u bounds", width, height);
 
     gst_vaapi_display_get_pixel_aspect_ratio(
@@ -459,6 +465,8 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
     sink->video_par_d  = video_par_d;
     GST_DEBUG("video pixel-aspect-ratio %d/%d", video_par_n, video_par_d);
 
+    gst_caps_replace(&sink->caps, caps);
+
     if (!gst_vaapi_ensure_display(sink, &sink->display))
         return FALSE;
 
@@ -861,6 +869,7 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
 static void
 gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
 {
+    sink->caps           = NULL;
     sink->display        = NULL;
     sink->window         = NULL;
     sink->window_width   = 0;
index 368a2d2..b7c06d8 100644 (file)
@@ -68,6 +68,7 @@ struct _GstVaapiSink {
     /*< private >*/
     GstVideoSink parent_instance;
 
+    GstCaps            *caps;
     GstVaapiDisplay    *display;
     GstVaapiWindow     *window;
     guint               window_width;