mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
FEI: plugin: Add virtual methods to base encode
Two new virtual methods are added to gstvaapiencode. load_control_data(): load the FEI input buffers set by the upstream elements save_stats_to_meta(): save the FEI output buffers to Meta for downnstream elements https://bugzilla.gnome.org/show_bug.cgi?id=785712 https://bugzilla.gnome.org/show_bug.cgi?id=784667 Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
parent
0fdef0e349
commit
a46ad6b5be
2 changed files with 40 additions and 0 deletions
|
@ -271,6 +271,9 @@ gst_vaapiencode_push_frame (GstVaapiEncode * encode, gint64 timeout)
|
|||
GstVaapiEncoderStatus status;
|
||||
GstBuffer *out_buffer;
|
||||
GstFlowReturn ret;
|
||||
#if USE_H264_FEI_ENCODER
|
||||
GstVaapiFeiVideoMeta *feimeta = NULL;
|
||||
#endif
|
||||
|
||||
status = gst_vaapi_encoder_get_buffer_with_timeout (encode->encoder,
|
||||
&codedbuf_proxy, timeout);
|
||||
|
@ -295,6 +298,15 @@ gst_vaapiencode_push_frame (GstVaapiEncode * encode, gint64 timeout)
|
|||
out_buffer = NULL;
|
||||
ret = klass->alloc_buffer (encode,
|
||||
GST_VAAPI_CODED_BUFFER_PROXY_BUFFER (codedbuf_proxy), &out_buffer);
|
||||
|
||||
#if USE_H264_FEI_ENCODER
|
||||
if (klass->save_stats_to_meta) {
|
||||
feimeta = klass->save_stats_to_meta (encode, codedbuf_proxy);
|
||||
if (feimeta != NULL)
|
||||
gst_buffer_set_vaapi_fei_video_meta (out_buffer, feimeta);
|
||||
}
|
||||
#endif
|
||||
|
||||
gst_vaapi_coded_buffer_proxy_replace (&codedbuf_proxy, NULL);
|
||||
if (ret != GST_FLOW_OK)
|
||||
goto error_allocate_buffer;
|
||||
|
@ -617,6 +629,10 @@ gst_vaapiencode_handle_frame (GstVideoEncoder * venc,
|
|||
GstVaapiSurfaceProxy *proxy;
|
||||
GstFlowReturn ret;
|
||||
GstBuffer *buf;
|
||||
#if USE_H264_FEI_ENCODER
|
||||
GstVaapiFeiVideoMeta *feimeta = NULL;
|
||||
GstVaapiEncodeClass *const klass = GST_VAAPIENCODE_GET_CLASS (venc);
|
||||
#endif
|
||||
|
||||
buf = NULL;
|
||||
ret = gst_vaapi_plugin_base_get_input_buffer (GST_VAAPI_PLUGIN_BASE (encode),
|
||||
|
@ -635,6 +651,12 @@ gst_vaapiencode_handle_frame (GstVideoEncoder * venc,
|
|||
if (!proxy)
|
||||
goto error_buffer_no_surface_proxy;
|
||||
|
||||
#if USE_H264_FEI_ENCODER
|
||||
feimeta = gst_buffer_get_vaapi_fei_video_meta (buf);
|
||||
if (feimeta && klass->load_control_data)
|
||||
klass->load_control_data (encode, feimeta, proxy);
|
||||
#endif
|
||||
|
||||
gst_video_codec_frame_set_user_data (frame,
|
||||
gst_vaapi_surface_proxy_ref (proxy),
|
||||
(GDestroyNotify) gst_vaapi_surface_proxy_unref);
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
#include "gstvaapipluginbase.h"
|
||||
#include <gst/vaapi/gstvaapiencoder.h>
|
||||
|
||||
#if USE_H264_FEI_ENCODER
|
||||
#include <gst/vaapi/gstvaapisurface.h>
|
||||
#include <gst/vaapi/gstvaapicodedbufferproxy.h>
|
||||
#include "gstvaapifeivideometa.h"
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_VAAPIENCODE \
|
||||
|
@ -81,6 +87,18 @@ struct _GstVaapiEncodeClass
|
|||
GstVaapiCodedBuffer * coded_buf,
|
||||
GstBuffer ** outbuf_ptr);
|
||||
GstVaapiProfile (*get_profile) (GstCaps * caps);
|
||||
|
||||
#if USE_H264_FEI_ENCODER
|
||||
|
||||
gboolean (*load_control_data) (GstVaapiEncode *encoder,
|
||||
GstVaapiFeiVideoMeta *feimeta,
|
||||
GstVaapiSurfaceProxy *proxy);
|
||||
|
||||
GstVaapiFeiVideoMeta* (*save_stats_to_meta) (GstVaapiEncode *base_encode,
|
||||
GstVaapiCodedBufferProxy *proxy);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
GType
|
||||
|
|
Loading…
Reference in a new issue