Improve introspection

Add instrospection of client and source-output.
Add properties to source-output and to CreateSourceOutput/Input
Add helper to fill properties of context.
Add client-name to pinossrc and pinossink
Improve test-subscribe to show all new introspection details.
This commit is contained in:
Wim Taymans 2015-07-28 17:05:03 +02:00
parent 85e09e7a5b
commit 13d846ec38
21 changed files with 684 additions and 72 deletions

View file

@ -190,17 +190,6 @@ enum
PROP_LAST
};
static gchar *
pinos_client_name (void)
{
const char *c;
if ((c = g_get_application_name ()))
return g_strdup (c);
else
return g_strdup_printf ("GStreamer-pid-%lu", (gulong) getpid ());
}
static GstDevice *
new_source (const PinosSourceInfo *info)
{

View file

@ -51,7 +51,7 @@ GST_DEBUG_CATEGORY_STATIC (pinos_sink_debug);
enum
{
PROP_0,
PROP_LAST
PROP_CLIENT_NAME
};
@ -85,6 +85,17 @@ static GstFlowReturn gst_pinos_sink_render (GstBaseSink * psink,
static gboolean gst_pinos_sink_start (GstBaseSink * basesink);
static gboolean gst_pinos_sink_stop (GstBaseSink * basesink);
static void
gst_pinos_sink_finalize (GObject * object)
{
GstPinosSink *pinossink = GST_PINOS_SINK (object);
g_object_unref (pinossink->allocator);
g_free (pinossink->client_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_pinos_sink_class_init (GstPinosSinkClass * klass)
{
@ -96,9 +107,19 @@ gst_pinos_sink_class_init (GstPinosSinkClass * klass)
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
gobject_class->finalize = gst_pinos_sink_finalize;
gobject_class->set_property = gst_pinos_sink_set_property;
gobject_class->get_property = gst_pinos_sink_get_property;
g_object_class_install_property (gobject_class,
PROP_CLIENT_NAME,
g_param_spec_string ("client-name",
"Client Name",
"The client name to use (NULL = default)",
NULL,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
gstelement_class->change_state = gst_pinos_sink_change_state;
gst_element_class_set_static_metadata (gstelement_class,
@ -123,6 +144,7 @@ static void
gst_pinos_sink_init (GstPinosSink * sink)
{
sink->allocator = gst_tmpfile_allocator_new ();
sink->client_name = pinos_client_name();
}
static GstCaps *
@ -172,7 +194,14 @@ static void
gst_pinos_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstPinosSink *pinossink = GST_PINOS_SINK (object);
switch (prop_id) {
case PROP_CLIENT_NAME:
g_free (pinossink->client_name);
pinossink->client_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -183,7 +212,13 @@ static void
gst_pinos_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstPinosSink *pinossink = GST_PINOS_SINK (object);
switch (prop_id) {
case PROP_CLIENT_NAME:
g_value_set_string (value, pinossink->client_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -52,6 +52,7 @@ struct _GstPinosSink {
GstBaseSink element;
/*< private >*/
gchar *client_name;
/* video state */
gboolean negotiated;

View file

@ -50,7 +50,8 @@ GST_DEBUG_CATEGORY_STATIC (pinos_src_debug);
enum
{
PROP_0,
PROP_PATH
PROP_PATH,
PROP_CLIENT_NAME,
};
@ -91,6 +92,11 @@ gst_pinos_src_set_property (GObject * object, guint prop_id,
pinossrc->path = g_value_dup_string (value);
break;
case PROP_CLIENT_NAME:
g_free (pinossrc->client_name);
pinossrc->client_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -108,6 +114,10 @@ gst_pinos_src_get_property (GObject * object, guint prop_id,
g_value_set_string (value, pinossrc->path);
break;
case PROP_CLIENT_NAME:
g_value_set_string (value, pinossrc->client_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -121,6 +131,7 @@ gst_pinos_src_finalize (GObject * object)
g_object_unref (pinossrc->fd_allocator);
g_free (pinossrc->path);
g_free (pinossrc->client_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -151,6 +162,14 @@ gst_pinos_src_class_init (GstPinosSrcClass * klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_CLIENT_NAME,
g_param_spec_string ("client-name",
"Client Name",
"The client name to use (NULL = default)",
NULL,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
gstelement_class->change_state = gst_pinos_src_change_state;
@ -181,6 +200,7 @@ gst_pinos_src_init (GstPinosSrc * src)
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
src->fd_allocator = gst_fd_allocator_new ();
src->client_name = pinos_client_name ();
}
static GstCaps *

View file

@ -53,6 +53,7 @@ struct _GstPinosSrc {
/*< private >*/
gchar *path;
gchar *client_name;
gboolean negotiated;