vtenc: Fix class hierarchy in an attempt to fix property docs

Also fix some convention-nits in the process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8120>
This commit is contained in:
Nirbheek Chauhan 2024-12-10 00:05:53 +05:30 committed by GStreamer Marge Bot
parent e881817567
commit 07e538c043
4 changed files with 51 additions and 25 deletions

View file

@ -19464,6 +19464,7 @@
"GstVtdec!src",
"GstVtdecHw!sink",
"GstVtdecHw!src",
"GstVTEnc",
"GstVulkanBarrierBufferInfo",
"GstVulkanBarrierBufferInfo.offset",
"GstVulkanBarrierBufferInfo.parent",

View file

@ -4518,6 +4518,7 @@
"description": "H.264 encoder",
"hierarchy": [
"vtenc_h264",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -4654,6 +4655,7 @@
"description": "H.264 (HW only) encoder",
"hierarchy": [
"vtenc_h264_hw",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -4790,6 +4792,7 @@
"description": "H.265/HEVC encoder",
"hierarchy": [
"vtenc_h265",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -4925,6 +4928,7 @@
"description": "H.265/HEVC (HW only) encoder",
"hierarchy": [
"vtenc_h265_hw",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -5060,6 +5064,7 @@
"description": "H.265/HEVC with alpha encoder",
"hierarchy": [
"vtenc_h265a",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -5195,6 +5200,7 @@
"description": "H.265/HEVC with alpha (HW only) encoder",
"hierarchy": [
"vtenc_h265a_hw",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -5330,6 +5336,7 @@
"description": "Apple ProRes encoder",
"hierarchy": [
"vtenc_prores",
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
@ -5566,6 +5573,20 @@
}
]
},
"GstVTEnc": {
"hierarchy": [
"GstVTEnc",
"GstVideoEncoder",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"interfaces": [
"GstPreset"
],
"kind": "object"
},
"GstVtencRateControl": {
"kind": "enum",
"values": [

View file

@ -127,7 +127,9 @@
#include "vtenc.h"
#include "coremediabuffer.h"
#ifdef HAVE_IOS
#include "corevideobuffer.h"
#endif
#include "vtutil.h"
#include "helpers.h"
#include <gst/pbutils/codec-utils.h>
@ -205,7 +207,8 @@ struct _GstVTEncFrame
GstVideoFrame videoframe;
};
static GstElementClass *parent_class = NULL;
#define parent_class gst_vtenc_parent_class
G_DEFINE_TYPE (GstVTEnc, gst_vtenc, GST_TYPE_VIDEO_ENCODER);
static void gst_vtenc_get_property (GObject * obj, guint prop_id,
GValue * value, GParamSpec * pspec);
@ -422,15 +425,9 @@ gst_vtenc_base_init (GstVTEncClass * klass)
static void
gst_vtenc_class_init (GstVTEncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstVideoEncoderClass *gstvideoencoder_class;
gobject_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
gstvideoencoder_class = (GstVideoEncoderClass *) klass;
parent_class = g_type_class_peek_parent (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstVideoEncoderClass *gstvideoencoder_class = GST_VIDEO_ENCODER_CLASS (klass);
gobject_class->get_property = gst_vtenc_get_property;
gobject_class->set_property = gst_vtenc_set_property;
@ -438,13 +435,14 @@ gst_vtenc_class_init (GstVTEncClass * klass)
element_class->change_state = GST_DEBUG_FUNCPTR (gst_vtenc_change_state);
gstvideoencoder_class->start = gst_vtenc_start;
gstvideoencoder_class->stop = gst_vtenc_stop;
gstvideoencoder_class->set_format = gst_vtenc_set_format;
gstvideoencoder_class->handle_frame = gst_vtenc_handle_frame;
gstvideoencoder_class->finish = gst_vtenc_finish;
gstvideoencoder_class->flush = gst_vtenc_flush;
gstvideoencoder_class->sink_event = gst_vtenc_sink_event;
gstvideoencoder_class->start = GST_DEBUG_FUNCPTR (gst_vtenc_start);
gstvideoencoder_class->stop = GST_DEBUG_FUNCPTR (gst_vtenc_stop);
gstvideoencoder_class->set_format = GST_DEBUG_FUNCPTR (gst_vtenc_set_format);
gstvideoencoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_vtenc_handle_frame);
gstvideoencoder_class->finish = GST_DEBUG_FUNCPTR (gst_vtenc_finish);
gstvideoencoder_class->flush = GST_DEBUG_FUNCPTR (gst_vtenc_flush);
gstvideoencoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_vtenc_sink_event);
g_object_class_install_property (gobject_class, PROP_BITRATE,
g_param_spec_uint ("bitrate", "Bitrate",
@ -580,6 +578,7 @@ gst_vtenc_class_init (GstVTEncClass * klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
}
gst_type_mark_as_plugin_api (GST_TYPE_VTENC, 0);
gst_type_mark_as_plugin_api (GST_TYPE_VTENC_RATE_CONTROL, 0);
}
@ -2558,8 +2557,7 @@ gst_vtenc_register (GstPlugin * plugin,
type_name = g_strdup_printf ("vtenc_%s", codec_details->element_name);
type =
g_type_register_static (GST_TYPE_VIDEO_ENCODER, type_name, &type_info, 0);
type = g_type_register_static (GST_TYPE_VTENC, type_name, &type_info, 0);
g_type_set_qdata (type, GST_VTENC_CODEC_DETAILS_QDATA,
(gpointer) codec_details);

View file

@ -28,8 +28,16 @@
G_BEGIN_DECLS
#define GST_VTENC_CAST(obj) \
((GstVTEnc *) (obj))
#define GST_TYPE_VTENC (gst_vtenc_get_type())
#define GST_VTENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VTENC, GstVTEnc))
#define GST_VTENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VTENC, GstVTEncClass))
#define GST_IS_VTENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VTENC))
#define GST_IS_VTENC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VTENC))
#define GST_VTENC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VTENC, GstVTEncClass))
#define GST_VTENC_CAST(obj) ((GstVTEnc *)obj)
typedef struct _GstVTEnc GstVTEnc;
typedef struct _GstVTEncClass GstVTEncClass;
#define GST_VTENC_CLASS_GET_CODEC_DETAILS(klass) \
((const GstVTEncoderDetails *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), \
GST_VTENC_CODEC_DETAILS_QDATA))
@ -49,10 +57,6 @@ typedef enum
typedef struct _GstVTEncoderDetails GstVTEncoderDetails;
typedef struct _GstVTEncClassParams GstVTEncClassParams;
typedef struct _GstVTEncClass GstVTEncClass;
typedef struct _GstVTEnc GstVTEnc;
struct _GstVTEncoderDetails
{
const gchar * name;
@ -119,6 +123,8 @@ struct _GstVTEnc
gboolean require_restart;
};
GType gst_vtenc_get_type (void);
void gst_vtenc_register_elements (GstPlugin * plugin);
G_END_DECLS