mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
vaapiencode: use pad query vmethods
GstVideoEncoder, the base class of vaapiencode, added support for pad queries as virtual methods since gstreamer 1.4. This patch enables those vmethods, while keeps support for previous versions of gstreamer. This patch is relevant since GstVideoEncoder takes care of other queries that we are currently ignoring. Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> https://bugzilla.gnome.org/show_bug.cgi?id=757629
This commit is contained in:
parent
75e7a0a36c
commit
ea802072d1
1 changed files with 47 additions and 0 deletions
|
@ -57,6 +57,45 @@ ensure_display (GstVaapiEncode * encode)
|
|||
return gst_vaapi_plugin_base_ensure_display (GST_VAAPI_PLUGIN_BASE (encode));
|
||||
}
|
||||
|
||||
#if GST_CHECK_VERSION(1,4,0)
|
||||
static gboolean
|
||||
gst_vaapiencode_sink_query (GstVideoEncoder * encoder, GstQuery * query)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (encoder);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CONTEXT:
|
||||
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
break;
|
||||
default:
|
||||
ret = GST_VIDEO_ENCODER_CLASS (gst_vaapiencode_parent_class)->sink_query
|
||||
(encoder, query);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapiencode_src_query (GstVideoEncoder * encoder, GstQuery * query)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (encoder);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CONTEXT:
|
||||
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
break;
|
||||
default:
|
||||
ret = GST_VIDEO_ENCODER_CLASS (gst_vaapiencode_parent_class)->src_query
|
||||
(encoder, query);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static gboolean
|
||||
gst_vaapiencode_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
|
@ -76,6 +115,7 @@ gst_vaapiencode_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
gst_object_unref (plugin);
|
||||
return success;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -610,8 +650,10 @@ gst_vaapiencode_init (GstVaapiEncode * encode)
|
|||
|
||||
gst_vaapi_plugin_base_init (GST_VAAPI_PLUGIN_BASE (encode), GST_CAT_DEFAULT);
|
||||
|
||||
#if !GST_CHECK_VERSION(1,4,0)
|
||||
gst_pad_set_query_function (plugin->sinkpad, gst_vaapiencode_query);
|
||||
gst_pad_set_query_function (plugin->srcpad, gst_vaapiencode_query);
|
||||
#endif
|
||||
gst_pad_use_fixed_caps (plugin->srcpad);
|
||||
}
|
||||
|
||||
|
@ -645,8 +687,13 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
|
|||
klass->set_property = gst_vaapiencode_default_set_property;
|
||||
klass->alloc_buffer = gst_vaapiencode_default_alloc_buffer;
|
||||
|
||||
#if GST_CHECK_VERSION(1,4,0)
|
||||
venc_class->src_query = GST_DEBUG_FUNCPTR (gst_vaapiencode_src_query);
|
||||
venc_class->sink_query = GST_DEBUG_FUNCPTR (gst_vaapiencode_sink_query);
|
||||
#else
|
||||
/* Registering debug symbols for function pointers */
|
||||
GST_DEBUG_REGISTER_FUNCPTR (gst_vaapiencode_query);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline GPtrArray *
|
||||
|
|
Loading…
Reference in a new issue