vaapisink: add helper function to apply a composition buffer.

Simplify application of a composition buffer to a GstVaapiSurface, and
all its peers, until that function is eventually promoted to libgstvaapi.
This commit is contained in:
Gwenole Beauchesne 2013-03-20 17:34:38 +01:00
parent 6ce6712ed5
commit 9e1da76971

View file

@ -832,11 +832,22 @@ gst_vaapisink_put_surface(
return TRUE;
}
static inline gboolean
set_composition_from_buffer(GstVaapiSurface *surface, GstBuffer *buffer)
{
GstVideoOverlayComposition * const composition =
gst_video_buffer_get_overlay_composition(buffer);
if (!composition)
return FALSE;
return gst_vaapi_surface_set_subpictures_from_composition(surface,
composition, TRUE);
}
static GstFlowReturn
gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
{
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
GstVideoOverlayComposition *composition;
GstVaapiVideoMeta *meta;
GstVaapiSurface *surface;
GstBuffer *buffer;
@ -882,9 +893,7 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
flags = gst_vaapi_video_meta_get_render_flags(meta);
composition = gst_video_buffer_get_overlay_composition(src_buffer);
if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
composition, TRUE))
if (!set_composition_from_buffer(surface, src_buffer))
GST_WARNING("could not update subtitles");
switch (sink->display_type) {