static void gst_frei0r_mixer_init (GstFrei0rMixer * self, GstFrei0rMixerClass * klass) { self->property_cache = gst_frei0r_property_cache_init (klass->properties, klass->n_properties); gst_video_info_init (&self->info); self->collect = gst_collect_pads_new (); gst_collect_pads_set_function (self->collect, (GstCollectPadsFunction) gst_frei0r_mixer_collected, self); gst_collect_pads_set_event_function (self->collect, (GstCollectPadsEventFunction) gst_frei0r_mixer_sink_event, self); gst_collect_pads_set_query_function (self->collect, (GstCollectPadsQueryFunction) gst_frei0r_mixer_sink_query, self); self->src = gst_pad_new_from_template (gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "src"), "src"); gst_pad_set_query_function (self->src, GST_DEBUG_FUNCPTR (gst_frei0r_mixer_src_query)); gst_pad_set_event_function (self->src, GST_DEBUG_FUNCPTR (gst_frei0r_mixer_src_event)); gst_element_add_pad (GST_ELEMENT_CAST (self), self->src); self->sink0 = gst_pad_new_from_template (gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink_0"), "sink_0"); gst_collect_pads_add_pad (self->collect, self->sink0, sizeof (GstCollectData), NULL, TRUE); self->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (self->sink0); gst_element_add_pad (GST_ELEMENT_CAST (self), self->sink0); self->sink1 = gst_pad_new_from_template (gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink_1"), "sink_1"); gst_collect_pads_add_pad (self->collect, self->sink1, sizeof (GstCollectData), NULL, TRUE); gst_element_add_pad (GST_ELEMENT_CAST (self), self->sink1); if (klass->info->plugin_type == F0R_PLUGIN_TYPE_MIXER3) { self->sink2 = gst_pad_new_from_template (gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink_2"), "sink_2"); gst_collect_pads_add_pad (self->collect, self->sink2, sizeof (GstCollectData), NULL, TRUE); gst_element_add_pad (GST_ELEMENT_CAST (self), self->sink2); } }
static void gst_mxf_mux_init (GstMXFMux * mux) { GstCaps *caps; mux->srcpad = gst_pad_new_from_static_template (&src_templ, "src"); gst_pad_set_event_function (mux->srcpad, gst_mxf_mux_handle_src_event); caps = gst_caps_new_empty_simple ("application/mxf"); gst_pad_set_caps (mux->srcpad, caps); gst_caps_unref (caps); gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad); mux->collect = gst_collect_pads_new (); gst_collect_pads_set_event_function (mux->collect, GST_DEBUG_FUNCPTR (gst_mxf_mux_handle_sink_event), mux); gst_collect_pads_set_function (mux->collect, GST_DEBUG_FUNCPTR (gst_mxf_mux_collected), mux); gst_mxf_mux_reset (mux); }
static void gst_smpte_init (GstSMPTE * smpte) { smpte->sinkpad1 = gst_pad_new_from_static_template (&gst_smpte_sink1_template, "sink1"); GST_PAD_SET_PROXY_CAPS (smpte->sinkpad1); gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1); smpte->sinkpad2 = gst_pad_new_from_static_template (&gst_smpte_sink2_template, "sink2"); GST_PAD_SET_PROXY_CAPS (smpte->sinkpad2); gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2); smpte->srcpad = gst_pad_new_from_static_template (&gst_smpte_src_template, "src"); gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad); smpte->collect = gst_collect_pads_new (); gst_collect_pads_set_function (smpte->collect, (GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_smpte_collected), smpte); gst_collect_pads_set_event_function (smpte->collect, GST_DEBUG_FUNCPTR (gst_smpte_sink_event), smpte); gst_collect_pads_add_pad (smpte->collect, smpte->sinkpad1, sizeof (GstCollectData), NULL, TRUE); gst_collect_pads_add_pad (smpte->collect, smpte->sinkpad2, sizeof (GstCollectData), NULL, TRUE); smpte->type = DEFAULT_PROP_TYPE; smpte->border = DEFAULT_PROP_BORDER; smpte->depth = DEFAULT_PROP_DEPTH; smpte->duration = DEFAULT_PROP_DURATION; smpte->invert = DEFAULT_PROP_INVERT; smpte->fps_num = 0; smpte->fps_denom = 1; }
static GstPad * gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps) { GstInterleave *self = GST_INTERLEAVE (element); GstPad *new_pad; gchar *pad_name; gint channels, padnumber; GValue val = { 0, }; if (templ->direction != GST_PAD_SINK) goto not_sink_pad; padnumber = g_atomic_int_add (&self->padcounter, 1); if (self->channel_positions_from_input) channels = g_atomic_int_add (&self->channels, 1); else channels = padnumber; pad_name = g_strdup_printf ("sink_%u", padnumber); new_pad = GST_PAD_CAST (g_object_new (GST_TYPE_INTERLEAVE_PAD, "name", pad_name, "direction", templ->direction, "template", templ, NULL)); GST_INTERLEAVE_PAD_CAST (new_pad)->channel = channels; GST_DEBUG_OBJECT (self, "requested new pad %s", pad_name); g_free (pad_name); gst_pad_use_fixed_caps (new_pad); gst_collect_pads_add_pad (self->collect, new_pad, sizeof (GstCollectData), NULL, TRUE); gst_collect_pads_set_event_function (self->collect, (GstCollectPadsEventFunction) GST_DEBUG_FUNCPTR (gst_interleave_sink_event), self); if (!gst_element_add_pad (element, new_pad)) goto could_not_add; g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION); g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_NONE); self->input_channel_positions = g_value_array_append (self->input_channel_positions, &val); g_value_unset (&val); /* Update the src caps if we already have them */ if (self->sinkcaps) { GstCaps *srccaps; GstStructure *s; /* Take lock to make sure processing finishes first */ GST_OBJECT_LOCK (self->collect); srccaps = gst_caps_copy (self->sinkcaps); s = gst_caps_get_structure (srccaps, 0); gst_structure_set (s, "channels", G_TYPE_INT, self->channels, NULL); gst_interleave_set_channel_positions (self, s); /* FIXME: send caps event after stream-start event */ gst_pad_set_active (self->src, TRUE); gst_pad_set_caps (self->src, srccaps); gst_caps_unref (srccaps); GST_OBJECT_UNLOCK (self->collect); } return new_pad; /* errors */ not_sink_pad: { g_warning ("interleave: requested new pad that is not a SINK pad\n"); return NULL; } could_not_add: { GST_DEBUG_OBJECT (self, "could not add pad %s", GST_PAD_NAME (new_pad)); gst_collect_pads_remove_pad (self->collect, new_pad); gst_object_unref (new_pad); return NULL; } }