mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
plugins: use common helper function to apply compositions.
Use common gst_vaapi_apply_composition() helper function to apply compositions attached to a buffer in vaapisink or GstVaapiVideoConverterGLX.
This commit is contained in:
parent
17e7e67c1f
commit
95b865968c
4 changed files with 20 additions and 17 deletions
|
@ -328,3 +328,15 @@ gst_vaapi_append_surface_caps(GstCaps *out_caps, GstCaps *in_caps)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_apply_composition(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);
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define GST_VAAPI_PLUGIN_UTIL_H
|
#define GST_VAAPI_PLUGIN_UTIL_H
|
||||||
|
|
||||||
#include <gst/vaapi/gstvaapidisplay.h>
|
#include <gst/vaapi/gstvaapidisplay.h>
|
||||||
|
#include <gst/vaapi/gstvaapisurface.h>
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -50,6 +51,10 @@ G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps);
|
gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps);
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_apply_composition(GstVaapiSurface *surface, GstBuffer *buffer);
|
||||||
|
|
||||||
#ifndef G_PRIMITIVE_SWAP
|
#ifndef G_PRIMITIVE_SWAP
|
||||||
#define G_PRIMITIVE_SWAP(type, a, b) do { \
|
#define G_PRIMITIVE_SWAP(type, a, b) do { \
|
||||||
const type t = a; a = b; b = t; \
|
const type t = a; a = b; b = t; \
|
||||||
|
|
|
@ -832,18 +832,6 @@ gst_vaapisink_put_surface(
|
||||||
return TRUE;
|
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
|
static GstFlowReturn
|
||||||
gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
|
gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
|
||||||
{
|
{
|
||||||
|
@ -893,7 +881,7 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
|
||||||
|
|
||||||
flags = gst_vaapi_video_meta_get_render_flags(meta);
|
flags = gst_vaapi_video_meta_get_render_flags(meta);
|
||||||
|
|
||||||
if (!set_composition_from_buffer(surface, src_buffer))
|
if (!gst_vaapi_apply_composition(surface, src_buffer))
|
||||||
GST_WARNING("could not update subtitles");
|
GST_WARNING("could not update subtitles");
|
||||||
|
|
||||||
switch (sink->display_type) {
|
switch (sink->display_type) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <gst/vaapi/gstvaapivideometa.h>
|
#include <gst/vaapi/gstvaapivideometa.h>
|
||||||
#include <gst/vaapi/gstvaapitexture.h>
|
#include <gst/vaapi/gstvaapitexture.h>
|
||||||
#include "gstvaapivideoconverter_glx.h"
|
#include "gstvaapivideoconverter_glx.h"
|
||||||
|
#include "gstvaapipluginutil.h"
|
||||||
|
|
||||||
typedef gboolean (*GstSurfaceUploadFunction)(GstSurfaceConverter *,
|
typedef gboolean (*GstSurfaceUploadFunction)(GstSurfaceConverter *,
|
||||||
GstSurfaceBuffer *);
|
GstSurfaceBuffer *);
|
||||||
|
@ -131,8 +132,6 @@ gst_vaapi_video_converter_glx_upload(GstSurfaceConverter *self,
|
||||||
GstVaapiVideoMeta * const meta = gst_buffer_get_vaapi_video_meta(buffer);
|
GstVaapiVideoMeta * const meta = gst_buffer_get_vaapi_video_meta(buffer);
|
||||||
GstVaapiSurface * const surface = gst_vaapi_video_meta_get_surface(meta);
|
GstVaapiSurface * const surface = gst_vaapi_video_meta_get_surface(meta);
|
||||||
GstVaapiDisplay *new_dpy, *old_dpy;
|
GstVaapiDisplay *new_dpy, *old_dpy;
|
||||||
GstVideoOverlayComposition * const composition =
|
|
||||||
gst_video_buffer_get_overlay_composition(buffer);
|
|
||||||
|
|
||||||
new_dpy = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface));
|
new_dpy = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface));
|
||||||
old_dpy = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(priv->texture));
|
old_dpy = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(priv->texture));
|
||||||
|
@ -145,8 +144,7 @@ gst_vaapi_video_converter_glx_upload(GstSurfaceConverter *self,
|
||||||
texture, GL_TEXTURE_2D, GL_BGRA);
|
texture, GL_TEXTURE_2D, GL_BGRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
|
if (!gst_vaapi_apply_composition(surface, buffer))
|
||||||
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,
|
||||||
|
|
Loading…
Reference in a new issue