surface: apply composition to the parent context, if requested.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 14 Dec 2011 13:40:37 +0000 (14:40 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 14 Dec 2011 13:40:37 +0000 (14:40 +0100)
gst-libs/gst/vaapi/gstvaapisurface.c
gst-libs/gst/vaapi/gstvaapisurface.h
gst-libs/gst/vaapi/gstvaapivideoconverter_glx.c
gst/vaapi/gstvaapisink.c

index 57eab42..c29b1ba 100644 (file)
@@ -875,6 +875,8 @@ gst_vaapi_surface_query_status(
  * gst_vaapi_surface_set_subpictures_from_composition:
  * @surface: a #GstVaapiSurface
  * @compostion: a #GstVideoOverlayCompositon
+ * @propagate_context: a flag specifying whether to apply composition
+ *     to the parent context, if any
  *
  * Helper to update the subpictures from #GstVideoOverlayCompositon. Sending
  * a NULL composition will clear all the current subpictures. Note that this
@@ -884,8 +886,9 @@ gst_vaapi_surface_query_status(
  */
 gboolean
 gst_vaapi_surface_set_subpictures_from_composition(
-    GstVaapiSurface *surface,
-    GstVideoOverlayComposition *composition
+    GstVaapiSurface            *surface,
+    GstVideoOverlayComposition *composition,
+    gboolean                    propagate_context
 )
 {
     GstVaapiDisplay *display;
@@ -893,6 +896,12 @@ gst_vaapi_surface_set_subpictures_from_composition(
 
     g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
 
+    if (propagate_context) {
+        GstVaapiContext * const context = surface->priv->parent_context;
+        if (context)
+            return gst_vaapi_context_apply_composition(context, composition);
+    }
+
     display = GST_VAAPI_OBJECT_DISPLAY(surface);
     if (!display)
         return FALSE;
index 0741878..ce9bd9e 100644 (file)
@@ -235,8 +235,9 @@ gst_vaapi_surface_query_status(
 
 gboolean
 gst_vaapi_surface_set_subpictures_from_composition(
-    GstVaapiSurface *surface,
-    GstVideoOverlayComposition *composition
+    GstVaapiSurface            *surface,
+    GstVideoOverlayComposition *composition,
+    gboolean                    propagate_context
 );
 
 G_END_DECLS
index a4d3562..fdeb817 100644 (file)
@@ -135,7 +135,8 @@ gst_vaapi_video_converter_glx_upload (GstSurfaceConverter *converter,
                                                         GL_BGRA);
   }
 
-  if (!gst_vaapi_surface_set_subpictures_from_composition (surface, composition))
+  if (!gst_vaapi_surface_set_subpictures_from_composition (surface,
+           composition, TRUE))
         GST_WARNING ("could not update subtitles");
 
   return gst_vaapi_texture_put_surface (priv->texture, surface,
index c174924..7dab271 100644 (file)
@@ -679,7 +679,8 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
 
     flags = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
 
-    if (!gst_vaapi_surface_set_subpictures_from_composition(surface, composition))
+    if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
+             composition, TRUE))
         GST_WARNING("could not update subtitles");
 
 #if USE_VAAPISINK_GLX