vaapisink: add helper function to apply a composition buffer.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Mar 2013 16:34:38 +0000 (17:34 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Mar 2013 18:22:24 +0000 (19:22 +0100)
Simplify application of a composition buffer to a GstVaapiSurface, and
all its peers, until that function is eventually promoted to libgstvaapi.

gst/vaapi/gstvaapisink.c

index 0b4a0bd..28aca3e 100644 (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) {