diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index c7157f9d02..ea774d75d2 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -38,6 +38,16 @@ #define DEBUG 1 #include "gstvaapidebug.h" +enum +{ + PROP_DISPLAY = 1, + PROP_CAPS, + N_PROPERTIES +}; +static GParamSpec *g_properties[N_PROPERTIES] = { NULL, }; + +G_DEFINE_TYPE (GstVaapiDecoder, gst_vaapi_decoder, GST_TYPE_OBJECT); + static void drop_frame (GstVaapiDecoder * decoder, GstVideoCodecFrame * frame); static void @@ -453,14 +463,10 @@ notify_codec_state_changed (GstVaapiDecoder * decoder) decoder->codec_state_changed_data); } -void -gst_vaapi_decoder_finalize (GstVaapiDecoder * decoder) +static void +gst_vaapi_decoder_finalize (GObject * object) { - const GstVaapiDecoderClass *const klass = - GST_VAAPI_DECODER_GET_CLASS (decoder); - - if (klass->destroy) - klass->destroy (decoder); + GstVaapiDecoder *const decoder = GST_VAAPI_DECODER (object); gst_video_codec_state_unref (decoder->codec_state); decoder->codec_state = NULL; @@ -482,16 +488,90 @@ gst_vaapi_decoder_finalize (GstVaapiDecoder * decoder) gst_vaapi_display_replace (&decoder->display, NULL); decoder->va_display = NULL; + + G_OBJECT_CLASS (gst_vaapi_decoder_parent_class)->finalize (object); } -static gboolean -gst_vaapi_decoder_init (GstVaapiDecoder * decoder, GstVaapiDisplay * display, - GstCaps * caps) +static void +gst_vaapi_decoder_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GstVaapiDecoder *const decoder = GST_VAAPI_DECODER (object); + + switch (property_id) { + case PROP_DISPLAY: + g_assert (decoder->display == NULL); + decoder->display = g_value_dup_object (value); + g_assert (decoder->display != NULL); + decoder->va_display = GST_VAAPI_DISPLAY_VADISPLAY (decoder->display); + break; + case PROP_CAPS:{ + GstCaps *caps = g_value_get_boxed (value); + if (!set_caps (decoder, caps)) { + GST_WARNING_OBJECT (decoder, "failed to set caps %" GST_PTR_FORMAT, + caps); + } + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +gst_vaapi_decoder_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GstVaapiDecoder *const decoder = GST_VAAPI_DECODER (object); + + switch (property_id) { + case PROP_DISPLAY: + g_value_set_object (value, decoder->display); + break; + case PROP_CAPS: + g_value_set_boxed (value, get_caps (decoder)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +gst_vaapi_decoder_class_init (GstVaapiDecoderClass * klass) +{ + GObjectClass *const object_class = G_OBJECT_CLASS (klass); + + object_class->set_property = gst_vaapi_decoder_set_property; + object_class->get_property = gst_vaapi_decoder_get_property; + object_class->finalize = gst_vaapi_decoder_finalize; + + /** + * GstVaapiDecoder:display: + * + * #GstVaapiDisplay to be used. + */ + g_properties[PROP_DISPLAY] = + g_param_spec_object ("display", "Gst VA-API Display", + "The VA-API display object to use", GST_TYPE_VAAPI_DISPLAY, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME); + + /** + * GstCaps:caps: + * + * #GstCaps the caps describing the media to process. + */ + g_properties[PROP_CAPS] = + g_param_spec_boxed ("caps", "Caps", + "The caps describing the media to process", GST_TYPE_CAPS, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME); + + g_object_class_install_properties (object_class, N_PROPERTIES, g_properties); +} + +static void +gst_vaapi_decoder_init (GstVaapiDecoder * decoder) { - const GstVaapiDecoderClass *const klass = - GST_VAAPI_DECODER_GET_CLASS (decoder); GstVideoCodecState *codec_state; - guint sub_size; parser_state_init (&decoder->parser_state); @@ -499,56 +579,21 @@ gst_vaapi_decoder_init (GstVaapiDecoder * decoder, GstVaapiDisplay * display, codec_state->ref_count = 1; gst_video_info_init (&codec_state->info); - decoder->user_data = NULL; - decoder->display = gst_object_ref (display); - decoder->va_display = GST_VAAPI_DISPLAY_VADISPLAY (display); - decoder->context = NULL; decoder->va_context = VA_INVALID_ID; - decoder->codec = 0; decoder->codec_state = codec_state; - decoder->codec_state_changed_func = NULL; - decoder->codec_state_changed_data = NULL; - decoder->buffers = g_async_queue_new_full ((GDestroyNotify) gst_buffer_unref); decoder->frames = g_async_queue_new_full ((GDestroyNotify) gst_video_codec_frame_unref); - - if (!set_caps (decoder, caps)) - return FALSE; - - sub_size = GST_VAAPI_MINI_OBJECT_CLASS (klass)->size - sizeof (*decoder); - if (sub_size > 0) - memset (((guchar *) decoder) + sizeof (*decoder), 0, sub_size); - - if (klass->create && !klass->create (decoder)) - return FALSE; - return TRUE; } GstVaapiDecoder * -gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass, - GstVaapiDisplay * display, GstCaps * caps) +gst_vaapi_decoder_new (GstVaapiDisplay * display, GstCaps * caps) { - GstVaapiDecoder *decoder; - g_return_val_if_fail (display != NULL, NULL); g_return_val_if_fail (GST_IS_CAPS (caps), NULL); - decoder = (GstVaapiDecoder *) - gst_vaapi_mini_object_new (GST_VAAPI_MINI_OBJECT_CLASS (klass)); - if (!decoder) - return NULL; - - if (!gst_vaapi_decoder_init (decoder, display, caps)) - goto error; - return decoder; - - /* ERRORS */ -error: - { - gst_vaapi_decoder_unref (decoder); - return NULL; - } + return g_object_new (GST_TYPE_VAAPI_DECODER, "display", display, + "caps", caps, NULL); } /** @@ -562,7 +607,7 @@ error: GstVaapiDecoder * gst_vaapi_decoder_ref (GstVaapiDecoder * decoder) { - return gst_vaapi_object_ref (decoder); + return gst_object_ref (decoder); } /** @@ -575,7 +620,7 @@ gst_vaapi_decoder_ref (GstVaapiDecoder * decoder) void gst_vaapi_decoder_unref (GstVaapiDecoder * decoder) { - gst_vaapi_object_unref (decoder); + gst_object_unref (decoder); } /** @@ -591,8 +636,7 @@ void gst_vaapi_decoder_replace (GstVaapiDecoder ** old_decoder_ptr, GstVaapiDecoder * new_decoder) { - gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) old_decoder_ptr, - GST_VAAPI_MINI_OBJECT (new_decoder)); + gst_object_replace ((GstObject **) old_decoder_ptr, GST_OBJECT (new_decoder)); } /** diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.h b/gst-libs/gst/vaapi/gstvaapidecoder.h index 8b442b9f41..e0a6059d07 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder.h @@ -32,8 +32,12 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER \ + (gst_vaapi_decoder_get_type ()) #define GST_VAAPI_DECODER(obj) \ - ((GstVaapiDecoder *)(obj)) + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER, GstVaapiDecoder)) +#define GST_VAAPI_IS_DECODER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER)) typedef struct _GstVaapiDecoder GstVaapiDecoder; typedef void (*GstVaapiDecoderStateChangedFunc) (GstVaapiDecoder * decoder, @@ -73,6 +77,9 @@ typedef enum { GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1 } GstVaapiDecoderStatus; +GType +gst_vaapi_decoder_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * gst_vaapi_decoder_ref (GstVaapiDecoder * decoder); @@ -141,6 +148,10 @@ gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder); gboolean gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps); +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiDecoder, gst_vaapi_decoder_unref) +#endif + G_END_DECLS #endif /* GST_VAAPI_DECODER_H */ diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index 3654e80956..dfadad6d38 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -558,6 +558,9 @@ struct _GstVaapiDecoderH264Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderH264, gst_vaapi_decoder_h264, + GST_TYPE_VAAPI_DECODER); + static gboolean exec_ref_pic_marking (GstVaapiDecoderH264 * decoder, GstVaapiPictureH264 * picture); @@ -4710,16 +4713,21 @@ gst_vaapi_decoder_h264_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_h264_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_h264_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_h264_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_h264_class_init (GstVaapiDecoderH264Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderH264); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; - decoder_class->create = gst_vaapi_decoder_h264_create; decoder_class->destroy = gst_vaapi_decoder_h264_destroy; decoder_class->reset = gst_vaapi_decoder_h264_reset; @@ -4728,21 +4736,17 @@ gst_vaapi_decoder_h264_class_init (GstVaapiDecoderH264Class * klass) decoder_class->start_frame = gst_vaapi_decoder_h264_start_frame; decoder_class->end_frame = gst_vaapi_decoder_h264_end_frame; decoder_class->flush = gst_vaapi_decoder_h264_flush; - decoder_class->decode_codec_data = gst_vaapi_decoder_h264_decode_codec_data; + + object_class->finalize = gst_vaapi_decoder_h264_finalize; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_h264_class (void) +static void +gst_vaapi_decoder_h264_init (GstVaapiDecoderH264 * decoder) { - static GstVaapiDecoderH264Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_h264_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_h264_create (base_decoder); } /** @@ -4830,5 +4834,6 @@ gst_vaapi_decoder_h264_get_low_latency (GstVaapiDecoderH264 * decoder) GstVaapiDecoder * gst_vaapi_decoder_h264_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_h264_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_H264, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.h b/gst-libs/gst/vaapi/gstvaapidecoder_h264.h index d170638134..999e80b27d 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.h @@ -27,8 +27,12 @@ G_BEGIN_DECLS -#define GST_VAAPI_DECODER_H264(decoder) \ - ((GstVaapiDecoderH264 *)(decoder)) +#define GST_TYPE_VAAPI_DECODER_H264 \ + (gst_vaapi_decoder_h264_get_type ()) +#define GST_VAAPI_DECODER_H264(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_H264, GstVaapiDecoderH264)) +#define GST_VAAPI_IS_DECODER_H264(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_H264)) typedef struct _GstVaapiDecoderH264 GstVaapiDecoderH264; @@ -48,8 +52,11 @@ typedef enum { GST_VAAPI_STREAM_ALIGN_H264_AU } GstVaapiStreamAlignH264; +GType +gst_vaapi_decoder_h264_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_h264_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_h264_new (GstVaapiDisplay *display, GstCaps *caps); void gst_vaapi_decoder_h264_set_alignment(GstVaapiDecoderH264 *decoder, diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index 8e6d2e5763..c7f3abb7c3 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -445,6 +445,9 @@ struct _GstVaapiDecoderH265Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderH265, gst_vaapi_decoder_h265, + GST_TYPE_VAAPI_DECODER); + #define RSV_VCL_N10 10 #define RSV_VCL_N12 12 #define RSV_VCL_N14 14 @@ -3032,15 +3035,23 @@ gst_vaapi_decoder_h265_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_h265_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_h265_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_h265_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_h265_class_init (GstVaapiDecoderH265Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderH265); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_h265_finalize; + decoder_class->create = gst_vaapi_decoder_h265_create; decoder_class->destroy = gst_vaapi_decoder_h265_destroy; decoder_class->parse = gst_vaapi_decoder_h265_parse; @@ -3051,17 +3062,12 @@ gst_vaapi_decoder_h265_class_init (GstVaapiDecoderH265Class * klass) decoder_class->decode_codec_data = gst_vaapi_decoder_h265_decode_codec_data; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_h265_class (void) +static void +gst_vaapi_decoder_h265_init (GstVaapiDecoderH265 * decoder) { - static GstVaapiDecoderH265Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_h265_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_h265_create (base_decoder); } /** @@ -3094,5 +3100,6 @@ gst_vaapi_decoder_h265_set_alignment (GstVaapiDecoderH265 * decoder, GstVaapiDecoder * gst_vaapi_decoder_h265_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_h265_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_H265, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.h b/gst-libs/gst/vaapi/gstvaapidecoder_h265.h index 89f0f931bf..619d3008db 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.h @@ -28,8 +28,12 @@ G_BEGIN_DECLS -#define GST_VAAPI_DECODER_H265(decoder) \ - ((GstVaapiDecoderH265 *)(decoder)) +#define GST_TYPE_VAAPI_DECODER_H265 \ + (gst_vaapi_decoder_h265_get_type ()) +#define GST_VAAPI_DECODER_H265(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_H265, GstVaapiDecoderH265)) +#define GST_VAAPI_IS_DECODER_H265(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_H265)) typedef struct _GstVaapiDecoderH265 GstVaapiDecoderH265; @@ -49,11 +53,14 @@ typedef enum { GST_VAAPI_STREAM_ALIGN_H265_AU } GstVaapiStreamAlignH265; +GType +gst_vaapi_decoder_h265_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_h265_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_h265_new (GstVaapiDisplay *display, GstCaps *caps); void -gst_vaapi_decoder_h265_set_alignment(GstVaapiDecoderH265 *decoder, +gst_vaapi_decoder_h265_set_alignment (GstVaapiDecoderH265 *decoder, GstVaapiStreamAlignH265 alignment); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c index 51d9aeb1a9..d17b42e511 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c @@ -96,6 +96,9 @@ struct _GstVaapiDecoderJpegClass GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderJpeg, gst_vaapi_decoder_jpeg, + GST_TYPE_VAAPI_DECODER); + static inline void unit_set_marker_code (GstVaapiDecoderUnit * unit, GstJpegMarker marker) { @@ -844,15 +847,22 @@ gst_vaapi_decoder_jpeg_end_frame (GstVaapiDecoder * base_decoder) return decode_current_picture (decoder); } +static void +gst_vaapi_decoder_jpeg_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_jpeg_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_jpeg_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_jpeg_class_init (GstVaapiDecoderJpegClass * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderJpeg); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_jpeg_finalize; decoder_class->create = gst_vaapi_decoder_jpeg_create; decoder_class->destroy = gst_vaapi_decoder_jpeg_destroy; @@ -862,17 +872,12 @@ gst_vaapi_decoder_jpeg_class_init (GstVaapiDecoderJpegClass * klass) decoder_class->end_frame = gst_vaapi_decoder_jpeg_end_frame; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_jpeg_class (void) +static void +gst_vaapi_decoder_jpeg_init (GstVaapiDecoderJpeg * decoder) { - static GstVaapiDecoderJpegClass g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_jpeg_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_jpeg_create (base_decoder); } /** @@ -888,5 +893,6 @@ gst_vaapi_decoder_jpeg_class (void) GstVaapiDecoder * gst_vaapi_decoder_jpeg_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_jpeg_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_JPEG, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.h b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.h index 76a19cca53..876055ea42 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.h @@ -28,10 +28,20 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_JPEG \ + (gst_vaapi_decoder_jpeg_get_type ()) +#define GST_VAAPI_DECODER_JPEG(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_JPEG, GstVaapiDecoderJpeg)) +#define GST_VAAPI_IS_DECODER_JPEG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_JPEG)) + typedef struct _GstVaapiDecoderJpeg GstVaapiDecoderJpeg; +GType +gst_vaapi_decoder_jpeg_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_jpeg_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_jpeg_new (GstVaapiDisplay *display, GstCaps *caps); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c index 8d45910277..618270e6dd 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c @@ -296,6 +296,9 @@ struct _GstVaapiDecoderMpeg2Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderMpeg2, gst_vaapi_decoder_mpeg2, + GST_TYPE_VAAPI_DECODER); + static void gst_vaapi_decoder_mpeg2_close (GstVaapiDecoderMpeg2 * decoder) { @@ -1564,15 +1567,22 @@ gst_vaapi_decoder_mpeg2_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_mpeg2_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_mpeg2_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_mpeg2_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_mpeg2_class_init (GstVaapiDecoderMpeg2Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderMpeg2); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_mpeg2_finalize; decoder_class->create = gst_vaapi_decoder_mpeg2_create; decoder_class->destroy = gst_vaapi_decoder_mpeg2_destroy; @@ -1583,17 +1593,12 @@ gst_vaapi_decoder_mpeg2_class_init (GstVaapiDecoderMpeg2Class * klass) decoder_class->flush = gst_vaapi_decoder_mpeg2_flush; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_mpeg2_class (void) +static void +gst_vaapi_decoder_mpeg2_init (GstVaapiDecoderMpeg2 * decoder) { - static GstVaapiDecoderMpeg2Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_mpeg2_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_mpeg2_create (base_decoder); } /** @@ -1609,6 +1614,6 @@ gst_vaapi_decoder_mpeg2_class (void) GstVaapiDecoder * gst_vaapi_decoder_mpeg2_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_mpeg2_class (), - display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_MPEG2, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.h b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.h index 0fea920315..a996c59481 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.h @@ -28,10 +28,20 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_MPEG2 \ + (gst_vaapi_decoder_mpeg2_get_type ()) +#define GST_VAAPI_DECODER_MPEG2(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_MPEG2, GstVaapiDecoderMpeg2)) +#define GST_VAAPI_IS_DECODER_MPEG2(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_MPEG2)) + typedef struct _GstVaapiDecoderMpeg2 GstVaapiDecoderMpeg2; +GType +gst_vaapi_decoder_mpeg2_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_mpeg2_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_mpeg2_new (GstVaapiDisplay *display, GstCaps *caps); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c index bda09b4df0..f7090df335 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c @@ -119,6 +119,9 @@ struct _GstVaapiDecoderMpeg4Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderMpeg4, gst_vaapi_decoder_mpeg4, + GST_TYPE_VAAPI_DECODER); + static void gst_vaapi_decoder_mpeg4_close (GstVaapiDecoderMpeg4 * decoder) { @@ -1157,35 +1160,36 @@ gst_vaapi_decoder_mpeg4_decode (GstVaapiDecoder * base_decoder, return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_mpeg4_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_mpeg4_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_mpeg4_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_mpeg4_class_init (GstVaapiDecoderMpeg4Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderMpeg4); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_mpeg4_finalize; decoder_class->create = gst_vaapi_decoder_mpeg4_create; decoder_class->destroy = gst_vaapi_decoder_mpeg4_destroy; decoder_class->parse = gst_vaapi_decoder_mpeg4_parse; decoder_class->decode = gst_vaapi_decoder_mpeg4_decode; - decoder_class->decode_codec_data = gst_vaapi_decoder_mpeg4_decode_codec_data; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_mpeg4_class (void) +static void +gst_vaapi_decoder_mpeg4_init (GstVaapiDecoderMpeg4 * decoder) { - static GstVaapiDecoderMpeg4Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_mpeg4_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_mpeg4_create (base_decoder); } /** @@ -1201,6 +1205,6 @@ gst_vaapi_decoder_mpeg4_class (void) GstVaapiDecoder * gst_vaapi_decoder_mpeg4_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_mpeg4_class (), - display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_MPEG4, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.h b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.h index 3ce4add4e0..99d918d09a 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.h @@ -27,10 +27,20 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_MPEG4 \ + (gst_vaapi_decoder_mpeg4_get_type ()) +#define GST_VAAPI_DECODER_MPEG4(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_MPEG4, GstVaapiDecoderMpeg4)) +#define GST_VAAPI_IS_DECODER_MPEG4(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_MPEG4)) + typedef struct _GstVaapiDecoderMpeg4 GstVaapiDecoderMpeg4; +GType +gst_vaapi_decoder_mpeg4_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_mpeg4_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_mpeg4_new (GstVaapiDisplay *display, GstCaps *caps); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h index 4d92706f85..cdd80782f7 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h @@ -25,11 +25,10 @@ #ifndef GST_VAAPI_DECODER_PRIV_H #define GST_VAAPI_DECODER_PRIV_H -#include +#include "sysdeps.h" #include #include #include -#include "gstvaapiminiobject.h" G_BEGIN_DECLS @@ -37,13 +36,13 @@ G_BEGIN_DECLS ((GstVaapiDecoder *)(decoder)) #define GST_VAAPI_DECODER_CLASS(klass) \ - ((GstVaapiDecoderClass *)(klass)) + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_DECODER, GstVaapiDecoderClass)) #define GST_VAAPI_IS_DECODER_CLASS(klass) \ - ((klass) != NULL)) + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_DECODER)) #define GST_VAAPI_DECODER_GET_CLASS(obj) \ - GST_VAAPI_DECODER_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj)) + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_DECODER, GstVaapiDecoderClass)) typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass; @@ -187,7 +186,7 @@ struct _GstVaapiParserState struct _GstVaapiDecoder { /*< private >*/ - GstVaapiMiniObject parent_instance; + GstObject parent_instance; gpointer user_data; GstVaapiDisplay *display; @@ -211,7 +210,7 @@ struct _GstVaapiDecoder struct _GstVaapiDecoderClass { /*< private >*/ - GstVaapiMiniObjectClass parent_class; + GstObjectClass parent_class; gboolean (*create) (GstVaapiDecoder * decoder); void (*destroy) (GstVaapiDecoder * decoder); @@ -231,12 +230,7 @@ struct _GstVaapiDecoderClass G_GNUC_INTERNAL GstVaapiDecoder * -gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass, - GstVaapiDisplay * display, GstCaps * caps); - -G_GNUC_INTERNAL -void -gst_vaapi_decoder_finalize (GstVaapiDecoder * decoder); +gst_vaapi_decoder_new (GstVaapiDisplay * display, GstCaps * caps); G_GNUC_INTERNAL void diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c index 7fc0244b41..4bd03148ef 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c @@ -98,6 +98,9 @@ struct _GstVaapiDecoderVC1Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderVC1, gst_vaapi_decoder_vc1, + GST_TYPE_VAAPI_DECODER); + static GstVaapiDecoderStatus get_status (GstVC1ParserResult result) { @@ -1425,15 +1428,22 @@ gst_vaapi_decoder_vc1_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_vc1_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_vc1_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_vc1_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_vc1_class_init (GstVaapiDecoderVC1Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderVC1); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_vc1_finalize; decoder_class->create = gst_vaapi_decoder_vc1_create; decoder_class->destroy = gst_vaapi_decoder_vc1_destroy; @@ -1446,17 +1456,12 @@ gst_vaapi_decoder_vc1_class_init (GstVaapiDecoderVC1Class * klass) decoder_class->decode_codec_data = gst_vaapi_decoder_vc1_decode_codec_data; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_vc1_class (void) +static void +gst_vaapi_decoder_vc1_init (GstVaapiDecoderVC1 * decoder) { - static GstVaapiDecoderVC1Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_vc1_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_vc1_create (base_decoder); } /** @@ -1472,5 +1477,6 @@ gst_vaapi_decoder_vc1_class (void) GstVaapiDecoder * gst_vaapi_decoder_vc1_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_vc1_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_VC1, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.h b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.h index 6127909856..6f9474f94c 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.h @@ -27,10 +27,20 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_VC1 \ + (gst_vaapi_decoder_vc1_get_type ()) +#define GST_VAAPI_DECODER_VC1(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_VC1, GstVaapiDecoderVC1)) +#define GST_VAAPI_IS_DECODER_VC1(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_VC1)) + typedef struct _GstVaapiDecoderVC1 GstVaapiDecoderVC1; +GType +gst_vaapi_decoder_vc1_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * -gst_vaapi_decoder_vc1_new(GstVaapiDisplay *display, GstCaps *caps); +gst_vaapi_decoder_vc1_new (GstVaapiDisplay *display, GstCaps *caps); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c b/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c index 1503458001..80a0f9d4b1 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c @@ -83,6 +83,9 @@ struct _GstVaapiDecoderVp8Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderVp8, gst_vaapi_decoder_vp8, + GST_TYPE_VAAPI_DECODER); + static GstVaapiDecoderStatus get_status (GstVp8ParserResult result) { @@ -615,15 +618,22 @@ gst_vaapi_decoder_vp8_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_vp8_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_vp8_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_vp8_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_vp8_class_init (GstVaapiDecoderVp8Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderVp8); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_vp8_finalize; decoder_class->create = gst_vaapi_decoder_vp8_create; decoder_class->destroy = gst_vaapi_decoder_vp8_destroy; @@ -634,17 +644,12 @@ gst_vaapi_decoder_vp8_class_init (GstVaapiDecoderVp8Class * klass) decoder_class->flush = gst_vaapi_decoder_vp8_flush; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_vp8_class (void) +static void +gst_vaapi_decoder_vp8_init (GstVaapiDecoderVp8 * decoder) { - static GstVaapiDecoderVp8Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_vp8_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_vp8_create (base_decoder); } /** @@ -660,5 +665,6 @@ gst_vaapi_decoder_vp8_class (void) GstVaapiDecoder * gst_vaapi_decoder_vp8_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_vp8_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_VP8, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp8.h b/gst-libs/gst/vaapi/gstvaapidecoder_vp8.h index 43a88fdc85..816f6f02a0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp8.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp8.h @@ -28,8 +28,18 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_VP8 \ + (gst_vaapi_decoder_vp8_get_type ()) +#define GST_VAAPI_DECODER_VP8(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_VP8, GstVaapiDecoderVp8)) +#define GST_VAAPI_IS_DECODER_VP8(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_VP8)) + typedef struct _GstVaapiDecoderVp8 GstVaapiDecoderVp8; +GType +gst_vaapi_decoder_vp8_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * gst_vaapi_decoder_vp8_new (GstVaapiDisplay * display, GstCaps * caps); diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c index c2cc928473..5647e01375 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c @@ -87,6 +87,9 @@ struct _GstVaapiDecoderVp9Class GstVaapiDecoderClass parent_class; }; +G_DEFINE_TYPE (GstVaapiDecoderVp9, gst_vaapi_decoder_vp9, + GST_TYPE_VAAPI_DECODER); + static GstVaapiDecoderStatus get_status (GstVp9ParserResult result) { @@ -729,15 +732,22 @@ gst_vaapi_decoder_vp9_flush (GstVaapiDecoder * base_decoder) return GST_VAAPI_DECODER_STATUS_SUCCESS; } +static void +gst_vaapi_decoder_vp9_finalize (GObject * object) +{ + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (object); + + gst_vaapi_decoder_vp9_destroy (base_decoder); + G_OBJECT_CLASS (gst_vaapi_decoder_vp9_parent_class)->finalize (object); +} + static void gst_vaapi_decoder_vp9_class_init (GstVaapiDecoderVp9Class * klass) { - GstVaapiMiniObjectClass *const object_class = - GST_VAAPI_MINI_OBJECT_CLASS (klass); + GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstVaapiDecoderClass *const decoder_class = GST_VAAPI_DECODER_CLASS (klass); - object_class->size = sizeof (GstVaapiDecoderVp9); - object_class->finalize = (GDestroyNotify) gst_vaapi_decoder_finalize; + object_class->finalize = gst_vaapi_decoder_vp9_finalize; decoder_class->create = gst_vaapi_decoder_vp9_create; decoder_class->destroy = gst_vaapi_decoder_vp9_destroy; @@ -748,17 +758,12 @@ gst_vaapi_decoder_vp9_class_init (GstVaapiDecoderVp9Class * klass) decoder_class->flush = gst_vaapi_decoder_vp9_flush; } -static inline const GstVaapiDecoderClass * -gst_vaapi_decoder_vp9_class (void) +static void +gst_vaapi_decoder_vp9_init (GstVaapiDecoderVp9 * decoder) { - static GstVaapiDecoderVp9Class g_class; - static gsize g_class_init = FALSE; + GstVaapiDecoder *const base_decoder = GST_VAAPI_DECODER (decoder); - if (g_once_init_enter (&g_class_init)) { - gst_vaapi_decoder_vp9_class_init (&g_class); - g_once_init_leave (&g_class_init, TRUE); - } - return GST_VAAPI_DECODER_CLASS (&g_class); + gst_vaapi_decoder_vp9_create (base_decoder); } /** @@ -774,5 +779,6 @@ gst_vaapi_decoder_vp9_class (void) GstVaapiDecoder * gst_vaapi_decoder_vp9_new (GstVaapiDisplay * display, GstCaps * caps) { - return gst_vaapi_decoder_new (gst_vaapi_decoder_vp9_class (), display, caps); + return g_object_new (GST_TYPE_VAAPI_DECODER_VP9, "display", display, + "caps", caps, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.h b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.h index 9d28c5e357..de97534559 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.h @@ -27,8 +27,18 @@ G_BEGIN_DECLS +#define GST_TYPE_VAAPI_DECODER_VP9 \ + (gst_vaapi_decoder_vp9_get_type ()) +#define GST_VAAPI_DECODER_VP9(decoder) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DECODER_VP9, GstVaapiDecoderVp9)) +#define GST_VAAPI_IS_DECODER_VP9(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DECODER_VP9)) + typedef struct _GstVaapiDecoderVp9 GstVaapiDecoderVp9; +GType +gst_vaapi_decoder_vp9_get_type (void) G_GNUC_CONST; + GstVaapiDecoder * gst_vaapi_decoder_vp9_new (GstVaapiDisplay * display, GstCaps * caps);