From c37c9ca6cfa85e249209924e6a2b405dbd9db54d Mon Sep 17 00:00:00 2001 From: Holger Kaelberer Date: Tue, 7 Feb 2012 15:21:05 +0100 Subject: [PATCH] vaapisink: recalculate render rect only if caps are negotiated. 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 --- NEWS | 5 ++++- gst/vaapi/gstvaapisink.c | 9 +++++++++ gst/vaapi/gstvaapisink.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 608ba1c..292a1b7 100644 --- 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) diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index 6769be2..6ae5f2a 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -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; diff --git a/gst/vaapi/gstvaapisink.h b/gst/vaapi/gstvaapisink.h index 368a2d2..b7c06d8 100644 --- a/gst/vaapi/gstvaapisink.h +++ b/gst/vaapi/gstvaapisink.h @@ -68,6 +68,7 @@ struct _GstVaapiSink { /*< private >*/ GstVideoSink parent_instance; + GstCaps *caps; GstVaapiDisplay *display; GstVaapiWindow *window; guint window_width; -- 2.7.4