set_property and get_property functions are not called in GstPad
Sudhir
vndkst at yahoo.com
Mon May 5 22:22:21 PDT 2014
Hi stefan,
I have shared code snippet of my plugin. Get and set_property of mysink-pad
is not called.
What could be the reason?
Am I missing any thing in initialization?
/* Defining the element type and setting parent class */
#define gst_mysink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstMySink, gst_mysink, GST_TYPE_ELEMENT,
G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
gst_mysink_child_proxy_init));
static void gst_mysink_class_init (GstMySinkClass * ps_klass)
{
GObjectClass *ps_gobject_class = G_OBJECT_CLASS ( ps_klass);
GST_INFO(" pad class initialization");
//assert(0);
/* Assigning function pointers */
ps_gobject_class->set_property = gst_mysink_set_property;
ps_gobject_class->get_property = gst_mysink_get_property;
/*Install plugin properties here*/
}
static void gst_mysink_get_property (GObject * object, guint prop_id, GValue
* value, GParamSpec * pspec)
{
GstMySink *ps_mysink = gst_mysink (object);
GST_INFO(" pad get property");
switch(prop_id)
{
/*Set property here*/
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void gst_mysink_set_property (GObject * object, guint prop_id, const
GValue * value, GParamSpec * pspec)
{
GstMySink *ps_mysink = gst_mysink (object);
GST_INFO(" pad setting property");
switch(prop_id)
{
/*Set pad property about this */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void gst_mysink_init(GstMySink *ps_mysink)
{
/* set property default values here*/
GST_OBJECT_FLAG_SET (ps_mysink, GST_ELEMENT_FLAG_SINK);
}
//#define gst_mysink_pad_parent_class parent_class_pad
G_DEFINE_TYPE (GstMySinkPad, gst_mysink_pad, GST_TYPE_PAD);
static GstPad* gst_mysink_request_new_pad (GstElement *ps_element,
GstPadTemplate *ps_templ,
const gchar *ps_name, const GstCaps *ps_caps)
{
GstMySinkPad *ps_pad;
GstMySink *ps_mysink = GST_MYSINK(ps_element);
GstPad *pad;
/* Care fully use lock functions */
GST_MYSINK_LOCK (ps_mysink);
ps_pad = (GstMySinkPad *) g_object_new (GST_TYPE_MYSINK_PAD, "name",
ps_name, "direction",
ps_templ->direction, "template", ps_templ, NULL);
pad = GST_PAD(ps_pad);
/*Insert pad to local list*/
gst_element_add_pad (ps_element, pad);
GST_MYSINK_UNLOCK (ps_mysink);
gst_child_proxy_child_added (GST_CHILD_PROXY (GST_MYSINK(ps_element)),
G_OBJECT (ps_pad), GST_OBJECT_NAME (ps_pad));
GST_INFO("pad added %s", GST_PAD_NAME(pad));
GST_MYSINK_LOCK (ps_mysink);
gst_pad_set_activate_function(pad, <Initialization function>);
gst_pad_set_chain_function (pad, <pad chain function>);
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (<Pad event
function>));
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR
(gst_pad_query_default));
GST_MYSINK_UNLOCK (ps_mysink);
return pad;
}
static void gst_mysink_release_pad (GstElement * ps_element, GstPad *
ps_pad)
{
GstMySink *ps_mysink = GST_MYSINK (ps_element);;
GstMySinkPad *ps_mysink_pad = GST_MYSINK_PAD (ps_pad);
[.....]
/*Remove pad from the child */
return;
}
gboolean gst_mysink_register(GstPlugin * ps_plugin)
{
return gst_element_register (ps_plugin, "mysink", GST_RANK_PRIMARY,
GST_TYPE_MYSINK_);
}
static void gst_mysink_pad_class_init (GstMySinkPadClass * ps_klass)
{
GObjectClass *ps_gobject_class = G_OBJECT_CLASS ( ps_klass);
GST_INFO(" pad class initialization");
//assert(0);
/* Assigning function pointers */
ps_gobject_class->set_property = gst_mysink_pad_set_property;
ps_gobject_class->get_property = gst_mysink_pad_get_property;
/*Install plugin properties here*/
}
gboolean gst_mysink_pad_event (GstPad *ps_pad, GstObject *ps_parent,
GstEvent *ps_event)
{
GstMySink *ps_mysink = GST_MYSINK (ps_parent);
gboolean b_res;
switch ((gint)GST_EVENT_TYPE (ps_event))
{
case GST_EVENT_EOS:
GST_INFO("Received EOS event");
/*Handle EOS here
Inform parent about EOS */
b_res = gst_pad_event_default (ps_pad, ps_parent, ps_event);
break;
default:
b_res = gst_pad_event_default (ps_pad, ps_parent, ps_event);
break;
}
return b_res;
}
static void gst_mysink_child_proxy_init (gpointer g_iface, gpointer
iface_data)
{
GstChildProxyInterface *iface = (GstChildProxyInterface *)g_iface;
GST_INFO ("initializing child proxy interface");
iface->get_child_by_index = gst_mysink_child_proxy_get_child_by_index;
iface->get_children_count = gst_mysink_child_proxy_get_children_count;
/*Functions are similar to mixer-pad function */
}
static gboolean gst_mysink_pad_sender_init (GstPad *pad, GstObject *parent)
{
/* Doing initialization here */
return TRUE;
error:
return FALSE;
}
static void gst_mysink_pad_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstMySinkPad *ps_mysink_pad = GST_MYSINK_PAD (object);
GST_INFO(" pad get property");
switch(prop_id)
{
/*Set property here*/
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void gst_mysink_pad_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMySinkPad *ps_mysink_pad = GST_MYSINK_PAD (object);
GST_INFO(" pad setting property");
switch(prop_id)
{
/*Set pad property about this */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void gst_mysink_pad_init(GstMySinkPad *ps_mysink_pad)
{
/* set property default values here*/
}
static GstFlowReturn gst_mysink_pad_chain(GstPad *ps_pad, GstObject
*ps_parent, GstBuffer *ps_input_buf)
{
GstMySinkPad *ps_mysink_pad = GST_MYSINK_PAD(ps_pad);
/* Rendering data here */
return GST_FLOW_OK;
error:
return GST_FLOW_ERROR;
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/set-property-and-get-property-functions-are-not-called-in-GstPad-tp4666672p4666758.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list