static GstElement * kms_recorder_endpoint_create_sink (KmsRecorderEndpoint * self) { gulong *probe_id; GstElement *sink; GstPad *sinkpad; sink = kms_recorder_endpoint_get_sink (self); if (sink == NULL) { sink = gst_element_factory_make ("fakesink", NULL); GST_ELEMENT_ERROR (self, STREAM, WRONG_TYPE, ("No available sink"), (NULL)); return sink; } sinkpad = gst_element_get_static_pad (sink, "sink"); if (sinkpad == NULL) { GST_WARNING ("No sink pad available for element %" GST_PTR_FORMAT, sink); return sink; } probe_id = g_slice_new0 (gulong); *probe_id = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, stop_notification_cb, self, NULL); g_object_set_data_full (G_OBJECT (sinkpad), KEY_RECORDER_PAD_PROBE_ID, probe_id, destroy_ulong); g_object_unref (sinkpad); return sink; }
static void sink_required_cb (KmsConfController * controller, gpointer recorder) { KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (recorder); gulong *probe_id; GstElement *sink; GstPad *sinkpad; sink = kms_recorder_endpoint_get_sink (self); if (sink == NULL) { sink = gst_element_factory_make ("fakesink", NULL); GST_ELEMENT_ERROR (self, STREAM, WRONG_TYPE, ("No available sink"), (NULL)); return; } g_object_set (self->priv->controller, "sink", sink, NULL); sinkpad = gst_element_get_static_pad (sink, "sink"); if (sinkpad == NULL) { GST_WARNING ("No sink pad available for element %" GST_PTR_FORMAT, sink); return; } probe_id = g_slice_new0 (gulong); *probe_id = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, stop_notification_cb, self, NULL); g_object_set_data_full (G_OBJECT (sinkpad), KEY_RECORDER_PAD_PROBE_ID, probe_id, destroy_ulong); g_object_unref (sinkpad); }