mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
plugins: factor out video context sharing code.
This commit is contained in:
parent
e5f066b719
commit
01a3fc44c0
7 changed files with 49 additions and 230 deletions
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#include "gstvaapidecode.h"
|
#include "gstvaapidecode.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
#include "gstvaapivideocontext.h"
|
|
||||||
#include "gstvaapivideobuffer.h"
|
#include "gstvaapivideobuffer.h"
|
||||||
#if GST_CHECK_VERSION(1,1,0) && USE_GLX
|
#if GST_CHECK_VERSION(1,1,0) && USE_GLX
|
||||||
#include "gstvaapivideometa_texture.h"
|
#include "gstvaapivideometa_texture.h"
|
||||||
|
@ -95,35 +94,11 @@ static GstStaticPadTemplate gst_vaapidecode_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
|
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
|
||||||
|
|
||||||
/* GstVideoContext interface */
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type,
|
|
||||||
const GValue *value)
|
|
||||||
{
|
|
||||||
GstVaapiDecode *decode = GST_VAAPIDECODE (context);
|
|
||||||
gst_vaapi_set_display (type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY(decode));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_video_context_interface_init(GstVideoContextInterface *iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapidecode_set_video_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GstVideoContextClass GstVideoContextInterface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE(
|
G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiDecode,
|
GstVaapiDecode,
|
||||||
gst_vaapidecode,
|
gst_vaapidecode,
|
||||||
GST_TYPE_VIDEO_DECODER,
|
GST_TYPE_VIDEO_DECODER,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_video_context_interface_init)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
|
gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
|
||||||
|
@ -564,21 +539,6 @@ error_create_pool:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapidecode_set_context(GstElement *element, GstContext *context)
|
|
||||||
{
|
|
||||||
GstVaapiDecode * const decode = GST_VAAPIDECODE(element);
|
|
||||||
GstVaapiDisplay *display = NULL;
|
|
||||||
|
|
||||||
if (gst_vaapi_video_context_get_display(context, &display)) {
|
|
||||||
GST_INFO_OBJECT(element, "set display %p", display);
|
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE(decode, display);
|
|
||||||
gst_vaapi_display_unref(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
gst_vaapidecode_ensure_display(GstVaapiDecode *decode)
|
gst_vaapidecode_ensure_display(GstVaapiDecode *decode)
|
||||||
{
|
{
|
||||||
|
@ -833,10 +793,6 @@ gst_vaapidecode_class_init(GstVaapiDecodeClass *klass)
|
||||||
GST_DEBUG_FUNCPTR(gst_vaapidecode_decide_allocation);
|
GST_DEBUG_FUNCPTR(gst_vaapidecode_decide_allocation);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
element_class->set_context = GST_DEBUG_FUNCPTR(gst_vaapidecode_set_context);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_element_class_set_static_metadata(element_class,
|
gst_element_class_set_static_metadata(element_class,
|
||||||
"VA-API decoder",
|
"VA-API decoder",
|
||||||
"Codec/Decoder/Video",
|
"Codec/Decoder/Video",
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "gst/vaapi/sysdeps.h"
|
#include "gst/vaapi/sysdeps.h"
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <gst/video/videocontext.h>
|
|
||||||
|
|
||||||
#include "gstvaapidownload.h"
|
#include "gstvaapidownload.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
|
@ -91,29 +90,11 @@ struct _GstVaapiDownloadClass {
|
||||||
GstVaapiPluginBaseClass parent_class;
|
GstVaapiPluginBaseClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GstVideoContext interface */
|
|
||||||
static void
|
|
||||||
gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
|
|
||||||
const GValue *value)
|
|
||||||
{
|
|
||||||
GstVaapiDownload *download = GST_VAAPIDOWNLOAD (context);
|
|
||||||
gst_vaapi_set_display (type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY(download));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_video_context_interface_init(GstVideoContextInterface *iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapidownload_set_video_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GstVideoContextClass GstVideoContextInterface
|
|
||||||
G_DEFINE_TYPE_WITH_CODE(
|
G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiDownload,
|
GstVaapiDownload,
|
||||||
gst_vaapidownload,
|
gst_vaapidownload,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_video_context_interface_init))
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapidownload_start(GstBaseTransform *trans);
|
gst_vaapidownload_start(GstBaseTransform *trans);
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <gst/vaapi/gstvaapivalue.h>
|
#include <gst/vaapi/gstvaapivalue.h>
|
||||||
#include <gst/vaapi/gstvaapidisplay.h>
|
#include <gst/vaapi/gstvaapidisplay.h>
|
||||||
#include "gstvaapiencode.h"
|
#include "gstvaapiencode.h"
|
||||||
#include "gstvaapivideocontext.h"
|
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
#include "gstvaapivideometa.h"
|
#include "gstvaapivideometa.h"
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
@ -42,47 +41,9 @@
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_vaapiencode_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_vaapiencode_debug);
|
||||||
#define GST_CAT_DEFAULT gst_vaapiencode_debug
|
#define GST_CAT_DEFAULT gst_vaapiencode_debug
|
||||||
|
|
||||||
/* GstContext interface */
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapiencode_set_context (GstElement * element, GstContext * context)
|
|
||||||
{
|
|
||||||
GstVaapiEncode *const encode = GST_VAAPIENCODE_CAST (element);
|
|
||||||
GstVaapiDisplay *display = NULL;
|
|
||||||
|
|
||||||
if (gst_vaapi_video_context_get_display (context, &display)) {
|
|
||||||
GST_INFO_OBJECT (element, "set display %p", display);
|
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE (encode, display);
|
|
||||||
gst_vaapi_display_unref (display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static void
|
|
||||||
gst_vaapiencode_set_video_context (GstVideoContext * context,
|
|
||||||
const gchar * type, const GValue * value)
|
|
||||||
{
|
|
||||||
GstVaapiEncode *const encode = GST_VAAPIENCODE_CAST (context);
|
|
||||||
|
|
||||||
gst_vaapi_set_display (type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY (encode));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_video_context_interface_init (GstVideoContextInterface * iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapiencode_set_video_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GstVideoContextClass GstVideoContextInterface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstVaapiEncode,
|
G_DEFINE_TYPE_WITH_CODE (GstVaapiEncode,
|
||||||
gst_vaapiencode, GST_TYPE_VIDEO_ENCODER,
|
gst_vaapiencode, GST_TYPE_VIDEO_ENCODER,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_video_context_interface_init)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -917,9 +878,6 @@ static void
|
||||||
gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
|
gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *const object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *const object_class = G_OBJECT_CLASS (klass);
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
#endif
|
|
||||||
GstVideoEncoderClass *const venc_class = GST_VIDEO_ENCODER_CLASS (klass);
|
GstVideoEncoderClass *const venc_class = GST_VIDEO_ENCODER_CLASS (klass);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_vaapiencode_debug,
|
GST_DEBUG_CATEGORY_INIT (gst_vaapiencode_debug,
|
||||||
|
@ -931,10 +889,6 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
|
||||||
object_class->set_property = gst_vaapiencode_set_property;
|
object_class->set_property = gst_vaapiencode_set_property;
|
||||||
object_class->get_property = gst_vaapiencode_get_property;
|
object_class->get_property = gst_vaapiencode_get_property;
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
element_class->set_context = GST_DEBUG_FUNCPTR (gst_vaapiencode_set_context);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
venc_class->open = GST_DEBUG_FUNCPTR (gst_vaapiencode_open);
|
venc_class->open = GST_DEBUG_FUNCPTR (gst_vaapiencode_open);
|
||||||
venc_class->close = GST_DEBUG_FUNCPTR (gst_vaapiencode_close);
|
venc_class->close = GST_DEBUG_FUNCPTR (gst_vaapiencode_close);
|
||||||
venc_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapiencode_set_format);
|
venc_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapiencode_set_format);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "gst/vaapi/sysdeps.h"
|
#include "gst/vaapi/sysdeps.h"
|
||||||
#include "gstvaapipluginbase.h"
|
#include "gstvaapipluginbase.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
|
#include "gstvaapivideocontext.h"
|
||||||
|
|
||||||
/* Default debug category is from the subclass */
|
/* Default debug category is from the subclass */
|
||||||
#define GST_CAT_DEFAULT (plugin->debug_category)
|
#define GST_CAT_DEFAULT (plugin->debug_category)
|
||||||
|
@ -36,6 +37,8 @@ implements_interface_supported (GstImplementsInterface * iface, GType type)
|
||||||
{
|
{
|
||||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (iface);
|
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (iface);
|
||||||
|
|
||||||
|
if (type == GST_TYPE_VIDEO_CONTEXT)
|
||||||
|
return TRUE;
|
||||||
return GST_VAAPI_PLUGIN_BASE_GET_CLASS (plugin)->has_interface (plugin, type);
|
return GST_VAAPI_PLUGIN_BASE_GET_CLASS (plugin)->has_interface (plugin, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +49,39 @@ implements_interface_init (GstImplementsInterfaceClass * iface)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* GstVideoContext interface */
|
||||||
|
#if GST_CHECK_VERSION(1,1,0)
|
||||||
|
static void
|
||||||
|
plugin_set_context (GstElement * element, GstContext * context)
|
||||||
|
{
|
||||||
|
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (element);
|
||||||
|
GstVaapiDisplay *display = NULL;
|
||||||
|
|
||||||
|
if (gst_vaapi_video_context_get_display (context, &display)) {
|
||||||
|
GST_INFO_OBJECT (element, "set display %p", display);
|
||||||
|
gst_vaapi_display_replace (&plugin->display, display);
|
||||||
|
gst_vaapi_display_unref (display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static void
|
||||||
|
plugin_set_context (GstVideoContext * context, const gchar * type,
|
||||||
|
const GValue * value)
|
||||||
|
{
|
||||||
|
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (context);
|
||||||
|
|
||||||
|
gst_vaapi_set_display (type, value, &plugin->display);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
video_context_interface_init (GstVideoContextInterface * iface)
|
||||||
|
{
|
||||||
|
iface->set_context = plugin_set_context;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GstVideoContextClass GstVideoContextInterface
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id)
|
gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +89,9 @@ gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id)
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
|
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
|
||||||
implements_interface_init);
|
implements_interface_init);
|
||||||
#endif
|
#endif
|
||||||
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT, video_context_interface_init);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -71,6 +110,11 @@ gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
|
||||||
{
|
{
|
||||||
klass->has_interface = default_has_interface;
|
klass->has_interface = default_has_interface;
|
||||||
klass->display_changed = default_display_changed;
|
klass->display_changed = default_display_changed;
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,1,0)
|
||||||
|
GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
element_class->set_context = GST_DEBUG_FUNCPTR (plugin_set_context);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#include "gstvaapipostproc.h"
|
#include "gstvaapipostproc.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
#include "gstvaapivideocontext.h"
|
|
||||||
#include "gstvaapivideobuffer.h"
|
#include "gstvaapivideobuffer.h"
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
#include "gstvaapivideobufferpool.h"
|
#include "gstvaapivideobufferpool.h"
|
||||||
|
@ -89,42 +88,11 @@ static GstStaticPadTemplate gst_vaapipostproc_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
|
GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
|
||||||
|
|
||||||
/* GstVideoContext interface */
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapipostproc_set_video_context(
|
|
||||||
GstVideoContext *context,
|
|
||||||
const gchar *type,
|
|
||||||
const GValue *value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(context);
|
|
||||||
|
|
||||||
gst_vaapi_set_display(type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY(postproc));
|
|
||||||
|
|
||||||
if (postproc->uploader)
|
|
||||||
gst_vaapi_uploader_ensure_display(postproc->uploader, GST_VAAPI_PLUGIN_BASE_DISPLAY(postproc));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_video_context_interface_init(GstVideoContextInterface *iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapipostproc_set_video_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GstVideoContextClass GstVideoContextInterface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE(
|
G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiPostproc,
|
GstVaapiPostproc,
|
||||||
gst_vaapipostproc,
|
gst_vaapipostproc,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_video_context_interface_init)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
@ -233,21 +201,6 @@ find_filter_op(GPtrArray *filter_ops, GstVaapiFilterOp op)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapipostproc_set_context(GstElement *element, GstContext *context)
|
|
||||||
{
|
|
||||||
GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(element);
|
|
||||||
GstVaapiDisplay *display = NULL;
|
|
||||||
|
|
||||||
if (gst_vaapi_video_context_get_display(context, &display)) {
|
|
||||||
GST_INFO_OBJECT(element, "set display %p", display);
|
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE(postproc, display);
|
|
||||||
gst_vaapi_display_unref(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
gst_vaapipostproc_ensure_display(GstVaapiPostproc *postproc)
|
gst_vaapipostproc_ensure_display(GstVaapiPostproc *postproc)
|
||||||
{
|
{
|
||||||
|
@ -1627,10 +1580,6 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
|
||||||
trans_class->prepare_output_buffer =
|
trans_class->prepare_output_buffer =
|
||||||
gst_vaapipostproc_prepare_output_buffer;
|
gst_vaapipostproc_prepare_output_buffer;
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
element_class->set_context = gst_vaapipostproc_set_context;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_element_class_set_static_metadata(element_class,
|
gst_element_class_set_static_metadata(element_class,
|
||||||
"VA-API video postprocessing",
|
"VA-API video postprocessing",
|
||||||
"Filter/Converter/Video",
|
"Filter/Converter/Video",
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
|
|
||||||
#include "gstvaapisink.h"
|
#include "gstvaapisink.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
#include "gstvaapivideocontext.h"
|
|
||||||
#include "gstvaapivideometa.h"
|
#include "gstvaapivideometa.h"
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
#include "gstvaapivideobufferpool.h"
|
#include "gstvaapivideobufferpool.h"
|
||||||
|
@ -107,23 +106,6 @@ static GstStaticPadTemplate gst_vaapisink_sink_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapisink_sink_caps_str));
|
GST_STATIC_CAPS(gst_vaapisink_sink_caps_str));
|
||||||
|
|
||||||
/* GstVideoContext interface */
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type,
|
|
||||||
const GValue *value)
|
|
||||||
{
|
|
||||||
GstVaapiSink *sink = GST_VAAPISINK (context);
|
|
||||||
gst_vaapi_set_display (type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY(sink));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapisink_set_video_context;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapisink_has_interface(GstVaapiPluginBase *plugin, GType type)
|
gst_vaapisink_has_interface(GstVaapiPluginBase *plugin, GType type)
|
||||||
{
|
{
|
||||||
|
@ -138,10 +120,6 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
gst_vaapisink,
|
gst_vaapisink,
|
||||||
GST_TYPE_VIDEO_SINK,
|
GST_TYPE_VIDEO_SINK,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_vaapisink_video_context_iface_init);
|
|
||||||
#endif
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_OVERLAY,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_OVERLAY,
|
||||||
gst_vaapisink_video_overlay_iface_init))
|
gst_vaapisink_video_overlay_iface_init))
|
||||||
|
|
||||||
|
@ -1342,21 +1320,6 @@ gst_vaapisink_buffer_alloc(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
static void
|
|
||||||
gst_vaapisink_set_context(GstElement *element, GstContext *context)
|
|
||||||
{
|
|
||||||
GstVaapiSink * const sink = GST_VAAPISINK(element);
|
|
||||||
GstVaapiDisplay *display = NULL;
|
|
||||||
|
|
||||||
if (gst_vaapi_video_context_get_display(context, &display)) {
|
|
||||||
GST_INFO_OBJECT(element, "set display %p", display);
|
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE(sink, display);
|
|
||||||
gst_vaapi_display_unref(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query)
|
gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query)
|
||||||
{
|
{
|
||||||
|
@ -1493,10 +1456,6 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
|
||||||
basesink_class->buffer_alloc = gst_vaapisink_buffer_alloc;
|
basesink_class->buffer_alloc = gst_vaapisink_buffer_alloc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
|
||||||
element_class->set_context = gst_vaapisink_set_context;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_element_class_set_static_metadata(element_class,
|
gst_element_class_set_static_metadata(element_class,
|
||||||
"VA-API sink",
|
"VA-API sink",
|
||||||
"Sink/Video",
|
"Sink/Video",
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "gst/vaapi/sysdeps.h"
|
#include "gst/vaapi/sysdeps.h"
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <gst/video/videocontext.h>
|
|
||||||
|
|
||||||
#include "gstvaapiupload.h"
|
#include "gstvaapiupload.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
|
@ -68,34 +67,11 @@ static GstStaticPadTemplate gst_vaapiupload_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
|
GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
|
||||||
|
|
||||||
/* GstVideoContext interface */
|
|
||||||
static void
|
|
||||||
gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
|
|
||||||
const GValue *value)
|
|
||||||
{
|
|
||||||
GstVaapiUpload * const upload = GST_VAAPIUPLOAD(context);
|
|
||||||
|
|
||||||
gst_vaapi_set_display(type, value, &GST_VAAPI_PLUGIN_BASE_DISPLAY(upload));
|
|
||||||
|
|
||||||
if (upload->uploader)
|
|
||||||
gst_vaapi_uploader_ensure_display(upload->uploader,
|
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY(upload));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_video_context_interface_init(GstVideoContextInterface *iface)
|
|
||||||
{
|
|
||||||
iface->set_context = gst_vaapiupload_set_video_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GstVideoContextClass GstVideoContextInterface
|
|
||||||
G_DEFINE_TYPE_WITH_CODE(
|
G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiUpload,
|
GstVaapiUpload,
|
||||||
gst_vaapiupload,
|
gst_vaapiupload,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
|
||||||
gst_video_context_interface_init))
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapiupload_start(GstBaseTransform *trans);
|
gst_vaapiupload_start(GstBaseTransform *trans);
|
||||||
|
|
Loading…
Reference in a new issue