static struct _elements_entry _elements[] = {
{ "fakesrc", gst_fakesrc_get_type, &gst_fakesrc_details, gst_fakesrc_factory_init },
- { "fakesink", gst_fakesink_get_type, &gst_fakesink_details, NULL },
+ { "fakesink", gst_fakesink_get_type, &gst_fakesink_details, gst_fakesink_factory_init },
{ "disksrc", gst_disksrc_get_type, &gst_disksrc_details, NULL },
{ "disksink", gst_disksink_get_type, &gst_disksink_details, NULL },
{ "identity", gst_identity_get_type, &gst_identity_details, NULL },
ARG_SILENT,
};
+GST_PADTEMPLATE_FACTORY (fakesink_sink_factory,
+ "sink%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ NULL /* no caps */
+);
+
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
static void gst_fakesink_init (GstFakeSink *fakesink);
+static GstPad* gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ);
+
static void gst_fakesink_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_fakesink_get_property (GObject *object, guint prop_id,
gst_fakesink_class_init (GstFakeSinkClass *klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
+ gstelement_class = (GstElementClass*)klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
G_TYPE_POINTER);
- gobject_class->set_property = gst_fakesink_set_property;
- gobject_class->get_property = gst_fakesink_get_property;
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
+
+ gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad);
}
static void
GstPad *pad;
pad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (fakesink), pad);
- gst_pad_set_chain_function (pad, gst_fakesink_chain);
+ gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
fakesink->sinkpads = g_slist_prepend (NULL, pad);
fakesink->numsinkpads = 1;
fakesink->silent = FALSE;
}
+static GstPad*
+gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ)
+{
+ gchar *name;
+ GstPad *sinkpad;
+ GstFakeSink *fakesink;
+
+ g_return_val_if_fail (GST_IS_FAKESINK (element), NULL);
+
+ if (templ->direction != GST_PAD_SINK) {
+ g_warning ("gstfakesink: request new pad that is not a SINK pad\n");
+ return NULL;
+ }
+
+ fakesink = GST_FAKESINK (element);
+
+ name = g_strdup_printf ("sink%d", fakesink->numsinkpads);
+
+ sinkpad = gst_pad_new_from_template (templ, name);
+ gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
+
+ fakesink->sinkpads = g_slist_prepend (fakesink->sinkpads, sinkpad);
+ fakesink->numsinkpads++;
+
+ return sinkpad;
+}
+
static void
gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
gst_buffer_unref (buf);
}
+
+gboolean
+gst_fakesink_factory_init (GstElementFactory *factory)
+{
+ gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (fakesink_sink_factory));
+
+ return TRUE;
+}
+
GType gst_fakesink_get_type(void);
+gboolean gst_fakesink_factory_init (GstElementFactory *factory);
#ifdef __cplusplus
}
static struct _elements_entry _elements[] = {
{ "fakesrc", gst_fakesrc_get_type, &gst_fakesrc_details, gst_fakesrc_factory_init },
- { "fakesink", gst_fakesink_get_type, &gst_fakesink_details, NULL },
+ { "fakesink", gst_fakesink_get_type, &gst_fakesink_details, gst_fakesink_factory_init },
{ "disksrc", gst_disksrc_get_type, &gst_disksrc_details, NULL },
{ "disksink", gst_disksink_get_type, &gst_disksink_details, NULL },
{ "identity", gst_identity_get_type, &gst_identity_details, NULL },
ARG_SILENT,
};
+GST_PADTEMPLATE_FACTORY (fakesink_sink_factory,
+ "sink%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ NULL /* no caps */
+);
+
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
static void gst_fakesink_init (GstFakeSink *fakesink);
+static GstPad* gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ);
+
static void gst_fakesink_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_fakesink_get_property (GObject *object, guint prop_id,
gst_fakesink_class_init (GstFakeSinkClass *klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
+ gstelement_class = (GstElementClass*)klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
G_TYPE_POINTER);
- gobject_class->set_property = gst_fakesink_set_property;
- gobject_class->get_property = gst_fakesink_get_property;
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
+
+ gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad);
}
static void
GstPad *pad;
pad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (fakesink), pad);
- gst_pad_set_chain_function (pad, gst_fakesink_chain);
+ gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
fakesink->sinkpads = g_slist_prepend (NULL, pad);
fakesink->numsinkpads = 1;
fakesink->silent = FALSE;
}
+static GstPad*
+gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ)
+{
+ gchar *name;
+ GstPad *sinkpad;
+ GstFakeSink *fakesink;
+
+ g_return_val_if_fail (GST_IS_FAKESINK (element), NULL);
+
+ if (templ->direction != GST_PAD_SINK) {
+ g_warning ("gstfakesink: request new pad that is not a SINK pad\n");
+ return NULL;
+ }
+
+ fakesink = GST_FAKESINK (element);
+
+ name = g_strdup_printf ("sink%d", fakesink->numsinkpads);
+
+ sinkpad = gst_pad_new_from_template (templ, name);
+ gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
+
+ fakesink->sinkpads = g_slist_prepend (fakesink->sinkpads, sinkpad);
+ fakesink->numsinkpads++;
+
+ return sinkpad;
+}
+
static void
gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
gst_buffer_unref (buf);
}
+
+gboolean
+gst_fakesink_factory_init (GstElementFactory *factory)
+{
+ gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (fakesink_sink_factory));
+
+ return TRUE;
+}
+
GType gst_fakesink_get_type(void);
+gboolean gst_fakesink_factory_init (GstElementFactory *factory);
#ifdef __cplusplus
}