mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-12 01:16:22 +00:00
va: basedec: refactor context query
Context query is handled either by source and sink queries. This patch factors-out its handling in a common utility function. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1999>
This commit is contained in:
parent
532b20cf05
commit
43cb1b5dcf
|
@ -117,6 +117,19 @@ gst_va_base_dec_getcaps (GstVideoDecoder * decoder, GstCaps * filter)
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_query_context (GstVaBaseDec * self, GstQuery * query)
|
||||||
|
{
|
||||||
|
GstVaDisplay *display = NULL;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
gst_object_replace ((GstObject **) & display, (GstObject *) self->display);
|
||||||
|
ret = gst_va_handle_context_query (GST_ELEMENT_CAST (self), query, display);
|
||||||
|
gst_clear_object (&display);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
{
|
{
|
||||||
|
@ -125,15 +138,7 @@ gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_CONTEXT:{
|
case GST_QUERY_CONTEXT:{
|
||||||
GstVaDisplay *display = NULL;
|
ret = _query_context (base, query);
|
||||||
|
|
||||||
gst_object_replace ((GstObject **) & display,
|
|
||||||
(GstObject *) base->display);
|
|
||||||
|
|
||||||
ret = gst_va_handle_context_query (GST_ELEMENT_CAST (decoder), query,
|
|
||||||
display);
|
|
||||||
|
|
||||||
gst_clear_object (&display);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_QUERY_CAPS:{
|
case GST_QUERY_CAPS:{
|
||||||
|
@ -180,22 +185,8 @@ gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_va_base_dec_sink_query (GstVideoDecoder * decoder, GstQuery * query)
|
gst_va_base_dec_sink_query (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
|
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT)
|
||||||
gboolean ret = FALSE;
|
return _query_context (GST_VA_BASE_DEC (decoder), query);
|
||||||
|
|
||||||
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT) {
|
|
||||||
GstVaDisplay *display = NULL;
|
|
||||||
|
|
||||||
gst_object_replace ((GstObject **) & display, (GstObject *) base->display);
|
|
||||||
|
|
||||||
ret = gst_va_handle_context_query (GST_ELEMENT_CAST (decoder), query,
|
|
||||||
display);
|
|
||||||
|
|
||||||
gst_clear_object (&display);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->sink_query (decoder, query);
|
return GST_VIDEO_DECODER_CLASS (parent_class)->sink_query (decoder, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue