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 <gwenole.beauchesne@intel.com>
This commit is contained in:
Holger Kaelberer 2012-02-07 15:21:05 +01:00 committed by Gwenole Beauchesne
parent c28eef0cb2
commit c37c9ca6cf
3 changed files with 14 additions and 1 deletions

5
NEWS
View file

@ -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) 2010-2011 Splitted-Desktop Systems
Copyright (C) 2011-2012 Intel Corporation Copyright (C) 2011-2012 Intel Corporation
Copyright (C) 2011 Collabora 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 Version 0.3.6 - 02.Apr.2012
* Add support for decoding MPEG-2 interlaced streams * Add support for decoding MPEG-2 interlaced streams
* Add support for interlaced streams with FFmpeg decoders (Holger Kaelberer) * Add support for interlaced streams with FFmpeg decoders (Holger Kaelberer)

View file

@ -240,6 +240,8 @@ gst_vaapisink_destroy(GstVaapiSink *sink)
g_object_unref(sink->display); g_object_unref(sink->display);
sink->display = NULL; sink->display = NULL;
} }
gst_caps_replace(&sink->caps, NULL);
} }
/* Checks whether a ConfigureNotify event is in the queue */ /* 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; guint num, den, display_par_n, display_par_d;
gboolean success; 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_DEBUG("ensure render rect within %ux%u bounds", width, height);
gst_vaapi_display_get_pixel_aspect_ratio( 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; sink->video_par_d = video_par_d;
GST_DEBUG("video pixel-aspect-ratio %d/%d", video_par_n, 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)) if (!gst_vaapi_ensure_display(sink, &sink->display))
return FALSE; return FALSE;
@ -861,6 +869,7 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
static void static void
gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass) gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
{ {
sink->caps = NULL;
sink->display = NULL; sink->display = NULL;
sink->window = NULL; sink->window = NULL;
sink->window_width = 0; sink->window_width = 0;

View file

@ -68,6 +68,7 @@ struct _GstVaapiSink {
/*< private >*/ /*< private >*/
GstVideoSink parent_instance; GstVideoSink parent_instance;
GstCaps *caps;
GstVaapiDisplay *display; GstVaapiDisplay *display;
GstVaapiWindow *window; GstVaapiWindow *window;
guint window_width; guint window_width;