mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
aggregator: Remove klass->sinkpads_type
This posed problems for the python bindings (and possibly others). Instead, subclasses now use add_pad_template_with_gtype. https://bugzilla.gnome.org/show_bug.cgi?id=789986
This commit is contained in:
parent
00874850e7
commit
56fc5bef18
11 changed files with 38 additions and 43 deletions
|
@ -270,7 +270,6 @@ gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_gl_base_mixer_set_context);
|
||||
element_class->change_state = gst_gl_base_mixer_change_state;
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_GL_BASE_MIXER_PAD;
|
||||
agg_class->sink_query = gst_gl_base_mixer_sink_query;
|
||||
agg_class->src_query = gst_gl_base_mixer_src_query;
|
||||
agg_class->src_activate = gst_gl_base_mixer_src_activate_mode;
|
||||
|
|
|
@ -365,9 +365,9 @@ gst_gl_mixer_class_init (GstGLMixerClass * klass)
|
|||
gobject_class->set_property = gst_gl_mixer_set_property;
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template_with_gtype (element_class,
|
||||
&sink_factory, GST_TYPE_GL_MIXER_PAD);
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_GL_MIXER_PAD;
|
||||
agg_class->sink_query = gst_gl_mixer_sink_query;
|
||||
agg_class->src_query = gst_gl_mixer_src_query;
|
||||
agg_class->stop = gst_gl_mixer_stop;
|
||||
|
|
|
@ -180,9 +180,9 @@ gst_gl_stereo_mix_class_init (GstGLStereoMixClass * klass)
|
|||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template_with_gtype (element_class,
|
||||
&sink_factory, GST_TYPE_GL_STEREO_MIX_PAD);
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_GL_STEREO_MIX_PAD;
|
||||
agg_class->stop = gst_gl_stereo_mix_stop;
|
||||
agg_class->start = gst_gl_stereo_mix_start;
|
||||
agg_class->src_query = gst_gl_stereo_mix_src_query;
|
||||
|
|
|
@ -55,6 +55,14 @@
|
|||
#define GST_CAT_DEFAULT gst_gl_video_mixer_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%u",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
|
||||
"RGBA"))
|
||||
);
|
||||
|
||||
#define GST_TYPE_GL_VIDEO_MIXER_BACKGROUND (gst_gl_video_mixer_background_get_type())
|
||||
static GType
|
||||
gst_gl_video_mixer_background_get_type (void)
|
||||
|
@ -862,6 +870,9 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass)
|
|||
"Filter/Effect/Video/Compositor", "OpenGL video_mixer",
|
||||
"Matthew Waters <matthew@centricular.com>");
|
||||
|
||||
gst_element_class_add_static_pad_template_with_gtype (element_class,
|
||||
&sink_factory, GST_TYPE_GL_VIDEO_MIXER_PAD);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_BACKGROUND,
|
||||
g_param_spec_enum ("background", "Background", "Background type",
|
||||
GST_TYPE_GL_VIDEO_MIXER_BACKGROUND,
|
||||
|
@ -875,7 +886,6 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass)
|
|||
|
||||
vagg_class->update_caps = _update_caps;
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
|
||||
agg_class->fixate_src_caps = _fixate_caps;
|
||||
agg_class->propose_allocation = gst_gl_video_mixer_propose_allocation;
|
||||
|
||||
|
|
|
@ -1564,6 +1564,9 @@ gst_aggregator_default_create_new_pad (GstAggregator * self,
|
|||
GstAggregatorPrivate *priv = self->priv;
|
||||
gint serial = 0;
|
||||
gchar *name = NULL;
|
||||
GType pad_type =
|
||||
GST_PAD_TEMPLATE_GTYPE (templ) ==
|
||||
G_TYPE_NONE ? GST_TYPE_AGGREGATOR_PAD : GST_PAD_TEMPLATE_GTYPE (templ);
|
||||
|
||||
if (templ->direction != GST_PAD_SINK)
|
||||
goto not_sink;
|
||||
|
@ -1584,7 +1587,7 @@ gst_aggregator_default_create_new_pad (GstAggregator * self,
|
|||
}
|
||||
|
||||
name = g_strdup_printf ("sink_%u", serial);
|
||||
agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
|
||||
agg_pad = g_object_new (pad_type,
|
||||
"name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
|
||||
g_free (name);
|
||||
|
||||
|
@ -2224,8 +2227,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
GST_DEBUG_CATEGORY_INIT (aggregator_debug, "aggregator",
|
||||
GST_DEBUG_FG_MAGENTA, "GstAggregator");
|
||||
|
||||
klass->sinkpads_type = GST_TYPE_AGGREGATOR_PAD;
|
||||
|
||||
klass->sink_event = gst_aggregator_default_sink_event;
|
||||
klass->sink_query = gst_aggregator_default_sink_query;
|
||||
|
||||
|
|
|
@ -152,9 +152,6 @@ struct _GstAggregator
|
|||
|
||||
/**
|
||||
* GstAggregatorClass:
|
||||
* @sinkpads_type: Optional.
|
||||
* The type of the pads that should be created when
|
||||
* GstElement.request_new_pad is called.
|
||||
* @flush: Optional.
|
||||
* Called after a successful flushing seek, once all the flush
|
||||
* stops have been received. Flush pad-specific data in
|
||||
|
@ -233,8 +230,6 @@ struct _GstAggregator
|
|||
struct _GstAggregatorClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
GType sinkpads_type;
|
||||
|
||||
GstFlowReturn (*flush) (GstAggregator * aggregator);
|
||||
|
||||
GstBuffer * (*clip) (GstAggregator * aggregator,
|
||||
|
|
|
@ -692,8 +692,6 @@ static gboolean
|
|||
gst_video_aggregator_default_negotiated_src_caps (GstAggregator * agg,
|
||||
GstCaps * caps)
|
||||
{
|
||||
GstVideoAggregatorPadClass *vaggpad_klass = g_type_class_peek
|
||||
(GST_AGGREGATOR_GET_CLASS (agg)->sinkpads_type);
|
||||
GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
|
||||
gboolean at_least_one_alpha = FALSE;
|
||||
const GstVideoFormatInfo *finfo;
|
||||
|
@ -741,14 +739,15 @@ gst_video_aggregator_default_negotiated_src_caps (GstAggregator * agg,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (vaggpad_klass->set_info) {
|
||||
/* Then browse the sinks once more, setting or unsetting conversion if needed */
|
||||
for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
|
||||
GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (l->data);
|
||||
/* Then browse the sinks once more, setting or unsetting conversion if needed */
|
||||
for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
|
||||
GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (l->data);
|
||||
GstVideoAggregatorPadClass *vaggpad_klass =
|
||||
GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
|
||||
|
||||
if (!vaggpad_klass->set_info (pad, vagg, &pad->info, &vagg->info)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (vaggpad_klass->set_info
|
||||
&& !vaggpad_klass->set_info (pad, vagg, &pad->info, &vagg->info)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1304,8 @@ clean_pad (GstElement * agg, GstPad * pad, gpointer user_data)
|
|||
GstVideoAggregatorPadClass *vaggpad_class =
|
||||
GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
|
||||
|
||||
vaggpad_class->clean_frame (vpad, vagg);
|
||||
if (vaggpad_class->clean_frame)
|
||||
vaggpad_class->clean_frame (vpad, vagg);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1318,8 +1318,6 @@ gst_video_aggregator_do_aggregate (GstVideoAggregator * vagg,
|
|||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (vagg);
|
||||
GstVideoAggregatorClass *vagg_klass = (GstVideoAggregatorClass *) klass;
|
||||
GstVideoAggregatorPadClass *vaggpad_class = g_type_class_peek
|
||||
(GST_AGGREGATOR_CLASS (klass)->sinkpads_type);
|
||||
|
||||
g_assert (vagg_klass->aggregate_frames != NULL);
|
||||
g_assert (vagg_klass->get_output_buffer != NULL);
|
||||
|
@ -1345,9 +1343,7 @@ gst_video_aggregator_do_aggregate (GstVideoAggregator * vagg,
|
|||
|
||||
ret = vagg_klass->aggregate_frames (vagg, *outbuf);
|
||||
|
||||
if (vaggpad_class->clean_frame) {
|
||||
gst_element_foreach_sink_pad (GST_ELEMENT_CAST (vagg), clean_pad, NULL);
|
||||
}
|
||||
gst_element_foreach_sink_pad (GST_ELEMENT_CAST (vagg), clean_pad, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2189,7 +2185,6 @@ gst_video_aggregator_class_init (GstVideoAggregatorClass * klass)
|
|||
gstelement_class->release_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_video_aggregator_release_pad);
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_VIDEO_AGGREGATOR_PAD;
|
||||
agg_class->start = gst_video_aggregator_start;
|
||||
agg_class->stop = gst_video_aggregator_stop;
|
||||
agg_class->sink_query = gst_video_aggregator_sink_query;
|
||||
|
|
|
@ -562,8 +562,8 @@ gst_audio_interleave_class_init (GstAudioInterleaveClass * klass)
|
|||
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_audio_interleave_src_template);
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_audio_interleave_sink_template);
|
||||
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
|
||||
&gst_audio_interleave_sink_template, GST_TYPE_AUDIO_INTERLEAVE_PAD);
|
||||
gst_element_class_set_static_metadata (gstelement_class, "AudioInterleave",
|
||||
"Generic/Audio", "Mixes multiple audio streams",
|
||||
"Olivier Crete <olivier.crete@collabora.com>");
|
||||
|
@ -573,9 +573,6 @@ gst_audio_interleave_class_init (GstAudioInterleaveClass * klass)
|
|||
gstelement_class->release_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_audio_interleave_release_pad);
|
||||
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_AUDIO_INTERLEAVE_PAD;
|
||||
|
||||
agg_class->sink_query = GST_DEBUG_FUNCPTR (gst_audio_interleave_sink_query);
|
||||
agg_class->sink_event = GST_DEBUG_FUNCPTR (gst_audio_interleave_sink_event);
|
||||
agg_class->stop = gst_audio_interleave_stop;
|
||||
|
|
|
@ -502,8 +502,8 @@ gst_audiomixer_class_init (GstAudioMixerClass * klass)
|
|||
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_audiomixer_src_template);
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_audiomixer_sink_template);
|
||||
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
|
||||
&gst_audiomixer_sink_template, GST_TYPE_AUDIO_MIXER_PAD);
|
||||
gst_element_class_set_static_metadata (gstelement_class, "AudioMixer",
|
||||
"Generic/Audio", "Mixes multiple audio streams",
|
||||
"Sebastian Dröge <sebastian@centricular.com>");
|
||||
|
@ -513,8 +513,6 @@ gst_audiomixer_class_init (GstAudioMixerClass * klass)
|
|||
gstelement_class->release_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_audiomixer_release_pad);
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_AUDIO_MIXER_PAD;
|
||||
|
||||
agg_class->sink_query = GST_DEBUG_FUNCPTR (gst_audiomixer_sink_query);
|
||||
agg_class->sink_event = GST_DEBUG_FUNCPTR (gst_audiomixer_sink_event);
|
||||
agg_class->update_src_caps =
|
||||
|
|
|
@ -1223,7 +1223,6 @@ gst_compositor_class_init (GstCompositorClass * klass)
|
|||
gobject_class->get_property = gst_compositor_get_property;
|
||||
gobject_class->set_property = gst_compositor_set_property;
|
||||
|
||||
agg_class->sinkpads_type = GST_TYPE_COMPOSITOR_PAD;
|
||||
agg_class->sink_query = _sink_query;
|
||||
agg_class->fixate_src_caps = _fixate_caps;
|
||||
agg_class->negotiated_src_caps = _negotiated_caps;
|
||||
|
@ -1235,7 +1234,8 @@ gst_compositor_class_init (GstCompositorClass * klass)
|
|||
DEFAULT_BACKGROUND, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &src_factory);
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
|
||||
&sink_factory, GST_TYPE_COMPOSITOR_PAD);
|
||||
|
||||
gst_element_class_set_static_metadata (gstelement_class, "Compositor",
|
||||
"Filter/Editor/Video/Compositor",
|
||||
|
|
|
@ -169,9 +169,9 @@ gst_mxf_mux_class_init (GstMXFMuxClass * klass)
|
|||
gstaggregator_class->sink_event = GST_DEBUG_FUNCPTR (gst_mxf_mux_sink_event);
|
||||
gstaggregator_class->stop = GST_DEBUG_FUNCPTR (gst_mxf_mux_stop);
|
||||
gstaggregator_class->aggregate = GST_DEBUG_FUNCPTR (gst_mxf_mux_aggregate);
|
||||
gstaggregator_class->sinkpads_type = GST_TYPE_MXF_MUX_PAD;
|
||||
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &src_templ);
|
||||
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
|
||||
&src_templ, GST_TYPE_MXF_MUX_PAD);
|
||||
|
||||
p = mxf_essence_element_writer_get_pad_templates ();
|
||||
while (p && *p) {
|
||||
|
|
Loading…
Reference in a new issue