static void kms_recorder_endpoint_new_media_muxer (KmsRecorderEndpoint * self) { GstBus *bus; kms_recorder_endpoint_create_base_media_muxer (self); g_signal_connect (self->priv->mux, "on-sink-added", G_CALLBACK (kms_recorder_endpoint_on_sink_added), self); kms_recorder_endpoint_update_media_stats (self); bus = kms_base_media_muxer_get_bus (self->priv->mux); gst_bus_set_sync_handler (bus, bus_sync_signal_handler, self, NULL); g_object_unref (bus); if (kms_recording_profile_supports_type (self->priv->profile, KMS_ELEMENT_PAD_TYPE_AUDIO)) { kms_recorder_endpoint_add_appsink (self, KMS_ELEMENT_PAD_TYPE_AUDIO, NULL, AUDIO_STREAM_NAME RECORDER_DEFAULT_SUFFIX, FALSE); } if (kms_recording_profile_supports_type (self->priv->profile, KMS_ELEMENT_PAD_TYPE_VIDEO)) { kms_recorder_endpoint_add_appsink (self, KMS_ELEMENT_PAD_TYPE_VIDEO, NULL, VIDEO_STREAM_NAME RECORDER_DEFAULT_SUFFIX, FALSE); } }
static void kms_recorder_endpoint_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (object); KMS_ELEMENT_LOCK (KMS_ELEMENT (self)); switch (property_id) { case PROP_DVR: self->priv->use_dvr = g_value_get_boolean (value); break; case PROP_PROFILE:{ if (self->priv->profile == KMS_RECORDING_PROFILE_NONE) { self->priv->profile = g_value_get_enum (value); if (self->priv->profile != KMS_RECORDING_PROFILE_NONE) { GstElement *sink; GstBus *bus; sink = kms_recorder_endpoint_create_sink (self); self->priv->mux = kms_muxing_pipeline_new (KMS_MUXING_PIPELINE_PROFILE, self->priv->profile, KMS_MUXING_PIPELINE_SINK, sink, NULL); g_object_unref (sink); bus = kms_muxing_pipeline_get_bus (self->priv->mux); gst_bus_set_sync_handler (bus, bus_sync_signal_handler, self, NULL); g_object_unref (bus); if (kms_recording_profile_supports_type (self->priv->profile, KMS_ELEMENT_PAD_TYPE_AUDIO)) { kms_recorder_endpoint_add_appsink (self, KMS_ELEMENT_PAD_TYPE_AUDIO); } if (kms_recording_profile_supports_type (self->priv->profile, KMS_ELEMENT_PAD_TYPE_VIDEO)) { kms_recorder_endpoint_add_appsink (self, KMS_ELEMENT_PAD_TYPE_VIDEO); } } } else { GST_ERROR_OBJECT (self, "Profile can only be configured once"); } break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self)); }
static gboolean kms_recorder_endpoint_request_new_sink_pad (KmsElement * obj, KmsElementPadType type, const gchar * description, const gchar * name) { KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (obj); KmsUriEndpointState state; KmsSinkPadData *data; gboolean ret = FALSE; KMS_ELEMENT_LOCK (KMS_ELEMENT (self)); ret = self->priv->profile == KMS_RECORDING_PROFILE_KSR; if (!ret) { GST_WARNING_OBJECT (self, "KSR profile not configured"); goto end; } kms_recorder_endpoint_add_appsink (self, type, description, name, TRUE); g_object_get (self, "state", &state, NULL); if (state != KMS_URI_ENDPOINT_STATE_START) { goto end; } data = g_hash_table_lookup (self->priv->sink_pad_data, name); if (data == NULL) { GST_ERROR_OBJECT (self, "Can not create requested pad %s", name); goto end; } connect_sink_func (name, data, self); end: KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self)); return ret; }