示例#1
0
static void
gst_dtls_dec_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstDtlsDec *self = GST_DTLS_DEC (object);

  switch (prop_id) {
    case PROP_CONNECTION_ID:
      g_free (self->connection_id);
      self->connection_id = g_value_dup_string (value);
      g_return_if_fail (self->agent);
      create_connection (self, self->connection_id);
      break;
    case PROP_PEM:
      if (self->agent) {
        g_object_unref (self->agent);
      }
      self->agent = get_agent_by_pem (g_value_get_string (value));
      if (self->connection_id) {
        create_connection (self, self->connection_id);
      }
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
  }
}
static void gst_er_dtls_dec_init(GstErDtlsDec *self)
{
    GstPad *sink;
    self->agent = get_agent_by_pem(NULL);
    self->connection_id = NULL;
    self->connection = NULL;
    self->peer_pem = NULL;

    self->decoder_key = NULL;
    self->srtp_cipher = DEFAULT_SRTP_CIPHER;
    self->srtp_auth = DEFAULT_SRTP_AUTH;

    g_mutex_init(&self->src_mutex);

    self->src = NULL;
    sink = gst_pad_new_from_static_template(&sink_template, "sink");
    g_return_if_fail(sink);

    gst_pad_set_chain_function(sink, GST_DEBUG_FUNCPTR(sink_chain));

    gst_element_add_pad(GST_ELEMENT(self), sink);
}