va: Do not use a common parent_class in vabasedec.
We have only one copy of gst_va_base_dec_parent_class inside the vabasedec, so it can not handle the case when there are multi va decoders inside one pipeline. The pipeline: gst-launch-1.0 filesrc location=xxx.h264 ! h264parse \ ! vah264dec ! msdkh265enc ! vah265dec ! fakesink generates a assertion of "invalid cast from 'GstVaH264Dec' to 'GstH265Decoder" and gets a crash. We should keep the parent_class for each decoder type. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2231>
This commit is contained in:
parent
da27722351
commit
64b596103a
@ -80,9 +80,6 @@ struct _GstVaAV1Dec
|
|||||||
gboolean need_negotiation;
|
gboolean need_negotiation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
||||||
@ -136,7 +133,8 @@ gst_va_av1_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
@ -871,7 +869,7 @@ static void
|
|||||||
gst_va_av1_dec_dispose (GObject * object)
|
gst_va_av1_dec_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
|
|
||||||
#define GST_CAT_DEFAULT (base->debug_category)
|
#define GST_CAT_DEFAULT (base->debug_category)
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
gpointer gst_va_base_dec_parent_class = NULL;
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_va_base_dec_open (GstVideoDecoder * decoder)
|
gst_va_base_dec_open (GstVideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
@ -86,7 +83,8 @@ gst_va_base_dec_stop (GstVideoDecoder * decoder)
|
|||||||
gst_buffer_pool_set_active (base->other_pool, FALSE);
|
gst_buffer_pool_set_active (base->other_pool, FALSE);
|
||||||
gst_clear_object (&base->other_pool);
|
gst_clear_object (&base->other_pool);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->stop (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->stop (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
@ -175,7 +173,8 @@ gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
|||||||
/* else jump to default */
|
/* else jump to default */
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ret = GST_VIDEO_DECODER_CLASS (parent_class)->src_query (decoder, query);
|
ret = GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->src_query (decoder, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +186,8 @@ gst_va_base_dec_sink_query (GstVideoDecoder * decoder, GstQuery * query)
|
|||||||
{
|
{
|
||||||
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT)
|
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT)
|
||||||
return _query_context (GST_VA_BASE_DEC (decoder), query);
|
return _query_context (GST_VA_BASE_DEC (decoder), query);
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->sink_query (decoder, query);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->sink_query (decoder, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstAllocator *
|
static GstAllocator *
|
||||||
@ -408,7 +408,8 @@ gst_va_base_dec_set_context (GstElement * element, GstContext * context)
|
|||||||
gst_clear_object (&old_display);
|
gst_clear_object (&old_display);
|
||||||
gst_clear_object (&new_display);
|
gst_clear_object (&new_display);
|
||||||
|
|
||||||
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
|
GST_ELEMENT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(element))->set_context (element, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -426,7 +427,7 @@ gst_va_base_dec_class_init (GstVaBaseDecClass * klass, GstVaCodecs codec,
|
|||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_CLASS (klass);
|
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_CLASS (klass);
|
||||||
|
|
||||||
gst_va_base_dec_parent_class = g_type_class_peek_parent (klass);
|
klass->parent_decoder_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
klass->codec = codec;
|
klass->codec = codec;
|
||||||
klass->render_device_path = g_strdup (render_device_path);
|
klass->render_device_path = g_strdup (render_device_path);
|
||||||
|
@ -37,6 +37,7 @@ G_BEGIN_DECLS
|
|||||||
#define GST_VA_BASE_DEC(obj) ((GstVaBaseDec *)(obj))
|
#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_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_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 _GstVaBaseDec GstVaBaseDec;
|
||||||
typedef struct _GstVaBaseDecClass GstVaBaseDecClass;
|
typedef struct _GstVaBaseDecClass GstVaBaseDecClass;
|
||||||
@ -90,6 +91,8 @@ struct _GstVaBaseDecClass
|
|||||||
|
|
||||||
GstVaCodecs codec;
|
GstVaCodecs codec;
|
||||||
gchar *render_device_path;
|
gchar *render_device_path;
|
||||||
|
/* The parent class in GType hierarchy */
|
||||||
|
GstObjectClass *parent_decoder_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CData
|
struct CData
|
||||||
|
@ -89,9 +89,6 @@ struct _GstVaH264Dec
|
|||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
||||||
@ -825,7 +822,8 @@ gst_va_h264_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -836,7 +834,7 @@ gst_va_h264_dec_dispose (GObject * object)
|
|||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
g_clear_pointer (&self->ref_list, g_array_unref);
|
g_clear_pointer (&self->ref_list, g_array_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -92,9 +92,6 @@ struct _GstVaH265Dec
|
|||||||
gboolean need_negotiation;
|
gboolean need_negotiation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
|
||||||
@ -388,8 +385,8 @@ gst_va_h265_dec_decode_slice (GstH265Decoder * decoder,
|
|||||||
header->deblocking_filter_disabled_flag;
|
header->deblocking_filter_disabled_flag;
|
||||||
slice_param.LongSliceFlags.fields.collocated_from_l0_flag =
|
slice_param.LongSliceFlags.fields.collocated_from_l0_flag =
|
||||||
header->collocated_from_l0_flag;
|
header->collocated_from_l0_flag;
|
||||||
slice_param.LongSliceFlags.
|
slice_param.LongSliceFlags.fields.
|
||||||
fields.slice_loop_filter_across_slices_enabled_flag =
|
slice_loop_filter_across_slices_enabled_flag =
|
||||||
header->loop_filter_across_slices_enabled_flag;
|
header->loop_filter_across_slices_enabled_flag;
|
||||||
|
|
||||||
_fill_ref_pic_list (decoder, picture, slice_param.RefPicList[0],
|
_fill_ref_pic_list (decoder, picture, slice_param.RefPicList[0],
|
||||||
@ -898,14 +895,15 @@ gst_va_h265_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_va_h265_dec_dispose (GObject * object)
|
gst_va_h265_dec_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -76,9 +76,6 @@ struct _GstVaMpeg2Dec
|
|||||||
GstMpegVideoSequenceHdr seq;
|
GstMpegVideoSequenceHdr seq;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
||||||
@ -132,7 +129,8 @@ gst_va_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VAProfile
|
static VAProfile
|
||||||
@ -604,7 +602,7 @@ static void
|
|||||||
gst_va_mpeg2_dec_dispose (GObject * object)
|
gst_va_mpeg2_dec_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -75,9 +75,6 @@ struct _GstVaVp8Dec
|
|||||||
gboolean need_negotiation;
|
gboolean need_negotiation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
||||||
@ -128,7 +125,8 @@ gst_va_vp8_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VAProfile
|
static VAProfile
|
||||||
@ -466,7 +464,7 @@ static void
|
|||||||
gst_va_vp8_dec_dispose (GObject * object)
|
gst_va_vp8_dec_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -73,9 +73,6 @@ struct _GstVaVp9Dec
|
|||||||
gboolean need_negotiation;
|
gboolean need_negotiation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define parent_class gst_va_base_dec_parent_class
|
|
||||||
extern gpointer gst_va_base_dec_parent_class;
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
|
||||||
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
|
||||||
@ -520,14 +517,15 @@ gst_va_vp9_dec_negotiate (GstVideoDecoder * decoder)
|
|||||||
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
|
||||||
base->output_state->caps);
|
base->output_state->caps);
|
||||||
|
|
||||||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
|
||||||
|
(decoder))->negotiate (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_va_vp9_dec_dispose (GObject * object)
|
gst_va_vp9_dec_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user