surface: apply composition to the parent context, if requested.

This commit is contained in:
Gwenole Beauchesne 2011-12-14 14:40:37 +01:00
parent 17538a340e
commit ac7c4cfe78
4 changed files with 18 additions and 6 deletions

View file

@ -875,6 +875,8 @@ gst_vaapi_surface_query_status(
* gst_vaapi_surface_set_subpictures_from_composition: * gst_vaapi_surface_set_subpictures_from_composition:
* @surface: a #GstVaapiSurface * @surface: a #GstVaapiSurface
* @compostion: a #GstVideoOverlayCompositon * @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 * Helper to update the subpictures from #GstVideoOverlayCompositon. Sending
* a NULL composition will clear all the current subpictures. Note that this * a NULL composition will clear all the current subpictures. Note that this
@ -884,8 +886,9 @@ gst_vaapi_surface_query_status(
*/ */
gboolean gboolean
gst_vaapi_surface_set_subpictures_from_composition( gst_vaapi_surface_set_subpictures_from_composition(
GstVaapiSurface *surface, GstVaapiSurface *surface,
GstVideoOverlayComposition *composition GstVideoOverlayComposition *composition,
gboolean propagate_context
) )
{ {
GstVaapiDisplay *display; GstVaapiDisplay *display;
@ -893,6 +896,12 @@ gst_vaapi_surface_set_subpictures_from_composition(
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE); 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); display = GST_VAAPI_OBJECT_DISPLAY(surface);
if (!display) if (!display)
return FALSE; return FALSE;

View file

@ -235,8 +235,9 @@ gst_vaapi_surface_query_status(
gboolean gboolean
gst_vaapi_surface_set_subpictures_from_composition( gst_vaapi_surface_set_subpictures_from_composition(
GstVaapiSurface *surface, GstVaapiSurface *surface,
GstVideoOverlayComposition *composition GstVideoOverlayComposition *composition,
gboolean propagate_context
); );
G_END_DECLS G_END_DECLS

View file

@ -135,7 +135,8 @@ gst_vaapi_video_converter_glx_upload (GstSurfaceConverter *converter,
GL_BGRA); 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"); GST_WARNING ("could not update subtitles");
return gst_vaapi_texture_put_surface (priv->texture, surface, return gst_vaapi_texture_put_surface (priv->texture, surface,

View file

@ -679,7 +679,8 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
flags = GST_VAAPI_PICTURE_STRUCTURE_FRAME; 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"); GST_WARNING("could not update subtitles");
#if USE_VAAPISINK_GLX #if USE_VAAPISINK_GLX