static GstPad * kms_element_generate_sink_pad (KmsElement * element, const gchar * name, GstElement ** target, GstPadTemplate * templ) { GstElement *valve = *target; GstPad *sink, *ret_pad; if (valve != NULL) return NULL; valve = gst_element_factory_make ("valve", NULL); *target = valve; g_object_set (valve, "drop", TRUE, NULL); gst_bin_add (GST_BIN (element), valve); gst_element_sync_state_with_parent (valve); if (target == &element->priv->audio_valve) { KMS_ELEMENT_GET_CLASS (element)->audio_valve_added (element, valve); } else { KMS_ELEMENT_GET_CLASS (element)->video_valve_added (element, valve); } sink = gst_element_get_static_pad (valve, "sink"); ret_pad = gst_ghost_pad_new_from_template (name, sink, templ); g_object_unref (sink); return ret_pad; }
static gboolean kms_element_pad_query (GstPad * pad, GstObject * parent, GstQuery * query) { KmsElementClass *klass; KmsElement *element; element = KMS_ELEMENT (parent); klass = KMS_ELEMENT_GET_CLASS (element); return klass->sink_query (element, pad, query); }
static void kms_element_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { KmsElement *self = KMS_ELEMENT (object); switch (property_id) { case PROP_ACCEPT_EOS: KMS_ELEMENT_LOCK (self); self->priv->accept_eos = g_value_get_boolean (value); KMS_ELEMENT_UNLOCK (self); break; case PROP_AUDIO_CAPS: kms_element_endpoint_set_caps (self, gst_value_get_caps (value), &self->priv->audio_caps); break; case PROP_VIDEO_CAPS: kms_element_endpoint_set_caps (self, gst_value_get_caps (value), &self->priv->video_caps); break; case PROP_TARGET_BITRATE: KMS_ELEMENT_LOCK (self); self->priv->target_bitrate = g_value_get_int (value); g_object_set (G_OBJECT (kms_element_get_video_agnosticbin (self)), DEFAULT_BITRATE_, self->priv->target_bitrate, NULL); KMS_ELEMENT_UNLOCK (self); break; case PROP_MEDIA_STATS:{ gboolean enable = g_value_get_boolean (value); KMS_ELEMENT_LOCK (self); if (enable != self->priv->stats_enabled) { self->priv->stats_enabled = enable; KMS_ELEMENT_GET_CLASS (self)->collect_media_stats (self, enable); } KMS_ELEMENT_UNLOCK (self); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }