mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
va: Move back parent_object to each element.
Using GstBaseDec hack to access the parent_object of each element in the element itself is a bit fragile. It would be better to keep its own parent object as the usual global variable. It would make it resistant to code changes. The GstBaseDec macro to access the parent object now it's internal to base decoder. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>
This commit is contained in:
parent
428b4104b0
commit
a2a3c81c85
8 changed files with 37 additions and 19 deletions
|
@ -80,6 +80,8 @@ struct _GstVaAV1Dec
|
|||
gboolean need_negotiation;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -135,8 +137,7 @@ gst_va_av1_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
|
@ -880,7 +881,7 @@ static void
|
|||
gst_va_av1_dec_dispose (GObject * object)
|
||||
{
|
||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -908,6 +909,8 @@ gst_va_av1_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), AV1,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "gstvavideoformat.h"
|
||||
|
||||
#define GST_CAT_DEFAULT (base->debug_category)
|
||||
#define GST_VA_BASE_DEC_GET_PARENT_CLASS(obj) (GST_VA_BASE_DEC_GET_CLASS(obj)->parent_decoder_class)
|
||||
|
||||
static gboolean
|
||||
gst_va_base_dec_open (GstVideoDecoder * decoder)
|
||||
|
|
|
@ -37,7 +37,6 @@ G_BEGIN_DECLS
|
|||
#define GST_VA_BASE_DEC(obj) ((GstVaBaseDec *)(obj))
|
||||
#define GST_VA_BASE_DEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_FROM_INSTANCE (obj), GstVaBaseDecClass))
|
||||
#define GST_VA_BASE_DEC_CLASS(klass) ((GstVaBaseDecClass *)(klass))
|
||||
#define GST_VA_BASE_DEC_GET_PARENT_CLASS(obj) (GST_VA_BASE_DEC_GET_CLASS(obj)->parent_decoder_class)
|
||||
|
||||
typedef struct _GstVaBaseDec GstVaBaseDec;
|
||||
typedef struct _GstVaBaseDecClass GstVaBaseDecClass;
|
||||
|
|
|
@ -88,6 +88,8 @@ struct _GstVaH264Dec
|
|||
gboolean interlaced;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -857,8 +859,7 @@ gst_va_h264_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -869,7 +870,7 @@ gst_va_h264_dec_dispose (GObject * object)
|
|||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
g_clear_pointer (&self->ref_list, g_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -898,6 +899,8 @@ gst_va_h264_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), H264,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
|
@ -103,6 +103,8 @@ struct _GstVaH265Dec
|
|||
gboolean need_negotiation;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -1239,8 +1241,7 @@ gst_va_h265_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1250,7 +1251,7 @@ gst_va_h265_dec_dispose (GObject * object)
|
|||
|
||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1279,6 +1280,8 @@ gst_va_h265_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), HEVC,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
|
@ -76,6 +76,8 @@ struct _GstVaMpeg2Dec
|
|||
GstMpegVideoSequenceHdr seq;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -130,8 +132,7 @@ gst_va_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static VAProfile
|
||||
|
@ -606,7 +607,7 @@ static void
|
|||
gst_va_mpeg2_dec_dispose (GObject * object)
|
||||
{
|
||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -634,6 +635,8 @@ gst_va_mpeg2_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), MPEG2,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
|
@ -75,6 +75,8 @@ struct _GstVaVp8Dec
|
|||
gboolean need_negotiation;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -126,8 +128,7 @@ gst_va_vp8_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static VAProfile
|
||||
|
@ -472,7 +473,7 @@ static void
|
|||
gst_va_vp8_dec_dispose (GObject * object)
|
||||
{
|
||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -500,6 +501,8 @@ gst_va_vp8_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), VP8,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
|
@ -74,6 +74,8 @@ struct _GstVaVp9Dec
|
|||
gboolean need_negotiation;
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
|
||||
|
@ -612,15 +614,14 @@ gst_va_vp9_dec_negotiate (GstVideoDecoder * decoder)
|
|||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||
base->output_state->caps);
|
||||
|
||||
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||
(decoder))->negotiate (decoder);
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_va_vp9_dec_dispose (GObject * object)
|
||||
{
|
||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -648,6 +649,8 @@ gst_va_vp9_dec_class_init (gpointer g_class, gpointer class_data)
|
|||
sink_doc_caps = gst_caps_from_string (sink_caps_str);
|
||||
src_doc_caps = gst_caps_from_string (src_caps_str);
|
||||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), VP9,
|
||||
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
|
||||
src_doc_caps, sink_doc_caps);
|
||||
|
|
Loading…
Reference in a new issue