mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
dtls: Re-namespace from Er to Gst
This commit is contained in:
parent
1de51fcf02
commit
936fa2f1c4
20 changed files with 620 additions and 643 deletions
|
@ -39,17 +39,17 @@
|
|||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#if ER_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_agent_debug);
|
||||
# define GST_CAT_DEFAULT er_dtls_agent_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (ErDtlsAgent, er_dtls_agent, G_TYPE_OBJECT,
|
||||
GST_DEBUG_CATEGORY_INIT (er_dtls_agent_debug, "gstdtlsagent", 0,
|
||||
"Ericsson DTLS Agent"));
|
||||
#if GST_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_agent_debug);
|
||||
# define GST_CAT_DEFAULT gst_dtls_agent_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsAgent, gst_dtls_agent, G_TYPE_OBJECT,
|
||||
GST_DEBUG_CATEGORY_INIT (gst_dtls_agent_debug, "dtlsagent", 0,
|
||||
"DTLS Agent"));
|
||||
#else
|
||||
G_DEFINE_TYPE (ErDtlsAgent, er_dtls_agent, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (GstDtlsAgent, gst_dtls_agent, G_TYPE_OBJECT);
|
||||
#endif
|
||||
|
||||
#define ER_DTLS_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), ER_TYPE_DTLS_AGENT, ErDtlsAgentPrivate))
|
||||
#define GST_DTLS_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgentPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -60,17 +60,17 @@ enum
|
|||
|
||||
static GParamSpec *properties[NUM_PROPERTIES];
|
||||
|
||||
struct _ErDtlsAgentPrivate
|
||||
struct _GstDtlsAgentPrivate
|
||||
{
|
||||
SSL_CTX *ssl_context;
|
||||
|
||||
ErDtlsCertificate *certificate;
|
||||
GstDtlsCertificate *certificate;
|
||||
};
|
||||
|
||||
static void er_dtls_agent_finalize (GObject * gobject);
|
||||
static void er_dtls_agent_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_agent_finalize (GObject * gobject);
|
||||
static void gst_dtls_agent_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
const gchar *er_dtls_agent_peek_id (ErDtlsAgent *);
|
||||
const gchar *gst_dtls_agent_peek_id (GstDtlsAgent *);
|
||||
|
||||
static GRWLock *ssl_locks;
|
||||
|
||||
|
@ -111,7 +111,7 @@ ssl_thread_id_function (void)
|
|||
}
|
||||
|
||||
void
|
||||
_er_dtls_init_openssl ()
|
||||
_gst_dtls_init_openssl ()
|
||||
{
|
||||
static gsize is_init = 0;
|
||||
gint i;
|
||||
|
@ -142,31 +142,31 @@ _er_dtls_init_openssl ()
|
|||
}
|
||||
|
||||
static void
|
||||
er_dtls_agent_class_init (ErDtlsAgentClass * klass)
|
||||
gst_dtls_agent_class_init (GstDtlsAgentClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ErDtlsAgentPrivate));
|
||||
g_type_class_add_private (klass, sizeof (GstDtlsAgentPrivate));
|
||||
|
||||
gobject_class->set_property = er_dtls_agent_set_property;
|
||||
gobject_class->finalize = er_dtls_agent_finalize;
|
||||
gobject_class->set_property = gst_dtls_agent_set_property;
|
||||
gobject_class->finalize = gst_dtls_agent_finalize;
|
||||
|
||||
properties[PROP_CERTIFICATE] =
|
||||
g_param_spec_object ("certificate",
|
||||
"ErDtlsCertificate",
|
||||
"GstDtlsCertificate",
|
||||
"Sets the certificate of the agent",
|
||||
ER_TYPE_DTLS_CERTIFICATE,
|
||||
GST_TYPE_DTLS_CERTIFICATE,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
|
||||
_er_dtls_init_openssl ();
|
||||
_gst_dtls_init_openssl ();
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_agent_init (ErDtlsAgent * self)
|
||||
gst_dtls_agent_init (GstDtlsAgent * self)
|
||||
{
|
||||
ErDtlsAgentPrivate *priv = ER_DTLS_AGENT_GET_PRIVATE (self);
|
||||
GstDtlsAgentPrivate *priv = GST_DTLS_AGENT_GET_PRIVATE (self);
|
||||
self->priv = priv;
|
||||
|
||||
ERR_clear_error ();
|
||||
|
@ -194,42 +194,42 @@ er_dtls_agent_init (ErDtlsAgent * self)
|
|||
}
|
||||
|
||||
static void
|
||||
er_dtls_agent_finalize (GObject * gobject)
|
||||
gst_dtls_agent_finalize (GObject * gobject)
|
||||
{
|
||||
ErDtlsAgentPrivate *priv = ER_DTLS_AGENT (gobject)->priv;
|
||||
GstDtlsAgentPrivate *priv = GST_DTLS_AGENT (gobject)->priv;
|
||||
|
||||
SSL_CTX_free (priv->ssl_context);
|
||||
priv->ssl_context = NULL;
|
||||
|
||||
LOG_DEBUG (gobject, "finalized");
|
||||
|
||||
G_OBJECT_CLASS (er_dtls_agent_parent_class)->finalize (gobject);
|
||||
G_OBJECT_CLASS (gst_dtls_agent_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_agent_set_property (GObject * object, guint prop_id,
|
||||
gst_dtls_agent_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
ErDtlsAgent *self = ER_DTLS_AGENT (object);
|
||||
ErDtlsCertificate *certificate;
|
||||
GstDtlsAgent *self = GST_DTLS_AGENT (object);
|
||||
GstDtlsCertificate *certificate;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CERTIFICATE:
|
||||
certificate = ER_DTLS_CERTIFICATE (g_value_get_object (value));
|
||||
g_return_if_fail (ER_IS_DTLS_CERTIFICATE (certificate));
|
||||
certificate = GST_DTLS_CERTIFICATE (g_value_get_object (value));
|
||||
g_return_if_fail (GST_IS_DTLS_CERTIFICATE (certificate));
|
||||
g_return_if_fail (self->priv->ssl_context);
|
||||
|
||||
self->priv->certificate = certificate;
|
||||
g_object_ref (certificate);
|
||||
|
||||
if (!SSL_CTX_use_certificate (self->priv->ssl_context,
|
||||
_er_dtls_certificate_get_internal_certificate (certificate))) {
|
||||
_gst_dtls_certificate_get_internal_certificate (certificate))) {
|
||||
LOG_WARNING (self, "could not use certificate");
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
if (!SSL_CTX_use_PrivateKey (self->priv->ssl_context,
|
||||
_er_dtls_certificate_get_internal_key (certificate))) {
|
||||
_gst_dtls_certificate_get_internal_key (certificate))) {
|
||||
LOG_WARNING (self, "could not use private key");
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
@ -244,10 +244,10 @@ er_dtls_agent_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
ErDtlsCertificate *
|
||||
er_dtls_agent_get_certificate (ErDtlsAgent * self)
|
||||
GstDtlsCertificate *
|
||||
gst_dtls_agent_get_certificate (GstDtlsAgent * self)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_AGENT (self), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
|
||||
if (self->priv->certificate) {
|
||||
g_object_ref (self->priv->certificate);
|
||||
}
|
||||
|
@ -255,20 +255,21 @@ er_dtls_agent_get_certificate (ErDtlsAgent * self)
|
|||
}
|
||||
|
||||
gchar *
|
||||
er_dtls_agent_get_certificate_pem (ErDtlsAgent * self)
|
||||
gst_dtls_agent_get_certificate_pem (GstDtlsAgent * self)
|
||||
{
|
||||
gchar *pem;
|
||||
g_return_val_if_fail (ER_IS_DTLS_AGENT (self), NULL);
|
||||
g_return_val_if_fail (ER_IS_DTLS_CERTIFICATE (self->priv->certificate), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self->priv->certificate),
|
||||
NULL);
|
||||
|
||||
g_object_get (self->priv->certificate, "pem", &pem, NULL);
|
||||
|
||||
return pem;
|
||||
}
|
||||
|
||||
const ErDtlsAgentContext
|
||||
_er_dtls_agent_peek_context (ErDtlsAgent * self)
|
||||
const GstDtlsAgentContext
|
||||
_gst_dtls_agent_peek_context (GstDtlsAgent * self)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_AGENT (self), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
|
||||
return self->priv->ssl_context;
|
||||
}
|
||||
|
|
|
@ -32,50 +32,50 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define ER_TYPE_DTLS_AGENT (er_dtls_agent_get_type())
|
||||
#define ER_DTLS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ER_TYPE_DTLS_AGENT, ErDtlsAgent))
|
||||
#define ER_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ER_TYPE_DTLS_AGENT, ErDtlsAgentClass))
|
||||
#define ER_IS_DTLS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ER_TYPE_DTLS_AGENT))
|
||||
#define ER_IS_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ER_TYPE_DTLS_AGENT))
|
||||
#define ER_DTLS_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ER_TYPE_DTLS_AGENT, ErDtlsAgentClass))
|
||||
#define GST_TYPE_DTLS_AGENT (gst_dtls_agent_get_type())
|
||||
#define GST_DTLS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgent))
|
||||
#define GST_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
|
||||
#define GST_IS_DTLS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_AGENT))
|
||||
#define GST_IS_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_AGENT))
|
||||
#define GST_DTLS_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
|
||||
|
||||
typedef gpointer ErDtlsAgentContext;
|
||||
typedef gpointer GstDtlsAgentContext;
|
||||
|
||||
typedef struct _ErDtlsAgent ErDtlsAgent;
|
||||
typedef struct _ErDtlsAgentClass ErDtlsAgentClass;
|
||||
typedef struct _ErDtlsAgentPrivate ErDtlsAgentPrivate;
|
||||
typedef struct _GstDtlsAgent GstDtlsAgent;
|
||||
typedef struct _GstDtlsAgentClass GstDtlsAgentClass;
|
||||
typedef struct _GstDtlsAgentPrivate GstDtlsAgentPrivate;
|
||||
|
||||
/*
|
||||
* ErDtlsAgent:
|
||||
* GstDtlsAgent:
|
||||
*
|
||||
* A context for creating ErDtlsConnections with a ErDtlsCertificate.
|
||||
* ErDtlsAgent needs to be constructed with the "certificate" property set.
|
||||
* A context for creating GstDtlsConnections with a GstDtlsCertificate.
|
||||
* GstDtlsAgent needs to be constructed with the "certificate" property set.
|
||||
*/
|
||||
struct _ErDtlsAgent {
|
||||
struct _GstDtlsAgent {
|
||||
GObject parent_instance;
|
||||
|
||||
ErDtlsAgentPrivate *priv;
|
||||
GstDtlsAgentPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ErDtlsAgentClass {
|
||||
struct _GstDtlsAgentClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType er_dtls_agent_get_type(void) G_GNUC_CONST;
|
||||
GType gst_dtls_agent_get_type(void) G_GNUC_CONST;
|
||||
|
||||
/*
|
||||
* Returns the certificate used by the agent.
|
||||
*/
|
||||
ErDtlsCertificate *er_dtls_agent_get_certificate(ErDtlsAgent *);
|
||||
GstDtlsCertificate *gst_dtls_agent_get_certificate(GstDtlsAgent *);
|
||||
|
||||
/*
|
||||
* Returns the certificate used by the agent, in PEM format.
|
||||
*/
|
||||
gchar *er_dtls_agent_get_certificate_pem(ErDtlsAgent *self);
|
||||
gchar *gst_dtls_agent_get_certificate_pem(GstDtlsAgent *self);
|
||||
|
||||
/* internal */
|
||||
void _er_dtls_init_openssl(void);
|
||||
const ErDtlsAgentContext _er_dtls_agent_peek_context(ErDtlsAgent *);
|
||||
void _gst_dtls_init_openssl(void);
|
||||
const GstDtlsAgentContext _gst_dtls_agent_peek_context(GstDtlsAgent *);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -39,17 +39,17 @@
|
|||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#if ER_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_certificate_debug);
|
||||
# define GST_CAT_DEFAULT er_dtls_certificate_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (ErDtlsCertificate, er_dtls_certificate, G_TYPE_OBJECT,
|
||||
GST_DEBUG_CATEGORY_INIT (er_dtls_certificate_debug, "gstdtlscertificate", 0,
|
||||
"Ericsson DTLS Certificate"));
|
||||
#if GST_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_certificate_debug);
|
||||
# define GST_CAT_DEFAULT gst_dtls_certificate_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsCertificate, gst_dtls_certificate,
|
||||
G_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (gst_dtls_certificate_debug,
|
||||
"dtlscertificate", 0, "DTLS Certificate"));
|
||||
#else
|
||||
G_DEFINE_TYPE (ErDtlsCertificate, er_dtls_certificate, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (GstDtlsCertificate, gst_dtls_certificate, G_TYPE_OBJECT);
|
||||
#endif
|
||||
|
||||
#define ER_DTLS_CERTIFICATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), ER_TYPE_DTLS_CERTIFICATE, ErDtlsCertificatePrivate))
|
||||
#define GST_DTLS_CERTIFICATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificatePrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
|
||||
#define DEFAULT_PEM NULL
|
||||
|
||||
struct _ErDtlsCertificatePrivate
|
||||
struct _GstDtlsCertificatePrivate
|
||||
{
|
||||
X509 *x509;
|
||||
EVP_PKEY *private_key;
|
||||
|
@ -70,24 +70,24 @@ struct _ErDtlsCertificatePrivate
|
|||
gchar *pem;
|
||||
};
|
||||
|
||||
static void er_dtls_certificate_finalize (GObject * gobject);
|
||||
static void er_dtls_certificate_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_certificate_finalize (GObject * gobject);
|
||||
static void gst_dtls_certificate_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void er_dtls_certificate_get_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_certificate_get_property (GObject *, guint prop_id,
|
||||
GValue *, GParamSpec *);
|
||||
|
||||
static void init_generated (ErDtlsCertificate *);
|
||||
static void init_from_pem_string (ErDtlsCertificate *, const gchar * pem);
|
||||
static void init_generated (GstDtlsCertificate *);
|
||||
static void init_from_pem_string (GstDtlsCertificate *, const gchar * pem);
|
||||
|
||||
static void
|
||||
er_dtls_certificate_class_init (ErDtlsCertificateClass * klass)
|
||||
gst_dtls_certificate_class_init (GstDtlsCertificateClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ErDtlsCertificatePrivate));
|
||||
g_type_class_add_private (klass, sizeof (GstDtlsCertificatePrivate));
|
||||
|
||||
gobject_class->set_property = er_dtls_certificate_set_property;
|
||||
gobject_class->get_property = er_dtls_certificate_get_property;
|
||||
gobject_class->set_property = gst_dtls_certificate_set_property;
|
||||
gobject_class->get_property = gst_dtls_certificate_get_property;
|
||||
|
||||
properties[PROP_PEM] =
|
||||
g_param_spec_string ("pem",
|
||||
|
@ -98,15 +98,15 @@ er_dtls_certificate_class_init (ErDtlsCertificateClass * klass)
|
|||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
|
||||
_er_dtls_init_openssl ();
|
||||
_gst_dtls_init_openssl ();
|
||||
|
||||
gobject_class->finalize = er_dtls_certificate_finalize;
|
||||
gobject_class->finalize = gst_dtls_certificate_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_certificate_init (ErDtlsCertificate * self)
|
||||
gst_dtls_certificate_init (GstDtlsCertificate * self)
|
||||
{
|
||||
ErDtlsCertificatePrivate *priv = ER_DTLS_CERTIFICATE_GET_PRIVATE (self);
|
||||
GstDtlsCertificatePrivate *priv = GST_DTLS_CERTIFICATE_GET_PRIVATE (self);
|
||||
self->priv = priv;
|
||||
|
||||
priv->x509 = NULL;
|
||||
|
@ -115,9 +115,9 @@ er_dtls_certificate_init (ErDtlsCertificate * self)
|
|||
}
|
||||
|
||||
static void
|
||||
er_dtls_certificate_finalize (GObject * gobject)
|
||||
gst_dtls_certificate_finalize (GObject * gobject)
|
||||
{
|
||||
ErDtlsCertificatePrivate *priv = ER_DTLS_CERTIFICATE (gobject)->priv;
|
||||
GstDtlsCertificatePrivate *priv = GST_DTLS_CERTIFICATE (gobject)->priv;
|
||||
|
||||
X509_free (priv->x509);
|
||||
priv->x509 = NULL;
|
||||
|
@ -129,14 +129,14 @@ er_dtls_certificate_finalize (GObject * gobject)
|
|||
g_free (priv->pem);
|
||||
priv->pem = NULL;
|
||||
|
||||
G_OBJECT_CLASS (er_dtls_certificate_parent_class)->finalize (gobject);
|
||||
G_OBJECT_CLASS (gst_dtls_certificate_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_certificate_set_property (GObject * object, guint prop_id,
|
||||
gst_dtls_certificate_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
ErDtlsCertificate *self = ER_DTLS_CERTIFICATE (object);
|
||||
GstDtlsCertificate *self = GST_DTLS_CERTIFICATE (object);
|
||||
const gchar *pem;
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -154,10 +154,10 @@ er_dtls_certificate_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
er_dtls_certificate_get_property (GObject * object, guint prop_id,
|
||||
gst_dtls_certificate_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
ErDtlsCertificate *self = ER_DTLS_CERTIFICATE (object);
|
||||
GstDtlsCertificate *self = GST_DTLS_CERTIFICATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PEM:
|
||||
|
@ -170,9 +170,9 @@ er_dtls_certificate_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
init_generated (ErDtlsCertificate * self)
|
||||
init_generated (GstDtlsCertificate * self)
|
||||
{
|
||||
ErDtlsCertificatePrivate *priv = self->priv;
|
||||
GstDtlsCertificatePrivate *priv = self->priv;
|
||||
RSA *rsa;
|
||||
X509_NAME *name = NULL;
|
||||
|
||||
|
@ -240,13 +240,13 @@ init_generated (ErDtlsCertificate * self)
|
|||
return;
|
||||
}
|
||||
|
||||
self->priv->pem = _er_dtls_x509_to_pem (priv->x509);
|
||||
self->priv->pem = _gst_dtls_x509_to_pem (priv->x509);
|
||||
}
|
||||
|
||||
static void
|
||||
init_from_pem_string (ErDtlsCertificate * self, const gchar * pem)
|
||||
init_from_pem_string (GstDtlsCertificate * self, const gchar * pem)
|
||||
{
|
||||
ErDtlsCertificatePrivate *priv = self->priv;
|
||||
GstDtlsCertificatePrivate *priv = self->priv;
|
||||
BIO *bio;
|
||||
|
||||
g_return_if_fail (pem);
|
||||
|
@ -281,11 +281,11 @@ init_from_pem_string (ErDtlsCertificate * self, const gchar * pem)
|
|||
}
|
||||
|
||||
gchar *
|
||||
_er_dtls_x509_to_pem (gpointer x509)
|
||||
_gst_dtls_x509_to_pem (gpointer x509)
|
||||
{
|
||||
#define ER_DTLS_BIO_BUFFER_SIZE 4096
|
||||
#define GST_DTLS_BIO_BUFFER_SIZE 4096
|
||||
BIO *bio;
|
||||
gchar buffer[ER_DTLS_BIO_BUFFER_SIZE] = { 0 };
|
||||
gchar buffer[GST_DTLS_BIO_BUFFER_SIZE] = { 0 };
|
||||
gint len;
|
||||
gchar *pem = NULL;
|
||||
|
||||
|
@ -297,7 +297,7 @@ _er_dtls_x509_to_pem (gpointer x509)
|
|||
goto beach;
|
||||
}
|
||||
|
||||
len = BIO_read (bio, buffer, ER_DTLS_BIO_BUFFER_SIZE);
|
||||
len = BIO_read (bio, buffer, GST_DTLS_BIO_BUFFER_SIZE);
|
||||
if (!len) {
|
||||
g_warn_if_reached ();
|
||||
goto beach;
|
||||
|
@ -311,16 +311,16 @@ beach:
|
|||
return pem;
|
||||
}
|
||||
|
||||
ErDtlsCertificateInternalCertificate
|
||||
_er_dtls_certificate_get_internal_certificate (ErDtlsCertificate * self)
|
||||
GstDtlsCertificateInternalCertificate
|
||||
_gst_dtls_certificate_get_internal_certificate (GstDtlsCertificate * self)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_CERTIFICATE (self), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self), NULL);
|
||||
return self->priv->x509;
|
||||
}
|
||||
|
||||
ErDtlsCertificateInternalKey
|
||||
_er_dtls_certificate_get_internal_key (ErDtlsCertificate * self)
|
||||
GstDtlsCertificateInternalKey
|
||||
_gst_dtls_certificate_get_internal_key (GstDtlsCertificate * self)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_CERTIFICATE (self), NULL);
|
||||
g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self), NULL);
|
||||
return self->priv->private_key;
|
||||
}
|
||||
|
|
|
@ -30,42 +30,42 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define ER_TYPE_DTLS_CERTIFICATE (er_dtls_certificate_get_type())
|
||||
#define ER_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ER_TYPE_DTLS_CERTIFICATE, ErDtlsCertificate))
|
||||
#define ER_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ER_TYPE_DTLS_CERTIFICATE, ErDtlsCertificateClass))
|
||||
#define ER_IS_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ER_TYPE_DTLS_CERTIFICATE))
|
||||
#define ER_IS_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ER_TYPE_DTLS_CERTIFICATE))
|
||||
#define ER_DTLS_CERTIFICATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ER_TYPE_DTLS_CERTIFICATE, ErDtlsCertificateClass))
|
||||
#define GST_TYPE_DTLS_CERTIFICATE (gst_dtls_certificate_get_type())
|
||||
#define GST_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificate))
|
||||
#define GST_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass))
|
||||
#define GST_IS_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_CERTIFICATE))
|
||||
#define GST_IS_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_CERTIFICATE))
|
||||
#define GST_DTLS_CERTIFICATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass))
|
||||
|
||||
typedef gpointer ErDtlsCertificateInternalCertificate;
|
||||
typedef gpointer ErDtlsCertificateInternalKey;
|
||||
typedef gpointer GstDtlsCertificateInternalCertificate;
|
||||
typedef gpointer GstDtlsCertificateInternalKey;
|
||||
|
||||
typedef struct _ErDtlsCertificate ErDtlsCertificate;
|
||||
typedef struct _ErDtlsCertificateClass ErDtlsCertificateClass;
|
||||
typedef struct _ErDtlsCertificatePrivate ErDtlsCertificatePrivate;
|
||||
typedef struct _GstDtlsCertificate GstDtlsCertificate;
|
||||
typedef struct _GstDtlsCertificateClass GstDtlsCertificateClass;
|
||||
typedef struct _GstDtlsCertificatePrivate GstDtlsCertificatePrivate;
|
||||
|
||||
/*
|
||||
* ErDtlsCertificate:
|
||||
* GstDtlsCertificate:
|
||||
*
|
||||
* Handles a X509 certificate and a private key.
|
||||
* If a certificate is created without the "pem" property, a self-signed certificate is generated.
|
||||
*/
|
||||
struct _ErDtlsCertificate {
|
||||
struct _GstDtlsCertificate {
|
||||
GObject parent_instance;
|
||||
|
||||
ErDtlsCertificatePrivate *priv;
|
||||
GstDtlsCertificatePrivate *priv;
|
||||
};
|
||||
|
||||
struct _ErDtlsCertificateClass {
|
||||
struct _GstDtlsCertificateClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType er_dtls_certificate_get_type(void) G_GNUC_CONST;
|
||||
GType gst_dtls_certificate_get_type(void) G_GNUC_CONST;
|
||||
|
||||
/* internal */
|
||||
ErDtlsCertificateInternalCertificate _er_dtls_certificate_get_internal_certificate(ErDtlsCertificate *);
|
||||
ErDtlsCertificateInternalKey _er_dtls_certificate_get_internal_key(ErDtlsCertificate *);
|
||||
gchar *_er_dtls_x509_to_pem(gpointer x509);
|
||||
GstDtlsCertificateInternalCertificate _gst_dtls_certificate_get_internal_certificate(GstDtlsCertificate *);
|
||||
GstDtlsCertificateInternalKey _gst_dtls_certificate_get_internal_key(GstDtlsCertificate *);
|
||||
gchar *_gst_dtls_x509_to_pem(gpointer x509);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#ifndef gstdtlscommon_h
|
||||
#define gstdtlscommon_h
|
||||
|
||||
#ifndef ER_DTLS_USE_GST_LOG
|
||||
# define ER_DTLS_USE_GST_LOG 0
|
||||
#ifndef GST_DTLS_USE_GST_LOG
|
||||
# define GST_DTLS_USE_GST_LOG 0
|
||||
#endif
|
||||
|
||||
#if ER_DTLS_USE_GST_LOG
|
||||
#if GST_DTLS_USE_GST_LOG
|
||||
# include <gst/gst.h>
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define UNUSED(param) while (0) { (void)(param); }
|
||||
|
||||
#if ER_DTLS_USE_GST_LOG
|
||||
#if GST_DTLS_USE_GST_LOG
|
||||
# define LOG_ERROR(obj, ...) GST_ERROR_OBJECT(obj, __VA_ARGS__ )
|
||||
# define LOG_WARNING(obj, ...) GST_WARNING_OBJECT(obj, __VA_ARGS__ )
|
||||
# define LOG_FIXME(obj, ...) GST_FIXME_OBJECT(obj, __VA_ARGS__ )
|
||||
|
|
|
@ -41,17 +41,17 @@
|
|||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#if ER_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_connection_debug);
|
||||
# define GST_CAT_DEFAULT er_dtls_connection_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (ErDtlsConnection, er_dtls_connection, G_TYPE_OBJECT,
|
||||
GST_DEBUG_CATEGORY_INIT (er_dtls_connection_debug, "gstdtlsconnection", 0,
|
||||
"Ericsson DTLS Connection"));
|
||||
#if GST_DTLS_USE_GST_LOG
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug);
|
||||
# define GST_CAT_DEFAULT gst_dtls_connection_debug
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsConnection, gst_dtls_connection, G_TYPE_OBJECT,
|
||||
GST_DEBUG_CATEGORY_INIT (gst_dtls_connection_debug, "dtlsconnection", 0,
|
||||
"DTLS Connection"));
|
||||
#else
|
||||
G_DEFINE_TYPE (ErDtlsConnection, er_dtls_connection, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (GstDtlsConnection, gst_dtls_connection, G_TYPE_OBJECT);
|
||||
#endif
|
||||
|
||||
#define ER_DTLS_CONNECTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), ER_TYPE_DTLS_CONNECTION, ErDtlsConnectionPrivate))
|
||||
#define GST_DTLS_CONNECTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionPrivate))
|
||||
|
||||
#define SRTP_KEY_LEN 16
|
||||
#define SRTP_SALT_LEN 14
|
||||
|
@ -77,7 +77,7 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
|
||||
static int connection_ex_index;
|
||||
|
||||
struct _ErDtlsConnectionPrivate
|
||||
struct _GstDtlsConnectionPrivate
|
||||
{
|
||||
SSL *ssl;
|
||||
BIO *bio;
|
||||
|
@ -97,18 +97,18 @@ struct _ErDtlsConnectionPrivate
|
|||
GClosure *send_closure;
|
||||
};
|
||||
|
||||
static void er_dtls_connection_finalize (GObject * gobject);
|
||||
static void er_dtls_connection_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_connection_finalize (GObject * gobject);
|
||||
static void gst_dtls_connection_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
|
||||
static void log_state (ErDtlsConnection *, const gchar * str);
|
||||
static gpointer connection_timeout_thread_func (ErDtlsConnection *);
|
||||
static void export_srtp_keys (ErDtlsConnection *);
|
||||
static void openssl_poll (ErDtlsConnection *);
|
||||
static void log_state (GstDtlsConnection *, const gchar * str);
|
||||
static gpointer connection_timeout_thread_func (GstDtlsConnection *);
|
||||
static void export_srtp_keys (GstDtlsConnection *);
|
||||
static void openssl_poll (GstDtlsConnection *);
|
||||
static int openssl_verify_callback (int preverify_ok,
|
||||
X509_STORE_CTX * x509_ctx);
|
||||
|
||||
static BIO_METHOD *BIO_s_er_dtls_connection ();
|
||||
static BIO_METHOD *BIO_s_gst_dtls_connection ();
|
||||
static int bio_method_write (BIO *, const char *data, int size);
|
||||
static int bio_method_read (BIO *, char *out_buffer, int size);
|
||||
static long bio_method_ctrl (BIO *, int cmd, long arg1, void *arg2);
|
||||
|
@ -116,13 +116,13 @@ static int bio_method_new (BIO *);
|
|||
static int bio_method_free (BIO *);
|
||||
|
||||
static void
|
||||
er_dtls_connection_class_init (ErDtlsConnectionClass * klass)
|
||||
gst_dtls_connection_class_init (GstDtlsConnectionClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ErDtlsConnectionPrivate));
|
||||
g_type_class_add_private (klass, sizeof (GstDtlsConnectionPrivate));
|
||||
|
||||
gobject_class->set_property = er_dtls_connection_set_property;
|
||||
gobject_class->set_property = gst_dtls_connection_set_property;
|
||||
|
||||
connection_ex_index =
|
||||
SSL_get_ex_new_index (0, (gpointer) "gstdtlsagent connection index", NULL,
|
||||
|
@ -147,22 +147,22 @@ er_dtls_connection_class_init (ErDtlsConnectionClass * klass)
|
|||
|
||||
properties[PROP_AGENT] =
|
||||
g_param_spec_object ("agent",
|
||||
"ERDtlsAgent",
|
||||
"DTLS Agent",
|
||||
"Agent to use in creation of the connection",
|
||||
ER_TYPE_DTLS_AGENT,
|
||||
GST_TYPE_DTLS_AGENT,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
|
||||
_er_dtls_init_openssl ();
|
||||
_gst_dtls_init_openssl ();
|
||||
|
||||
gobject_class->finalize = er_dtls_connection_finalize;
|
||||
gobject_class->finalize = gst_dtls_connection_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_connection_init (ErDtlsConnection * self)
|
||||
gst_dtls_connection_init (GstDtlsConnection * self)
|
||||
{
|
||||
ErDtlsConnectionPrivate *priv = ER_DTLS_CONNECTION_GET_PRIVATE (self);
|
||||
GstDtlsConnectionPrivate *priv = GST_DTLS_CONNECTION_GET_PRIVATE (self);
|
||||
self->priv = priv;
|
||||
|
||||
priv->ssl = NULL;
|
||||
|
@ -185,10 +185,10 @@ er_dtls_connection_init (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
static void
|
||||
er_dtls_connection_finalize (GObject * gobject)
|
||||
gst_dtls_connection_finalize (GObject * gobject)
|
||||
{
|
||||
ErDtlsConnection *self = ER_DTLS_CONNECTION (gobject);
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnection *self = GST_DTLS_CONNECTION (gobject);
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
|
||||
|
||||
SSL_free (priv->ssl);
|
||||
|
@ -204,30 +204,30 @@ er_dtls_connection_finalize (GObject * gobject)
|
|||
|
||||
LOG_DEBUG (self, "finalized");
|
||||
|
||||
G_OBJECT_CLASS (er_dtls_connection_parent_class)->finalize (gobject);
|
||||
G_OBJECT_CLASS (gst_dtls_connection_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
er_dtls_connection_set_property (GObject * object, guint prop_id,
|
||||
gst_dtls_connection_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
ErDtlsConnection *self = ER_DTLS_CONNECTION (object);
|
||||
ErDtlsAgent *agent;
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnection *self = GST_DTLS_CONNECTION (object);
|
||||
GstDtlsAgent *agent;
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
SSL_CTX *ssl_context;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_AGENT:
|
||||
g_return_if_fail (!priv->ssl);
|
||||
agent = ER_DTLS_AGENT (g_value_get_object (value));
|
||||
g_return_if_fail (ER_IS_DTLS_AGENT (agent));
|
||||
agent = GST_DTLS_AGENT (g_value_get_object (value));
|
||||
g_return_if_fail (GST_IS_DTLS_AGENT (agent));
|
||||
|
||||
ssl_context = _er_dtls_agent_peek_context (agent);
|
||||
ssl_context = _gst_dtls_agent_peek_context (agent);
|
||||
|
||||
priv->ssl = SSL_new (ssl_context);
|
||||
g_return_if_fail (priv->ssl);
|
||||
|
||||
priv->bio = BIO_new (BIO_s_er_dtls_connection ());
|
||||
priv->bio = BIO_new (BIO_s_gst_dtls_connection ());
|
||||
g_return_if_fail (priv->bio);
|
||||
|
||||
priv->bio->ptr = self;
|
||||
|
@ -246,10 +246,10 @@ er_dtls_connection_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
void
|
||||
er_dtls_connection_start (ErDtlsConnection * self, gboolean is_client)
|
||||
gst_dtls_connection_start (GstDtlsConnection * self, gboolean is_client)
|
||||
{
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (self));
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
g_return_if_fail (priv->send_closure);
|
||||
g_return_if_fail (priv->ssl);
|
||||
g_return_if_fail (priv->bio);
|
||||
|
@ -283,11 +283,11 @@ er_dtls_connection_start (ErDtlsConnection * self, gboolean is_client)
|
|||
}
|
||||
|
||||
void
|
||||
er_dtls_connection_start_timeout (ErDtlsConnection * self)
|
||||
gst_dtls_connection_start_timeout (GstDtlsConnection * self)
|
||||
{
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
|
||||
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
GError *error = NULL;
|
||||
gchar *thread_name = g_strdup_printf ("connection_thread_%p", self);
|
||||
|
||||
|
@ -311,9 +311,9 @@ er_dtls_connection_start_timeout (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
void
|
||||
er_dtls_connection_stop (ErDtlsConnection * self)
|
||||
gst_dtls_connection_stop (GstDtlsConnection * self)
|
||||
{
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (self->priv->ssl);
|
||||
g_return_if_fail (self->priv->bio);
|
||||
|
||||
|
@ -335,9 +335,9 @@ er_dtls_connection_stop (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
void
|
||||
er_dtls_connection_close (ErDtlsConnection * self)
|
||||
gst_dtls_connection_close (GstDtlsConnection * self)
|
||||
{
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (self->priv->ssl);
|
||||
g_return_if_fail (self->priv->bio);
|
||||
|
||||
|
@ -364,10 +364,10 @@ er_dtls_connection_close (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
void
|
||||
er_dtls_connection_set_send_callback (ErDtlsConnection * self,
|
||||
gst_dtls_connection_set_send_callback (GstDtlsConnection * self,
|
||||
GClosure * closure)
|
||||
{
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (self));
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
|
||||
|
||||
LOG_TRACE (self, "locking @ set_send_callback");
|
||||
g_mutex_lock (&self->priv->mutex);
|
||||
|
@ -384,10 +384,10 @@ er_dtls_connection_set_send_callback (ErDtlsConnection * self,
|
|||
}
|
||||
|
||||
gint
|
||||
er_dtls_connection_process (ErDtlsConnection * self, gpointer data, gint len)
|
||||
gst_dtls_connection_process (GstDtlsConnection * self, gpointer data, gint len)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_CONNECTION (self), 0);
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), 0);
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
gint result;
|
||||
|
||||
g_return_val_if_fail (self->priv->ssl, 0);
|
||||
|
@ -427,9 +427,9 @@ er_dtls_connection_process (ErDtlsConnection * self, gpointer data, gint len)
|
|||
}
|
||||
|
||||
gint
|
||||
er_dtls_connection_send (ErDtlsConnection * self, gpointer data, gint len)
|
||||
gst_dtls_connection_send (GstDtlsConnection * self, gpointer data, gint len)
|
||||
{
|
||||
g_return_val_if_fail (ER_IS_DTLS_CONNECTION (self), 0);
|
||||
g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), 0);
|
||||
int ret = 0;
|
||||
|
||||
g_return_val_if_fail (self->priv->ssl, 0);
|
||||
|
@ -464,9 +464,9 @@ er_dtls_connection_send (ErDtlsConnection * self, gpointer data, gint len)
|
|||
*/
|
||||
|
||||
static void
|
||||
log_state (ErDtlsConnection * self, const gchar * str)
|
||||
log_state (GstDtlsConnection * self, const gchar * str)
|
||||
{
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
guint states = 0;
|
||||
|
||||
states |= (! !SSL_is_init_finished (priv->ssl) << 0);
|
||||
|
@ -488,9 +488,9 @@ log_state (ErDtlsConnection * self, const gchar * str)
|
|||
}
|
||||
|
||||
static gpointer
|
||||
connection_timeout_thread_func (ErDtlsConnection * self)
|
||||
connection_timeout_thread_func (GstDtlsConnection * self)
|
||||
{
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
struct timeval timeout;
|
||||
gint64 end_time, wait_time;
|
||||
gint ret;
|
||||
|
@ -551,7 +551,7 @@ connection_timeout_thread_func (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
static void
|
||||
export_srtp_keys (ErDtlsConnection * self)
|
||||
export_srtp_keys (GstDtlsConnection * self)
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
|
@ -566,20 +566,20 @@ export_srtp_keys (ErDtlsConnection * self)
|
|||
struct
|
||||
{
|
||||
Key client_key;
|
||||
Key server_key;
|
||||
Key servgst_key;
|
||||
Salt client_salt;
|
||||
Salt server_salt;
|
||||
Salt servgst_salt;
|
||||
} exported_keys;
|
||||
|
||||
struct
|
||||
{
|
||||
Key key;
|
||||
Salt salt;
|
||||
} client_key, server_key;
|
||||
} client_key, servgst_key;
|
||||
|
||||
SRTP_PROTECTION_PROFILE *profile;
|
||||
ErDtlsSrtpCipher cipher;
|
||||
ErDtlsSrtpAuth auth;
|
||||
GstDtlsSrtpCipher cipher;
|
||||
GstDtlsSrtpAuth auth;
|
||||
gint success;
|
||||
|
||||
static gchar export_string[] = "EXTRACTOR-dtls_srtp";
|
||||
|
@ -599,12 +599,12 @@ export_srtp_keys (ErDtlsConnection * self)
|
|||
|
||||
switch (profile->id) {
|
||||
case SRTP_AES128_CM_SHA1_80:
|
||||
cipher = ER_DTLS_SRTP_CIPHER_AES_128_ICM;
|
||||
auth = ER_DTLS_SRTP_AUTH_HMAC_SHA1_80;
|
||||
cipher = GST_DTLS_SRTP_CIPHER_AES_128_ICM;
|
||||
auth = GST_DTLS_SRTP_AUTH_HMAC_SHA1_80;
|
||||
break;
|
||||
case SRTP_AES128_CM_SHA1_32:
|
||||
cipher = ER_DTLS_SRTP_CIPHER_AES_128_ICM;
|
||||
auth = ER_DTLS_SRTP_AUTH_HMAC_SHA1_32;
|
||||
cipher = GST_DTLS_SRTP_CIPHER_AES_128_ICM;
|
||||
auth = GST_DTLS_SRTP_AUTH_HMAC_SHA1_32;
|
||||
break;
|
||||
default:
|
||||
LOG_WARNING (self, "invalid crypto suite set by handshake");
|
||||
|
@ -612,18 +612,18 @@ export_srtp_keys (ErDtlsConnection * self)
|
|||
}
|
||||
|
||||
client_key.key = exported_keys.client_key;
|
||||
server_key.key = exported_keys.server_key;
|
||||
servgst_key.key = exported_keys.servgst_key;
|
||||
client_key.salt = exported_keys.client_salt;
|
||||
server_key.salt = exported_keys.server_salt;
|
||||
servgst_key.salt = exported_keys.servgst_salt;
|
||||
|
||||
if (self->priv->is_client) {
|
||||
g_signal_emit (self, signals[SIGNAL_ON_ENCODER_KEY], 0, &client_key, cipher,
|
||||
auth);
|
||||
g_signal_emit (self, signals[SIGNAL_ON_DECODER_KEY], 0, &server_key, cipher,
|
||||
auth);
|
||||
g_signal_emit (self, signals[SIGNAL_ON_DECODER_KEY], 0, &servgst_key,
|
||||
cipher, auth);
|
||||
} else {
|
||||
g_signal_emit (self, signals[SIGNAL_ON_ENCODER_KEY], 0, &server_key, cipher,
|
||||
auth);
|
||||
g_signal_emit (self, signals[SIGNAL_ON_ENCODER_KEY], 0, &servgst_key,
|
||||
cipher, auth);
|
||||
g_signal_emit (self, signals[SIGNAL_ON_DECODER_KEY], 0, &client_key, cipher,
|
||||
auth);
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ beach:
|
|||
}
|
||||
|
||||
static void
|
||||
openssl_poll (ErDtlsConnection * self)
|
||||
openssl_poll (GstDtlsConnection * self)
|
||||
{
|
||||
int ret;
|
||||
char buf[512];
|
||||
|
@ -691,7 +691,7 @@ openssl_poll (ErDtlsConnection * self)
|
|||
static int
|
||||
openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
|
||||
{
|
||||
ErDtlsConnection *self;
|
||||
GstDtlsConnection *self;
|
||||
SSL *ssl;
|
||||
BIO *bio;
|
||||
gchar *pem = NULL;
|
||||
|
@ -701,9 +701,9 @@ openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
|
|||
X509_STORE_CTX_get_ex_data (x509_ctx,
|
||||
SSL_get_ex_data_X509_STORE_CTX_idx ());
|
||||
self = SSL_get_ex_data (ssl, connection_ex_index);
|
||||
g_return_val_if_fail (ER_IS_DTLS_CONNECTION (self), FALSE);
|
||||
g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), FALSE);
|
||||
|
||||
pem = _er_dtls_x509_to_pem (x509_ctx->cert);
|
||||
pem = _gst_dtls_x509_to_pem (x509_ctx->cert);
|
||||
|
||||
if (!pem) {
|
||||
LOG_WARNING (self, "failed to convert received certificate to pem format");
|
||||
|
@ -756,7 +756,7 @@ static BIO_METHOD custom_bio_methods = {
|
|||
};
|
||||
|
||||
static BIO_METHOD *
|
||||
BIO_s_er_dtls_connection ()
|
||||
BIO_s_gst_dtls_connection ()
|
||||
{
|
||||
return &custom_bio_methods;
|
||||
}
|
||||
|
@ -764,14 +764,14 @@ BIO_s_er_dtls_connection ()
|
|||
static int
|
||||
bio_method_write (BIO * bio, const char *data, int size)
|
||||
{
|
||||
ErDtlsConnection *self = ER_DTLS_CONNECTION (bio->ptr);
|
||||
GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
|
||||
|
||||
LOG_LOG (self, "BIO: writing %d", size);
|
||||
|
||||
if (self->priv->send_closure) {
|
||||
GValue values[3] = { G_VALUE_INIT };
|
||||
|
||||
g_value_init (&values[0], ER_TYPE_DTLS_CONNECTION);
|
||||
g_value_init (&values[0], GST_TYPE_DTLS_CONNECTION);
|
||||
g_value_set_object (&values[0], self);
|
||||
|
||||
g_value_init (&values[1], G_TYPE_POINTER);
|
||||
|
@ -789,8 +789,8 @@ bio_method_write (BIO * bio, const char *data, int size)
|
|||
static int
|
||||
bio_method_read (BIO * bio, char *out_buffer, int size)
|
||||
{
|
||||
ErDtlsConnection *self = ER_DTLS_CONNECTION (bio->ptr);
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
guint internal_size;
|
||||
gint copy_size;
|
||||
|
||||
|
@ -833,8 +833,8 @@ bio_method_read (BIO * bio, char *out_buffer, int size)
|
|||
static long
|
||||
bio_method_ctrl (BIO * bio, int cmd, long arg1, void *arg2)
|
||||
{
|
||||
ErDtlsConnection *self = ER_DTLS_CONNECTION (bio->ptr);
|
||||
ErDtlsConnectionPrivate *priv = self->priv;
|
||||
GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
|
||||
GstDtlsConnectionPrivate *priv = self->priv;
|
||||
|
||||
switch (cmd) {
|
||||
case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT:
|
||||
|
@ -896,6 +896,6 @@ bio_method_free (BIO * bio)
|
|||
return 0;
|
||||
}
|
||||
|
||||
LOG_LOG (ER_DTLS_CONNECTION (bio->ptr), "BIO free");
|
||||
LOG_LOG (GST_DTLS_CONNECTION (bio->ptr), "BIO free");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,93 +30,93 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define ER_TYPE_DTLS_CONNECTION (er_dtls_connection_get_type())
|
||||
#define ER_DTLS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ER_TYPE_DTLS_CONNECTION, ErDtlsConnection))
|
||||
#define ER_DTLS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ER_TYPE_DTLS_CONNECTION, ErDtlsConnectionClass))
|
||||
#define ER_IS_DTLS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ER_TYPE_DTLS_CONNECTION))
|
||||
#define ER_IS_DTLS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ER_TYPE_DTLS_CONNECTION))
|
||||
#define ER_DTLS_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ER_TYPE_DTLS_CONNECTION, ErDtlsConnectionClass))
|
||||
#define GST_TYPE_DTLS_CONNECTION (gst_dtls_connection_get_type())
|
||||
#define GST_DTLS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnection))
|
||||
#define GST_DTLS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionClass))
|
||||
#define GST_IS_DTLS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_CONNECTION))
|
||||
#define GST_IS_DTLS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_CONNECTION))
|
||||
#define GST_DTLS_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionClass))
|
||||
|
||||
typedef struct _ErDtlsConnection ErDtlsConnection;
|
||||
typedef struct _ErDtlsConnectionClass ErDtlsConnectionClass;
|
||||
typedef struct _ErDtlsConnectionPrivate ErDtlsConnectionPrivate;
|
||||
typedef struct _GstDtlsConnection GstDtlsConnection;
|
||||
typedef struct _GstDtlsConnectionClass GstDtlsConnectionClass;
|
||||
typedef struct _GstDtlsConnectionPrivate GstDtlsConnectionPrivate;
|
||||
|
||||
/**
|
||||
* ErDtlsSrtpCipher:
|
||||
* @ER_DTLS_SRTP_CIPHER_AES_128_ICM: aes-128-icm
|
||||
* GstDtlsSrtpCipher:
|
||||
* @GST_DTLS_SRTP_CIPHER_AES_128_ICM: aes-128-icm
|
||||
*
|
||||
* SRTP Cipher selected by the DTLS handshake, should match the enums in gstsrtp
|
||||
*/
|
||||
typedef enum {
|
||||
ER_DTLS_SRTP_CIPHER_AES_128_ICM = 1
|
||||
} ErDtlsSrtpCipher;
|
||||
GST_DTLS_SRTP_CIPHER_AES_128_ICM = 1
|
||||
} GstDtlsSrtpCipher;
|
||||
|
||||
/**
|
||||
* ErDtlsSrtpAuth:
|
||||
* @ER_DTLS_SRTP_AUTH_HMAC_SHA1_32: hmac-sha1-32
|
||||
* @ER_DTLS_SRTP_AUTH_HMAC_SHA1_80: hmac-sha1-80
|
||||
* GstDtlsSrtpAuth:
|
||||
* @GST_DTLS_SRTP_AUTH_HMAC_SHA1_32: hmac-sha1-32
|
||||
* @GST_DTLS_SRTP_AUTH_HMAC_SHA1_80: hmac-sha1-80
|
||||
*
|
||||
* SRTP Auth selected by the DTLS handshake, should match the enums in gstsrtp
|
||||
*/
|
||||
typedef enum {
|
||||
ER_DTLS_SRTP_AUTH_HMAC_SHA1_32 = 1,
|
||||
ER_DTLS_SRTP_AUTH_HMAC_SHA1_80 = 2
|
||||
} ErDtlsSrtpAuth;
|
||||
GST_DTLS_SRTP_AUTH_HMAC_SHA1_32 = 1,
|
||||
GST_DTLS_SRTP_AUTH_HMAC_SHA1_80 = 2
|
||||
} GstDtlsSrtpAuth;
|
||||
|
||||
#define ER_DTLS_SRTP_MASTER_KEY_LENGTH 30
|
||||
#define GST_DTLS_SRTP_MASTER_KEY_LENGTH 30
|
||||
|
||||
/*
|
||||
* ErDtlsConnection:
|
||||
* GstDtlsConnection:
|
||||
*
|
||||
* A class that handles a single DTLS connection.
|
||||
* Any connection needs to be created with the agent property set.
|
||||
* Once the DTLS handshake is completed, on-encoder-key and on-decoder-key will be signalled.
|
||||
*/
|
||||
struct _ErDtlsConnection {
|
||||
struct _GstDtlsConnection {
|
||||
GObject parent_instance;
|
||||
|
||||
ErDtlsConnectionPrivate *priv;
|
||||
GstDtlsConnectionPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ErDtlsConnectionClass {
|
||||
struct _GstDtlsConnectionClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType er_dtls_connection_get_type(void) G_GNUC_CONST;
|
||||
GType gst_dtls_connection_get_type(void) G_GNUC_CONST;
|
||||
|
||||
void er_dtls_connection_start(ErDtlsConnection *, gboolean is_client);
|
||||
void er_dtls_connection_start_timeout(ErDtlsConnection *);
|
||||
void gst_dtls_connection_start(GstDtlsConnection *, gboolean is_client);
|
||||
void gst_dtls_connection_start_timeout(GstDtlsConnection *);
|
||||
|
||||
/*
|
||||
* Stops the connections, it is not required to call this function.
|
||||
*/
|
||||
void er_dtls_connection_stop(ErDtlsConnection *);
|
||||
void gst_dtls_connection_stop(GstDtlsConnection *);
|
||||
|
||||
/*
|
||||
* Closes the connection, the function will block until the connection has been stopped.
|
||||
* If stop is called some time before, close will return instantly.
|
||||
*/
|
||||
void er_dtls_connection_close(ErDtlsConnection *);
|
||||
void gst_dtls_connection_close(GstDtlsConnection *);
|
||||
|
||||
/*
|
||||
* Sets the closure that will be called whenever data needs to be sent.
|
||||
*
|
||||
* The closure will get called with the following arguments:
|
||||
* void cb(ErDtlsConnection *, gpointer data, gint length, gpointer user_data)
|
||||
* void cb(GstDtlsConnection *, gpointer data, gint length, gpointer usgst_data)
|
||||
*/
|
||||
void er_dtls_connection_set_send_callback(ErDtlsConnection *, GClosure *);
|
||||
void gst_dtls_connection_set_send_callback(GstDtlsConnection *, GClosure *);
|
||||
|
||||
/*
|
||||
* Processes data that has been recevied, the transformation is done in-place.
|
||||
* Returns the length of the plaintext data that was decoded, if no data is available, 0<= will be returned.
|
||||
*/
|
||||
gint er_dtls_connection_process(ErDtlsConnection *, gpointer ptr, gint len);
|
||||
gint gst_dtls_connection_process(GstDtlsConnection *, gpointer ptr, gint len);
|
||||
|
||||
/*
|
||||
* If the DTLS handshake is completed this function will encode the given data.
|
||||
* Returns the length of the data sent, or 0 if the DTLS handshake is not completed.
|
||||
*/
|
||||
gint er_dtls_connection_send(ErDtlsConnection *, gpointer ptr, gint len);
|
||||
gint gst_dtls_connection_send(GstDtlsConnection *, gpointer ptr, gint len);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -42,13 +42,12 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_dec_debug);
|
||||
#define GST_CAT_DEFAULT er_dtls_dec_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_dtls_dec_debug
|
||||
|
||||
#define gst_er_dtls_dec_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstErDtlsDec, gst_er_dtls_dec, GST_TYPE_ELEMENT,
|
||||
GST_DEBUG_CATEGORY_INIT (er_dtls_dec_debug, "erdtlsdec", 0,
|
||||
"Ericsson DTLS Decoder"));
|
||||
#define gst_dtls_dec_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsDec, gst_dtls_dec, GST_TYPE_ELEMENT,
|
||||
GST_DEBUG_CATEGORY_INIT (gst_dtls_dec_debug, "dtlsdec", 0, "DTLS Decoder"));
|
||||
|
||||
#define UNUSED(param) while (0) { (void)(param); }
|
||||
|
||||
|
@ -84,32 +83,32 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
#define DEFAULT_SRTP_AUTH 0
|
||||
|
||||
|
||||
static void gst_er_dtls_dec_finalize (GObject *);
|
||||
static void gst_er_dtls_dec_dispose (GObject *);
|
||||
static void gst_er_dtls_dec_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_dec_finalize (GObject *);
|
||||
static void gst_dtls_dec_dispose (GObject *);
|
||||
static void gst_dtls_dec_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void gst_er_dtls_dec_get_property (GObject *, guint prop_id, GValue *,
|
||||
static void gst_dtls_dec_get_property (GObject *, guint prop_id, GValue *,
|
||||
GParamSpec *);
|
||||
|
||||
static GstStateChangeReturn gst_er_dtls_dec_change_state (GstElement *,
|
||||
static GstStateChangeReturn gst_dtls_dec_change_state (GstElement *,
|
||||
GstStateChange);
|
||||
static GstPad *gst_er_dtls_dec_request_new_pad (GstElement *, GstPadTemplate *,
|
||||
static GstPad *gst_dtls_dec_request_new_pad (GstElement *, GstPadTemplate *,
|
||||
const gchar * name, const GstCaps *);
|
||||
static void gst_er_dtls_dec_release_pad (GstElement *, GstPad *);
|
||||
static void gst_dtls_dec_release_pad (GstElement *, GstPad *);
|
||||
|
||||
static void on_key_received (ErDtlsConnection *, gpointer key, guint cipher,
|
||||
guint auth, GstErDtlsDec *);
|
||||
static gboolean on_peer_certificate_received (ErDtlsConnection *, gchar * pem,
|
||||
GstErDtlsDec *);
|
||||
static void on_key_received (GstDtlsConnection *, gpointer key, guint cipher,
|
||||
guint auth, GstDtlsDec *);
|
||||
static gboolean on_pegst_certificate_received (GstDtlsConnection *, gchar * pem,
|
||||
GstDtlsDec *);
|
||||
static GstFlowReturn sink_chain (GstPad *, GstObject * parent, GstBuffer *);
|
||||
|
||||
static ErDtlsAgent *get_agent_by_pem (const gchar * pem);
|
||||
static void agent_weak_ref_notify (gchar * pem, ErDtlsAgent *);
|
||||
static void create_connection (GstErDtlsDec *, gchar * id);
|
||||
static void connection_weak_ref_notify (gchar * id, ErDtlsConnection *);
|
||||
static GstDtlsAgent *get_agent_by_pem (const gchar * pem);
|
||||
static void agent_weak_ref_notify (gchar * pem, GstDtlsAgent *);
|
||||
static void create_connection (GstDtlsDec *, gchar * id);
|
||||
static void connection_weak_ref_notify (gchar * id, GstDtlsConnection *);
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_class_init (GstErDtlsDecClass * klass)
|
||||
gst_dtls_dec_class_init (GstDtlsDecClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
|
@ -117,18 +116,15 @@ gst_er_dtls_dec_class_init (GstErDtlsDecClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_er_dtls_dec_finalize);
|
||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_er_dtls_dec_dispose);
|
||||
gobject_class->set_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_dec_set_property);
|
||||
gobject_class->get_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_dec_get_property);
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_dec_finalize);
|
||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_dtls_dec_dispose);
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dtls_dec_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_dtls_dec_get_property);
|
||||
|
||||
element_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_dec_change_state);
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR (gst_dtls_dec_change_state);
|
||||
element_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_dec_request_new_pad);
|
||||
element_class->release_pad = GST_DEBUG_FUNCPTR (gst_er_dtls_dec_release_pad);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_dec_request_new_pad);
|
||||
element_class->release_pad = GST_DEBUG_FUNCPTR (gst_dtls_dec_release_pad);
|
||||
|
||||
signals[SIGNAL_ON_KEY_RECEIVED] =
|
||||
g_signal_new ("on-key-received", G_TYPE_FROM_CLASS (klass),
|
||||
|
@ -163,16 +159,16 @@ gst_er_dtls_dec_class_init (GstErDtlsDecClass * klass)
|
|||
g_param_spec_uint ("srtp-cipher",
|
||||
"SRTP cipher",
|
||||
"The SRTP cipher selected in the DTLS handshake. "
|
||||
"The value will be set to an ErDtlsSrtpCipher.",
|
||||
0, ER_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
|
||||
"The value will be set to an GstDtlsSrtpCipher.",
|
||||
0, GST_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_SRTP_AUTH] =
|
||||
g_param_spec_uint ("srtp-auth",
|
||||
"SRTP authentication",
|
||||
"The SRTP authentication selected in the DTLS handshake. "
|
||||
"The value will be set to an ErDtlsSrtpAuth.",
|
||||
0, ER_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
|
||||
"The value will be set to an GstDtlsSrtpAuth.",
|
||||
0, GST_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
|
@ -189,15 +185,15 @@ gst_er_dtls_dec_class_init (GstErDtlsDecClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_init (GstErDtlsDec * self)
|
||||
gst_dtls_dec_init (GstDtlsDec * self)
|
||||
{
|
||||
GstPad *sink;
|
||||
self->agent = get_agent_by_pem (NULL);
|
||||
self->connection_id = NULL;
|
||||
self->connection = NULL;
|
||||
self->peer_pem = NULL;
|
||||
self->pegst_pem = NULL;
|
||||
|
||||
self->decoder_key = NULL;
|
||||
self->decodgst_key = NULL;
|
||||
self->srtp_cipher = DEFAULT_SRTP_CIPHER;
|
||||
self->srtp_auth = DEFAULT_SRTP_AUTH;
|
||||
|
||||
|
@ -213,20 +209,20 @@ gst_er_dtls_dec_init (GstErDtlsDec * self)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_finalize (GObject * object)
|
||||
gst_dtls_dec_finalize (GObject * object)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (object);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (object);
|
||||
|
||||
if (self->decoder_key) {
|
||||
gst_buffer_unref (self->decoder_key);
|
||||
self->decoder_key = NULL;
|
||||
if (self->decodgst_key) {
|
||||
gst_buffer_unref (self->decodgst_key);
|
||||
self->decodgst_key = NULL;
|
||||
}
|
||||
|
||||
g_free (self->connection_id);
|
||||
self->connection_id = NULL;
|
||||
|
||||
g_free (self->peer_pem);
|
||||
self->peer_pem = NULL;
|
||||
g_free (self->pegst_pem);
|
||||
self->pegst_pem = NULL;
|
||||
|
||||
g_mutex_clear (&self->src_mutex);
|
||||
|
||||
|
@ -236,9 +232,9 @@ gst_er_dtls_dec_finalize (GObject * object)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_dispose (GObject * object)
|
||||
gst_dtls_dec_dispose (GObject * object)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (object);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (object);
|
||||
|
||||
if (self->agent) {
|
||||
g_object_unref (self->agent);
|
||||
|
@ -252,10 +248,10 @@ gst_er_dtls_dec_dispose (GObject * object)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_set_property (GObject * object, guint prop_id,
|
||||
gst_dtls_dec_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (object);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
@ -279,10 +275,10 @@ gst_er_dtls_dec_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
gst_dtls_dec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (object);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
@ -290,13 +286,13 @@ gst_er_dtls_dec_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
break;
|
||||
case PROP_PEM:
|
||||
g_value_take_string (value,
|
||||
er_dtls_agent_get_certificate_pem (self->agent));
|
||||
gst_dtls_agent_get_certificate_pem (self->agent));
|
||||
break;
|
||||
case PROP_PEER_PEM:
|
||||
g_value_set_string (value, self->peer_pem);
|
||||
g_value_set_string (value, self->pegst_pem);
|
||||
break;
|
||||
case PROP_DECODER_KEY:
|
||||
g_value_set_boxed (value, self->decoder_key);
|
||||
g_value_set_boxed (value, self->decodgst_key);
|
||||
break;
|
||||
case PROP_SRTP_CIPHER:
|
||||
g_value_set_uint (value, self->srtp_cipher);
|
||||
|
@ -310,9 +306,9 @@ gst_er_dtls_dec_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_er_dtls_dec_change_state (GstElement * element, GstStateChange transition)
|
||||
gst_dtls_dec_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (element);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (element);
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
switch (transition) {
|
||||
|
@ -321,7 +317,7 @@ gst_er_dtls_dec_change_state (GstElement * element, GstStateChange transition)
|
|||
g_signal_connect_object (self->connection,
|
||||
"on-decoder-key", G_CALLBACK (on_key_received), self, 0);
|
||||
g_signal_connect_object (self->connection,
|
||||
"on-peer-certificate", G_CALLBACK (on_peer_certificate_received),
|
||||
"on-peer-certificate", G_CALLBACK (on_pegst_certificate_received),
|
||||
self, 0);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (self,
|
||||
|
@ -339,10 +335,10 @@ gst_er_dtls_dec_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
static GstPad *
|
||||
gst_er_dtls_dec_request_new_pad (GstElement * element,
|
||||
gst_dtls_dec_request_new_pad (GstElement * element,
|
||||
GstPadTemplate * tmpl, const gchar * name, const GstCaps * caps)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (element);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (element);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "requesting pad");
|
||||
|
||||
|
@ -367,9 +363,9 @@ gst_er_dtls_dec_request_new_pad (GstElement * element,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_dec_release_pad (GstElement * element, GstPad * pad)
|
||||
gst_dtls_dec_release_pad (GstElement * element, GstPad * pad)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (element);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (element);
|
||||
|
||||
g_mutex_lock (&self->src_mutex);
|
||||
|
||||
|
@ -385,23 +381,23 @@ gst_er_dtls_dec_release_pad (GstElement * element, GstPad * pad)
|
|||
}
|
||||
|
||||
static void
|
||||
on_key_received (ErDtlsConnection * connection, gpointer key, guint cipher,
|
||||
guint auth, GstErDtlsDec * self)
|
||||
on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
|
||||
guint auth, GstDtlsDec * self)
|
||||
{
|
||||
gpointer key_dup;
|
||||
gchar *key_str;
|
||||
|
||||
UNUSED (connection);
|
||||
g_return_if_fail (GST_IS_ER_DTLS_DEC (self));
|
||||
g_return_if_fail (GST_IS_DTLS_DEC (self));
|
||||
|
||||
self->srtp_cipher = cipher;
|
||||
self->srtp_auth = auth;
|
||||
|
||||
key_dup = g_memdup (key, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
self->decoder_key =
|
||||
gst_buffer_new_wrapped (key_dup, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
self->decodgst_key =
|
||||
gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
key_str = g_base64_encode (key, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
GST_INFO_OBJECT (self, "received key: %s", key_str);
|
||||
g_free (key_str);
|
||||
|
||||
|
@ -409,9 +405,9 @@ on_key_received (ErDtlsConnection * connection, gpointer key, guint cipher,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
signal_peer_certificate_received (GWeakRef * ref)
|
||||
signal_pegst_certificate_received (GWeakRef * ref)
|
||||
{
|
||||
GstErDtlsDec *self;
|
||||
GstDtlsDec *self;
|
||||
|
||||
self = g_weak_ref_get (ref);
|
||||
g_weak_ref_clear (ref);
|
||||
|
@ -428,22 +424,22 @@ signal_peer_certificate_received (GWeakRef * ref)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
on_peer_certificate_received (ErDtlsConnection * connection, gchar * pem,
|
||||
GstErDtlsDec * self)
|
||||
on_pegst_certificate_received (GstDtlsConnection * connection, gchar * pem,
|
||||
GstDtlsDec * self)
|
||||
{
|
||||
GWeakRef *ref;
|
||||
|
||||
UNUSED (connection);
|
||||
g_return_val_if_fail (GST_IS_ER_DTLS_DEC (self), TRUE);
|
||||
g_return_val_if_fail (GST_IS_DTLS_DEC (self), TRUE);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Received peer certificate PEM: \n%s", pem);
|
||||
|
||||
self->peer_pem = g_strdup (pem);
|
||||
self->pegst_pem = g_strdup (pem);
|
||||
|
||||
ref = g_new (GWeakRef, 1);
|
||||
g_weak_ref_init (ref, self);
|
||||
|
||||
g_idle_add ((GSourceFunc) signal_peer_certificate_received, ref);
|
||||
g_idle_add ((GSourceFunc) signal_pegst_certificate_received, ref);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -451,7 +447,7 @@ on_peer_certificate_received (ErDtlsConnection * connection, gchar * pem,
|
|||
static GstFlowReturn
|
||||
sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
GstErDtlsDec *self = GST_ER_DTLS_DEC (parent);
|
||||
GstDtlsDec *self = GST_DTLS_DEC (parent);
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstMapInfo map_info = GST_MAP_INFO_INIT;
|
||||
gint size;
|
||||
|
@ -472,7 +468,7 @@ sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
}
|
||||
|
||||
size =
|
||||
er_dtls_connection_process (self->connection, map_info.data,
|
||||
gst_dtls_connection_process (self->connection, map_info.data,
|
||||
map_info.size);
|
||||
gst_buffer_unmap (buffer, &map_info);
|
||||
|
||||
|
@ -501,19 +497,19 @@ sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
static GHashTable *agent_table = NULL;
|
||||
G_LOCK_DEFINE_STATIC (agent_table);
|
||||
|
||||
static ErDtlsAgent *generated_cert_agent = NULL;
|
||||
static GstDtlsAgent *generated_cert_agent = NULL;
|
||||
|
||||
static ErDtlsAgent *
|
||||
static GstDtlsAgent *
|
||||
get_agent_by_pem (const gchar * pem)
|
||||
{
|
||||
ErDtlsAgent *agent;
|
||||
GstDtlsAgent *agent;
|
||||
|
||||
if (!pem) {
|
||||
if (g_once_init_enter (&generated_cert_agent)) {
|
||||
ErDtlsAgent *new_agent;
|
||||
GstDtlsAgent *new_agent;
|
||||
|
||||
new_agent = g_object_new (ER_TYPE_DTLS_AGENT, "certificate",
|
||||
g_object_new (ER_TYPE_DTLS_CERTIFICATE, NULL), NULL);
|
||||
new_agent = g_object_new (GST_TYPE_DTLS_AGENT, "certificate",
|
||||
g_object_new (GST_TYPE_DTLS_CERTIFICATE, NULL), NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (generated_cert_agent,
|
||||
"no agent with generated cert found, creating new");
|
||||
|
@ -533,11 +529,11 @@ get_agent_by_pem (const gchar * pem)
|
|||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
}
|
||||
|
||||
agent = ER_DTLS_AGENT (g_hash_table_lookup (agent_table, pem));
|
||||
agent = GST_DTLS_AGENT (g_hash_table_lookup (agent_table, pem));
|
||||
|
||||
if (!agent) {
|
||||
agent = g_object_new (ER_TYPE_DTLS_AGENT,
|
||||
"certificate", g_object_new (ER_TYPE_DTLS_CERTIFICATE, "pem", pem,
|
||||
agent = g_object_new (GST_TYPE_DTLS_AGENT,
|
||||
"certificate", g_object_new (GST_TYPE_DTLS_CERTIFICATE, "pem", pem,
|
||||
NULL), NULL);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (agent), (GWeakNotify) agent_weak_ref_notify,
|
||||
|
@ -559,7 +555,7 @@ get_agent_by_pem (const gchar * pem)
|
|||
}
|
||||
|
||||
static void
|
||||
agent_weak_ref_notify (gchar * pem, ErDtlsAgent * agent)
|
||||
agent_weak_ref_notify (gchar * pem, GstDtlsAgent * agent)
|
||||
{
|
||||
UNUSED (agent);
|
||||
|
||||
|
@ -574,10 +570,10 @@ agent_weak_ref_notify (gchar * pem, ErDtlsAgent * agent)
|
|||
static GHashTable *connection_table = NULL;
|
||||
G_LOCK_DEFINE_STATIC (connection_table);
|
||||
|
||||
ErDtlsConnection *
|
||||
gst_er_dtls_dec_fetch_connection (gchar * id)
|
||||
GstDtlsConnection *
|
||||
gst_dtls_dec_fetch_connection (gchar * id)
|
||||
{
|
||||
ErDtlsConnection *connection;
|
||||
GstDtlsConnection *connection;
|
||||
g_return_val_if_fail (id, NULL);
|
||||
|
||||
GST_DEBUG ("fetching '%s' from connection table, size is %d",
|
||||
|
@ -600,10 +596,10 @@ gst_er_dtls_dec_fetch_connection (gchar * id)
|
|||
}
|
||||
|
||||
static void
|
||||
create_connection (GstErDtlsDec * self, gchar * id)
|
||||
create_connection (GstDtlsDec * self, gchar * id)
|
||||
{
|
||||
g_return_if_fail (GST_IS_ER_DTLS_DEC (self));
|
||||
g_return_if_fail (ER_IS_DTLS_AGENT (self->agent));
|
||||
g_return_if_fail (GST_IS_DTLS_DEC (self));
|
||||
g_return_if_fail (GST_IS_DTLS_AGENT (self->agent));
|
||||
|
||||
if (self->connection) {
|
||||
g_object_unref (self->connection);
|
||||
|
@ -624,7 +620,7 @@ create_connection (GstErDtlsDec * self, gchar * id)
|
|||
}
|
||||
|
||||
self->connection =
|
||||
g_object_new (ER_TYPE_DTLS_CONNECTION, "agent", self->agent, NULL);
|
||||
g_object_new (GST_TYPE_DTLS_CONNECTION, "agent", self->agent, NULL);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (self->connection),
|
||||
(GWeakNotify) connection_weak_ref_notify, g_strdup (id));
|
||||
|
@ -635,7 +631,7 @@ create_connection (GstErDtlsDec * self, gchar * id)
|
|||
}
|
||||
|
||||
static void
|
||||
connection_weak_ref_notify (gchar * id, ErDtlsConnection * connection)
|
||||
connection_weak_ref_notify (gchar * id, GstDtlsConnection * connection)
|
||||
{
|
||||
UNUSED (connection);
|
||||
|
||||
|
|
|
@ -33,46 +33,46 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_DEC \
|
||||
(gst_er_dtls_dec_get_type())
|
||||
#define GST_ER_DTLS_DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_DEC, GstErDtlsDec))
|
||||
#define GST_ER_DTLS_DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_DEC, GstErDtlsDecClass))
|
||||
#define GST_IS_ER_DTLS_DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_DEC))
|
||||
#define GST_IS_ER_DTLS_DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_DEC))
|
||||
#define GST_TYPE_DTLS_DEC \
|
||||
(gst_dtls_dec_get_type())
|
||||
#define GST_DTLS_DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_DEC, GstDtlsDec))
|
||||
#define GST_DTLS_DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_DEC, GstDtlsDecClass))
|
||||
#define GST_IS_DTLS_DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_DEC))
|
||||
#define GST_IS_DTLS_DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_DEC))
|
||||
|
||||
typedef struct _GstErDtlsDec GstErDtlsDec;
|
||||
typedef struct _GstErDtlsDecClass GstErDtlsDecClass;
|
||||
typedef struct _GstDtlsDec GstDtlsDec;
|
||||
typedef struct _GstDtlsDecClass GstDtlsDecClass;
|
||||
|
||||
struct _GstErDtlsDec {
|
||||
struct _GstDtlsDec {
|
||||
GstElement element;
|
||||
|
||||
GstPad *src;
|
||||
GMutex src_mutex;
|
||||
|
||||
ErDtlsAgent *agent;
|
||||
ErDtlsConnection *connection;
|
||||
GstDtlsAgent *agent;
|
||||
GstDtlsConnection *connection;
|
||||
GMutex connection_mutex;
|
||||
gchar *connection_id;
|
||||
gchar *peer_pem;
|
||||
gchar *pegst_pem;
|
||||
|
||||
GstBuffer *decoder_key;
|
||||
GstBuffer *decodgst_key;
|
||||
guint srtp_cipher;
|
||||
guint srtp_auth;
|
||||
};
|
||||
|
||||
struct _GstErDtlsDecClass {
|
||||
struct _GstDtlsDecClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_er_dtls_dec_get_type(void);
|
||||
GType gst_dtls_dec_get_type(void);
|
||||
|
||||
gboolean gst_er_dtls_dec_plugin_init(GstPlugin *);
|
||||
gboolean gst_dtls_dec_plugin_init(GstPlugin *);
|
||||
|
||||
ErDtlsConnection *gst_er_dtls_dec_fetch_connection(gchar *id);
|
||||
GstDtlsConnection *gst_dtls_dec_fetch_connection(gchar *id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -42,13 +42,12 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_STATIC_CAPS ("application/x-dtls")
|
||||
);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_enc_debug);
|
||||
#define GST_CAT_DEFAULT er_dtls_enc_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_enc_debug);
|
||||
#define GST_CAT_DEFAULT gst_dtls_enc_debug
|
||||
|
||||
#define gst_er_dtls_enc_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstErDtlsEnc, gst_er_dtls_enc, GST_TYPE_ELEMENT,
|
||||
GST_DEBUG_CATEGORY_INIT (er_dtls_enc_debug, "erdtlsenc", 0,
|
||||
"Ericsson DTLS Encoder"));
|
||||
#define gst_dtls_enc_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsEnc, gst_dtls_enc, GST_TYPE_ELEMENT,
|
||||
GST_DEBUG_CATEGORY_INIT (gst_dtls_enc_debug, "dtlsenc", 0, "DTLS Encoder"));
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -81,15 +80,15 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
|
||||
#define INITIAL_QUEUE_SIZE 64
|
||||
|
||||
static void gst_er_dtls_enc_finalize (GObject *);
|
||||
static void gst_er_dtls_enc_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_enc_finalize (GObject *);
|
||||
static void gst_dtls_enc_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void gst_er_dtls_enc_get_property (GObject *, guint prop_id, GValue *,
|
||||
static void gst_dtls_enc_get_property (GObject *, guint prop_id, GValue *,
|
||||
GParamSpec *);
|
||||
|
||||
static GstStateChangeReturn gst_er_dtls_enc_change_state (GstElement *,
|
||||
static GstStateChangeReturn gst_dtls_enc_change_state (GstElement *,
|
||||
GstStateChange);
|
||||
static GstPad *gst_er_dtls_enc_request_new_pad (GstElement *, GstPadTemplate *,
|
||||
static GstPad *gst_dtls_enc_request_new_pad (GstElement *, GstPadTemplate *,
|
||||
const gchar * name, const GstCaps *);
|
||||
|
||||
static gboolean src_activate_mode (GstPad *, GstObject *, GstPadMode,
|
||||
|
@ -98,13 +97,13 @@ static void src_task_loop (GstPad *);
|
|||
|
||||
static GstFlowReturn sink_chain (GstPad *, GstObject *, GstBuffer *);
|
||||
|
||||
static void on_key_received (ErDtlsConnection *, gpointer key, guint cipher,
|
||||
guint auth, GstErDtlsEnc *);
|
||||
static void on_send_data (ErDtlsConnection *, gconstpointer data, gint length,
|
||||
GstErDtlsEnc *);
|
||||
static void on_key_received (GstDtlsConnection *, gpointer key, guint cipher,
|
||||
guint auth, GstDtlsEnc *);
|
||||
static void on_send_data (GstDtlsConnection *, gconstpointer data, gint length,
|
||||
GstDtlsEnc *);
|
||||
|
||||
static void
|
||||
gst_er_dtls_enc_class_init (GstErDtlsEncClass * klass)
|
||||
gst_dtls_enc_class_init (GstDtlsEncClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
|
@ -112,16 +111,13 @@ gst_er_dtls_enc_class_init (GstErDtlsEncClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_er_dtls_enc_finalize);
|
||||
gobject_class->set_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_enc_set_property);
|
||||
gobject_class->get_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_enc_get_property);
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_enc_finalize);
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dtls_enc_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_dtls_enc_get_property);
|
||||
|
||||
element_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_enc_change_state);
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR (gst_dtls_enc_change_state);
|
||||
element_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_enc_request_new_pad);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_enc_request_new_pad);
|
||||
|
||||
signals[SIGNAL_ON_KEY_RECEIVED] =
|
||||
g_signal_new ("on-key-received", G_TYPE_FROM_CLASS (klass),
|
||||
|
@ -152,16 +148,16 @@ gst_er_dtls_enc_class_init (GstErDtlsEncClass * klass)
|
|||
g_param_spec_uint ("srtp-cipher",
|
||||
"SRTP cipher",
|
||||
"The SRTP cipher selected in the DTLS handshake. "
|
||||
"The value will be set to an ErDtlsSrtpCipher.",
|
||||
0, ER_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
|
||||
"The value will be set to an GstDtlsSrtpCipher.",
|
||||
0, GST_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_SRTP_AUTH] =
|
||||
g_param_spec_uint ("srtp-auth",
|
||||
"SRTP authentication",
|
||||
"The SRTP authentication selected in the DTLS handshake. "
|
||||
"The value will be set to an ErDtlsSrtpAuth.",
|
||||
0, ER_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
|
||||
"The value will be set to an GstDtlsSrtpAuth.",
|
||||
0, GST_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
|
@ -179,14 +175,14 @@ gst_er_dtls_enc_class_init (GstErDtlsEncClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_enc_init (GstErDtlsEnc * self)
|
||||
gst_dtls_enc_init (GstDtlsEnc * self)
|
||||
{
|
||||
self->connection_id = NULL;
|
||||
self->connection = NULL;
|
||||
|
||||
self->is_client = DEFAULT_IS_CLIENT;
|
||||
|
||||
self->encoder_key = NULL;
|
||||
self->encodgst_key = NULL;
|
||||
self->srtp_cipher = DEFAULT_SRTP_CIPHER;
|
||||
self->srtp_auth = DEFAULT_SRTP_AUTH;
|
||||
|
||||
|
@ -205,13 +201,13 @@ gst_er_dtls_enc_init (GstErDtlsEnc * self)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_enc_finalize (GObject * object)
|
||||
gst_dtls_enc_finalize (GObject * object)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (object);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (object);
|
||||
|
||||
if (self->encoder_key) {
|
||||
gst_buffer_unref (self->encoder_key);
|
||||
self->encoder_key = NULL;
|
||||
if (self->encodgst_key) {
|
||||
gst_buffer_unref (self->encodgst_key);
|
||||
self->encodgst_key = NULL;
|
||||
}
|
||||
|
||||
g_mutex_lock (&self->queue_lock);
|
||||
|
@ -231,10 +227,10 @@ gst_er_dtls_enc_finalize (GObject * object)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_enc_set_property (GObject * object, guint prop_id,
|
||||
gst_dtls_enc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (object);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
@ -249,10 +245,10 @@ gst_er_dtls_enc_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
gst_dtls_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (object);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
@ -262,7 +258,7 @@ gst_er_dtls_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
g_value_set_boolean (value, self->is_client);
|
||||
break;
|
||||
case PROP_ENCODER_KEY:
|
||||
g_value_set_boxed (value, self->encoder_key);
|
||||
g_value_set_boxed (value, self->encodgst_key);
|
||||
break;
|
||||
case PROP_SRTP_CIPHER:
|
||||
g_value_set_uint (value, self->srtp_cipher);
|
||||
|
@ -276,16 +272,15 @@ gst_er_dtls_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_er_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
||||
gst_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (element);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (element);
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
if (self->connection_id) {
|
||||
self->connection =
|
||||
gst_er_dtls_dec_fetch_connection (self->connection_id);
|
||||
self->connection = gst_dtls_dec_fetch_connection (self->connection_id);
|
||||
|
||||
if (!self->connection) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
|
@ -297,7 +292,7 @@ gst_er_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
g_signal_connect_object (self->connection,
|
||||
"on-encoder-key", G_CALLBACK (on_key_received), self, 0);
|
||||
|
||||
er_dtls_connection_set_send_callback (self->connection,
|
||||
gst_dtls_connection_set_send_callback (self->connection,
|
||||
g_cclosure_new (G_CALLBACK (on_send_data), self, NULL));
|
||||
} else {
|
||||
GST_WARNING_OBJECT (self,
|
||||
|
@ -307,7 +302,7 @@ gst_er_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
GST_DEBUG_OBJECT (self, "starting connection %s", self->connection_id);
|
||||
er_dtls_connection_start (self->connection, self->is_client);
|
||||
gst_dtls_connection_start (self->connection, self->is_client);
|
||||
|
||||
gst_pad_set_active (self->src, TRUE);
|
||||
break;
|
||||
|
@ -315,14 +310,14 @@ gst_er_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
GST_DEBUG_OBJECT (self, "stopping connection %s", self->connection_id);
|
||||
gst_pad_set_active (self->src, FALSE);
|
||||
|
||||
er_dtls_connection_stop (self->connection);
|
||||
gst_dtls_connection_stop (self->connection);
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
GST_DEBUG_OBJECT (self, "closing connection %s", self->connection_id);
|
||||
|
||||
if (self->connection) {
|
||||
er_dtls_connection_close (self->connection);
|
||||
er_dtls_connection_set_send_callback (self->connection, NULL);
|
||||
gst_dtls_connection_close (self->connection);
|
||||
gst_dtls_connection_set_send_callback (self->connection, NULL);
|
||||
g_object_unref (self->connection);
|
||||
self->connection = NULL;
|
||||
}
|
||||
|
@ -337,7 +332,7 @@ gst_er_dtls_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
static GstPad *
|
||||
gst_er_dtls_enc_request_new_pad (GstElement * element,
|
||||
gst_dtls_enc_request_new_pad (GstElement * element,
|
||||
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
|
||||
{
|
||||
GstPad *sink;
|
||||
|
@ -368,7 +363,7 @@ static gboolean
|
|||
src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
|
||||
gboolean active)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (parent);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (parent);
|
||||
gboolean success = TRUE;
|
||||
g_return_val_if_fail (mode == GST_PAD_MODE_PUSH, FALSE);
|
||||
|
||||
|
@ -401,10 +396,10 @@ src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
|
|||
static void
|
||||
src_task_loop (GstPad * pad)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (GST_PAD_PARENT (pad));
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (GST_PAD_PARENT (pad));
|
||||
GstFlowReturn ret;
|
||||
GstPad *peer;
|
||||
gboolean peer_is_active;
|
||||
gboolean pegst_is_active;
|
||||
|
||||
GST_TRACE_OBJECT (self, "src loop: acquiring lock");
|
||||
g_mutex_lock (&self->queue_lock);
|
||||
|
@ -432,10 +427,10 @@ src_task_loop (GstPad * pad)
|
|||
GST_TRACE_OBJECT (self, "src loop: queue has element");
|
||||
|
||||
peer = gst_pad_get_peer (pad);
|
||||
peer_is_active = gst_pad_is_active (peer);
|
||||
pegst_is_active = gst_pad_is_active (peer);
|
||||
gst_object_unref (peer);
|
||||
|
||||
if (peer_is_active) {
|
||||
if (pegst_is_active) {
|
||||
GstBuffer *buffer;
|
||||
gboolean start_connection_timeout = FALSE;
|
||||
|
||||
|
@ -444,7 +439,7 @@ src_task_loop (GstPad * pad)
|
|||
gchar s_id[32];
|
||||
GstCaps *caps;
|
||||
|
||||
g_snprintf (s_id, sizeof (s_id), "erdtlsenc-%08x", g_random_int ());
|
||||
g_snprintf (s_id, sizeof (s_id), "dtlsenc-%08x", g_random_int ());
|
||||
gst_pad_push_event (self->src, gst_event_new_stream_start (s_id));
|
||||
caps = gst_caps_new_empty_simple ("application/x-dtls");
|
||||
gst_pad_push_event (self->src, gst_event_new_caps (caps));
|
||||
|
@ -462,7 +457,7 @@ src_task_loop (GstPad * pad)
|
|||
|
||||
ret = gst_pad_push (self->src, buffer);
|
||||
if (start_connection_timeout)
|
||||
er_dtls_connection_start_timeout (self->connection);
|
||||
gst_dtls_connection_start_timeout (self->connection);
|
||||
|
||||
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
|
||||
GST_WARNING_OBJECT (self, "failed to push buffer on src pad: %s",
|
||||
|
@ -478,7 +473,7 @@ src_task_loop (GstPad * pad)
|
|||
static GstFlowReturn
|
||||
sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
GstErDtlsEnc *self = GST_ER_DTLS_ENC (parent);
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (parent);
|
||||
GstMapInfo map_info;
|
||||
gint ret;
|
||||
|
||||
|
@ -486,7 +481,7 @@ sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
|
||||
if (map_info.size) {
|
||||
ret =
|
||||
er_dtls_connection_send (self->connection, map_info.data,
|
||||
gst_dtls_connection_send (self->connection, map_info.data,
|
||||
map_info.size);
|
||||
if (ret != map_info.size) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
|
@ -503,23 +498,23 @@ sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
}
|
||||
|
||||
static void
|
||||
on_key_received (ErDtlsConnection * connection, gpointer key, guint cipher,
|
||||
guint auth, GstErDtlsEnc * self)
|
||||
on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
|
||||
guint auth, GstDtlsEnc * self)
|
||||
{
|
||||
gpointer key_dup;
|
||||
gchar *key_str;
|
||||
|
||||
g_return_if_fail (GST_IS_ER_DTLS_ENC (self));
|
||||
g_return_if_fail (ER_IS_DTLS_CONNECTION (connection));
|
||||
g_return_if_fail (GST_IS_DTLS_ENC (self));
|
||||
g_return_if_fail (GST_IS_DTLS_CONNECTION (connection));
|
||||
|
||||
self->srtp_cipher = cipher;
|
||||
self->srtp_auth = auth;
|
||||
|
||||
key_dup = g_memdup (key, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
self->encoder_key =
|
||||
gst_buffer_new_wrapped (key_dup, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
self->encodgst_key =
|
||||
gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
|
||||
key_str = g_base64_encode (key, ER_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
|
||||
GST_INFO_OBJECT (self, "received key: %s", key_str);
|
||||
g_free (key_str);
|
||||
|
||||
|
@ -527,8 +522,8 @@ on_key_received (ErDtlsConnection * connection, gpointer key, guint cipher,
|
|||
}
|
||||
|
||||
static void
|
||||
on_send_data (ErDtlsConnection * connection, gconstpointer data, gint length,
|
||||
GstErDtlsEnc * self)
|
||||
on_send_data (GstDtlsConnection * connection, gconstpointer data, gint length,
|
||||
GstDtlsEnc * self)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
|
|
|
@ -33,16 +33,16 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_ENC (gst_er_dtls_enc_get_type())
|
||||
#define GST_ER_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_ENC, GstErDtlsEnc))
|
||||
#define GST_ER_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_ENC, GstErDtlsEncClass))
|
||||
#define GST_IS_ER_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_ENC))
|
||||
#define GST_IS_ER_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_ENC))
|
||||
#define GST_TYPE_DTLS_ENC (gst_dtls_enc_get_type())
|
||||
#define GST_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_ENC, GstDtlsEnc))
|
||||
#define GST_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_ENC, GstDtlsEncClass))
|
||||
#define GST_IS_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_ENC))
|
||||
#define GST_IS_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_ENC))
|
||||
|
||||
typedef struct _GstErDtlsEnc GstErDtlsEnc;
|
||||
typedef struct _GstErDtlsEncClass GstErDtlsEncClass;
|
||||
typedef struct _GstDtlsEnc GstDtlsEnc;
|
||||
typedef struct _GstDtlsEncClass GstDtlsEncClass;
|
||||
|
||||
struct _GstErDtlsEnc {
|
||||
struct _GstDtlsEnc {
|
||||
GstElement element;
|
||||
|
||||
GstPad *src;
|
||||
|
@ -51,25 +51,25 @@ struct _GstErDtlsEnc {
|
|||
GMutex queue_lock;
|
||||
GCond queue_cond_add;
|
||||
|
||||
ErDtlsConnection *connection;
|
||||
GstDtlsConnection *connection;
|
||||
gchar *connection_id;
|
||||
|
||||
gboolean is_client;
|
||||
|
||||
GstBuffer *encoder_key;
|
||||
GstBuffer *encodgst_key;
|
||||
guint srtp_cipher;
|
||||
guint srtp_auth;
|
||||
|
||||
gboolean send_initial_events;
|
||||
};
|
||||
|
||||
struct _GstErDtlsEncClass {
|
||||
struct _GstDtlsEncClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_er_dtls_enc_get_type(void);
|
||||
GType gst_dtls_enc_get_type(void);
|
||||
|
||||
gboolean gst_er_dtls_enc_plugin_init(GstPlugin *);
|
||||
gboolean gst_dtls_enc_plugin_init(GstPlugin *);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "gstdtlssrtpbin.h"
|
||||
|
||||
#define gst_er_dtls_srtp_bin_parent_class parent_class
|
||||
G_DEFINE_ABSTRACT_TYPE (GstErDtlsSrtpBin, gst_er_dtls_srtp_bin, GST_TYPE_BIN);
|
||||
#define gst_dtls_srtp_bin_parent_class parent_class
|
||||
G_DEFINE_ABSTRACT_TYPE (GstDtlsSrtpBin, gst_dtls_srtp_bin, GST_TYPE_BIN);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -54,24 +54,24 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
#define DEFAULT_SRTCP_AUTH NULL
|
||||
#define DEFAULT_SRTCP_CIPHER NULL
|
||||
|
||||
static void gst_er_dtls_srtp_bin_finalize (GObject *);
|
||||
static void gst_er_dtls_srtp_bin_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_bin_finalize (GObject *);
|
||||
static void gst_dtls_srtp_bin_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void gst_er_dtls_srtp_bin_get_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_bin_get_property (GObject *, guint prop_id,
|
||||
GValue *, GParamSpec *);
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_bin_class_init (GstErDtlsSrtpBinClass * klass)
|
||||
gst_dtls_srtp_bin_class_init (GstDtlsSrtpBinClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_bin_finalize);
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_finalize);
|
||||
gobject_class->set_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_bin_set_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_set_property);
|
||||
gobject_class->get_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_bin_get_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_get_property);
|
||||
|
||||
klass->remove_dtls_element = NULL;
|
||||
|
||||
|
@ -124,7 +124,7 @@ gst_er_dtls_srtp_bin_class_init (GstErDtlsSrtpBinClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_bin_init (GstErDtlsSrtpBin * self)
|
||||
gst_dtls_srtp_bin_init (GstDtlsSrtpBin * self)
|
||||
{
|
||||
self->key = NULL;
|
||||
self->key_is_set = FALSE;
|
||||
|
@ -135,9 +135,9 @@ gst_er_dtls_srtp_bin_init (GstErDtlsSrtpBin * self)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_bin_finalize (GObject * object)
|
||||
gst_dtls_srtp_bin_finalize (GObject * object)
|
||||
{
|
||||
GstErDtlsSrtpBin *self = GST_ER_DTLS_SRTP_BIN (object);
|
||||
GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
|
||||
|
||||
if (self->key) {
|
||||
gst_buffer_unref (self->key);
|
||||
|
@ -156,11 +156,11 @@ gst_er_dtls_srtp_bin_finalize (GObject * object)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_bin_set_property (GObject * object,
|
||||
gst_dtls_srtp_bin_set_property (GObject * object,
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpBin *self = GST_ER_DTLS_SRTP_BIN (object);
|
||||
GstErDtlsSrtpBinClass *klass = GST_ER_DTLS_SRTP_BIN_GET_CLASS (self);
|
||||
GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
|
||||
GstDtlsSrtpBinClass *klass = GST_DTLS_SRTP_BIN_GET_CLASS (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
@ -205,10 +205,10 @@ gst_er_dtls_srtp_bin_set_property (GObject * object,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_bin_get_property (GObject * object,
|
||||
gst_dtls_srtp_bin_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpBin *self = GST_ER_DTLS_SRTP_BIN (object);
|
||||
GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION_ID:
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_SRTP_BIN (gst_er_dtls_srtp_bin_get_type())
|
||||
#define GST_ER_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_SRTP_BIN, GstErDtlsSrtpBin))
|
||||
#define GST_ER_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_SRTP_BIN, GstErDtlsSrtpBinClass))
|
||||
#define GST_ER_DTLS_SRTP_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_ER_DTLS_SRTP_BIN, GstErDtlsSrtpBinClass))
|
||||
#define GST_IS_ER_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_SRTP_BIN))
|
||||
#define GST_IS_ER_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_SRTP_BIN))
|
||||
#define GST_TYPE_DTLS_SRTP_BIN (gst_dtls_srtp_bin_get_type())
|
||||
#define GST_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBin))
|
||||
#define GST_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBinClass))
|
||||
#define GST_DTLS_SRTP_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBinClass))
|
||||
#define GST_IS_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_BIN))
|
||||
#define GST_IS_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_BIN))
|
||||
|
||||
typedef struct _GstErDtlsSrtpBin GstErDtlsSrtpBin;
|
||||
typedef struct _GstErDtlsSrtpBinClass GstErDtlsSrtpBinClass;
|
||||
typedef struct _GstDtlsSrtpBin GstDtlsSrtpBin;
|
||||
typedef struct _GstDtlsSrtpBinClass GstDtlsSrtpBinClass;
|
||||
|
||||
struct _GstErDtlsSrtpBin {
|
||||
struct _GstDtlsSrtpBin {
|
||||
GstBin bin;
|
||||
|
||||
GstElement *dtls_element;
|
||||
|
@ -53,13 +53,13 @@ struct _GstErDtlsSrtpBin {
|
|||
gchar *srtcp_auth;
|
||||
};
|
||||
|
||||
struct _GstErDtlsSrtpBinClass {
|
||||
struct _GstDtlsSrtpBinClass {
|
||||
GstBinClass parent_class;
|
||||
|
||||
void (*remove_dtls_element)(GstErDtlsSrtpBin *);
|
||||
void (*remove_dtls_element)(GstDtlsSrtpBin *);
|
||||
};
|
||||
|
||||
GType gst_er_dtls_srtp_bin_get_type(void);
|
||||
GType gst_dtls_srtp_bin_get_type(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ GST_STATIC_PAD_TEMPLATE ("data_src",
|
|||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_srtp_dec_debug);
|
||||
#define GST_CAT_DEFAULT er_dtls_srtp_dec_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_dtls_srtp_dec_debug
|
||||
|
||||
#define gst_er_dtls_srtp_dec_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstErDtlsSrtpDec, gst_er_dtls_srtp_dec,
|
||||
GST_TYPE_ER_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (er_dtls_srtp_dec_debug,
|
||||
"erdtlssrtpdec", 0, "Ericsson DTLS Decoder"));
|
||||
#define gst_dtls_srtp_dec_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDec, gst_dtls_srtp_dec,
|
||||
GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_dec_debug,
|
||||
"dtlssrtpdec", 0, "DTLS Decoder"));
|
||||
|
||||
#define UNUSED(param) while (0) { (void)(param); }
|
||||
|
||||
|
@ -72,46 +72,46 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
#define DEFAULT_PEM NULL
|
||||
#define DEFAULT_PEER_PEM NULL
|
||||
|
||||
static void gst_er_dtls_srtp_dec_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_dec_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void gst_er_dtls_srtp_dec_get_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_dec_get_property (GObject *, guint prop_id,
|
||||
GValue *, GParamSpec *);
|
||||
|
||||
static GstPad *gst_er_dtls_srtp_dec_request_new_pad (GstElement *,
|
||||
static GstPad *gst_dtls_srtp_dec_request_new_pad (GstElement *,
|
||||
GstPadTemplate *, const gchar * name, const GstCaps *);
|
||||
static GstCaps *on_decoder_request_key (GstElement * srtp_decoder, guint ssrc,
|
||||
GstErDtlsSrtpBin *);
|
||||
static void on_peer_pem (GstElement * srtp_decoder, GParamSpec * pspec,
|
||||
GstErDtlsSrtpDec * self);
|
||||
static GstCaps *on_decodgst_request_key (GstElement * srtp_decoder, guint ssrc,
|
||||
GstDtlsSrtpBin *);
|
||||
static void on_pegst_pem (GstElement * srtp_decoder, GParamSpec * pspec,
|
||||
GstDtlsSrtpDec * self);
|
||||
|
||||
static void gst_er_dtls_srtp_dec_remove_dtls_element (GstErDtlsSrtpBin *);
|
||||
static GstPadProbeReturn remove_dtls_decoder_probe_callback (GstPad *,
|
||||
static void gst_dtls_srtp_dec_remove_dtls_element (GstDtlsSrtpBin *);
|
||||
static GstPadProbeReturn remove_dtls_decodgst_probe_callback (GstPad *,
|
||||
GstPadProbeInfo *, GstElement *);
|
||||
|
||||
static GstPadProbeReturn drop_funnel_rtcp_caps (GstPad *, GstPadProbeInfo *,
|
||||
gpointer);
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_dec_class_init (GstErDtlsSrtpDecClass * klass)
|
||||
gst_dtls_srtp_dec_class_init (GstDtlsSrtpDecClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstErDtlsSrtpBinClass *dtls_srtp_bin_class;
|
||||
GstDtlsSrtpBinClass *dtls_srtp_bin_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
dtls_srtp_bin_class = (GstErDtlsSrtpBinClass *) klass;
|
||||
dtls_srtp_bin_class = (GstDtlsSrtpBinClass *) klass;
|
||||
|
||||
gobject_class->set_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_dec_set_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_set_property);
|
||||
gobject_class->get_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_dec_get_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_get_property);
|
||||
|
||||
element_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_dec_request_new_pad);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_request_new_pad);
|
||||
|
||||
dtls_srtp_bin_class->remove_dtls_element =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_dec_remove_dtls_element);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_remove_dtls_element);
|
||||
|
||||
properties[PROP_PEM] =
|
||||
g_param_spec_string ("pem",
|
||||
|
@ -142,7 +142,7 @@ gst_er_dtls_srtp_dec_class_init (GstErDtlsSrtpDecClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_dec_init (GstErDtlsSrtpDec * self)
|
||||
gst_dtls_srtp_dec_init (GstDtlsSrtpDec * self)
|
||||
{
|
||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (GST_ELEMENT (self));
|
||||
GstPadTemplate *templ;
|
||||
|
@ -151,7 +151,7 @@ gst_er_dtls_srtp_dec_init (GstErDtlsSrtpDec * self)
|
|||
|
||||
/*
|
||||
+--------------------+
|
||||
+--------------+ .-o| erdtlsdec |o-R----------data
|
||||
+--------------+ .-o| dtlsdec |o-R----------data
|
||||
| dtls|o-' +--------------------+
|
||||
sink---o| dtlsdemux |
|
||||
| srt(c)p|o-. +-----------+ +-----------+
|
||||
|
@ -168,13 +168,12 @@ gst_er_dtls_srtp_dec_init (GstErDtlsSrtpDec * self)
|
|||
return;
|
||||
}
|
||||
self->dtls_srtp_demux =
|
||||
gst_element_factory_make ("erdtlssrtpdemux", "dtls-srtp-demux");
|
||||
gst_element_factory_make ("dtlssrtpdemux", "dtls-srtp-demux");
|
||||
if (!self->dtls_srtp_demux) {
|
||||
GST_ERROR_OBJECT (self, "failed to create dtls_srtp_demux");
|
||||
return;
|
||||
}
|
||||
self->bin.dtls_element =
|
||||
gst_element_factory_make ("erdtlsdec", "dtls-decoder");
|
||||
self->bin.dtls_element = gst_element_factory_make ("dtlsdec", "dtls-decoder");
|
||||
if (!self->bin.dtls_element) {
|
||||
GST_ERROR_OBJECT (self, "failed to create dtls_dec");
|
||||
return;
|
||||
|
@ -229,16 +228,16 @@ gst_er_dtls_srtp_dec_init (GstErDtlsSrtpDec * self)
|
|||
g_return_if_fail (ret);
|
||||
|
||||
g_signal_connect (self->srtp_dec, "request-key",
|
||||
G_CALLBACK (on_decoder_request_key), self);
|
||||
G_CALLBACK (on_decodgst_request_key), self);
|
||||
g_signal_connect (self->bin.dtls_element, "notify::peer-pem",
|
||||
G_CALLBACK (on_peer_pem), self);
|
||||
G_CALLBACK (on_pegst_pem), self);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_dec_set_property (GObject * object,
|
||||
gst_dtls_srtp_dec_set_property (GObject * object,
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpDec *self = GST_ER_DTLS_SRTP_DEC (object);
|
||||
GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PEM:
|
||||
|
@ -254,10 +253,10 @@ gst_er_dtls_srtp_dec_set_property (GObject * object,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_dec_get_property (GObject * object,
|
||||
gst_dtls_srtp_dec_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpDec *self = GST_ER_DTLS_SRTP_DEC (object);
|
||||
GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PEM:
|
||||
|
@ -281,10 +280,10 @@ gst_er_dtls_srtp_dec_get_property (GObject * object,
|
|||
}
|
||||
|
||||
static GstPad *
|
||||
gst_er_dtls_srtp_dec_request_new_pad (GstElement * element,
|
||||
gst_dtls_srtp_dec_request_new_pad (GstElement * element,
|
||||
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
|
||||
{
|
||||
GstErDtlsSrtpDec *self = GST_ER_DTLS_SRTP_DEC (element);
|
||||
GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (element);
|
||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
||||
GstPad *ghost_pad = NULL;
|
||||
gboolean ret;
|
||||
|
@ -321,8 +320,8 @@ gst_er_dtls_srtp_dec_request_new_pad (GstElement * element,
|
|||
}
|
||||
|
||||
static GstCaps *
|
||||
on_decoder_request_key (GstElement * srtp_decoder,
|
||||
guint ssrc, GstErDtlsSrtpBin * bin)
|
||||
on_decodgst_request_key (GstElement * srtp_decoder,
|
||||
guint ssrc, GstDtlsSrtpBin * bin)
|
||||
{
|
||||
GstCaps *key_caps;
|
||||
GstBuffer *key_buffer = NULL;
|
||||
|
@ -364,7 +363,7 @@ on_decoder_request_key (GstElement * srtp_decoder,
|
|||
g_object_get (bin->dtls_element,
|
||||
"srtp-cipher", &cipher, "srtp-auth", &auth, NULL);
|
||||
|
||||
g_return_val_if_fail (cipher == ER_DTLS_SRTP_CIPHER_AES_128_ICM, NULL);
|
||||
g_return_val_if_fail (cipher == GST_DTLS_SRTP_CIPHER_AES_128_ICM, NULL);
|
||||
|
||||
key_caps = gst_caps_new_simple ("application/x-srtp",
|
||||
"srtp-key", GST_TYPE_BUFFER, key_buffer,
|
||||
|
@ -372,12 +371,12 @@ on_decoder_request_key (GstElement * srtp_decoder,
|
|||
"srtcp-cipher", G_TYPE_STRING, "aes-128-icm", NULL);
|
||||
|
||||
switch (auth) {
|
||||
case ER_DTLS_SRTP_AUTH_HMAC_SHA1_32:
|
||||
case GST_DTLS_SRTP_AUTH_HMAC_SHA1_32:
|
||||
gst_caps_set_simple (key_caps,
|
||||
"srtp-auth", G_TYPE_STRING, "hmac-sha1-32",
|
||||
"srtcp-auth", G_TYPE_STRING, "hmac-sha1-32", NULL);
|
||||
break;
|
||||
case ER_DTLS_SRTP_AUTH_HMAC_SHA1_80:
|
||||
case GST_DTLS_SRTP_AUTH_HMAC_SHA1_80:
|
||||
gst_caps_set_simple (key_caps,
|
||||
"srtp-auth", G_TYPE_STRING, "hmac-sha1-80",
|
||||
"srtcp-auth", G_TYPE_STRING, "hmac-sha1-80", NULL);
|
||||
|
@ -394,8 +393,8 @@ on_decoder_request_key (GstElement * srtp_decoder,
|
|||
}
|
||||
|
||||
static void
|
||||
on_peer_pem (GstElement * srtp_decoder, GParamSpec * pspec,
|
||||
GstErDtlsSrtpDec * self)
|
||||
on_pegst_pem (GstElement * srtp_decoder, GParamSpec * pspec,
|
||||
GstDtlsSrtpDec * self)
|
||||
{
|
||||
UNUSED (srtp_decoder);
|
||||
UNUSED (pspec);
|
||||
|
@ -404,9 +403,9 @@ on_peer_pem (GstElement * srtp_decoder, GParamSpec * pspec,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_dec_remove_dtls_element (GstErDtlsSrtpBin * bin)
|
||||
gst_dtls_srtp_dec_remove_dtls_element (GstDtlsSrtpBin * bin)
|
||||
{
|
||||
GstErDtlsSrtpDec *self = GST_ER_DTLS_SRTP_DEC (bin);
|
||||
GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (bin);
|
||||
GstPad *demux_pad;
|
||||
gulong id;
|
||||
|
||||
|
@ -417,7 +416,7 @@ gst_er_dtls_srtp_dec_remove_dtls_element (GstErDtlsSrtpBin * bin)
|
|||
demux_pad = gst_element_get_static_pad (self->dtls_srtp_demux, "dtls_src");
|
||||
|
||||
id = gst_pad_add_probe (demux_pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
(GstPadProbeCallback) remove_dtls_decoder_probe_callback,
|
||||
(GstPadProbeCallback) remove_dtls_decodgst_probe_callback,
|
||||
bin->dtls_element, NULL);
|
||||
g_return_if_fail (id);
|
||||
bin->dtls_element = NULL;
|
||||
|
@ -430,7 +429,7 @@ gst_er_dtls_srtp_dec_remove_dtls_element (GstErDtlsSrtpBin * bin)
|
|||
}
|
||||
|
||||
static GstPadProbeReturn
|
||||
remove_dtls_decoder_probe_callback (GstPad * pad,
|
||||
remove_dtls_decodgst_probe_callback (GstPad * pad,
|
||||
GstPadProbeInfo * info, GstElement * element)
|
||||
{
|
||||
gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
|
||||
|
|
|
@ -32,30 +32,30 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_SRTP_DEC (gst_er_dtls_srtp_dec_get_type())
|
||||
#define GST_ER_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_SRTP_DEC, GstErDtlsSrtpDec))
|
||||
#define GST_ER_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_SRTP_DEC, GstErDtlsSrtpDecClass))
|
||||
#define GST_IS_ER_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_SRTP_DEC))
|
||||
#define GST_IS_ER_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_SRTP_DEC))
|
||||
#define GST_TYPE_DTLS_SRTP_DEC (gst_dtls_srtp_dec_get_type())
|
||||
#define GST_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_DEC, GstDtlsSrtpDec))
|
||||
#define GST_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_DEC, GstDtlsSrtpDecClass))
|
||||
#define GST_IS_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_DEC))
|
||||
#define GST_IS_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_DEC))
|
||||
|
||||
typedef struct _GstErDtlsSrtpDec GstErDtlsSrtpDec;
|
||||
typedef struct _GstErDtlsSrtpDecClass GstErDtlsSrtpDecClass;
|
||||
typedef struct _GstDtlsSrtpDec GstDtlsSrtpDec;
|
||||
typedef struct _GstDtlsSrtpDecClass GstDtlsSrtpDecClass;
|
||||
|
||||
struct _GstErDtlsSrtpDec {
|
||||
GstErDtlsSrtpBin bin;
|
||||
struct _GstDtlsSrtpDec {
|
||||
GstDtlsSrtpBin bin;
|
||||
|
||||
GstElement *dtls_srtp_demux;
|
||||
GstElement *srtp_dec;
|
||||
GstElement *funnel;
|
||||
};
|
||||
|
||||
struct _GstErDtlsSrtpDecClass {
|
||||
GstErDtlsSrtpBinClass parent_class;
|
||||
struct _GstDtlsSrtpDecClass {
|
||||
GstDtlsSrtpBinClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_er_dtls_srtp_dec_get_type(void);
|
||||
GType gst_dtls_srtp_dec_get_type(void);
|
||||
|
||||
gboolean gst_er_dtls_srtp_dec_plugin_init(GstPlugin *);
|
||||
gboolean gst_dtls_srtp_dec_plugin_init(GstPlugin *);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -52,18 +52,18 @@ GST_STATIC_PAD_TEMPLATE ("dtls_src",
|
|||
GST_STATIC_CAPS ("application/x-dtls")
|
||||
);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (er_er_dtls_srtp_demux_debug);
|
||||
#define GST_CAT_DEFAULT er_er_dtls_srtp_demux_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_gst_dtls_srtp_demux_debug);
|
||||
#define GST_CAT_DEFAULT gst_gst_dtls_srtp_demux_debug
|
||||
|
||||
#define gst_er_dtls_srtp_demux_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstErDtlsSrtpDemux, gst_er_dtls_srtp_demux,
|
||||
GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (er_er_dtls_srtp_demux_debug,
|
||||
"erdtlssrtpdemux", 0, "Ericsson DTLS SRTP Demultiplexer"));
|
||||
#define gst_dtls_srtp_demux_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDemux, gst_dtls_srtp_demux,
|
||||
GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_gst_dtls_srtp_demux_debug,
|
||||
"dtlssrtpdemux", 0, "DTLS SRTP Demultiplexer"));
|
||||
|
||||
static GstFlowReturn sink_chain (GstPad *, GstObject * self, GstBuffer *);
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_demux_class_init (GstErDtlsSrtpDemuxClass * klass)
|
||||
gst_dtls_srtp_demux_class_init (GstDtlsSrtpDemuxClass * klass)
|
||||
{
|
||||
GstElementClass *element_class;
|
||||
|
||||
|
@ -84,7 +84,7 @@ gst_er_dtls_srtp_demux_class_init (GstErDtlsSrtpDemuxClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_demux_init (GstErDtlsSrtpDemux * self)
|
||||
gst_dtls_srtp_demux_init (GstDtlsSrtpDemux * self)
|
||||
{
|
||||
GstPad *sink;
|
||||
|
||||
|
@ -107,7 +107,7 @@ gst_er_dtls_srtp_demux_init (GstErDtlsSrtpDemux * self)
|
|||
static GstFlowReturn
|
||||
sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
GstErDtlsSrtpDemux *self = GST_ER_DTLS_SRTP_DEMUX (parent);
|
||||
GstDtlsSrtpDemux *self = GST_DTLS_SRTP_DEMUX (parent);
|
||||
guint8 first_byte;
|
||||
|
||||
if (gst_buffer_get_size (buffer) == 0) {
|
||||
|
|
|
@ -30,34 +30,34 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_SRTP_DEMUX \
|
||||
(gst_er_dtls_srtp_demux_get_type())
|
||||
#define GST_ER_DTLS_SRTP_DEMUX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_SRTP_DEMUX, GstErDtlsSrtpDemux))
|
||||
#define GST_ER_DTLS_SRTP_DEMUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_SRTP_DEMUX, GstErDtlsSrtpDemuxClass))
|
||||
#define GST_IS_ER_DTLS_SRTP_DEMUX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_SRTP_DEMUX))
|
||||
#define GST_IS_ER_DTLS_SRTP_DEMUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_SRTP_DEMUX))
|
||||
#define GST_TYPE_DTLS_SRTP_DEMUX \
|
||||
(gst_dtls_srtp_demux_get_type())
|
||||
#define GST_DTLS_SRTP_DEMUX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_DEMUX, GstDtlsSrtpDemux))
|
||||
#define GST_DTLS_SRTP_DEMUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_DEMUX, GstDtlsSrtpDemuxClass))
|
||||
#define GST_IS_DTLS_SRTP_DEMUX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_DEMUX))
|
||||
#define GST_IS_DTLS_SRTP_DEMUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_DEMUX))
|
||||
|
||||
typedef struct _GstErDtlsSrtpDemux GstErDtlsSrtpDemux;
|
||||
typedef struct _GstErDtlsSrtpDemuxClass GstErDtlsSrtpDemuxClass;
|
||||
typedef struct _GstDtlsSrtpDemux GstDtlsSrtpDemux;
|
||||
typedef struct _GstDtlsSrtpDemuxClass GstDtlsSrtpDemuxClass;
|
||||
|
||||
struct _GstErDtlsSrtpDemux {
|
||||
struct _GstDtlsSrtpDemux {
|
||||
GstElement element;
|
||||
|
||||
GstPad *rtp_src;
|
||||
GstPad *dtls_src;
|
||||
};
|
||||
|
||||
struct _GstErDtlsSrtpDemuxClass {
|
||||
struct _GstDtlsSrtpDemuxClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_er_dtls_srtp_demux_get_type(void);
|
||||
GType gst_dtls_srtp_demux_get_type(void);
|
||||
|
||||
gboolean gst_er_dtls_srtp_demux_plugin_init(GstPlugin *);
|
||||
gboolean gst_dtls_srtp_demux_plugin_init(GstPlugin *);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (er_dtls_srtp_enc_debug);
|
||||
#define GST_CAT_DEFAULT er_dtls_srtp_enc_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_enc_debug);
|
||||
#define GST_CAT_DEFAULT gst_dtls_srtp_enc_debug
|
||||
|
||||
#define gst_er_dtls_srtp_enc_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstErDtlsSrtpEnc, gst_er_dtls_srtp_enc,
|
||||
GST_TYPE_ER_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (er_dtls_srtp_enc_debug,
|
||||
"erdtlssrtpenc", 0, "Ericsson DTLS Decoder"));
|
||||
#define gst_dtls_srtp_enc_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpEnc, gst_dtls_srtp_enc,
|
||||
GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_enc_debug,
|
||||
"dtlssrtpenc", 0, "DTLS Decoder"));
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -86,43 +86,43 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||
static gboolean transform_enum (GBinding *, const GValue * source_value,
|
||||
GValue * target_value, GEnumClass *);
|
||||
|
||||
static void gst_er_dtls_srtp_enc_set_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_enc_set_property (GObject *, guint prop_id,
|
||||
const GValue *, GParamSpec *);
|
||||
static void gst_er_dtls_srtp_enc_get_property (GObject *, guint prop_id,
|
||||
static void gst_dtls_srtp_enc_get_property (GObject *, guint prop_id,
|
||||
GValue *, GParamSpec *);
|
||||
|
||||
static GstPad *add_ghost_pad (GstElement *, const gchar * name, GstPad *,
|
||||
GstPadTemplate *);
|
||||
static GstPad *gst_er_dtls_srtp_enc_request_new_pad (GstElement *,
|
||||
static GstPad *gst_dtls_srtp_enc_request_new_pad (GstElement *,
|
||||
GstPadTemplate *, const gchar * name, const GstCaps *);
|
||||
|
||||
static void on_key_received (GObject * encoder, GstErDtlsSrtpEnc *);
|
||||
static void on_key_received (GObject * encoder, GstDtlsSrtpEnc *);
|
||||
|
||||
static void gst_er_dtls_srtp_enc_remove_dtls_element (GstErDtlsSrtpBin *);
|
||||
static GstPadProbeReturn remove_dtls_encoder_probe_callback (GstPad *,
|
||||
static void gst_dtls_srtp_enc_remove_dtls_element (GstDtlsSrtpBin *);
|
||||
static GstPadProbeReturn remove_dtls_encodgst_probe_callback (GstPad *,
|
||||
GstPadProbeInfo *, GstElement *);
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_enc_class_init (GstErDtlsSrtpEncClass * klass)
|
||||
gst_dtls_srtp_enc_class_init (GstDtlsSrtpEncClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstErDtlsSrtpBinClass *dtls_srtp_bin_class;
|
||||
GstDtlsSrtpBinClass *dtls_srtp_bin_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
dtls_srtp_bin_class = (GstErDtlsSrtpBinClass *) klass;
|
||||
dtls_srtp_bin_class = (GstDtlsSrtpBinClass *) klass;
|
||||
|
||||
gobject_class->set_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_enc_set_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_set_property);
|
||||
gobject_class->get_property =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_enc_get_property);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_get_property);
|
||||
|
||||
element_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_enc_request_new_pad);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_request_new_pad);
|
||||
|
||||
dtls_srtp_bin_class->remove_dtls_element =
|
||||
GST_DEBUG_FUNCPTR (gst_er_dtls_srtp_enc_remove_dtls_element);
|
||||
GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_remove_dtls_element);
|
||||
|
||||
signals[SIGNAL_ON_KEY_SET] =
|
||||
g_signal_new ("on-key-set", G_TYPE_FROM_CLASS (klass),
|
||||
|
@ -156,7 +156,7 @@ gst_er_dtls_srtp_enc_class_init (GstErDtlsSrtpEncClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_enc_init (GstErDtlsSrtpEnc * self)
|
||||
gst_dtls_srtp_enc_init (GstDtlsSrtpEnc * self)
|
||||
{
|
||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (GST_ELEMENT (self));
|
||||
static GEnumClass *cipher_enum_class, *auth_enum_class;
|
||||
|
@ -170,7 +170,7 @@ gst_er_dtls_srtp_enc_init (GstErDtlsSrtpEnc * self)
|
|||
+--------------------+ | funnel |o---src
|
||||
| |
|
||||
+--------------------+ | |
|
||||
data_sink-R-o| erdtlsenc |o---o| |
|
||||
data_sink-R-o| dtlsenc |o---o| |
|
||||
+--------------------+ +-----------------+
|
||||
*/
|
||||
|
||||
|
@ -181,8 +181,7 @@ gst_er_dtls_srtp_enc_init (GstErDtlsSrtpEnc * self)
|
|||
return;
|
||||
}
|
||||
g_return_if_fail (self->srtp_enc);
|
||||
self->bin.dtls_element =
|
||||
gst_element_factory_make ("erdtlsenc", "dtls-encoder");
|
||||
self->bin.dtls_element = gst_element_factory_make ("dtlsenc", "dtls-encoder");
|
||||
if (!self->bin.dtls_element) {
|
||||
GST_ERROR_OBJECT (self, "failed to create dtls encoder");
|
||||
return;
|
||||
|
@ -257,10 +256,10 @@ transform_enum (GBinding * binding, const GValue * source_value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_enc_set_property (GObject * object,
|
||||
gst_dtls_srtp_enc_set_property (GObject * object,
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpEnc *self = GST_ER_DTLS_SRTP_ENC (object);
|
||||
GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IS_CLIENT:
|
||||
|
@ -278,10 +277,10 @@ gst_er_dtls_srtp_enc_set_property (GObject * object,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_enc_get_property (GObject * object,
|
||||
gst_dtls_srtp_enc_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstErDtlsSrtpEnc *self = GST_ER_DTLS_SRTP_ENC (object);
|
||||
GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IS_CLIENT:
|
||||
|
@ -319,10 +318,10 @@ add_ghost_pad (GstElement * element,
|
|||
}
|
||||
|
||||
static GstPad *
|
||||
gst_er_dtls_srtp_enc_request_new_pad (GstElement * element,
|
||||
gst_dtls_srtp_enc_request_new_pad (GstElement * element,
|
||||
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
|
||||
{
|
||||
GstErDtlsSrtpEnc *self = GST_ER_DTLS_SRTP_ENC (element);
|
||||
GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (element);
|
||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
||||
GstPad *target_pad;
|
||||
GstPad *ghost_pad = NULL;
|
||||
|
@ -382,9 +381,9 @@ gst_er_dtls_srtp_enc_request_new_pad (GstElement * element,
|
|||
}
|
||||
|
||||
static void
|
||||
on_key_received (GObject * encoder, GstErDtlsSrtpEnc * self)
|
||||
on_key_received (GObject * encoder, GstDtlsSrtpEnc * self)
|
||||
{
|
||||
GstErDtlsSrtpBin *bin = GST_ER_DTLS_SRTP_BIN (self);
|
||||
GstDtlsSrtpBin *bin = GST_DTLS_SRTP_BIN (self);
|
||||
GstBuffer *buffer = NULL;
|
||||
guint cipher, auth;
|
||||
|
||||
|
@ -408,10 +407,10 @@ on_key_received (GObject * encoder, GstErDtlsSrtpEnc * self)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_er_dtls_srtp_enc_remove_dtls_element (GstErDtlsSrtpBin * bin)
|
||||
gst_dtls_srtp_enc_remove_dtls_element (GstDtlsSrtpBin * bin)
|
||||
{
|
||||
GstErDtlsSrtpEnc *self = GST_ER_DTLS_SRTP_ENC (bin);
|
||||
GstPad *dtls_sink_pad, *peer_pad;
|
||||
GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (bin);
|
||||
GstPad *dtls_sink_pad, *pegst_pad;
|
||||
gulong id;
|
||||
guint rtp_cipher = 1, rtcp_cipher = 1, rtp_auth = 1, rtcp_auth = 1;
|
||||
|
||||
|
@ -437,26 +436,26 @@ gst_er_dtls_srtp_enc_remove_dtls_element (GstErDtlsSrtpBin * bin)
|
|||
return;
|
||||
}
|
||||
|
||||
peer_pad = gst_pad_get_peer (dtls_sink_pad);
|
||||
g_return_if_fail (peer_pad);
|
||||
pegst_pad = gst_pad_get_peer (dtls_sink_pad);
|
||||
g_return_if_fail (pegst_pad);
|
||||
gst_object_unref (dtls_sink_pad);
|
||||
dtls_sink_pad = NULL;
|
||||
|
||||
id = gst_pad_add_probe (peer_pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
(GstPadProbeCallback) remove_dtls_encoder_probe_callback,
|
||||
id = gst_pad_add_probe (pegst_pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
(GstPadProbeCallback) remove_dtls_encodgst_probe_callback,
|
||||
bin->dtls_element, NULL);
|
||||
g_return_if_fail (id);
|
||||
bin->dtls_element = NULL;
|
||||
|
||||
gst_pad_push_event (peer_pad,
|
||||
gst_pad_push_event (pegst_pad,
|
||||
gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM,
|
||||
gst_structure_new_empty ("dummy")));
|
||||
|
||||
gst_object_unref (peer_pad);
|
||||
gst_object_unref (pegst_pad);
|
||||
}
|
||||
|
||||
static GstPadProbeReturn
|
||||
remove_dtls_encoder_probe_callback (GstPad * pad,
|
||||
remove_dtls_encodgst_probe_callback (GstPad * pad,
|
||||
GstPadProbeInfo * info, GstElement * element)
|
||||
{
|
||||
gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
|
||||
|
|
|
@ -32,32 +32,32 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ER_DTLS_SRTP_ENC (gst_er_dtls_srtp_enc_get_type())
|
||||
#define GST_ER_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ER_DTLS_SRTP_ENC, GstErDtlsSrtpEnc))
|
||||
#define GST_ER_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ER_DTLS_SRTP_ENC, GstErDtlsSrtpEncClass))
|
||||
#define GST_IS_ER_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ER_DTLS_SRTP_ENC))
|
||||
#define GST_IS_ER_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ER_DTLS_SRTP_ENC))
|
||||
#define GST_TYPE_DTLS_SRTP_ENC (gst_dtls_srtp_enc_get_type())
|
||||
#define GST_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_ENC, GstDtlsSrtpEnc))
|
||||
#define GST_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_ENC, GstDtlsSrtpEncClass))
|
||||
#define GST_IS_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_ENC))
|
||||
#define GST_IS_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_ENC))
|
||||
|
||||
typedef struct _GstErDtlsSrtpEnc GstErDtlsSrtpEnc;
|
||||
typedef struct _GstErDtlsSrtpEncClass GstErDtlsSrtpEncClass;
|
||||
typedef struct _GstDtlsSrtpEnc GstDtlsSrtpEnc;
|
||||
typedef struct _GstDtlsSrtpEncClass GstDtlsSrtpEncClass;
|
||||
|
||||
struct _GstErDtlsSrtpEnc {
|
||||
GstErDtlsSrtpBin bin;
|
||||
struct _GstDtlsSrtpEnc {
|
||||
GstDtlsSrtpBin bin;
|
||||
|
||||
GstElement *srtp_enc;
|
||||
GstElement *funnel;
|
||||
};
|
||||
|
||||
struct _GstErDtlsSrtpEncClass {
|
||||
GstErDtlsSrtpBinClass parent_class;
|
||||
struct _GstDtlsSrtpEncClass {
|
||||
GstDtlsSrtpBinClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_er_dtls_srtp_enc_get_type(void);
|
||||
GType gst_dtls_srtp_enc_get_type(void);
|
||||
|
||||
gboolean gst_er_dtls_srtp_enc_plugin_init(GstPlugin *);
|
||||
gboolean gst_dtls_srtp_enc_plugin_init(GstPlugin *);
|
||||
|
||||
guint gst_er_dtls_srtp_enc_get_cipher_value_by_nick(const gchar *cipher_nick);
|
||||
guint gst_er_dtls_srtp_enc_get_auth_value_by_nick(const gchar *auth_nick);
|
||||
guint gst_dtls_srtp_enc_get_ciphgst_value_by_nick(const gchar *ciphgst_nick);
|
||||
guint gst_dtls_srtp_enc_get_auth_value_by_nick(const gchar *auth_nick);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -38,33 +38,20 @@
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "erdtlsenc", GST_RANK_NONE,
|
||||
GST_TYPE_ER_DTLS_ENC)
|
||||
&& gst_element_register (plugin, "erdtlsdec", GST_RANK_NONE,
|
||||
GST_TYPE_ER_DTLS_DEC)
|
||||
&& gst_element_register (plugin, "erdtlssrtpdec", GST_RANK_NONE,
|
||||
GST_TYPE_ER_DTLS_SRTP_DEC)
|
||||
&& gst_element_register (plugin, "erdtlssrtpenc", GST_RANK_NONE,
|
||||
GST_TYPE_ER_DTLS_SRTP_ENC)
|
||||
&& gst_element_register (plugin, "erdtlssrtpdemux", GST_RANK_NONE,
|
||||
GST_TYPE_ER_DTLS_SRTP_DEMUX);
|
||||
return gst_element_register (plugin, "dtlsenc", GST_RANK_NONE,
|
||||
GST_TYPE_DTLS_ENC)
|
||||
&& gst_element_register (plugin, "dtlsdec", GST_RANK_NONE,
|
||||
GST_TYPE_DTLS_DEC)
|
||||
&& gst_element_register (plugin, "dtlssrtpdec", GST_RANK_NONE,
|
||||
GST_TYPE_DTLS_SRTP_DEC)
|
||||
&& gst_element_register (plugin, "dtlssrtpenc", GST_RANK_NONE,
|
||||
GST_TYPE_DTLS_SRTP_ENC)
|
||||
&& gst_element_register (plugin, "dtlssrtpdemux", GST_RANK_NONE,
|
||||
GST_TYPE_DTLS_SRTP_DEMUX);
|
||||
}
|
||||
|
||||
/* PACKAGE: this is usually set by autotools depending on some _INIT macro
|
||||
* in configure.ac and then written into and defined in config.h, but we can
|
||||
* just set it ourselves here in case someone doesn't use autotools to
|
||||
* compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
|
||||
*/
|
||||
#ifndef PACKAGE
|
||||
#define PACKAGE "erdtls"
|
||||
#endif
|
||||
|
||||
/* gstreamer looks for this structure to register plugins
|
||||
*/
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
erdtls,
|
||||
"Ericsson DTLS decoder and encoder plugins",
|
||||
plugin_init,
|
||||
PACKAGE_VERSION,
|
||||
"BSD", "OpenWebRTC GStreamer plugins", "http://www.openwebrtc.io/")
|
||||
dtls,
|
||||
"DTLS decoder and encoder plugins",
|
||||
plugin_init, PACKAGE_VERSION, "BSD", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
||||
|
|
Loading…
Reference in a new issue